1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/propgrid/propgriddefs.h
3 // Purpose: wxPropertyGrid miscellaneous definitions
4 // Author: Jaakko Salli
8 // Copyright: (c) Jaakko Salli
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_PROPGRID_PROPGRIDDEFS_H_
13 #define _WX_PROPGRID_PROPGRIDDEFS_H_
19 #include "wx/dynarray.h"
20 #include "wx/vector.h"
21 #include "wx/hashmap.h"
22 #include "wx/variant.h"
24 #include "wx/longlong.h"
25 #include "wx/clntdata.h"
27 // -----------------------------------------------------------------------
30 // Here are some platform dependent defines
31 // NOTE: More in propertygrid.cpp
34 #if defined(__WXMSW__)
36 // space between vertical line and value text
37 #define wxPG_XBEFORETEXT 4
38 // space between vertical line and value editor control
39 #define wxPG_XBEFOREWIDGET 1
41 // comment to use bitmap buttons
42 #define wxPG_ICON_WIDTH 9
43 // 1 if wxRendererNative should be employed
44 #define wxPG_USE_RENDERER_NATIVE 0
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 #define wxPG_NAT_BUTTON_BORDER_ANY 1
56 #define wxPG_NAT_BUTTON_BORDER_X 1
57 #define wxPG_NAT_BUTTON_BORDER_Y 1
59 // If 1 then controls are refreshed after selected was drawn.
60 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 0
62 #elif defined(__WXGTK__)
64 // space between vertical line and value text
65 #define wxPG_XBEFORETEXT 5
66 // space between vertical line and value editor control
67 #define wxPG_XBEFOREWIDGET 1
69 // x position adjustment for wxTextCtrl (and like)
70 // NB: Only define wxPG_TEXTCTRLXADJUST for platforms that do not
71 // (yet) support wxTextEntry::SetMargins() for the left margin.
72 //#define wxPG_TEXTCTRLXADJUST 3
74 // comment to use bitmap buttons
75 #define wxPG_ICON_WIDTH 9
76 // 1 if wxRendererNative should be employed
77 #define wxPG_USE_RENDERER_NATIVE 1
80 #define wxPG_SUPPORT_TOOLTIPS 1
82 // width of optional bitmap/image in front of property
83 #define wxPG_CUSTOM_IMAGE_WIDTH 20
85 // 1 if splitter drag detect margin and control cannot overlap
86 #define wxPG_NO_CHILD_EVT_MOTION 1
88 #define wxPG_NAT_BUTTON_BORDER_ANY 1
89 #define wxPG_NAT_BUTTON_BORDER_X 1
90 #define wxPG_NAT_BUTTON_BORDER_Y 1
92 // If 1 then controls are refreshed after selected was drawn.
93 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 1
95 #elif defined(__WXMAC__)
97 // space between vertical line and value text
98 #define wxPG_XBEFORETEXT 4
99 // space between vertical line and value editor widget
100 #define wxPG_XBEFOREWIDGET 1
102 // x position adjustment for wxTextCtrl (and like)
103 #define wxPG_TEXTCTRLXADJUST 0
105 // comment to use bitmap buttons
106 #define wxPG_ICON_WIDTH 11
107 // 1 if wxRendererNative should be employed
108 #define wxPG_USE_RENDERER_NATIVE 1
111 #define wxPG_SUPPORT_TOOLTIPS 1
113 // width of optional bitmap/image in front of property
114 #define wxPG_CUSTOM_IMAGE_WIDTH 20
116 // 1 if splitter drag detect margin and control cannot overlap
117 #define wxPG_NO_CHILD_EVT_MOTION 0
119 #define wxPG_NAT_BUTTON_BORDER_ANY 0
120 #define wxPG_NAT_BUTTON_BORDER_X 0
121 #define wxPG_NAT_BUTTON_BORDER_Y 0
123 // If 1 then controls are refreshed after selected was drawn.
124 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 0
128 // space between vertical line and value text
129 #define wxPG_XBEFORETEXT 5
130 // space between vertical line and value editor widget
131 #define wxPG_XBEFOREWIDGET 1
133 // x position adjustment for wxTextCtrl (and like)
134 #define wxPG_TEXTCTRLXADJUST 3
136 // comment to use bitmap buttons
137 #define wxPG_ICON_WIDTH 9
138 // 1 if wxRendererNative should be employed
139 #define wxPG_USE_RENDERER_NATIVE 0
142 #define wxPG_SUPPORT_TOOLTIPS 0
144 // width of optional bitmap/image in front of property
145 #define wxPG_CUSTOM_IMAGE_WIDTH 20
147 // 1 if splitter drag detect margin and control cannot overlap
148 #define wxPG_NO_CHILD_EVT_MOTION 1
150 #define wxPG_NAT_BUTTON_BORDER_ANY 0
151 #define wxPG_NAT_BUTTON_BORDER_X 0
152 #define wxPG_NAT_BUTTON_BORDER_Y 0
154 // If 1 then controls are refreshed after selected was drawn.
155 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 1
159 #define wxPG_CONTROL_MARGIN 0 // space between splitter and control
161 #define wxCC_CUSTOM_IMAGE_MARGIN1 4 // before image
162 #define wxCC_CUSTOM_IMAGE_MARGIN2 5 // after image
164 #define DEFAULT_IMAGE_OFFSET_INCREMENT \
165 (wxCC_CUSTOM_IMAGE_MARGIN1 + wxCC_CUSTOM_IMAGE_MARGIN2)
167 #define wxPG_DRAG_MARGIN 30
169 #if wxPG_NO_CHILD_EVT_MOTION
170 #define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
171 #define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
173 #define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
174 #define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
177 // Use this macro to generate standard custom image height from
178 #define wxPG_STD_CUST_IMAGE_HEIGHT(LINEHEIGHT) (LINEHEIGHT-3)
181 #if defined(__WXWINCE__)
182 #define wxPG_SMALL_SCREEN 1
184 #define wxPG_SMALL_SCREEN 0
188 // Undefine wxPG_ICON_WIDTH to use supplied xpm bitmaps instead
189 // (for tree buttons)
190 //#undef wxPG_ICON_WIDTH
192 #if WXWIN_COMPATIBILITY_2_6 || WXWIN_COMPATIBILITY_2_8
193 #define wxPG_COMPATIBILITY_1_4 1
195 #define wxPG_COMPATIBILITY_1_4 0
198 // Need to force disable tooltips?
200 #undef wxPG_SUPPORT_TOOLTIPS
201 #define wxPG_SUPPORT_TOOLTIPS 0
204 // Set 1 to include advanced properties (wxFontProperty, wxColourProperty, etc.)
205 #ifndef wxPG_INCLUDE_ADVPROPS
206 #define wxPG_INCLUDE_ADVPROPS 1
209 // Set 1 to include checkbox editor class
210 #define wxPG_INCLUDE_CHECKBOX 1
212 // -----------------------------------------------------------------------
217 class wxPropertyCategory
;
219 class wxPropertyGridPageState
;
221 class wxPGCellRenderer
;
222 class wxPGChoiceEntry
;
223 class wxPGPropArgCls
;
224 class wxPropertyGridInterface
;
225 class wxPropertyGrid
;
226 class wxPropertyGridEvent
;
227 class wxPropertyGridManager
;
228 class wxPGOwnerDrawnComboBox
;
229 class wxPGEditorDialogAdapter
;
230 class wxPGValidationInfo
;
233 // -----------------------------------------------------------------------
235 /** @section propgrid_misc wxPropertyGrid Miscellanous
237 This section describes some miscellanous values, types and macros.
241 // Used to tell wxPGProperty to use label as name as well
242 #define wxPG_LABEL (*wxPGProperty::sm_wxPG_LABEL)
244 // This is the value placed in wxPGProperty::sm_wxPG_LABEL
245 #define wxPG_LABEL_STRING wxS("@!")
246 #define wxPG_NULL_BITMAP wxNullBitmap
247 #define wxPG_COLOUR_BLACK (*wxBLACK)
249 /** Convert Red, Green and Blue to a single 32-bit value.
251 #define wxPG_COLOUR(R,G,B) ((wxUint32)(R+(G<<8)+(B<<16)))
254 /** If property is supposed to have custom-painted image, then returning
255 this in OnMeasureImage() will usually be enough.
257 #define wxPG_DEFAULT_IMAGE_SIZE wxSize(-1, -1)
260 /** This callback function is used for sorting properties.
262 Call wxPropertyGrid::SetSortFunction() to set it.
264 Sort function should return a value greater than 0 if position of p1 is
265 after p2. So, for instance, when comparing property names, you can use
266 following implementation:
269 int MyPropertySortFunction(wxPropertyGrid* propGrid,
273 return p1->GetBaseName().compare( p2->GetBaseName() );
277 typedef int (*wxPGSortCallback
)(wxPropertyGrid
* propGrid
,
283 typedef wxString wxPGCachedString
;
288 // -----------------------------------------------------------------------
290 // Used to indicate wxPGChoices::Add etc that the value is actually not given
292 #define wxPG_INVALID_VALUE INT_MAX
294 // -----------------------------------------------------------------------
296 WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(wxPGProperty
*, wxArrayPGProperty
,
298 class WXDLLIMPEXP_PROPGRID
);
300 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(void*,
302 class WXDLLIMPEXP_PROPGRID
);
304 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxString
,
306 class WXDLLIMPEXP_PROPGRID
);
308 WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(void*,
310 class WXDLLIMPEXP_PROPGRID
);
312 WX_DECLARE_HASH_MAP_WITH_DECL(wxInt32
,
317 class WXDLLIMPEXP_PROPGRID
);
319 // Utility to find if specific item is in a vector. Returns index to
320 // the item, or wxNOT_FOUND if not present.
321 template<typename CONTAINER
, typename T
>
322 int wxPGFindInVector( CONTAINER vector
, const T
& item
)
324 for ( unsigned int i
=0; i
<vector
.size(); i
++ )
326 if ( vector
[i
] == item
)
332 // -----------------------------------------------------------------------
334 enum wxPG_GETPROPERTYVALUES_FLAGS
337 /** Flags for wxPropertyGridInterface::GetPropertyValues */
338 wxPG_KEEP_STRUCTURE
= 0x00000010,
340 /** Flags for wxPropertyGrid::SetPropertyAttribute() etc */
341 wxPG_RECURSE
= 0x00000020,
343 /** Include attributes for GetPropertyValues. */
344 wxPG_INC_ATTRIBUTES
= 0x00000040,
346 /** Used when first starting recursion. */
347 wxPG_RECURSE_STARTS
= 0x00000080,
349 /** Force value change. */
350 wxPG_FORCE
= 0x00000100,
352 /** Only sort categories and their immediate children.
353 Sorting done by wxPG_AUTO_SORT option uses this.
355 wxPG_SORT_TOP_LEVEL_ONLY
= 0x00000200
359 /** Flags for wxPropertyGrid::SetPropertyAttribute() etc */
360 #define wxPG_DONT_RECURSE 0x00000000
362 // -----------------------------------------------------------------------
364 // Misc argument flags.
365 enum wxPG_MISC_ARG_FLAGS
367 // Get/Store full value instead of displayed value.
368 wxPG_FULL_VALUE
= 0x00000001,
370 wxPG_REPORT_ERROR
= 0x00000002,
372 wxPG_PROPERTY_SPECIFIC
= 0x00000004,
374 // Get/Store editable value instead of displayed one (should only be
375 // different in the case of common values)
376 wxPG_EDITABLE_VALUE
= 0x00000008,
378 // Used when dealing with fragments of composite string value
379 wxPG_COMPOSITE_FRAGMENT
= 0x00000010,
381 // Means property for which final string value is for cannot really be
383 wxPG_UNEDITABLE_COMPOSITE_FRAGMENT
= 0x00000020,
385 // ValueToString() called from GetValueAsString()
386 // (guarantees that input wxVariant value is current own value)
387 wxPG_VALUE_IS_CURRENT
= 0x00000040,
389 // Value is being set programmatically (ie. not by user)
390 wxPG_PROGRAMMATIC_VALUE
= 0x00000080
393 // -----------------------------------------------------------------------
395 // wxPGProperty::SetValue() flags
396 enum wxPG_SETVALUE_FLAGS
398 wxPG_SETVAL_REFRESH_EDITOR
= 0x0001,
399 wxPG_SETVAL_AGGREGATED
= 0x0002,
400 wxPG_SETVAL_FROM_PARENT
= 0x0004,
401 wxPG_SETVAL_BY_USER
= 0x0008 // Set if value changed by user
404 // -----------------------------------------------------------------------
407 // Valid constants for wxPG_UINT_BASE attribute
408 // (long because of wxVariant constructor)
409 #define wxPG_BASE_OCT (long)8
410 #define wxPG_BASE_DEC (long)10
411 #define wxPG_BASE_HEX (long)16
412 #define wxPG_BASE_HEXL (long)32
415 // Valid constants for wxPG_UINT_PREFIX attribute
416 #define wxPG_PREFIX_NONE (long)0
417 #define wxPG_PREFIX_0x (long)1
418 #define wxPG_PREFIX_DOLLAR_SIGN (long)2
420 // -----------------------------------------------------------------------
423 // Editor accessor (for backwards compatiblity use only).
424 #define wxPG_EDITOR(T) wxPGEditor_##T
426 // Macro for declaring editor class, with optional impexpdecl part.
427 #ifndef WX_PG_DECLARE_EDITOR_WITH_DECL
429 #define WX_PG_DECLARE_EDITOR_WITH_DECL(EDITOR,DECL) \
430 extern DECL wxPGEditor* wxPGEditor_##EDITOR; \
431 extern DECL wxPGEditor* wxPGConstruct##EDITOR##EditorClass();
435 // Declare editor class.
436 #define WX_PG_DECLARE_EDITOR(EDITOR) \
437 extern wxPGEditor* wxPGEditor_##EDITOR; \
438 extern wxPGEditor* wxPGConstruct##EDITOR##EditorClass();
440 // Declare builtin editor classes.
441 WX_PG_DECLARE_EDITOR_WITH_DECL(TextCtrl
,WXDLLIMPEXP_PROPGRID
)
442 WX_PG_DECLARE_EDITOR_WITH_DECL(Choice
,WXDLLIMPEXP_PROPGRID
)
443 WX_PG_DECLARE_EDITOR_WITH_DECL(ComboBox
,WXDLLIMPEXP_PROPGRID
)
444 WX_PG_DECLARE_EDITOR_WITH_DECL(TextCtrlAndButton
,WXDLLIMPEXP_PROPGRID
)
445 #if wxPG_INCLUDE_CHECKBOX
446 WX_PG_DECLARE_EDITOR_WITH_DECL(CheckBox
,WXDLLIMPEXP_PROPGRID
)
448 WX_PG_DECLARE_EDITOR_WITH_DECL(ChoiceAndButton
,WXDLLIMPEXP_PROPGRID
)
450 // -----------------------------------------------------------------------
455 // Macro WXVARIANT allows creation of wxVariant from any type supported by
456 // wxWidgets internally, and of all types created using
457 // WX_PG_DECLARE_VARIANT_DATA.
459 wxVariant
WXVARIANT( const T
& WXUNUSED(value
) )
461 wxFAIL_MSG("Code should always call specializations of this template");
465 template<> inline wxVariant
WXVARIANT( const int& value
)
466 { return wxVariant((long)value
); }
467 template<> inline wxVariant
WXVARIANT( const long& value
)
468 { return wxVariant(value
); }
469 template<> inline wxVariant
WXVARIANT( const bool& value
)
470 { return wxVariant(value
); }
471 template<> inline wxVariant
WXVARIANT( const double& value
)
472 { return wxVariant(value
); }
473 template<> inline wxVariant
WXVARIANT( const wxArrayString
& value
)
474 { return wxVariant(value
); }
475 template<> inline wxVariant
WXVARIANT( const wxString
& value
)
476 { return wxVariant(value
); }
478 template<> inline wxVariant
WXVARIANT( const wxLongLong
& value
)
479 { return wxVariant(value
); }
480 template<> inline wxVariant
WXVARIANT( const wxULongLong
& value
)
481 { return wxVariant(value
); }
484 template<> inline wxVariant
WXVARIANT( const wxDateTime
& value
)
485 { return wxVariant(value
); }
490 // These are modified versions of DECLARE/WX_PG_IMPLEMENT_VARIANT_DATA
491 // macros found in variant.h. Difference are as follows:
492 // * These support non-wxObject data
493 // * These implement classname##RefFromVariant function which returns
494 // reference to data within.
495 // * const char* classname##_VariantType which equals classname.
498 #define WX_PG_DECLARE_VARIANT_DATA(classname) \
499 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
501 #define WX_PG_DECLARE_VARIANT_DATA_EXPORTED(classname,expdecl) \
502 expdecl classname& operator << ( classname &object, const wxVariant &variant ); \
503 expdecl wxVariant& operator << ( wxVariant &variant, const classname &object ); \
504 expdecl const classname& classname##RefFromVariant( const wxVariant& variant ); \
505 expdecl classname& classname##RefFromVariant( wxVariant& variant ); \
506 template<> inline wxVariant WXVARIANT( const classname& value ) \
512 extern expdecl const char* classname##_VariantType;
515 #define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \
516 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
518 // Add getter (ie. classname << variant) separately to allow
519 // custom implementations.
520 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,expdecl) \
521 const char* classname##_VariantType = #classname; \
522 class classname##VariantData: public wxVariantData \
525 classname##VariantData() {} \
526 classname##VariantData( const classname &value ) { m_value = value; } \
528 classname &GetValue() { return m_value; } \
530 const classname &GetValue() const { return m_value; } \
532 virtual bool Eq(wxVariantData& data) const; \
534 virtual wxString GetType() const; \
536 virtual wxVariantData* Clone() const { return new classname##VariantData(m_value); } \
538 DECLARE_WXANY_CONVERSION() \
543 IMPLEMENT_TRIVIAL_WXANY_CONVERSION(classname, classname##VariantData) \
545 wxString classname##VariantData::GetType() const\
547 return wxS(#classname);\
550 expdecl wxVariant& operator << ( wxVariant &variant, const classname &value )\
552 classname##VariantData *data = new classname##VariantData( value );\
553 variant.SetData( data );\
556 expdecl classname& classname##RefFromVariant( wxVariant& variant ) \
558 wxASSERT_MSG( variant.GetType() == wxS(#classname), \
559 wxString::Format("Variant type should have been '%s'" \
562 variant.GetType().c_str())); \
563 classname##VariantData *data = \
564 (classname##VariantData*) variant.GetData(); \
565 return data->GetValue();\
567 expdecl const classname& classname##RefFromVariant( const wxVariant& variant ) \
569 wxASSERT_MSG( variant.GetType() == wxS(#classname), \
570 wxString::Format("Variant type should have been '%s'" \
573 variant.GetType().c_str())); \
574 classname##VariantData *data = \
575 (classname##VariantData*) variant.GetData(); \
576 return data->GetValue();\
579 #define WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname, expdecl) \
580 expdecl classname& operator << ( classname &value, const wxVariant &variant )\
582 wxASSERT( variant.GetType() == #classname );\
584 classname##VariantData *data = (classname##VariantData*) variant.GetData();\
585 value = data->GetValue();\
589 #define WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname, expdecl) \
590 bool classname##VariantData::Eq(wxVariantData& data) const \
592 wxASSERT( GetType() == data.GetType() );\
594 classname##VariantData & otherData = (classname##VariantData &) data;\
596 return otherData.m_value == m_value;\
599 // implements a wxVariantData-derived class using for the Eq() method the
600 // operator== which must have been provided by "classname"
601 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname,expdecl) \
602 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
603 WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
604 WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl)
606 #define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \
607 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
609 // with Eq() implementation that always returns false
610 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname,expdecl) \
611 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
612 WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
614 bool classname##VariantData::Eq(wxVariantData& WXUNUSED(data)) const \
619 #define WX_PG_IMPLEMENT_VARIANT_DATA_DUMMY_EQ(classname) \
620 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname, wxEMPTY_PARAMETER_VALUE)
622 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxPoint
, WXDLLIMPEXP_PROPGRID
)
623 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxSize
, WXDLLIMPEXP_PROPGRID
)
624 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxArrayInt
, WXDLLIMPEXP_PROPGRID
)
625 DECLARE_VARIANT_OBJECT_EXPORTED(wxFont
, WXDLLIMPEXP_PROPGRID
)
626 template<> inline wxVariant
WXVARIANT( const wxFont
& value
)
633 template<> inline wxVariant
WXVARIANT( const wxColour
& value
)
640 // Define constants for common wxVariant type strings
642 #define wxPG_VARIANT_TYPE_STRING wxPGGlobalVars->m_strstring
643 #define wxPG_VARIANT_TYPE_LONG wxPGGlobalVars->m_strlong
644 #define wxPG_VARIANT_TYPE_BOOL wxPGGlobalVars->m_strbool
645 #define wxPG_VARIANT_TYPE_LIST wxPGGlobalVars->m_strlist
646 #define wxPG_VARIANT_TYPE_DOUBLE wxS("double")
647 #define wxPG_VARIANT_TYPE_ARRSTRING wxS("arrstring")
648 #define wxPG_VARIANT_TYPE_DATETIME wxS("datetime")
649 #define wxPG_VARIANT_TYPE_LONGLONG wxS("longlong")
650 #define wxPG_VARIANT_TYPE_ULONGLONG wxS("ulonglong")
654 // -----------------------------------------------------------------------
658 // NOTE: I have made two versions - worse ones (performance and consistency
659 // wise) use wxStringTokenizer and better ones (may have unfound bugs)
663 #include "wx/tokenzr.h"
665 // TOKENIZER1 can be done with wxStringTokenizer
666 #define WX_PG_TOKENIZER1_BEGIN(WXSTRING,DELIMITER) \
667 wxStringTokenizer tkz(WXSTRING,DELIMITER,wxTOKEN_RET_EMPTY); \
668 while ( tkz.HasMoreTokens() ) \
670 wxString token = tkz.GetNextToken(); \
674 #define WX_PG_TOKENIZER1_END() \
679 // 2nd version: tokens are surrounded by DELIMITERs (for example, C-style
680 // strings). TOKENIZER2 must use custom code (a class) for full compliance with
681 // " surrounded strings with \" inside.
683 // class implementation is in propgrid.cpp
686 class WXDLLIMPEXP_PROPGRID wxPGStringTokenizer
689 wxPGStringTokenizer( const wxString
& str
, wxChar delimeter
);
690 ~wxPGStringTokenizer();
692 bool HasMoreTokens(); // not const so we can do some stuff in it
693 wxString
GetNextToken();
696 const wxString
* m_str
;
697 wxString::const_iterator m_curPos
;
698 wxString m_readyToken
;
699 wxUniChar m_delimeter
;
702 #define WX_PG_TOKENIZER2_BEGIN(WXSTRING,DELIMITER) \
703 wxPGStringTokenizer tkz(WXSTRING,DELIMITER); \
704 while ( tkz.HasMoreTokens() ) \
706 wxString token = tkz.GetNextToken();
708 #define WX_PG_TOKENIZER2_END() \
711 // -----------------------------------------------------------------------
713 #endif // wxUSE_PROPGRID
715 #endif // _WX_PROPGRID_PROPGRIDDEFS_H_