1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: runtime metadata information (extended class info)
4 // Author: Stefan Csomor
8 // Copyright: (c) 1997 Julian Smart
9 // (c) 2003 Stefan Csomor
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
16 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
17 #pragma interface "xti.h"
20 // We want to support properties, event sources and events sinks through
21 // explicit declarations, using templates and specialization to make the
22 // effort as painless as possible.
24 // This means we have the following domains :
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
29 // which will be merged with wxVariant
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
35 // ----------------------------------------------------------------------------
37 // ----------------------------------------------------------------------------
40 #include "wx/memory.h"
42 #include "wx/string.h"
43 #include "wx/arrstr.h"
45 // some compilers have troubles getting the correct wxPropertyAccessorT constructor
46 // set this to 1 to make things work for these, too
48 #ifndef WX_XTI_TEMPLATE_FIX
49 #define WX_XTI_TEMPLATE_FIX 0
52 #if WX_XTI_TEMPLATE_FIX
53 #define WX_XTI_PARAM_FIX(a,b) a,b
55 #define WX_XTI_PARAM_FIX(a,b)
58 class WXDLLIMPEXP_BASE wxObject
;
59 class WXDLLIMPEXP_BASE wxClassInfo
;
60 class WXDLLIMPEXP_BASE wxHashTable
;
61 class WXDLLIMPEXP_BASE wxObjectRefData
;
62 class WXDLLIMPEXP_BASE wxEvent
;
64 typedef void (wxObject::*wxObjectEventFunction
)(wxEvent
&);
66 // ----------------------------------------------------------------------------
69 // In the header files there would no change from pure c++ code, in the
70 // implementation, an enum would have
71 // to be enumerated eg :
73 // WX_BEGIN_ENUM( wxFlavor )
74 // WX_ENUM_MEMBER( Vanilla )
75 // WX_ENUM_MEMBER( Chocolate )
76 // WX_ENUM_MEMBER( Strawberry )
77 // WX_END_ENUM( wxFlavor )
78 // ----------------------------------------------------------------------------
80 struct WXDLLIMPEXP_BASE wxEnumMemberData
86 class WXDLLIMPEXP_BASE wxEnumData
89 wxEnumData( wxEnumMemberData
* data
) ;
91 // returns true if the member has been found and sets the int value
92 // pointed to accordingly (if ptr != null )
93 // if not found returns false, value left unchanged
94 bool HasEnumMemberValue( const wxChar
*name
, int *value
= NULL
) ;
96 // returns the value of the member, if not found in debug mode an
97 // assert is issued, in release 0 is returned
98 int GetEnumMemberValue(const wxChar
*name
);
100 // returns the name of the enum member having the passed in value
101 // returns an emtpy string if not found
102 const wxChar
*GetEnumMemberName(int value
);
104 // returns the number of members in this enum
105 int GetEnumCount() { return m_count
; }
107 // returns the value of the nth member
108 int GetEnumMemberValueByIndex( int n
) ;
110 // returns the value of the nth member
111 const wxChar
*GetEnumMemberNameByIndex( int n
) ;
113 wxEnumMemberData
*m_members
;
117 #define WX_BEGIN_ENUM( e ) \
118 wxEnumMemberData s_enumDataMembers##e[] = {
120 #define WX_ENUM_MEMBER( v ) { #v, v } ,
122 #define WX_END_ENUM( e ) { NULL , 0 } } ; \
123 wxEnumData s_enumData##e( s_enumDataMembers##e ) ; \
124 wxEnumData *wxGetEnumData(e) { return &s_enumData##e ; } \
125 template<> const wxTypeInfo* wxGetTypeInfo( e * ){ static wxEnumTypeInfo s_typeInfo(wxT_ENUM , &s_enumData##e) ; return &s_typeInfo ; } \
126 template<> void wxStringReadValue(const wxString& s , e &data ) \
128 data = (e) s_enumData##e.GetEnumMemberValue(s) ; \
130 template<> void wxStringWriteValue(wxString &s , const e &data ) \
132 s = s_enumData##e.GetEnumMemberName((int)data) ; \
134 template<> const wxTypeInfo* wxGetTypeInfo( e ** ){ static wxBuiltInTypeInfo s_typeInfo(wxT_VOID ) ; assert(0) ; return &s_typeInfo ; } \
135 template<> void wxStringReadValue(const wxString& , e* & ) \
139 template<> void wxStringWriteValue(wxString &s , e* const & ) \
144 // ----------------------------------------------------------------------------
156 // typedef wxSet<wxFlavor> wxCoupe ;
158 // in the implementation file :
160 // WX_BEGIN_ENUM( wxFlavor )
161 // WX_ENUM_MEMBER( Vanilla )
162 // WX_ENUM_MEMBER( Chocolate )
163 // WX_ENUM_MEMBER( Strawberry )
164 // WX_END_ENUM( wxFlavor )
166 // WX_IMPLEMENT_SET_STREAMING( wxCoupe , wxFlavor )
168 // implementation note : no partial specialization for streaming, but a delegation to a
171 // ----------------------------------------------------------------------------
173 // in order to remove dependancy on string tokenizer
174 void wxSetStringToArray( const wxString
&s
, wxArrayString
&array
) ;
177 void wxSetFromString(const wxString
&s
, wxSet
<e
> &data
)
179 wxEnumData
* edata
= wxGetEnumData((e
) 0) ;
182 wxArrayString array
;
183 wxSetStringToArray( s
, array
) ;
185 for ( int i
= 0 ; i
< array
.Count() ; ++i
)
189 if ( edata
->HasEnumMemberValue( flag
, &ivalue
) )
191 data
.Set( (e
) ivalue
) ;
197 void wxSetToString( wxString
&s
, const wxSet
<e
> &data
)
199 wxEnumData
* edata
= wxGetEnumData((e
) 0) ;
200 int count
= edata
->GetEnumCount() ;
203 for ( i
= 0 ; i
< count
; i
++ )
205 e value
= (e
) edata
->GetEnumMemberValueByIndex(i
) ;
206 if ( data
.Contains( value
) )
208 // this could also be done by the templated calls
211 s
+= edata
->GetEnumMemberNameByIndex(i
) ;
216 // if the wxSet specialization above does not work for all compilers, add this to the WX_IMPLEMENT_SET_STREAMING macro
217 // template<> const wxTypeInfo* wxGetTypeInfo( SetName * ){ static wxEnumTypeInfo s_typeInfo(wxT_SET , &s_enumData##e) ; return &s_typeInfo ; }
219 #define WX_IMPLEMENT_SET_STREAMING(SetName,e) \
220 template<> void wxStringReadValue(const wxString &s , wxSet<e> &data ) \
222 wxSetFromString( s , data ) ; \
224 template<> void wxStringWriteValue( wxString &s , const wxSet<e> &data ) \
226 wxSetToString( s , data ) ; \
230 // ----------------------------------------------------------------------------
232 // ----------------------------------------------------------------------------
235 // All data exposed by the RTTI is characterized using the following classes.
236 // The first characterization is done by wxTypeKind. All enums up to and including
237 // wxT_CUSTOM represent so called simple types. These cannot be divided any further.
238 // They can be converted to and from wxStrings, that's all.
243 wxT_VOID
= 0, // unknown type
253 wxT_STRING
, // must be wxString
254 wxT_SET
, // must be wxSet<> template
256 wxT_CUSTOM
, // user defined type (e.g. wxPoint)
258 wxT_LAST_SIMPLE_TYPE_KIND
= wxT_CUSTOM
,
260 wxT_OBJECT_PTR
, // object reference
261 wxT_OBJECT
, // embedded object
262 wxT_COLLECTION
, // collection
264 wxT_DELEGATE
, // for connecting against an event source
266 wxT_LAST_TYPE_KIND
= wxT_DELEGATE
// sentinel for bad data, asserts, debugging
269 class WXDLLIMPEXP_BASE wxTypeInfo
272 wxTypeInfo() : m_kind( wxT_VOID
) {}
273 virtual ~wxTypeInfo() {}
274 wxTypeKind
GetKind() const { return m_kind
; }
275 bool IsDelegateType() const { return m_kind
== wxT_DELEGATE
; }
276 bool IsCustomType() const { return m_kind
== wxT_CUSTOM
; }
277 bool IsObjectType() const { return m_kind
== wxT_OBJECT
|| m_kind
== wxT_OBJECT_PTR
; }
282 class WXDLLIMPEXP_BASE wxBuiltInTypeInfo
: public wxTypeInfo
285 wxBuiltInTypeInfo( wxTypeKind kind
) { wxASSERT_MSG( kind
< wxT_SET
, wxT("Illegal Kind for Base Type") ) ; m_kind
= kind
;}
288 class WXDLLIMPEXP_BASE wxCustomTypeInfo
: public wxTypeInfo
291 wxCustomTypeInfo( const wxChar
*typeName
)
292 { m_kind
= wxT_CUSTOM
; m_typeName
= typeName
;}
293 const wxChar
*GetTypeName() const { return m_typeName
; }
295 const wxChar
*m_typeName
; // Kind == wxT_CUSTOM
298 class WXDLLIMPEXP_BASE wxEnumTypeInfo
: public wxTypeInfo
301 wxEnumTypeInfo( wxTypeKind kind
, wxEnumData
* enumInfo
)
302 { wxASSERT_MSG( kind
== wxT_ENUM
|| kind
== wxT_SET
, wxT("Illegal Kind for Enum Type")) ; m_kind
= kind
; m_enumInfo
= enumInfo
;}
303 const wxEnumData
* GetEnumData() const { return m_enumInfo
; }
305 wxEnumData
*m_enumInfo
; // Kind == wxT_ENUM or Kind == wxT_SET
308 class WXDLLIMPEXP_BASE wxClassTypeInfo
: public wxTypeInfo
311 wxClassTypeInfo( wxTypeKind kind
, wxClassInfo
* classInfo
)
312 { wxASSERT_MSG( kind
== wxT_OBJECT_PTR
|| kind
== wxT_OBJECT
, wxT("Illegal Kind for Enum Type")) ; m_kind
= kind
; m_classInfo
= classInfo
;}
313 const wxClassInfo
*GetClassInfo() const { return m_classInfo
; }
315 wxClassInfo
*m_classInfo
; // Kind == wxT_OBJECT - could be NULL
318 class WXDLLIMPEXP_BASE wxCollectionTypeInfo
: public wxTypeInfo
321 wxCollectionTypeInfo( wxTypeInfo
*elementType
)
322 { m_kind
= wxT_COLLECTION
, m_elementType
= elementType
; }
324 const wxTypeInfo
* GetElementType() const { return m_elementType
; }
326 wxTypeInfo
* m_elementType
;
329 // a delegate is an exposed event source
331 class WXDLLIMPEXP_BASE wxDelegateTypeInfo
: public wxTypeInfo
334 wxDelegateTypeInfo( int eventType
, wxClassInfo
* eventClass
)
335 { m_kind
= wxT_DELEGATE
; m_eventClass
= eventClass
; m_eventType
= eventType
;}
336 const wxClassInfo
*GetEventClass() const { assert( m_kind
== wxT_DELEGATE
) ; return m_eventClass
; }
337 int GetEventType() const { return m_eventType
; }
339 const wxClassInfo
*m_eventClass
; // (extended will merge into classinfo)
343 template<typename T
> const wxTypeInfo
* wxGetTypeInfo( T
* ) ;
345 template<typename T
> const wxTypeInfo
* wxGetTypeInfo( wxSet
<T
> * )
347 static wxEnumTypeInfo
s_typeInfo(wxT_SET
, wxGetEnumData((T
) 0) ) ; return &s_typeInfo
;
350 // this macro is for usage with custom, non-object derived classes and structs, wxPoint is such a custom type
352 #define WX_CUSTOM_TYPE_INFO( e ) \
353 template<> const wxTypeInfo* wxGetTypeInfo( e ** ){ static wxBuiltInTypeInfo s_typeInfo(wxT_VOID) ; assert(0) ; return &s_typeInfo ; } \
354 template<> const wxTypeInfo* wxGetTypeInfo( e * ){ static wxCustomTypeInfo s_typeInfo(#e) ; return &s_typeInfo ; }
356 // templated streaming, every type must have their specialization for these methods
359 void wxStringReadValue( const wxString
&s
, T
&data
);
362 void wxStringWriteValue( wxString
&s
, const T
&data
);
364 // sometimes a compiler invents specializations that are nowhere called, use this macro to satisfy the refs
366 #define WX_ILLEGAL_TYPE_SPECIALIZATION( a ) \
367 template<> const wxTypeInfo* wxGetTypeInfo( a * ) { assert(0) ; \
368 static wxBuiltInTypeInfo s_typeInfo( wxT_VOID ) ; return &s_typeInfo ; } \
369 template<> void wxStringReadValue(const wxString & , a & ) { assert(0) ; }\
370 template<> void wxStringWriteValue(wxString & , a const & ) { assert(0) ; }
372 // ----------------------------------------------------------------------------
373 // wxxVariant as typesafe data holder
374 // ----------------------------------------------------------------------------
376 class WXDLLIMPEXP_BASE wxxVariantData
379 virtual ~wxxVariantData() {}
381 // return a heap allocated duplicate
382 virtual wxxVariantData
* Clone() const = 0 ;
384 // returns the type info of the contentc
385 virtual const wxTypeInfo
* GetTypeInfo() const = 0 ;
387 // write the value into a string
388 virtual void Write( wxString
&s
) const = 0 ;
390 // read the value from a string
391 virtual void Read( const wxString
&s
) = 0 ;
394 template<typename T
> class WXDLLIMPEXP_BASE wxxVariantDataT
: public wxxVariantData
397 wxxVariantDataT(const T
& d
) : m_data(d
) {}
398 virtual ~wxxVariantDataT() {}
400 // get a ref to the stored data
401 T
& Get() { return m_data
; }
403 // get a const ref to the stored data
404 const T
& Get() const { return m_data
; }
407 void Set(const T
& d
) { m_data
= d
; }
409 // return a heap allocated duplicate
410 virtual wxxVariantData
* Clone() const { return new wxxVariantDataT
<T
>( Get() ) ; }
412 // returns the type info of the contentc
413 virtual const wxTypeInfo
* GetTypeInfo() const { return wxGetTypeInfo( (T
*) NULL
) ; }
415 // write the value into a string
416 virtual void Write( wxString
&s
) const { wxStringWriteValue( s
, m_data
) ; }
418 // read the value from a string
419 virtual void Read( const wxString
&s
) { wxStringReadValue( s
, m_data
) ; }
425 class WXDLLIMPEXP_BASE wxxVariant
428 wxxVariant() { m_data
= NULL
; }
429 wxxVariant( wxxVariantData
* data
, const wxString
& name
= wxT("") ) : m_data(data
) , m_name(name
) {}
430 wxxVariant( const wxxVariant
&d
) { if ( d
.m_data
) m_data
= d
.m_data
->Clone() ; else m_data
= NULL
; m_name
= d
.m_name
; }
432 template<typename T
> wxxVariant( T data
, const wxString
& name
= wxT("") ) :
433 m_data(new wxxVariantDataT
<T
>(data
) ), m_name(name
) {}
434 ~wxxVariant() { delete m_data
; }
436 // get a ref to the stored data
437 template<typename T
> T
& Get()
439 wxxVariantDataT
<T
> *dataptr
= dynamic_cast<wxxVariantDataT
<T
>*> (m_data
) ;
440 wxASSERT_MSG( dataptr
, "Cast not possible" ) ;
441 return dataptr
->Get() ;
444 // get a ref to the stored data
445 template<typename T
> const T
& Get() const
447 const wxxVariantDataT
<T
> *dataptr
= dynamic_cast<const wxxVariantDataT
<T
>*> (m_data
) ;
448 wxASSERT_MSG( dataptr
, "Cast not possible" ) ;
449 return dataptr
->Get() ;
453 template<typename T
> void Set(const T
& data
) const
456 m_data
= new wxxVariantDataT
<T
>(data
) ;
459 wxxVariant
& operator=(const wxxVariant
&d
)
461 m_data
= d
.m_data
->Clone() ;
466 // gets the stored data casted to a wxObject* , returning NULL if cast is not possible
467 wxObject
* GetAsObject() ;
469 // get the typeinfo of the stored object
470 const wxTypeInfo
* GetTypeInfo() const { return m_data
->GetTypeInfo() ; }
472 // write the value into a string
473 void Write( wxString
&s
) const { m_data
->Write( s
) ; }
475 // read the value from a string
476 void Read( const wxString
&s
) { m_data
->Read( s
) ; }
478 // returns this value as string
479 wxString
GetAsString() const
486 void SetFromString( const wxString
&s
)
491 wxxVariantData
* m_data
;
495 #include <wx/dynarray.h>
497 WX_DECLARE_OBJARRAY_WITH_DECL(wxxVariant
, wxxVariantArray
, class WXDLLIMPEXP_BASE
);
499 // ----------------------------------------------------------------------------
502 // wxPropertyInfo is used to inquire of the property by name. It doesn't
503 // provide access to the property, only information about it. If you
504 // want access, look at wxPropertyAccessor.
505 // ----------------------------------------------------------------------------
507 class WXDLLIMPEXP_BASE wxPropertyAccessor
510 #if WX_XTI_TEMPLATE_FIX
512 class SetByRefRetBool
;
514 class SetAndGetByRef
;
515 class SetAndGetByRefRetBool
;
518 wxPropertyAccessor() { m_setterName
= NULL
; m_getterName
= NULL
; m_adderName
= NULL
;}
519 virtual ~wxPropertyAccessor() {}
521 // Setting a simple property (non-collection)
522 virtual void SetProperty(wxObject
*object
, const wxxVariant
&value
) const = 0 ;
524 // Getting a simple property (non-collection)
525 virtual wxxVariant
GetProperty(const wxObject
*object
) const = 0 ;
527 // Adding an element to a collection property
528 virtual void AddToPropertyCollection(wxObject
*object
, const wxxVariant
&value
) const
529 { wxASSERT_MSG(0,wxT("Collection Operation called on non Collection Property")) ; }
531 // Getting a collection property
532 virtual wxxVariantArray
GetPropertyCollection( const wxObject
*obj
) const
533 { wxASSERT_MSG(0,wxT("Collection Operation called on non Collection Property")) ; return wxxVariantArray() ; }
535 virtual bool HasSetter() const = 0 ;
536 virtual bool HasGetter() const = 0 ;
537 virtual bool HasAdder() const = 0 ;
539 const wxChar
* GetGetterName() const { return m_setterName
; }
540 const wxChar
* GetSetterName() const { return m_getterName
; }
541 const wxChar
* GetAdderName() const { return m_adderName
; }
543 virtual wxxVariant
ReadValue( const wxString
&value
) const = 0 ;
544 virtual void WriteValue( wxString
& value
, const wxObject
*o
) const = 0 ;
546 const wxChar
*m_setterName
;
547 const wxChar
*m_getterName
;
548 const wxChar
*m_adderName
;
551 class WXDLLIMPEXP_BASE wxGenericPropertyAccessor
: public wxPropertyAccessor
554 wxGenericPropertyAccessor( const wxChar
* propertyName
) ;
555 ~wxGenericPropertyAccessor() ;
556 virtual void SetProperty(wxObject
*object
, const wxxVariant
&value
) const ;
557 virtual wxxVariant
GetProperty(const wxObject
*object
) const ;
559 virtual bool HasSetter() const { return true ; }
560 virtual bool HasGetter() const { return true ; }
561 virtual bool HasAdder() const { return false ; }
563 virtual wxxVariant
ReadValue( const wxString
&value
) const ;
564 virtual void WriteValue( wxString
& value
, const wxObject
*o
) const ;
566 struct wxGenericPropertyAccessorInternal
;
567 wxGenericPropertyAccessorInternal
* m_data
;
570 template<class Klass
, typename T
>
571 class WXDLLIMPEXP_BASE wxPropertyAccessorT
: public wxPropertyAccessor
575 typedef void (Klass::*setter_t
)(T value
);
576 typedef bool (Klass::*setter_bool_t
)(T value
);
577 typedef void (Klass::*setter_ref_t
)(const T
& value
);
578 typedef bool (Klass::*setter_ref_bool_t
)(const T
& value
);
579 typedef T (Klass::*getter_t
)() const;
580 typedef const T
& (Klass::*getter_ref_t
)() const;
582 wxPropertyAccessorT(setter_t setter
, getter_t getter
, const wxChar
*s
, const wxChar
*g
)
583 : m_setter_bool( NULL
) , m_setter_ref_bool( NULL
) , m_setter(setter
), m_setter_ref(NULL
), m_getter(getter
) ,m_getter_ref(NULL
) {m_setterName
= s
;m_getterName
=g
;}
585 wxPropertyAccessorT( getter_t getter
, const wxChar
*g
)
586 : m_setter_bool( NULL
) , m_setter_ref_bool( NULL
) , m_setter(NULL
), m_setter_ref(NULL
), m_getter(getter
) ,m_getter_ref(NULL
) {m_setterName
= "";m_getterName
=g
;}
588 wxPropertyAccessorT(WX_XTI_PARAM_FIX(GetByRef
*,) getter_ref_t getter
, const wxChar
*g
)
589 : m_setter_bool( NULL
) , m_setter_ref_bool( NULL
) , m_setter(NULL
), m_setter_ref(NULL
), m_getter(NULL
) ,m_getter_ref(getter
) {m_setterName
= "";m_getterName
=g
;}
591 wxPropertyAccessorT(WX_XTI_PARAM_FIX(SetRetBool
*,) setter_bool_t setter
, getter_t getter
, const wxChar
*s
, const wxChar
*g
)
592 : m_setter_bool( setter
) , m_setter_ref_bool( NULL
) , m_setter(NULL
), m_setter_ref(NULL
), m_getter(getter
) , m_getter_ref(NULL
){m_setterName
= s
;m_getterName
=g
;}
594 wxPropertyAccessorT(WX_XTI_PARAM_FIX(SetByRef
*,) setter_ref_t setter
, getter_t getter
, const wxChar
*s
, const wxChar
*g
)
595 : m_setter_bool( NULL
) , m_setter_ref_bool( NULL
) , m_setter(NULL
), m_setter_ref(setter
), m_getter(getter
) , m_getter_ref(NULL
){m_setterName
= s
;m_getterName
=g
;}
597 wxPropertyAccessorT(WX_XTI_PARAM_FIX(SetByRefRetBool
*,) setter_ref_bool_t setter
, getter_t getter
, const wxChar
*s
, const wxChar
*g
)
598 : m_setter_bool( NULL
) , m_setter_ref_bool( setter
) , m_setter(NULL
), m_setter_ref(NULL
), m_getter(getter
) , m_getter_ref(NULL
){m_setterName
= s
;m_getterName
=g
;}
600 wxPropertyAccessorT(WX_XTI_PARAM_FIX(SetAndGetByRef
*,) setter_ref_t setter
, getter_ref_t getter
, const wxChar
*s
, const wxChar
*g
)
601 : m_setter_bool( NULL
) , m_setter_ref_bool( NULL
) , m_setter(NULL
), m_setter_ref(setter
), m_getter(NULL
) , m_getter_ref(getter
){m_setterName
= s
;m_getterName
=g
;}
603 wxPropertyAccessorT(WX_XTI_PARAM_FIX(SetAndGetByRefRetBool
*,) setter_ref_bool_t setter
, getter_ref_t getter
, const wxChar
*s
, const wxChar
*g
)
604 : m_setter_bool( NULL
) , m_setter_ref_bool( setter
) , m_setter(NULL
), m_setter_ref(NULL
), m_getter(NULL
) , m_getter_ref(getter
){m_setterName
= s
;m_getterName
=g
;}
606 wxPropertyAccessorT(WX_XTI_PARAM_FIX(GetByRef
*,) setter_t setter
, getter_ref_t getter
, const wxChar
*s
, const wxChar
*g
)
607 : m_setter_bool( NULL
) , m_setter_ref_bool( NULL
) , m_setter(NULL
), m_setter(setter
), m_getter(NULL
) , m_getter_ref(getter
){m_setterName
= s
;m_getterName
=g
;}
609 // returns true if this accessor has a setter
610 bool HasSetter() const { return m_setter
!= NULL
|| m_setter_ref
!= NULL
|| m_setter_ref_bool
!= NULL
|| m_setter_bool
; }
612 // return true if this accessor has a getter
613 bool HasGetter() const { return m_getter
!= NULL
|| m_getter_ref
!= NULL
; }
615 bool HasAdder() const { return true ; }
616 // set the property this accessor is responsible for in an object
617 void SetProperty(wxObject
*o
, const wxxVariant
&v
) const
619 Klass
*obj
= dynamic_cast<Klass
*>(o
);
622 if ( wxGetTypeInfo((T
*)NULL
)->GetKind() == wxT_OBJECT
&& v
.GetTypeInfo()->GetKind() == wxT_OBJECT_PTR
)
623 value
= *v
.Get
<T
*>();
627 (obj
->*(m_setter
))(value
);
628 else if ( m_setter_ref
)
629 (obj
->*(m_setter_ref
))(value
);
630 else if ( m_setter_ref_bool
)
631 (obj
->*(m_setter_ref_bool
))(value
);
632 else if ( m_setter_bool
)
633 (obj
->*(m_setter_bool
))(value
);
636 wxASSERT_MSG(0 , wxT("SetPropertyCalled without a valid Setter") ) ;
640 // gets the property this accessor is responsible for from an object
641 wxxVariant
GetProperty(const wxObject
*o
) const
643 return wxxVariant( (wxxVariantData
* ) DoGetProperty( o
) ) ;
646 // write the property this accessor is responsible for from an object into
648 void WriteValue( wxString
& s
, const wxObject
*o
) const
650 DoGetProperty( o
)->Write( s
) ;
653 // read a wxxVariant having the correct type for the property this accessor
654 // is responsible for from a string
655 wxxVariant
ReadValue( const wxString
&value
) const
658 wxStringReadValue( value
, data
) ;
659 return wxxVariant( data
) ;
663 wxxVariantDataT
<T
>* DoGetProperty(const wxObject
*o
) const
665 const Klass
*obj
= dynamic_cast<const Klass
*>(o
);
667 return new wxxVariantDataT
<T
>( (obj
->*(m_getter
))() ) ;
669 return new wxxVariantDataT
<T
>( (obj
->*(m_getter_ref
))() ) ;
673 setter_ref_t m_setter_ref
;
674 setter_ref_bool_t m_setter_ref_bool
;
675 setter_bool_t m_setter_bool
;
677 getter_ref_t m_getter_ref
;
680 template<class Klass
, typename CollectionType
, typename AddedElementType
>
681 class WXDLLIMPEXP_BASE wxPropertyCollectionAccessorT
: public wxPropertyAccessor
685 typedef void (Klass::*adder_t
)(AddedElementType value
);
686 typedef CollectionType (Klass::*getter_t
)() const;
687 typedef const CollectionType
& (Klass::*getter_ref_t
)() const;
689 wxPropertyCollectionAccessorT(adder_t adder
, getter_t getter
, const wxChar
*a
, const wxChar
*g
)
690 : m_getter(getter
), m_adder(adder
) , m_getter_ref( NULL
) { m_adderName
= a
;m_getterName
=g
;}
692 wxPropertyCollectionAccessorT(adder_t adder
, getter_ref_t getter
, const wxChar
*a
, const wxChar
*g
)
693 : m_getter(NULL
), m_adder(adder
) , m_getter_ref( getter
) { m_adderName
= a
;m_getterName
=g
;}
695 ~wxPropertyCollectionAccessorT() {}
697 // returns true if this accessor has a setter
698 bool HasSetter() const { return false ;}
700 // return true if this accessor has a getter
701 bool HasGetter() const { return m_getter
!= NULL
;}
703 // return true if this accessor has a getter
704 bool HasAdder() const { return m_adder
!= NULL
;}
706 // set the property this accessor is responsible for in an object
707 void AddToPropertyCollection(wxObject
*o
, const wxxVariant
&v
) const
709 Klass
*obj
= dynamic_cast<Klass
*>(o
);
710 AddedElementType value
;
712 if ( wxGetTypeInfo((AddedElementType
*)NULL
)->GetKind() == wxT_OBJECT
&& v
.GetTypeInfo()->GetKind() == wxT_OBJECT_PTR
)
713 value
= *v
.Get
<AddedElementType
*>();
715 value
= v
.Get
<AddedElementType
>();
718 (obj
->*(m_adder
))(value
);
721 wxASSERT_MSG(0 , wxT("SetPropertyCalled without a valid Setter") ) ;
725 // gets the property this accessor is responsible for from an object
726 wxxVariantArray
GetPropertyCollection(const wxObject
*o
) const
728 const Klass
*obj
= dynamic_cast<const Klass
*>(o
);
730 wxxVariantArray result
;
731 CollectionType::compatibility_iterator current
= (obj
->*(m_getter_ref
))().GetFirst() ;
735 result
.Add( new wxxVariant(current
->GetData()) ) ;
736 current
= current
->GetNext();
742 // set the property this accessor is responsible for in an object
743 void SetProperty(wxObject
*WXUNUSED(o
), const wxxVariant
&WXUNUSED(v
)) const
745 wxASSERT_MSG(0,wxT("SetProperty called on Collection Property")) ;
748 // gets the property this accessor is responsible for from an object
749 wxxVariant
GetProperty(const wxObject
*WXUNUSED(o
)) const
751 wxASSERT_MSG(0,wxT("GetProperty called on Collection Property")) ;
752 return wxxVariant() ;
755 // write the property this accessor is responsible for from an object into
757 void WriteValue( wxString
& s
, const wxObject
*o
) const
759 wxASSERT_MSG(0,wxT("WriteValue called on Collection Property")) ;
762 // read a wxxVariant having the correct type for the property this accessor
763 // is responsible for from a string
764 wxxVariant
ReadValue( const wxString
&value
) const
766 wxASSERT_MSG(0,wxT("ReadValue called on Collection Property")) ;
767 return wxxVariant() ;
772 getter_ref_t m_getter_ref
;
776 class WXDLLIMPEXP_BASE wxPropertyInfo
779 wxPropertyInfo( wxPropertyInfo
* &iter
, const wxChar
*name
, const wxTypeInfo
* typeInfo
, wxPropertyAccessor
*accessor
, wxxVariant dv
) :
780 m_name( name
) , m_typeInfo( typeInfo
) , m_accessor( accessor
) , m_defaultValue( dv
) , m_collectionElementTypeInfo(NULL
)
785 wxPropertyInfo( wxPropertyInfo
* &iter
, const wxChar
*name
, const wxTypeInfo
* collTypeInfo
, const wxTypeInfo
* elemTypeInfo
, wxPropertyAccessor
*accessor
) :
786 m_name( name
) , m_typeInfo( collTypeInfo
) , m_accessor( accessor
) , m_collectionElementTypeInfo(elemTypeInfo
)
791 // return the name of this property
792 const wxChar
* GetName() const { return m_name
; }
794 // return the element type info of this property (for collections, otherwise NULL)
795 const wxTypeInfo
* GetCollectionElementTypeInfo() const { return m_collectionElementTypeInfo
; }
797 // return the type info of this property
798 const wxTypeInfo
* GetTypeInfo() const { return m_typeInfo
; }
800 // return the accessor for this property
801 wxPropertyAccessor
* GetAccessor() const { return m_accessor
; }
803 // returns NULL if this is the last property of this class
804 wxPropertyInfo
* GetNext() const { return m_next
; }
806 // returns the default value of this property, its kind may be wxT_VOID if it is not valid
807 wxxVariant
GetDefaultValue() const { return m_defaultValue
; }
809 void Insert(wxPropertyInfo
* &iter
)
816 wxPropertyInfo
* i
= iter
;
824 const wxChar
* m_name
;
825 const wxChar
* m_typeName
;
826 const wxTypeInfo
* m_typeInfo
;
827 const wxTypeInfo
* m_collectionElementTypeInfo
;
828 wxPropertyAccessor
* m_accessor
;
829 wxxVariant m_defaultValue
;
830 // string representation of the default value
831 // to be assigned by the designer to the property
832 // when the component is dropped on the container.
833 wxPropertyInfo
* m_next
;
836 #define WX_BEGIN_PROPERTIES_TABLE(theClass) \
837 wxPropertyInfo *theClass::GetPropertiesStatic() \
839 typedef theClass class_t; \
840 static wxPropertyInfo* first = NULL ;
842 #define WX_END_PROPERTIES_TABLE() \
846 #if WX_XTI_TEMPLATE_FIX
848 #define WX_PROPERTY( name , type , setter , getter ,defaultValue ) \
849 static wxPropertyAccessorT<class_t , type> _accessor##name( &setter , &getter , #setter , #getter ) ; \
850 static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (type*) NULL ) ,&_accessor##name , wxxVariant(defaultValue) ) ;
852 #define WX_PROPERTY_COLLECTION( name , colltype , addelemtype , adder , getter ) \
853 static wxPropertyCollectionAccessorT<class_t , colltype , addelemtype > _accessor##name( &adder , &getter , #adder , #getter ) ; \
854 static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (colltype*) NULL ) ,wxGetTypeInfo( (addelemtype*) NULL ) ,&_accessor##name ) ;
856 #define WX_READONLY_PROPERTY_COLLECTION( name , colltype , addelemtype , getter ) \
857 static wxPropertyCollectionAccessorT<class_t , colltype , addelemtype > _accessor##name( NULL , &getter , "" , #getter ) ; \
858 static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (colltype*) NULL ) ,wxGetTypeInfo( (addelemtype*) NULL ) ,&_accessor##name ) ;
860 #define WX_PROPERTY_SET_RET_BOOL( name , type , setter , getter ,defaultValue ) \
861 static wxPropertyAccessorT<class_t , type> _accessor##name( (wxPropertyAccessor::SetRetBool*)NULL , &setter , &getter , #setter , #getter ) ; \
862 static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (type*) NULL ) ,&_accessor##name , wxxVariant(defaultValue) ) ;
864 #define WX_PROPERTY_SET_BY_REF( name , type , setter , getter ,defaultValue ) \
865 static wxPropertyAccessorT<class_t , type> _accessor##name( (wxPropertyAccessor::SetByRef*)NULL, &setter , &getter , #setter , #getter ) ; \
866 static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (type*) NULL ) ,&_accessor##name , wxxVariant(defaultValue) ) ;
868 #define WX_PROPERTY_SET_BY_REF_RET_BOOL( name , type , setter , getter ,defaultValue ) \
869 static wxPropertyAccessorT<class_t , type> _accessor##name( (wxPropertyAccessor::SetByRefRetBool*)NULL, &setter , &getter , #setter , #getter ) ; \
870 static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (type*) NULL ) ,&_accessor##name , wxxVariant(defaultValue) ) ;
872 #define WX_PROPERTY_SET_AND_GET_BY_REF_RET_BOOL( name , type , setter , getter ,defaultValue ) \
873 static wxPropertyAccessorT<class_t , type> _accessor##name( (wxPropertyAccessor::SetAndGetByRefRetBool*)NULL, &setter , &getter , #setter , #getter ) ; \
874 static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (type*) NULL ) ,&_accessor##name , wxxVariant(defaultValue) ) ;
876 #define WX_READONLY_PROPERTY( name , type , getter ,defaultValue ) \
877 static wxPropertyAccessorT<class_t , type> _accessor##name( &getter , #getter ) ; \
878 static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (type*) NULL ) ,&_accessor##name , wxxVariant(defaultValue) ) ;
880 #define WX_READONLY_PROPERTY_GET_BY_REF( name , type , getter ,defaultValue ) \
881 static wxPropertyAccessorT<class_t , type> _accessor##name( (wxPropertyAccessor::GetByRef*)NULL , &getter , #getter ) ; \
882 static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (type*) NULL ) ,&_accessor##name , wxxVariant(defaultValue) ) ;
886 #define WX_PROPERTY( name , type , setter , getter ,defaultValue ) \
887 static wxPropertyAccessorT<class_t , type> _accessor##name( &setter , &getter , #setter , #getter ) ; \
888 static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (type*) NULL ) ,&_accessor##name , wxxVariant(defaultValue) ) ;
890 #define WX_PROPERTY_COLLECTION( name , colltype , addelemtype , adder , getter ) \
891 static wxPropertyCollectionAccessorT<class_t , colltype , addelemtype > _accessor##name( &adder , &getter , #adder , #getter ) ; \
892 static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (colltype*) NULL ) ,wxGetTypeInfo( (addelemtype*) NULL ) ,&_accessor##name ) ;
894 #define WX_READONLY_PROPERTY_COLLECTION( name , colltype , addelemtype , getter ) \
895 static wxPropertyCollectionAccessorT<class_t , colltype , addelemtype > _accessor##name( NULL , &getter , "" , #getter ) ; \
896 static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (colltype*) NULL ) ,wxGetTypeInfo( (addelemtype*) NULL ) ,&_accessor##name ) ;
898 #define WX_PROPERTY_SET_RET_BOOL( name , type , setter , getter ,defaultValue ) \
899 WX_PROPERTY( name , type , setter , getter , defaultValue )
901 #define WX_PROPERTY_SET_BY_REF( name , type , setter , getter ,defaultValue ) \
902 WX_PROPERTY( name , type , setter , getter , defaultValue )
904 #define WX_PROPERTY_SET_BY_REF_RET_BOOL( name , type , setter , getter ,defaultValue ) \
905 WX_PROPERTY( name , type , setter , getter , defaultValue )
907 #define WX_PROPERTY_SET_AND_GET_BY_REF_RET_BOOL( name , type , setter , getter ,defaultValue ) \
908 WX_PROPERTY( name , type , setter , getter , defaultValue )
910 #define WX_READONLY_PROPERTY( name , type , getter ,defaultValue ) \
911 static wxPropertyAccessorT<class_t , type> _accessor##name( &getter , #getter ) ; \
912 static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (type*) NULL ) ,&_accessor##name , wxxVariant(defaultValue) ) ;
914 #define WX_READONLY_PROPERTY_GET_BY_REF( name , type , getter ,defaultValue ) \
915 WX_READONLY_PROPERTY( name , type , getter , defaultValue )
920 #define WX_DELEGATE( name , eventType , eventClass ) \
921 static wxDelegateTypeInfo _typeInfo##name( eventType , CLASSINFO( eventClass ) ) ; \
922 static wxPropertyInfo _propertyInfo##name( first , #name , &_typeInfo##name , NULL , wxxVariant() ) ; \
924 // ----------------------------------------------------------------------------
927 // this is describing an event sink
928 // ----------------------------------------------------------------------------
933 wxHandlerInfo( wxHandlerInfo
* &iter
, const wxChar
*name
, wxObjectEventFunction address
, const wxClassInfo
* eventClassInfo
) :
934 m_name( name
) , m_eventClassInfo( eventClassInfo
) , m_eventFunction( address
)
941 wxHandlerInfo
* i
= iter
;
949 // get the name of the handler method
950 const wxChar
* GetName() const { return m_name
; }
952 // return the class info of the event
953 const wxClassInfo
* GetEventClassInfo() const { return m_eventClassInfo
; }
955 // get the handler function pointer
956 wxObjectEventFunction
GetEventFunction() const { return m_eventFunction
; }
958 // returns NULL if this is the last handler of this class
959 wxHandlerInfo
* GetNext() const { return m_next
; }
961 wxObjectEventFunction m_eventFunction
;
962 const wxChar
* m_name
;
963 const wxClassInfo
* m_eventClassInfo
;
964 wxHandlerInfo
* m_next
;
967 #define WX_HANDLER(name,eventClassType) \
968 static wxHandlerInfo _handlerInfo##name( first , #name , (wxObjectEventFunction) (wxEventFunction) &name , CLASSINFO( eventClassType ) ) ;
970 #define WX_BEGIN_HANDLERS_TABLE(theClass) \
971 wxHandlerInfo *theClass::GetHandlersStatic() \
973 typedef theClass class_t; \
974 static wxHandlerInfo* first = NULL ;
976 #define WX_END_HANDLERS_TABLE() \
979 // ----------------------------------------------------------------------------
980 // Constructor Bridges
982 // allow to set up constructors with params during runtime
983 // ----------------------------------------------------------------------------
985 class WXDLLIMPEXP_BASE wxConstructorBridge
988 virtual void Create(wxObject
*o
, wxxVariant
*args
) = 0;
991 // Creator Bridges for all Numbers of Params
995 template<typename Class
>
996 struct wxConstructorBridge_0
: public wxConstructorBridge
998 void Create(wxObject
*o
, wxxVariant
*)
1000 Class
*obj
= dynamic_cast<Class
*>(o
);
1005 struct wxConstructorBridge_Dummy
: public wxConstructorBridge
1007 void Create(wxObject
*, wxxVariant
*)
1012 #define WX_CONSTRUCTOR_0(klass) \
1013 wxConstructorBridge_0<klass> constructor##klass ; \
1014 wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \
1015 const wxChar *klass::sm_constructorProperties##klass[] = { NULL } ; \
1016 const int klass::sm_constructorPropertiesCount##klass = 0 ;
1018 #define WX_CONSTRUCTOR_DUMMY(klass) \
1019 wxConstructorBridge_Dummy constructor##klass ; \
1020 wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \
1021 const wxChar *klass::sm_constructorProperties##klass[] = { NULL } ; \
1022 const int klass::sm_constructorPropertiesCount##klass = 0 ;
1026 template<typename Class
, typename T0
>
1027 struct wxConstructorBridge_1
: public wxConstructorBridge
1029 void Create(wxObject
*o
, wxxVariant
*args
)
1031 Class
*obj
= dynamic_cast<Class
*>(o
);
1038 #define WX_CONSTRUCTOR_1(klass,t0,v0) \
1039 wxConstructorBridge_1<klass,t0> constructor##klass ; \
1040 wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \
1041 const wxChar *klass::sm_constructorProperties##klass[] = { #v0 } ; \
1042 const int klass::sm_constructorPropertiesCount##klass = 1 ;
1046 template<typename Class
,
1047 typename T0
, typename T1
>
1048 struct wxConstructorBridge_2
: public wxConstructorBridge
1050 void Create(wxObject
*o
, wxxVariant
*args
)
1052 Class
*obj
= dynamic_cast<Class
*>(o
);
1060 #define WX_CONSTRUCTOR_2(klass,t0,v0,t1,v1) \
1061 wxConstructorBridge_2<klass,t0,t1> constructor##klass ; \
1062 wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \
1063 const wxChar *klass::sm_constructorProperties##klass[] = { #v0 , #v1 } ; \
1064 const int klass::sm_constructorPropertiesCount##klass = 2;
1068 template<typename Class
,
1069 typename T0
, typename T1
, typename T2
>
1070 struct wxConstructorBridge_3
: public wxConstructorBridge
1072 void Create(wxObject
*o
, wxxVariant
*args
)
1074 Class
*obj
= dynamic_cast<Class
*>(o
);
1083 #define WX_CONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \
1084 wxConstructorBridge_3<klass,t0,t1,t2> constructor##klass ; \
1085 wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \
1086 const wxChar *klass::sm_constructorProperties##klass[] = { #v0 , #v1 , #v2 } ; \
1087 const int klass::sm_constructorPropertiesCount##klass = 3 ;
1091 template<typename Class
,
1092 typename T0
, typename T1
, typename T2
, typename T3
>
1093 struct wxConstructorBridge_4
: public wxConstructorBridge
1095 void Create(wxObject
*o
, wxxVariant
*args
)
1097 Class
*obj
= dynamic_cast<Class
*>(o
);
1107 #define WX_CONSTRUCTOR_4(klass,t0,v0,t1,v1,t2,v2,t3,v3) \
1108 wxConstructorBridge_4<klass,t0,t1,t2,t3> constructor##klass ; \
1109 wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \
1110 const wxChar *klass::sm_constructorProperties##klass[] = { #v0 , #v1 , #v2 , #v3 } ; \
1111 const int klass::sm_constructorPropertiesCount##klass = 4 ;
1115 template<typename Class
,
1116 typename T0
, typename T1
, typename T2
, typename T3
, typename T4
>
1117 struct wxConstructorBridge_5
: public wxConstructorBridge
1119 void Create(wxObject
*o
, wxxVariant
*args
)
1121 Class
*obj
= dynamic_cast<Class
*>(o
);
1132 #define WX_CONSTRUCTOR_5(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4) \
1133 wxConstructorBridge_5<klass,t0,t1,t2,t3,t4> constructor##klass ; \
1134 wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \
1135 const wxChar *klass::sm_constructorProperties##klass[] = { #v0 , #v1 , #v2 , #v3 , #v4 } ; \
1136 const int klass::sm_constructorPropertiesCount##klass = 5;
1140 template<typename Class
,
1141 typename T0
, typename T1
, typename T2
, typename T3
, typename T4
, typename T5
>
1142 struct wxConstructorBridge_6
: public wxConstructorBridge
1144 void Create(wxObject
*o
, wxxVariant
*args
)
1146 Class
*obj
= dynamic_cast<Class
*>(o
);
1158 #define WX_CONSTRUCTOR_6(klass,t0,v0,t1,v1,t2,v2,t3,v3,t4,v4,t5,v5) \
1159 wxConstructorBridge_6<klass,t0,t1,t2,t3,t4,t5> constructor##klass ; \
1160 wxConstructorBridge* klass::sm_constructor##klass = &constructor##klass ; \
1161 const wxChar *klass::sm_constructorProperties##klass[] = { #v0 , #v1 , #v2 , #v3 , #v4 , #v5 } ; \
1162 const int klass::sm_constructorPropertiesCount##klass = 6;
1165 // ----------------------------------------------------------------------------
1167 // ----------------------------------------------------------------------------
1169 typedef wxObject
*(*wxObjectConstructorFn
)(void);
1170 typedef wxObject
* (*wxVariantToObjectConverter
)( wxxVariant
&data
) ;
1171 typedef wxxVariant (*wxObjectToVariantConverter
)( wxObject
* ) ;
1173 class WXDLLIMPEXP_BASE wxClassInfo
1176 wxClassInfo(const wxClassInfo
**_Parents
,
1177 const wxChar
*_UnitName
,
1178 const wxChar
*_ClassName
,
1180 wxObjectConstructorFn ctor
,
1181 wxPropertyInfo
*_Props
,
1182 wxHandlerInfo
*_Handlers
,
1183 wxConstructorBridge
* _Constructor
,
1184 const wxChar
** _ConstructorProperties
,
1185 const int _ConstructorPropertiesCount
,
1186 wxVariantToObjectConverter _PtrConverter1
,
1187 wxVariantToObjectConverter _Converter2
,
1188 wxObjectToVariantConverter _Converter3
1189 ) : m_parents(_Parents
) , m_unitName(_UnitName
) ,m_className(_ClassName
),
1190 m_objectSize(size
), m_objectConstructor(ctor
) , m_firstProperty(_Props
) , m_firstHandler(_Handlers
) , m_constructor( _Constructor
) ,
1191 m_constructorProperties(_ConstructorProperties
) , m_constructorPropertiesCount(_ConstructorPropertiesCount
),
1192 m_variantOfPtrToObjectConverter( _PtrConverter1
) , m_variantToObjectConverter( _Converter2
) , m_objectToVariantConverter( _Converter3
) , m_next(sm_first
)
1198 wxClassInfo(const wxChar
*_UnitName
, const wxChar
*_ClassName
, const wxClassInfo
**_Parents
) : m_parents(_Parents
) , m_unitName(_UnitName
) ,m_className(_ClassName
),
1199 m_objectSize(0), m_objectConstructor(NULL
) , m_firstProperty(NULL
) , m_firstHandler(NULL
) , m_constructor( NULL
) ,
1200 m_constructorProperties(NULL
) , m_constructorPropertiesCount(NULL
),
1201 m_variantOfPtrToObjectConverter( NULL
) , m_variantToObjectConverter( NULL
) , m_objectToVariantConverter( NULL
) , m_next(sm_first
)
1207 virtual ~wxClassInfo() ;
1209 // allocates an instance of this class, this object does not have to be initialized or fully constructed
1210 // as this call will be followed by a call to Create
1211 virtual wxObject
*AllocateObject() const { return m_objectConstructor
? (*m_objectConstructor
)() : 0; }
1213 // 'old naming' for AllocateObject staying here for backward compatibility
1214 wxObject
*CreateObject() const { return AllocateObject() ; }
1216 const wxChar
*GetClassName() const { return m_className
; }
1217 const wxClassInfo
**GetParents() const { return m_parents
; }
1218 int GetSize() const { return m_objectSize
; }
1220 wxObjectConstructorFn
GetConstructor() const { return m_objectConstructor
; }
1221 static const wxClassInfo
*GetFirst() { return sm_first
; }
1222 const wxClassInfo
*GetNext() const { return m_next
; }
1223 static wxClassInfo
*FindClass(const wxChar
*className
);
1225 // Climb upwards through inheritance hierarchy.
1226 // Dual inheritance is catered for.
1228 bool IsKindOf(const wxClassInfo
*info
) const
1235 for ( int i
= 0 ; m_parents
[i
] ; ++ i
)
1237 if ( m_parents
[i
]->IsKindOf( info
) )
1244 #ifdef WXWIN_COMPATIBILITY_2_4
1245 // Initializes parent pointers and hash table for fast searching.
1246 wxDEPRECATED( static void InitializeClasses() );
1247 // Cleans up hash table used for fast searching.
1248 wxDEPRECATED( static void CleanUpClasses() );
1250 static void CleanUp();
1252 // returns the first property
1253 const wxPropertyInfo
* GetFirstProperty() const { return m_firstProperty
; }
1255 // returns the first handler
1256 const wxHandlerInfo
* GetFirstHandler() const { return m_firstHandler
; }
1258 // Call the Create upon an instance of the class, in the end the object is fully
1260 virtual void Create (wxObject
*object
, int ParamCount
, wxxVariant
*Params
) const
1262 wxASSERT_MSG( ParamCount
== m_constructorPropertiesCount
, wxT("Illegal Parameter Count for Create Method")) ;
1263 m_constructor
->Create( object
, Params
) ;
1266 // get number of parameters for constructor
1267 virtual int GetCreateParamCount() const { return m_constructorPropertiesCount
; }
1269 // get n-th constructor parameter
1270 virtual const wxChar
* GetCreateParamName(int n
) const { return m_constructorProperties
[n
] ; }
1272 // Runtime access to objects for simple properties (get/set) by property name, and variant data
1273 virtual void SetProperty (wxObject
*object
, const wxChar
*propertyName
, const wxxVariant
&value
) const ;
1274 virtual wxxVariant
GetProperty (wxObject
*object
, const wxChar
*propertyName
) const;
1276 // Runtime access to objects for collection properties by property name
1277 virtual wxxVariantArray
GetPropertyCollection(wxObject
*object
, const wxChar
*propertyName
) const ;
1278 virtual void AddToPropertyCollection(wxObject
*object
, const wxChar
*propertyName
, const wxxVariant
& value
) const ;
1280 // we must be able to cast variants to wxObject pointers, templates seem not to be suitable
1281 wxObject
* VariantToInstance( wxxVariant
&data
) const
1282 { if ( data
.GetTypeInfo()->GetKind() == wxT_OBJECT
)
1283 return m_variantToObjectConverter( data
) ;
1285 return m_variantOfPtrToObjectConverter( data
) ;
1288 wxxVariant
InstanceToVariant( wxObject
*object
) const { return m_objectToVariantConverter( object
) ; }
1290 // find property by name
1291 virtual const wxPropertyInfo
*FindPropertyInfo (const wxChar
*PropertyName
) const ;
1293 // find handler by name
1294 virtual const wxHandlerInfo
*FindHandlerInfo (const wxChar
*PropertyName
) const ;
1296 // find property by name
1297 virtual const wxPropertyInfo
*FindPropertyInfoInThisClass (const wxChar
*PropertyName
) const ;
1299 // find handler by name
1300 virtual const wxHandlerInfo
*FindHandlerInfoInThisClass (const wxChar
*PropertyName
) const ;
1302 const wxChar
*m_className
;
1304 wxObjectConstructorFn m_objectConstructor
;
1306 // class info object live in a linked list:
1307 // pointers to its head and the next element in it
1309 static wxClassInfo
*sm_first
;
1310 wxClassInfo
*m_next
;
1312 // FIXME: this should be private (currently used directly by way too
1314 static wxHashTable
*sm_classTable
;
1317 wxPropertyInfo
* m_firstProperty
;
1318 wxHandlerInfo
* m_firstHandler
;
1320 const wxClassInfo
** m_parents
;
1321 const wxChar
* m_unitName
;
1323 wxConstructorBridge
* m_constructor
;
1324 const wxChar
** m_constructorProperties
;
1325 const int m_constructorPropertiesCount
;
1326 wxVariantToObjectConverter m_variantOfPtrToObjectConverter
;
1327 wxVariantToObjectConverter m_variantToObjectConverter
;
1328 wxObjectToVariantConverter m_objectToVariantConverter
;
1330 const wxPropertyAccessor
*FindAccessor (const wxChar
*propertyName
) const ;
1333 // InitializeClasses() helper
1334 static wxClassInfo
*GetBaseByName(const wxChar
*name
) ;
1337 // registers the class
1341 DECLARE_NO_COPY_CLASS(wxClassInfo
)
1345 WXDLLIMPEXP_BASE wxObject
*wxCreateDynamicObject(const wxChar
*name
);
1347 // ----------------------------------------------------------------------------
1349 // ----------------------------------------------------------------------------
1351 // this object leads to having a pure runtime-instantiation
1353 class wxDynamicClassInfo
: public wxClassInfo
1356 wxDynamicClassInfo( const wxChar
*_UnitName
, const wxChar
*_ClassName
, const wxClassInfo
* superClass
) ;
1357 virtual ~wxDynamicClassInfo() ;
1359 // constructs a wxDynamicObject with an instance
1360 virtual wxObject
*AllocateObject() const ;
1362 // Call the Create method for a class
1363 virtual void Create (wxObject
*object
, int ParamCount
, wxxVariant
*Params
) const ;
1365 // get number of parameters for constructor
1366 virtual int GetCreateParamCount() const ;
1368 // get i-th constructor parameter
1369 virtual const wxChar
* GetCreateParamName(int i
) const ;
1371 // Runtime access to objects by property name, and variant data
1372 virtual void SetProperty (wxObject
*object
, const wxChar
*PropertyName
, const wxxVariant
&Value
) const ;
1373 virtual wxxVariant
GetProperty (wxObject
*object
, const wxChar
*PropertyName
) const ;
1375 void AddProperty( const wxChar
*propertyName
, const wxTypeInfo
* typeInfo
) ;
1376 void AddHandler( const wxChar
*handlerName
, wxObjectEventFunction address
, const wxClassInfo
* eventClassInfo
) ;
1379 // ----------------------------------------------------------------------------
1380 // Dynamic class macros
1381 // ----------------------------------------------------------------------------
1383 #define _DECLARE_DYNAMIC_CLASS(name) \
1385 static wxClassInfo sm_class##name; \
1386 static const wxClassInfo* sm_classParents##name[] ; \
1387 static wxPropertyInfo* GetPropertiesStatic() ; \
1388 static wxHandlerInfo* GetHandlersStatic() ; \
1389 virtual wxClassInfo *GetClassInfo() const \
1390 { return &name::sm_class##name; }
1392 #define DECLARE_DYNAMIC_CLASS(name) \
1393 static wxConstructorBridge* sm_constructor##name ; \
1394 static const wxChar * sm_constructorProperties##name[] ; \
1395 static const int sm_constructorPropertiesCount##name ; \
1396 _DECLARE_DYNAMIC_CLASS(name)
1398 #define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \
1399 DECLARE_NO_ASSIGN_CLASS(name) \
1400 DECLARE_DYNAMIC_CLASS(name)
1402 #define DECLARE_DYNAMIC_CLASS_NO_COPY(name) \
1403 DECLARE_NO_COPY_CLASS(name) \
1404 DECLARE_DYNAMIC_CLASS(name)
1406 #define DECLARE_ABSTRACT_CLASS(name) _DECLARE_DYNAMIC_CLASS(name)
1407 #define DECLARE_CLASS(name) DECLARE_DYNAMIC_CLASS(name)
1409 // -----------------------------------
1410 // for concrete classes
1411 // -----------------------------------
1413 // Single inheritance with one base class
1415 #define _IMPLEMENT_DYNAMIC_CLASS(name, basename, unit) \
1416 wxObject* wxConstructorFor##name() \
1417 { return new name; } \
1418 const wxClassInfo* name::sm_classParents##name[] = { &basename::sm_class##basename ,NULL } ; \
1419 wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.Get<name*>() ; } \
1420 wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast<name*> (data) ) ; } \
1421 wxClassInfo name::sm_class##name(sm_classParents##name , wxT(unit) , wxT(#name), \
1422 (int) sizeof(name), \
1423 (wxObjectConstructorFn) wxConstructorFor##name , \
1424 name::GetPropertiesStatic(),name::GetHandlersStatic(),name::sm_constructor##name , name::sm_constructorProperties##name , \
1425 name::sm_constructorPropertiesCount##name , wxVariantOfPtrToObjectConverter##name , NULL , wxObjectToVariantConverter##name); \
1426 template<> void wxStringReadValue(const wxString & , name & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") ) ;}\
1427 template<> void wxStringWriteValue(wxString & , name const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1428 template<> void wxStringReadValue(const wxString & , name * & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") ) ;}\
1429 template<> void wxStringWriteValue(wxString & , name* const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1430 template<> void wxStringReadValue(const wxString & , name ** & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1431 template<> void wxStringWriteValue(wxString & , name** const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1432 template<> const wxTypeInfo* wxGetTypeInfo( name *** ){ static wxBuiltInTypeInfo s_typeInfo(wxT_VOID ) ; wxASSERT_MSG(0 , wxT("illegal specialization called") ) ; return &s_typeInfo ; } \
1433 template<> const wxTypeInfo* wxGetTypeInfo( name * ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT , &name::sm_class##name) ; return &s_typeInfo ; } \
1434 template<> const wxTypeInfo* wxGetTypeInfo( name ** ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &name::sm_class##name) ; return &s_typeInfo ; }
1436 #define _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY(name, basename, unit) \
1437 wxObject* wxConstructorFor##name() \
1438 { return new name; } \
1439 const wxClassInfo* name::sm_classParents##name[] = { &basename::sm_class##basename ,NULL } ; \
1440 wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return &data.Get<name>() ; } \
1441 wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.Get<name*>() ; } \
1442 wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast<name*> (data) ) ; } \
1443 wxClassInfo name::sm_class##name(sm_classParents##name , wxT(unit) , wxT(#name), \
1444 (int) sizeof(name), \
1445 (wxObjectConstructorFn) wxConstructorFor##name , \
1446 name::GetPropertiesStatic(),name::GetHandlersStatic(),name::sm_constructor##name , name::sm_constructorProperties##name , \
1447 name::sm_constructorPropertiesCount##name , wxVariantOfPtrToObjectConverter##name , wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \
1448 template<> void wxStringReadValue(const wxString & , name & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") ) ;}\
1449 template<> void wxStringWriteValue(wxString & , name const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1450 template<> void wxStringReadValue(const wxString & , name * & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") ) ;}\
1451 template<> void wxStringWriteValue(wxString & , name* const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1452 template<> void wxStringReadValue(const wxString & , name ** & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1453 template<> void wxStringWriteValue(wxString & , name** const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1454 template<> const wxTypeInfo* wxGetTypeInfo( name *** ){ static wxBuiltInTypeInfo s_typeInfo(wxT_VOID ) ; wxASSERT_MSG(0 , wxT("illegal specialization called") ) ; return &s_typeInfo ; } \
1455 template<> const wxTypeInfo* wxGetTypeInfo( name * ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT , &name::sm_class##name) ; return &s_typeInfo ; } \
1456 template<> const wxTypeInfo* wxGetTypeInfo( name ** ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &name::sm_class##name) ; return &s_typeInfo ; }
1458 #define IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename ) \
1459 _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , "" ) \
1460 const wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \
1461 const wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \
1462 WX_CONSTRUCTOR_DUMMY( name )
1464 #define IMPLEMENT_DYNAMIC_CLASS( name , basename ) \
1465 _IMPLEMENT_DYNAMIC_CLASS( name , basename , "" ) \
1466 wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \
1467 wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \
1468 WX_CONSTRUCTOR_DUMMY( name )
1470 #define IMPLEMENT_DYNAMIC_CLASS_XTI( name , basename , unit ) \
1471 _IMPLEMENT_DYNAMIC_CLASS( name , basename , unit )
1473 #define IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI( name , basename , unit ) \
1474 _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name , basename , unit )
1476 // this is for classes that do not derive from wxobject, there are no creators for these
1478 #define IMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_NO_BASE_XTI( name , unit ) \
1479 const wxClassInfo* name::sm_classParents##name[] = { NULL } ; \
1480 wxClassInfo name::sm_class##name(sm_classParents##name , wxT("") , wxT(#name), \
1481 (int) sizeof(name), \
1482 (wxObjectConstructorFn) 0 , \
1483 name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \
1485 template<> void wxStringReadValue(const wxString & , name * & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1486 template<> void wxStringWriteValue(wxString & , name* const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1487 template<> void wxStringReadValue(const wxString & , name ** & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1488 template<> void wxStringWriteValue(wxString & , name** const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1489 template<> const wxTypeInfo* wxGetTypeInfo( name *** ){ static wxBuiltInTypeInfo s_typeInfo(wxT_VOID ) ; wxASSERT_MSG(0 , wxT("illegal specialization called") ) ; return &s_typeInfo ; } \
1490 template<> const wxTypeInfo* wxGetTypeInfo( name * ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT , &name::sm_class##name) ; return &s_typeInfo ; } \
1491 template<> const wxTypeInfo* wxGetTypeInfo( name ** ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &name::sm_class##name) ; return &s_typeInfo ; }
1493 // this is for subclasses that still do not derive from wxobject
1495 #define IMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_XTI( name , basename, unit ) \
1496 const wxClassInfo* name::sm_classParents##name[] = { &basename::sm_class##basename ,NULL } ; \
1497 wxClassInfo name::sm_class##name(sm_classParents##name , wxT("") , wxT(#name), \
1498 (int) sizeof(name), \
1499 (wxObjectConstructorFn) 0 , \
1500 name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \
1502 template<> void wxStringReadValue(const wxString & , name * & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1503 template<> void wxStringWriteValue(wxString & , name* const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1504 template<> void wxStringReadValue(const wxString & , name ** & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1505 template<> void wxStringWriteValue(wxString & , name** const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1506 template<> const wxTypeInfo* wxGetTypeInfo( name *** ){ static wxBuiltInTypeInfo s_typeInfo(wxT_VOID ) ; wxASSERT_MSG(0 , wxT("illegal specialization called") ) ; return &s_typeInfo ; } \
1507 template<> const wxTypeInfo* wxGetTypeInfo( name * ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT , &name::sm_class##name) ; return &s_typeInfo ; } \
1508 template<> const wxTypeInfo* wxGetTypeInfo( name ** ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &name::sm_class##name) ; return &s_typeInfo ; }
1511 // Multiple inheritance with two base classes
1513 #define _IMPLEMENT_DYNAMIC_CLASS2(name, basename, basename2, unit) \
1514 wxObject* wxConstructorFor##name() \
1515 { return new name; } \
1516 const wxClassInfo* name::sm_classParents##name[] = { &basename::sm_class##basename ,&basename2::sm_class##basename2 , NULL } ; \
1517 wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return data.Get<name*>() ; } \
1518 wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast<name*> (data) ) ; } \
1519 wxClassInfo name::sm_class##name(sm_classParents##name , wxT(unit) , wxT(#name), \
1520 (int) sizeof(name), \
1521 (wxObjectConstructorFn) wxConstructorFor##name , \
1522 name::GetPropertiesStatic(),name::GetHandlersStatic(),name::sm_constructor##name , name::sm_constructorProperties##name , \
1523 name::sm_constructorPropertiesCount##name , wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \
1524 template<> void wxStringReadValue(const wxString & , name * & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1525 template<> void wxStringWriteValue(wxString & , name* const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1526 template<> void wxStringReadValue(const wxString & , name ** & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1527 template<> void wxStringWriteValue(wxString & , name** const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1528 template<> const wxTypeInfo* wxGetTypeInfo( name *** ){ static wxBuiltInTypeInfo s_typeInfo(wxT_VOID ) ; wxASSERT_MSG(0 , wxT("illegal specialization called") ) ; return &s_typeInfo ; } \
1529 template<> const wxTypeInfo* wxGetTypeInfo( name * ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT , &name::sm_class##name) ; return &s_typeInfo ; } \
1530 template<> const wxTypeInfo* wxGetTypeInfo( name ** ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &name::sm_class##name) ; return &s_typeInfo ; }
1532 #define IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2) \
1533 _IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2 , "") \
1534 wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \
1535 wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \
1536 WX_CONSTRUCTOR_DUMMY( name )
1538 #define IMPLEMENT_DYNAMIC_CLASS2_XTI( name , basename , basename2, unit) \
1539 _IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2 , unit)
1541 // -----------------------------------
1542 // for abstract classes
1543 // -----------------------------------
1545 // Single inheritance with one base class
1547 #define _IMPLEMENT_ABSTRACT_CLASS(name, basename) \
1548 const wxClassInfo* name::sm_classParents##name[] = { &basename::sm_class##basename ,NULL } ; \
1549 wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return data.Get<name*>() ; } \
1550 wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.Get<name*>() ; } \
1551 wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast<name*> (data) ) ; } \
1552 wxClassInfo name::sm_class##name(sm_classParents##name , wxT("") , wxT(#name), \
1553 (int) sizeof(name), \
1554 (wxObjectConstructorFn) 0 , \
1555 name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \
1556 0 , wxVariantOfPtrToObjectConverter##name ,wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \
1557 template<> void wxStringReadValue(const wxString & , name * & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1558 template<> void wxStringWriteValue(wxString & , name* const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1559 template<> void wxStringReadValue(const wxString & , name ** & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1560 template<> void wxStringWriteValue(wxString & , name** const & ){wxASSERT_MSG( 0 , wxT("Illegal Spezialication Called") );}\
1561 template<> const wxTypeInfo* wxGetTypeInfo( name * ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT , &name::sm_class##name) ; return &s_typeInfo ; } \
1562 template<> const wxTypeInfo* wxGetTypeInfo( name ** ){ static wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &name::sm_class##name) ; return &s_typeInfo ; } \
1563 template<> const wxTypeInfo* wxGetTypeInfo( name *** ){ static wxBuiltInTypeInfo s_typeInfo(wxT_VOID) ; assert(0) ; return &s_typeInfo ; }
1565 #define IMPLEMENT_ABSTRACT_CLASS( name , basename ) \
1566 _IMPLEMENT_ABSTRACT_CLASS( name , basename ) \
1567 wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \
1568 wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; }
1570 // Multiple inheritance with two base classes
1572 #define IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \
1573 wxClassInfo name::sm_class##name(wxT(#name), wxT(#basename1), \
1574 wxT(#basename2), (int) sizeof(name), \
1575 (wxObjectConstructorFn) 0);
1577 #define IMPLEMENT_CLASS IMPLEMENT_ABSTRACT_CLASS
1578 #define IMPLEMENT_CLASS2 IMPLEMENT_ABSTRACT_CLASS2