]> git.saurik.com Git - wxWidgets.git/blame - include/wx/propgrid/propgriddefs.h
Initial commit for Laurent Humbertclaude's Windows slave.
[wxWidgets.git] / include / wx / propgrid / propgriddefs.h
CommitLineData
1c4293cb
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/propgrid/propgriddefs.h
3// Purpose: wxPropertyGrid miscellaneous definitions
4// Author: Jaakko Salli
5// Modified by:
6// Created: 2008-08-31
7// RCS-ID: $Id:
8// Copyright: (c) Jaakko Salli
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_PROPGRID_PROPGRIDDEFS_H_
13#define _WX_PROPGRID_PROPGRIDDEFS_H_
14
f4bc1aa2
JS
15#if wxUSE_PROPGRID
16
1c4293cb
VZ
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"
22
23// -----------------------------------------------------------------------
24
25//
26// Here are some platform dependent defines
27// NOTE: More in propertygrid.cpp
28//
29
30#ifndef SWIG
31
32#if defined(__WXMSW__)
33
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
38
39 // x position adjustment for wxTextCtrl (and like)
40 #define wxPG_TEXTCTRLXADJUST 3
41
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
46
47 // 1 to use double-buffer that guarantees flicker-free painting
48 #define wxPG_DOUBLE_BUFFER 1
49
50 // Enable tooltips
51 #define wxPG_SUPPORT_TOOLTIPS 1
52
53 // width of optional bitmap/image in front of property
54 #define wxPG_CUSTOM_IMAGE_WIDTH 20
55
56 // 1 to create controls out of sight, hide them, and then move them into
57 // correct position
58 #define wxPG_CREATE_CONTROLS_HIDDEN 0
59
60 // 1 if splitter drag detect margin and control cannot overlap
61 #define wxPG_NO_CHILD_EVT_MOTION 0
62
63 // If 1, then setting empty tooltip actually hides it
64 #define wxPG_ALLOW_EMPTY_TOOLTIPS 1
65
66 #define wxPG_NAT_BUTTON_BORDER_ANY 1
67 #define wxPG_NAT_BUTTON_BORDER_X 1
68 #define wxPG_NAT_BUTTON_BORDER_Y 1
69
70 // If 1 then controls are refreshed after selected was drawn.
71 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 0
72
73#elif defined(__WXGTK__)
74
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
79
80 // x position adjustment for wxTextCtrl (and like)
81 #define wxPG_TEXTCTRLXADJUST 3
82
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
87
88 // 1 to use double-buffer that guarantees flicker-free painting
89 #define wxPG_DOUBLE_BUFFER 1
90
91 // Enable tooltips
92 #define wxPG_SUPPORT_TOOLTIPS 1
93
94 // width of optional bitmap/image in front of property
95 #define wxPG_CUSTOM_IMAGE_WIDTH 20
96
97 // 1 to create controls out of sight, hide them, and then move them into
98 // correct position
99 #define wxPG_CREATE_CONTROLS_HIDDEN 0
100
101 // 1 if splitter drag detect margin and control cannot overlap
102 #define wxPG_NO_CHILD_EVT_MOTION 1
103
104 // If 1, then setting empty tooltip actually hides it
105 #define wxPG_ALLOW_EMPTY_TOOLTIPS 0
106
107 #define wxPG_NAT_BUTTON_BORDER_ANY 1
108 #define wxPG_NAT_BUTTON_BORDER_X 1
109 #define wxPG_NAT_BUTTON_BORDER_Y 1
110
111 // If 1 then controls are refreshed after selected was drawn.
112 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 1
113
114#elif defined(__WXMAC__)
115
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
120
121 // x position adjustment for wxTextCtrl (and like)
122 #define wxPG_TEXTCTRLXADJUST 3
123
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
128
129 // 1 to use double-buffer that guarantees flicker-free painting
130 #define wxPG_DOUBLE_BUFFER 0
131
132 // Enable tooltips
133 #define wxPG_SUPPORT_TOOLTIPS 1
134
135 // width of optional bitmap/image in front of property
136 #define wxPG_CUSTOM_IMAGE_WIDTH 20
137
138 // 1 to create controls out of sight, hide them, and then move them into
139 // correct position
140 #define wxPG_CREATE_CONTROLS_HIDDEN 0
141
142 // 1 if splitter drag detect margin and control cannot overlap
143 #define wxPG_NO_CHILD_EVT_MOTION 0
144
145 // If 1, then setting empty tooltip actually hides it
146 #define wxPG_ALLOW_EMPTY_TOOLTIPS 1
147
148 #define wxPG_NAT_BUTTON_BORDER_ANY 0
149 #define wxPG_NAT_BUTTON_BORDER_X 0
150 #define wxPG_NAT_BUTTON_BORDER_Y 0
151
152 // If 1 then controls are refreshed after selected was drawn.
153 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 0
154
155#else // defaults
156
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
161
162 // x position adjustment for wxTextCtrl (and like)
163 #define wxPG_TEXTCTRLXADJUST 3
164
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
169
170 // 1 to use double-buffer that guarantees flicker-free painting
171 #define wxPG_DOUBLE_BUFFER 0
172
173 // Enable tooltips
174 #define wxPG_SUPPORT_TOOLTIPS 0
175
176 // width of optional bitmap/image in front of property
177 #define wxPG_CUSTOM_IMAGE_WIDTH 20
178
179 // 1 to create controls out of sight, hide them, and then move them into
180 // correct position
181 #define wxPG_CREATE_CONTROLS_HIDDEN 0
182
183 // 1 if splitter drag detect margin and control cannot overlap
184 #define wxPG_NO_CHILD_EVT_MOTION 1
185
186 // If 1, then setting empty tooltip actually hides it
187 #define wxPG_ALLOW_EMPTY_TOOLTIPS 0
188
189 #define wxPG_NAT_BUTTON_BORDER_ANY 0
190 #define wxPG_NAT_BUTTON_BORDER_X 0
191 #define wxPG_NAT_BUTTON_BORDER_Y 0
192
193 // If 1 then controls are refreshed after selected was drawn.
194 #define wxPG_REFRESH_CONTROLS_AFTER_REPAINT 1
195#endif // platform
196
197
198#define wxPG_CONTROL_MARGIN 0 // space between splitter and control
199
200#define wxCC_CUSTOM_IMAGE_MARGIN1 4 // before image
201#define wxCC_CUSTOM_IMAGE_MARGIN2 5 // after image
202
203#define wxPG_DRAG_MARGIN 30
204
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
208#else
209 #define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
210 #define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
211#endif
212
213// Use this macro to generate standard custom image height from
214#define wxPG_STD_CUST_IMAGE_HEIGHT(LINEHEIGHT) (LINEHEIGHT-3)
215
216
217#if defined(__WXWINCE__)
218 #define wxPG_SMALL_SCREEN 1
219 #undef wxPG_DOUBLE_BUFFER
220 #define wxPG_DOUBLE_BUFFER 0
221#else
222 #define wxPG_SMALL_SCREEN 0
223#endif
224
225#endif // #ifndef SWIG
226
227// Undefine wxPG_ICON_WIDTH to use supplied xpm bitmaps instead
228// (for tree buttons)
229//#undef wxPG_ICON_WIDTH
230
231// Need to force disable tooltips?
232#if !wxUSE_TOOLTIPS
233 #undef wxPG_SUPPORT_TOOLTIPS
234 #define wxPG_SUPPORT_TOOLTIPS 0
235#endif
236
237// Set 1 to include advanced properties (wxFontProperty, wxColourProperty, etc.)
238#ifndef wxPG_INCLUDE_ADVPROPS
239 #define wxPG_INCLUDE_ADVPROPS 1
240#endif
241
242// Set 1 to include checkbox editor class
243#define wxPG_INCLUDE_CHECKBOX 1
244
245// -----------------------------------------------------------------------
246
247
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; }
254
255
256class wxPGEditor;
257class wxPGProperty;
258class wxPropertyCategory;
259class wxPGChoices;
260class wxPropertyGridPageState;
261class wxPGCell;
262class wxPGCellRenderer;
263class wxPGChoiceEntry;
264class wxPGPropArgCls;
265class wxPropertyGridInterface;
266class wxPropertyGrid;
267class wxPropertyGridEvent;
268class wxPropertyGridManager;
269class wxPGOwnerDrawnComboBox;
270class wxPGCustomComboControl;
271class wxPGEditorDialogAdapter;
272struct wxPGValidationInfo;
273
274
275// -----------------------------------------------------------------------
276
277/** @section propgrid_misc wxPropertyGrid Miscellanous
278
279 This section describes some miscellanous values, types and macros.
280 @{
281*/
282
283#ifndef SWIG
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)
290#else
291 #define wxPG_NULL_BITMAP wxBitmap_NULL
292 #define wxPG_COLOUR_BLACK wxColour_BLACK
293#endif // #ifndef SWIG
294
295/** Convert Red, Green and Blue to a single 32-bit value.
296*/
297#define wxPG_COLOUR(R,G,B) ((wxUint32)(R+(G<<8)+(B<<16)))
298
299
300/** If property is supposed to have custom-painted image, then returning
301 this in OnMeasureImage() will usually be enough.
302*/
303#define wxPG_DEFAULT_IMAGE_SIZE wxSize(-1, -1)
304
305
306typedef wxString wxPGCachedString;
307
308/** @}
309*/
310
311// -----------------------------------------------------------------------
312
313// Used to indicate wxPGChoices::Add etc that the value is actually not given
314// by the caller.
315#define wxPG_INVALID_VALUE INT_MAX
316
317// -----------------------------------------------------------------------
318
319#ifndef SWIG
320
321#if wxUSE_STL
4a84bb72 322typedef std::vector<wxPGProperty*> wxArrayPGProperty;
1c4293cb
VZ
323#else
324WX_DEFINE_TYPEARRAY_WITH_DECL_PTR(wxPGProperty*, wxArrayPGProperty,
325 wxBaseArrayPtrVoid,
326 class WXDLLIMPEXP_PROPGRID);
327#endif
328
329// Always use wxString based hashmap with unicode, stl, swig and GCC 4.0+
330WX_DECLARE_STRING_HASH_MAP_WITH_DECL(void*,
331 wxPGHashMapS2P,
332 class WXDLLIMPEXP_PROPGRID);
333
334
335WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(void*,
336 wxPGHashMapP2P,
337 class WXDLLIMPEXP_PROPGRID);
338
339WX_DECLARE_HASH_MAP_WITH_DECL(wxInt32,
340 wxInt32,
341 wxIntegerHash,
342 wxIntegerEqual,
343 wxPGHashMapI2I,
344 class WXDLLIMPEXP_PROPGRID);
345
346#endif // #ifndef SWIG
347
348// -----------------------------------------------------------------------
349
350enum wxPG_GETPROPERTYVALUES_FLAGS
351{
352
353/** Flags for wxPropertyGridInterface::GetPropertyValues */
354wxPG_KEEP_STRUCTURE = 0x00000010,
355
356/** Flags for wxPropertyGrid::SetPropertyAttribute() etc */
357wxPG_RECURSE = 0x00000020,
358
359/** Include attributes for GetPropertyValues. */
360wxPG_INC_ATTRIBUTES = 0x00000040,
361
362/** Used when first starting recursion. */
363wxPG_RECURSE_STARTS = 0x00000080,
364
365/** Force value change. */
366wxPG_FORCE = 0x00000100
367
368};
369
370/** Flags for wxPropertyGrid::SetPropertyAttribute() etc */
371#define wxPG_DONT_RECURSE 0x00000000
372
373// -----------------------------------------------------------------------
374
375// Misc argument flags.
376enum wxPG_MISC_ARG_FLAGS
377{
378 // Get/Store full value instead of displayed value.
379 wxPG_FULL_VALUE = 0x00000001,
380
381 wxPG_REPORT_ERROR = 0x00000002,
382
383 wxPG_PROPERTY_SPECIFIC = 0x00000004,
384
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,
388
389 // Used when dealing with fragments of composite string value
390 wxPG_COMPOSITE_FRAGMENT = 0x00000010,
391
392 // Means property for which final string value is for can not really be
393 // edited.
394 wxPG_UNEDITABLE_COMPOSITE_FRAGMENT = 0x00000020
395};
396
397// -----------------------------------------------------------------------
398
399// wxPGProperty::SetValue() flags
400enum wxPG_SETVALUE_FLAGS
401{
402 wxPG_SETVAL_REFRESH_EDITOR = 0x0001,
403 wxPG_SETVAL_AGGREGATED = 0x0002,
8f18b252
JS
404 wxPG_SETVAL_FROM_PARENT = 0x0004,
405 wxPG_SETVAL_BY_USER = 0x0008 // Set if value changed by user
1c4293cb
VZ
406};
407
408// -----------------------------------------------------------------------
409
410//
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
417
418//
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
423
424// -----------------------------------------------------------------------
425// Editor class.
426
427#ifndef SWIG
428
429// Editor accessor.
430#define wxPG_EDITOR(T) wxPGEditor_##T
431
432// Declare editor class, with optional part.
433#define WX_PG_DECLARE_EDITOR_WITH_DECL(EDITOR,DECL) \
434extern DECL wxPGEditor* wxPGEditor_##EDITOR; \
435extern DECL wxPGEditor* wxPGConstruct##EDITOR##EditorClass();
436
437// Declare editor class.
438#define WX_PG_DECLARE_EDITOR(EDITOR) \
439extern wxPGEditor* wxPGEditor_##EDITOR; \
440extern wxPGEditor* wxPGConstruct##EDITOR##EditorClass();
441
442// Declare builtin editor classes.
443WX_PG_DECLARE_EDITOR_WITH_DECL(TextCtrl,WXDLLIMPEXP_PROPGRID)
444WX_PG_DECLARE_EDITOR_WITH_DECL(Choice,WXDLLIMPEXP_PROPGRID)
445WX_PG_DECLARE_EDITOR_WITH_DECL(ComboBox,WXDLLIMPEXP_PROPGRID)
446WX_PG_DECLARE_EDITOR_WITH_DECL(TextCtrlAndButton,WXDLLIMPEXP_PROPGRID)
447#if wxPG_INCLUDE_CHECKBOX
448WX_PG_DECLARE_EDITOR_WITH_DECL(CheckBox,WXDLLIMPEXP_PROPGRID)
449#endif
450WX_PG_DECLARE_EDITOR_WITH_DECL(ChoiceAndButton,WXDLLIMPEXP_PROPGRID)
451
452#endif // !SWIG
453
454// -----------------------------------------------------------------------
455
456#ifndef SWIG
457
1c4293cb
VZ
458//
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.
462template<class T>
0372d42e 463wxVariant WXVARIANT( const T& WXUNUSED(value) )
1c4293cb 464{
0372d42e
JS
465 wxFAIL_MSG("Code should always call specializations of this template");
466 return wxVariant();
1c4293cb
VZ
467}
468
469template<> inline wxVariant WXVARIANT( const int& value )
470 { return wxVariant((long)value); }
471template<> inline wxVariant WXVARIANT( const long& value )
472 { return wxVariant(value); }
473template<> inline wxVariant WXVARIANT( const bool& value )
474 { return wxVariant(value); }
475template<> inline wxVariant WXVARIANT( const double& value )
476 { return wxVariant(value); }
477template<> inline wxVariant WXVARIANT( const wxArrayString& value )
478 { return wxVariant(value); }
479template<> inline wxVariant WXVARIANT( const wxString& value )
480 { return wxVariant(value); }
481#if wxUSE_DATETIME
482template<> inline wxVariant WXVARIANT( const wxDateTime& value )
483 { return wxVariant(value); }
484#endif
485
0372d42e
JS
486
487//
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.
494// * WXVARIANT
495//
496#define WX_PG_DECLARE_VARIANT_DATA(classname) \
497 WX_PG_DECLARE_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
498
499#define WX_PG_DECLARE_VARIANT_DATA_EXPORTED(classname,expdecl) \
500expdecl classname& operator << ( classname &object, const wxVariant &variant ); \
501expdecl wxVariant& operator << ( wxVariant &variant, const classname &object ); \
502expdecl const classname& classname##RefFromVariant( const wxVariant& variant ); \
503expdecl classname& classname##RefFromVariant( wxVariant& variant ); \
504template<> inline wxVariant WXVARIANT( const classname& value ) \
1c4293cb 505{ \
0372d42e
JS
506 wxVariant variant; \
507 variant << value; \
508 return variant; \
1c4293cb 509} \
0372d42e
JS
510extern expdecl const char* classname##_VariantType;
511
512
513#define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \
514 WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
515
a6162a3e
JS
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) \
0372d42e
JS
519const char* classname##_VariantType = #classname; \
520class classname##VariantData: public wxVariantData \
1c4293cb 521{ \
0372d42e
JS
522public:\
523 classname##VariantData() {} \
524 classname##VariantData( const classname &value ) { m_value = value; } \
525\
526 classname &GetValue() { return m_value; } \
a48fcef3
JS
527\
528 const classname &GetValue() const { return m_value; } \
0372d42e
JS
529\
530 virtual bool Eq(wxVariantData& data) const; \
531\
532 virtual wxString GetType() const; \
533\
534 virtual wxVariantData* Clone() const { return new classname##VariantData(m_value); } \
0372d42e
JS
535\
536protected:\
537 classname m_value; \
538};\
539\
540wxString classname##VariantData::GetType() const\
541{\
542 return wxS(#classname);\
543}\
544\
0372d42e
JS
545expdecl wxVariant& operator << ( wxVariant &variant, const classname &value )\
546{\
547 classname##VariantData *data = new classname##VariantData( value );\
548 variant.SetData( data );\
549 return variant;\
1c4293cb 550} \
0372d42e 551expdecl classname& classname##RefFromVariant( wxVariant& variant ) \
1c4293cb 552{ \
0372d42e
JS
553 wxASSERT( variant.GetType() == #classname );\
554 classname##VariantData *data = (classname##VariantData*) variant.GetData();\
a48fcef3 555 return data->GetValue();\
1c4293cb 556} \
0372d42e 557expdecl const classname& classname##RefFromVariant( const wxVariant& variant ) \
1c4293cb 558{ \
0372d42e
JS
559 wxASSERT( variant.GetType() == #classname );\
560 classname##VariantData *data = (classname##VariantData*) variant.GetData();\
a48fcef3 561 return data->GetValue();\
0372d42e
JS
562}
563
a6162a3e
JS
564#define WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname, expdecl) \
565expdecl classname& operator << ( classname &value, const wxVariant &variant )\
566{\
567 wxASSERT( variant.GetType() == #classname );\
568 \
569 classname##VariantData *data = (classname##VariantData*) variant.GetData();\
570 value = data->GetValue();\
571 return value;\
572}
573
574#define WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname, expdecl) \
0372d42e
JS
575bool classname##VariantData::Eq(wxVariantData& data) const \
576{\
577 wxASSERT( GetType() == data.GetType() );\
578\
579 classname##VariantData & otherData = (classname##VariantData &) data;\
580\
581 return otherData.m_value == m_value;\
582}
583
a6162a3e
JS
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) \
587WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
588WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
589WX_PG_IMPLEMENT_VARIANT_DATA_EQ(classname,wxEMPTY_PARAMETER_VALUE expdecl)
590
0372d42e
JS
591#define WX_PG_IMPLEMENT_VARIANT_DATA(classname) \
592WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED(classname, wxEMPTY_PARAMETER_VALUE)
593
594// with Eq() implementation that always returns false
595#define WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname,expdecl) \
a6162a3e
JS
596WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_NO_EQ_NO_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
597WX_PG_IMPLEMENT_VARIANT_DATA_GETTER(classname,wxEMPTY_PARAMETER_VALUE expdecl) \
0372d42e
JS
598\
599bool classname##VariantData::Eq(wxVariantData& WXUNUSED(data)) const \
600{\
601 return false; \
602}
603
604#define WX_PG_IMPLEMENT_VARIANT_DATA_DUMMY_EQ(classname) \
605WX_PG_IMPLEMENT_VARIANT_DATA_EXPORTED_DUMMY_EQ(classname, wxEMPTY_PARAMETER_VALUE)
606
607WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxPoint, WXDLLIMPEXP_PROPGRID)
608WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxSize, WXDLLIMPEXP_PROPGRID)
609WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxArrayInt, WXDLLIMPEXP_PROPGRID)
610WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxLongLong, WXDLLIMPEXP_PROPGRID)
611WX_PG_DECLARE_VARIANT_DATA_EXPORTED(wxULongLong, WXDLLIMPEXP_PROPGRID)
612DECLARE_VARIANT_OBJECT_EXPORTED(wxFont, WXDLLIMPEXP_PROPGRID)
613template<> inline wxVariant WXVARIANT( const wxFont& value )
614{
615 wxVariant variant;
616 variant << value;
617 return variant;
1c4293cb
VZ
618}
619
1c4293cb
VZ
620template<> inline wxVariant WXVARIANT( const wxColour& value )
621{
622 wxVariant variant;
623 variant << value;
624 return variant;
625}
626
a6162a3e
JS
627#if wxUSE_LONGLONG_NATIVE
628
629template<> inline wxVariant WXVARIANT( const wxLongLong_t& value )
630{
631 wxVariant variant;
632 variant << wxLongLong(value);
633 return variant;
634}
635
636template<> inline wxVariant WXVARIANT( const wxULongLong_t& value )
637{
638 wxVariant variant;
639 variant << wxULongLong(value);
640 return variant;
641}
642
643WXDLLIMPEXP_PROPGRID wxLongLong_t& operator << ( wxLongLong_t &value, const wxVariant &variant );
644WXDLLIMPEXP_PROPGRID wxULongLong_t& operator << ( wxULongLong_t &value, const wxVariant &variant );
645
646#endif // wxUSE_LONGLONG_NATIVE
647
0372d42e
JS
648// Define constants for common wxVariant type strings
649
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")
1c4293cb
VZ
657
658// Safely converts a wxVariant to (long) int. Supports converting from string
659// and boolean as well.
660WXDLLIMPEXP_PROPGRID
661long wxPGVariantToInt( const wxVariant& variant, long defVal = 1 );
662
663// Safely converts a wxVariant to wxLongLong_t. Returns true on success.
664WXDLLIMPEXP_PROPGRID
665bool wxPGVariantToLongLong( const wxVariant& variant, wxLongLong_t* pResult );
666
667// Safely converts a wxVariant to wxULongLong_t. Returns true on success.
668WXDLLIMPEXP_PROPGRID
669bool wxPGVariantToULongLong( const wxVariant& variant, wxULongLong_t* pResult );
670
671// Safely converts a wxVariant to double. Supports converting from string and
672// wxLongLong as well.
673WXDLLIMPEXP_PROPGRID
674bool wxPGVariantToDouble( const wxVariant& variant, double* pResult );
675
676#endif // !SWIG
677
678// -----------------------------------------------------------------------
679
680#ifndef SWIG
681
1c4293cb
VZ
682//
683// Tokenizer macros.
684// NOTE: I have made two versions - worse ones (performance and consistency
685// wise) use wxStringTokenizer and better ones (may have unfound bugs)
686// use custom code.
687//
688
689#include "wx/tokenzr.h"
690
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() ) \
695 { \
696 wxString token = tkz.GetNextToken(); \
697 token.Trim(true); \
698 token.Trim(false);
699
700#define WX_PG_TOKENIZER1_END() \
701 }
702
703
704//
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.
708//
709// class implementation is in propgrid.cpp
710//
711
712class WXDLLIMPEXP_PROPGRID wxPGStringTokenizer
713{
714public:
715 wxPGStringTokenizer( const wxString& str, wxChar delimeter );
716 ~wxPGStringTokenizer();
717
718 bool HasMoreTokens(); // not const so we can do some stuff in it
719 wxString GetNextToken();
720
721protected:
722 const wxString* m_str;
723 wxString::const_iterator m_curPos;
724 wxString m_readyToken;
725 wxUniChar m_delimeter;
726};
727
728#define WX_PG_TOKENIZER2_BEGIN(WXSTRING,DELIMITER) \
729 wxPGStringTokenizer tkz(WXSTRING,DELIMITER); \
730 while ( tkz.HasMoreTokens() ) \
731 { \
732 wxString token = tkz.GetNextToken();
733
734#define WX_PG_TOKENIZER2_END() \
735 }
736
737#endif
738
739// -----------------------------------------------------------------------
740
f4bc1aa2
JS
741#endif // wxUSE_PROPGRID
742
1c4293cb 743#endif // _WX_PROPGRID_PROPGRIDDEFS_H_