- // returns true if this accessor has a setter
- bool HasSetter() const { return false ;}
-
- // return true if this accessor has a getter
- bool HasGetter() const { return m_getter != NULL ;}
-
- // return true if this accessor has a getter
- bool HasAdder() const { return m_adder != NULL ;}
-
- // set the property this accessor is responsible for in an object
- void AddToPropertyCollection(wxObject *o, const wxxVariant &v) const
- {
- Klass *obj = dynamic_cast<Klass*>(o);
- AddedElementType value ;
-
- if ( wxGetTypeInfo((AddedElementType*)NULL)->GetKind() == wxT_OBJECT && v.GetTypeInfo()->GetKind() == wxT_OBJECT_PTR )
- value = *v.Get<AddedElementType*>();
- else
- value = v.Get<AddedElementType>();
-
- if (m_adder)
- (obj->*(m_adder))(value);
- else
- {
- wxASSERT_MSG(0 , wxT("SetPropertyCalled without a valid Setter") ) ;
- }
- }
-
- // gets the property this accessor is responsible for from an object
- wxxVariantArray GetPropertyCollection(const wxObject *o) const
- {
- const Klass *obj = dynamic_cast<const Klass*>(o);
-
- wxxVariantArray result ;
- CollectionType::compatibility_iterator current = (obj->*(m_getter_ref))().GetFirst() ;
-
- while (current)
- {
- result.Add( new wxxVariant(current->GetData()) ) ;
- current = current->GetNext();
- }
- return result ;
- }
-
-
- // set the property this accessor is responsible for in an object
- void SetProperty(wxObject *WXUNUSED(o), const wxxVariant &WXUNUSED(v)) const
- {
- wxASSERT_MSG(0,wxT("SetProperty called on Collection Property")) ;
- }
-
- // gets the property this accessor is responsible for from an object
- wxxVariant GetProperty(const wxObject *WXUNUSED(o)) const
- {
- wxASSERT_MSG(0,wxT("GetProperty called on Collection Property")) ;
- return wxxVariant() ;
- }
-
- // write the property this accessor is responsible for from an object into
- // a string
- void WriteValue( wxString& s , const wxObject *o ) const
- {
- wxASSERT_MSG(0,wxT("WriteValue called on Collection Property")) ;
- }
-
- // read a wxxVariant having the correct type for the property this accessor
- // is responsible for from a string
- wxxVariant ReadValue( const wxString &value ) const
- {
- wxASSERT_MSG(0,wxT("ReadValue called on Collection Property")) ;
- return wxxVariant() ;
- }
-
-private :
- getter_t m_getter;
- getter_ref_t m_getter_ref ;
- adder_t m_adder;
-};
-
-class WXDLLIMPEXP_BASE wxPropertyInfo
-{
-public :
- wxPropertyInfo( wxPropertyInfo* &iter , const wxChar *name , const wxTypeInfo* typeInfo , wxPropertyAccessor *accessor , wxxVariant dv ) :
- m_name( name ) , m_typeInfo( typeInfo ) , m_accessor( accessor ) , m_defaultValue( dv ) , m_collectionElementTypeInfo(NULL)
- {
- Insert(iter) ;
- }
-
- wxPropertyInfo( wxPropertyInfo* &iter , const wxChar *name , const wxTypeInfo* collTypeInfo , const wxTypeInfo* elemTypeInfo , wxPropertyAccessor *accessor ) :
- m_name( name ) , m_typeInfo( collTypeInfo ) , m_accessor( accessor ) , m_collectionElementTypeInfo(elemTypeInfo)
- {
- Insert(iter) ;
- }
-
- // return the name of this property
- const wxChar * GetName() const { return m_name ; }
-
- // return the element type info of this property (for collections, otherwise NULL)
- const wxTypeInfo * GetCollectionElementTypeInfo() const { return m_collectionElementTypeInfo ; }
-
- // return the type info of this property
- const wxTypeInfo * GetTypeInfo() const { return m_typeInfo ; }
-
- // return the accessor for this property
- wxPropertyAccessor* GetAccessor() const { return m_accessor ; }
-
- // returns NULL if this is the last property of this class
- wxPropertyInfo* GetNext() const { return m_next ; }
-
- // returns the default value of this property, its kind may be wxT_VOID if it is not valid
- wxxVariant GetDefaultValue() const { return m_defaultValue ; }
-private :
- void Insert(wxPropertyInfo* &iter)
- {
- m_next = NULL ;
- if ( iter == NULL )
- iter = this ;
- else
- {
- wxPropertyInfo* i = iter ;
- while( i->m_next )
- i = i->m_next ;
-
- i->m_next = this ;
- }
- }
-
- const wxChar * m_name;
- const wxChar * m_typeName ;
- const wxTypeInfo* m_typeInfo ;
- const wxTypeInfo* m_collectionElementTypeInfo ;
- wxPropertyAccessor* m_accessor ;
- wxxVariant m_defaultValue;
- // string representation of the default value
- // to be assigned by the designer to the property
- // when the component is dropped on the container.
- wxPropertyInfo* m_next ;
-};
-
-#define WX_BEGIN_PROPERTIES_TABLE(theClass) \
- wxPropertyInfo *theClass::GetPropertiesStatic() \
- { \
- typedef theClass class_t; \
- static wxPropertyInfo* first = NULL ;
-
-#define WX_END_PROPERTIES_TABLE() \
- return first ; }
-
-
-#if WX_XTI_TEMPLATE_FIX
-
-#define WX_PROPERTY( name , type , setter , getter ,defaultValue ) \
- static wxPropertyAccessorT<class_t , type> _accessor##name( &setter , &getter , #setter , #getter ) ; \
- static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (type*) NULL ) ,&_accessor##name , wxxVariant(defaultValue) ) ;
-
-#define WX_PROPERTY_COLLECTION( name , colltype , addelemtype , adder , getter ) \
- static wxPropertyCollectionAccessorT<class_t , colltype , addelemtype > _accessor##name( &adder , &getter , #adder , #getter ) ; \
- static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (colltype*) NULL ) ,wxGetTypeInfo( (addelemtype*) NULL ) ,&_accessor##name ) ;
-
-#define WX_READONLY_PROPERTY_COLLECTION( name , colltype , addelemtype , getter ) \
- static wxPropertyCollectionAccessorT<class_t , colltype , addelemtype > _accessor##name( NULL , &getter , "" , #getter ) ; \
- static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (colltype*) NULL ) ,wxGetTypeInfo( (addelemtype*) NULL ) ,&_accessor##name ) ;
-
-#define WX_PROPERTY_SET_RET_BOOL( name , type , setter , getter ,defaultValue ) \
- static wxPropertyAccessorT<class_t , type> _accessor##name( (wxPropertyAccessor::SetRetBool*)NULL , &setter , &getter , #setter , #getter ) ; \
- static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (type*) NULL ) ,&_accessor##name , wxxVariant(defaultValue) ) ;
-
-#define WX_PROPERTY_SET_BY_REF( name , type , setter , getter ,defaultValue ) \
- static wxPropertyAccessorT<class_t , type> _accessor##name( (wxPropertyAccessor::SetByRef*)NULL, &setter , &getter , #setter , #getter ) ; \
- static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (type*) NULL ) ,&_accessor##name , wxxVariant(defaultValue) ) ;
-
-#define WX_PROPERTY_SET_BY_REF_RET_BOOL( name , type , setter , getter ,defaultValue ) \
- static wxPropertyAccessorT<class_t , type> _accessor##name( (wxPropertyAccessor::SetByRefRetBool*)NULL, &setter , &getter , #setter , #getter ) ; \
- static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (type*) NULL ) ,&_accessor##name , wxxVariant(defaultValue) ) ;
-
-#define WX_PROPERTY_SET_AND_GET_BY_REF_RET_BOOL( name , type , setter , getter ,defaultValue ) \
- static wxPropertyAccessorT<class_t , type> _accessor##name( (wxPropertyAccessor::SetAndGetByRefRetBool*)NULL, &setter , &getter , #setter , #getter ) ; \
- static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (type*) NULL ) ,&_accessor##name , wxxVariant(defaultValue) ) ;
-
-#define WX_READONLY_PROPERTY( name , type , getter ,defaultValue ) \
- static wxPropertyAccessorT<class_t , type> _accessor##name( &getter , #getter ) ; \
- static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (type*) NULL ) ,&_accessor##name , wxxVariant(defaultValue) ) ;
-
-#define WX_READONLY_PROPERTY_GET_BY_REF( name , type , getter ,defaultValue ) \
- static wxPropertyAccessorT<class_t , type> _accessor##name( (wxPropertyAccessor::GetByRef*)NULL , &getter , #getter ) ; \
- static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (type*) NULL ) ,&_accessor##name , wxxVariant(defaultValue) ) ;
-
-#else
-
-#define WX_PROPERTY( name , type , setter , getter ,defaultValue ) \
- static wxPropertyAccessorT<class_t , type> _accessor##name( &setter , &getter , #setter , #getter ) ; \
- static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (type*) NULL ) ,&_accessor##name , wxxVariant(defaultValue) ) ;
-
-#define WX_PROPERTY_COLLECTION( name , colltype , addelemtype , adder , getter ) \
- static wxPropertyCollectionAccessorT<class_t , colltype , addelemtype > _accessor##name( &adder , &getter , #adder , #getter ) ; \
- static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (colltype*) NULL ) ,wxGetTypeInfo( (addelemtype*) NULL ) ,&_accessor##name ) ;
-
-#define WX_READONLY_PROPERTY_COLLECTION( name , colltype , addelemtype , getter ) \
- static wxPropertyCollectionAccessorT<class_t , colltype , addelemtype > _accessor##name( NULL , &getter , "" , #getter ) ; \
- static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (colltype*) NULL ) ,wxGetTypeInfo( (addelemtype*) NULL ) ,&_accessor##name ) ;
-
-#define WX_PROPERTY_SET_RET_BOOL( name , type , setter , getter ,defaultValue ) \
- WX_PROPERTY( name , type , setter , getter , defaultValue )
-
-#define WX_PROPERTY_SET_BY_REF( name , type , setter , getter ,defaultValue ) \
- WX_PROPERTY( name , type , setter , getter , defaultValue )
-
-#define WX_PROPERTY_SET_BY_REF_RET_BOOL( name , type , setter , getter ,defaultValue ) \
- WX_PROPERTY( name , type , setter , getter , defaultValue )
-
-#define WX_PROPERTY_SET_AND_GET_BY_REF_RET_BOOL( name , type , setter , getter ,defaultValue ) \
- WX_PROPERTY( name , type , setter , getter , defaultValue )
-
-#define WX_READONLY_PROPERTY( name , type , getter ,defaultValue ) \
- static wxPropertyAccessorT<class_t , type> _accessor##name( &getter , #getter ) ; \
- static wxPropertyInfo _propertyInfo##name( first , #name , wxGetTypeInfo( (type*) NULL ) ,&_accessor##name , wxxVariant(defaultValue) ) ;
-
-#define WX_READONLY_PROPERTY_GET_BY_REF( name , type , getter ,defaultValue ) \
- WX_READONLY_PROPERTY( name , type , getter , defaultValue )
-
-#endif
-
-
-#define WX_DELEGATE( name , eventType , eventClass ) \
- static wxDelegateTypeInfo _typeInfo##name( eventType , CLASSINFO( eventClass ) ) ; \
- static wxPropertyInfo _propertyInfo##name( first , #name , &_typeInfo##name , NULL , wxxVariant() ) ; \
-
-// ----------------------------------------------------------------------------
-// Handler Info
-//
-// this is describing an event sink
-// ----------------------------------------------------------------------------
-
-class wxHandlerInfo
-{
-public :
- wxHandlerInfo( wxHandlerInfo* &iter , const wxChar *name , wxObjectEventFunction address , const wxClassInfo* eventClassInfo ) :
- m_name( name ) , m_eventClassInfo( eventClassInfo ) , m_eventFunction( address )
- {
- m_next = NULL ;
- if ( iter == NULL )
- iter = this ;
- else
- {
- wxHandlerInfo* i = iter ;
- while( i->m_next )
- i = i->m_next ;
-
- i->m_next = this ;
- }
- }
-
- // get the name of the handler method
- const wxChar * GetName() const { return m_name ; }
-
- // return the class info of the event
- const wxClassInfo * GetEventClassInfo() const { return m_eventClassInfo ; }
-
- // get the handler function pointer
- wxObjectEventFunction GetEventFunction() const { return m_eventFunction ; }
-
- // returns NULL if this is the last handler of this class
- wxHandlerInfo* GetNext() const { return m_next ; }
-private :
- wxObjectEventFunction m_eventFunction ;
- const wxChar * m_name;
- const wxClassInfo* m_eventClassInfo ;
- wxHandlerInfo* m_next ;
-};
-
-#define WX_HANDLER(name,eventClassType) \
- static wxHandlerInfo _handlerInfo##name( first , #name , (wxObjectEventFunction) (wxEventFunction) &name , CLASSINFO( eventClassType ) ) ;
-
-#define WX_BEGIN_HANDLERS_TABLE(theClass) \
- wxHandlerInfo *theClass::GetHandlersStatic() \
- { \
- typedef theClass class_t; \
- static wxHandlerInfo* first = NULL ;
-
-#define WX_END_HANDLERS_TABLE() \
- return first ; }
-
-// ----------------------------------------------------------------------------
-// Constructor Bridges
-//
-// allow to set up constructors with params during runtime
-// ----------------------------------------------------------------------------
-
-class WXDLLIMPEXP_BASE wxConstructorBridge
-{
-public :
- virtual void Create(wxObject *o, wxxVariant *args) = 0;
-};