]>
Commit | Line | Data |
---|---|---|
a095505c | 1 | ///////////////////////////////////////////////////////////////////////////// |
2abce515 | 2 | // Name: wx/xti.hG |
a095505c SC |
3 | // Purpose: runtime metadata information (extended class info) |
4 | // Author: Stefan Csomor | |
4393b50c | 5 | // Modified by: |
a095505c SC |
6 | // Created: 27/07/03 |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 1997 Julian Smart | |
9 | // (c) 2003 Stefan Csomor | |
10 | // Licence: wxWindows licence | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | #ifndef _WX_XTIH__ | |
14 | #define _WX_XTIH__ | |
15 | ||
12028905 | 16 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
a095505c SC |
17 | #pragma interface "xti.h" |
18 | #endif | |
19 | ||
20 | // We want to support properties, event sources and events sinks through | |
21 | // explicit declarations, using templates and specialization to make the | |
4393b50c | 22 | // effort as painless as possible. |
a095505c SC |
23 | // |
24 | // This means we have the following domains : | |
25 | // | |
26 | // - Type Information for categorizing built in types as well as custom types | |
27 | // this includes information about enums, their values and names | |
28 | // - Type safe value storage : a kind of wxVariant, called right now wxxVariant | |
4393b50c | 29 | // which will be merged with wxVariant |
a095505c SC |
30 | // - Property Information and Property Accessors providing access to a class' |
31 | // values and exposed event delegates | |
32 | // - Information about event handlers | |
33 | // - extended Class Information for accessing all these | |
34 | ||
35 | // ---------------------------------------------------------------------------- | |
36 | // headers | |
37 | // ---------------------------------------------------------------------------- | |
38 | ||
39 | #include "wx/defs.h" | |
40 | #include "wx/memory.h" | |
ae820c69 | 41 | #include "wx/flags.h" |
a095505c | 42 | #include "wx/string.h" |
aeec2045 | 43 | #include "wx/arrstr.h" |
ae820c69 | 44 | #include "wx/hashmap.h" |
a095505c | 45 | |
1b23f6f7 | 46 | #include <typeinfo> |
492f9a9e | 47 | |
2abce515 SC |
48 | // we will move this later to defs.h |
49 | ||
50 | #if !wxCHECK_GCC_VERSION( 3 , 4 ) | |
51 | # define wxUSE_MEMBER_TEMPLATES 0 | |
52 | #endif | |
53 | ||
54 | #ifdef _MSC_VER | |
55 | # if _MSC_VER <= 1200 | |
56 | # define wxUSE_MEMBER_TEMPLATES 0 | |
57 | # endif | |
58 | #endif | |
59 | ||
60 | #ifndef wxUSE_MEMBER_TEMPLATES | |
61 | #define wxUSE_MEMBER_TEMPLATES 1 | |
62 | #endif | |
63 | ||
64 | #if wxUSE_MEMBER_TEMPLATES | |
65 | #define WX_TEMPLATED_MEMBER_CALL( method , type ) method<type>() | |
66 | #define WX_TEMPLATED_MEMBER_FIX( type ) | |
67 | #else | |
68 | #define WX_TEMPLATED_MEMBER_CALL( method , type ) method((type*)NULL) | |
69 | #define WX_TEMPLATED_MEMBER_FIX( type ) type* =NULL | |
70 | #endif | |
71 | ||
a095505c SC |
72 | class WXDLLIMPEXP_BASE wxObject; |
73 | class WXDLLIMPEXP_BASE wxClassInfo; | |
492f9a9e | 74 | class WXDLLIMPEXP_BASE wxDynamicClassInfo; |
a095505c SC |
75 | class WXDLLIMPEXP_BASE wxHashTable; |
76 | class WXDLLIMPEXP_BASE wxObjectRefData; | |
77 | class WXDLLIMPEXP_BASE wxEvent; | |
78 | ||
79 | typedef void (wxObject::*wxObjectEventFunction)(wxEvent&); | |
80 | ||
81 | // ---------------------------------------------------------------------------- | |
82 | // Enum Support | |
83 | // | |
4393b50c | 84 | // In the header files there would no change from pure c++ code, in the |
a095505c SC |
85 | // implementation, an enum would have |
86 | // to be enumerated eg : | |
87 | // | |
88 | // WX_BEGIN_ENUM( wxFlavor ) | |
89 | // WX_ENUM_MEMBER( Vanilla ) | |
90 | // WX_ENUM_MEMBER( Chocolate ) | |
91 | // WX_ENUM_MEMBER( Strawberry ) | |
92 | // WX_END_ENUM( wxFlavor ) | |
93 | // ---------------------------------------------------------------------------- | |
94 | ||
95 | struct WXDLLIMPEXP_BASE wxEnumMemberData | |
96 | { | |
517fb871 VS |
97 | const wxChar* m_name; |
98 | int m_value; | |
a095505c SC |
99 | }; |
100 | ||
101 | class WXDLLIMPEXP_BASE wxEnumData | |
102 | { | |
103 | public : | |
517fb871 | 104 | wxEnumData( wxEnumMemberData* data ) ; |
a095505c | 105 | |
517fb871 VS |
106 | // returns true if the member has been found and sets the int value |
107 | // pointed to accordingly (if ptr != null ) | |
108 | // if not found returns false, value left unchanged | |
25474dca | 109 | bool HasEnumMemberValue( const wxChar *name , int *value = NULL ) const ; |
4393b50c | 110 | |
517fb871 VS |
111 | // returns the value of the member, if not found in debug mode an |
112 | // assert is issued, in release 0 is returned | |
25474dca | 113 | int GetEnumMemberValue(const wxChar *name ) const ; |
4393b50c | 114 | |
517fb871 VS |
115 | // returns the name of the enum member having the passed in value |
116 | // returns an emtpy string if not found | |
25474dca | 117 | const wxChar *GetEnumMemberName(int value) const ; |
4393b50c | 118 | |
517fb871 | 119 | // returns the number of members in this enum |
25474dca | 120 | int GetEnumCount() const { return m_count ; } |
4393b50c | 121 | |
517fb871 | 122 | // returns the value of the nth member |
25474dca | 123 | int GetEnumMemberValueByIndex( int n ) const ; |
4393b50c | 124 | |
517fb871 | 125 | // returns the value of the nth member |
25474dca | 126 | const wxChar *GetEnumMemberNameByIndex( int n ) const ; |
a095505c SC |
127 | private : |
128 | wxEnumMemberData *m_members; | |
517fb871 | 129 | int m_count ; |
a095505c SC |
130 | }; |
131 | ||
132 | #define WX_BEGIN_ENUM( e ) \ | |
517fb871 | 133 | wxEnumMemberData s_enumDataMembers##e[] = { |
a095505c | 134 | |
583150e3 | 135 | #define WX_ENUM_MEMBER( v ) { wxT(#v), v } , |
a095505c SC |
136 | |
137 | #define WX_END_ENUM( e ) { NULL , 0 } } ; \ | |
517fb871 VS |
138 | wxEnumData s_enumData##e( s_enumDataMembers##e ) ; \ |
139 | wxEnumData *wxGetEnumData(e) { return &s_enumData##e ; } \ | |
492f9a9e | 140 | template<> void wxStringReadValue(const wxString& s , e &data ) \ |
ae820c69 SC |
141 | { \ |
142 | data = (e) s_enumData##e.GetEnumMemberValue(s) ; \ | |
143 | } \ | |
492f9a9e | 144 | template<> void wxStringWriteValue(wxString &s , const e &data ) \ |
ae820c69 SC |
145 | { \ |
146 | s = s_enumData##e.GetEnumMemberName((int)data) ; \ | |
147 | } \ | |
148 | void FromLong##e( long data , wxxVariant& result ) { result = wxxVariant((e)data) ;} \ | |
149 | void ToLong##e( const wxxVariant& data , long &result ) { result = (long) data.Get<e>() ;} \ | |
583150e3 | 150 | wxEnumTypeInfo s_typeInfo##e(wxT_ENUM , &s_enumData##e , &wxToStringConverter<e> , &wxFromStringConverter<e> , &ToLong##e , &FromLong##e , typeid(e).name() ) ; |
a095505c SC |
151 | |
152 | // ---------------------------------------------------------------------------- | |
153 | // Set Support | |
4393b50c | 154 | // |
a095505c | 155 | // in the header : |
4393b50c | 156 | // |
a095505c | 157 | // enum wxFlavor |
4393b50c | 158 | // { |
517fb871 VS |
159 | // Vanilla, |
160 | // Chocolate, | |
161 | // Strawberry, | |
a095505c | 162 | // }; |
4393b50c | 163 | // |
0886e254 | 164 | // typedef wxBitset<wxFlavor> wxCoupe ; |
4393b50c | 165 | // |
a095505c | 166 | // in the implementation file : |
4393b50c | 167 | // |
a095505c | 168 | // WX_BEGIN_ENUM( wxFlavor ) |
517fb871 VS |
169 | // WX_ENUM_MEMBER( Vanilla ) |
170 | // WX_ENUM_MEMBER( Chocolate ) | |
171 | // WX_ENUM_MEMBER( Strawberry ) | |
a095505c | 172 | // WX_END_ENUM( wxFlavor ) |
a095505c | 173 | // |
4393b50c SC |
174 | // WX_IMPLEMENT_SET_STREAMING( wxCoupe , wxFlavor ) |
175 | // | |
176 | // implementation note : no partial specialization for streaming, but a delegation to a | |
a095505c SC |
177 | // different class |
178 | // | |
179 | // ---------------------------------------------------------------------------- | |
180 | ||
181 | // in order to remove dependancy on string tokenizer | |
182 | void wxSetStringToArray( const wxString &s , wxArrayString &array ) ; | |
183 | ||
184 | template<typename e> | |
0886e254 | 185 | void wxSetFromString(const wxString &s , wxBitset<e> &data ) |
a095505c | 186 | { |
517fb871 | 187 | wxEnumData* edata = wxGetEnumData((e) 0) ; |
9c8046dd | 188 | data.reset() ; |
a095505c | 189 | |
517fb871 VS |
190 | wxArrayString array ; |
191 | wxSetStringToArray( s , array ) ; | |
a095505c SC |
192 | wxString flag; |
193 | for ( int i = 0 ; i < array.Count() ; ++i ) | |
194 | { | |
195 | flag = array[i] ; | |
517fb871 VS |
196 | int ivalue ; |
197 | if ( edata->HasEnumMemberValue( flag , &ivalue ) ) | |
198 | { | |
9c8046dd | 199 | data.set( (e) ivalue ) ; |
517fb871 | 200 | } |
a095505c SC |
201 | } |
202 | } | |
203 | ||
204 | template<typename e> | |
0886e254 | 205 | void wxSetToString( wxString &s , const wxBitset<e> &data ) |
a095505c | 206 | { |
517fb871 VS |
207 | wxEnumData* edata = wxGetEnumData((e) 0) ; |
208 | int count = edata->GetEnumCount() ; | |
209 | int i ; | |
210 | s.Clear() ; | |
211 | for ( i = 0 ; i < count ; i++ ) | |
212 | { | |
213 | e value = (e) edata->GetEnumMemberValueByIndex(i) ; | |
9c8046dd | 214 | if ( data.test( value ) ) |
517fb871 VS |
215 | { |
216 | // this could also be done by the templated calls | |
217 | if ( !s.IsEmpty() ) | |
583150e3 | 218 | s +=wxT("|") ; |
517fb871 VS |
219 | s += edata->GetEnumMemberNameByIndex(i) ; |
220 | } | |
221 | } | |
a095505c SC |
222 | } |
223 | ||
a095505c | 224 | #define WX_IMPLEMENT_SET_STREAMING(SetName,e) \ |
492f9a9e | 225 | template<> void wxStringReadValue(const wxString &s , wxBitset<e> &data ) \ |
ae820c69 SC |
226 | { \ |
227 | wxSetFromString( s , data ) ; \ | |
228 | } \ | |
492f9a9e | 229 | template<> void wxStringWriteValue( wxString &s , const wxBitset<e> &data ) \ |
ae820c69 SC |
230 | { \ |
231 | wxSetToString( s , data ) ; \ | |
232 | } \ | |
9c8046dd SC |
233 | void FromLong##SetName( long data , wxxVariant& result ) { result = wxxVariant(SetName((unsigned long)data)) ;} \ |
234 | void ToLong##SetName( const wxxVariant& data , long &result ) { result = (long) data.Get<SetName>().to_ulong() ;} \ | |
492f9a9e | 235 | wxEnumTypeInfo s_typeInfo##SetName(wxT_SET , &s_enumData##e , &wxToStringConverter<SetName> , &wxFromStringConverter<SetName> , &ToLong##SetName , &FromLong##SetName, typeid(SetName).name() ) ; \ |
2abce515 | 236 | } |
a095505c | 237 | |
0886e254 SC |
238 | template<typename e> |
239 | void wxFlagsFromString(const wxString &s , e &data ) | |
240 | { | |
241 | wxEnumData* edata = wxGetEnumData((e*) 0) ; | |
242 | data.m_data = 0 ; | |
243 | ||
244 | wxArrayString array ; | |
245 | wxSetStringToArray( s , array ) ; | |
246 | wxString flag; | |
1c263d56 | 247 | for ( size_t i = 0 ; i < array.Count() ; ++i ) |
0886e254 SC |
248 | { |
249 | flag = array[i] ; | |
250 | int ivalue ; | |
251 | if ( edata->HasEnumMemberValue( flag , &ivalue ) ) | |
252 | { | |
253 | data.m_data |= ivalue ; | |
254 | } | |
255 | } | |
256 | } | |
257 | ||
258 | template<typename e> | |
259 | void wxFlagsToString( wxString &s , const e& data ) | |
260 | { | |
261 | wxEnumData* edata = wxGetEnumData((e*) 0) ; | |
262 | int count = edata->GetEnumCount() ; | |
263 | int i ; | |
264 | s.Clear() ; | |
265 | long dataValue = data.m_data ; | |
266 | for ( i = 0 ; i < count ; i++ ) | |
267 | { | |
268 | int value = edata->GetEnumMemberValueByIndex(i) ; | |
269 | // make this to allow for multi-bit constants to work | |
270 | if ( value && ( dataValue & value ) == value ) | |
271 | { | |
272 | // clear the flags we just set | |
273 | dataValue &= ~value ; | |
274 | // this could also be done by the templated calls | |
275 | if ( !s.IsEmpty() ) | |
583150e3 | 276 | s +=wxT("|") ; |
0886e254 SC |
277 | s += edata->GetEnumMemberNameByIndex(i) ; |
278 | } | |
279 | } | |
280 | } | |
281 | ||
282 | #define WX_BEGIN_FLAGS( e ) \ | |
283 | wxEnumMemberData s_enumDataMembers##e[] = { | |
284 | ||
583150e3 | 285 | #define WX_FLAGS_MEMBER( v ) { wxT(#v), v } , |
0886e254 SC |
286 | |
287 | #define WX_END_FLAGS( e ) { NULL , 0 } } ; \ | |
288 | wxEnumData s_enumData##e( s_enumDataMembers##e ) ; \ | |
289 | wxEnumData *wxGetEnumData(e*) { return &s_enumData##e ; } \ | |
492f9a9e | 290 | template<> void wxStringReadValue(const wxString &s , e &data ) \ |
0886e254 SC |
291 | { \ |
292 | wxFlagsFromString<e>( s , data ) ; \ | |
293 | } \ | |
492f9a9e | 294 | template<> void wxStringWriteValue( wxString &s , const e& data ) \ |
0886e254 SC |
295 | { \ |
296 | wxFlagsToString<e>( s , data ) ; \ | |
297 | } \ | |
298 | void FromLong##e( long data , wxxVariant& result ) { result = wxxVariant(e(data)) ;} \ | |
299 | void ToLong##e( const wxxVariant& data , long &result ) { result = (long) data.Get<e>().m_data ;} \ | |
583150e3 | 300 | wxEnumTypeInfo s_typeInfo##e(wxT_SET , &s_enumData##e , &wxToStringConverter<e> , &wxFromStringConverter<e> , &ToLong##e , &FromLong##e, typeid(e).name() ) ; |
a095505c SC |
301 | // ---------------------------------------------------------------------------- |
302 | // Type Information | |
303 | // ---------------------------------------------------------------------------- | |
ab6e4913 SC |
304 | // |
305 | // | |
306 | // All data exposed by the RTTI is characterized using the following classes. | |
307 | // The first characterization is done by wxTypeKind. All enums up to and including | |
308 | // wxT_CUSTOM represent so called simple types. These cannot be divided any further. | |
309 | // They can be converted to and from wxStrings, that's all. | |
310 | ||
a095505c SC |
311 | |
312 | enum wxTypeKind | |
313 | { | |
314 | wxT_VOID = 0, // unknown type | |
315 | wxT_BOOL, | |
316 | wxT_CHAR, | |
317 | wxT_UCHAR, | |
318 | wxT_INT, | |
319 | wxT_UINT, | |
320 | wxT_LONG, | |
321 | wxT_ULONG, | |
322 | wxT_FLOAT, | |
323 | wxT_DOUBLE, | |
324 | wxT_STRING, // must be wxString | |
0886e254 | 325 | wxT_SET, // must be wxBitset<> template |
a095505c | 326 | wxT_ENUM, |
a095505c | 327 | wxT_CUSTOM, // user defined type (e.g. wxPoint) |
75890a3f | 328 | |
ab6e4913 SC |
329 | wxT_LAST_SIMPLE_TYPE_KIND = wxT_CUSTOM , |
330 | ||
331 | wxT_OBJECT_PTR, // object reference | |
ae820c69 | 332 | wxT_OBJECT , // embedded object |
ab6e4913 SC |
333 | wxT_COLLECTION , // collection |
334 | ||
517fb871 | 335 | wxT_DELEGATE , // for connecting against an event source |
75890a3f | 336 | |
ab6e4913 | 337 | wxT_LAST_TYPE_KIND = wxT_DELEGATE // sentinel for bad data, asserts, debugging |
a095505c SC |
338 | }; |
339 | ||
492f9a9e SC |
340 | class WXDLLIMPEXP_BASE wxxVariant ; |
341 | class WXDLLIMPEXP_BASE wxTypeInfo ; | |
ae820c69 | 342 | |
492f9a9e | 343 | WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxTypeInfo* , wxTypeInfoMap , class WXDLLIMPEXP_BASE ) ; |
208fd16c | 344 | |
a095505c SC |
345 | class WXDLLIMPEXP_BASE wxTypeInfo |
346 | { | |
347 | public : | |
2abce515 SC |
348 | typedef void (*converterToString_t)( const wxxVariant& data , wxString &result ) ; |
349 | typedef void (*converterFromString_t)( const wxString& data , wxxVariant &result ) ; | |
208fd16c | 350 | |
ab0881c7 VS |
351 | wxTypeInfo(wxTypeKind kind, |
352 | converterToString_t to = NULL, converterFromString_t from = NULL, | |
353 | const wxString &name = wxEmptyString): | |
583150e3 | 354 | m_toString(to), m_fromString(from), m_kind(kind), m_name(name) |
2abce515 | 355 | { |
ab0881c7 | 356 | Register(); |
2abce515 | 357 | } |
583150e3 SC |
358 | #if wxUSE_UNICODE |
359 | wxTypeInfo(wxTypeKind kind, | |
360 | converterToString_t to = NULL, converterFromString_t from = NULL, | |
361 | const char *name = ""): | |
362 | m_toString(to), m_fromString(from), m_kind(kind), m_name(wxString::FromAscii(name)) | |
363 | { | |
364 | Register(); | |
365 | } | |
366 | #endif | |
ae820c69 | 367 | |
2abce515 SC |
368 | virtual ~wxTypeInfo() |
369 | { | |
370 | Unregister() ; | |
371 | } | |
ae820c69 | 372 | |
2abce515 SC |
373 | // return the kind of this type (wxT_... constants) |
374 | wxTypeKind GetKind() const { return m_kind ; } | |
ae820c69 | 375 | |
2abce515 SC |
376 | // returns the unique name of this type |
377 | const wxString& GetTypeName() const { return m_name ; } | |
ae820c69 | 378 | |
2abce515 SC |
379 | // is this type a delegate type |
380 | bool IsDelegateType() const { return m_kind == wxT_DELEGATE ; } | |
ae820c69 | 381 | |
2abce515 SC |
382 | // is this type a custom type |
383 | bool IsCustomType() const { return m_kind == wxT_CUSTOM ; } | |
ae820c69 | 384 | |
2abce515 SC |
385 | // is this type an object type |
386 | bool IsObjectType() const { return m_kind == wxT_OBJECT || m_kind == wxT_OBJECT_PTR ; } | |
ae820c69 | 387 | |
2abce515 SC |
388 | // can the content of this type be converted to and from strings ? |
389 | bool HasStringConverters() const { return m_toString != NULL && m_fromString != NULL ; } | |
ae820c69 | 390 | |
2abce515 SC |
391 | // convert a wxxVariant holding data of this type into a string |
392 | void ConvertToString( const wxxVariant& data , wxString &result ) const | |
ae820c69 | 393 | |
2abce515 | 394 | { wxASSERT_MSG( m_toString , wxT("String conversions not supported") ) ; (*m_toString)( data , result ) ; } |
ae820c69 | 395 | |
2abce515 SC |
396 | // convert a string into a wxxVariant holding the corresponding data in this type |
397 | void ConvertFromString( const wxString& data , wxxVariant &result ) const | |
398 | { wxASSERT_MSG( m_fromString , wxT("String conversions not supported") ) ; (*m_fromString)( data , result ) ; } | |
ae820c69 | 399 | |
583150e3 SC |
400 | #if wxUSE_UNICODE |
401 | static wxTypeInfo *FindType(const char *typeName) { return FindType( wxString::FromAscii(typeName) ) ; } | |
402 | #endif | |
2abce515 | 403 | static wxTypeInfo *FindType(const wxChar *typeName); |
ae820c69 SC |
404 | |
405 | private : | |
406 | ||
407 | void Register(); | |
408 | void Unregister(); | |
208fd16c SC |
409 | |
410 | converterToString_t m_toString ; | |
411 | converterFromString_t m_fromString ; | |
412 | ||
ae820c69 SC |
413 | static wxTypeInfoMap* sm_typeTable ; |
414 | ||
ab0881c7 VS |
415 | wxTypeKind m_kind; |
416 | wxString m_name; | |
a095505c SC |
417 | }; |
418 | ||
419 | class WXDLLIMPEXP_BASE wxBuiltInTypeInfo : public wxTypeInfo | |
420 | { | |
421 | public : | |
ae820c69 SC |
422 | wxBuiltInTypeInfo( wxTypeKind kind , converterToString_t to = NULL , converterFromString_t from = NULL , const wxString &name = wxEmptyString ) : |
423 | wxTypeInfo( kind , to , from , name ) | |
424 | { wxASSERT_MSG( GetKind() < wxT_SET , wxT("Illegal Kind for Base Type") ) ; } | |
583150e3 SC |
425 | #if wxUSE_UNICODE |
426 | wxBuiltInTypeInfo( wxTypeKind kind , converterToString_t to , converterFromString_t from , const char *name ) : | |
427 | wxTypeInfo( kind , to , from , name ) | |
428 | { wxASSERT_MSG( GetKind() < wxT_SET , wxT("Illegal Kind for Base Type") ) ; } | |
429 | #endif | |
a095505c SC |
430 | } ; |
431 | ||
432 | class WXDLLIMPEXP_BASE wxCustomTypeInfo : public wxTypeInfo | |
433 | { | |
434 | public : | |
ae820c69 SC |
435 | wxCustomTypeInfo( const wxString &name , converterToString_t to , converterFromString_t from ) : |
436 | wxTypeInfo( wxT_CUSTOM , to , from , name ) | |
437 | {} | |
583150e3 SC |
438 | #if wxUSE_UNICODE |
439 | wxCustomTypeInfo( const char *name , converterToString_t to , converterFromString_t from ) : | |
440 | wxTypeInfo( wxT_CUSTOM , to , from , name ) | |
441 | {} | |
442 | #endif | |
a095505c SC |
443 | } ; |
444 | ||
445 | class WXDLLIMPEXP_BASE wxEnumTypeInfo : public wxTypeInfo | |
446 | { | |
447 | public : | |
ae820c69 SC |
448 | typedef void (*converterToLong_t)( const wxxVariant& data , long &result ) ; |
449 | typedef void (*converterFromLong_t)( long data , wxxVariant &result ) ; | |
450 | ||
2abce515 | 451 | wxEnumTypeInfo( wxTypeKind kind , wxEnumData* enumInfo , converterToString_t to , converterFromString_t from , |
ae820c69 | 452 | converterToLong_t toLong , converterFromLong_t fromLong , const wxString &name ) : |
2abce515 SC |
453 | wxTypeInfo( kind , to , from , name ) , m_toLong( toLong ) , m_fromLong( fromLong ) |
454 | { wxASSERT_MSG( kind == wxT_ENUM || kind == wxT_SET , wxT("Illegal Kind for Enum Type")) ; m_enumInfo = enumInfo ;} | |
583150e3 SC |
455 | |
456 | #if wxUSE_UNICODE | |
457 | wxEnumTypeInfo( wxTypeKind kind , wxEnumData* enumInfo , converterToString_t to , converterFromString_t from , | |
458 | converterToLong_t toLong , converterFromLong_t fromLong , const char * name ) : | |
459 | wxTypeInfo( kind , to , from , name ) , m_toLong( toLong ) , m_fromLong( fromLong ) | |
460 | { wxASSERT_MSG( kind == wxT_ENUM || kind == wxT_SET , wxT("Illegal Kind for Enum Type")) ; m_enumInfo = enumInfo ;} | |
461 | #endif | |
2abce515 | 462 | const wxEnumData* GetEnumData() const { return m_enumInfo ; } |
ae820c69 | 463 | |
2abce515 SC |
464 | // convert a wxxVariant holding data of this type into a long |
465 | void ConvertToLong( const wxxVariant& data , long &result ) const | |
ae820c69 | 466 | |
2abce515 | 467 | { wxASSERT_MSG( m_toLong , wxT("Long conversions not supported") ) ; (*m_toLong)( data , result ) ; } |
ae820c69 | 468 | |
2abce515 SC |
469 | // convert a long into a wxxVariant holding the corresponding data in this type |
470 | void ConvertFromLong( long data , wxxVariant &result ) const | |
471 | { wxASSERT_MSG( m_fromLong , wxT("Long conversions not supported") ) ; (*m_fromLong)( data , result ) ; } | |
ae820c69 | 472 | |
a095505c | 473 | private : |
ae820c69 SC |
474 | converterToLong_t m_toLong ; |
475 | converterFromLong_t m_fromLong ; | |
476 | ||
517fb871 | 477 | wxEnumData *m_enumInfo; // Kind == wxT_ENUM or Kind == wxT_SET |
a095505c SC |
478 | } ; |
479 | ||
480 | class WXDLLIMPEXP_BASE wxClassTypeInfo : public wxTypeInfo | |
481 | { | |
482 | public : | |
492f9a9e | 483 | wxClassTypeInfo( wxTypeKind kind , wxClassInfo* classInfo , converterToString_t to = NULL , converterFromString_t from = NULL , const wxString &name = wxEmptyString) ; |
583150e3 SC |
484 | #if wxUSE_UNICODE |
485 | wxClassTypeInfo( wxTypeKind kind , wxClassInfo* classInfo , converterToString_t to , converterFromString_t from , const char *name ) ; | |
486 | #endif | |
2abce515 | 487 | const wxClassInfo *GetClassInfo() const { return m_classInfo ; } |
a095505c | 488 | private : |
517fb871 | 489 | wxClassInfo *m_classInfo; // Kind == wxT_OBJECT - could be NULL |
a095505c SC |
490 | } ; |
491 | ||
ab6e4913 SC |
492 | class WXDLLIMPEXP_BASE wxCollectionTypeInfo : public wxTypeInfo |
493 | { | |
494 | public : | |
c681bd24 | 495 | wxCollectionTypeInfo( const wxString &elementName , converterToString_t to , converterFromString_t from , const wxString &name) : |
ae820c69 | 496 | wxTypeInfo( wxT_COLLECTION , to , from , name ) |
c681bd24 | 497 | { m_elementTypeName = elementName ; m_elementType = NULL ;} |
583150e3 | 498 | #if wxUSE_UNICODE |
c681bd24 | 499 | wxCollectionTypeInfo( const char *elementName , converterToString_t to , converterFromString_t from , const char *name ) : |
583150e3 | 500 | wxTypeInfo( wxT_COLLECTION , to , from , name ) |
c681bd24 | 501 | { m_elementTypeName = wxString::FromAscii( elementName ) ; m_elementType = NULL ;} |
583150e3 | 502 | #endif |
c681bd24 SC |
503 | const wxTypeInfo* GetElementType() const |
504 | { | |
505 | if ( m_elementType == NULL ) | |
506 | m_elementType = wxTypeInfo::FindType( m_elementTypeName ) ; | |
507 | return m_elementType ; } | |
ab6e4913 | 508 | private : |
c681bd24 SC |
509 | mutable wxTypeInfo * m_elementType ; |
510 | wxString m_elementTypeName ; | |
ab6e4913 SC |
511 | } ; |
512 | ||
4393b50c | 513 | // a delegate is an exposed event source |
a095505c SC |
514 | |
515 | class WXDLLIMPEXP_BASE wxDelegateTypeInfo : public wxTypeInfo | |
516 | { | |
517 | public : | |
ae820c69 | 518 | wxDelegateTypeInfo( int eventType , wxClassInfo* eventClass , converterToString_t to = NULL , converterFromString_t from = NULL ) ; |
517fb871 | 519 | int GetEventType() const { return m_eventType ; } |
25474dca | 520 | const wxClassInfo* GetEventClass() const { return m_eventClass ; } |
a095505c | 521 | private : |
517fb871 VS |
522 | const wxClassInfo *m_eventClass; // (extended will merge into classinfo) |
523 | int m_eventType ; | |
a095505c SC |
524 | } ; |
525 | ||
492f9a9e | 526 | template<typename T> const wxTypeInfo* wxGetTypeInfo( T * ) { return wxTypeInfo::FindType(typeid(T).name()) ; } |
a095505c | 527 | |
a095505c SC |
528 | // this macro is for usage with custom, non-object derived classes and structs, wxPoint is such a custom type |
529 | ||
492f9a9e SC |
530 | #define WX_CUSTOM_TYPE_INFO( e , toString , fromString ) \ |
531 | wxCustomTypeInfo s_typeInfo##e(typeid(e).name() , &toString , &fromString) ; | |
a095505c | 532 | |
ae820c69 | 533 | #define WX_COLLECTION_TYPE_INFO( element , collection ) \ |
c681bd24 | 534 | wxCollectionTypeInfo s_typeInfo##collection( typeid(element).name() , NULL , NULL , typeid(collection).name() ) ; |
ae820c69 | 535 | |
aa8d7c2f | 536 | // sometimes a compiler invents specializations that are nowhere called, use this macro to satisfy the refs |
a095505c | 537 | |
583150e3 | 538 | #define WX_ILLEGAL_TYPE_SPECIALIZATION( a ) |
492f9a9e SC |
539 | /* |
540 | template<> const wxTypeInfo* wxGetTypeInfo( a * ) { assert(0) ; \ | |
aa8d7c2f | 541 | static wxBuiltInTypeInfo s_typeInfo( wxT_VOID ) ; return &s_typeInfo ; } \ |
492f9a9e SC |
542 | template<> void wxStringReadValue(const wxString & , a & ) { assert(0) ; }\ |
543 | template<> void wxStringWriteValue(wxString & , a const & ) { assert(0) ; } | |
544 | */ | |
a095505c SC |
545 | |
546 | // ---------------------------------------------------------------------------- | |
547 | // wxxVariant as typesafe data holder | |
548 | // ---------------------------------------------------------------------------- | |
549 | ||
550 | class WXDLLIMPEXP_BASE wxxVariantData | |
551 | { | |
552 | public: | |
517fb871 | 553 | virtual ~wxxVariantData() {} |
a095505c | 554 | |
517fb871 VS |
555 | // return a heap allocated duplicate |
556 | virtual wxxVariantData* Clone() const = 0 ; | |
a095505c | 557 | |
517fb871 VS |
558 | // returns the type info of the contentc |
559 | virtual const wxTypeInfo* GetTypeInfo() const = 0 ; | |
a095505c SC |
560 | } ; |
561 | ||
df3a88af | 562 | template<typename T> class wxxVariantDataT : public wxxVariantData |
a095505c SC |
563 | { |
564 | public: | |
fa08490f | 565 | wxxVariantDataT(const T& d) : m_data(d) {} |
ae820c69 | 566 | virtual ~wxxVariantDataT() {} |
a095505c | 567 | |
ae820c69 | 568 | // get a ref to the stored data |
fa08490f | 569 | T & Get() { return m_data; } |
a095505c | 570 | |
ae820c69 | 571 | // get a const ref to the stored data |
fa08490f SC |
572 | const T & Get() const { return m_data; } |
573 | ||
ae820c69 | 574 | // set the data |
fa08490f | 575 | void Set(const T& d) { m_data = d; } |
a095505c | 576 | |
517fb871 VS |
577 | // return a heap allocated duplicate |
578 | virtual wxxVariantData* Clone() const { return new wxxVariantDataT<T>( Get() ) ; } | |
a095505c | 579 | |
517fb871 VS |
580 | // returns the type info of the contentc |
581 | virtual const wxTypeInfo* GetTypeInfo() const { return wxGetTypeInfo( (T*) NULL ) ; } | |
583150e3 | 582 | |
a095505c SC |
583 | private: |
584 | T m_data; | |
585 | }; | |
586 | ||
587 | class WXDLLIMPEXP_BASE wxxVariant | |
588 | { | |
589 | public : | |
ae820c69 SC |
590 | wxxVariant() { m_data = NULL ; } |
591 | wxxVariant( wxxVariantData* data , const wxString& name = wxT("") ) : m_data(data) , m_name(name) {} | |
592 | wxxVariant( const wxxVariant &d ) { if ( d.m_data ) m_data = d.m_data->Clone() ; else m_data = NULL ; m_name = d.m_name ; } | |
593 | ||
594 | template<typename T> wxxVariant( const T& data , const wxString& name = wxT("") ) : | |
595 | m_data(new wxxVariantDataT<T>(data) ), m_name(name) {} | |
596 | ||
597 | ~wxxVariant() { delete m_data ; } | |
598 | ||
599 | // get a ref to the stored data | |
2abce515 | 600 | template<typename T> T& Get(WX_TEMPLATED_MEMBER_FIX(T)) |
ae820c69 SC |
601 | { |
602 | wxxVariantDataT<T> *dataptr = dynamic_cast<wxxVariantDataT<T>*> (m_data) ; | |
0a206469 | 603 | wxASSERT_MSG( dataptr , wxT("Cast not possible") ) ; |
ae820c69 SC |
604 | return dataptr->Get() ; |
605 | } | |
606 | ||
607 | // get a ref to the stored data | |
2abce515 | 608 | template<typename T> const T& Get(WX_TEMPLATED_MEMBER_FIX(T)) const |
ae820c69 SC |
609 | { |
610 | const wxxVariantDataT<T> *dataptr = dynamic_cast<const wxxVariantDataT<T>*> (m_data) ; | |
0a206469 | 611 | wxASSERT_MSG( dataptr , wxT("Cast not possible") ) ; |
ae820c69 SC |
612 | return dataptr->Get() ; |
613 | } | |
fa08490f | 614 | |
583150e3 SC |
615 | bool IsEmpty() const { return m_data == NULL ; } |
616 | ||
208fd16c SC |
617 | template<typename T> bool HasData() const |
618 | { | |
ae820c69 | 619 | const wxxVariantDataT<T> *dataptr = dynamic_cast<const wxxVariantDataT<T>*> (m_data) ; |
208fd16c SC |
620 | return dataptr != NULL ; |
621 | } | |
622 | ||
ae820c69 SC |
623 | // stores the data |
624 | template<typename T> void Set(const T& data) const | |
625 | { | |
626 | delete m_data ; | |
627 | m_data = new wxxVariantDataT<T>(data) ; | |
628 | } | |
629 | ||
630 | wxxVariant& operator=(const wxxVariant &d) | |
631 | { | |
632 | m_data = d.m_data->Clone() ; | |
633 | m_name = d.m_name ; | |
634 | return *this ; | |
635 | } | |
636 | ||
637 | // gets the stored data casted to a wxObject* , returning NULL if cast is not possible | |
638 | wxObject* GetAsObject() ; | |
639 | ||
640 | // get the typeinfo of the stored object | |
641 | const wxTypeInfo* GetTypeInfo() const { return m_data->GetTypeInfo() ; } | |
642 | ||
643 | // returns this value as string | |
644 | wxString GetAsString() const | |
645 | { | |
646 | wxString s ; | |
208fd16c | 647 | GetTypeInfo()->ConvertToString( *this , s ) ; |
ae820c69 SC |
648 | return s ; |
649 | } | |
4f8ffae1 | 650 | const wxString& GetName() const { return m_name ; } |
a095505c | 651 | private : |
517fb871 VS |
652 | wxxVariantData* m_data ; |
653 | wxString m_name ; | |
a095505c SC |
654 | } ; |
655 | ||
ab6e4913 SC |
656 | #include <wx/dynarray.h> |
657 | ||
658 | WX_DECLARE_OBJARRAY_WITH_DECL(wxxVariant, wxxVariantArray, class WXDLLIMPEXP_BASE); | |
659 | ||
2abce515 SC |
660 | // templated streaming, every type must have their specialization for these methods |
661 | ||
662 | template<typename T> | |
663 | void wxStringReadValue( const wxString &s , T &data ); | |
664 | ||
665 | template<typename T> | |
666 | void wxStringWriteValue( wxString &s , const T &data); | |
667 | ||
668 | template<typename T> | |
669 | void wxToStringConverter( const wxxVariant &v, wxString &s) { wxStringWriteValue( s , v.WX_TEMPLATED_MEMBER_CALL(Get , T) ) ; } | |
670 | ||
671 | template<typename T> | |
672 | void wxFromStringConverter( const wxString &s, wxxVariant &v) { T d ; wxStringReadValue( s , d ) ; v = wxxVariant(d) ; } \ | |
673 | ||
a095505c SC |
674 | // ---------------------------------------------------------------------------- |
675 | // Property Support | |
676 | // | |
677 | // wxPropertyInfo is used to inquire of the property by name. It doesn't | |
678 | // provide access to the property, only information about it. If you | |
679 | // want access, look at wxPropertyAccessor. | |
680 | // ---------------------------------------------------------------------------- | |
681 | ||
492f9a9e | 682 | class WXDLLIMPEXP_BASE wxSetter |
a095505c | 683 | { |
ab0881c7 | 684 | public: |
208fd16c | 685 | wxSetter( const wxString name ) { m_name = name ; } |
ab0881c7 | 686 | virtual ~wxSetter() {} |
208fd16c SC |
687 | virtual void Set( wxObject *object, const wxxVariant &variantValue ) const = 0; |
688 | const wxString& GetName() const { return m_name ; } | |
ab0881c7 VS |
689 | private: |
690 | wxString m_name; | |
691 | }; | |
a095505c | 692 | |
492f9a9e | 693 | class WXDLLIMPEXP_BASE wxGetter |
2d51f067 | 694 | { |
ab0881c7 | 695 | public: |
208fd16c | 696 | wxGetter( const wxString name ) { m_name = name ; } |
ab0881c7 | 697 | virtual ~wxGetter() {} |
208fd16c SC |
698 | virtual void Get( const wxObject *object , wxxVariant& result) const = 0; |
699 | const wxString& GetName() const { return m_name ; } | |
ab0881c7 VS |
700 | private: |
701 | wxString m_name; | |
702 | }; | |
2d51f067 | 703 | |
492f9a9e | 704 | class WXDLLIMPEXP_BASE wxCollectionGetter |
a095505c | 705 | { |
208fd16c SC |
706 | public : |
707 | wxCollectionGetter( const wxString name ) { m_name = name ; } | |
ab0881c7 | 708 | virtual ~wxCollectionGetter() {} |
208fd16c SC |
709 | virtual void Get( const wxObject *object , wxxVariantArray& result) const = 0; |
710 | const wxString& GetName() const { return m_name ; } | |
711 | private : | |
712 | wxString m_name ; | |
713 | } ; | |
fa08490f | 714 | |
208fd16c | 715 | template<typename coll_t> void wxCollectionToVariantArray( const coll_t& coll , wxxVariantArray& result ) ; |
a095505c | 716 | |
492f9a9e | 717 | class WXDLLIMPEXP_BASE wxAdder |
208fd16c SC |
718 | { |
719 | public : | |
720 | wxAdder( const wxString name ) { m_name = name ; } | |
ab0881c7 | 721 | virtual ~wxAdder() {} |
208fd16c SC |
722 | virtual void Add( wxObject *object, const wxxVariant &variantValue ) const= 0; |
723 | const wxString& GetName() const { return m_name ; } | |
724 | private : | |
725 | wxString m_name ; | |
726 | } ; | |
a095505c | 727 | |
517fb871 | 728 | |
ab6e4913 | 729 | |
a06bb527 | 730 | #define WX_SETTER( property, Klass, valueType, setterMethod ) \ |
ae820c69 SC |
731 | class wxSetter##property : public wxSetter \ |
732 | { \ | |
733 | public: \ | |
583150e3 | 734 | wxSetter##property() : wxSetter( wxT(#setterMethod) ) {} \ |
492f9a9e | 735 | ~wxSetter##property() {} \ |
ae820c69 SC |
736 | void Set( wxObject *object, const wxxVariant &variantValue ) const \ |
737 | { \ | |
738 | Klass *obj = dynamic_cast<Klass*>(object) ; \ | |
739 | if ( variantValue.HasData<valueType>() ) \ | |
740 | obj->setterMethod(variantValue.Get<valueType>()) ; \ | |
a06bb527 | 741 | else \ |
ae820c69 SC |
742 | obj->setterMethod(*variantValue.Get<valueType*>()) ; \ |
743 | } \ | |
744 | } ; | |
208fd16c | 745 | |
a06bb527 | 746 | #define WX_GETTER( property, Klass, valueType , gettermethod ) \ |
ae820c69 SC |
747 | class wxGetter##property : public wxGetter \ |
748 | { \ | |
749 | public : \ | |
583150e3 | 750 | wxGetter##property() : wxGetter( wxT(#gettermethod) ) {} \ |
492f9a9e | 751 | ~wxGetter##property() {} \ |
ae820c69 SC |
752 | void Get( const wxObject *object , wxxVariant &result) const \ |
753 | { \ | |
754 | const Klass *obj = dynamic_cast<const Klass*>(object) ; \ | |
755 | result = wxxVariant( obj->gettermethod() ) ; \ | |
756 | } \ | |
757 | } ; | |
208fd16c | 758 | |
a06bb527 | 759 | #define WX_ADDER( property, Klass, valueType , addermethod ) \ |
ae820c69 SC |
760 | class wxAdder##property : public wxAdder \ |
761 | { \ | |
762 | public: \ | |
583150e3 | 763 | wxAdder##property() : wxAdder( wxT(#addermethod) ) {} \ |
492f9a9e | 764 | ~wxAdder##property() {} \ |
ae820c69 SC |
765 | void Add( wxObject *object, const wxxVariant &variantValue ) const \ |
766 | { \ | |
767 | Klass *obj = dynamic_cast<Klass*>(object) ; \ | |
768 | if ( variantValue.HasData<valueType>() ) \ | |
769 | obj->addermethod(variantValue.Get<valueType>()) ; \ | |
a06bb527 | 770 | else \ |
ae820c69 SC |
771 | obj->addermethod(*variantValue.Get<valueType*>()) ; \ |
772 | } \ | |
773 | } ; | |
208fd16c | 774 | |
a06bb527 | 775 | #define WX_COLLECTION_GETTER( property, Klass, valueType , gettermethod ) \ |
ae820c69 SC |
776 | class wxCollectionGetter##property : public wxCollectionGetter \ |
777 | { \ | |
778 | public : \ | |
583150e3 | 779 | wxCollectionGetter##property() : wxCollectionGetter( wxT(#gettermethod) ) {} \ |
492f9a9e | 780 | ~wxCollectionGetter##property() {} \ |
ae820c69 SC |
781 | void Get( const wxObject *object , wxxVariantArray &result) const \ |
782 | { \ | |
783 | const Klass *obj = dynamic_cast<const Klass*>(object) ; \ | |
784 | wxCollectionToVariantArray( obj->gettermethod() , result ) ; \ | |
785 | } \ | |
786 | } ; | |
ab6e4913 | 787 | |
208fd16c SC |
788 | class WXDLLIMPEXP_BASE wxPropertyAccessor |
789 | { | |
790 | public : | |
791 | wxPropertyAccessor( wxSetter *setter , wxGetter *getter , wxAdder *adder , wxCollectionGetter *collectionGetter ) | |
792 | { m_setter = setter ; m_getter = getter ; m_adder = adder ; m_collectionGetter = collectionGetter ;} | |
ab6e4913 | 793 | |
208fd16c | 794 | virtual ~wxPropertyAccessor() {} |
ab6e4913 | 795 | |
208fd16c SC |
796 | // Setting a simple property (non-collection) |
797 | virtual void SetProperty(wxObject *object, const wxxVariant &value) const | |
798 | { wxASSERT_MSG(m_setter,wxT("SetProperty called w/o valid setter") ) ; m_setter->Set( object , value ) ;} | |
16a45a23 | 799 | |
208fd16c SC |
800 | // Getting a simple property (non-collection) |
801 | virtual void GetProperty(const wxObject *object, wxxVariant &result) const | |
16d0c403 | 802 | { wxASSERT_MSG(m_getter,wxT("GetProperty called w/o valid getter") ) ; m_getter->Get( object , result ) ;} |
ab6e4913 | 803 | |
208fd16c SC |
804 | // Adding an element to a collection property |
805 | virtual void AddToPropertyCollection(wxObject *object, const wxxVariant &value) const | |
806 | { wxASSERT_MSG(m_adder,wxT("AddToPropertyCollection called w/o valid adder") ) ; m_adder->Add( object , value ) ;} | |
ab6e4913 | 807 | |
208fd16c SC |
808 | // Getting a collection property |
809 | virtual void GetPropertyCollection( const wxObject *obj, wxxVariantArray &result) const | |
16d0c403 | 810 | { wxASSERT_MSG(m_collectionGetter,wxT("GetPropertyCollection called w/o valid collection getter") ) ; m_collectionGetter->Get( obj , result) ;} |
208fd16c SC |
811 | |
812 | virtual bool HasSetter() const { return m_setter != NULL ; } | |
813 | virtual bool HasCollectionGetter() const { return m_collectionGetter != NULL ; } | |
814 | virtual bool HasGetter() const { return m_getter != NULL ; } | |
815 | virtual bool HasAdder() const { return m_adder != NULL ; } | |
816 | ||
817 | virtual const wxString& GetCollectionGetterName() const | |
818 | { return m_collectionGetter->GetName() ; } | |
819 | virtual const wxString& GetGetterName() const | |
820 | { return m_getter->GetName() ; } | |
821 | virtual const wxString& GetSetterName() const | |
822 | { return m_setter->GetName() ; } | |
823 | virtual const wxString& GetAdderName() const | |
824 | { return m_adder->GetName() ; } | |
492f9a9e | 825 | |
208fd16c SC |
826 | protected : |
827 | wxSetter *m_setter ; | |
828 | wxAdder *m_adder ; | |
829 | wxGetter *m_getter ; | |
830 | wxCollectionGetter* m_collectionGetter ; | |
831 | }; | |
ab6e4913 | 832 | |
ae820c69 SC |
833 | class WXDLLIMPEXP_BASE wxGenericPropertyAccessor : public wxPropertyAccessor |
834 | { | |
835 | public : | |
836 | wxGenericPropertyAccessor( const wxString &propName ) ; | |
837 | ~wxGenericPropertyAccessor() ; | |
ab6e4913 | 838 | |
492f9a9e SC |
839 | void RenameProperty( const wxString &oldName , const wxString &newName ) |
840 | { | |
841 | wxASSERT( oldName == m_propertyName ) ; m_propertyName = newName ; | |
842 | } | |
ae820c69 SC |
843 | virtual bool HasSetter() const { return true ; } |
844 | virtual bool HasGetter() const { return true ; } | |
845 | virtual bool HasAdder() const { return false ; } | |
846 | virtual bool HasCollectionGetter() const { return false ; } | |
ab6e4913 | 847 | |
ae820c69 | 848 | virtual const wxString& GetGetterName() const |
208fd16c SC |
849 | { return m_getterName ; } |
850 | virtual const wxString& GetSetterName() const | |
851 | { return m_setterName ; } | |
ab6e4913 | 852 | |
208fd16c | 853 | virtual void SetProperty(wxObject *object, const wxxVariant &value) const ; |
ae820c69 | 854 | virtual void GetProperty(const wxObject *object, wxxVariant &value) const ; |
208fd16c | 855 | |
ae820c69 SC |
856 | // Adding an element to a collection property |
857 | virtual void AddToPropertyCollection(wxObject *WXUNUSED(object), const wxxVariant &WXUNUSED(value)) const | |
858 | { wxASSERT_MSG(0,wxT("AddToPropertyCollection called on a generic accessor") ) ;} | |
208fd16c | 859 | |
ae820c69 SC |
860 | // Getting a collection property |
861 | virtual void GetPropertyCollection( const wxObject *WXUNUSED(obj), wxxVariantArray &WXUNUSED(result)) const | |
208fd16c | 862 | { wxASSERT_MSG(0,wxT("GetPropertyCollection called on a generic accessor") ) ;} |
ae820c69 SC |
863 | private : |
864 | struct wxGenericPropertyAccessorInternal ; | |
865 | wxGenericPropertyAccessorInternal* m_data ; | |
866 | wxString m_propertyName ; | |
867 | wxString m_setterName ; | |
868 | wxString m_getterName ; | |
208fd16c | 869 | } ; |
ab6e4913 | 870 | |
ae820c69 SC |
871 | typedef long wxPropertyInfoFlags ; |
872 | enum { | |
873 | // will be removed in future releases | |
874 | wxPROP_DEPRECATED = 0x00000001 , | |
875 | // object graph property, will be streamed with priority (after constructor properties) | |
876 | wxPROP_OBJECT_GRAPH = 0x00000002 , | |
877 | // this will only be streamed out and in as enum/set, the internal representation is still a long | |
878 | wxPROP_ENUM_STORE_LONG = 0x00000004 , | |
9c8046dd SC |
879 | // don't stream out this property, needed eg to avoid streaming out children that are always created by their parents |
880 | wxPROP_DONT_STREAM = 0x00000008 , | |
ae820c69 SC |
881 | } ; |
882 | ||
a095505c SC |
883 | class WXDLLIMPEXP_BASE wxPropertyInfo |
884 | { | |
492f9a9e | 885 | friend class WXDLLIMPEXP_BASE wxDynamicClassInfo ; |
a095505c | 886 | public : |
ab0881c7 | 887 | wxPropertyInfo(wxPropertyInfo* &iter, |
492f9a9e SC |
888 | wxClassInfo* itsClass, |
889 | const wxString& name, | |
890 | const wxString& typeName, | |
891 | wxPropertyAccessor *accessor, | |
892 | wxxVariant dv, | |
893 | wxPropertyInfoFlags flags = 0, | |
894 | const wxString& helpString = wxEmptyString, | |
895 | const wxString& groupString = wxEmptyString) : | |
583150e3 | 896 | m_itsClass(itsClass), |
492f9a9e | 897 | m_name(name), |
492f9a9e | 898 | m_typeInfo(NULL), |
583150e3 | 899 | m_typeName(typeName) , |
492f9a9e SC |
900 | m_collectionElementTypeInfo(NULL), |
901 | m_accessor(accessor), | |
583150e3 SC |
902 | m_defaultValue(dv), |
903 | m_flags(flags), | |
904 | m_helpString(helpString), | |
905 | m_groupString(groupString) | |
492f9a9e SC |
906 | { |
907 | Insert(iter); | |
908 | } | |
909 | ||
583150e3 | 910 | #if wxUSE_UNICODE |
492f9a9e SC |
911 | wxPropertyInfo(wxPropertyInfo* &iter, |
912 | wxClassInfo* itsClass, | |
ab0881c7 | 913 | const wxString& name, |
583150e3 | 914 | const char* typeName, |
ab0881c7 VS |
915 | wxPropertyAccessor *accessor, |
916 | wxxVariant dv, | |
917 | wxPropertyInfoFlags flags = 0, | |
918 | const wxString& helpString = wxEmptyString, | |
919 | const wxString& groupString = wxEmptyString) : | |
583150e3 | 920 | m_itsClass(itsClass), |
ab0881c7 | 921 | m_name(name), |
583150e3 SC |
922 | m_typeInfo(NULL), |
923 | m_typeName(wxString::FromAscii(typeName)) , | |
924 | m_collectionElementTypeInfo(NULL), | |
925 | m_accessor(accessor), | |
926 | m_defaultValue(dv), | |
927 | m_flags(flags), | |
ab0881c7 | 928 | m_helpString(helpString), |
583150e3 SC |
929 | m_groupString(groupString) |
930 | { | |
931 | Insert(iter); | |
932 | } | |
933 | #endif | |
934 | wxPropertyInfo(wxPropertyInfo* &iter, | |
935 | wxClassInfo* itsClass, | |
936 | const wxString& name, | |
937 | wxDelegateTypeInfo* type, | |
938 | wxPropertyAccessor *accessor, | |
939 | wxxVariant dv, | |
940 | wxPropertyInfoFlags flags = 0, | |
941 | const wxString& helpString = wxEmptyString, | |
942 | const wxString& groupString = wxEmptyString) : | |
ab0881c7 | 943 | m_itsClass(itsClass), |
583150e3 | 944 | m_name(name), |
492f9a9e | 945 | m_typeInfo(type), |
ab0881c7 VS |
946 | m_collectionElementTypeInfo(NULL), |
947 | m_accessor(accessor), | |
583150e3 SC |
948 | m_defaultValue(dv), |
949 | m_flags(flags), | |
950 | m_helpString(helpString), | |
951 | m_groupString(groupString) | |
ae820c69 | 952 | { |
ab0881c7 | 953 | Insert(iter); |
ae820c69 SC |
954 | } |
955 | ||
ab0881c7 | 956 | wxPropertyInfo(wxPropertyInfo* &iter, |
492f9a9e SC |
957 | wxClassInfo* itsClass, const wxString& name, |
958 | const wxString& collectionTypeName, | |
959 | const wxString& elementTypeName, | |
ab0881c7 VS |
960 | wxPropertyAccessor *accessor, |
961 | wxPropertyInfoFlags flags = 0, | |
962 | const wxString& helpString = wxEmptyString, | |
963 | const wxString& groupString = wxEmptyString) : | |
ab0881c7 | 964 | m_itsClass(itsClass), |
583150e3 | 965 | m_name(name), |
492f9a9e SC |
966 | m_typeInfo(NULL), |
967 | m_typeName(collectionTypeName) , | |
968 | m_collectionElementTypeInfo(NULL), | |
969 | m_collectionElementTypeName(elementTypeName), | |
583150e3 SC |
970 | m_accessor(accessor) , |
971 | m_flags(flags), | |
972 | m_helpString(helpString), | |
973 | m_groupString(groupString) | |
ae820c69 | 974 | { |
ab0881c7 | 975 | Insert(iter); |
ae820c69 SC |
976 | } |
977 | ||
583150e3 SC |
978 | #if wxUSE_UNICODE |
979 | wxPropertyInfo(wxPropertyInfo* &iter, | |
980 | wxClassInfo* itsClass, const wxString& name, | |
981 | const char* collectionTypeName, | |
982 | const char* elementTypeName, | |
983 | wxPropertyAccessor *accessor, | |
984 | wxPropertyInfoFlags flags = 0, | |
985 | const wxString& helpString = wxEmptyString, | |
986 | const wxString& groupString = wxEmptyString) : | |
987 | m_itsClass(itsClass), | |
988 | m_name(name), | |
989 | m_typeInfo(NULL), | |
990 | m_typeName(wxString::FromAscii(collectionTypeName)) , | |
991 | m_collectionElementTypeInfo(NULL), | |
992 | m_collectionElementTypeName(wxString::FromAscii(elementTypeName)), | |
993 | m_accessor(accessor) , | |
994 | m_flags(flags), | |
995 | m_helpString(helpString), | |
996 | m_groupString(groupString) | |
997 | { | |
998 | Insert(iter); | |
999 | } | |
1000 | #endif | |
1c263d56 SC |
1001 | ~wxPropertyInfo() ; |
1002 | ||
ae820c69 SC |
1003 | // return the class this property is declared in |
1004 | const wxClassInfo* GetDeclaringClass() const { return m_itsClass ; } | |
fa08490f | 1005 | |
ae820c69 SC |
1006 | // return the name of this property |
1007 | const wxString& GetName() const { return m_name ; } | |
ab6e4913 | 1008 | |
ae820c69 SC |
1009 | // returns the flags of this property |
1010 | wxPropertyInfoFlags GetFlags() const { return m_flags ;} | |
fa08490f | 1011 | |
ae820c69 SC |
1012 | // returns the short help string of this property |
1013 | const wxString& GetHelpString() const { return m_helpString ; } | |
fa08490f | 1014 | |
ae820c69 SC |
1015 | // returns the group string of this property |
1016 | const wxString& GetGroupString() const { return m_groupString ; } | |
fa08490f | 1017 | |
ae820c69 | 1018 | // return the element type info of this property (for collections, otherwise NULL) |
583150e3 | 1019 | const wxTypeInfo * GetCollectionElementTypeInfo() const |
492f9a9e SC |
1020 | { |
1021 | if ( m_collectionElementTypeInfo == NULL ) | |
1022 | m_collectionElementTypeInfo = wxTypeInfo::FindType(m_collectionElementTypeName) ; | |
583150e3 | 1023 | return m_collectionElementTypeInfo ; |
492f9a9e | 1024 | } |
fa08490f | 1025 | |
ae820c69 | 1026 | // return the type info of this property |
583150e3 | 1027 | const wxTypeInfo * GetTypeInfo() const |
492f9a9e SC |
1028 | { |
1029 | if ( m_typeInfo == NULL ) | |
1030 | m_typeInfo = wxTypeInfo::FindType(m_typeName) ; | |
583150e3 | 1031 | return m_typeInfo ; |
492f9a9e | 1032 | } |
fa08490f | 1033 | |
ae820c69 SC |
1034 | // return the accessor for this property |
1035 | wxPropertyAccessor* GetAccessor() const { return m_accessor ; } | |
1036 | ||
1037 | // returns NULL if this is the last property of this class | |
1038 | wxPropertyInfo* GetNext() const { return m_next ; } | |
1039 | ||
1040 | // returns the default value of this property, its kind may be wxT_VOID if it is not valid | |
1041 | wxxVariant GetDefaultValue() const { return m_defaultValue ; } | |
4393b50c | 1042 | private : |
ab6e4913 SC |
1043 | void Insert(wxPropertyInfo* &iter) |
1044 | { | |
ae820c69 SC |
1045 | m_next = NULL ; |
1046 | if ( iter == NULL ) | |
1047 | iter = this ; | |
1048 | else | |
1049 | { | |
1050 | wxPropertyInfo* i = iter ; | |
1051 | while( i->m_next ) | |
1052 | i = i->m_next ; | |
1053 | ||
1054 | i->m_next = this ; | |
1055 | } | |
ab6e4913 | 1056 | } |
583150e3 | 1057 | |
492f9a9e | 1058 | wxClassInfo* m_itsClass ; |
583150e3 | 1059 | wxString m_name ; |
492f9a9e | 1060 | mutable wxTypeInfo* m_typeInfo ; |
583150e3 | 1061 | wxString m_typeName ; |
492f9a9e | 1062 | mutable wxTypeInfo* m_collectionElementTypeInfo ; |
583150e3 | 1063 | wxString m_collectionElementTypeName ; |
517fb871 | 1064 | wxPropertyAccessor* m_accessor ; |
583150e3 SC |
1065 | wxxVariant m_defaultValue; |
1066 | wxPropertyInfoFlags m_flags ; | |
1067 | wxString m_helpString ; | |
1068 | wxString m_groupString ; | |
517fb871 VS |
1069 | // string representation of the default value |
1070 | // to be assigned by the designer to the property | |
1071 | // when the component is dropped on the container. | |
1072 | wxPropertyInfo* m_next ; | |
a095505c SC |
1073 | }; |
1074 | ||
492f9a9e | 1075 | WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxPropertyInfo* , wxPropertyInfoMap , class WXDLLIMPEXP_BASE ) ; |
ae820c69 | 1076 | |
a095505c | 1077 | #define WX_BEGIN_PROPERTIES_TABLE(theClass) \ |
2d51f067 | 1078 | wxPropertyInfo *theClass::GetPropertiesStatic() \ |
ae820c69 SC |
1079 | { \ |
1080 | typedef theClass class_t; \ | |
1081 | static wxPropertyInfo* first = NULL ; | |
a095505c SC |
1082 | |
1083 | #define WX_END_PROPERTIES_TABLE() \ | |
ae820c69 | 1084 | return first ; } |
a095505c | 1085 | |
492f9a9e | 1086 | #define WX_HIDE_PROPERTY( pname ) \ |
583150e3 | 1087 | static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(void).name() ,NULL , wxxVariant() , wxPROP_DONT_STREAM , wxEmptyString , wxEmptyString ) ; |
492f9a9e SC |
1088 | |
1089 | #define WX_PROPERTY( pname , type , setter , getter ,defaultValue , flags , help , group) \ | |
1090 | WX_SETTER( pname , class_t , type , setter ) \ | |
1091 | static wxSetter##pname _setter##pname ; \ | |
1092 | WX_GETTER( pname , class_t , type , getter ) \ | |
1093 | static wxGetter##pname _getter##pname ; \ | |
1094 | static wxPropertyAccessor _accessor##pname( &_setter##pname , &_getter##pname , NULL , NULL ) ; \ | |
583150e3 | 1095 | static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(type).name() ,&_accessor##pname , wxxVariant(defaultValue) , flags , group , help ) ; |
492f9a9e SC |
1096 | |
1097 | #define WX_PROPERTY_FLAGS( pname , flags , type , setter , getter ,defaultValue , pflags , help , group) \ | |
1098 | WX_SETTER( pname , class_t , type , setter ) \ | |
1099 | static wxSetter##pname _setter##pname ; \ | |
1100 | WX_GETTER( pname , class_t , type , getter ) \ | |
1101 | static wxGetter##pname _getter##pname ; \ | |
1102 | static wxPropertyAccessor _accessor##pname( &_setter##pname , &_getter##pname , NULL , NULL ) ; \ | |
583150e3 | 1103 | static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(flags).name() ,&_accessor##pname , wxxVariant(defaultValue), wxPROP_ENUM_STORE_LONG | pflags , help , group ) ; |
492f9a9e SC |
1104 | |
1105 | #define WX_READONLY_PROPERTY( pname , type , getter ,defaultValue , flags , help , group) \ | |
1106 | WX_GETTER( pname , class_t , type , getter ) \ | |
1107 | static wxGetter##pname _getter##pname ; \ | |
1108 | static wxPropertyAccessor _accessor##pname( NULL , &_getter##pname , NULL , NULL ) ; \ | |
583150e3 SC |
1109 | static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(type).name() ,&_accessor##pname , wxxVariant(defaultValue), flags , help , group ) ; |
1110 | ||
1111 | #define WX_READONLY_PROPERTY_FLAGS( pname , flags , type , getter ,defaultValue , pflags , help , group) \ | |
1112 | WX_GETTER( pname , class_t , type , getter ) \ | |
1113 | static wxGetter##pname _getter##pname ; \ | |
1114 | static wxPropertyAccessor _accessor##pname( NULL , &_getter##pname , NULL , NULL ) ; \ | |
1115 | static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(flags).name() ,&_accessor##pname , wxxVariant(defaultValue), wxPROP_ENUM_STORE_LONG | pflags , help , group ) ; | |
492f9a9e SC |
1116 | |
1117 | #define WX_PROPERTY_COLLECTION( pname , colltype , addelemtype , adder , getter , flags , help , group ) \ | |
1118 | WX_ADDER( pname , class_t , addelemtype , adder ) \ | |
1119 | static wxAdder##pname _adder##pname ; \ | |
1120 | WX_COLLECTION_GETTER( pname , class_t , colltype , getter ) \ | |
1121 | static wxCollectionGetter##pname _collectionGetter##pname ; \ | |
1122 | static wxPropertyAccessor _accessor##pname( NULL , NULL ,&_adder##pname , &_collectionGetter##pname ) ; \ | |
583150e3 | 1123 | static wxPropertyInfo _propertyInfo##pname( first , class_t::GetClassInfoStatic() , wxT(#pname) , typeid(colltype).name() ,typeid(addelemtype).name() ,&_accessor##pname , flags , help , group ) ; |
492f9a9e SC |
1124 | |
1125 | #define WX_READONLY_PROPERTY_COLLECTION( pname , colltype , addelemtype , getter , flags , help , group) \ | |
1126 | WX_COLLECTION_GETTER( pname , class_t , colltype , getter ) \ | |
1127 | static wxCollectionGetter##pname _collectionGetter##pname ; \ | |
1128 | static wxPropertyAccessor _accessor##pname( NULL , NULL , NULL , &_collectionGetter##pname ) ; \ | |
583150e3 | 1129 | static wxPropertyInfo _propertyInfo##pname( first ,class_t::GetClassInfoStatic() , wxT(#pname) , typeid(colltype).name() ,typeid(addelemtype).name() ,&_accessor##pname , flags , help , group ) ; |
16a45a23 SC |
1130 | |
1131 | ||
a095505c | 1132 | #define WX_DELEGATE( name , eventType , eventClass ) \ |
517fb871 | 1133 | static wxDelegateTypeInfo _typeInfo##name( eventType , CLASSINFO( eventClass ) ) ; \ |
583150e3 | 1134 | static wxPropertyInfo _propertyInfo##name( first ,class_t::GetClassInfoStatic() , wxT(#name) , &_typeInfo##name , NULL , wxxVariant() ) ; \ |
a095505c SC |
1135 | |
1136 | // ---------------------------------------------------------------------------- | |
1137 | // Handler Info | |
1138 | // | |
1139 | // this is describing an event sink | |
1140 | // ---------------------------------------------------------------------------- | |
1141 | ||
492f9a9e | 1142 | class WXDLLIMPEXP_BASE wxHandlerInfo |
a095505c | 1143 | { |
492f9a9e | 1144 | friend class WXDLLIMPEXP_BASE wxDynamicClassInfo ; |
a095505c | 1145 | public : |
ab0881c7 | 1146 | wxHandlerInfo(wxHandlerInfo* &iter, |
492f9a9e | 1147 | wxClassInfo* itsClass, |
ab0881c7 VS |
1148 | const wxString& name, |
1149 | wxObjectEventFunction address, | |
1150 | const wxClassInfo* eventClassInfo) : | |
1151 | m_eventFunction(address), | |
1152 | m_name(name), | |
492f9a9e SC |
1153 | m_eventClassInfo(eventClassInfo) , |
1154 | m_itsClass(itsClass) | |
ae820c69 SC |
1155 | { |
1156 | m_next = NULL ; | |
1157 | if ( iter == NULL ) | |
1158 | iter = this ; | |
1159 | else | |
1160 | { | |
1161 | wxHandlerInfo* i = iter ; | |
1162 | while( i->m_next ) | |
1163 | i = i->m_next ; | |
1164 | ||
1165 | i->m_next = this ; | |
1166 | } | |
1167 | } | |
1168 | ||
1c263d56 SC |
1169 | ~wxHandlerInfo() ; |
1170 | ||
ae820c69 SC |
1171 | // return the name of this handler |
1172 | const wxString& GetName() const { return m_name ; } | |
1173 | ||
1174 | // return the class info of the event | |
1175 | const wxClassInfo * GetEventClassInfo() const { return m_eventClassInfo ; } | |
1176 | ||
1177 | // get the handler function pointer | |
1178 | wxObjectEventFunction GetEventFunction() const { return m_eventFunction ; } | |
1179 | ||
1180 | // returns NULL if this is the last handler of this class | |
1181 | wxHandlerInfo* GetNext() const { return m_next ; } | |
492f9a9e SC |
1182 | |
1183 | // return the class this property is declared in | |
1184 | const wxClassInfo* GetDeclaringClass() const { return m_itsClass ; } | |
1185 | ||
4393b50c | 1186 | private : |
517fb871 | 1187 | wxObjectEventFunction m_eventFunction ; |
ae820c69 | 1188 | wxString m_name; |
517fb871 VS |
1189 | const wxClassInfo* m_eventClassInfo ; |
1190 | wxHandlerInfo* m_next ; | |
492f9a9e | 1191 | wxClassInfo* m_itsClass ; |
a095505c SC |
1192 | }; |
1193 | ||
1194 | #define WX_HANDLER(name,eventClassType) \ | |
492f9a9e | 1195 | static wxHandlerInfo _handlerInfo##name( first , class_t::GetClassInfoStatic() , #name , (wxObjectEventFunction) (wxEventFunction) &name , CLASSINFO( eventClassType ) ) ; |
a095505c SC |
1196 | |
1197 | #define WX_BEGIN_HANDLERS_TABLE(theClass) \ | |
2d51f067 | 1198 | wxHandlerInfo *theClass::GetHandlersStatic() \ |
ae820c69 SC |
1199 | { \ |
1200 | typedef theClass class_t; \ | |
1201 | static wxHandlerInfo* first = NULL ; | |
a095505c SC |
1202 | |
1203 | #define WX_END_HANDLERS_TABLE() \ | |
ae820c69 | 1204 | return first ; } |
a095505c SC |
1205 | |
1206 | // ---------------------------------------------------------------------------- | |
1207 | // Constructor Bridges | |
1208 | // | |
1209 | // allow to set up constructors with params during runtime | |
1210 | // ---------------------------------------------------------------------------- | |
1211 | ||
1212 | class WXDLLIMPEXP_BASE wxConstructorBridge | |
1213 | { | |
1214 | public : | |
583150e3 | 1215 | virtual void Create(wxObject * &o, wxxVariant *args) = 0; |
a095505c SC |
1216 | }; |
1217 | ||
583150e3 SC |
1218 | // a direct constructor bridge calls the operator new for this class and |
1219 | // passes all params to the constructor. needed for classes that cannot be | |
1220 | // instantiated using alloc-create semantics | |
1221 | class WXDLLIMPEXP_BASE wxDirectConstructorBrigde : public wxConstructorBridge | |
1222 | { | |
1223 | public : | |
1224 | virtual void Create(wxObject * &o, wxxVariant *args) = 0; | |
1225 | } ; | |
1226 | ||
a095505c SC |
1227 | // Creator Bridges for all Numbers of Params |
1228 | ||
1229 | // no params | |
1230 | ||
1231 | template<typename Class> | |
1232 | struct wxConstructorBridge_0 : public wxConstructorBridge | |
1233 | { | |
583150e3 | 1234 | void Create(wxObject * &o, wxxVariant *) |
a095505c SC |
1235 | { |
1236 | Class *obj = dynamic_cast<Class*>(o); | |
1237 | obj->Create(); | |
1238 | } | |
1239 | }; | |
1240 | ||
1241 | struct wxConstructorBridge_Dummy : public wxConstructorBridge | |
1242 | { | |
583150e3 | 1243 | void Create(wxObject *&, wxxVariant *) |
a095505c SC |
1244 | { |
1245 | } | |
1246 | } ; | |
1247 | ||
1248 | #define WX_CONSTRUCTOR_0(klass) \ | |
517fb871 VS |
1249 | wxConstructorBridge_0<klass> constructor##klass ; \ |
1250 | wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \ | |
1251 | const wxChar *klass::sm_constructorProperties##klass[] = { NULL } ; \ | |
1252 | const int klass::sm_constructorPropertiesCount##klass = 0 ; | |
a095505c SC |
1253 | |
1254 | #define WX_CONSTRUCTOR_DUMMY(klass) \ | |
517fb871 VS |
1255 | wxConstructorBridge_Dummy constructor##klass ; \ |
1256 | wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \ | |
1257 | const wxChar *klass::sm_constructorProperties##klass[] = { NULL } ; \ | |
1258 | const int klass::sm_constructorPropertiesCount##klass = 0 ; | |
a095505c SC |
1259 | |
1260 | // 1 param | |
1261 | ||
1262 | template<typename Class, typename T0> | |
1263 | struct wxConstructorBridge_1 : public wxConstructorBridge | |
1264 | { | |
583150e3 | 1265 | void Create(wxObject * &o, wxxVariant *args) |
a095505c SC |
1266 | { |
1267 | Class *obj = dynamic_cast<Class*>(o); | |
1268 | obj->Create( | |
2abce515 | 1269 | args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0) |
ae820c69 | 1270 | ); |
a095505c SC |
1271 | } |
1272 | }; | |
1273 | ||
1274 | #define WX_CONSTRUCTOR_1(klass,t0,v0) \ | |
517fb871 VS |
1275 | wxConstructorBridge_1<klass,t0> constructor##klass ; \ |
1276 | wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \ | |
583150e3 | 1277 | const wxChar *klass::sm_constructorProperties##klass[] = { wxT(#v0) } ; \ |
517fb871 | 1278 | const int klass::sm_constructorPropertiesCount##klass = 1 ; |
a095505c SC |
1279 | |
1280 | // 2 params | |
1281 | ||
1282 | template<typename Class, | |
ae820c69 | 1283 | typename T0, typename T1> |
a095505c SC |
1284 | struct wxConstructorBridge_2 : public wxConstructorBridge |
1285 | { | |
583150e3 | 1286 | void Create(wxObject * &o, wxxVariant *args) |
a095505c SC |
1287 | { |
1288 | Class *obj = dynamic_cast<Class*>(o); | |
1289 | obj->Create( | |
2abce515 SC |
1290 | args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0) , |
1291 | args[1].WX_TEMPLATED_MEMBER_CALL(Get , T1) | |
ae820c69 | 1292 | ); |
a095505c SC |
1293 | } |
1294 | }; | |
1295 | ||
1296 | #define WX_CONSTRUCTOR_2(klass,t0,v0,t1,v1) \ | |
517fb871 VS |
1297 | wxConstructorBridge_2<klass,t0,t1> constructor##klass ; \ |
1298 | wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \ | |
583150e3 SC |
1299 | const wxChar *klass::sm_constructorProperties##klass[] = { wxT(#v0) , wxT(#v1) } ; \ |
1300 | const int klass::sm_constructorPropertiesCount##klass = 2; | |
1301 | ||
1302 | // direct constructor version | |
1303 | ||
1304 | template<typename Class, | |
1305 | typename T0, typename T1> | |
1306 | struct wxDirectConstructorBridge_2 : public wxDirectConstructorBrigde | |
1307 | { | |
1308 | void Create(wxObject * &o, wxxVariant *args) | |
1309 | { | |
1310 | o = new Class( | |
1311 | args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0) , | |
1312 | args[1].WX_TEMPLATED_MEMBER_CALL(Get , T1) | |
1313 | ); | |
1314 | } | |
1315 | }; | |
1316 | ||
1317 | #define WX_DIRECT_CONSTRUCTOR_2(klass,t0,v0,t1,v1) \ | |
1318 | wxDirectConstructorBridge_2<klass,t0,t1> constructor##klass ; \ | |
1319 | wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \ | |
1320 | const wxChar *klass::sm_constructorProperties##klass[] = { wxT(#v0) , wxT(#v1) } ; \ | |
517fb871 | 1321 | const int klass::sm_constructorPropertiesCount##klass = 2; |
a095505c | 1322 | |
583150e3 | 1323 | |
a095505c SC |
1324 | // 3 params |
1325 | ||
1326 | template<typename Class, | |
ae820c69 | 1327 | typename T0, typename T1, typename T2> |
a095505c SC |
1328 | struct wxConstructorBridge_3 : public wxConstructorBridge |
1329 | { | |
583150e3 | 1330 | void Create(wxObject * &o, wxxVariant *args) |
a095505c SC |
1331 | { |
1332 | Class *obj = dynamic_cast<Class*>(o); | |
1333 | obj->Create( | |
2abce515 SC |
1334 | args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0) , |
1335 | args[1].WX_TEMPLATED_MEMBER_CALL(Get , T1) , | |
1336 | args[2].WX_TEMPLATED_MEMBER_CALL(Get , T2) | |
ae820c69 | 1337 | ); |
a095505c SC |
1338 | } |
1339 | }; | |
1340 | ||
1341 | #define WX_CONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \ | |
517fb871 VS |
1342 | wxConstructorBridge_3<klass,t0,t1,t2> constructor##klass ; \ |
1343 | wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \ | |
583150e3 | 1344 | const wxChar *klass::sm_constructorProperties##klass[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) } ; \ |
517fb871 | 1345 | const int klass::sm_constructorPropertiesCount##klass = 3 ; |
a095505c SC |
1346 | |
1347 | // 4 params | |
1348 | ||
1349 | template<typename Class, | |
ae820c69 | 1350 | typename T0, typename T1, typename T2, typename T3> |
a095505c SC |
1351 | struct wxConstructorBridge_4 : public wxConstructorBridge |
1352 | { | |
583150e3 | 1353 | void Create(wxObject * &o, wxxVariant *args) |
a095505c SC |
1354 | { |
1355 | Class *obj = dynamic_cast<Class*>(o); | |
1356 | obj->Create( | |
2abce515 SC |
1357 | args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0) , |
1358 | args[1].WX_TEMPLATED_MEMBER_CALL(Get , T1) , | |
1359 | args[2].WX_TEMPLATED_MEMBER_CALL(Get , T2) , | |
1360 | args[3].WX_TEMPLATED_MEMBER_CALL(Get , T3) | |
ae820c69 | 1361 | ); |
a095505c SC |
1362 | } |
1363 | }; | |
1364 | ||
1365 | #define WX_CONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \ | |
517fb871 VS |
1366 | wxConstructorBridge_4<klass,t0,t1,t2,t3> constructor##klass ; \ |
1367 | wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \ | |
583150e3 | 1368 | const wxChar *klass::sm_constructorProperties##klass[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) } ; \ |
517fb871 | 1369 | const int klass::sm_constructorPropertiesCount##klass = 4 ; |
fbbdc52c SC |
1370 | |
1371 | // 5 params | |
1372 | ||
1373 | template<typename Class, | |
ae820c69 | 1374 | typename T0, typename T1, typename T2, typename T3, typename T4> |
fbbdc52c SC |
1375 | struct wxConstructorBridge_5 : public wxConstructorBridge |
1376 | { | |
583150e3 | 1377 | void Create(wxObject * &o, wxxVariant *args) |
fbbdc52c SC |
1378 | { |
1379 | Class *obj = dynamic_cast<Class*>(o); | |
1380 | obj->Create( | |
2abce515 SC |
1381 | args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0) , |
1382 | args[1].WX_TEMPLATED_MEMBER_CALL(Get , T1) , | |
1383 | args[2].WX_TEMPLATED_MEMBER_CALL(Get , T2) , | |
1384 | args[3].WX_TEMPLATED_MEMBER_CALL(Get , T3) , | |
1385 | args[4].WX_TEMPLATED_MEMBER_CALL(Get , T4) | |
ae820c69 | 1386 | ); |
fbbdc52c SC |
1387 | } |
1388 | }; | |
1389 | ||
1390 | #define WX_CONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \ | |
ae820c69 SC |
1391 | wxConstructorBridge_5<klass,t0,t1,t2,t3,t4> constructor##klass ; \ |
1392 | wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \ | |
583150e3 | 1393 | const wxChar *klass::sm_constructorProperties##klass[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) } ; \ |
ae820c69 | 1394 | const int klass::sm_constructorPropertiesCount##klass = 5; |
fa08490f SC |
1395 | |
1396 | // 6 params | |
1397 | ||
1398 | template<typename Class, | |
ae820c69 | 1399 | typename T0, typename T1, typename T2, typename T3, typename T4, typename T5> |
fa08490f SC |
1400 | struct wxConstructorBridge_6 : public wxConstructorBridge |
1401 | { | |
583150e3 | 1402 | void Create(wxObject * &o, wxxVariant *args) |
fa08490f SC |
1403 | { |
1404 | Class *obj = dynamic_cast<Class*>(o); | |
1405 | obj->Create( | |
2abce515 SC |
1406 | args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0) , |
1407 | args[1].WX_TEMPLATED_MEMBER_CALL(Get , T1) , | |
1408 | args[2].WX_TEMPLATED_MEMBER_CALL(Get , T2) , | |
1409 | args[3].WX_TEMPLATED_MEMBER_CALL(Get , T3) , | |
1410 | args[4].WX_TEMPLATED_MEMBER_CALL(Get , T4) , | |
1411 | args[5].WX_TEMPLATED_MEMBER_CALL(Get , T5) | |
ae820c69 | 1412 | ); |
fa08490f SC |
1413 | } |
1414 | }; | |
1415 | ||
583150e3 SC |
1416 | #define WX_CONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ |
1417 | wxConstructorBridge_6<klass,t0,t1,t2,t3,t4,t5> constructor##klass ; \ | |
1418 | wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \ | |
1419 | const wxChar *klass::sm_constructorProperties##klass[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) } ; \ | |
1420 | const int klass::sm_constructorPropertiesCount##klass = 6; | |
1421 | ||
1422 | // direct constructor version | |
1423 | ||
2abce515 SC |
1424 | template<typename Class, |
1425 | typename T0, typename T1, typename T2, typename T3, typename T4, typename T5> | |
583150e3 | 1426 | struct wxDirectConstructorBridge_6 : public wxDirectConstructorBrigde |
2abce515 | 1427 | { |
583150e3 | 1428 | void Create(wxObject * &o, wxxVariant *args) |
2abce515 | 1429 | { |
583150e3 | 1430 | o = new Class( |
2abce515 SC |
1431 | args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0) , |
1432 | args[1].WX_TEMPLATED_MEMBER_CALL(Get , T1) , | |
1433 | args[2].WX_TEMPLATED_MEMBER_CALL(Get , T2) , | |
1434 | args[3].WX_TEMPLATED_MEMBER_CALL(Get , T3) , | |
1435 | args[4].WX_TEMPLATED_MEMBER_CALL(Get , T4) , | |
1436 | args[5].WX_TEMPLATED_MEMBER_CALL(Get , T5) | |
1437 | ); | |
1438 | } | |
1439 | }; | |
1440 | ||
1441 | #define WX_DIRECT_CONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \ | |
1442 | wxDirectConstructorBridge_6<klass,t0,t1,t2,t3,t4,t5> constructor##klass ; \ | |
1443 | wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \ | |
583150e3 | 1444 | const wxChar *klass::sm_constructorProperties##klass[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) } ; \ |
ae820c69 | 1445 | const int klass::sm_constructorPropertiesCount##klass = 6; |
fa08490f | 1446 | |
a06bb527 SC |
1447 | // 7 params |
1448 | ||
1449 | template<typename Class, | |
ae820c69 | 1450 | typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> |
a06bb527 SC |
1451 | struct wxConstructorBridge_7 : public wxConstructorBridge |
1452 | { | |
583150e3 | 1453 | void Create(wxObject * &o, wxxVariant *args) |
a06bb527 SC |
1454 | { |
1455 | Class *obj = dynamic_cast<Class*>(o); | |
1456 | obj->Create( | |
2abce515 SC |
1457 | args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0) , |
1458 | args[1].WX_TEMPLATED_MEMBER_CALL(Get , T1) , | |
1459 | args[2].WX_TEMPLATED_MEMBER_CALL(Get , T2) , | |
1460 | args[3].WX_TEMPLATED_MEMBER_CALL(Get , T3) , | |
1461 | args[4].WX_TEMPLATED_MEMBER_CALL(Get , T4) , | |
1462 | args[5].WX_TEMPLATED_MEMBER_CALL(Get , T5) , | |
1463 | args[6].WX_TEMPLATED_MEMBER_CALL(Get , T6) | |
ae820c69 | 1464 | ); |
a06bb527 SC |
1465 | } |
1466 | }; | |
1467 | ||
1468 | #define WX_CONSTRUCTOR_7(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6) \ | |
ae820c69 SC |
1469 | wxConstructorBridge_7<klass,t0,t1,t2,t3,t4,t5,t6> constructor##klass ; \ |
1470 | wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \ | |
583150e3 | 1471 | const wxChar *klass::sm_constructorProperties##klass[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) , wxT(#v6) } ; \ |
ae820c69 | 1472 | const int klass::sm_constructorPropertiesCount##klass = 7; |
a095505c | 1473 | |
a06bb527 SC |
1474 | // 8 params |
1475 | ||
1476 | template<typename Class, | |
ae820c69 | 1477 | typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> |
a06bb527 SC |
1478 | struct wxConstructorBridge_8 : public wxConstructorBridge |
1479 | { | |
583150e3 | 1480 | void Create(wxObject * &o, wxxVariant *args) |
a06bb527 SC |
1481 | { |
1482 | Class *obj = dynamic_cast<Class*>(o); | |
1483 | obj->Create( | |
2abce515 SC |
1484 | args[0].WX_TEMPLATED_MEMBER_CALL(Get , T0) , |
1485 | args[1].WX_TEMPLATED_MEMBER_CALL(Get , T1) , | |
1486 | args[2].WX_TEMPLATED_MEMBER_CALL(Get , T2) , | |
1487 | args[3].WX_TEMPLATED_MEMBER_CALL(Get , T3) , | |
1488 | args[4].WX_TEMPLATED_MEMBER_CALL(Get , T4) , | |
1489 | args[5].WX_TEMPLATED_MEMBER_CALL(Get , T5) , | |
1490 | args[6].WX_TEMPLATED_MEMBER_CALL(Get , T6) , | |
1491 | args[7].WX_TEMPLATED_MEMBER_CALL(Get , T7) | |
ae820c69 | 1492 | ); |
a06bb527 SC |
1493 | } |
1494 | }; | |
1495 | ||
1496 | #define WX_CONSTRUCTOR_8(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5,t6,v6,t7,v7) \ | |
ae820c69 SC |
1497 | wxConstructorBridge_8<klass,t0,t1,t2,t3,t4,t5,t6,t7> constructor##klass ; \ |
1498 | wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \ | |
583150e3 | 1499 | const wxChar *klass::sm_constructorProperties##klass[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) , wxT(#v3) , wxT(#v4) , wxT(#v5) , wxT(#v6) , wxT(#v7) } ; \ |
ae820c69 | 1500 | const int klass::sm_constructorPropertiesCount##klass = 8; |
a095505c SC |
1501 | // ---------------------------------------------------------------------------- |
1502 | // wxClassInfo | |
1503 | // ---------------------------------------------------------------------------- | |
1504 | ||
1505 | typedef wxObject *(*wxObjectConstructorFn)(void); | |
fa08490f | 1506 | typedef wxObject* (*wxVariantToObjectConverter)( wxxVariant &data ) ; |
a095505c | 1507 | typedef wxxVariant (*wxObjectToVariantConverter)( wxObject* ) ; |
492f9a9e | 1508 | |
79902653 VS |
1509 | class WXDLLIMPEXP_BASE wxWriter; |
1510 | class WXDLLIMPEXP_BASE wxPersister; | |
492f9a9e | 1511 | |
9c8046dd | 1512 | typedef bool (*wxObjectStreamingCallback) ( const wxObject *, wxWriter * , wxPersister * , wxxVariantArray & ) ; |
a095505c SC |
1513 | |
1514 | class WXDLLIMPEXP_BASE wxClassInfo | |
1515 | { | |
79902653 VS |
1516 | friend class WXDLLIMPEXP_BASE wxPropertyInfo ; |
1517 | friend class WXDLLIMPEXP_BASE wxHandlerInfo ; | |
a095505c SC |
1518 | public: |
1519 | wxClassInfo(const wxClassInfo **_Parents, | |
ae820c69 SC |
1520 | const wxChar *_UnitName, |
1521 | const wxChar *_ClassName, | |
1522 | int size, | |
1523 | wxObjectConstructorFn ctor , | |
1524 | wxPropertyInfo *_Props , | |
1525 | wxHandlerInfo *_Handlers , | |
1526 | wxConstructorBridge* _Constructor , | |
1527 | const wxChar ** _ConstructorProperties , | |
1528 | const int _ConstructorPropertiesCount , | |
1529 | wxVariantToObjectConverter _PtrConverter1 , | |
1530 | wxVariantToObjectConverter _Converter2 , | |
9c8046dd SC |
1531 | wxObjectToVariantConverter _Converter3 , |
1532 | wxObjectStreamingCallback _streamingCallback = NULL | |
583150e3 SC |
1533 | ) : |
1534 | ||
ab0881c7 VS |
1535 | m_className(_ClassName), |
1536 | m_objectSize(size), | |
1537 | m_objectConstructor(ctor), | |
1538 | m_next(sm_first), | |
1539 | m_firstProperty(_Props), | |
1540 | m_firstHandler(_Handlers), | |
1541 | m_parents(_Parents), | |
583150e3 | 1542 | m_unitName(_UnitName), |
ab0881c7 VS |
1543 | m_constructor(_Constructor), |
1544 | m_constructorProperties(_ConstructorProperties), | |
1545 | m_constructorPropertiesCount(_ConstructorPropertiesCount), | |
1546 | m_variantOfPtrToObjectConverter(_PtrConverter1), | |
1547 | m_variantToObjectConverter(_Converter2), | |
1548 | m_objectToVariantConverter(_Converter3), | |
1549 | m_streamingCallback(_streamingCallback) | |
ae820c69 SC |
1550 | { |
1551 | sm_first = this; | |
1552 | Register() ; | |
1553 | } | |
1554 | ||
ab0881c7 | 1555 | wxClassInfo(const wxChar *_UnitName, const wxChar *_ClassName, |
583150e3 | 1556 | const wxClassInfo **_Parents) : |
ab0881c7 VS |
1557 | m_className(_ClassName), |
1558 | m_objectSize(0), | |
1559 | m_objectConstructor(NULL), | |
1560 | m_next(sm_first), | |
1561 | m_firstProperty(NULL), | |
1562 | m_firstHandler(NULL), | |
1563 | m_parents(_Parents), | |
1564 | m_unitName(_UnitName), | |
1565 | m_constructor(NULL), | |
1566 | m_constructorProperties(NULL), | |
1567 | m_constructorPropertiesCount(0), | |
1568 | m_variantOfPtrToObjectConverter(NULL), | |
1569 | m_variantToObjectConverter(NULL), | |
1570 | m_objectToVariantConverter(NULL), | |
1571 | m_streamingCallback(NULL) | |
ae820c69 SC |
1572 | { |
1573 | sm_first = this; | |
1574 | Register() ; | |
1575 | } | |
2d51f067 | 1576 | |
aeec2045 | 1577 | virtual ~wxClassInfo() ; |
a095505c | 1578 | |
ab6e4913 SC |
1579 | // allocates an instance of this class, this object does not have to be initialized or fully constructed |
1580 | // as this call will be followed by a call to Create | |
1581 | virtual wxObject *AllocateObject() const { return m_objectConstructor ? (*m_objectConstructor)() : 0; } | |
1582 | ||
1583 | // 'old naming' for AllocateObject staying here for backward compatibility | |
1584 | wxObject *CreateObject() const { return AllocateObject() ; } | |
a095505c | 1585 | |
583150e3 SC |
1586 | // direct construction call for classes that cannot construct instances via alloc/create |
1587 | wxObject *ConstructObject(int ParamCount, wxxVariant *Params) const | |
1588 | { | |
1589 | wxASSERT_MSG( ParamCount == m_constructorPropertiesCount , wxT("Illegal Parameter Count for ConstructObject Method")) ; | |
1590 | wxObject *object = NULL ; | |
1591 | m_constructor->Create( object , Params ) ; | |
1592 | return object ; | |
1593 | } | |
1594 | ||
1595 | bool NeedsDirectConstruction() const { return dynamic_cast<wxDirectConstructorBrigde*>( m_constructor) != NULL ; } | |
1596 | ||
a095505c | 1597 | const wxChar *GetClassName() const { return m_className; } |
9c8046dd | 1598 | const wxChar *GetIncludeName() const { return m_unitName ; } |
a095505c SC |
1599 | const wxClassInfo **GetParents() const { return m_parents; } |
1600 | int GetSize() const { return m_objectSize; } | |
1601 | ||
1602 | wxObjectConstructorFn GetConstructor() const { return m_objectConstructor; } | |
1603 | static const wxClassInfo *GetFirst() { return sm_first; } | |
1604 | const wxClassInfo *GetNext() const { return m_next; } | |
1605 | static wxClassInfo *FindClass(const wxChar *className); | |
1606 | ||
ae820c69 SC |
1607 | // Climb upwards through inheritance hierarchy. |
1608 | // Dual inheritance is catered for. | |
a095505c SC |
1609 | |
1610 | bool IsKindOf(const wxClassInfo *info) const | |
1611 | { | |
517fb871 VS |
1612 | if ( info != 0 ) |
1613 | { | |
1614 | if ( info == this ) | |
1615 | return true ; | |
1616 | ||
1617 | for ( int i = 0 ; m_parents[i] ; ++ i ) | |
1618 | { | |
1619 | if ( m_parents[i]->IsKindOf( info ) ) | |
1620 | return true ; | |
1621 | } | |
1622 | } | |
1623 | return false ; | |
a095505c SC |
1624 | } |
1625 | ||
ab0881c7 VS |
1626 | // if there is a callback registered with that class it will be called |
1627 | // before this object will be written to disk, it can veto streaming out | |
1628 | // this object by returning false, if this class has not registered a | |
1629 | // callback, the search will go up the inheritance tree if no callback has | |
1630 | // been registered true will be returned by default | |
9c8046dd SC |
1631 | bool BeforeWriteObject( const wxObject *obj, wxWriter *streamer , wxPersister *persister , wxxVariantArray &metadata) const ; |
1632 | ||
1633 | // gets the streaming callback from this class or any superclass | |
1634 | wxObjectStreamingCallback GetStreamingCallback() const ; | |
1635 | ||
aa8d7c2f | 1636 | #ifdef WXWIN_COMPATIBILITY_2_4 |
a095505c | 1637 | // Initializes parent pointers and hash table for fast searching. |
aa8d7c2f | 1638 | wxDEPRECATED( static void InitializeClasses() ); |
a095505c | 1639 | // Cleans up hash table used for fast searching. |
aa8d7c2f SC |
1640 | wxDEPRECATED( static void CleanUpClasses() ); |
1641 | #endif | |
1642 | static void CleanUp(); | |
75890a3f | 1643 | |
517fb871 VS |
1644 | // returns the first property |
1645 | const wxPropertyInfo* GetFirstProperty() const { return m_firstProperty ; } | |
a095505c | 1646 | |
517fb871 VS |
1647 | // returns the first handler |
1648 | const wxHandlerInfo* GetFirstHandler() const { return m_firstHandler ; } | |
a095505c | 1649 | |
ab6e4913 SC |
1650 | // Call the Create upon an instance of the class, in the end the object is fully |
1651 | // initialized | |
fa08490f | 1652 | virtual void Create (wxObject *object, int ParamCount, wxxVariant *Params) const |
ae820c69 SC |
1653 | { |
1654 | wxASSERT_MSG( ParamCount == m_constructorPropertiesCount , wxT("Illegal Parameter Count for Create Method")) ; | |
1655 | m_constructor->Create( object , Params ) ; | |
1656 | } | |
a095505c | 1657 | |
517fb871 VS |
1658 | // get number of parameters for constructor |
1659 | virtual int GetCreateParamCount() const { return m_constructorPropertiesCount; } | |
a095505c | 1660 | |
ab6e4913 SC |
1661 | // get n-th constructor parameter |
1662 | virtual const wxChar* GetCreateParamName(int n) const { return m_constructorProperties[n] ; } | |
a095505c | 1663 | |
ab6e4913 SC |
1664 | // Runtime access to objects for simple properties (get/set) by property name, and variant data |
1665 | virtual void SetProperty (wxObject *object, const wxChar *propertyName, const wxxVariant &value) const ; | |
1666 | virtual wxxVariant GetProperty (wxObject *object, const wxChar *propertyName) const; | |
1667 | ||
1668 | // Runtime access to objects for collection properties by property name | |
1669 | virtual wxxVariantArray GetPropertyCollection(wxObject *object, const wxChar *propertyName) const ; | |
16a45a23 | 1670 | virtual void AddToPropertyCollection(wxObject *object, const wxChar *propertyName , const wxxVariant& value) const ; |
a095505c | 1671 | |
ae820c69 SC |
1672 | // we must be able to cast variants to wxObject pointers, templates seem not to be suitable |
1673 | wxObject* VariantToInstance( wxxVariant &data ) const | |
1674 | { if ( data.GetTypeInfo()->GetKind() == wxT_OBJECT ) | |
1675 | return m_variantToObjectConverter( data ) ; | |
1676 | else | |
1677 | return m_variantOfPtrToObjectConverter( data ) ; | |
1678 | } | |
fa08490f | 1679 | |
ae820c69 | 1680 | wxxVariant InstanceToVariant( wxObject *object ) const { return m_objectToVariantConverter( object ) ; } |
4393b50c | 1681 | |
517fb871 | 1682 | // find property by name |
fbbdc52c SC |
1683 | virtual const wxPropertyInfo *FindPropertyInfo (const wxChar *PropertyName) const ; |
1684 | ||
517fb871 | 1685 | // find handler by name |
fbbdc52c | 1686 | virtual const wxHandlerInfo *FindHandlerInfo (const wxChar *PropertyName) const ; |
a095505c | 1687 | |
2d51f067 | 1688 | // find property by name |
492f9a9e | 1689 | virtual wxPropertyInfo *FindPropertyInfoInThisClass (const wxChar *PropertyName) const ; |
2d51f067 SC |
1690 | |
1691 | // find handler by name | |
492f9a9e | 1692 | virtual wxHandlerInfo *FindHandlerInfoInThisClass (const wxChar *PropertyName) const ; |
ae820c69 SC |
1693 | |
1694 | // puts all the properties of this class and its superclasses in the map, as long as there is not yet | |
1695 | // an entry with the same name (overriding mechanism) | |
1696 | void GetProperties( wxPropertyInfoMap &map ) const ; | |
a095505c SC |
1697 | public: |
1698 | const wxChar *m_className; | |
1699 | int m_objectSize; | |
1700 | wxObjectConstructorFn m_objectConstructor; | |
1701 | ||
1702 | // class info object live in a linked list: | |
1703 | // pointers to its head and the next element in it | |
1704 | ||
1705 | static wxClassInfo *sm_first; | |
1706 | wxClassInfo *m_next; | |
1707 | ||
517fb871 | 1708 | // FIXME: this should be private (currently used directly by way too |
a095505c SC |
1709 | // many clients) |
1710 | static wxHashTable *sm_classTable; | |
1711 | ||
2d51f067 | 1712 | protected : |
ae820c69 SC |
1713 | wxPropertyInfo * m_firstProperty ; |
1714 | wxHandlerInfo * m_firstHandler ; | |
a095505c | 1715 | private: |
ae820c69 | 1716 | const wxClassInfo** m_parents ; |
fa08490f SC |
1717 | const wxChar* m_unitName; |
1718 | ||
ae820c69 SC |
1719 | wxConstructorBridge* m_constructor ; |
1720 | const wxChar ** m_constructorProperties ; | |
1721 | const int m_constructorPropertiesCount ; | |
1722 | wxVariantToObjectConverter m_variantOfPtrToObjectConverter ; | |
1723 | wxVariantToObjectConverter m_variantToObjectConverter ; | |
1724 | wxObjectToVariantConverter m_objectToVariantConverter ; | |
9c8046dd | 1725 | wxObjectStreamingCallback m_streamingCallback ; |
2d51f067 | 1726 | const wxPropertyAccessor *FindAccessor (const wxChar *propertyName) const ; |
a095505c | 1727 | |
a095505c | 1728 | |
517fb871 | 1729 | // InitializeClasses() helper |
2d51f067 | 1730 | static wxClassInfo *GetBaseByName(const wxChar *name) ; |
75890a3f | 1731 | |
d1d738f1 VS |
1732 | protected: |
1733 | // registers the class | |
1734 | void Register(); | |
1735 | void Unregister(); | |
a095505c SC |
1736 | |
1737 | DECLARE_NO_COPY_CLASS(wxClassInfo) | |
1738 | }; | |
1739 | ||
2d51f067 | 1740 | |
a095505c SC |
1741 | WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxChar *name); |
1742 | ||
2d51f067 SC |
1743 | // ---------------------------------------------------------------------------- |
1744 | // wxDynamicObject | |
1745 | // ---------------------------------------------------------------------------- | |
1746 | // | |
1747 | // this object leads to having a pure runtime-instantiation | |
1748 | ||
492f9a9e | 1749 | class WXDLLIMPEXP_BASE wxDynamicClassInfo : public wxClassInfo |
2d51f067 SC |
1750 | { |
1751 | public : | |
1752 | wxDynamicClassInfo( const wxChar *_UnitName, const wxChar *_ClassName , const wxClassInfo* superClass ) ; | |
1753 | virtual ~wxDynamicClassInfo() ; | |
1754 | ||
1755 | // constructs a wxDynamicObject with an instance | |
ab6e4913 | 1756 | virtual wxObject *AllocateObject() const ; |
2d51f067 SC |
1757 | |
1758 | // Call the Create method for a class | |
1759 | virtual void Create (wxObject *object, int ParamCount, wxxVariant *Params) const ; | |
1760 | ||
1761 | // get number of parameters for constructor | |
1762 | virtual int GetCreateParamCount() const ; | |
1763 | ||
1764 | // get i-th constructor parameter | |
1765 | virtual const wxChar* GetCreateParamName(int i) const ; | |
1766 | ||
1767 | // Runtime access to objects by property name, and variant data | |
1768 | virtual void SetProperty (wxObject *object, const wxChar *PropertyName, const wxxVariant &Value) const ; | |
1769 | virtual wxxVariant GetProperty (wxObject *object, const wxChar *PropertyName) const ; | |
1770 | ||
2abce515 | 1771 | // adds a property to this class at runtime |
2d51f067 | 1772 | void AddProperty( const wxChar *propertyName , const wxTypeInfo* typeInfo ) ; |
2abce515 SC |
1773 | |
1774 | // removes an existing runtime-property | |
1775 | void RemoveProperty( const wxChar *propertyName ) ; | |
1776 | ||
492f9a9e SC |
1777 | // renames an existing runtime-property |
1778 | void RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) ; | |
1779 | ||
2abce515 | 1780 | // as a handler to this class at runtime |
2d51f067 | 1781 | void AddHandler( const wxChar *handlerName , wxObjectEventFunction address , const wxClassInfo* eventClassInfo ) ; |
2abce515 SC |
1782 | |
1783 | // removes an existing runtime-handler | |
1784 | void RemoveHandler( const wxChar *handlerName ) ; | |
492f9a9e SC |
1785 | |
1786 | // renames an existing runtime-handler | |
1787 | void RenameHandler( const wxChar *oldHandlerName , const wxChar *newHandlerName ) ; | |
2d51f067 SC |
1788 | } ; |
1789 | ||
a095505c SC |
1790 | // ---------------------------------------------------------------------------- |
1791 | // Dynamic class macros | |
1792 | // ---------------------------------------------------------------------------- | |
1793 | ||
1794 | #define _DECLARE_DYNAMIC_CLASS(name) \ | |
1795 | public: \ | |
ae820c69 SC |
1796 | static wxClassInfo sm_class##name; \ |
1797 | static const wxClassInfo* sm_classParents##name[] ; \ | |
1798 | static wxPropertyInfo* GetPropertiesStatic() ; \ | |
1799 | static wxHandlerInfo* GetHandlersStatic() ; \ | |
1800 | static wxClassInfo *GetClassInfoStatic() \ | |
1801 | { return &name::sm_class##name; } \ | |
2abce515 | 1802 | virtual wxClassInfo *GetClassInfo() const \ |
ae820c69 | 1803 | { return &name::sm_class##name; } |
a095505c SC |
1804 | |
1805 | #define DECLARE_DYNAMIC_CLASS(name) \ | |
ae820c69 SC |
1806 | static wxConstructorBridge* sm_constructor##name ; \ |
1807 | static const wxChar * sm_constructorProperties##name[] ; \ | |
1808 | static const int sm_constructorPropertiesCount##name ; \ | |
f0b7eadf | 1809 | _DECLARE_DYNAMIC_CLASS(name) |
a095505c SC |
1810 | |
1811 | #define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ | |
1812 | DECLARE_NO_ASSIGN_CLASS(name) \ | |
1813 | DECLARE_DYNAMIC_CLASS(name) | |
1814 | ||
1815 | #define DECLARE_DYNAMIC_CLASS_NO_COPY(name) \ | |
1816 | DECLARE_NO_COPY_CLASS(name) \ | |
1817 | DECLARE_DYNAMIC_CLASS(name) | |
1818 | ||
1819 | #define DECLARE_ABSTRACT_CLASS(name) _DECLARE_DYNAMIC_CLASS(name) | |
1820 | #define DECLARE_CLASS(name) DECLARE_DYNAMIC_CLASS(name) | |
1821 | ||
1822 | // ----------------------------------- | |
1823 | // for concrete classes | |
1824 | // ----------------------------------- | |
1825 | ||
ae820c69 | 1826 | // Single inheritance with one base class |
a095505c | 1827 | |
583150e3 SC |
1828 | #define _TYPEINFO_CLASSES(n , toString , fromString ) \ |
1829 | wxClassTypeInfo s_typeInfo##n(wxT_OBJECT , &n::sm_class##n , toString , fromString , typeid(n).name()) ; \ | |
1830 | wxClassTypeInfo s_typeInfoPtr##n(wxT_OBJECT_PTR , &n::sm_class##n , toString , fromString , typeid(n*).name()) ; | |
492f9a9e | 1831 | |
9c8046dd | 1832 | #define _IMPLEMENT_DYNAMIC_CLASS(name, basename, unit , callback) \ |
ae820c69 SC |
1833 | wxObject* wxConstructorFor##name() \ |
1834 | { return new name; } \ | |
1835 | const wxClassInfo* name::sm_classParents##name[] = { &basename::sm_class##basename ,NULL } ; \ | |
1836 | wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.Get<name*>() ; } \ | |
1837 | wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast<name*> (data) ) ; } \ | |
1838 | wxClassInfo name::sm_class##name(sm_classParents##name , wxT(unit) , wxT(#name), \ | |
1839 | (int) sizeof(name), \ | |
1840 | (wxObjectConstructorFn) wxConstructorFor##name , \ | |
1841 | name::GetPropertiesStatic(),name::GetHandlersStatic(),name::sm_constructor##name , name::sm_constructorProperties##name , \ | |
583150e3 | 1842 | name::sm_constructorPropertiesCount##name , wxVariantOfPtrToObjectConverter##name , NULL , wxObjectToVariantConverter##name , callback); |
fa08490f | 1843 | |
9c8046dd | 1844 | #define _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY(name, basename, unit, callback ) \ |
ae820c69 SC |
1845 | wxObject* wxConstructorFor##name() \ |
1846 | { return new name; } \ | |
1847 | const wxClassInfo* name::sm_classParents##name[] = { &basename::sm_class##basename ,NULL } ; \ | |
1848 | wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return &data.Get<name>() ; } \ | |
1849 | wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.Get<name*>() ; } \ | |
1850 | wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast<name*> (data) ) ; } \ | |
1851 | wxClassInfo name::sm_class##name(sm_classParents##name , wxT(unit) , wxT(#name), \ | |
1852 | (int) sizeof(name), \ | |
1853 | (wxObjectConstructorFn) wxConstructorFor##name , \ | |
1854 | name::GetPropertiesStatic(),name::GetHandlersStatic(),name::sm_constructor##name , name::sm_constructorProperties##name , \ | |
583150e3 | 1855 | name::sm_constructorPropertiesCount##name , wxVariantOfPtrToObjectConverter##name , wxVariantToObjectConverter##name , wxObjectToVariantConverter##name, callback); |
fa08490f SC |
1856 | |
1857 | #define IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename ) \ | |
9c8046dd | 1858 | _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , "" , NULL ) \ |
583150e3 | 1859 | _TYPEINFO_CLASSES(name, NULL , NULL) \ |
ae820c69 SC |
1860 | const wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \ |
1861 | const wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ | |
1862 | WX_CONSTRUCTOR_DUMMY( name ) | |
a095505c SC |
1863 | |
1864 | #define IMPLEMENT_DYNAMIC_CLASS( name , basename ) \ | |
9c8046dd | 1865 | _IMPLEMENT_DYNAMIC_CLASS( name , basename , "" , NULL ) \ |
583150e3 SC |
1866 | _TYPEINFO_CLASSES(name, NULL , NULL) \ |
1867 | wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \ | |
ae820c69 SC |
1868 | wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ |
1869 | WX_CONSTRUCTOR_DUMMY( name ) | |
a095505c SC |
1870 | |
1871 | #define IMPLEMENT_DYNAMIC_CLASS_XTI( name , basename , unit ) \ | |
583150e3 SC |
1872 | _IMPLEMENT_DYNAMIC_CLASS( name , basename , unit , NULL ) \ |
1873 | _TYPEINFO_CLASSES(name, NULL , NULL) | |
9c8046dd SC |
1874 | |
1875 | #define IMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK( name , basename , unit , callback ) \ | |
583150e3 SC |
1876 | _IMPLEMENT_DYNAMIC_CLASS( name , basename , unit , &callback ) \ |
1877 | _TYPEINFO_CLASSES(name, NULL , NULL) | |
a095505c | 1878 | |
fa08490f | 1879 | #define IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI( name , basename , unit ) \ |
583150e3 SC |
1880 | _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , unit , NULL ) \ |
1881 | _TYPEINFO_CLASSES(name, NULL , NULL) | |
1882 | ||
1883 | #define IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( name , basename , unit , toString , fromString ) \ | |
1884 | _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , unit , NULL ) \ | |
1885 | _TYPEINFO_CLASSES(name, toString , fromString) | |
fa08490f | 1886 | |
4393b50c | 1887 | // this is for classes that do not derive from wxobject, there are no creators for these |
a095505c SC |
1888 | |
1889 | #define IMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_NO_BASE_XTI( name , unit ) \ | |
ae820c69 SC |
1890 | const wxClassInfo* name::sm_classParents##name[] = { NULL } ; \ |
1891 | wxClassInfo name::sm_class##name(sm_classParents##name , wxT("") , wxT(#name), \ | |
1892 | (int) sizeof(name), \ | |
1893 | (wxObjectConstructorFn) 0 , \ | |
1894 | name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \ | |
1895 | 0 , 0 , 0 ); \ | |
583150e3 | 1896 | _TYPEINFO_CLASSES(name, NULL , NULL) |
a095505c SC |
1897 | |
1898 | // this is for subclasses that still do not derive from wxobject | |
1899 | ||
1900 | #define IMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_XTI( name , basename, unit ) \ | |
ae820c69 SC |
1901 | const wxClassInfo* name::sm_classParents##name[] = { &basename::sm_class##basename ,NULL } ; \ |
1902 | wxClassInfo name::sm_class##name(sm_classParents##name , wxT("") , wxT(#name), \ | |
1903 | (int) sizeof(name), \ | |
1904 | (wxObjectConstructorFn) 0 , \ | |
1905 | name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \ | |
1906 | 0 , 0 , 0 ); \ | |
583150e3 | 1907 | _TYPEINFO_CLASSES(name, NULL , NULL) |
ae820c69 SC |
1908 | |
1909 | ||
1910 | // Multiple inheritance with two base classes | |
a095505c SC |
1911 | |
1912 | #define _IMPLEMENT_DYNAMIC_CLASS2(name, basename, basename2, unit) \ | |
ae820c69 SC |
1913 | wxObject* wxConstructorFor##name() \ |
1914 | { return new name; } \ | |
1915 | const wxClassInfo* name::sm_classParents##name[] = { &basename::sm_class##basename ,&basename2::sm_class##basename2 , NULL } ; \ | |
1916 | wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return data.Get<name*>() ; } \ | |
1917 | wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast<name*> (data) ) ; } \ | |
1918 | wxClassInfo name::sm_class##name(sm_classParents##name , wxT(unit) , wxT(#name), \ | |
1919 | (int) sizeof(name), \ | |
1920 | (wxObjectConstructorFn) wxConstructorFor##name , \ | |
1921 | name::GetPropertiesStatic(),name::GetHandlersStatic(),name::sm_constructor##name , name::sm_constructorProperties##name , \ | |
1922 | name::sm_constructorPropertiesCount##name , wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \ | |
a095505c SC |
1923 | |
1924 | #define IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2) \ | |
ae820c69 | 1925 | _IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2 , "") \ |
583150e3 | 1926 | _TYPEINFO_CLASSES(name, NULL , NULL) \ |
ae820c69 SC |
1927 | wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \ |
1928 | wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ | |
1929 | WX_CONSTRUCTOR_DUMMY( name ) | |
a095505c SC |
1930 | |
1931 | #define IMPLEMENT_DYNAMIC_CLASS2_XTI( name , basename , basename2, unit) \ | |
583150e3 SC |
1932 | _IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2 , unit) \ |
1933 | _TYPEINFO_CLASSES(name, NULL , NULL) | |
1934 | ||
a095505c SC |
1935 | |
1936 | // ----------------------------------- | |
1937 | // for abstract classes | |
1938 | // ----------------------------------- | |
1939 | ||
ae820c69 | 1940 | // Single inheritance with one base class |
a095505c SC |
1941 | |
1942 | #define _IMPLEMENT_ABSTRACT_CLASS(name, basename) \ | |
ae820c69 SC |
1943 | const wxClassInfo* name::sm_classParents##name[] = { &basename::sm_class##basename ,NULL } ; \ |
1944 | wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return data.Get<name*>() ; } \ | |
1945 | wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.Get<name*>() ; } \ | |
1946 | wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast<name*> (data) ) ; } \ | |
1947 | wxClassInfo name::sm_class##name(sm_classParents##name , wxT("") , wxT(#name), \ | |
1948 | (int) sizeof(name), \ | |
1949 | (wxObjectConstructorFn) 0 , \ | |
1950 | name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \ | |
1951 | 0 , wxVariantOfPtrToObjectConverter##name ,wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \ | |
583150e3 | 1952 | _TYPEINFO_CLASSES(name, NULL , NULL) |
a095505c SC |
1953 | |
1954 | #define IMPLEMENT_ABSTRACT_CLASS( name , basename ) \ | |
ae820c69 SC |
1955 | _IMPLEMENT_ABSTRACT_CLASS( name , basename ) \ |
1956 | wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \ | |
1957 | wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } | |
a095505c | 1958 | |
ae820c69 | 1959 | // Multiple inheritance with two base classes |
a095505c SC |
1960 | |
1961 | #define IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \ | |
ae820c69 SC |
1962 | wxClassInfo name::sm_class##name(wxT(#name), wxT(#basename1), \ |
1963 | wxT(#basename2), (int) sizeof(name), \ | |
1964 | (wxObjectConstructorFn) 0); | |
a095505c SC |
1965 | |
1966 | #define IMPLEMENT_CLASS IMPLEMENT_ABSTRACT_CLASS | |
1967 | #define IMPLEMENT_CLASS2 IMPLEMENT_ABSTRACT_CLASS2 | |
1968 | ||
208fd16c SC |
1969 | // -------------------------------------------------------------------------- |
1970 | // Collection Support | |
1971 | // -------------------------------------------------------------------------- | |
1972 | ||
2abce515 | 1973 | template<typename iter , typename collection_t > void wxListCollectionToVariantArray( const collection_t& coll , wxxVariantArray &value ) |
208fd16c | 1974 | { |
2abce515 | 1975 | iter current = coll.GetFirst() ; |
208fd16c SC |
1976 | while (current) |
1977 | { | |
1978 | value.Add( new wxxVariant(current->GetData()) ) ; | |
1979 | current = current->GetNext(); | |
1980 | } | |
1981 | } | |
1982 | ||
1983 | template<typename collection_t> void wxArrayCollectionToVariantArray( const collection_t& coll , wxxVariantArray &value ) | |
1984 | { | |
ae820c69 | 1985 | for( size_t i = 0 ; i < coll.GetCount() ; i++ ) |
208fd16c SC |
1986 | { |
1987 | value.Add( new wxxVariant(coll[i]) ) ; | |
1988 | } | |
1989 | } | |
1990 | ||
1991 | ||
aeec2045 | 1992 | #endif |