Repository navigation
Expand file tree
/
Copy pathCMFCPropertyGridCtrl_Ext.cpp
More file actions
455 lines (411 loc) · 20.2 KB
/
Copy pathCMFCPropertyGridCtrl_Ext.cpp
File metadata and controls
455 lines (411 loc) · 20.2 KB
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
// Copyright © 2010-2013, 2026 Ivyware Pty Ltd, Khrustal & Mann
// MELBOURNE, VICTORIA, AUSTRALIA, 3000
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License.
//
//
// CMFCPropertyGridCtrl extensions, ptototypes and definitions
// NOTES:
//
#include "stdafx.h"
#include "Msgexception.h"
#include "P2Pmsg_Ext.h"
#include "CMFCPropertyGridCtrl_Ext.h"
#include "MFCPropertyGridFontcrxProperty.h"
#include "CFont_Ext.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
/////////////////////////////////////////////////////////////////////////////
// CResourceViewBar
/*void
CMFCPropertyGridCtrl_Init ( )
{
//SetPropListFont();
m_wndPropList.EnableHeaderCtrl(FALSE);
m_wndPropList.EnableDescriptionArea();
m_wndPropList.SetVSDotNetLook();
m_wndPropList.MarkModifiedProperties();
CMFCPropertyGridProperty* pGroup1 = new CMFCPropertyGridProperty(_T("Appearance"));
pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("3D Look"), (_variant_t) false, _T("Specifies the window's font will be non-bold and controls will have a 3D border")));
CMFCPropertyGridProperty* pProp = new CMFCPropertyGridProperty(_T("Border"), _T("Dialog Frame"), _T("One of: None, Thin, Resizable, or Dialog Frame"));
pProp->AddOption(_T("None"));
pProp->AddOption(_T("Thin"));
pProp->AddOption(_T("Resizable"));
pProp->AddOption(_T("Dialog Frame"));
pProp->AllowEdit(FALSE);
pGroup1->AddSubItem(pProp);
pGroup1->AddSubItem(new CMFCPropertyGridProperty(_T("Caption"), (_variant_t) _T("About"), _T("Specifies the text that will be displayed in the window's title bar")));
m_wndPropList.AddProperty(pGroup1);
CMFCPropertyGridProperty* pSize = new CMFCPropertyGridProperty(_T("Window Size"), 0, TRUE);
pProp = new CMFCPropertyGridProperty(_T("Height"), (_variant_t) 250l, _T("Specifies the window's height"));
pProp->EnableSpinControl(TRUE, 50, 300);
pSize->AddSubItem(pProp);
pProp = new CMFCPropertyGridProperty( _T("Width"), (_variant_t) 150l, _T("Specifies the window's width"));
pProp->EnableSpinControl(TRUE, 50, 200);
pSize->AddSubItem(pProp);
m_wndPropList.AddProperty(pSize);
CMFCPropertyGridProperty* pGroup2 = new CMFCPropertyGridProperty(_T("Font"));
LOGFONT lf;
CFont* font = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT));
font->GetLogFont(&lf);
lstrcpy(lf.lfFaceName, L"Arial");
pGroup2->AddSubItem(new CMFCPropertyGridFontProperty(_T("Font"), lf, CF_EFFECTS | CF_SCREENFONTS, _T("Specifies the default font for the window")));
pGroup2->AddSubItem(new CMFCPropertyGridProperty(_T("Use System Font"), (_variant_t) true, _T("Specifies that the window uses MS Shell Dlg font")));
m_wndPropList.AddProperty(pGroup2);
CMFCPropertyGridProperty* pGroup3 = new CMFCPropertyGridProperty(_T("Misc"));
pProp = new CMFCPropertyGridProperty(_T("(Name)"), _T("Application"));
pProp->Enable(FALSE);
pGroup3->AddSubItem(pProp);
CMFCPropertyGridColorProperty* pColorProp = new CMFCPropertyGridColorProperty(_T("Window Color"), RGB(210, 192, 254), NULL, _T("Specifies the default window color"));
pColorProp->EnableOtherButton(_T("Other..."));
pColorProp->EnableAutomaticButton(L"Default", ::GetSysColor(COLOR_3DFACE));
pGroup3->AddSubItem(pColorProp);
static TCHAR BASED_CODE szFilter[] = _T("Icon Files(*.ico)|*.ico|All Files(*.*)|*.*||");
pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(_T("Icon"), TRUE, L"", _T("ico"), 0, szFilter, _T("Specifies the window icon")));
pGroup3->AddSubItem(new CMFCPropertyGridFileProperty(L"Folder", _T("c:\\")));
m_wndPropList.AddProperty(pGroup3);
CMFCPropertyGridProperty* pGroup4 = new CMFCPropertyGridProperty(_T("Hierarchy"));
CMFCPropertyGridProperty* pGroup41 = new CMFCPropertyGridProperty(_T("First sub-level"));
pGroup4->AddSubItem(pGroup41);
CMFCPropertyGridProperty* pGroup411 = new CMFCPropertyGridProperty(_T("Second sub-level"));
pGroup41->AddSubItem(pGroup411);
pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("Item 1"), (_variant_t) _T("Value 1"), _T("This is a description")));
pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("Item 2"), (_variant_t) _T("Value 2"), _T("This is a description")));
pGroup411->AddSubItem(new CMFCPropertyGridProperty(_T("Item 3"), (_variant_t) _T("Value 3"), _T("This is a description")));
pGroup4->Expand(FALSE);
m_wndPropList.AddProperty(pGroup4);
}*/
//
// Appends control with contents of P2PmsgField
// NOTES: Recursive implementation via private function, public
// implementation in successive function
//
// Parameters: CMFCPropertyGridCtrl *pCtrl
// Control to be populated
//
// P3PmsgField *pField
// Grid population Field
//
// CMFCPropertyGridProperty *pGroupParent
// Parent property grid
//
// Returns: BOOL
// Results summary
// 0.. OK
// ?.. Failure, refer P2PeerLast() for further details
//BOOL
//CMFCPropertyGridCtrl_Init ( CMFCPropertyGridProperty *pGroup, P3PmsgField *pField )
CMFCPropertyGridProperty*
CMFCPropertyGridCtrl_CreateGroup ( P3PmsgField *pField )
{
P3Pmsg_fwprintf(stdout,L"----------------------------------------\n");
pField->Print(stdout,2);
// Heading
// NOTES: Passed parent node always assumed to contain heading
CString strGroupname = pField -> c_name();
CString strDescription;
//if ( pField->ATTR.Exists(T_4GRID_TYPE_Typ) &&
// pField->ATTR.SelectItem(T_4GRID_TYPE_Typ).r_data().c_strcmp(T_4GRID_TYPE_HEADING) == 0 )
//{
// strGroupname = pField->ATTR.SelectItem (T_4GRID_TYPE_Lab).r_data().c_wstr();
// strDescription = pField->ATTR.DeclareItem(T_4GRID_TYPE_Dsc,(LPCTSTR)"").r_data().c_wstr();
//}
//CMFCPropertyGridProperty *pGroup = new CMFCPropertyGridProperty ( strGroupname );
// pGroup -> SetDescription ( strDescription );
CMFCPropertyGridProperty *pProp = 0;
// Explore and populate with passed P2Pmsg object contents
P3PmsgAttr oATTR = pField->r_Attr().r_Object();
LPCTSTR lpszPropname = pField->c_name();
if ( oATTR.Exists(T_4GRID_TYPE_Lab) )
lpszPropname = oATTR.SelectItem(T_4GRID_TYPE_Lab).c_wstr();
if ( oATTR.Exists(T_4GRID_TYPE_Dsc) )
strDescription = oATTR.SelectItem(T_4GRID_TYPE_Dsc).c_wstr();
_variant_t var = P2PmsgData_var ( pField->r_data() );
if ( oATTR.Exists(T_4GRID_TYPE_Typ) &&
oATTR.SelectItem(T_4GRID_TYPE_Typ).r_data().c_wcscmp(T_4GRID_TYPE_SPIN) == 0 )
{
int nMin = pField->r_Attr().SelectItem(L"Spin").r_Attr().SelectItem(L"Min").c_int();
int nMax = pField->r_Attr().SelectItem(L"Spin").r_Attr().SelectItem(L"Max").c_int();
pProp -> EnableSpinControl ( TRUE, nMin, nMax );
pProp -> SetData ( pField->GetP2Pos() );
}
else if ( oATTR.Exists(T_4GRID_TYPE_Typ) &&
oATTR.SelectItem(T_4GRID_TYPE_Typ).r_data().c_wcscmp(T_4GRID_TYPE_COLOR) == 0 )
{ // COLOR Property
COLORREF oCOLORREF = pField->r_data().c_uint();
CMFCPropertyGridColorProperty *pColorProp
= new CMFCPropertyGridColorProperty ( lpszPropname, oCOLORREF, NULL, strDescription );
pColorProp -> EnableOtherButton (_T("Other...") );
pColorProp -> EnableAutomaticButton ( L"Default", ::GetSysColor(COLOR_3DFACE));
//pGroup -> AddSubItem(pColorProp);
pColorProp -> SetData ( pField->GetP2Pos() );
}
else if ( oATTR.Exists(T_4GRID_TYPE_Typ) &&
oATTR.SelectItem(T_4GRID_TYPE_Typ).r_data().c_wcscmp(T_4GRID_TYPE_FONT) == 0 )
{ // FONT Property
LOGFONT oLOGFONT;
if ( pField->r_data().c_size() >= sizeof(oLOGFONT) )
memcpy ( &oLOGFONT, pField->c_vBlob(), sizeof(oLOGFONT) );
else
StockObject2LOGFONT ( DEFAULT_GUI_FONT, oLOGFONT, L"Arial" );
//CFont* font = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT));
//font->GetLogFont(&oLOGFONT);
//lstrcpy(oLOGFONT.lfFaceName, L"Arial");
CMFCPropertyGridFontProperty *pFontProp
= new CMFCPropertyGridFontProperty( lpszPropname, oLOGFONT, CF_EFFECTS | CF_SCREENFONTS, strDescription );
pFontProp -> SetData ( pField->GetP2Pos() );
//pGroup -> AddSubItem(pFontProp);
}
else if ( oATTR.Exists(T_4GRID_TYPE_Typ) &&
oATTR.SelectItem(T_4GRID_TYPE_Typ).r_data().c_wcscmp(T_4GRID_TYPE_FONTcrx) == 0 )
{ // FONTcrx Property
LOGFONTcrx oLOGFONTcrx;
if ( pField->r_data().c_size() >= sizeof(oLOGFONTcrx) )
memcpy ( &oLOGFONTcrx, pField->c_vBlob(), sizeof(oLOGFONTcrx) );
else
StockObject2LOGFONT ( DEFAULT_GUI_FONT, oLOGFONTcrx, L"Arial" );
CMFCPropertyGridFontcrxProperty *pFontcrxProp
= new CMFCPropertyGridFontcrxProperty( lpszPropname, oLOGFONTcrx, CF_EFFECTS | CF_SCREENFONTS, strDescription
, 0, oLOGFONTcrx.oCOLORREF );
//pGroup -> AddSubItem(pFontcrxProp);
pFontcrxProp -> SetData ( pField->GetP2Pos() );
}
else if ( oATTR.Exists(T_4GRID_TYPE_Typ) &&
oATTR.SelectItem(T_4GRID_TYPE_Typ).r_data().c_wcscmp(T_4GRID_TYPE_OPTION) == 0 )
{ // OPTION's Property
pProp = new CMFCPropertyGridProperty ( lpszPropname, var, strDescription );
CString strOptions = oATTR.SelectItem(T_4GRID_TYPE_OPTION).c_wstr();
int nToken = 0;
while ( nToken >= 0 && !strOptions.IsEmpty() )
{
CString strOption = strOptions.Tokenize ( _T(";|"), nToken );
if ( strOption.IsEmpty() )
continue;
pProp -> AddOption ( strOption );
strOption.Empty();
}
pProp -> AllowEdit(FALSE);
pProp -> SetData ( pField->GetP2Pos() );
//pGroup -> AddSubItem ( pProp );
}
else if ( oATTR.Exists(T_4GRID_TYPE_Typ) &&
oATTR.SelectItem(T_4GRID_TYPE_Typ).r_data().c_wcscmp(T_4GRID_TYPE_HEADING) == 0 )
{ // HEADING Property
strGroupname = oATTR.SelectItem (T_4GRID_TYPE_Lab).r_data().c_wstr();
strDescription = oATTR.DeclareItem(T_4GRID_TYPE_Dsc,(LPCTSTR)"").r_data().c_wstr();
pProp = new CMFCPropertyGridProperty ( strGroupname );
pProp -> SetDescription ( strDescription );
//pGroup -> AddSubItem ( pProp );
}
else
{
pProp = new CMFCPropertyGridProperty ( lpszPropname, var, strDescription );
pProp -> SetData ( pField->GetP2Pos() );
//pGroup -> AddSubItem ( pProp );
pProp -> SetData ( pField->GetP2Pos() );
}
// Tidy up, and
//pGroup -> AddSubItem ( pGroup );
return pProp;
}
//
// Initialises control with contents of P2PmsgNode
// NOTES: Recursive implementation via private function, public
// implementation in successive function
//
// Parameters: CMFCPropertyGridCtrl *pCtrl
// Control to be populated
//
// P3PmsgNode *pNode
// Grid population node
//
// CMFCPropertyGridProperty *pGroupParent
// Parent property grid
//
// Returns: BOOL
// Results summary
// 0.. OK
// ?.. Failure, refer P2PeerLast() for further details
BOOL
CMFCPropertyGridCtrl_Init ( CMFCPropertyGridCtrl *pCtrl, P3PmsgItem *pItem
, CMFCPropertyGridProperty *pGroupParent )
{
//pNode->Print(stdout,2);
// Heading
// NOTES: Passed parent node always assumed to contain heading
CString strGroupname = pItem -> c_name();
CString strDescription;
if ( pItem->ATTR.Exists(T_4GRID_TYPE_Typ) &&
pItem->ATTR.SelectItem(T_4GRID_TYPE_Typ).r_data().c_wcscmp(T_4GRID_TYPE_HEADING) == 0 )
{
strGroupname = pItem->ATTR.SelectItem (T_4GRID_TYPE_Lab).r_data().c_wstr();
strDescription = pItem->ATTR.DeclareItem(T_4GRID_TYPE_Dsc,(LPCTSTR)"").r_data().c_wstr();
}
CMFCPropertyGridProperty *pGroup = new CMFCPropertyGridProperty ( strGroupname );
pGroup -> SetDescription ( strDescription );
CMFCPropertyGridProperty *pProp = 0;
// Explore and populate with passed P2Pmsg object contents
P3PmsgCurs oCursNode ( *pItem );
for ( int i = 0; oCursNode.Goto(i); i++ )
{
/*if ( oCursNode.IsNode() )
{ // Delegate through to subordinate node
CMFCPropertyGridCtrl_Init ( pCtrl, &oCursNode.r_node(), pGroup );
}
else*/ if ( oCursNode.IsList() )
ASSERT(0);
else if ( oCursNode.IsItem() )
{
P3PmsgAttr oATTR = oCursNode.r_item().r_Attr().r_Object();
LPCTNAM lpszPropname = oCursNode.r_item().c_name();
if ( oATTR.Exists(T_4GRID_TYPE_Lab) )
lpszPropname = oATTR.SelectItem(T_4GRID_TYPE_Lab).c_wstr();
if ( oATTR.Exists(T_4GRID_TYPE_Dsc) )
strDescription = oATTR.SelectItem(T_4GRID_TYPE_Dsc).c_wstr();
_variant_t var = P2PmsgData_var ( oCursNode.r_item().r_data() );
if ( oATTR.Exists(T_4GRID_TYPE_Typ) &&
oATTR.SelectItem(T_4GRID_TYPE_Typ).r_data().c_wcscmp(T_4GRID_TYPE_SPIN) == 0 )
{
int nMin = oCursNode.r_item().r_Attr().SelectItem(L"Spin").r_Attr().SelectItem(L"Min").c_int();
int nMax = oCursNode.r_item().r_Attr().SelectItem(L"Spin").r_Attr().SelectItem(L"Max").c_int();
pProp -> EnableSpinControl ( TRUE, nMin, nMax );
pProp -> SetData ( oCursNode.r_item().GetP2Pos() );
}
else if ( oATTR.Exists(T_4GRID_TYPE_Typ) &&
oATTR.SelectItem(T_4GRID_TYPE_Typ).r_data().c_wcscmp(T_4GRID_TYPE_COLOR) == 0 )
{ // COLOR Property
COLORREF oCOLORREF = oCursNode.r_item().r_data().c_uint();
CMFCPropertyGridColorProperty *pColorProp
= new CMFCPropertyGridColorProperty ( lpszPropname, oCOLORREF, NULL, strDescription );
pColorProp -> EnableOtherButton (_T("Other...") );
pColorProp -> EnableAutomaticButton ( L"Default", ::GetSysColor(COLOR_3DFACE));
pGroup -> AddSubItem(pColorProp);
pColorProp -> SetData ( oCursNode.r_item().GetP2Pos() );
}
else if ( oATTR.Exists(T_4GRID_TYPE_Typ) &&
oATTR.SelectItem(T_4GRID_TYPE_Typ).r_data().c_wcscmp(T_4GRID_TYPE_FONT) == 0 )
{ // FONT Property
LOGFONT oLOGFONT;
if ( oCursNode.r_item().r_data().c_size() >= sizeof(oLOGFONT) )
memcpy ( &oLOGFONT, oCursNode.r_item().c_vBlob(), sizeof(oLOGFONT) );
else
StockObject2LOGFONT ( DEFAULT_GUI_FONT, oLOGFONT, L"Arial" );
//CFont* font = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT));
//font->GetLogFont(&oLOGFONT);
//lstrcpy(oLOGFONT.lfFaceName, L"Arial");
CMFCPropertyGridFontProperty *pFontProp
= new CMFCPropertyGridFontProperty( lpszPropname, oLOGFONT, CF_EFFECTS | CF_SCREENFONTS, strDescription );
pFontProp -> SetData ( oCursNode.r_item().GetP2Pos() );
pGroup -> AddSubItem(pFontProp);
}
else if ( oATTR.Exists(T_4GRID_TYPE_Typ) &&
oATTR.SelectItem(T_4GRID_TYPE_Typ).r_data().c_wcscmp(T_4GRID_TYPE_FONTcrx) == 0 )
{ // FONTcrx Property
LOGFONTcrx oLOGFONTcrx;
if ( oCursNode.r_item().r_data().c_size() >= sizeof(oLOGFONTcrx) )
memcpy ( &oLOGFONTcrx, oCursNode.r_item().c_vBlob(), sizeof(oLOGFONTcrx) );
else
StockObject2LOGFONT ( DEFAULT_GUI_FONT, oLOGFONTcrx, L"Arial" );
CMFCPropertyGridFontcrxProperty *pFontcrxProp
= new CMFCPropertyGridFontcrxProperty( lpszPropname, oLOGFONTcrx, CF_EFFECTS | CF_SCREENFONTS, strDescription
, 0, oLOGFONTcrx.oCOLORREF );
pGroup -> AddSubItem(pFontcrxProp);
pFontcrxProp -> SetData ( oCursNode.r_item().GetP2Pos() );
}
else if ( oATTR.Exists(T_4GRID_TYPE_Typ) &&
oATTR.SelectItem(T_4GRID_TYPE_Typ).r_data().c_wcscmp(T_4GRID_TYPE_OPTION) == 0 )
{ // OPTION's Property
pProp = new CMFCPropertyGridProperty ( lpszPropname, var, strDescription );
CString strOptions = oATTR.SelectItem(T_4GRID_TYPE_OPTION).c_wstr();
int nToken = 0;
while ( nToken >= 0 && !strOptions.IsEmpty() )
{
CString strOption = strOptions.Tokenize ( _T(";|"), nToken );
if ( strOption.IsEmpty() )
continue;
pProp -> AddOption ( strOption );
strOption.Empty();
}
pProp -> AllowEdit(FALSE);
pProp -> SetData ( oCursNode.r_item().GetP2Pos() );
pGroup -> AddSubItem ( pProp );
}
else if ( oATTR.Exists(T_4GRID_TYPE_Typ) &&
oATTR.SelectItem(T_4GRID_TYPE_Typ).r_data().c_wcscmp(T_4GRID_TYPE_HEADING) == 0 )
{ // HEADING Property
strGroupname = oATTR.SelectItem (T_4GRID_TYPE_Lab).r_data().c_wstr();
strDescription = oATTR.DeclareItem(T_4GRID_TYPE_Dsc,(LPCTSTR)"").r_data().c_wstr();
pProp = new CMFCPropertyGridProperty ( strGroupname );
pProp -> SetDescription ( strDescription );
pGroup -> AddSubItem ( pProp );
}
else
{
pProp = new CMFCPropertyGridProperty ( lpszPropname, var, strDescription );
pProp -> SetData ( oCursNode.r_item().GetP2Pos() );
pGroup -> AddSubItem ( pProp );
pProp -> SetData ( oCursNode.r_item().GetP2Pos() );
}
}
else
ASSERT(0);
}
// Tidy up, and
if ( pGroupParent )
pGroupParent -> AddSubItem ( pGroup );
else
pCtrl -> AddProperty ( pGroup );
return TRUE;
}
BOOL
CMFCPropertyGridCtrl_Init ( CMFCPropertyGridCtrl *pCtrl, P3PmsgItem *pItem )
{
// Recursive delegation
return CMFCPropertyGridCtrl_Init ( pCtrl, pItem, 0 );
}
//BOOL
//CMFCPropertyGridCtrl_Init ( CMFCPropertyGridProperty *pGroup, P3PmsgField *pField )
//{
// // Recursive delegation
// return CMFCPropertyGridCtrl_Init ( pGroup, pField );
//}
CMFCPropertyGridProperty*
Create4Grid_HEADING ( LPCSTR lpszHeading, LPCTSTR lpszDescription )
{
CMFCPropertyGridProperty *pGroup = new CMFCPropertyGridProperty ( lpszHeading );
pGroup -> SetDescription ( lpszDescription );
return pGroup;
}
CMFCPropertyGridProperty*
Create4Grid_COLOR ( P3PmsgField& oField, LPCSTR lpszHeading, LPCTSTR lpszDescription )
{
COLORREF oCOLORREF = oField.r_data().c_uint();
CMFCPropertyGridColorProperty *pColorProp
= new CMFCPropertyGridColorProperty ( lpszHeading, oCOLORREF, NULL, lpszDescription );
pColorProp -> EnableOtherButton (_T("Other...") );
pColorProp -> EnableAutomaticButton ( L"Default", ::GetSysColor(COLOR_3DFACE));
pColorProp -> SetData ( oField.GetP2Pos() );
return pColorProp;
}
CMFCPropertyGridProperty*
Create4Grid ( P3PmsgField& oField, LPCSTR lpszHeading, LPCTSTR lpszDescription )
{
_variant_t var = P2PmsgData_var ( oField.r_data() );
CMFCPropertyGridProperty *pProp
= new CMFCPropertyGridProperty ( lpszHeading, var, lpszDescription );
pProp -> SetData ( oField.GetP2Pos() );
return pProp;
}