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
33 #if defined(__WXMSW__)
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
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
45 // 1 to use double-buffer that guarantees flicker-free painting
46 #define wxPG_DOUBLE_BUFFER 1
49 #define wxPG_SUPPORT_TOOLTIPS 1
51 // width of optional bitmap/image in front of property
52 #define wxPG_CUSTOM_IMAGE_WIDTH 20
54 // 1 if splitter drag detect margin and control cannot overlap
55 #define wxPG_NO_CHILD_EVT_MOTION 0
57 // If 1, then setting empty tooltip actually hides it
58 #define wxPG_ALLOW_EMPTY_TOOLTIPS 1
60 #define wxPG_NAT_BUTTON_BORDER_ANY 1
61 #define wxPG_NAT_BUTTON_BORDER_X 1
62 #define wxPG_NAT_BUTTON_BORDER_Y 1
64 // If 1 then controls are refreshed after selected was drawn.
65 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 0
67 #elif defined(__WXGTK__)
69 // space between vertical line and value text
70 #define wxPG_XBEFORETEXT 5
71 // space between vertical line and value editor control
72 #define wxPG_XBEFOREWIDGET 1
74 // x position adjustment for wxTextCtrl (and like)
75 // NB: Only define wxPG_TEXTCTRLXADJUST for platforms that do not
76 // (yet) support wxTextEntry::SetMargins() for the left margin.
77 //#define wxPG_TEXTCTRLXADJUST 3
79 // comment to use bitmap buttons
80 #define wxPG_ICON_WIDTH 9
81 // 1 if wxRendererNative should be employed
82 #define wxPG_USE_RENDERER_NATIVE 1
84 // 1 to use double-buffer that guarantees flicker-free painting
85 #define wxPG_DOUBLE_BUFFER 1
88 #define wxPG_SUPPORT_TOOLTIPS 1
90 // width of optional bitmap/image in front of property
91 #define wxPG_CUSTOM_IMAGE_WIDTH 20
93 // 1 if splitter drag detect margin and control cannot overlap
94 #define wxPG_NO_CHILD_EVT_MOTION 1
96 // If 1, then setting empty tooltip actually hides it
97 #define wxPG_ALLOW_EMPTY_TOOLTIPS 0
99 #define wxPG_NAT_BUTTON_BORDER_ANY 1
100 #define wxPG_NAT_BUTTON_BORDER_X 1
101 #define wxPG_NAT_BUTTON_BORDER_Y 1
103 // If 1 then controls are refreshed after selected was drawn.
104 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 1
106 #elif defined(__WXMAC__)
108 // space between vertical line and value text
109 #define wxPG_XBEFORETEXT 4
110 // space between vertical line and value editor widget
111 #define wxPG_XBEFOREWIDGET 1
113 // x position adjustment for wxTextCtrl (and like)
114 #define wxPG_TEXTCTRLXADJUST 0
116 // comment to use bitmap buttons
117 #define wxPG_ICON_WIDTH 11
118 // 1 if wxRendererNative should be employed
119 #define wxPG_USE_RENDERER_NATIVE 1
121 // 1 to use double-buffer that guarantees flicker-free painting
122 #define wxPG_DOUBLE_BUFFER 0
125 #define wxPG_SUPPORT_TOOLTIPS 1
127 // width of optional bitmap/image in front of property
128 #define wxPG_CUSTOM_IMAGE_WIDTH 20
130 // 1 if splitter drag detect margin and control cannot overlap
131 #define wxPG_NO_CHILD_EVT_MOTION 0
133 // If 1, then setting empty tooltip actually hides it
134 #define wxPG_ALLOW_EMPTY_TOOLTIPS 1
136 #define wxPG_NAT_BUTTON_BORDER_ANY 0
137 #define wxPG_NAT_BUTTON_BORDER_X 0
138 #define wxPG_NAT_BUTTON_BORDER_Y 0
140 // If 1 then controls are refreshed after selected was drawn.
141 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 0
145 // space between vertical line and value text
146 #define wxPG_XBEFORETEXT 5
147 // space between vertical line and value editor widget
148 #define wxPG_XBEFOREWIDGET 1
150 // x position adjustment for wxTextCtrl (and like)
151 #define wxPG_TEXTCTRLXADJUST 3
153 // comment to use bitmap buttons
154 #define wxPG_ICON_WIDTH 9
155 // 1 if wxRendererNative should be employed
156 #define wxPG_USE_RENDERER_NATIVE 0
158 // 1 to use double-buffer that guarantees flicker-free painting
159 #define wxPG_DOUBLE_BUFFER 0
162 #define wxPG_SUPPORT_TOOLTIPS 0
164 // width of optional bitmap/image in front of property
165 #define wxPG_CUSTOM_IMAGE_WIDTH 20
167 // 1 if splitter drag detect margin and control cannot overlap
168 #define wxPG_NO_CHILD_EVT_MOTION 1
170 // If 1, then setting empty tooltip actually hides it
171 #define wxPG_ALLOW_EMPTY_TOOLTIPS 0
173 #define wxPG_NAT_BUTTON_BORDER_ANY 0
174 #define wxPG_NAT_BUTTON_BORDER_X 0
175 #define wxPG_NAT_BUTTON_BORDER_Y 0
177 // If 1 then controls are refreshed after selected was drawn.
178 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 1
182 #define wxPG_CONTROL_MARGIN 0 // space between splitter and control
184 #define wxCC_CUSTOM_IMAGE_MARGIN1 4 // before image
185 #define wxCC_CUSTOM_IMAGE_MARGIN2 5 // after image
187 #define DEFAULT_IMAGE_OFFSET_INCREMENT \
188 (wxCC_CUSTOM_IMAGE_MARGIN1 + wxCC_CUSTOM_IMAGE_MARGIN2)
190 #define wxPG_DRAG_MARGIN 30
192 #if wxPG_NO_CHILD_EVT_MOTION
193 #define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
194 #define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
196 #define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
197 #define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
200 // Use this macro to generate standard custom image height from
201 #define wxPG_STD_CUST_IMAGE_HEIGHT(LINEHEIGHT) (LINEHEIGHT-3)
204 #if defined(__WXWINCE__)
205 #define wxPG_SMALL_SCREEN 1
206 #undef wxPG_DOUBLE_BUFFER
207 #define wxPG_DOUBLE_BUFFER 0
209 #define wxPG_SMALL_SCREEN 0
212 #endif // #ifndef SWIG
214 // Undefine wxPG_ICON_WIDTH to use supplied xpm bitmaps instead
215 // (for tree buttons)
216 //#undef wxPG_ICON_WIDTH
218 #if WXWIN_COMPATIBILITY_2_6 || WXWIN_COMPATIBILITY_2_8
219 #define wxPG_COMPATIBILITY_1_4 1
221 #define wxPG_COMPATIBILITY_1_4 0
224 // Need to force disable tooltips?
226 #undef wxPG_SUPPORT_TOOLTIPS
227 #define wxPG_SUPPORT_TOOLTIPS 0
230 // Set 1 to include advanced properties (wxFontProperty, wxColourProperty, etc.)
231 #ifndef wxPG_INCLUDE_ADVPROPS
232 #define wxPG_INCLUDE_ADVPROPS 1
235 // Set 1 to include checkbox editor class
236 #define wxPG_INCLUDE_CHECKBOX 1
238 // -----------------------------------------------------------------------
243 class wxPropertyCategory
;
245 class wxPropertyGridPageState
;
247 class wxPGCellRenderer
;
248 class wxPGChoiceEntry
;
249 class wxPGPropArgCls
;
250 class wxPropertyGridInterface
;
251 class wxPropertyGrid
;
252 class wxPropertyGridEvent
;
253 class wxPropertyGridManager
;
254 class wxPGOwnerDrawnComboBox
;
255 class wxPGEditorDialogAdapter
;
256 class wxPGValidationInfo
;
259 // -----------------------------------------------------------------------
261 /** @section propgrid_misc wxPropertyGrid Miscellanous
263 This section describes some miscellanous values, types and macros.
268 // Used to tell wxPGProperty to use label as name as well
269 #define wxPG_LABEL (*wxPGProperty::sm_wxPG_LABEL)
270 // This is the value placed in wxPGProperty::sm_wxPG_LABEL
271 #define wxPG_LABEL_STRING wxS("@!")
272 #define wxPG_NULL_BITMAP wxNullBitmap
273 #define wxPG_COLOUR_BLACK (*wxBLACK)
275 #define wxPG_NULL_BITMAP wxBitmap_NULL
276 #define wxPG_COLOUR_BLACK wxColour_BLACK
277 #endif // #ifndef SWIG
279 /** Convert Red, Green and Blue to a single 32-bit value.
281 #define wxPG_COLOUR(R,G,B) ((wxUint32)(R+(G<<8)+(B<<16)))
284 /** If property is supposed to have custom-painted image, then returning
285 this in OnMeasureImage() will usually be enough.
287 #define wxPG_DEFAULT_IMAGE_SIZE wxSize(-1, -1)
290 /** This callback function is used for sorting properties.
292 Call wxPropertyGrid::SetSortFunction() to set it.
294 Sort function should return a value greater than 0 if position of p1 is
295 after p2. So, for instance, when comparing property names, you can use
296 following implementation:
299 int MyPropertySortFunction(wxPropertyGrid* propGrid,
303 return p1->GetBaseName().compare( p2->GetBaseName() );
307 typedef int (*wxPGSortCallback
)(wxPropertyGrid
* propGrid
,
313 typedef wxString wxPGCachedString
;
318 // -----------------------------------------------------------------------
320 // Used to indicate wxPGChoices::Add etc that the value is actually not given
322 #define wxPG_INVALID_VALUE INT_MAX
324 // -----------------------------------------------------------------------
328 WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(wxPGProperty
*, wxArrayPGProperty
,
330 class WXDLLIMPEXP_PROPGRID
);
332 // Always use wxString based hashmap with unicode, stl, swig and GCC 4.0+
333 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(void*,
335 class WXDLLIMPEXP_PROPGRID
);
337 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxString
,
339 class WXDLLIMPEXP_PROPGRID
);
341 WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(void*,
343 class WXDLLIMPEXP_PROPGRID
);
345 WX_DECLARE_HASH_MAP_WITH_DECL(wxInt32
,
350 class WXDLLIMPEXP_PROPGRID
);
352 #endif // #ifndef SWIG
354 // -----------------------------------------------------------------------
356 enum wxPG_GETPROPERTYVALUES_FLAGS
359 /** Flags for wxPropertyGridInterface::GetPropertyValues */
360 wxPG_KEEP_STRUCTURE
= 0x00000010,
362 /** Flags for wxPropertyGrid::SetPropertyAttribute() etc */
363 wxPG_RECURSE
= 0x00000020,
365 /** Include attributes for GetPropertyValues. */
366 wxPG_INC_ATTRIBUTES
= 0x00000040,
368 /** Used when first starting recursion. */
369 wxPG_RECURSE_STARTS
= 0x00000080,
371 /** Force value change. */
372 wxPG_FORCE
= 0x00000100,
374 /** Only sort categories and their immediate children.
375 Sorting done by wxPG_AUTO_SORT option uses this.
377 wxPG_SORT_TOP_LEVEL_ONLY
= 0x00000200
381 /** Flags for wxPropertyGrid::SetPropertyAttribute() etc */
382 #define wxPG_DONT_RECURSE 0x00000000
384 // -----------------------------------------------------------------------
386 // Misc argument flags.
387 enum wxPG_MISC_ARG_FLAGS
389 // Get/Store full value instead of displayed value.
390 wxPG_FULL_VALUE
= 0x00000001,
392 wxPG_REPORT_ERROR
= 0x00000002,
394 wxPG_PROPERTY_SPECIFIC
= 0x00000004,
396 // Get/Store editable value instead of displayed one (should only be
397 // different in the case of common values)
398 wxPG_EDITABLE_VALUE
= 0x00000008,
400 // Used when dealing with fragments of composite string value
401 wxPG_COMPOSITE_FRAGMENT
= 0x00000010,
403 // Means property for which final string value is for can not really be
405 wxPG_UNEDITABLE_COMPOSITE_FRAGMENT
= 0x00000020,
407 // ValueToString() called from GetValueAsString()
408 // (guarantees that input wxVariant value is current own value)
409 wxPG_VALUE_IS_CURRENT
= 0x00000040,
411 // Value is being set programmatically (ie. not by user)
412 wxPG_PROGRAMMATIC_VALUE
= 0x00000080
415 // -----------------------------------------------------------------------
417 // wxPGProperty::SetValue() flags
418 enum wxPG_SETVALUE_FLAGS
420 wxPG_SETVAL_REFRESH_EDITOR
= 0x0001,
421 wxPG_SETVAL_AGGREGATED
= 0x0002,
422 wxPG_SETVAL_FROM_PARENT
= 0x0004,
423 wxPG_SETVAL_BY_USER
= 0x0008 // Set if value changed by user
426 // -----------------------------------------------------------------------
429 // Valid constants for wxPG_UINT_BASE attribute
430 // (long because of wxVariant constructor)
431 #define wxPG_BASE_OCT (long)8
432 #define wxPG_BASE_DEC (long)10
433 #define wxPG_BASE_HEX (long)16
434 #define wxPG_BASE_HEXL (long)32
437 // Valid constants for wxPG_UINT_PREFIX attribute
438 #define wxPG_PREFIX_NONE (long)0
439 #define wxPG_PREFIX_0x (long)1
440 #define wxPG_PREFIX_DOLLAR_SIGN (long)2
442 // -----------------------------------------------------------------------
447 // Editor accessor (for backwards compatiblity use only).
448 #define wxPG_EDITOR(T) wxPGEditor_##T
450 // Declare editor class, with optional part.
451 #define WX_PG_DECLARE_EDITOR_WITH_DECL(EDITOR,DECL) \
452 extern DECL wxPGEditor* wxPGEditor_##EDITOR; \
453 extern DECL wxPGEditor* wxPGConstruct##EDITOR##EditorClass();
455 // Declare editor class.
456 #define WX_PG_DECLARE_EDITOR(EDITOR) \
457 extern wxPGEditor* wxPGEditor_##EDITOR; \
458 extern wxPGEditor* wxPGConstruct##EDITOR##EditorClass();
460 // Declare builtin editor classes.
461 WX_PG_DECLARE_EDITOR_WITH_DECL(TextCtrl
,WXDLLIMPEXP_PROPGRID
)
462 WX_PG_DECLARE_EDITOR_WITH_DECL(Choice
,WXDLLIMPEXP_PROPGRID
)
463 WX_PG_DECLARE_EDITOR_WITH_DECL(ComboBox
,WXDLLIMPEXP_PROPGRID
)
464 WX_PG_DECLARE_EDITOR_WITH_DECL(TextCtrlAndButton
,WXDLLIMPEXP_PROPGRID
)
465 #if wxPG_INCLUDE_CHECKBOX
466 WX_PG_DECLARE_EDITOR_WITH_DECL(CheckBox
,WXDLLIMPEXP_PROPGRID
)
468 WX_PG_DECLARE_EDITOR_WITH_DECL(ChoiceAndButton
,WXDLLIMPEXP_PROPGRID
)
472 // -----------------------------------------------------------------------
477 // Macro WXVARIANT allows creation of wxVariant from any type supported by
478 // wxWidgets internally, and of all types created using
479 // WX_PG_DECLARE_VARIANT_DATA.
481 wxVariant
WXVARIANT( const T
& WXUNUSED(value
) )
483 wxFAIL_MSG("Code should always call specializations of this template");
487 template<> inline wxVariant
WXVARIANT( const int& value
)
488 { return wxVariant((long)value
); }
489 template<> inline wxVariant
WXVARIANT( const long& value
)
490 { return wxVariant(value
); }
491 template<> inline wxVariant
WXVARIANT( const bool& value
)
492 { return wxVariant(value
); }
493 template<> inline wxVariant
WXVARIANT( const double& value
)
494 { return wxVariant(value
); }
495 template<> inline wxVariant
WXVARIANT( const wxArrayString
& value
)
496 { return wxVariant(value
); }
497 template<> inline wxVariant
WXVARIANT( const wxString
& value
)
498 { return wxVariant(value
); }
500 template<> inline wxVariant
WXVARIANT( const wxLongLong
& value
)
501 { return wxVariant(value
); }
502 template<> inline wxVariant
WXVARIANT( const wxULongLong
& value
)
503 { return wxVariant(value
); }
506 template<> inline wxVariant
WXVARIANT( const wxDateTime
& value
)
507 { return wxVariant(value
); }
512 // These are modified versions of DECLARE/WX_PG_IMPLEMENT_VARIANT_DATA
513 // macros found in variant.h. Difference are as follows:
514 // * These support non-wxObject data
515 // * These implement classname##RefFromVariant function which returns
516 // reference to data within.
517 // * const char* classname##_VariantType which equals classname.
520 #define WX_PG_DECLARE_VARIANT_DATA(classname) \
521 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
523 #define WX_PG_DECLARE_VARIANT_DATA_EXPORTED(classname,expdecl) \
524 expdecl classname& operator << ( classname &object, const wxVariant &variant ); \
525 expdecl wxVariant& operator << ( wxVariant &variant, const classname &object ); \
526 expdecl const classname& classname##RefFromVariant( const wxVariant& variant ); \
527 expdecl classname& classname##RefFromVariant( wxVariant& variant ); \
528 template<> inline wxVariant WXVARIANT( const classname& value ) \
534 extern expdecl const char* classname##_VariantType;
537 #define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \
538 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
540 // Add getter (ie. classname << variant) separately to allow
541 // custom implementations.
542 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,expdecl) \
543 const char* classname##_VariantType = #classname; \
544 class classname##VariantData: public wxVariantData \
547 classname##VariantData() {} \
548 classname##VariantData( const classname &value ) { m_value = value; } \
550 classname &GetValue() { return m_value; } \
552 const classname &GetValue() const { return m_value; } \
554 virtual bool Eq(wxVariantData& data) const; \
556 virtual wxString GetType() const; \
558 virtual wxVariantData* Clone() const { return new classname##VariantData(m_value); } \
564 wxString classname##VariantData::GetType() const\
566 return wxS(#classname);\
569 expdecl wxVariant& operator << ( wxVariant &variant, const classname &value )\
571 classname##VariantData *data = new classname##VariantData( value );\
572 variant.SetData( data );\
575 expdecl classname& classname##RefFromVariant( wxVariant& variant ) \
577 wxASSERT_MSG( variant.GetType() == wxS(#classname), \
578 wxString::Format("Variant type should have been '%s'" \
581 variant.GetType().c_str())); \
582 classname##VariantData *data = \
583 (classname##VariantData*) variant.GetData(); \
584 return data->GetValue();\
586 expdecl const classname& classname##RefFromVariant( const wxVariant& variant ) \
588 wxASSERT_MSG( variant.GetType() == wxS(#classname), \
589 wxString::Format("Variant type should have been '%s'" \
592 variant.GetType().c_str())); \
593 classname##VariantData *data = \
594 (classname##VariantData*) variant.GetData(); \
595 return data->GetValue();\
598 #define WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname, expdecl) \
599 expdecl classname& operator << ( classname &value, const wxVariant &variant )\
601 wxASSERT( variant.GetType() == #classname );\
603 classname##VariantData *data = (classname##VariantData*) variant.GetData();\
604 value = data->GetValue();\
608 #define WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname, expdecl) \
609 bool classname##VariantData::Eq(wxVariantData& data) const \
611 wxASSERT( GetType() == data.GetType() );\
613 classname##VariantData & otherData = (classname##VariantData &) data;\
615 return otherData.m_value == m_value;\
618 // implements a wxVariantData-derived class using for the Eq() method the
619 // operator== which must have been provided by "classname"
620 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname,expdecl) \
621 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
622 WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
623 WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl)
625 #define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \
626 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
628 // with Eq() implementation that always returns false
629 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname,expdecl) \
630 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
631 WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
633 bool classname##VariantData::Eq(wxVariantData& WXUNUSED(data)) const \
638 #define WX_PG_IMPLEMENT_VARIANT_DATA_DUMMY_EQ(classname) \
639 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname, wxEMPTY_PARAMETER_VALUE)
641 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxPoint
, WXDLLIMPEXP_PROPGRID
)
642 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxSize
, WXDLLIMPEXP_PROPGRID
)
643 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxArrayInt
, WXDLLIMPEXP_PROPGRID
)
644 DECLARE_VARIANT_OBJECT_EXPORTED(wxFont
, WXDLLIMPEXP_PROPGRID
)
645 template<> inline wxVariant
WXVARIANT( const wxFont
& value
)
652 template<> inline wxVariant
WXVARIANT( const wxColour
& value
)
659 // Define constants for common wxVariant type strings
661 #define wxPG_VARIANT_TYPE_STRING wxPGGlobalVars->m_strstring
662 #define wxPG_VARIANT_TYPE_LONG wxPGGlobalVars->m_strlong
663 #define wxPG_VARIANT_TYPE_BOOL wxPGGlobalVars->m_strbool
664 #define wxPG_VARIANT_TYPE_LIST wxPGGlobalVars->m_strlist
665 #define wxPG_VARIANT_TYPE_DOUBLE wxS("double")
666 #define wxPG_VARIANT_TYPE_ARRSTRING wxS("arrstring")
667 #define wxPG_VARIANT_TYPE_DATETIME wxS("datetime")
668 #define wxPG_VARIANT_TYPE_LONGLONG wxS("longlong")
669 #define wxPG_VARIANT_TYPE_ULONGLONG wxS("ulonglong")
673 // -----------------------------------------------------------------------
679 // NOTE: I have made two versions - worse ones (performance and consistency
680 // wise) use wxStringTokenizer and better ones (may have unfound bugs)
684 #include "wx/tokenzr.h"
686 // TOKENIZER1 can be done with wxStringTokenizer
687 #define WX_PG_TOKENIZER1_BEGIN(WXSTRING,DELIMITER) \
688 wxStringTokenizer tkz(WXSTRING,DELIMITER,wxTOKEN_RET_EMPTY); \
689 while ( tkz.HasMoreTokens() ) \
691 wxString token = tkz.GetNextToken(); \
695 #define WX_PG_TOKENIZER1_END() \
700 // 2nd version: tokens are surrounded by DELIMITERs (for example, C-style
701 // strings). TOKENIZER2 must use custom code (a class) for full compliance with
702 // " surrounded strings with \" inside.
704 // class implementation is in propgrid.cpp
707 class WXDLLIMPEXP_PROPGRID wxPGStringTokenizer
710 wxPGStringTokenizer( const wxString
& str
, wxChar delimeter
);
711 ~wxPGStringTokenizer();
713 bool HasMoreTokens(); // not const so we can do some stuff in it
714 wxString
GetNextToken();
717 const wxString
* m_str
;
718 wxString::const_iterator m_curPos
;
719 wxString m_readyToken
;
720 wxUniChar m_delimeter
;
723 #define WX_PG_TOKENIZER2_BEGIN(WXSTRING,DELIMITER) \
724 wxPGStringTokenizer tkz(WXSTRING,DELIMITER); \
725 while ( tkz.HasMoreTokens() ) \
727 wxString token = tkz.GetNextToken();
729 #define WX_PG_TOKENIZER2_END() \
734 // -----------------------------------------------------------------------
736 #endif // wxUSE_PROPGRID
738 #endif // _WX_PROPGRID_PROPGRIDDEFS_H_