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
46 // 1 to use double-buffer that guarantees flicker-free painting
47 #define wxPG_DOUBLE_BUFFER 1
50 #define wxPG_SUPPORT_TOOLTIPS 1
52 // width of optional bitmap/image in front of property
53 #define wxPG_CUSTOM_IMAGE_WIDTH 20
55 // 1 if splitter drag detect margin and control cannot overlap
56 #define wxPG_NO_CHILD_EVT_MOTION 0
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 #define wxPG_NAT_BUTTON_BORDER_ANY 1
95 #define wxPG_NAT_BUTTON_BORDER_X 1
96 #define wxPG_NAT_BUTTON_BORDER_Y 1
98 // If 1 then controls are refreshed after selected was drawn.
99 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 1
101 #elif defined(__WXMAC__)
103 // space between vertical line and value text
104 #define wxPG_XBEFORETEXT 4
105 // space between vertical line and value editor widget
106 #define wxPG_XBEFOREWIDGET 1
108 // x position adjustment for wxTextCtrl (and like)
109 #define wxPG_TEXTCTRLXADJUST 0
111 // comment to use bitmap buttons
112 #define wxPG_ICON_WIDTH 11
113 // 1 if wxRendererNative should be employed
114 #define wxPG_USE_RENDERER_NATIVE 1
116 // 1 to use double-buffer that guarantees flicker-free painting
117 #define wxPG_DOUBLE_BUFFER 0
120 #define wxPG_SUPPORT_TOOLTIPS 1
122 // width of optional bitmap/image in front of property
123 #define wxPG_CUSTOM_IMAGE_WIDTH 20
125 // 1 if splitter drag detect margin and control cannot overlap
126 #define wxPG_NO_CHILD_EVT_MOTION 0
128 #define wxPG_NAT_BUTTON_BORDER_ANY 0
129 #define wxPG_NAT_BUTTON_BORDER_X 0
130 #define wxPG_NAT_BUTTON_BORDER_Y 0
132 // If 1 then controls are refreshed after selected was drawn.
133 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 0
137 // space between vertical line and value text
138 #define wxPG_XBEFORETEXT 5
139 // space between vertical line and value editor widget
140 #define wxPG_XBEFOREWIDGET 1
142 // x position adjustment for wxTextCtrl (and like)
143 #define wxPG_TEXTCTRLXADJUST 3
145 // comment to use bitmap buttons
146 #define wxPG_ICON_WIDTH 9
147 // 1 if wxRendererNative should be employed
148 #define wxPG_USE_RENDERER_NATIVE 0
150 // 1 to use double-buffer that guarantees flicker-free painting
151 #define wxPG_DOUBLE_BUFFER 0
154 #define wxPG_SUPPORT_TOOLTIPS 0
156 // width of optional bitmap/image in front of property
157 #define wxPG_CUSTOM_IMAGE_WIDTH 20
159 // 1 if splitter drag detect margin and control cannot overlap
160 #define wxPG_NO_CHILD_EVT_MOTION 1
162 #define wxPG_NAT_BUTTON_BORDER_ANY 0
163 #define wxPG_NAT_BUTTON_BORDER_X 0
164 #define wxPG_NAT_BUTTON_BORDER_Y 0
166 // If 1 then controls are refreshed after selected was drawn.
167 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 1
171 #define wxPG_CONTROL_MARGIN 0 // space between splitter and control
173 #define wxCC_CUSTOM_IMAGE_MARGIN1 4 // before image
174 #define wxCC_CUSTOM_IMAGE_MARGIN2 5 // after image
176 #define DEFAULT_IMAGE_OFFSET_INCREMENT \
177 (wxCC_CUSTOM_IMAGE_MARGIN1 + wxCC_CUSTOM_IMAGE_MARGIN2)
179 #define wxPG_DRAG_MARGIN 30
181 #if wxPG_NO_CHILD_EVT_MOTION
182 #define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
183 #define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
185 #define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
186 #define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
189 // Use this macro to generate standard custom image height from
190 #define wxPG_STD_CUST_IMAGE_HEIGHT(LINEHEIGHT) (LINEHEIGHT-3)
193 #if defined(__WXWINCE__)
194 #define wxPG_SMALL_SCREEN 1
195 #undef wxPG_DOUBLE_BUFFER
196 #define wxPG_DOUBLE_BUFFER 0
198 #define wxPG_SMALL_SCREEN 0
202 // Undefine wxPG_ICON_WIDTH to use supplied xpm bitmaps instead
203 // (for tree buttons)
204 //#undef wxPG_ICON_WIDTH
206 #if WXWIN_COMPATIBILITY_2_6 || WXWIN_COMPATIBILITY_2_8
207 #define wxPG_COMPATIBILITY_1_4 1
209 #define wxPG_COMPATIBILITY_1_4 0
212 // Need to force disable tooltips?
214 #undef wxPG_SUPPORT_TOOLTIPS
215 #define wxPG_SUPPORT_TOOLTIPS 0
218 // Set 1 to include advanced properties (wxFontProperty, wxColourProperty, etc.)
219 #ifndef wxPG_INCLUDE_ADVPROPS
220 #define wxPG_INCLUDE_ADVPROPS 1
223 // Set 1 to include checkbox editor class
224 #define wxPG_INCLUDE_CHECKBOX 1
226 // -----------------------------------------------------------------------
231 class wxPropertyCategory
;
233 class wxPropertyGridPageState
;
235 class wxPGCellRenderer
;
236 class wxPGChoiceEntry
;
237 class wxPGPropArgCls
;
238 class wxPropertyGridInterface
;
239 class wxPropertyGrid
;
240 class wxPropertyGridEvent
;
241 class wxPropertyGridManager
;
242 class wxPGOwnerDrawnComboBox
;
243 class wxPGEditorDialogAdapter
;
244 class wxPGValidationInfo
;
247 // -----------------------------------------------------------------------
249 /** @section propgrid_misc wxPropertyGrid Miscellanous
251 This section describes some miscellanous values, types and macros.
255 // Used to tell wxPGProperty to use label as name as well
256 #define wxPG_LABEL (*wxPGProperty::sm_wxPG_LABEL)
258 // This is the value placed in wxPGProperty::sm_wxPG_LABEL
259 #define wxPG_LABEL_STRING wxS("@!")
260 #define wxPG_NULL_BITMAP wxNullBitmap
261 #define wxPG_COLOUR_BLACK (*wxBLACK)
263 /** Convert Red, Green and Blue to a single 32-bit value.
265 #define wxPG_COLOUR(R,G,B) ((wxUint32)(R+(G<<8)+(B<<16)))
268 /** If property is supposed to have custom-painted image, then returning
269 this in OnMeasureImage() will usually be enough.
271 #define wxPG_DEFAULT_IMAGE_SIZE wxSize(-1, -1)
274 /** This callback function is used for sorting properties.
276 Call wxPropertyGrid::SetSortFunction() to set it.
278 Sort function should return a value greater than 0 if position of p1 is
279 after p2. So, for instance, when comparing property names, you can use
280 following implementation:
283 int MyPropertySortFunction(wxPropertyGrid* propGrid,
287 return p1->GetBaseName().compare( p2->GetBaseName() );
291 typedef int (*wxPGSortCallback
)(wxPropertyGrid
* propGrid
,
297 typedef wxString wxPGCachedString
;
302 // -----------------------------------------------------------------------
304 // Used to indicate wxPGChoices::Add etc that the value is actually not given
306 #define wxPG_INVALID_VALUE INT_MAX
308 // -----------------------------------------------------------------------
310 WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(wxPGProperty
*, wxArrayPGProperty
,
312 class WXDLLIMPEXP_PROPGRID
);
314 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(void*,
316 class WXDLLIMPEXP_PROPGRID
);
318 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxString
,
320 class WXDLLIMPEXP_PROPGRID
);
322 WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(void*,
324 class WXDLLIMPEXP_PROPGRID
);
326 WX_DECLARE_HASH_MAP_WITH_DECL(wxInt32
,
331 class WXDLLIMPEXP_PROPGRID
);
333 // Utility to find if specific item is in a vector. Returns index to
334 // the item, or wxNOT_FOUND if not present.
335 template<typename CONTAINER
, typename T
>
336 int wxPGFindInVector( CONTAINER vector
, const T
& item
)
338 for ( unsigned int i
=0; i
<vector
.size(); i
++ )
340 if ( vector
[i
] == item
)
346 // -----------------------------------------------------------------------
348 enum wxPG_GETPROPERTYVALUES_FLAGS
351 /** Flags for wxPropertyGridInterface::GetPropertyValues */
352 wxPG_KEEP_STRUCTURE
= 0x00000010,
354 /** Flags for wxPropertyGrid::SetPropertyAttribute() etc */
355 wxPG_RECURSE
= 0x00000020,
357 /** Include attributes for GetPropertyValues. */
358 wxPG_INC_ATTRIBUTES
= 0x00000040,
360 /** Used when first starting recursion. */
361 wxPG_RECURSE_STARTS
= 0x00000080,
363 /** Force value change. */
364 wxPG_FORCE
= 0x00000100,
366 /** Only sort categories and their immediate children.
367 Sorting done by wxPG_AUTO_SORT option uses this.
369 wxPG_SORT_TOP_LEVEL_ONLY
= 0x00000200
373 /** Flags for wxPropertyGrid::SetPropertyAttribute() etc */
374 #define wxPG_DONT_RECURSE 0x00000000
376 // -----------------------------------------------------------------------
378 // Misc argument flags.
379 enum wxPG_MISC_ARG_FLAGS
381 // Get/Store full value instead of displayed value.
382 wxPG_FULL_VALUE
= 0x00000001,
384 wxPG_REPORT_ERROR
= 0x00000002,
386 wxPG_PROPERTY_SPECIFIC
= 0x00000004,
388 // Get/Store editable value instead of displayed one (should only be
389 // different in the case of common values)
390 wxPG_EDITABLE_VALUE
= 0x00000008,
392 // Used when dealing with fragments of composite string value
393 wxPG_COMPOSITE_FRAGMENT
= 0x00000010,
395 // Means property for which final string value is for can not really be
397 wxPG_UNEDITABLE_COMPOSITE_FRAGMENT
= 0x00000020,
399 // ValueToString() called from GetValueAsString()
400 // (guarantees that input wxVariant value is current own value)
401 wxPG_VALUE_IS_CURRENT
= 0x00000040,
403 // Value is being set programmatically (ie. not by user)
404 wxPG_PROGRAMMATIC_VALUE
= 0x00000080
407 // -----------------------------------------------------------------------
409 // wxPGProperty::SetValue() flags
410 enum wxPG_SETVALUE_FLAGS
412 wxPG_SETVAL_REFRESH_EDITOR
= 0x0001,
413 wxPG_SETVAL_AGGREGATED
= 0x0002,
414 wxPG_SETVAL_FROM_PARENT
= 0x0004,
415 wxPG_SETVAL_BY_USER
= 0x0008 // Set if value changed by user
418 // -----------------------------------------------------------------------
421 // Valid constants for wxPG_UINT_BASE attribute
422 // (long because of wxVariant constructor)
423 #define wxPG_BASE_OCT (long)8
424 #define wxPG_BASE_DEC (long)10
425 #define wxPG_BASE_HEX (long)16
426 #define wxPG_BASE_HEXL (long)32
429 // Valid constants for wxPG_UINT_PREFIX attribute
430 #define wxPG_PREFIX_NONE (long)0
431 #define wxPG_PREFIX_0x (long)1
432 #define wxPG_PREFIX_DOLLAR_SIGN (long)2
434 // -----------------------------------------------------------------------
437 // Editor accessor (for backwards compatiblity use only).
438 #define wxPG_EDITOR(T) wxPGEditor_##T
440 // Macro for declaring editor class, with optional impexpdecl part.
441 #ifndef WX_PG_DECLARE_EDITOR_WITH_DECL
443 #define WX_PG_DECLARE_EDITOR_WITH_DECL(EDITOR,DECL) \
444 extern DECL wxPGEditor* wxPGEditor_##EDITOR; \
445 extern DECL wxPGEditor* wxPGConstruct##EDITOR##EditorClass();
449 // Declare editor class.
450 #define WX_PG_DECLARE_EDITOR(EDITOR) \
451 extern wxPGEditor* wxPGEditor_##EDITOR; \
452 extern wxPGEditor* wxPGConstruct##EDITOR##EditorClass();
454 // Declare builtin editor classes.
455 WX_PG_DECLARE_EDITOR_WITH_DECL(TextCtrl
,WXDLLIMPEXP_PROPGRID
)
456 WX_PG_DECLARE_EDITOR_WITH_DECL(Choice
,WXDLLIMPEXP_PROPGRID
)
457 WX_PG_DECLARE_EDITOR_WITH_DECL(ComboBox
,WXDLLIMPEXP_PROPGRID
)
458 WX_PG_DECLARE_EDITOR_WITH_DECL(TextCtrlAndButton
,WXDLLIMPEXP_PROPGRID
)
459 #if wxPG_INCLUDE_CHECKBOX
460 WX_PG_DECLARE_EDITOR_WITH_DECL(CheckBox
,WXDLLIMPEXP_PROPGRID
)
462 WX_PG_DECLARE_EDITOR_WITH_DECL(ChoiceAndButton
,WXDLLIMPEXP_PROPGRID
)
464 // -----------------------------------------------------------------------
469 // Macro WXVARIANT allows creation of wxVariant from any type supported by
470 // wxWidgets internally, and of all types created using
471 // WX_PG_DECLARE_VARIANT_DATA.
473 wxVariant
WXVARIANT( const T
& WXUNUSED(value
) )
475 wxFAIL_MSG("Code should always call specializations of this template");
479 template<> inline wxVariant
WXVARIANT( const int& value
)
480 { return wxVariant((long)value
); }
481 template<> inline wxVariant
WXVARIANT( const long& value
)
482 { return wxVariant(value
); }
483 template<> inline wxVariant
WXVARIANT( const bool& value
)
484 { return wxVariant(value
); }
485 template<> inline wxVariant
WXVARIANT( const double& value
)
486 { return wxVariant(value
); }
487 template<> inline wxVariant
WXVARIANT( const wxArrayString
& value
)
488 { return wxVariant(value
); }
489 template<> inline wxVariant
WXVARIANT( const wxString
& value
)
490 { return wxVariant(value
); }
492 template<> inline wxVariant
WXVARIANT( const wxLongLong
& value
)
493 { return wxVariant(value
); }
494 template<> inline wxVariant
WXVARIANT( const wxULongLong
& value
)
495 { return wxVariant(value
); }
498 template<> inline wxVariant
WXVARIANT( const wxDateTime
& value
)
499 { return wxVariant(value
); }
504 // These are modified versions of DECLARE/WX_PG_IMPLEMENT_VARIANT_DATA
505 // macros found in variant.h. Difference are as follows:
506 // * These support non-wxObject data
507 // * These implement classname##RefFromVariant function which returns
508 // reference to data within.
509 // * const char* classname##_VariantType which equals classname.
512 #define WX_PG_DECLARE_VARIANT_DATA(classname) \
513 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
515 #define WX_PG_DECLARE_VARIANT_DATA_EXPORTED(classname,expdecl) \
516 expdecl classname& operator << ( classname &object, const wxVariant &variant ); \
517 expdecl wxVariant& operator << ( wxVariant &variant, const classname &object ); \
518 expdecl const classname& classname##RefFromVariant( const wxVariant& variant ); \
519 expdecl classname& classname##RefFromVariant( wxVariant& variant ); \
520 template<> inline wxVariant WXVARIANT( const classname& value ) \
526 extern expdecl const char* classname##_VariantType;
529 #define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \
530 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
532 // Add getter (ie. classname << variant) separately to allow
533 // custom implementations.
534 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,expdecl) \
535 const char* classname##_VariantType = #classname; \
536 class classname##VariantData: public wxVariantData \
539 classname##VariantData() {} \
540 classname##VariantData( const classname &value ) { m_value = value; } \
542 classname &GetValue() { return m_value; } \
544 const classname &GetValue() const { return m_value; } \
546 virtual bool Eq(wxVariantData& data) const; \
548 virtual wxString GetType() const; \
550 virtual wxVariantData* Clone() const { return new classname##VariantData(m_value); } \
552 DECLARE_WXANY_CONVERSION() \
557 IMPLEMENT_TRIVIAL_WXANY_CONVERSION(classname, classname##VariantData) \
559 wxString classname##VariantData::GetType() const\
561 return wxS(#classname);\
564 expdecl wxVariant& operator << ( wxVariant &variant, const classname &value )\
566 classname##VariantData *data = new classname##VariantData( value );\
567 variant.SetData( data );\
570 expdecl classname& classname##RefFromVariant( wxVariant& variant ) \
572 wxASSERT_MSG( variant.GetType() == wxS(#classname), \
573 wxString::Format("Variant type should have been '%s'" \
576 variant.GetType().c_str())); \
577 classname##VariantData *data = \
578 (classname##VariantData*) variant.GetData(); \
579 return data->GetValue();\
581 expdecl const classname& classname##RefFromVariant( const wxVariant& variant ) \
583 wxASSERT_MSG( variant.GetType() == wxS(#classname), \
584 wxString::Format("Variant type should have been '%s'" \
587 variant.GetType().c_str())); \
588 classname##VariantData *data = \
589 (classname##VariantData*) variant.GetData(); \
590 return data->GetValue();\
593 #define WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname, expdecl) \
594 expdecl classname& operator << ( classname &value, const wxVariant &variant )\
596 wxASSERT( variant.GetType() == #classname );\
598 classname##VariantData *data = (classname##VariantData*) variant.GetData();\
599 value = data->GetValue();\
603 #define WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname, expdecl) \
604 bool classname##VariantData::Eq(wxVariantData& data) const \
606 wxASSERT( GetType() == data.GetType() );\
608 classname##VariantData & otherData = (classname##VariantData &) data;\
610 return otherData.m_value == m_value;\
613 // implements a wxVariantData-derived class using for the Eq() method the
614 // operator== which must have been provided by "classname"
615 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname,expdecl) \
616 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
617 WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
618 WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl)
620 #define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \
621 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
623 // with Eq() implementation that always returns false
624 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname,expdecl) \
625 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
626 WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
628 bool classname##VariantData::Eq(wxVariantData& WXUNUSED(data)) const \
633 #define WX_PG_IMPLEMENT_VARIANT_DATA_DUMMY_EQ(classname) \
634 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname, wxEMPTY_PARAMETER_VALUE)
636 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxPoint
, WXDLLIMPEXP_PROPGRID
)
637 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxSize
, WXDLLIMPEXP_PROPGRID
)
638 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxArrayInt
, WXDLLIMPEXP_PROPGRID
)
639 DECLARE_VARIANT_OBJECT_EXPORTED(wxFont
, WXDLLIMPEXP_PROPGRID
)
640 template<> inline wxVariant
WXVARIANT( const wxFont
& value
)
647 template<> inline wxVariant
WXVARIANT( const wxColour
& value
)
654 // Define constants for common wxVariant type strings
656 #define wxPG_VARIANT_TYPE_STRING wxPGGlobalVars->m_strstring
657 #define wxPG_VARIANT_TYPE_LONG wxPGGlobalVars->m_strlong
658 #define wxPG_VARIANT_TYPE_BOOL wxPGGlobalVars->m_strbool
659 #define wxPG_VARIANT_TYPE_LIST wxPGGlobalVars->m_strlist
660 #define wxPG_VARIANT_TYPE_DOUBLE wxS("double")
661 #define wxPG_VARIANT_TYPE_ARRSTRING wxS("arrstring")
662 #define wxPG_VARIANT_TYPE_DATETIME wxS("datetime")
663 #define wxPG_VARIANT_TYPE_LONGLONG wxS("longlong")
664 #define wxPG_VARIANT_TYPE_ULONGLONG wxS("ulonglong")
668 // -----------------------------------------------------------------------
672 // NOTE: I have made two versions - worse ones (performance and consistency
673 // wise) use wxStringTokenizer and better ones (may have unfound bugs)
677 #include "wx/tokenzr.h"
679 // TOKENIZER1 can be done with wxStringTokenizer
680 #define WX_PG_TOKENIZER1_BEGIN(WXSTRING,DELIMITER) \
681 wxStringTokenizer tkz(WXSTRING,DELIMITER,wxTOKEN_RET_EMPTY); \
682 while ( tkz.HasMoreTokens() ) \
684 wxString token = tkz.GetNextToken(); \
688 #define WX_PG_TOKENIZER1_END() \
693 // 2nd version: tokens are surrounded by DELIMITERs (for example, C-style
694 // strings). TOKENIZER2 must use custom code (a class) for full compliance with
695 // " surrounded strings with \" inside.
697 // class implementation is in propgrid.cpp
700 class WXDLLIMPEXP_PROPGRID wxPGStringTokenizer
703 wxPGStringTokenizer( const wxString
& str
, wxChar delimeter
);
704 ~wxPGStringTokenizer();
706 bool HasMoreTokens(); // not const so we can do some stuff in it
707 wxString
GetNextToken();
710 const wxString
* m_str
;
711 wxString::const_iterator m_curPos
;
712 wxString m_readyToken
;
713 wxUniChar m_delimeter
;
716 #define WX_PG_TOKENIZER2_BEGIN(WXSTRING,DELIMITER) \
717 wxPGStringTokenizer tkz(WXSTRING,DELIMITER); \
718 while ( tkz.HasMoreTokens() ) \
720 wxString token = tkz.GetNextToken();
722 #define WX_PG_TOKENIZER2_END() \
725 // -----------------------------------------------------------------------
727 #endif // wxUSE_PROPGRID
729 #endif // _WX_PROPGRID_PROPGRIDDEFS_H_