1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/propgrid/propgriddefs.h
3 // Purpose: wxPropertyGrid miscellaneous definitions
4 // Author: Jaakko Salli
8 // Copyright: (c) Jaakko Salli
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_PROPGRID_PROPGRIDDEFS_H_
13 #define _WX_PROPGRID_PROPGRIDDEFS_H_
17 #include "wx/dynarray.h"
18 #include "wx/vector.h"
19 #include "wx/hashmap.h"
20 #include "wx/variant.h"
21 #include "wx/longlong.h"
22 #include "wx/clntdata.h"
24 // -----------------------------------------------------------------------
27 // Here are some platform dependent defines
28 // NOTE: More in propertygrid.cpp
31 #if defined(__WXMSW__)
33 // space between vertical line and value text
34 #define wxPG_XBEFORETEXT 4
35 // space between vertical line and value editor control
36 #define wxPG_XBEFOREWIDGET 1
38 // comment to use bitmap buttons
39 #define wxPG_ICON_WIDTH 9
40 // 1 if wxRendererNative should be employed
41 #define wxPG_USE_RENDERER_NATIVE 0
43 // 1 to use double-buffer that guarantees flicker-free painting
44 #define wxPG_DOUBLE_BUFFER 1
47 #define wxPG_SUPPORT_TOOLTIPS 1
49 // width of optional bitmap/image in front of property
50 #define wxPG_CUSTOM_IMAGE_WIDTH 20
52 // 1 if splitter drag detect margin and control cannot overlap
53 #define wxPG_NO_CHILD_EVT_MOTION 0
55 // If 1, then setting empty tooltip actually hides it
56 #define wxPG_ALLOW_EMPTY_TOOLTIPS 1
58 #define wxPG_NAT_BUTTON_BORDER_ANY 1
59 #define wxPG_NAT_BUTTON_BORDER_X 1
60 #define wxPG_NAT_BUTTON_BORDER_Y 1
62 // If 1 then controls are refreshed after selected was drawn.
63 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 0
65 #elif defined(__WXGTK__)
67 // space between vertical line and value text
68 #define wxPG_XBEFORETEXT 5
69 // space between vertical line and value editor control
70 #define wxPG_XBEFOREWIDGET 1
72 // x position adjustment for wxTextCtrl (and like)
73 // NB: Only define wxPG_TEXTCTRLXADJUST for platforms that do not
74 // (yet) support wxTextEntry::SetMargins() for the left margin.
75 //#define wxPG_TEXTCTRLXADJUST 3
77 // comment to use bitmap buttons
78 #define wxPG_ICON_WIDTH 9
79 // 1 if wxRendererNative should be employed
80 #define wxPG_USE_RENDERER_NATIVE 1
82 // 1 to use double-buffer that guarantees flicker-free painting
83 #define wxPG_DOUBLE_BUFFER 1
86 #define wxPG_SUPPORT_TOOLTIPS 1
88 // width of optional bitmap/image in front of property
89 #define wxPG_CUSTOM_IMAGE_WIDTH 20
91 // 1 if splitter drag detect margin and control cannot overlap
92 #define wxPG_NO_CHILD_EVT_MOTION 1
94 // If 1, then setting empty tooltip actually hides it
95 #define wxPG_ALLOW_EMPTY_TOOLTIPS 0
97 #define wxPG_NAT_BUTTON_BORDER_ANY 1
98 #define wxPG_NAT_BUTTON_BORDER_X 1
99 #define wxPG_NAT_BUTTON_BORDER_Y 1
101 // If 1 then controls are refreshed after selected was drawn.
102 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 1
104 #elif defined(__WXMAC__)
106 // space between vertical line and value text
107 #define wxPG_XBEFORETEXT 4
108 // space between vertical line and value editor widget
109 #define wxPG_XBEFOREWIDGET 1
111 // x position adjustment for wxTextCtrl (and like)
112 #define wxPG_TEXTCTRLXADJUST 0
114 // comment to use bitmap buttons
115 #define wxPG_ICON_WIDTH 11
116 // 1 if wxRendererNative should be employed
117 #define wxPG_USE_RENDERER_NATIVE 1
119 // 1 to use double-buffer that guarantees flicker-free painting
120 #define wxPG_DOUBLE_BUFFER 0
123 #define wxPG_SUPPORT_TOOLTIPS 1
125 // width of optional bitmap/image in front of property
126 #define wxPG_CUSTOM_IMAGE_WIDTH 20
128 // 1 if splitter drag detect margin and control cannot overlap
129 #define wxPG_NO_CHILD_EVT_MOTION 0
131 // If 1, then setting empty tooltip actually hides it
132 #define wxPG_ALLOW_EMPTY_TOOLTIPS 1
134 #define wxPG_NAT_BUTTON_BORDER_ANY 0
135 #define wxPG_NAT_BUTTON_BORDER_X 0
136 #define wxPG_NAT_BUTTON_BORDER_Y 0
138 // If 1 then controls are refreshed after selected was drawn.
139 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 0
143 // space between vertical line and value text
144 #define wxPG_XBEFORETEXT 5
145 // space between vertical line and value editor widget
146 #define wxPG_XBEFOREWIDGET 1
148 // x position adjustment for wxTextCtrl (and like)
149 #define wxPG_TEXTCTRLXADJUST 3
151 // comment to use bitmap buttons
152 #define wxPG_ICON_WIDTH 9
153 // 1 if wxRendererNative should be employed
154 #define wxPG_USE_RENDERER_NATIVE 0
156 // 1 to use double-buffer that guarantees flicker-free painting
157 #define wxPG_DOUBLE_BUFFER 0
160 #define wxPG_SUPPORT_TOOLTIPS 0
162 // width of optional bitmap/image in front of property
163 #define wxPG_CUSTOM_IMAGE_WIDTH 20
165 // 1 if splitter drag detect margin and control cannot overlap
166 #define wxPG_NO_CHILD_EVT_MOTION 1
168 // If 1, then setting empty tooltip actually hides it
169 #define wxPG_ALLOW_EMPTY_TOOLTIPS 0
171 #define wxPG_NAT_BUTTON_BORDER_ANY 0
172 #define wxPG_NAT_BUTTON_BORDER_X 0
173 #define wxPG_NAT_BUTTON_BORDER_Y 0
175 // If 1 then controls are refreshed after selected was drawn.
176 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 1
180 #define wxPG_CONTROL_MARGIN 0 // space between splitter and control
182 #define wxCC_CUSTOM_IMAGE_MARGIN1 4 // before image
183 #define wxCC_CUSTOM_IMAGE_MARGIN2 5 // after image
185 #define DEFAULT_IMAGE_OFFSET_INCREMENT \
186 (wxCC_CUSTOM_IMAGE_MARGIN1 + wxCC_CUSTOM_IMAGE_MARGIN2)
188 #define wxPG_DRAG_MARGIN 30
190 #if wxPG_NO_CHILD_EVT_MOTION
191 #define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
192 #define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
194 #define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
195 #define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
198 // Use this macro to generate standard custom image height from
199 #define wxPG_STD_CUST_IMAGE_HEIGHT(LINEHEIGHT) (LINEHEIGHT-3)
202 #if defined(__WXWINCE__)
203 #define wxPG_SMALL_SCREEN 1
204 #undef wxPG_DOUBLE_BUFFER
205 #define wxPG_DOUBLE_BUFFER 0
207 #define wxPG_SMALL_SCREEN 0
211 // Undefine wxPG_ICON_WIDTH to use supplied xpm bitmaps instead
212 // (for tree buttons)
213 //#undef wxPG_ICON_WIDTH
215 #if WXWIN_COMPATIBILITY_2_6 || WXWIN_COMPATIBILITY_2_8
216 #define wxPG_COMPATIBILITY_1_4 1
218 #define wxPG_COMPATIBILITY_1_4 0
221 // Need to force disable tooltips?
223 #undef wxPG_SUPPORT_TOOLTIPS
224 #define wxPG_SUPPORT_TOOLTIPS 0
227 // Set 1 to include advanced properties (wxFontProperty, wxColourProperty, etc.)
228 #ifndef wxPG_INCLUDE_ADVPROPS
229 #define wxPG_INCLUDE_ADVPROPS 1
232 // Set 1 to include checkbox editor class
233 #define wxPG_INCLUDE_CHECKBOX 1
235 // -----------------------------------------------------------------------
240 class wxPropertyCategory
;
242 class wxPropertyGridPageState
;
244 class wxPGCellRenderer
;
245 class wxPGChoiceEntry
;
246 class wxPGPropArgCls
;
247 class wxPropertyGridInterface
;
248 class wxPropertyGrid
;
249 class wxPropertyGridEvent
;
250 class wxPropertyGridManager
;
251 class wxPGOwnerDrawnComboBox
;
252 class wxPGEditorDialogAdapter
;
253 class wxPGValidationInfo
;
256 // -----------------------------------------------------------------------
258 /** @section propgrid_misc wxPropertyGrid Miscellanous
260 This section describes some miscellanous values, types and macros.
264 // Used to tell wxPGProperty to use label as name as well
265 #define wxPG_LABEL (*wxPGProperty::sm_wxPG_LABEL)
267 // This is the value placed in wxPGProperty::sm_wxPG_LABEL
268 #define wxPG_LABEL_STRING wxS("@!")
269 #define wxPG_NULL_BITMAP wxNullBitmap
270 #define wxPG_COLOUR_BLACK (*wxBLACK)
272 /** Convert Red, Green and Blue to a single 32-bit value.
274 #define wxPG_COLOUR(R,G,B) ((wxUint32)(R+(G<<8)+(B<<16)))
277 /** If property is supposed to have custom-painted image, then returning
278 this in OnMeasureImage() will usually be enough.
280 #define wxPG_DEFAULT_IMAGE_SIZE wxSize(-1, -1)
283 /** This callback function is used for sorting properties.
285 Call wxPropertyGrid::SetSortFunction() to set it.
287 Sort function should return a value greater than 0 if position of p1 is
288 after p2. So, for instance, when comparing property names, you can use
289 following implementation:
292 int MyPropertySortFunction(wxPropertyGrid* propGrid,
296 return p1->GetBaseName().compare( p2->GetBaseName() );
300 typedef int (*wxPGSortCallback
)(wxPropertyGrid
* propGrid
,
306 typedef wxString wxPGCachedString
;
311 // -----------------------------------------------------------------------
313 // Used to indicate wxPGChoices::Add etc that the value is actually not given
315 #define wxPG_INVALID_VALUE INT_MAX
317 // -----------------------------------------------------------------------
319 WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(wxPGProperty
*, wxArrayPGProperty
,
321 class WXDLLIMPEXP_PROPGRID
);
323 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(void*,
325 class WXDLLIMPEXP_PROPGRID
);
327 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxString
,
329 class WXDLLIMPEXP_PROPGRID
);
331 WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(void*,
333 class WXDLLIMPEXP_PROPGRID
);
335 WX_DECLARE_HASH_MAP_WITH_DECL(wxInt32
,
340 class WXDLLIMPEXP_PROPGRID
);
342 // -----------------------------------------------------------------------
344 enum wxPG_GETPROPERTYVALUES_FLAGS
347 /** Flags for wxPropertyGridInterface::GetPropertyValues */
348 wxPG_KEEP_STRUCTURE
= 0x00000010,
350 /** Flags for wxPropertyGrid::SetPropertyAttribute() etc */
351 wxPG_RECURSE
= 0x00000020,
353 /** Include attributes for GetPropertyValues. */
354 wxPG_INC_ATTRIBUTES
= 0x00000040,
356 /** Used when first starting recursion. */
357 wxPG_RECURSE_STARTS
= 0x00000080,
359 /** Force value change. */
360 wxPG_FORCE
= 0x00000100,
362 /** Only sort categories and their immediate children.
363 Sorting done by wxPG_AUTO_SORT option uses this.
365 wxPG_SORT_TOP_LEVEL_ONLY
= 0x00000200
369 /** Flags for wxPropertyGrid::SetPropertyAttribute() etc */
370 #define wxPG_DONT_RECURSE 0x00000000
372 // -----------------------------------------------------------------------
374 // Misc argument flags.
375 enum wxPG_MISC_ARG_FLAGS
377 // Get/Store full value instead of displayed value.
378 wxPG_FULL_VALUE
= 0x00000001,
380 wxPG_REPORT_ERROR
= 0x00000002,
382 wxPG_PROPERTY_SPECIFIC
= 0x00000004,
384 // Get/Store editable value instead of displayed one (should only be
385 // different in the case of common values)
386 wxPG_EDITABLE_VALUE
= 0x00000008,
388 // Used when dealing with fragments of composite string value
389 wxPG_COMPOSITE_FRAGMENT
= 0x00000010,
391 // Means property for which final string value is for can not really be
393 wxPG_UNEDITABLE_COMPOSITE_FRAGMENT
= 0x00000020,
395 // ValueToString() called from GetValueAsString()
396 // (guarantees that input wxVariant value is current own value)
397 wxPG_VALUE_IS_CURRENT
= 0x00000040,
399 // Value is being set programmatically (ie. not by user)
400 wxPG_PROGRAMMATIC_VALUE
= 0x00000080
403 // -----------------------------------------------------------------------
405 // wxPGProperty::SetValue() flags
406 enum wxPG_SETVALUE_FLAGS
408 wxPG_SETVAL_REFRESH_EDITOR
= 0x0001,
409 wxPG_SETVAL_AGGREGATED
= 0x0002,
410 wxPG_SETVAL_FROM_PARENT
= 0x0004,
411 wxPG_SETVAL_BY_USER
= 0x0008 // Set if value changed by user
414 // -----------------------------------------------------------------------
417 // Valid constants for wxPG_UINT_BASE attribute
418 // (long because of wxVariant constructor)
419 #define wxPG_BASE_OCT (long)8
420 #define wxPG_BASE_DEC (long)10
421 #define wxPG_BASE_HEX (long)16
422 #define wxPG_BASE_HEXL (long)32
425 // Valid constants for wxPG_UINT_PREFIX attribute
426 #define wxPG_PREFIX_NONE (long)0
427 #define wxPG_PREFIX_0x (long)1
428 #define wxPG_PREFIX_DOLLAR_SIGN (long)2
430 // -----------------------------------------------------------------------
433 // Editor accessor (for backwards compatiblity use only).
434 #define wxPG_EDITOR(T) wxPGEditor_##T
436 // Macro for declaring editor class, with optional impexpdecl part.
437 #ifndef WX_PG_DECLARE_EDITOR_WITH_DECL
439 #define WX_PG_DECLARE_EDITOR_WITH_DECL(EDITOR,DECL) \
440 extern DECL wxPGEditor* wxPGEditor_##EDITOR; \
441 extern DECL wxPGEditor* wxPGConstruct##EDITOR##EditorClass();
445 // Declare editor class.
446 #define WX_PG_DECLARE_EDITOR(EDITOR) \
447 extern wxPGEditor* wxPGEditor_##EDITOR; \
448 extern wxPGEditor* wxPGConstruct##EDITOR##EditorClass();
450 // Declare builtin editor classes.
451 WX_PG_DECLARE_EDITOR_WITH_DECL(TextCtrl
,WXDLLIMPEXP_PROPGRID
)
452 WX_PG_DECLARE_EDITOR_WITH_DECL(Choice
,WXDLLIMPEXP_PROPGRID
)
453 WX_PG_DECLARE_EDITOR_WITH_DECL(ComboBox
,WXDLLIMPEXP_PROPGRID
)
454 WX_PG_DECLARE_EDITOR_WITH_DECL(TextCtrlAndButton
,WXDLLIMPEXP_PROPGRID
)
455 #if wxPG_INCLUDE_CHECKBOX
456 WX_PG_DECLARE_EDITOR_WITH_DECL(CheckBox
,WXDLLIMPEXP_PROPGRID
)
458 WX_PG_DECLARE_EDITOR_WITH_DECL(ChoiceAndButton
,WXDLLIMPEXP_PROPGRID
)
460 // -----------------------------------------------------------------------
465 // Macro WXVARIANT allows creation of wxVariant from any type supported by
466 // wxWidgets internally, and of all types created using
467 // WX_PG_DECLARE_VARIANT_DATA.
469 wxVariant
WXVARIANT( const T
& WXUNUSED(value
) )
471 wxFAIL_MSG("Code should always call specializations of this template");
475 template<> inline wxVariant
WXVARIANT( const int& value
)
476 { return wxVariant((long)value
); }
477 template<> inline wxVariant
WXVARIANT( const long& value
)
478 { return wxVariant(value
); }
479 template<> inline wxVariant
WXVARIANT( const bool& value
)
480 { return wxVariant(value
); }
481 template<> inline wxVariant
WXVARIANT( const double& value
)
482 { return wxVariant(value
); }
483 template<> inline wxVariant
WXVARIANT( const wxArrayString
& value
)
484 { return wxVariant(value
); }
485 template<> inline wxVariant
WXVARIANT( const wxString
& value
)
486 { return wxVariant(value
); }
488 template<> inline wxVariant
WXVARIANT( const wxLongLong
& value
)
489 { return wxVariant(value
); }
490 template<> inline wxVariant
WXVARIANT( const wxULongLong
& value
)
491 { return wxVariant(value
); }
494 template<> inline wxVariant
WXVARIANT( const wxDateTime
& value
)
495 { return wxVariant(value
); }
500 // These are modified versions of DECLARE/WX_PG_IMPLEMENT_VARIANT_DATA
501 // macros found in variant.h. Difference are as follows:
502 // * These support non-wxObject data
503 // * These implement classname##RefFromVariant function which returns
504 // reference to data within.
505 // * const char* classname##_VariantType which equals classname.
508 #define WX_PG_DECLARE_VARIANT_DATA(classname) \
509 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
511 #define WX_PG_DECLARE_VARIANT_DATA_EXPORTED(classname,expdecl) \
512 expdecl classname& operator << ( classname &object, const wxVariant &variant ); \
513 expdecl wxVariant& operator << ( wxVariant &variant, const classname &object ); \
514 expdecl const classname& classname##RefFromVariant( const wxVariant& variant ); \
515 expdecl classname& classname##RefFromVariant( wxVariant& variant ); \
516 template<> inline wxVariant WXVARIANT( const classname& value ) \
522 extern expdecl const char* classname##_VariantType;
525 #define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \
526 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
528 // Add getter (ie. classname << variant) separately to allow
529 // custom implementations.
530 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,expdecl) \
531 const char* classname##_VariantType = #classname; \
532 class classname##VariantData: public wxVariantData \
535 classname##VariantData() {} \
536 classname##VariantData( const classname &value ) { m_value = value; } \
538 classname &GetValue() { return m_value; } \
540 const classname &GetValue() const { return m_value; } \
542 virtual bool Eq(wxVariantData& data) const; \
544 virtual wxString GetType() const; \
546 virtual wxVariantData* Clone() const { return new classname##VariantData(m_value); } \
552 wxString classname##VariantData::GetType() const\
554 return wxS(#classname);\
557 expdecl wxVariant& operator << ( wxVariant &variant, const classname &value )\
559 classname##VariantData *data = new classname##VariantData( value );\
560 variant.SetData( data );\
563 expdecl classname& classname##RefFromVariant( wxVariant& variant ) \
565 wxASSERT_MSG( variant.GetType() == wxS(#classname), \
566 wxString::Format("Variant type should have been '%s'" \
569 variant.GetType().c_str())); \
570 classname##VariantData *data = \
571 (classname##VariantData*) variant.GetData(); \
572 return data->GetValue();\
574 expdecl const classname& classname##RefFromVariant( const wxVariant& variant ) \
576 wxASSERT_MSG( variant.GetType() == wxS(#classname), \
577 wxString::Format("Variant type should have been '%s'" \
580 variant.GetType().c_str())); \
581 classname##VariantData *data = \
582 (classname##VariantData*) variant.GetData(); \
583 return data->GetValue();\
586 #define WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname, expdecl) \
587 expdecl classname& operator << ( classname &value, const wxVariant &variant )\
589 wxASSERT( variant.GetType() == #classname );\
591 classname##VariantData *data = (classname##VariantData*) variant.GetData();\
592 value = data->GetValue();\
596 #define WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname, expdecl) \
597 bool classname##VariantData::Eq(wxVariantData& data) const \
599 wxASSERT( GetType() == data.GetType() );\
601 classname##VariantData & otherData = (classname##VariantData &) data;\
603 return otherData.m_value == m_value;\
606 // implements a wxVariantData-derived class using for the Eq() method the
607 // operator== which must have been provided by "classname"
608 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname,expdecl) \
609 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
610 WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
611 WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl)
613 #define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \
614 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
616 // with Eq() implementation that always returns false
617 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname,expdecl) \
618 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
619 WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
621 bool classname##VariantData::Eq(wxVariantData& WXUNUSED(data)) const \
626 #define WX_PG_IMPLEMENT_VARIANT_DATA_DUMMY_EQ(classname) \
627 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname, wxEMPTY_PARAMETER_VALUE)
629 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxPoint
, WXDLLIMPEXP_PROPGRID
)
630 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxSize
, WXDLLIMPEXP_PROPGRID
)
631 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxArrayInt
, WXDLLIMPEXP_PROPGRID
)
632 DECLARE_VARIANT_OBJECT_EXPORTED(wxFont
, WXDLLIMPEXP_PROPGRID
)
633 template<> inline wxVariant
WXVARIANT( const wxFont
& value
)
640 template<> inline wxVariant
WXVARIANT( const wxColour
& value
)
647 // Define constants for common wxVariant type strings
649 #define wxPG_VARIANT_TYPE_STRING wxPGGlobalVars->m_strstring
650 #define wxPG_VARIANT_TYPE_LONG wxPGGlobalVars->m_strlong
651 #define wxPG_VARIANT_TYPE_BOOL wxPGGlobalVars->m_strbool
652 #define wxPG_VARIANT_TYPE_LIST wxPGGlobalVars->m_strlist
653 #define wxPG_VARIANT_TYPE_DOUBLE wxS("double")
654 #define wxPG_VARIANT_TYPE_ARRSTRING wxS("arrstring")
655 #define wxPG_VARIANT_TYPE_DATETIME wxS("datetime")
656 #define wxPG_VARIANT_TYPE_LONGLONG wxS("longlong")
657 #define wxPG_VARIANT_TYPE_ULONGLONG wxS("ulonglong")
661 // -----------------------------------------------------------------------
665 // NOTE: I have made two versions - worse ones (performance and consistency
666 // wise) use wxStringTokenizer and better ones (may have unfound bugs)
670 #include "wx/tokenzr.h"
672 // TOKENIZER1 can be done with wxStringTokenizer
673 #define WX_PG_TOKENIZER1_BEGIN(WXSTRING,DELIMITER) \
674 wxStringTokenizer tkz(WXSTRING,DELIMITER,wxTOKEN_RET_EMPTY); \
675 while ( tkz.HasMoreTokens() ) \
677 wxString token = tkz.GetNextToken(); \
681 #define WX_PG_TOKENIZER1_END() \
686 // 2nd version: tokens are surrounded by DELIMITERs (for example, C-style
687 // strings). TOKENIZER2 must use custom code (a class) for full compliance with
688 // " surrounded strings with \" inside.
690 // class implementation is in propgrid.cpp
693 class WXDLLIMPEXP_PROPGRID wxPGStringTokenizer
696 wxPGStringTokenizer( const wxString
& str
, wxChar delimeter
);
697 ~wxPGStringTokenizer();
699 bool HasMoreTokens(); // not const so we can do some stuff in it
700 wxString
GetNextToken();
703 const wxString
* m_str
;
704 wxString::const_iterator m_curPos
;
705 wxString m_readyToken
;
706 wxUniChar m_delimeter
;
709 #define WX_PG_TOKENIZER2_BEGIN(WXSTRING,DELIMITER) \
710 wxPGStringTokenizer tkz(WXSTRING,DELIMITER); \
711 while ( tkz.HasMoreTokens() ) \
713 wxString token = tkz.GetNextToken();
715 #define WX_PG_TOKENIZER2_END() \
718 // -----------------------------------------------------------------------
720 #endif // wxUSE_PROPGRID
722 #endif // _WX_PROPGRID_PROPGRIDDEFS_H_