]>
Commit | Line | Data |
---|---|---|
a095505c | 1 | ///////////////////////////////////////////////////////////////////////////// |
bb7eff4c | 2 | // Name: wx/xti.h |
a095505c SC |
3 | // Purpose: runtime metadata information (extended class info) |
4 | // Author: Stefan Csomor | |
28953245 | 5 | // Modified by: Francesco Montorsi |
a095505c SC |
6 | // Created: 27/07/03 |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 1997 Julian Smart | |
9 | // (c) 2003 Stefan Csomor | |
65571936 | 10 | // Licence: wxWindows licence |
a095505c SC |
11 | ///////////////////////////////////////////////////////////////////////////// |
12 | ||
13 | #ifndef _WX_XTIH__ | |
14 | #define _WX_XTIH__ | |
15 | ||
a095505c SC |
16 | // We want to support properties, event sources and events sinks through |
17 | // explicit declarations, using templates and specialization to make the | |
4393b50c | 18 | // effort as painless as possible. |
a095505c SC |
19 | // |
20 | // This means we have the following domains : | |
21 | // | |
22 | // - Type Information for categorizing built in types as well as custom types | |
28953245 | 23 | // this includes information about enums, their values and names |
cbca59a8 | 24 | // - Type safe value storage : a kind of wxVariant, called right now wxAny |
28953245 | 25 | // which will be merged with wxVariant |
a095505c | 26 | // - Property Information and Property Accessors providing access to a class' |
28953245 | 27 | // values and exposed event delegates |
a095505c SC |
28 | // - Information about event handlers |
29 | // - extended Class Information for accessing all these | |
30 | ||
31 | // ---------------------------------------------------------------------------- | |
32 | // headers | |
33 | // ---------------------------------------------------------------------------- | |
34 | ||
35 | #include "wx/defs.h" | |
af498247 | 36 | |
28953245 | 37 | #if wxUSE_EXTENDED_RTTI |
ab6e4913 | 38 | |
cbca59a8 SC |
39 | class WXDLLIMPEXP_FWD_BASE wxAny; |
40 | class WXDLLIMPEXP_FWD_BASE wxAnyList; | |
41 | class WXDLLIMPEXP_FWD_BASE wxObject; | |
42 | class WXDLLIMPEXP_FWD_BASE wxString; | |
43 | class WXDLLIMPEXP_FWD_BASE wxClassInfo; | |
44 | class WXDLLIMPEXP_FWD_BASE wxHashTable; | |
45 | class WXDLLIMPEXP_FWD_BASE wxObject; | |
46 | class WXDLLIMPEXP_FWD_BASE wxPluginLibrary; | |
47 | class WXDLLIMPEXP_FWD_BASE wxHashTable; | |
48 | class WXDLLIMPEXP_FWD_BASE wxHashTable_Node; | |
49 | ||
50 | class WXDLLIMPEXP_FWD_BASE wxStringToAnyHashMap; | |
51 | class WXDLLIMPEXP_FWD_BASE wxPropertyInfoMap; | |
52 | class WXDLLIMPEXP_FWD_BASE wxPropertyAccessor; | |
53 | ||
54 | #define wx_dynamic_cast(t, x) dynamic_cast<t>(x) | |
55 | ||
28953245 SC |
56 | #include "wx/xtitypes.h" |
57 | #include "wx/xtictor.h" | |
28953245 | 58 | #include "wx/xtihandler.h" |
a095505c | 59 | |
a095505c SC |
60 | // ---------------------------------------------------------------------------- |
61 | // wxClassInfo | |
62 | // ---------------------------------------------------------------------------- | |
63 | ||
cbca59a8 SC |
64 | class WXDLLIMPEXP_BASE wxObjectFunctor |
65 | { | |
66 | public: | |
67 | virtual ~wxObjectFunctor(); | |
68 | ||
69 | // Invoke the actual event handler: | |
70 | virtual void operator()(const wxObject *) = 0; | |
71 | }; | |
72 | ||
73 | class WXDLLIMPEXP_FWD_BASE wxPropertyInfo; | |
74 | class WXDLLIMPEXP_FWD_BASE wxHandlerInfo; | |
28953245 | 75 | |
a095505c | 76 | typedef wxObject *(*wxObjectConstructorFn)(void); |
cbca59a8 SC |
77 | typedef wxPropertyInfo *(*wxPropertyInfoFn)(void); |
78 | typedef wxHandlerInfo *(*wxHandlerInfoFn)(void); | |
79 | typedef void (*wxVariantToObjectConverter)( const wxAny &data, wxObjectFunctor* fn ); | |
80 | typedef wxObject* (*wxVariantToObjectPtrConverter) ( const wxAny& data); | |
81 | typedef wxAny (*wxObjectToVariantConverter)( wxObject* ); | |
82 | ||
83 | WXDLLIMPEXP_BASE wxString wxAnyGetAsString( const wxAny& data); | |
84 | WXDLLIMPEXP_BASE const wxObject* wxAnyGetAsObjectPtr( const wxAny& data); | |
492f9a9e | 85 | |
28953245 | 86 | class WXDLLIMPEXP_BASE wxObjectWriter; |
cbca59a8 | 87 | class WXDLLIMPEXP_BASE wxObjectWriterCallback; |
492f9a9e | 88 | |
28953245 | 89 | typedef bool (*wxObjectStreamingCallback) ( const wxObject *, wxObjectWriter *, \ |
cbca59a8 SC |
90 | wxObjectWriterCallback *, const wxStringToAnyHashMap & ); |
91 | ||
92 | ||
a095505c SC |
93 | |
94 | class WXDLLIMPEXP_BASE wxClassInfo | |
95 | { | |
28953245 SC |
96 | friend class WXDLLIMPEXP_BASE wxPropertyInfo; |
97 | friend class WXDLLIMPEXP_BASE wxHandlerInfo; | |
cbca59a8 | 98 | friend wxObject *wxCreateDynamicObject(const wxString& name); |
28953245 | 99 | |
a095505c SC |
100 | public: |
101 | wxClassInfo(const wxClassInfo **_Parents, | |
28953245 SC |
102 | const wxChar *_UnitName, |
103 | const wxChar *_ClassName, | |
104 | int size, | |
105 | wxObjectConstructorFn ctor, | |
cbca59a8 SC |
106 | wxPropertyInfoFn _Props, |
107 | wxHandlerInfoFn _Handlers, | |
28953245 SC |
108 | wxObjectAllocatorAndCreator* _Constructor, |
109 | const wxChar ** _ConstructorProperties, | |
110 | const int _ConstructorPropertiesCount, | |
cbca59a8 | 111 | wxVariantToObjectPtrConverter _PtrConverter1, |
28953245 SC |
112 | wxVariantToObjectConverter _Converter2, |
113 | wxObjectToVariantConverter _Converter3, | |
114 | wxObjectStreamingCallback _streamingCallback = NULL) : | |
ab0881c7 VS |
115 | m_className(_ClassName), |
116 | m_objectSize(size), | |
117 | m_objectConstructor(ctor), | |
118 | m_next(sm_first), | |
cbca59a8 SC |
119 | m_firstPropertyFn(_Props), |
120 | m_firstHandlerFn(_Handlers), | |
121 | m_firstProperty(NULL), | |
122 | m_firstHandler(NULL), | |
123 | m_firstInited(false), | |
ab0881c7 | 124 | m_parents(_Parents), |
583150e3 | 125 | m_unitName(_UnitName), |
ab0881c7 VS |
126 | m_constructor(_Constructor), |
127 | m_constructorProperties(_ConstructorProperties), | |
128 | m_constructorPropertiesCount(_ConstructorPropertiesCount), | |
129 | m_variantOfPtrToObjectConverter(_PtrConverter1), | |
130 | m_variantToObjectConverter(_Converter2), | |
131 | m_objectToVariantConverter(_Converter3), | |
132 | m_streamingCallback(_streamingCallback) | |
ae820c69 SC |
133 | { |
134 | sm_first = this; | |
28953245 | 135 | Register(); |
ae820c69 SC |
136 | } |
137 | ||
ab0881c7 | 138 | wxClassInfo(const wxChar *_UnitName, const wxChar *_ClassName, |
583150e3 | 139 | const wxClassInfo **_Parents) : |
ab0881c7 VS |
140 | m_className(_ClassName), |
141 | m_objectSize(0), | |
142 | m_objectConstructor(NULL), | |
143 | m_next(sm_first), | |
cbca59a8 SC |
144 | m_firstPropertyFn(NULL), |
145 | m_firstHandlerFn(NULL), | |
ab0881c7 VS |
146 | m_firstProperty(NULL), |
147 | m_firstHandler(NULL), | |
cbca59a8 | 148 | m_firstInited(true), |
ab0881c7 VS |
149 | m_parents(_Parents), |
150 | m_unitName(_UnitName), | |
151 | m_constructor(NULL), | |
152 | m_constructorProperties(NULL), | |
153 | m_constructorPropertiesCount(0), | |
154 | m_variantOfPtrToObjectConverter(NULL), | |
155 | m_variantToObjectConverter(NULL), | |
156 | m_objectToVariantConverter(NULL), | |
157 | m_streamingCallback(NULL) | |
ae820c69 SC |
158 | { |
159 | sm_first = this; | |
28953245 SC |
160 | Register(); |
161 | } | |
162 | ||
163 | // ctor compatible with old RTTI system | |
164 | wxClassInfo(const wxChar *_ClassName, | |
165 | const wxClassInfo *_Parent1, | |
166 | const wxClassInfo *_Parent2, | |
167 | int size, | |
168 | wxObjectConstructorFn ctor) : | |
169 | m_className(_ClassName), | |
170 | m_objectSize(size), | |
171 | m_objectConstructor(ctor), | |
172 | m_next(sm_first), | |
cbca59a8 SC |
173 | m_firstPropertyFn(NULL), |
174 | m_firstHandlerFn(NULL), | |
28953245 SC |
175 | m_firstProperty(NULL), |
176 | m_firstHandler(NULL), | |
cbca59a8 | 177 | m_firstInited(true), |
28953245 SC |
178 | m_parents(NULL), |
179 | m_unitName(NULL), | |
180 | m_constructor(NULL), | |
181 | m_constructorProperties(NULL), | |
182 | m_constructorPropertiesCount(0), | |
183 | m_variantOfPtrToObjectConverter(NULL), | |
184 | m_variantToObjectConverter(NULL), | |
185 | m_objectToVariantConverter(NULL), | |
186 | m_streamingCallback(NULL) | |
187 | { | |
188 | sm_first = this; | |
189 | m_parents[0] = _Parent1; | |
190 | m_parents[1] = _Parent2; | |
191 | m_parents[2] = NULL; | |
192 | Register(); | |
ae820c69 | 193 | } |
2d51f067 | 194 | |
28953245 | 195 | virtual ~wxClassInfo(); |
a095505c | 196 | |
28953245 SC |
197 | // allocates an instance of this class, this object does not have to be |
198 | // initialized or fully constructed as this call will be followed by a call to Create | |
199 | virtual wxObject *AllocateObject() const | |
200 | { return m_objectConstructor ? (*m_objectConstructor)() : 0; } | |
ab6e4913 SC |
201 | |
202 | // 'old naming' for AllocateObject staying here for backward compatibility | |
28953245 | 203 | wxObject *CreateObject() const { return AllocateObject(); } |
a095505c | 204 | |
583150e3 | 205 | // direct construction call for classes that cannot construct instances via alloc/create |
cbca59a8 | 206 | wxObject *ConstructObject(int ParamCount, wxAny *Params) const; |
583150e3 | 207 | |
28953245 SC |
208 | bool NeedsDirectConstruction() const |
209 | { return wx_dynamic_cast(wxObjectAllocator*, m_constructor) != NULL; } | |
583150e3 | 210 | |
28953245 SC |
211 | const wxChar *GetClassName() const |
212 | { return m_className; } | |
79fdfb35 SC |
213 | const wxChar *GetBaseClassName1() const |
214 | { return m_parents[0] ? m_parents[0]->GetClassName() : NULL; } | |
215 | const wxChar *GetBaseClassName2() const | |
216 | { return (m_parents[0] && m_parents[1]) ? m_parents[1]->GetClassName() : NULL; } | |
a095505c | 217 | |
28953245 SC |
218 | const wxClassInfo *GetBaseClass1() const |
219 | { return m_parents[0]; } | |
220 | const wxClassInfo *GetBaseClass2() const | |
221 | { return m_parents[0] ? m_parents[1] : NULL; } | |
222 | ||
223 | const wxChar *GetIncludeName() const | |
224 | { return m_unitName; } | |
225 | const wxClassInfo **GetParents() const | |
226 | { return m_parents; } | |
227 | int GetSize() const | |
228 | { return m_objectSize; } | |
229 | bool IsDynamic() const | |
230 | { return (NULL != m_objectConstructor); } | |
231 | ||
232 | wxObjectConstructorFn GetConstructor() const | |
233 | { return m_objectConstructor; } | |
234 | const wxClassInfo *GetNext() const | |
235 | { return m_next; } | |
236 | ||
237 | // statics: | |
238 | ||
239 | static void CleanUp(); | |
cbca59a8 | 240 | static wxClassInfo *FindClass(const wxString& className); |
28953245 SC |
241 | static const wxClassInfo *GetFirst() |
242 | { return sm_first; } | |
243 | ||
a095505c | 244 | |
ae820c69 SC |
245 | // Climb upwards through inheritance hierarchy. |
246 | // Dual inheritance is catered for. | |
a095505c | 247 | |
28953245 | 248 | bool IsKindOf(const wxClassInfo *info) const; |
a095505c | 249 | |
cbca59a8 | 250 | wxDECLARE_CLASS_INFO_ITERATORS(); |
644cb537 | 251 | |
ab0881c7 VS |
252 | // if there is a callback registered with that class it will be called |
253 | // before this object will be written to disk, it can veto streaming out | |
254 | // this object by returning false, if this class has not registered a | |
255 | // callback, the search will go up the inheritance tree if no callback has | |
256 | // been registered true will be returned by default | |
cbca59a8 SC |
257 | bool BeforeWriteObject( const wxObject *obj, wxObjectWriter *streamer, |
258 | wxObjectWriterCallback *writercallback, const wxStringToAnyHashMap &metadata) const; | |
9c8046dd SC |
259 | |
260 | // gets the streaming callback from this class or any superclass | |
28953245 | 261 | wxObjectStreamingCallback GetStreamingCallback() const; |
75890a3f | 262 | |
517fb871 | 263 | // returns the first property |
cbca59a8 SC |
264 | wxPropertyInfo* GetFirstProperty() const |
265 | { EnsureInfosInited(); return m_firstProperty; } | |
a095505c | 266 | |
517fb871 | 267 | // returns the first handler |
cbca59a8 SC |
268 | wxHandlerInfo* GetFirstHandler() const |
269 | { EnsureInfosInited(); return m_firstHandler; } | |
a095505c | 270 | |
ab6e4913 SC |
271 | // Call the Create upon an instance of the class, in the end the object is fully |
272 | // initialized | |
cbca59a8 | 273 | virtual bool Create (wxObject *object, int ParamCount, wxAny *Params) const; |
a095505c | 274 | |
517fb871 | 275 | // get number of parameters for constructor |
28953245 SC |
276 | virtual int GetCreateParamCount() const |
277 | { return m_constructorPropertiesCount; } | |
a095505c | 278 | |
ab6e4913 | 279 | // get n-th constructor parameter |
28953245 SC |
280 | virtual const wxChar* GetCreateParamName(int n) const |
281 | { return m_constructorProperties[n]; } | |
a095505c | 282 | |
28953245 SC |
283 | // Runtime access to objects for simple properties (get/set) by property |
284 | // name and variant data | |
285 | virtual void SetProperty (wxObject *object, const wxChar *propertyName, | |
cbca59a8 SC |
286 | const wxAny &value) const; |
287 | virtual wxAny GetProperty (wxObject *object, const wxChar *propertyName) const; | |
ab6e4913 SC |
288 | |
289 | // Runtime access to objects for collection properties by property name | |
cbca59a8 | 290 | virtual wxAnyList GetPropertyCollection(wxObject *object, |
28953245 SC |
291 | const wxChar *propertyName) const; |
292 | virtual void AddToPropertyCollection(wxObject *object, const wxChar *propertyName, | |
cbca59a8 | 293 | const wxAny& value) const; |
a095505c | 294 | |
28953245 SC |
295 | // we must be able to cast variants to wxObject pointers, templates seem |
296 | // not to be suitable | |
cbca59a8 SC |
297 | void CallOnAny( const wxAny &data, wxObjectFunctor* functor ) const; |
298 | ||
299 | wxObject* AnyToObjectPtr( const wxAny &data) const; | |
fa08490f | 300 | |
cbca59a8 | 301 | wxAny ObjectPtrToAny( wxObject *object ) const; |
4393b50c | 302 | |
517fb871 | 303 | // find property by name |
28953245 | 304 | virtual const wxPropertyInfo *FindPropertyInfo (const wxChar *PropertyName) const; |
fbbdc52c | 305 | |
517fb871 | 306 | // find handler by name |
28953245 | 307 | virtual const wxHandlerInfo *FindHandlerInfo (const wxChar *handlerName) const; |
a095505c | 308 | |
2d51f067 | 309 | // find property by name |
28953245 | 310 | virtual wxPropertyInfo *FindPropertyInfoInThisClass (const wxChar *PropertyName) const; |
2d51f067 SC |
311 | |
312 | // find handler by name | |
28953245 SC |
313 | virtual wxHandlerInfo *FindHandlerInfoInThisClass (const wxChar *handlerName) const; |
314 | ||
315 | // puts all the properties of this class and its superclasses in the map, | |
316 | // as long as there is not yet an entry with the same name (overriding mechanism) | |
317 | void GetProperties( wxPropertyInfoMap &map ) const; | |
ae820c69 | 318 | |
644cb537 | 319 | private: |
a095505c SC |
320 | const wxChar *m_className; |
321 | int m_objectSize; | |
28953245 | 322 | wxObjectConstructorFn m_objectConstructor; |
a095505c SC |
323 | |
324 | // class info object live in a linked list: | |
325 | // pointers to its head and the next element in it | |
326 | ||
327 | static wxClassInfo *sm_first; | |
28953245 | 328 | wxClassInfo *m_next; |
a095505c | 329 | |
a095505c SC |
330 | static wxHashTable *sm_classTable; |
331 | ||
cbca59a8 SC |
332 | wxPropertyInfoFn m_firstPropertyFn; |
333 | wxHandlerInfoFn m_firstHandlerFn; | |
334 | ||
335 | mutable bool m_firstInited; | |
336 | ||
28953245 | 337 | protected: |
cbca59a8 SC |
338 | void EnsureInfosInited() const |
339 | { | |
340 | if ( !m_firstInited) | |
341 | { | |
342 | if ( m_firstPropertyFn != NULL) | |
343 | m_firstProperty = (*m_firstPropertyFn)(); | |
344 | if ( m_firstHandlerFn != NULL) | |
345 | m_firstHandler = (*m_firstHandlerFn)(); | |
346 | m_firstInited = true; | |
347 | } | |
348 | } | |
349 | mutable wxPropertyInfo* m_firstProperty; | |
350 | mutable wxHandlerInfo* m_firstHandler; | |
28953245 | 351 | |
a095505c | 352 | private: |
28953245 SC |
353 | const wxClassInfo** m_parents; |
354 | const wxChar* m_unitName; | |
355 | ||
356 | wxObjectAllocatorAndCreator* m_constructor; | |
357 | const wxChar ** m_constructorProperties; | |
358 | const int m_constructorPropertiesCount; | |
cbca59a8 | 359 | wxVariantToObjectPtrConverter m_variantOfPtrToObjectConverter; |
28953245 SC |
360 | wxVariantToObjectConverter m_variantToObjectConverter; |
361 | wxObjectToVariantConverter m_objectToVariantConverter; | |
362 | wxObjectStreamingCallback m_streamingCallback; | |
363 | ||
364 | const wxPropertyAccessor *FindAccessor (const wxChar *propertyName) const; | |
a095505c | 365 | |
d1d738f1 VS |
366 | protected: |
367 | // registers the class | |
368 | void Register(); | |
369 | void Unregister(); | |
a095505c | 370 | |
28953245 | 371 | DECLARE_NO_COPY_CLASS(wxClassInfo) |
a095505c SC |
372 | }; |
373 | ||
cbca59a8 | 374 | WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name); |
a095505c | 375 | |
2d51f067 | 376 | // ---------------------------------------------------------------------------- |
28953245 | 377 | // wxDynamicClassInfo |
2d51f067 | 378 | // ---------------------------------------------------------------------------- |
28953245 | 379 | |
2d51f067 SC |
380 | // this object leads to having a pure runtime-instantiation |
381 | ||
492f9a9e | 382 | class WXDLLIMPEXP_BASE wxDynamicClassInfo : public wxClassInfo |
2d51f067 | 383 | { |
28953245 SC |
384 | friend class WXDLLIMPEXP_BASE wxDynamicObject; |
385 | ||
386 | public: | |
387 | wxDynamicClassInfo( const wxChar *_UnitName, const wxChar *_ClassName, | |
388 | const wxClassInfo* superClass ); | |
389 | virtual ~wxDynamicClassInfo(); | |
2d51f067 SC |
390 | |
391 | // constructs a wxDynamicObject with an instance | |
28953245 | 392 | virtual wxObject *AllocateObject() const; |
2d51f067 SC |
393 | |
394 | // Call the Create method for a class | |
cbca59a8 | 395 | virtual bool Create (wxObject *object, int ParamCount, wxAny *Params) const; |
2d51f067 SC |
396 | |
397 | // get number of parameters for constructor | |
28953245 | 398 | virtual int GetCreateParamCount() const; |
2d51f067 SC |
399 | |
400 | // get i-th constructor parameter | |
28953245 | 401 | virtual const wxChar* GetCreateParamName(int i) const; |
2d51f067 SC |
402 | |
403 | // Runtime access to objects by property name, and variant data | |
28953245 | 404 | virtual void SetProperty (wxObject *object, const wxChar *PropertyName, |
cbca59a8 SC |
405 | const wxAny &Value) const; |
406 | virtual wxAny GetProperty (wxObject *object, const wxChar *PropertyName) const; | |
2d51f067 | 407 | |
2abce515 | 408 | // adds a property to this class at runtime |
28953245 | 409 | void AddProperty( const wxChar *propertyName, const wxTypeInfo* typeInfo ); |
2abce515 SC |
410 | |
411 | // removes an existing runtime-property | |
28953245 | 412 | void RemoveProperty( const wxChar *propertyName ); |
2abce515 | 413 | |
492f9a9e | 414 | // renames an existing runtime-property |
28953245 | 415 | void RenameProperty( const wxChar *oldPropertyName, const wxChar *newPropertyName ); |
492f9a9e | 416 | |
2abce515 | 417 | // as a handler to this class at runtime |
28953245 SC |
418 | void AddHandler( const wxChar *handlerName, wxObjectEventFunction address, |
419 | const wxClassInfo* eventClassInfo ); | |
2abce515 SC |
420 | |
421 | // removes an existing runtime-handler | |
28953245 | 422 | void RemoveHandler( const wxChar *handlerName ); |
492f9a9e SC |
423 | |
424 | // renames an existing runtime-handler | |
28953245 SC |
425 | void RenameHandler( const wxChar *oldHandlerName, const wxChar *newHandlerName ); |
426 | ||
427 | private: | |
428 | struct wxDynamicClassInfoInternal; | |
429 | wxDynamicClassInfoInternal* m_data; | |
430 | }; | |
431 | ||
a095505c | 432 | // ---------------------------------------------------------------------------- |
28953245 | 433 | // wxDECLARE class macros |
a095505c SC |
434 | // ---------------------------------------------------------------------------- |
435 | ||
28953245 SC |
436 | #define _DECLARE_DYNAMIC_CLASS(name) \ |
437 | public: \ | |
438 | static wxClassInfo ms_classInfo; \ | |
439 | static const wxClassInfo* ms_classParents[]; \ | |
440 | static wxPropertyInfo* GetPropertiesStatic(); \ | |
441 | static wxHandlerInfo* GetHandlersStatic(); \ | |
442 | static wxClassInfo *GetClassInfoStatic() \ | |
443 | { return &name::ms_classInfo; } \ | |
444 | virtual wxClassInfo *GetClassInfo() const \ | |
445 | { return &name::ms_classInfo; } | |
446 | ||
447 | #define wxDECLARE_DYNAMIC_CLASS(name) \ | |
448 | static wxObjectAllocatorAndCreator* ms_constructor; \ | |
449 | static const wxChar * ms_constructorProperties[]; \ | |
450 | static const int ms_constructorPropertiesCount; \ | |
f0b7eadf | 451 | _DECLARE_DYNAMIC_CLASS(name) |
a095505c | 452 | |
28953245 | 453 | #define wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ |
cbca59a8 | 454 | wxDECLARE_NO_ASSIGN_CLASS(name); \ |
28953245 | 455 | wxDECLARE_DYNAMIC_CLASS(name) |
a095505c | 456 | |
28953245 | 457 | #define wxDECLARE_DYNAMIC_CLASS_NO_COPY(name) \ |
cbca59a8 SC |
458 | wxDECLARE_NO_COPY_CLASS(name); \ |
459 | wxDECLARE_DYNAMIC_CLASS(name) | |
460 | ||
461 | #define wxDECLARE_CLASS(name) \ | |
28953245 | 462 | wxDECLARE_DYNAMIC_CLASS(name) |
a095505c | 463 | |
28953245 SC |
464 | #define wxDECLARE_ABSTRACT_CLASS(name) _DECLARE_DYNAMIC_CLASS(name) |
465 | #define wxCLASSINFO(name) (&name::ms_classInfo) | |
a095505c | 466 | |
208fd16c SC |
467 | // -------------------------------------------------------------------------- |
468 | // Collection Support | |
469 | // -------------------------------------------------------------------------- | |
470 | ||
cbca59a8 SC |
471 | template<typename iter, typename collection_t > void wxListCollectionToAnyList( |
472 | const collection_t& coll, wxAnyList &value ) | |
208fd16c | 473 | { |
cbca59a8 SC |
474 | for ( collection_t::compatibility_iterator current = coll.GetFirst(); current; |
475 | current = current->GetNext() ) | |
208fd16c | 476 | { |
cbca59a8 | 477 | value.Append( new wxAny(current->GetData()) ); |
208fd16c SC |
478 | } |
479 | } | |
480 | ||
28953245 | 481 | template<typename collection_t> void wxArrayCollectionToVariantArray( |
cbca59a8 | 482 | const collection_t& coll, wxAnyList &value ) |
208fd16c | 483 | { |
28953245 | 484 | for( size_t i = 0; i < coll.GetCount(); i++ ) |
208fd16c | 485 | { |
cbca59a8 | 486 | value.Append( new wxAny(coll[i]) ); |
208fd16c SC |
487 | } |
488 | } | |
489 | ||
28953245 | 490 | #endif // wxUSE_EXTENDED_RTTI |
c0089c96 | 491 | #endif // _WX_XTIH__ |