-
Notifications
You must be signed in to change notification settings - Fork 0
/
COptionsDlg.h
160 lines (142 loc) · 3.84 KB
/
COptionsDlg.h
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#pragma once
#include "stdafx.h"
#include "resource.h"
#include "IFontOptions.h"
// bool to button state
#ifndef BOOL2BST
#define BOOL2BST(iState,bSet) (iState =( bSet ? BST_CHECKED : BST_UNCHECKED ) )
#endif
#ifndef BST2BOOL
#define BST2BOOL(iState,bSet) ( bSet = ( iState == BST_CHECKED ) )
#endif
class COptionsDlgPage: public CPropertyPageImpl<COptionsDlgPage>,
public CWinDataExchange<COptionsDlgPage>
{
typedef CPropertyPageImpl<COptionsDlgPage> _baseClass;
public:
// DECLARE_WND_CLASS(_T("NO5OptionsDlg"));
bool m_bAllowCTCP;
int m_iAllowCTCP;
CString m_userinfo;
int m_iPingPong;
bool m_bPingPong;
public:
COptionsDlgPage():_baseClass(_T("CTCP"))
{
m_bAllowCTCP = false;
m_iAllowCTCP = BST_UNCHECKED;
m_iPingPong = BST_CHECKED;
m_bPingPong = true;
//BOOL2BST(m_iAllowCTCP,m_bAllowCTCP);
}
enum { IDD = IDD_PROPPAGE_SMALL };
BEGIN_DDX_MAP(COptionsDlgPage)
DDX_CHECK(IDC_CHECK1, m_iAllowCTCP)
DDX_TEXT(IDC_EDIT1, m_userinfo)
DDX_CHECK(IDC_CHECK2,m_iPingPong)
END_DDX_MAP()
BEGIN_MSG_MAP(COptionsDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDC_CHECK1, OnCheck)
COMMAND_ID_HANDLER(IDC_CHECK2, OnCheck)
COMMAND_CODE_HANDLER(EN_CHANGE,OnEditChange)
//FORWARD_NOTIFICATIONS();
CHAIN_MSG_MAP(_baseClass)
//CHAIN_MSG_MAP(CWinDataExchange<COptionsDlgPage>)
END_MSG_MAP()
LRESULT OnInitDialog(UINT, WPARAM, LPARAM, BOOL& bHandled)
{
BOOL2BST(m_iAllowCTCP, m_bAllowCTCP);
BOOL2BST(m_iPingPong, m_bPingPong);
DoDataExchange(DDX_LOAD);
bHandled = FALSE;
return 0;
}
int OnSetActive()
{
// 0 = allow activate
// -1 = go back that was active
// page ID = jump to page
//DoDataExchange(DDX_LOAD);
return 0;
}
BOOL OnKillActive()
{
// FALSE = allow deactivate
// TRUE = prevent deactivation
//DoDataExchange(DDX_SAVE);
return FALSE;
}
int OnApply()
{
DoDataExchange(DDX_SAVE);
BST2BOOL(m_iAllowCTCP, m_bAllowCTCP);
BST2BOOL(m_iPingPong, m_bPingPong);
return PSNRET_NOERROR;
}
LRESULT OnCheck(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
SetModified();
return 0;
}
LRESULT OnEditChange(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
SetModified();
return 0;
}
};
class CFontOptionsDlgPage : public CPropertyPageImpl<CFontOptionsDlgPage>,
public CWinDataExchange<CFontOptionsDlgPage>
{
typedef CPropertyPageImpl<CFontOptionsDlgPage> _baseClass;
IFontOptions* m_pfo;
CComboBox cb;
CNo5RichEdit m_edit;
IFontOptions* m_pFO;
public:
//DECLARE_WND_CLASS(_T("NO5FontOptionsDlg"));
public:
CFontOptionsDlgPage(IFontOptions *pfo):m_pFO(pfo),_baseClass(_T("font options"))
{
m_pfo = NULL;
CreateFontOptions(&m_pfo);
m_pFO->CopyTo(&m_pfo);
}
virtual ~CFontOptionsDlgPage()
{
DestroyFontOptions(&m_pfo);
}
enum { IDD = IDD_PROPPAGE_SMALL1 };
BEGIN_MSG_MAP(CFontOptionsDlgPage)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_CODE_HANDLER(BN_CLICKED,OnButtonClicked)
COMMAND_HANDLER(IDC_COMBO1,CBN_SELENDOK,OnComboOk)
CHAIN_MSG_MAP(_baseClass)
END_MSG_MAP()
BEGIN_DDX_MAP(CFontOptionsDlgPage)
END_DDX_MAP()
LRESULT OnInitDialog(UINT, WPARAM, LPARAM, BOOL& bHandled);
int OnSetActive()
{
// 0 = allow activate
// -1 = go back that was active
// page ID = jump to page
//DoDataExchange(DDX_LOAD);
return 0;
}
BOOL OnKillActive()
{
// FALSE = allow deactivate
// TRUE = prevent deactivation
//DoDataExchange(DDX_SAVE);
return FALSE;
}
int OnApply()
{
DoDataExchange(DDX_SAVE);
m_pfo->CopyTo(&m_pFO);
return PSNRET_NOERROR;
}
LRESULT OnComboOk(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnButtonClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
};