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/hashmap.h"
19 #include "wx/variant.h"
20 #include "wx/longlong.h"
21 #include "wx/clntdata.h"
23 // -----------------------------------------------------------------------
26 // Here are some platform dependent defines
27 // NOTE: More in propertygrid.cpp
32 #if defined(__WXMSW__)
34 // space between vertical line and value text
35 #define wxPG_XBEFORETEXT 4
36 // space between vertical line and value editor control
37 #define wxPG_XBEFOREWIDGET 1
39 // x position adjustment for wxTextCtrl (and like)
40 #define wxPG_TEXTCTRLXADJUST 3
42 // comment to use bitmap buttons
43 #define wxPG_ICON_WIDTH 9
44 // 1 if wxRendererNative should be employed
45 #define wxPG_USE_RENDERER_NATIVE 0
47 // 1 to use double-buffer that guarantees flicker-free painting
48 #define wxPG_DOUBLE_BUFFER 1
51 #define wxPG_SUPPORT_TOOLTIPS 1
53 // width of optional bitmap/image in front of property
54 #define wxPG_CUSTOM_IMAGE_WIDTH 20
56 // 1 to create controls out of sight, hide them, and then move them into
58 #define wxPG_CREATE_CONTROLS_HIDDEN 0
60 // 1 if splitter drag detect margin and control cannot overlap
61 #define wxPG_NO_CHILD_EVT_MOTION 0
63 // If 1, then setting empty tooltip actually hides it
64 #define wxPG_ALLOW_EMPTY_TOOLTIPS 1
66 #define wxPG_NAT_BUTTON_BORDER_ANY 1
67 #define wxPG_NAT_BUTTON_BORDER_X 1
68 #define wxPG_NAT_BUTTON_BORDER_Y 1
70 // If 1 then controls are refreshed after selected was drawn.
71 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 0
73 #elif defined(__WXGTK__)
75 // space between vertical line and value text
76 #define wxPG_XBEFORETEXT 5
77 // space between vertical line and value editor control
78 #define wxPG_XBEFOREWIDGET 1
80 // x position adjustment for wxTextCtrl (and like)
81 #define wxPG_TEXTCTRLXADJUST 3
83 // comment to use bitmap buttons
84 #define wxPG_ICON_WIDTH 9
85 // 1 if wxRendererNative should be employed
86 #define wxPG_USE_RENDERER_NATIVE 0
88 // 1 to use double-buffer that guarantees flicker-free painting
89 #define wxPG_DOUBLE_BUFFER 1
92 #define wxPG_SUPPORT_TOOLTIPS 1
94 // width of optional bitmap/image in front of property
95 #define wxPG_CUSTOM_IMAGE_WIDTH 20
97 // 1 to create controls out of sight, hide them, and then move them into
99 #define wxPG_CREATE_CONTROLS_HIDDEN 0
101 // 1 if splitter drag detect margin and control cannot overlap
102 #define wxPG_NO_CHILD_EVT_MOTION 1
104 // If 1, then setting empty tooltip actually hides it
105 #define wxPG_ALLOW_EMPTY_TOOLTIPS 0
107 #define wxPG_NAT_BUTTON_BORDER_ANY 1
108 #define wxPG_NAT_BUTTON_BORDER_X 1
109 #define wxPG_NAT_BUTTON_BORDER_Y 1
111 // If 1 then controls are refreshed after selected was drawn.
112 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 1
114 #elif defined(__WXMAC__)
116 // space between vertical line and value text
117 #define wxPG_XBEFORETEXT 4
118 // space between vertical line and value editor widget
119 #define wxPG_XBEFOREWIDGET 1
121 // x position adjustment for wxTextCtrl (and like)
122 #define wxPG_TEXTCTRLXADJUST 3
124 // comment to use bitmap buttons
125 #define wxPG_ICON_WIDTH 11
126 // 1 if wxRendererNative should be employed
127 #define wxPG_USE_RENDERER_NATIVE 1
129 // 1 to use double-buffer that guarantees flicker-free painting
130 #define wxPG_DOUBLE_BUFFER 0
133 #define wxPG_SUPPORT_TOOLTIPS 1
135 // width of optional bitmap/image in front of property
136 #define wxPG_CUSTOM_IMAGE_WIDTH 20
138 // 1 to create controls out of sight, hide them, and then move them into
140 #define wxPG_CREATE_CONTROLS_HIDDEN 0
142 // 1 if splitter drag detect margin and control cannot overlap
143 #define wxPG_NO_CHILD_EVT_MOTION 0
145 // If 1, then setting empty tooltip actually hides it
146 #define wxPG_ALLOW_EMPTY_TOOLTIPS 1
148 #define wxPG_NAT_BUTTON_BORDER_ANY 0
149 #define wxPG_NAT_BUTTON_BORDER_X 0
150 #define wxPG_NAT_BUTTON_BORDER_Y 0
152 // If 1 then controls are refreshed after selected was drawn.
153 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 0
157 // space between vertical line and value text
158 #define wxPG_XBEFORETEXT 5
159 // space between vertical line and value editor widget
160 #define wxPG_XBEFOREWIDGET 1
162 // x position adjustment for wxTextCtrl (and like)
163 #define wxPG_TEXTCTRLXADJUST 3
165 // comment to use bitmap buttons
166 #define wxPG_ICON_WIDTH 9
167 // 1 if wxRendererNative should be employed
168 #define wxPG_USE_RENDERER_NATIVE 0
170 // 1 to use double-buffer that guarantees flicker-free painting
171 #define wxPG_DOUBLE_BUFFER 0
174 #define wxPG_SUPPORT_TOOLTIPS 0
176 // width of optional bitmap/image in front of property
177 #define wxPG_CUSTOM_IMAGE_WIDTH 20
179 // 1 to create controls out of sight, hide them, and then move them into
181 #define wxPG_CREATE_CONTROLS_HIDDEN 0
183 // 1 if splitter drag detect margin and control cannot overlap
184 #define wxPG_NO_CHILD_EVT_MOTION 1
186 // If 1, then setting empty tooltip actually hides it
187 #define wxPG_ALLOW_EMPTY_TOOLTIPS 0
189 #define wxPG_NAT_BUTTON_BORDER_ANY 0
190 #define wxPG_NAT_BUTTON_BORDER_X 0
191 #define wxPG_NAT_BUTTON_BORDER_Y 0
193 // If 1 then controls are refreshed after selected was drawn.
194 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 1
198 #define wxPG_CONTROL_MARGIN 0 // space between splitter and control
200 #define wxCC_CUSTOM_IMAGE_MARGIN1 4 // before image
201 #define wxCC_CUSTOM_IMAGE_MARGIN2 5 // after image
203 #define wxPG_DRAG_MARGIN 30
205 #if wxPG_NO_CHILD_EVT_MOTION
206 #define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
207 #define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
209 #define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
210 #define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
213 // Use this macro to generate standard custom image height from
214 #define wxPG_STD_CUST_IMAGE_HEIGHT(LINEHEIGHT) (LINEHEIGHT-3)
217 #if defined(__WXWINCE__)
218 #define wxPG_SMALL_SCREEN 1
219 #undef wxPG_DOUBLE_BUFFER
220 #define wxPG_DOUBLE_BUFFER 0
222 #define wxPG_SMALL_SCREEN 0
225 #endif // #ifndef SWIG
227 // Undefine wxPG_ICON_WIDTH to use supplied xpm bitmaps instead
228 // (for tree buttons)
229 //#undef wxPG_ICON_WIDTH
231 // Need to force disable tooltips?
233 #undef wxPG_SUPPORT_TOOLTIPS
234 #define wxPG_SUPPORT_TOOLTIPS 0
237 // Set 1 to include advanced properties (wxFontProperty, wxColourProperty, etc.)
238 #ifndef wxPG_INCLUDE_ADVPROPS
239 #define wxPG_INCLUDE_ADVPROPS 1
242 // Set 1 to include checkbox editor class
243 #define wxPG_INCLUDE_CHECKBOX 1
245 // -----------------------------------------------------------------------
248 // wxPG_CHECK_FOO_DBG - debug check with message that does not
249 // interrupt program flow.
250 #define wxPG_CHECK_RET_DBG(A,B) \
251 if ( !(A) ) { wxLogWarning(B); return; }
252 #define wxPG_CHECK_MSG_DBG(A,B,C) \
253 if ( !(A) ) { wxLogWarning(C); return B; }
258 class wxPropertyCategory
;
260 class wxPropertyGridPageState
;
262 class wxPGCellRenderer
;
263 class wxPGChoiceEntry
;
264 class wxPGPropArgCls
;
265 class wxPropertyGridInterface
;
266 class wxPropertyGrid
;
267 class wxPropertyGridEvent
;
268 class wxPropertyGridManager
;
269 class wxPGOwnerDrawnComboBox
;
270 class wxPGCustomComboControl
;
271 class wxPGEditorDialogAdapter
;
272 struct wxPGValidationInfo
;
275 // -----------------------------------------------------------------------
277 /** @section propgrid_misc wxPropertyGrid Miscellanous
279 This section describes some miscellanous values, types and macros.
284 // Used to tell wxPGProperty to use label as name as well
285 #define wxPG_LABEL (*wxPGProperty::sm_wxPG_LABEL)
286 // This is the value placed in wxPGProperty::sm_wxPG_LABEL
287 #define wxPG_LABEL_STRING wxS("@!")
288 #define wxPG_NULL_BITMAP wxNullBitmap
289 #define wxPG_COLOUR_BLACK (*wxBLACK)
291 #define wxPG_NULL_BITMAP wxBitmap_NULL
292 #define wxPG_COLOUR_BLACK wxColour_BLACK
293 #endif // #ifndef SWIG
295 /** Convert Red, Green and Blue to a single 32-bit value.
297 #define wxPG_COLOUR(R,G,B) ((wxUint32)(R+(G<<8)+(B<<16)))
300 /** If property is supposed to have custom-painted image, then returning
301 this in OnMeasureImage() will usually be enough.
303 #define wxPG_DEFAULT_IMAGE_SIZE wxSize(-1, -1)
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 // -----------------------------------------------------------------------
322 typedef std::vector
<wxPGProperty
*> wxArrayPGProperty
;
324 WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(wxPGProperty
*, wxArrayPGProperty
,
326 class WXDLLIMPEXP_PROPGRID
);
329 // Always use wxString based hashmap with unicode, stl, swig and GCC 4.0+
330 WX_DECLARE_STRING_HASH_MAP_WITH_DECL(void*,
332 class WXDLLIMPEXP_PROPGRID
);
335 WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(void*,
337 class WXDLLIMPEXP_PROPGRID
);
339 WX_DECLARE_HASH_MAP_WITH_DECL(wxInt32
,
344 class WXDLLIMPEXP_PROPGRID
);
346 #endif // #ifndef SWIG
348 // -----------------------------------------------------------------------
350 enum wxPG_GETPROPERTYVALUES_FLAGS
353 /** Flags for wxPropertyGridInterface::GetPropertyValues */
354 wxPG_KEEP_STRUCTURE
= 0x00000010,
356 /** Flags for wxPropertyGrid::SetPropertyAttribute() etc */
357 wxPG_RECURSE
= 0x00000020,
359 /** Include attributes for GetPropertyValues. */
360 wxPG_INC_ATTRIBUTES
= 0x00000040,
362 /** Used when first starting recursion. */
363 wxPG_RECURSE_STARTS
= 0x00000080,
365 /** Force value change. */
366 wxPG_FORCE
= 0x00000100
370 /** Flags for wxPropertyGrid::SetPropertyAttribute() etc */
371 #define wxPG_DONT_RECURSE 0x00000000
373 // -----------------------------------------------------------------------
375 // Misc argument flags.
376 enum wxPG_MISC_ARG_FLAGS
378 // Get/Store full value instead of displayed value.
379 wxPG_FULL_VALUE
= 0x00000001,
381 wxPG_REPORT_ERROR
= 0x00000002,
383 wxPG_PROPERTY_SPECIFIC
= 0x00000004,
385 // Get/Store editable value instead of displayed one (should only be
386 // different in the case of common values)
387 wxPG_EDITABLE_VALUE
= 0x00000008,
389 // Used when dealing with fragments of composite string value
390 wxPG_COMPOSITE_FRAGMENT
= 0x00000010,
392 // Means property for which final string value is for can not really be
394 wxPG_UNEDITABLE_COMPOSITE_FRAGMENT
= 0x00000020
397 // -----------------------------------------------------------------------
399 // wxPGProperty::SetValue() flags
400 enum wxPG_SETVALUE_FLAGS
402 wxPG_SETVAL_REFRESH_EDITOR
= 0x0001,
403 wxPG_SETVAL_AGGREGATED
= 0x0002,
404 wxPG_SETVAL_FROM_PARENT
= 0x0004,
405 wxPG_SETVAL_BY_USER
= 0x0008 // Set if value changed by user
408 // -----------------------------------------------------------------------
411 // Valid constants for wxPG_UINT_BASE attribute
412 // (long because of wxVariant constructor)
413 #define wxPG_BASE_OCT (long)8
414 #define wxPG_BASE_DEC (long)10
415 #define wxPG_BASE_HEX (long)16
416 #define wxPG_BASE_HEXL (long)32
419 // Valid constants for wxPG_UINT_PREFIX attribute
420 #define wxPG_PREFIX_NONE (long)0
421 #define wxPG_PREFIX_0x (long)1
422 #define wxPG_PREFIX_DOLLAR_SIGN (long)2
424 // -----------------------------------------------------------------------
430 #define wxPG_EDITOR(T) wxPGEditor_##T
432 // Declare editor class, with optional part.
433 #define WX_PG_DECLARE_EDITOR_WITH_DECL(EDITOR,DECL) \
434 extern DECL wxPGEditor* wxPGEditor_##EDITOR; \
435 extern DECL wxPGEditor* wxPGConstruct##EDITOR##EditorClass();
437 // Declare editor class.
438 #define WX_PG_DECLARE_EDITOR(EDITOR) \
439 extern wxPGEditor* wxPGEditor_##EDITOR; \
440 extern wxPGEditor* wxPGConstruct##EDITOR##EditorClass();
442 // Declare builtin editor classes.
443 WX_PG_DECLARE_EDITOR_WITH_DECL(TextCtrl
,WXDLLIMPEXP_PROPGRID
)
444 WX_PG_DECLARE_EDITOR_WITH_DECL(Choice
,WXDLLIMPEXP_PROPGRID
)
445 WX_PG_DECLARE_EDITOR_WITH_DECL(ComboBox
,WXDLLIMPEXP_PROPGRID
)
446 WX_PG_DECLARE_EDITOR_WITH_DECL(TextCtrlAndButton
,WXDLLIMPEXP_PROPGRID
)
447 #if wxPG_INCLUDE_CHECKBOX
448 WX_PG_DECLARE_EDITOR_WITH_DECL(CheckBox
,WXDLLIMPEXP_PROPGRID
)
450 WX_PG_DECLARE_EDITOR_WITH_DECL(ChoiceAndButton
,WXDLLIMPEXP_PROPGRID
)
454 // -----------------------------------------------------------------------
459 // Macro WXVARIANT allows creation of wxVariant from any type supported by
460 // wxWidgets internally, and of all types created using
461 // WX_PG_DECLARE_VARIANT_DATA.
463 wxVariant
WXVARIANT( const T
& WXUNUSED(value
) )
465 wxFAIL_MSG("Code should always call specializations of this template");
469 template<> inline wxVariant
WXVARIANT( const int& value
)
470 { return wxVariant((long)value
); }
471 template<> inline wxVariant
WXVARIANT( const long& value
)
472 { return wxVariant(value
); }
473 template<> inline wxVariant
WXVARIANT( const bool& value
)
474 { return wxVariant(value
); }
475 template<> inline wxVariant
WXVARIANT( const double& value
)
476 { return wxVariant(value
); }
477 template<> inline wxVariant
WXVARIANT( const wxArrayString
& value
)
478 { return wxVariant(value
); }
479 template<> inline wxVariant
WXVARIANT( const wxString
& value
)
480 { return wxVariant(value
); }
482 template<> inline wxVariant
WXVARIANT( const wxDateTime
& value
)
483 { return wxVariant(value
); }
488 // These are modified versions of DECLARE/WX_PG_IMPLEMENT_VARIANT_DATA
489 // macros found in variant.h. Difference are as follows:
490 // * These support non-wxObject data
491 // * These implement classname##RefFromVariant function which returns
492 // reference to data within.
493 // * const char* classname##_VariantType which equals classname.
496 #define WX_PG_DECLARE_VARIANT_DATA(classname) \
497 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
499 #define WX_PG_DECLARE_VARIANT_DATA_EXPORTED(classname,expdecl) \
500 expdecl classname& operator << ( classname &object, const wxVariant &variant ); \
501 expdecl wxVariant& operator << ( wxVariant &variant, const classname &object ); \
502 expdecl const classname& classname##RefFromVariant( const wxVariant& variant ); \
503 expdecl classname& classname##RefFromVariant( wxVariant& variant ); \
504 template<> inline wxVariant WXVARIANT( const classname& value ) \
510 extern expdecl const char* classname##_VariantType;
513 #define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \
514 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
516 // Add getter (ie. classname << variant) separately to allow
517 // custom implementations.
518 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,expdecl) \
519 const char* classname##_VariantType = #classname; \
520 class classname##VariantData: public wxVariantData \
523 classname##VariantData() {} \
524 classname##VariantData( const classname &value ) { m_value = value; } \
526 classname &GetValue() { return m_value; } \
528 const classname &GetValue() const { return m_value; } \
530 virtual bool Eq(wxVariantData& data) const; \
532 virtual wxString GetType() const; \
534 virtual wxVariantData* Clone() const { return new classname##VariantData(m_value); } \
540 wxString classname##VariantData::GetType() const\
542 return wxS(#classname);\
545 expdecl wxVariant& operator << ( wxVariant &variant, const classname &value )\
547 classname##VariantData *data = new classname##VariantData( value );\
548 variant.SetData( data );\
551 expdecl classname& classname##RefFromVariant( wxVariant& variant ) \
553 wxASSERT( variant.GetType() == #classname );\
554 classname##VariantData *data = (classname##VariantData*) variant.GetData();\
555 return data->GetValue();\
557 expdecl const classname& classname##RefFromVariant( const wxVariant& variant ) \
559 wxASSERT( variant.GetType() == #classname );\
560 classname##VariantData *data = (classname##VariantData*) variant.GetData();\
561 return data->GetValue();\
564 #define WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname, expdecl) \
565 expdecl classname& operator << ( classname &value, const wxVariant &variant )\
567 wxASSERT( variant.GetType() == #classname );\
569 classname##VariantData *data = (classname##VariantData*) variant.GetData();\
570 value = data->GetValue();\
574 #define WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname, expdecl) \
575 bool classname##VariantData::Eq(wxVariantData& data) const \
577 wxASSERT( GetType() == data.GetType() );\
579 classname##VariantData & otherData = (classname##VariantData &) data;\
581 return otherData.m_value == m_value;\
584 // implements a wxVariantData-derived class using for the Eq() method the
585 // operator== which must have been provided by "classname"
586 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname,expdecl) \
587 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
588 WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
589 WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl)
591 #define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \
592 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
594 // with Eq() implementation that always returns false
595 #define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname,expdecl) \
596 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
597 WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
599 bool classname##VariantData::Eq(wxVariantData& WXUNUSED(data)) const \
604 #define WX_PG_IMPLEMENT_VARIANT_DATA_DUMMY_EQ(classname) \
605 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname, wxEMPTY_PARAMETER_VALUE)
607 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxPoint
, WXDLLIMPEXP_PROPGRID
)
608 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxSize
, WXDLLIMPEXP_PROPGRID
)
609 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxArrayInt
, WXDLLIMPEXP_PROPGRID
)
610 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxLongLong
, WXDLLIMPEXP_PROPGRID
)
611 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxULongLong
, WXDLLIMPEXP_PROPGRID
)
612 DECLARE_VARIANT_OBJECT_EXPORTED(wxFont
, WXDLLIMPEXP_PROPGRID
)
613 template<> inline wxVariant
WXVARIANT( const wxFont
& value
)
620 template<> inline wxVariant
WXVARIANT( const wxColour
& value
)
627 #if wxUSE_LONGLONG_NATIVE
629 template<> inline wxVariant
WXVARIANT( const wxLongLong_t
& value
)
632 variant
<< wxLongLong(value
);
636 template<> inline wxVariant
WXVARIANT( const wxULongLong_t
& value
)
639 variant
<< wxULongLong(value
);
643 WXDLLIMPEXP_PROPGRID wxLongLong_t
& operator << ( wxLongLong_t
&value
, const wxVariant
&variant
);
644 WXDLLIMPEXP_PROPGRID wxULongLong_t
& operator << ( wxULongLong_t
&value
, const wxVariant
&variant
);
646 #endif // wxUSE_LONGLONG_NATIVE
648 // Define constants for common wxVariant type strings
650 #define wxPG_VARIANT_TYPE_STRING wxPGGlobalVars->m_strstring
651 #define wxPG_VARIANT_TYPE_LONG wxPGGlobalVars->m_strlong
652 #define wxPG_VARIANT_TYPE_BOOL wxPGGlobalVars->m_strbool
653 #define wxPG_VARIANT_TYPE_LIST wxPGGlobalVars->m_strlist
654 #define wxPG_VARIANT_TYPE_DOUBLE wxS("double")
655 #define wxPG_VARIANT_TYPE_ARRSTRING wxS("arrstring")
656 #define wxPG_VARIANT_TYPE_DATETIME wxS("datetime")
658 // Safely converts a wxVariant to (long) int. Supports converting from string
659 // and boolean as well.
661 long wxPGVariantToInt( const wxVariant
& variant
, long defVal
= 1 );
663 // Safely converts a wxVariant to wxLongLong_t. Returns true on success.
665 bool wxPGVariantToLongLong( const wxVariant
& variant
, wxLongLong_t
* pResult
);
667 // Safely converts a wxVariant to wxULongLong_t. Returns true on success.
669 bool wxPGVariantToULongLong( const wxVariant
& variant
, wxULongLong_t
* pResult
);
671 // Safely converts a wxVariant to double. Supports converting from string and
672 // wxLongLong as well.
674 bool wxPGVariantToDouble( const wxVariant
& variant
, double* pResult
);
678 // -----------------------------------------------------------------------
684 // NOTE: I have made two versions - worse ones (performance and consistency
685 // wise) use wxStringTokenizer and better ones (may have unfound bugs)
689 #include "wx/tokenzr.h"
691 // TOKENIZER1 can be done with wxStringTokenizer
692 #define WX_PG_TOKENIZER1_BEGIN(WXSTRING,DELIMITER) \
693 wxStringTokenizer tkz(WXSTRING,DELIMITER,wxTOKEN_RET_EMPTY); \
694 while ( tkz.HasMoreTokens() ) \
696 wxString token = tkz.GetNextToken(); \
700 #define WX_PG_TOKENIZER1_END() \
705 // 2nd version: tokens are surrounded by DELIMITERs (for example, C-style
706 // strings). TOKENIZER2 must use custom code (a class) for full compliance with
707 // " surrounded strings with \" inside.
709 // class implementation is in propgrid.cpp
712 class WXDLLIMPEXP_PROPGRID wxPGStringTokenizer
715 wxPGStringTokenizer( const wxString
& str
, wxChar delimeter
);
716 ~wxPGStringTokenizer();
718 bool HasMoreTokens(); // not const so we can do some stuff in it
719 wxString
GetNextToken();
722 const wxString
* m_str
;
723 wxString::const_iterator m_curPos
;
724 wxString m_readyToken
;
725 wxUniChar m_delimeter
;
728 #define WX_PG_TOKENIZER2_BEGIN(WXSTRING,DELIMITER) \
729 wxPGStringTokenizer tkz(WXSTRING,DELIMITER); \
730 while ( tkz.HasMoreTokens() ) \
732 wxString token = tkz.GetNextToken();
734 #define WX_PG_TOKENIZER2_END() \
739 // -----------------------------------------------------------------------
741 #endif // wxUSE_PROPGRID
743 #endif // _WX_PROPGRID_PROPGRIDDEFS_H_