1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//
 
#include "stdafx.h"
#include "ViewRecipeNew.h"
 
 
// CViewRecipeNew ´ëÈ­ »óÀÚÀÔ´Ï´Ù.
 
IMPLEMENT_DYNAMIC(CViewRecipeNew, CDialog)
 
CViewRecipeNew::CViewRecipeNew(CWnd* pParent /*=NULL*/)
    : CDialog(CViewRecipeNew::IDD, pParent)
{
    
}
 
CViewRecipeNew::~CViewRecipeNew()
{
}
 
void CViewRecipeNew::DoDataExchange(CDataExchange* pDX)
{
    DDX_Text(pDX,IDC_EDIT_RECIPENEW_NAME,m_strNewRecipeName);
    DDX_Text(pDX,IDC_EDIT_RECIPENEW_COMMENT,m_strNewRecipeComment);
    
    CDialog::DoDataExchange(pDX);
}
 
 
BEGIN_MESSAGE_MAP(CViewRecipeNew, CDialog)    
    ON_WM_PAINT()
    ON_WM_SHOWWINDOW()
END_MESSAGE_MAP()
 
BEGIN_EVENTSINK_MAP(CViewRecipeNew, CDialog)
    ON_EVENT(CViewRecipeNew, IDC_BTN_RECIPENEW_OK, DISPID_CLICK, CViewRecipeNew::ClickBtnRecipenewOk, VTS_NONE)
    ON_EVENT(CViewRecipeNew, IDC_BTN_RECIPENEW_CANCEL, DISPID_CLICK, CViewRecipeNew::ClickBtnRecipenewCancel, VTS_NONE)
END_EVENTSINK_MAP()
// CViewRecipeNew ¸Þ½ÃÁö Ã³¸®±âÀÔ´Ï´Ù.
 
BOOL CViewRecipeNew::OnInitDialog()
{    
    m_FontControl.SetFont(this,IDC_EDIT_RECIPENEW_NAME,CFontControl::EN_MIDDLEFONT);
    m_FontControl.SetFont(this,IDC_EDIT_RECIPENEW_COMMENT,CFontControl::EN_MIDDLEFONT);
 
    return TRUE;
}
 
void CViewRecipeNew::OnPaint()
{
    CPaintDC dc(this); // device context for painting
    
    CGeneralDraw            pDraw;
    CUIPictureControl        uiTitleRecipeName,uiTitleComment;
 
    uiTitleRecipeName.SetItemDefault(this,IDC_NEWRECIPE_NAME_TITLE);    
    uiTitleRecipeName.m_nFontsize = 24;
    uiTitleRecipeName.m_strData.Format(_T("%s"),_T("New Recipe Name"));
 
    uiTitleComment.SetItemDefault(this,IDC_NEWRECIPE_NAME_TITLE2);    
    uiTitleComment.m_nFontsize = 24;
    uiTitleComment.m_strData.Format(_T("%s"),_T("Comment"));
 
    pDraw.DrawPitureControl(uiTitleRecipeName);
    pDraw.DrawPitureControl(uiTitleComment);
}
 
void CViewRecipeNew::OnShowWindow(BOOL bShow, UINT nStatus)
{
    CDialog::OnShowWindow(bShow, nStatus);
 
    if(bShow == TRUE)
    {
        ((CWnd*)GetDlgItem(IDC_EDIT_RECIPENEW_NAME))->SetFocus();
    }
}
 
 
void CViewRecipeNew::ClickBtnRecipenewOk()
{
    UpdateData(TRUE);
 
    if(m_strNewRecipeName.IsEmpty() == TRUE)
    {
        AfxMessageBox(_T("Input Recipe Name"));
        ((CWnd*)GetDlgItem(IDC_EDIT_RECIPENEW_NAME))->SetFocus();
        return;
    }
 
    OnOK();
}
 
 
void CViewRecipeNew::ClickBtnRecipenewCancel()
{
    OnCancel();
}