1
/////////////////////////////////////////////////////////////////////////////
3
// Purpose: wxPropertyGrid Internal Header
4
// Author: Jaakko Salli
8
// Copyright: (c) Jaakko Salli
9
// Licence: wxWindows license
10
/////////////////////////////////////////////////////////////////////////////
12
#ifndef _WX_PROPGRID_PROPDEV_H_
13
#define _WX_PROPGRID_PROPDEV_H_
15
// -----------------------------------------------------------------------
18
class wxArrayEditorDialog;
20
// -----------------------------------------------------------------------
22
// These are intuitive substitutes for base property classes.
23
typedef wxPGProperty wxBasePropertyClass;
24
typedef wxPGProperty wxBaseParentPropertyClass;
26
// -----------------------------------------------------------------------
30
// This is required for sharing common global variables.
31
// TODO: Automatic locking mechanism?
32
class EXTAPI wxPGGlobalVarsClass
36
wxPGGlobalVarsClass();
37
~wxPGGlobalVarsClass();
39
wxString m_pDefaultImageWildcard; // Used by advprops, but here to make things easier.
41
//wxArrayPtrVoid m_arrEditorClasses; // List of editor class instances.
42
wxPGHashMapS2P m_mapEditorClasses; // Map of editor class instances (keys are name string).
45
wxArrayPtrVoid m_arrValidators; // These wxValidators need to be freed
48
//wxPGHashMapS2P m_dictValueType; // Valuename -> Value type object instance.
50
/*#if wxPG_VALUETYPE_IS_STRING
51
wxPGHashMapS2P m_dictValueTypeByClass; // VTClassname -> Value type object instance.
54
wxPGHashMapS2P m_dictPropertyClassInfo; // PropertyName -> ClassInfo
56
wxPGChoices* m_fontFamilyChoices;
58
wxPGCellRenderer* m_defaultRenderer; // Replace with your own to affect all properties using
61
wxPGVariantDataClassInfo wxVariantClassInfo_long; // These are for fast variant type comparison
62
wxPGVariantDataClassInfo wxVariantClassInfo_string;
63
wxPGVariantDataClassInfo wxVariantClassInfo_double;
64
wxPGVariantDataClassInfo wxVariantClassInfo_bool;
65
wxPGVariantDataClassInfo wxVariantClassInfo_arrstring;
66
wxPGVariantDataClassInfo wxVariantClassInfo_wxobject;
67
wxPGVariantDataClassInfo wxVariantClassInfo_list;
68
#if wxCHECK_VERSION(2,8,0)
69
wxPGVariantDataClassInfo wxVariantClassInfo_wxColour;
72
wxPGVariantDataClassInfo wxVariantClassInfo_datetime;
75
wxPGChoices m_boolChoices;
77
#if wxVARIANT_REFCOUNTED
78
wxVariant m_vEmptyString;
80
wxVariant m_vMinusOne;
85
// Cached constant strings
86
wxPGCachedString m_strDefaultValue;
87
wxPGCachedString m_strMin;
88
wxPGCachedString m_strMax;
89
wxPGCachedString m_strUnits;
90
wxPGCachedString m_strInlineHelp;
92
bool m_autoGetTranslation; // If true then some things are automatically translated
94
int m_offline; // > 0 if errors cannot or should not be shown in statusbar etc.
96
int m_extraStyle; // global extra style
102
int HasExtraStyle( int style ) const { return (m_extraStyle & style); }
105
wxCriticalSection m_critSect; // To allow different property grids to be addressed from different threads
109
#if wxCHECK_VERSION(2,9,0)
111
#define wxPGIsVariantType(VARIANT, T) \
112
((VARIANT).GetData() && typeid(*(VARIANT).GetData()) == *wxPGGlobalVars->wxVariantClassInfo_##T)
114
#define wxPGIsVariantClassInfo(CLASSINFO, T) \
115
(*CLASSINFO == *wxPGGlobalVars->wxVariantClassInfo_##T)
119
#define wxPGIsVariantType(VARIANT, T) \
120
((VARIANT).GetData() && wxPGVariantDataGetClassInfo((VARIANT).GetData()) == wxPGGlobalVars->wxVariantClassInfo_##T)
122
#define wxPGIsVariantClassInfo(CLASSINFO, T) \
123
(CLASSINFO == wxPGGlobalVars->wxVariantClassInfo_##T)
127
#if wxVARIANT_REFCOUNTED
128
#define wxPGVariant_EmptyString (wxPGGlobalVars->m_vEmptyString)
129
#define wxPGVariant_Zero (wxPGGlobalVars->m_vZero)
130
#define wxPGVariant_MinusOne (wxPGGlobalVars->m_vMinusOne)
131
#define wxPGVariant_True (wxPGGlobalVars->m_vTrue)
132
#define wxPGVariant_False (wxPGGlobalVars->m_vFalse)
134
#define wxPGVariant_EmptyString wxEmptyString
135
#define wxPGVariant_Zero ((long)0)
136
#define wxPGVariant_MinusOne ((long)-1)
137
#define wxPGVariant_True true
138
#define wxPGVariant_False false
141
#define wxPGVariant_Bool(A) (A?wxPGVariant_True:wxPGVariant_False)
144
#if wxVARIANT_REFCOUNTED
145
#define wxPGVariantAssign(A, B) A = B
148
// Does A = B, so that the operation should not
149
// fail due to dataclass mismatch with typename
151
#define wxPGVariantAssign(A, B) \
160
extern EXTAPI wxPGGlobalVarsClass* wxPGGlobalVars;
164
// -----------------------------------------------------------------------
171
// NOTE: I have made two versions - worse ones (performance and consistency
172
// wise) use wxStringTokenizer and better ones (may have unfound bugs)
176
#include <wx/tokenzr.h>
178
// TOKENIZER1 can be done with wxStringTokenizer
179
#define WX_PG_TOKENIZER1_BEGIN(WXSTRING,DELIMITER) \
180
wxStringTokenizer tkz(WXSTRING,DELIMITER,wxTOKEN_RET_EMPTY); \
181
while ( tkz.HasMoreTokens() ) \
183
wxString token = tkz.GetNextToken(); \
187
#define WX_PG_TOKENIZER1_END() \
192
// 2nd version: tokens are surrounded by DELIMITERs (for example, C-style strings).
193
// TOKENIZER2 must use custom code (a class) for full compliancy
194
// with " surrounded strings with \" inside.
196
// class implementation is in propgrid.cpp
199
class EXTAPI wxPGStringTokenizer
202
wxPGStringTokenizer( const wxString& str, wxChar delimeter );
203
~wxPGStringTokenizer();
205
bool HasMoreTokens(); // not const so we can do some stuff in it
206
wxString GetNextToken();
211
const wxString* m_str;
212
wxString::const_iterator m_curPos;
213
wxString m_readyToken;
214
wxUniChar m_delimeter;
218
#define WX_PG_TOKENIZER2_BEGIN(WXSTRING,DELIMITER) \
219
wxPGStringTokenizer tkz(WXSTRING,DELIMITER); \
220
while ( tkz.HasMoreTokens() ) \
222
wxString token = tkz.GetNextToken();
224
#define WX_PG_TOKENIZER2_END() \
229
#ifndef __wxPG_SOURCE_FILE__
230
// Reduce compile time, but still include in user app
234
// -----------------------------------------------------------------------
236
#if !wxCHECK_VERSION(2,8,0)
238
// There is no wxString::EndsWith() in wxWidgets 2.6.
239
bool wxPG_String_EndsWith(const wxString& str, const wxChar *suffix, wxString *rest = NULL);
243
inline bool wxPG_String_EndsWith(const wxString& str, const wxChar *suffix, wxString *rest = NULL)
245
return str.EndsWith(suffix, rest);
250
// -----------------------------------------------------------------------
252
#endif // _WX_PROPGRID_PROPDEV_H_