1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 /////////////////////////////////////////////////////////////////////////////
26 Custom::Custom(CWnd
* pParent
/*=NULL*/)
27 : CDialog(Custom::IDD
, pParent
)
29 //{{AFX_DATA_INIT(Custom)
30 // NOTE: the ClassWizard will add member initialization here
35 void Custom::DoDataExchange(CDataExchange
* pDX
)
37 CDialog::DoDataExchange(pDX
);
38 //{{AFX_DATA_MAP(Custom)
39 // NOTE: the ClassWizard will add DDX and DDV calls here
44 BEGIN_MESSAGE_MAP(Custom
, CDialog
)
45 //{{AFX_MSG_MAP(Custom)
49 /////////////////////////////////////////////////////////////////////////////
50 // Custom message handlers
52 void Custom::Free(void)
54 // for (int i = 0;i<nButton;i++) delete buttonList[i];
59 // TODO: Add extra validation here
62 CButton
*b
= (CButton
*)GetDlgItem(IDC_OR
);
63 if (b
->GetCheck()) mode
= 0;
68 void Custom::OnCancel()
70 // TODO: Add extra cleanup here
76 LRESULT
Custom::WindowProc(UINT message
, WPARAM wParam
, LPARAM lParam
)
78 // TODO: Add your specialized code here and/or call the base class
79 if (message
==WM_INITDIALOG
)
81 CButton
*b
= (CButton
*)GetDlgItem(IDC_OR
);
85 nButton
= clist
->GetCount()-2;
86 buttonList
= new CButton
[nButton
];
87 staticList
= new CStatic
[nButton
];
89 GetClientRect(&client
);
90 button
.top
= client
.top
+ 15;
91 button
.bottom
= button
.top
+ 15;
92 button
.left
= client
.left
+ 20;
93 button
.right
= client
.right
- 90; //button.left + 15;
94 if (nButton
>4) SetWindowPos(0,0,0,client
.right
- client
.left
,15*2 + (button
.bottom
- button
.top
+ 10)*nButton
+ 10,SWP_NOMOVE
);
95 font
.CreateFont(-10,0,0,0,FW_THIN
,false,false,false,DEFAULT_CHARSET
,OUT_DEFAULT_PRECIS
,CLIP_DEFAULT_PRECIS
,DEFAULT_QUALITY
,FIXED_PITCH
,NULL
);
96 for (int i
= 0;i
<nButton
;i
++)
99 clist
->GetLBText(i
+2,str
);
100 buttonList
[i
].Create(str
,BS_CHECKBOX
,button
,this,i
+10);
101 buttonList
[i
].SetFont(&font
,1);
102 buttonList
[i
].ModifyStyle(0,WS_VISIBLE
);
103 /* RECT st = button; st.left+=20; st.right = client.right - 90; st.top -= 3;
104 staticList[i].Create(str,0,st,this,i+10);
105 staticList[i].ModifyStyle(0,WS_VISIBLE);*/
106 button
.top
+= 10 + 10;
107 button
.bottom
+= 10 + 10;
110 else if (message
==WM_COMMAND
)
112 int button
= LOWORD(wParam
)-10;
113 if (button
>=0 && button
<=(nButton
))
115 buttonList
[button
].SetCheck(buttonList
[button
].GetCheck()==0?1:0);
117 for (int i
= 0;i
<button
;i
++) add2flag
<<=1;
118 if (buttonList
[button
].GetCheck()) flag
|=add2flag
;
122 return CDialog::WindowProc(message
, wParam
, lParam
);