]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/xti.h
don't change WXWIN_COMPATIBLITY settings, it affects binary compatibility
[wxWidgets.git] / include / wx / xti.h
index 03274ef4f3576dfe563df91c6ea2d7170292cbdd..f0afd53f0e83f6be1bafb3615c40e80a08ed3021 100644 (file)
@@ -254,7 +254,7 @@ enum wxTypeKind
     wxT_SET, // must be wxSet<> template
     wxT_ENUM,
     wxT_CUSTOM, // user defined type (e.g. wxPoint)
-    
+
     wxT_LAST_SIMPLE_TYPE_KIND = wxT_CUSTOM ,
 
     wxT_OBJECT_PTR, // object reference
@@ -262,7 +262,7 @@ enum wxTypeKind
     wxT_COLLECTION , // collection
 
     wxT_DELEGATE , // for connecting against an event source
-    
+
     wxT_LAST_TYPE_KIND = wxT_DELEGATE // sentinel for bad data, asserts, debugging
 };
 
@@ -517,7 +517,7 @@ public :
 #endif
     wxPropertyAccessor() { m_setterName = NULL ; m_getterName = NULL ; m_adderName = NULL ;}
     virtual ~wxPropertyAccessor() {}
-    
+
     // Setting a simple property (non-collection)
     virtual void SetProperty(wxObject *object, const wxxVariant &value) const = 0 ;
 
@@ -525,11 +525,11 @@ public :
     virtual wxxVariant GetProperty(const wxObject *object) const = 0 ;
 
     // Adding an element to a collection property
-    virtual void AddToPropertyCollection(wxObject *object, const wxxVariant &value) const 
+    virtual void AddToPropertyCollection(wxObject *object, const wxxVariant &value) const
     { wxASSERT_MSG(0,wxT("Collection Operation called on non Collection Property")) ; }
 
     // Getting a collection property
-    virtual wxxVariantArray GetPropertyCollection( const wxObject *obj) const 
+    virtual wxxVariantArray GetPropertyCollection( const wxObject *obj) const
     { wxASSERT_MSG(0,wxT("Collection Operation called on non Collection Property")) ; return wxxVariantArray() ; }
 
     virtual bool HasSetter() const = 0 ;
@@ -552,7 +552,7 @@ class WXDLLIMPEXP_BASE wxGenericPropertyAccessor : public wxPropertyAccessor
 {
 public :
     wxGenericPropertyAccessor( const wxChar* propertyName ) ;
-    ~wxGenericPropertyAccessor() ; 
+    ~wxGenericPropertyAccessor() ;
     virtual void SetProperty(wxObject *object, const wxxVariant &value) const ;
     virtual wxxVariant GetProperty(const wxObject *object) const ;
 
@@ -585,6 +585,9 @@ public:
     wxPropertyAccessorT( getter_t getter, const wxChar *g)
         : 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 ;}
 
+    wxPropertyAccessorT(WX_XTI_PARAM_FIX(GetByRef*,)  getter_ref_t getter, const wxChar *g)
+        : 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 ;}
+
     wxPropertyAccessorT(WX_XTI_PARAM_FIX(SetRetBool*,) setter_bool_t setter, getter_t getter, const wxChar *s, const wxChar *g)
        : 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 ;}
 
@@ -680,10 +683,14 @@ class WXDLLIMPEXP_BASE wxPropertyCollectionAccessorT : public wxPropertyAccessor
 public:
 
     typedef void (Klass::*adder_t)(AddedElementType value);
-    typedef const CollectionType& (Klass::*getter_t)() const ;
+    typedef CollectionType (Klass::*getter_t)() const;
+    typedef const CollectionType& (Klass::*getter_ref_t)() const;
 
     wxPropertyCollectionAccessorT(adder_t adder, getter_t getter, const wxChar *a, const wxChar *g)
-        : m_getter(getter), m_adder(adder) { m_adderName = a;m_getterName=g ;}
+        : m_getter(getter), m_adder(adder) , m_getter_ref( NULL ) { m_adderName = a;m_getterName=g ;}
+
+   wxPropertyCollectionAccessorT(adder_t adder, getter_ref_t getter, const wxChar *a, const wxChar *g)
+        : m_getter(NULL), m_adder(adder) , m_getter_ref( getter ) { m_adderName = a;m_getterName=g ;}
 
     ~wxPropertyCollectionAccessorT() {}
 
@@ -716,12 +723,13 @@ public:
    }
 
     // gets the property this accessor is responsible for from an object
-    wxxVariantArray GetPropertyCollection(const wxObject *o) const 
+    wxxVariantArray GetPropertyCollection(const wxObject *o) const
     {
         const Klass *obj = dynamic_cast<const Klass*>(o);
 
         wxxVariantArray result ;
-        CollectionType::compatibility_iterator current = (obj->*(m_getter))().GetFirst();
+         CollectionType::compatibility_iterator current = (obj->*(m_getter_ref))().GetFirst() ;
+
         while (current)
         {
             result.Add( new wxxVariant(current->GetData()) ) ;
@@ -761,6 +769,7 @@ public:
 
 private :
     getter_t m_getter;
+    getter_ref_t m_getter_ref ;
     adder_t m_adder;
 };
 
@@ -834,12 +843,20 @@ private :
         return first ; }
 
 
-#if WX_XTI_TEMPLATE_FIX 
+#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) ) ;
@@ -856,6 +873,14 @@ private :
         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 ) \
@@ -866,6 +891,10 @@ private :
        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 )
 
@@ -878,12 +907,16 @@ private :
 #define WX_PROPERTY_SET_AND_GET_BY_REF_RET_BOOL( name , type , setter , getter ,defaultValue ) \
     WX_PROPERTY( name , type , setter , getter , defaultValue )
 
-#endif
-
 #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() ) ; \
@@ -1215,7 +1248,7 @@ public:
     wxDEPRECATED( static void     CleanUpClasses() );
 #endif
     static void     CleanUp();
+
     // returns the first property
     const wxPropertyInfo* GetFirstProperty() const { return m_firstProperty ; }
 
@@ -1242,7 +1275,7 @@ public:
 
     // Runtime access to objects for collection properties by property name
     virtual wxxVariantArray GetPropertyCollection(wxObject *object, const wxChar *propertyName) const ;
-    virtual void AddPropertyCollection(wxObject *object, const wxChar *propertyName , const wxxVariant& value) const ;
+    virtual void AddToPropertyCollection(wxObject *object, const wxChar *propertyName , const wxxVariant& value) const ;
 
        // we must be able to cast variants to wxObject pointers, templates seem not to be suitable
        wxObject* VariantToInstance( wxxVariant &data ) const
@@ -1299,7 +1332,7 @@ private:
 
     // InitializeClasses() helper
     static wxClassInfo *GetBaseByName(const wxChar *name) ;
-    
+
 protected:
     // registers the class
     void Register();