]> git.saurik.com Git - wxWidgets.git/blob - include/wx/propgrid/propgriddefs.h
Use wxGetTranslation() instead of _() in the public headers.
[wxWidgets.git] / include / wx / propgrid / propgriddefs.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/propgrid/propgriddefs.h
3 // Purpose: wxPropertyGrid miscellaneous definitions
4 // Author: Jaakko Salli
5 // Modified by:
6 // Created: 2008-08-31
7 // Copyright: (c) Jaakko Salli
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_PROPGRID_PROPGRIDDEFS_H_
12 #define _WX_PROPGRID_PROPGRIDDEFS_H_
13
14 #include "wx/defs.h"
15
16 #if wxUSE_PROPGRID
17
18 #include "wx/dynarray.h"
19 #include "wx/vector.h"
20 #include "wx/hashmap.h"
21 #include "wx/variant.h"
22 #include "wx/any.h"
23 #include "wx/longlong.h"
24 #include "wx/clntdata.h"
25
26 // -----------------------------------------------------------------------
27
28 //
29 // Here are some platform dependent defines
30 // NOTE: More in propertygrid.cpp
31 //
32
33 #if defined(__WXMSW__)
34
35 // space between vertical line and value text
36 #define wxPG_XBEFORETEXT 4
37 // space between vertical line and value editor control
38 #define wxPG_XBEFOREWIDGET 1
39
40 // comment to use bitmap buttons
41 #define wxPG_ICON_WIDTH 9
42 // 1 if wxRendererNative should be employed
43 #define wxPG_USE_RENDERER_NATIVE 0
44
45 // Enable tooltips
46 #define wxPG_SUPPORT_TOOLTIPS 1
47
48 // width of optional bitmap/image in front of property
49 #define wxPG_CUSTOM_IMAGE_WIDTH 20
50
51 // 1 if splitter drag detect margin and control cannot overlap
52 #define wxPG_NO_CHILD_EVT_MOTION 0
53
54 #define wxPG_NAT_BUTTON_BORDER_ANY 1
55 #define wxPG_NAT_BUTTON_BORDER_X 1
56 #define wxPG_NAT_BUTTON_BORDER_Y 1
57
58 // If 1 then controls are refreshed explicitly in a few places
59 #define wxPG_REFRESH_CONTROLS 0
60
61 #elif defined(__WXGTK__)
62
63 // space between vertical line and value text
64 #define wxPG_XBEFORETEXT 5
65 // space between vertical line and value editor control
66 #define wxPG_XBEFOREWIDGET 1
67
68 // x position adjustment for wxTextCtrl (and like)
69 // NB: Only define wxPG_TEXTCTRLXADJUST for platforms that do not
70 // (yet) support wxTextEntry::SetMargins() for the left margin.
71 //#define wxPG_TEXTCTRLXADJUST 3
72
73 // comment to use bitmap buttons
74 #define wxPG_ICON_WIDTH 9
75 // 1 if wxRendererNative should be employed
76 #define wxPG_USE_RENDERER_NATIVE 1
77
78 // Enable tooltips
79 #define wxPG_SUPPORT_TOOLTIPS 1
80
81 // width of optional bitmap/image in front of property
82 #define wxPG_CUSTOM_IMAGE_WIDTH 20
83
84 // 1 if splitter drag detect margin and control cannot overlap
85 #define wxPG_NO_CHILD_EVT_MOTION 1
86
87 #define wxPG_NAT_BUTTON_BORDER_ANY 1
88 #define wxPG_NAT_BUTTON_BORDER_X 1
89 #define wxPG_NAT_BUTTON_BORDER_Y 1
90
91 // If 1 then controls are refreshed after selected was drawn.
92 #define wxPG_REFRESH_CONTROLS 1
93
94 #elif defined(__WXMAC__)
95
96 // space between vertical line and value text
97 #define wxPG_XBEFORETEXT 4
98 // space between vertical line and value editor widget
99 #define wxPG_XBEFOREWIDGET 1
100
101 // x position adjustment for wxTextCtrl (and like)
102 #define wxPG_TEXTCTRLXADJUST 0
103
104 // comment to use bitmap buttons
105 #define wxPG_ICON_WIDTH 11
106 // 1 if wxRendererNative should be employed
107 #define wxPG_USE_RENDERER_NATIVE 1
108
109 // Enable tooltips
110 #define wxPG_SUPPORT_TOOLTIPS 1
111
112 // width of optional bitmap/image in front of property
113 #define wxPG_CUSTOM_IMAGE_WIDTH 20
114
115 // 1 if splitter drag detect margin and control cannot overlap
116 #define wxPG_NO_CHILD_EVT_MOTION 0
117
118 #define wxPG_NAT_BUTTON_BORDER_ANY 0
119 #define wxPG_NAT_BUTTON_BORDER_X 0
120 #define wxPG_NAT_BUTTON_BORDER_Y 0
121
122 // If 1 then controls are refreshed after selected was drawn.
123 #define wxPG_REFRESH_CONTROLS 0
124
125 #else // defaults
126
127 // space between vertical line and value text
128 #define wxPG_XBEFORETEXT 5
129 // space between vertical line and value editor widget
130 #define wxPG_XBEFOREWIDGET 1
131
132 // x position adjustment for wxTextCtrl (and like)
133 #define wxPG_TEXTCTRLXADJUST 3
134
135 // comment to use bitmap buttons
136 #define wxPG_ICON_WIDTH 9
137 // 1 if wxRendererNative should be employed
138 #define wxPG_USE_RENDERER_NATIVE 0
139
140 // Enable tooltips
141 #define wxPG_SUPPORT_TOOLTIPS 0
142
143 // width of optional bitmap/image in front of property
144 #define wxPG_CUSTOM_IMAGE_WIDTH 20
145
146 // 1 if splitter drag detect margin and control cannot overlap
147 #define wxPG_NO_CHILD_EVT_MOTION 1
148
149 #define wxPG_NAT_BUTTON_BORDER_ANY 0
150 #define wxPG_NAT_BUTTON_BORDER_X 0
151 #define wxPG_NAT_BUTTON_BORDER_Y 0
152
153 // If 1 then controls are refreshed after selected was drawn.
154 #define wxPG_REFRESH_CONTROLS 0
155 #endif // platform
156
157
158 #define wxPG_CONTROL_MARGIN 0 // space between splitter and control
159
160 #define wxCC_CUSTOM_IMAGE_MARGIN1 4 // before image
161 #define wxCC_CUSTOM_IMAGE_MARGIN2 5 // after image
162
163 #define DEFAULT_IMAGE_OFFSET_INCREMENT \
164 (wxCC_CUSTOM_IMAGE_MARGIN1 + wxCC_CUSTOM_IMAGE_MARGIN2)
165
166 #define wxPG_DRAG_MARGIN 30
167
168 #if wxPG_NO_CHILD_EVT_MOTION
169 #define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
170 #define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
171 #else
172 #define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
173 #define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
174 #endif
175
176 // Use this macro to generate standard custom image height from
177 #define wxPG_STD_CUST_IMAGE_HEIGHT(LINEHEIGHT) (LINEHEIGHT-3)
178
179
180 #if defined(__WXWINCE__)
181 #define wxPG_SMALL_SCREEN 1
182 #else
183 #define wxPG_SMALL_SCREEN 0
184 #endif
185
186
187 // Undefine wxPG_ICON_WIDTH to use supplied xpm bitmaps instead
188 // (for tree buttons)
189 //#undef wxPG_ICON_WIDTH
190
191 #if WXWIN_COMPATIBILITY_2_6 || WXWIN_COMPATIBILITY_2_8
192 #define wxPG_COMPATIBILITY_1_4 1
193 #else
194 #define wxPG_COMPATIBILITY_1_4 0
195 #endif
196
197 // Need to force disable tooltips?
198 #if !wxUSE_TOOLTIPS
199 #undef wxPG_SUPPORT_TOOLTIPS
200 #define wxPG_SUPPORT_TOOLTIPS 0
201 #endif
202
203 // Set 1 to include advanced properties (wxFontProperty, wxColourProperty, etc.)
204 #ifndef wxPG_INCLUDE_ADVPROPS
205 #define wxPG_INCLUDE_ADVPROPS 1
206 #endif
207
208 // Set 1 to include checkbox editor class
209 #define wxPG_INCLUDE_CHECKBOX 1
210
211 // -----------------------------------------------------------------------
212
213
214 class wxPGEditor;
215 class wxPGProperty;
216 class wxPropertyCategory;
217 class wxPGChoices;
218 class wxPropertyGridPageState;
219 class wxPGCell;
220 class wxPGCellRenderer;
221 class wxPGChoiceEntry;
222 class wxPGPropArgCls;
223 class wxPropertyGridInterface;
224 class wxPropertyGrid;
225 class wxPropertyGridEvent;
226 class wxPropertyGridManager;
227 class wxPGOwnerDrawnComboBox;
228 class wxPGEditorDialogAdapter;
229 class wxPGValidationInfo;
230
231
232 // -----------------------------------------------------------------------
233
234 /** @section propgrid_misc wxPropertyGrid Miscellanous
235
236 This section describes some miscellanous values, types and macros.
237 @{
238 */
239
240 // Used to tell wxPGProperty to use label as name as well
241 #define wxPG_LABEL (*wxPGProperty::sm_wxPG_LABEL)
242
243 // This is the value placed in wxPGProperty::sm_wxPG_LABEL
244 #define wxPG_LABEL_STRING wxS("@!")
245 #define wxPG_NULL_BITMAP wxNullBitmap
246 #define wxPG_COLOUR_BLACK (*wxBLACK)
247
248 /** Convert Red, Green and Blue to a single 32-bit value.
249 */
250 #define wxPG_COLOUR(R,G,B) ((wxUint32)(R+(G<<8)+(B<<16)))
251
252
253 /** If property is supposed to have custom-painted image, then returning
254 this in OnMeasureImage() will usually be enough.
255 */
256 #define wxPG_DEFAULT_IMAGE_SIZE wxSize(-1, -1)
257
258
259 /** This callback function is used for sorting properties.
260
261 Call wxPropertyGrid::SetSortFunction() to set it.
262
263 Sort function should return a value greater than 0 if position of p1 is
264 after p2. So, for instance, when comparing property names, you can use
265 following implementation:
266
267 @code
268 int MyPropertySortFunction(wxPropertyGrid* propGrid,
269 wxPGProperty* p1,
270 wxPGProperty* p2)
271 {
272 return p1->GetBaseName().compare( p2->GetBaseName() );
273 }
274 @endcode
275 */
276 typedef int (*wxPGSortCallback)(wxPropertyGrid* propGrid,
277 wxPGProperty* p1,
278 wxPGProperty* p2);
279
280
281
282 typedef wxString wxPGCachedString;
283
284 /** @}
285 */
286
287 // -----------------------------------------------------------------------
288
289 // Used to indicate wxPGChoices::Add etc that the value is actually not given
290 // by the caller.
291 #define wxPG_INVALID_VALUE INT_MAX
292
293 // -----------------------------------------------------------------------
294
295 WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(wxPGProperty*, wxArrayPGProperty,
296 wxBaseArrayPtrVoid,
297 class WXDLLIMPEXP_PROPGRID);
298
299 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(void*,
300 wxPGHashMapS2P,
301 class WXDLLIMPEXP_PROPGRID);
302
303 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxString,
304 wxPGHashMapS2S,
305 class WXDLLIMPEXP_PROPGRID);
306
307 WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(void*,
308 wxPGHashMapP2P,
309 class WXDLLIMPEXP_PROPGRID);
310
311 WX_DECLARE_HASH_MAP_WITH_DECL(wxInt32,
312 wxInt32,
313 wxIntegerHash,
314 wxIntegerEqual,
315 wxPGHashMapI2I,
316 class WXDLLIMPEXP_PROPGRID);
317
318 // Utility to find if specific item is in a vector. Returns index to
319 // the item, or wxNOT_FOUND if not present.
320 template<typename CONTAINER, typename T>
321 int wxPGFindInVector( CONTAINER vector, const T& item )
322 {
323 for ( unsigned int i=0; i<vector.size(); i++ )
324 {
325 if ( vector[i] == item )
326 return (int) i;
327 }
328 return wxNOT_FOUND;
329 }
330
331 // -----------------------------------------------------------------------
332
333 enum wxPG_GETPROPERTYVALUES_FLAGS
334 {
335
336 /** Flags for wxPropertyGridInterface::GetPropertyValues */
337 wxPG_KEEP_STRUCTURE = 0x00000010,
338
339 /** Flags for wxPropertyGrid::SetPropertyAttribute() etc */
340 wxPG_RECURSE = 0x00000020,
341
342 /** Include attributes for GetPropertyValues. */
343 wxPG_INC_ATTRIBUTES = 0x00000040,
344
345 /** Used when first starting recursion. */
346 wxPG_RECURSE_STARTS = 0x00000080,
347
348 /** Force value change. */
349 wxPG_FORCE = 0x00000100,
350
351 /** Only sort categories and their immediate children.
352 Sorting done by wxPG_AUTO_SORT option uses this.
353 */
354 wxPG_SORT_TOP_LEVEL_ONLY = 0x00000200
355
356 };
357
358 /** Flags for wxPropertyGrid::SetPropertyAttribute() etc */
359 #define wxPG_DONT_RECURSE 0x00000000
360
361 // -----------------------------------------------------------------------
362
363 // Misc argument flags.
364 enum wxPG_MISC_ARG_FLAGS
365 {
366 // Get/Store full value instead of displayed value.
367 wxPG_FULL_VALUE = 0x00000001,
368
369 wxPG_REPORT_ERROR = 0x00000002,
370
371 wxPG_PROPERTY_SPECIFIC = 0x00000004,
372
373 // Get/Store editable value instead of displayed one (should only be
374 // different in the case of common values)
375 wxPG_EDITABLE_VALUE = 0x00000008,
376
377 // Used when dealing with fragments of composite string value
378 wxPG_COMPOSITE_FRAGMENT = 0x00000010,
379
380 // Means property for which final string value is for cannot really be
381 // edited.
382 wxPG_UNEDITABLE_COMPOSITE_FRAGMENT = 0x00000020,
383
384 // ValueToString() called from GetValueAsString()
385 // (guarantees that input wxVariant value is current own value)
386 wxPG_VALUE_IS_CURRENT = 0x00000040,
387
388 // Value is being set programmatically (ie. not by user)
389 wxPG_PROGRAMMATIC_VALUE = 0x00000080
390 };
391
392 // -----------------------------------------------------------------------
393
394 // wxPGProperty::SetValue() flags
395 enum wxPG_SETVALUE_FLAGS
396 {
397 wxPG_SETVAL_REFRESH_EDITOR = 0x0001,
398 wxPG_SETVAL_AGGREGATED = 0x0002,
399 wxPG_SETVAL_FROM_PARENT = 0x0004,
400 wxPG_SETVAL_BY_USER = 0x0008 // Set if value changed by user
401 };
402
403 // -----------------------------------------------------------------------
404
405 //
406 // Valid constants for wxPG_UINT_BASE attribute
407 // (long because of wxVariant constructor)
408 #define wxPG_BASE_OCT (long)8
409 #define wxPG_BASE_DEC (long)10
410 #define wxPG_BASE_HEX (long)16
411 #define wxPG_BASE_HEXL (long)32
412
413 //
414 // Valid constants for wxPG_UINT_PREFIX attribute
415 #define wxPG_PREFIX_NONE (long)0
416 #define wxPG_PREFIX_0x (long)1
417 #define wxPG_PREFIX_DOLLAR_SIGN (long)2
418
419 // -----------------------------------------------------------------------
420 // Editor class.
421
422 // Editor accessor (for backwards compatiblity use only).
423 #define wxPG_EDITOR(T) wxPGEditor_##T
424
425 // Macro for declaring editor class, with optional impexpdecl part.
426 #ifndef WX_PG_DECLARE_EDITOR_WITH_DECL
427
428 #define WX_PG_DECLARE_EDITOR_WITH_DECL(EDITOR,DECL) \
429 extern DECL wxPGEditor* wxPGEditor_##EDITOR; \
430 extern DECL wxPGEditor* wxPGConstruct##EDITOR##EditorClass();
431
432 #endif
433
434 // Declare editor class.
435 #define WX_PG_DECLARE_EDITOR(EDITOR) \
436 extern wxPGEditor* wxPGEditor_##EDITOR; \
437 extern wxPGEditor* wxPGConstruct##EDITOR##EditorClass();
438
439 // Declare builtin editor classes.
440 WX_PG_DECLARE_EDITOR_WITH_DECL(TextCtrl,WXDLLIMPEXP_PROPGRID)
441 WX_PG_DECLARE_EDITOR_WITH_DECL(Choice,WXDLLIMPEXP_PROPGRID)
442 WX_PG_DECLARE_EDITOR_WITH_DECL(ComboBox,WXDLLIMPEXP_PROPGRID)
443 WX_PG_DECLARE_EDITOR_WITH_DECL(TextCtrlAndButton,WXDLLIMPEXP_PROPGRID)
444 #if wxPG_INCLUDE_CHECKBOX
445 WX_PG_DECLARE_EDITOR_WITH_DECL(CheckBox,WXDLLIMPEXP_PROPGRID)
446 #endif
447 WX_PG_DECLARE_EDITOR_WITH_DECL(ChoiceAndButton,WXDLLIMPEXP_PROPGRID)
448
449 // -----------------------------------------------------------------------
450
451 #ifndef SWIG
452
453 //
454 // Macro WXVARIANT allows creation of wxVariant from any type supported by
455 // wxWidgets internally, and of all types created using
456 // WX_PG_DECLARE_VARIANT_DATA.
457 template<class T>
458 wxVariant WXVARIANT( const T& WXUNUSED(value) )
459 {
460 wxFAIL_MSG("Code should always call specializations of this template");
461 return wxVariant();
462 }
463
464 template<> inline wxVariant WXVARIANT( const int& value )
465 { return wxVariant((long)value); }
466 template<> inline wxVariant WXVARIANT( const long& value )
467 { return wxVariant(value); }
468 template<> inline wxVariant WXVARIANT( const bool& value )
469 { return wxVariant(value); }
470 template<> inline wxVariant WXVARIANT( const double& value )
471 { return wxVariant(value); }
472 template<> inline wxVariant WXVARIANT( const wxArrayString& value )
473 { return wxVariant(value); }
474 template<> inline wxVariant WXVARIANT( const wxString& value )
475 { return wxVariant(value); }
476 #if wxUSE_LONGLONG
477 template<> inline wxVariant WXVARIANT( const wxLongLong& value )
478 { return wxVariant(value); }
479 template<> inline wxVariant WXVARIANT( const wxULongLong& value )
480 { return wxVariant(value); }
481 #endif
482 #if wxUSE_DATETIME
483 template<> inline wxVariant WXVARIANT( const wxDateTime& value )
484 { return wxVariant(value); }
485 #endif
486
487
488 //
489 // These are modified versions of DECLARE/WX_PG_IMPLEMENT_VARIANT_DATA
490 // macros found in variant.h. Difference are as follows:
491 // * These support non-wxObject data
492 // * These implement classname##RefFromVariant function which returns
493 // reference to data within.
494 // * const char* classname##_VariantType which equals classname.
495 // * WXVARIANT
496 //
497 #define WX_PG_DECLARE_VARIANT_DATA(classname) \
498 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
499
500 #define WX_PG_DECLARE_VARIANT_DATA_EXPORTED(classname,expdecl) \
501 expdecl classname& operator << ( classname &object, const wxVariant &variant ); \
502 expdecl wxVariant& operator << ( wxVariant &variant, const classname &object ); \
503 expdecl const classname& classname##RefFromVariant( const wxVariant& variant ); \
504 expdecl classname& classname##RefFromVariant( wxVariant& variant ); \
505 template<> inline wxVariant WXVARIANT( const classname& value ) \
506 { \
507 wxVariant variant; \
508 variant << value; \
509 return variant; \
510 } \
511 extern expdecl const char* classname##_VariantType;
512
513
514 #define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \
515 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
516
517 // Add getter (ie. classname << variant) separately to allow
518 // custom implementations.
519 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,expdecl) \
520 const char* classname##_VariantType = #classname; \
521 class classname##VariantData: public wxVariantData \
522 { \
523 public:\
524 classname##VariantData() {} \
525 classname##VariantData( const classname &value ) { m_value = value; } \
526 \
527 classname &GetValue() { return m_value; } \
528 \
529 const classname &GetValue() const { return m_value; } \
530 \
531 virtual bool Eq(wxVariantData& data) const; \
532 \
533 virtual wxString GetType() const; \
534 \
535 virtual wxVariantData* Clone() const { return new classname##VariantData(m_value); } \
536 \
537 DECLARE_WXANY_CONVERSION() \
538 protected:\
539 classname m_value; \
540 };\
541 \
542 IMPLEMENT_TRIVIAL_WXANY_CONVERSION(classname, classname##VariantData) \
543 \
544 wxString classname##VariantData::GetType() const\
545 {\
546 return wxS(#classname);\
547 }\
548 \
549 expdecl wxVariant& operator << ( wxVariant &variant, const classname &value )\
550 {\
551 classname##VariantData *data = new classname##VariantData( value );\
552 variant.SetData( data );\
553 return variant;\
554 } \
555 expdecl classname& classname##RefFromVariant( wxVariant& variant ) \
556 { \
557 wxASSERT_MSG( variant.GetType() == wxS(#classname), \
558 wxString::Format("Variant type should have been '%s'" \
559 "instead of '%s'", \
560 wxS(#classname), \
561 variant.GetType().c_str())); \
562 classname##VariantData *data = \
563 (classname##VariantData*) variant.GetData(); \
564 return data->GetValue();\
565 } \
566 expdecl const classname& classname##RefFromVariant( const wxVariant& variant ) \
567 { \
568 wxASSERT_MSG( variant.GetType() == wxS(#classname), \
569 wxString::Format("Variant type should have been '%s'" \
570 "instead of '%s'", \
571 wxS(#classname), \
572 variant.GetType().c_str())); \
573 classname##VariantData *data = \
574 (classname##VariantData*) variant.GetData(); \
575 return data->GetValue();\
576 }
577
578 #define WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname, expdecl) \
579 expdecl classname& operator << ( classname &value, const wxVariant &variant )\
580 {\
581 wxASSERT( variant.GetType() == #classname );\
582 \
583 classname##VariantData *data = (classname##VariantData*) variant.GetData();\
584 value = data->GetValue();\
585 return value;\
586 }
587
588 #define WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname, expdecl) \
589 bool classname##VariantData::Eq(wxVariantData& data) const \
590 {\
591 wxASSERT( GetType() == data.GetType() );\
592 \
593 classname##VariantData & otherData = (classname##VariantData &) data;\
594 \
595 return otherData.m_value == m_value;\
596 }
597
598 // implements a wxVariantData-derived class using for the Eq() method the
599 // operator== which must have been provided by "classname"
600 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname,expdecl) \
601 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
602 WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
603 WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl)
604
605 #define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \
606 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
607
608 // with Eq() implementation that always returns false
609 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname,expdecl) \
610 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
611 WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
612 \
613 bool classname##VariantData::Eq(wxVariantData& WXUNUSED(data)) const \
614 {\
615 return false; \
616 }
617
618 #define WX_PG_IMPLEMENT_VARIANT_DATA_DUMMY_EQ(classname) \
619 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname, wxEMPTY_PARAMETER_VALUE)
620
621 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxPoint, WXDLLIMPEXP_PROPGRID)
622 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxSize, WXDLLIMPEXP_PROPGRID)
623 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxArrayInt, WXDLLIMPEXP_PROPGRID)
624 DECLARE_VARIANT_OBJECT_EXPORTED(wxFont, WXDLLIMPEXP_PROPGRID)
625 template<> inline wxVariant WXVARIANT( const wxFont& value )
626 {
627 wxVariant variant;
628 variant << value;
629 return variant;
630 }
631
632 template<> inline wxVariant WXVARIANT( const wxColour& value )
633 {
634 wxVariant variant;
635 variant << value;
636 return variant;
637 }
638
639 // Define constants for common wxVariant type strings
640
641 #define wxPG_VARIANT_TYPE_STRING wxPGGlobalVars->m_strstring
642 #define wxPG_VARIANT_TYPE_LONG wxPGGlobalVars->m_strlong
643 #define wxPG_VARIANT_TYPE_BOOL wxPGGlobalVars->m_strbool
644 #define wxPG_VARIANT_TYPE_LIST wxPGGlobalVars->m_strlist
645 #define wxPG_VARIANT_TYPE_DOUBLE wxS("double")
646 #define wxPG_VARIANT_TYPE_ARRSTRING wxS("arrstring")
647 #define wxPG_VARIANT_TYPE_DATETIME wxS("datetime")
648 #define wxPG_VARIANT_TYPE_LONGLONG wxS("longlong")
649 #define wxPG_VARIANT_TYPE_ULONGLONG wxS("ulonglong")
650
651 #endif // !SWIG
652
653 // -----------------------------------------------------------------------
654
655 //
656 // Tokenizer macros.
657 // NOTE: I have made two versions - worse ones (performance and consistency
658 // wise) use wxStringTokenizer and better ones (may have unfound bugs)
659 // use custom code.
660 //
661
662 #include "wx/tokenzr.h"
663
664 // TOKENIZER1 can be done with wxStringTokenizer
665 #define WX_PG_TOKENIZER1_BEGIN(WXSTRING,DELIMITER) \
666 wxStringTokenizer tkz(WXSTRING,DELIMITER,wxTOKEN_RET_EMPTY); \
667 while ( tkz.HasMoreTokens() ) \
668 { \
669 wxString token = tkz.GetNextToken(); \
670 token.Trim(true); \
671 token.Trim(false);
672
673 #define WX_PG_TOKENIZER1_END() \
674 }
675
676
677 //
678 // 2nd version: tokens are surrounded by DELIMITERs (for example, C-style
679 // strings). TOKENIZER2 must use custom code (a class) for full compliance with
680 // " surrounded strings with \" inside.
681 //
682 // class implementation is in propgrid.cpp
683 //
684
685 class WXDLLIMPEXP_PROPGRID wxPGStringTokenizer
686 {
687 public:
688 wxPGStringTokenizer( const wxString& str, wxChar delimeter );
689 ~wxPGStringTokenizer();
690
691 bool HasMoreTokens(); // not const so we can do some stuff in it
692 wxString GetNextToken();
693
694 protected:
695 const wxString* m_str;
696 wxString::const_iterator m_curPos;
697 wxString m_readyToken;
698 wxUniChar m_delimeter;
699 };
700
701 #define WX_PG_TOKENIZER2_BEGIN(WXSTRING,DELIMITER) \
702 wxPGStringTokenizer tkz(WXSTRING,DELIMITER); \
703 while ( tkz.HasMoreTokens() ) \
704 { \
705 wxString token = tkz.GetNextToken();
706
707 #define WX_PG_TOKENIZER2_END() \
708 }
709
710 // -----------------------------------------------------------------------
711
712 #endif // wxUSE_PROPGRID
713
714 #endif // _WX_PROPGRID_PROPGRIDDEFS_H_