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 WXDLLIMPEXP_PG 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 WXDLLIMPEXP_PG 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_strMin;
87
wxPGCachedString m_strMax;
88
wxPGCachedString m_strUnits;
89
wxPGCachedString m_strInlineHelp;
91
bool m_autoGetTranslation; // If true then some things are automatically translated
93
int m_offline; // > 0 if errors cannot or should not be shown in statusbar etc.
95
int m_extraStyle; // global extra style
101
int HasExtraStyle( int style ) const { return (m_extraStyle & style); }
104
wxCriticalSection m_critSect; // To allow different property grids to be addressed from different threads
108
#if wxCHECK_VERSION(2,9,0)
110
#define wxPGIsVariantType(VARIANT, T) \
111
((VARIANT).GetData() && typeid(*(VARIANT).GetData()) == *wxPGGlobalVars->wxVariantClassInfo_##T)
113
#define wxPGIsVariantClassInfo(CLASSINFO, T) \
114
(*CLASSINFO == *wxPGGlobalVars->wxVariantClassInfo_##T)
118
#define wxPGIsVariantType(VARIANT, T) \
119
((VARIANT).GetData() && wxPGVariantDataGetClassInfo((VARIANT).GetData()) == wxPGGlobalVars->wxVariantClassInfo_##T)
121
#define wxPGIsVariantClassInfo(CLASSINFO, T) \
122
(CLASSINFO == wxPGGlobalVars->wxVariantClassInfo_##T)
126
#if wxVARIANT_REFCOUNTED
127
#define wxPGVariant_EmptyString (wxPGGlobalVars->m_vEmptyString)
128
#define wxPGVariant_Zero (wxPGGlobalVars->m_vZero)
129
#define wxPGVariant_MinusOne (wxPGGlobalVars->m_vMinusOne)
130
#define wxPGVariant_True (wxPGGlobalVars->m_vTrue)
131
#define wxPGVariant_False (wxPGGlobalVars->m_vFalse)
133
#define wxPGVariant_EmptyString wxEmptyString
134
#define wxPGVariant_Zero ((long)0)
135
#define wxPGVariant_MinusOne ((long)-1)
136
#define wxPGVariant_True true
137
#define wxPGVariant_False false
140
#define wxPGVariant_Bool(A) (A?wxPGVariant_True:wxPGVariant_False)
143
#if wxVARIANT_REFCOUNTED
144
#define wxPGVariantAssign(A, B) A = B
147
// Does A = B, so that the operation should not
148
// fail due to dataclass mismatch with typename
150
#define wxPGVariantAssign(A, B) \
159
extern WXDLLIMPEXP_PG wxPGGlobalVarsClass* wxPGGlobalVars;
163
// -----------------------------------------------------------------------
170
// NOTE: I have made two versions - worse ones (performance and consistency
171
// wise) use wxStringTokenizer and better ones (may have unfound bugs)
175
#include <wx/tokenzr.h>
177
// TOKENIZER1 can be done with wxStringTokenizer
178
#define WX_PG_TOKENIZER1_BEGIN(WXSTRING,DELIMITER) \
179
wxStringTokenizer tkz(WXSTRING,DELIMITER,wxTOKEN_RET_EMPTY); \
180
while ( tkz.HasMoreTokens() ) \
182
wxString token = tkz.GetNextToken(); \
186
#define WX_PG_TOKENIZER1_END() \
191
// 2nd version: tokens are surrounded by DELIMITERs (for example, C-style strings).
192
// TOKENIZER2 must use custom code (a class) for full compliancy
193
// with " surrounded strings with \" inside.
195
// class implementation is in propgrid.cpp
198
class WXDLLIMPEXP_PG wxPGStringTokenizer
201
wxPGStringTokenizer( const wxString& str, wxChar delimeter );
202
~wxPGStringTokenizer();
204
bool HasMoreTokens(); // not const so we can do some stuff in it
205
wxString GetNextToken();
210
const wxString* m_str;
211
wxString::const_iterator m_curPos;
212
wxString m_readyToken;
213
wxUniChar m_delimeter;
217
#define WX_PG_TOKENIZER2_BEGIN(WXSTRING,DELIMITER) \
218
wxPGStringTokenizer tkz(WXSTRING,DELIMITER); \
219
while ( tkz.HasMoreTokens() ) \
221
wxString token = tkz.GetNextToken();
223
#define WX_PG_TOKENIZER2_END() \
228
#ifndef __wxPG_SOURCE_FILE__
229
// Reduce compile time, but still include in user app
233
// -----------------------------------------------------------------------
235
#if !wxCHECK_VERSION(2,8,0)
237
// There is no wxString::EndsWith() in wxWidgets 2.6.
238
bool wxPG_String_EndsWith(const wxString& str, const wxChar *suffix, wxString *rest = NULL);
242
inline bool wxPG_String_EndsWith(const wxString& str, const wxChar *suffix, wxString *rest = NULL)
244
return str.EndsWith(suffix, rest);
249
// -----------------------------------------------------------------------
251
#endif // _WX_PROPGRID_PROPDEV_H_