#if wxUSE_EXTENDED_RTTI
-#include "wx/string.h"
-#include "wx/variant.h"
-
-class WXDLLIMPEXP_BASE wxObject;
-class WXDLLIMPEXP_BASE wxClassInfo;
-class WXDLLIMPEXP_BASE wxDynamicClassInfo;
-class WXDLLIMPEXP_BASE wxHashTable;
-class WXDLLIMPEXP_BASE wxHashTable_Node;
-class WXDLLIMPEXP_BASE wxObjectRefData;
-class WXDLLIMPEXP_BASE wxEvent;
-class WXDLLIMPEXP_BASE wxEvtHandler;
+#include "wx/xti.h"
// ----------------------------------------------------------------------------
// Constructor Bridges
{
public:
virtual ~wxObjectAllocatorAndCreator() { }
- virtual bool Create(wxObject * &o, wxVariantBase *args) = 0;
+ virtual bool Create(wxObject * &o, wxAny *args) = 0;
};
// a direct constructor bridge calls the operator new for this class and
class WXDLLIMPEXP_BASE wxObjectAllocator : public wxObjectAllocatorAndCreator
{
public:
- virtual bool Create(wxObject * &o, wxVariantBase *args) = 0;
+ virtual bool Create(wxObject * &o, wxAny *args) = 0;
};
template<typename Class>
struct wxObjectAllocatorAndCreator_0 : public wxObjectAllocatorAndCreator
{
- bool Create(wxObject * &o, wxVariantBase *)
+ bool Create(wxObject * &o, wxAny *)
{
Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create();
struct wxObjectAllocatorAndCreator_Dummy : public wxObjectAllocatorAndCreator
{
- bool Create(wxObject *&, wxVariantBase *)
+ bool Create(wxObject *&, wxAny *)
{
return true;
}
template<typename Class>
struct wxDirectConstructorBridge_0 : public wxObjectAllocator
{
- bool Create(wxObject * &o, wxVariantBase *args)
+ bool Create(wxObject * &o, wxAny *args)
{
o = new Class( );
return o != NULL;
template<typename Class, typename T0>
struct wxObjectAllocatorAndCreator_1 : public wxObjectAllocatorAndCreator
{
- bool Create(wxObject * &o, wxVariantBase *args)
+ bool Create(wxObject * &o, wxAny *args)
{
Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create(
- args[0].wxTEMPLATED_MEMBER_CALL(Get, T0)
+ (args[0]).As(static_cast<T0*>(NULL))
);
}
};
template<typename Class, typename T0>
struct wxDirectConstructorBridge_1 : public wxObjectAllocator
{
- bool Create(wxObject * &o, wxVariantBase *args)
+ bool Create(wxObject * &o, wxAny *args)
{
o = new Class(
- args[0].wxTEMPLATED_MEMBER_CALL(Get, T0)
+ (args[0]).As(static_cast<T0*>(NULL))
);
return o != NULL;
}
typename T0, typename T1>
struct wxObjectAllocatorAndCreator_2 : public wxObjectAllocatorAndCreator
{
- bool Create(wxObject * &o, wxVariantBase *args)
+ bool Create(wxObject * &o, wxAny *args)
{
Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create(
- args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
- args[1].wxTEMPLATED_MEMBER_CALL(Get, T1)
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL))
);
}
};
typename T0, typename T1>
struct wxDirectConstructorBridge_2 : public wxObjectAllocator
{
- bool Create(wxObject * &o, wxVariantBase *args)
+ bool Create(wxObject * &o, wxAny *args)
{
o = new Class(
- args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
- args[1].wxTEMPLATED_MEMBER_CALL(Get, T1)
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL))
);
return o != NULL;
}
typename T0, typename T1, typename T2>
struct wxObjectAllocatorAndCreator_3 : public wxObjectAllocatorAndCreator
{
- bool Create(wxObject * &o, wxVariantBase *args)
+ bool Create(wxObject * &o, wxAny *args)
{
Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create(
- args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
- args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
- args[2].wxTEMPLATED_MEMBER_CALL(Get, T2)
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL))
);
}
};
typename T0, typename T1, typename T2>
struct wxDirectConstructorBridge_3 : public wxObjectAllocator
{
- bool Create(wxObject * &o, wxVariantBase *args)
+ bool Create(wxObject * &o, wxAny *args)
{
o = new Class(
- args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
- args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
- args[2].wxTEMPLATED_MEMBER_CALL(Get, T2)
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL))
);
return o != NULL;
}
typename T0, typename T1, typename T2, typename T3>
struct wxObjectAllocatorAndCreator_4 : public wxObjectAllocatorAndCreator
{
- bool Create(wxObject * &o, wxVariantBase *args)
+ bool Create(wxObject * &o, wxAny *args)
{
Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create(
- args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
- args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
- args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
- args[3].wxTEMPLATED_MEMBER_CALL(Get, T3)
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL))
);
}
};
typename T0, typename T1, typename T2, typename T3>
struct wxDirectConstructorBridge_4 : public wxObjectAllocator
{
- bool Create(wxObject * &o, wxVariantBase *args)
+ bool Create(wxObject * &o, wxAny *args)
{
o = new Class(
- args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
- args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
- args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
- args[3].wxTEMPLATED_MEMBER_CALL(Get, T3)
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL))
);
return o != NULL;
}
typename T0, typename T1, typename T2, typename T3, typename T4>
struct wxObjectAllocatorAndCreator_5 : public wxObjectAllocatorAndCreator
{
- bool Create(wxObject * &o, wxVariantBase *args)
+ bool Create(wxObject * &o, wxAny *args)
{
Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create(
- args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
- args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
- args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
- args[3].wxTEMPLATED_MEMBER_CALL(Get, T3),
- args[4].wxTEMPLATED_MEMBER_CALL(Get, T4)
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL)),
+ (args[4]).As(static_cast<T4*>(NULL))
);
}
};
typename T0, typename T1, typename T2, typename T3, typename T4>
struct wxDirectConstructorBridge_5 : public wxObjectAllocator
{
- bool Create(wxObject * &o, wxVariantBase *args)
+ bool Create(wxObject * &o, wxAny *args)
{
o = new Class(
- args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
- args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
- args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
- args[3].wxTEMPLATED_MEMBER_CALL(Get, T3),
- args[4].wxTEMPLATED_MEMBER_CALL(Get, T4)
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL)),
+ (args[4]).As(static_cast<T4*>(NULL))
);
return o != NULL;
}
typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
struct wxObjectAllocatorAndCreator_6 : public wxObjectAllocatorAndCreator
{
- bool Create(wxObject * &o, wxVariantBase *args)
+ bool Create(wxObject * &o, wxAny *args)
{
Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create(
- args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
- args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
- args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
- args[3].wxTEMPLATED_MEMBER_CALL(Get, T3),
- args[4].wxTEMPLATED_MEMBER_CALL(Get, T4),
- args[5].wxTEMPLATED_MEMBER_CALL(Get, T5)
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL)),
+ (args[4]).As(static_cast<T4*>(NULL)),
+ (args[5]).As(static_cast<T5*>(NULL))
);
}
};
typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
struct wxDirectConstructorBridge_6 : public wxObjectAllocator
{
- bool Create(wxObject * &o, wxVariantBase *args)
+ bool Create(wxObject * &o, wxAny *args)
{
o = new Class(
- args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
- args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
- args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
- args[3].wxTEMPLATED_MEMBER_CALL(Get, T3),
- args[4].wxTEMPLATED_MEMBER_CALL(Get, T4),
- args[5].wxTEMPLATED_MEMBER_CALL(Get, T5)
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL)),
+ (args[4]).As(static_cast<T4*>(NULL)),
+ (args[5]).As(static_cast<T5*>(NULL))
);
return o != NULL;
}
typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
struct wxObjectAllocatorAndCreator_7 : public wxObjectAllocatorAndCreator
{
- bool Create(wxObject * &o, wxVariantBase *args)
+ bool Create(wxObject * &o, wxAny *args)
{
Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create(
- args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
- args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
- args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
- args[3].wxTEMPLATED_MEMBER_CALL(Get, T3),
- args[4].wxTEMPLATED_MEMBER_CALL(Get, T4),
- args[5].wxTEMPLATED_MEMBER_CALL(Get, T5),
- args[6].wxTEMPLATED_MEMBER_CALL(Get, T6)
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL)),
+ (args[4]).As(static_cast<T4*>(NULL)),
+ (args[5]).As(static_cast<T5*>(NULL)),
+ (args[6]).As(static_cast<T6*>(NULL))
);
}
};
typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
struct wxDirectConstructorBridge_7 : public wxObjectAllocator
{
- bool Create(wxObject * &o, wxVariantBase *args)
+ bool Create(wxObject * &o, wxAny *args)
{
o = new Class(
- args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
- args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
- args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
- args[3].wxTEMPLATED_MEMBER_CALL(Get, T3),
- args[4].wxTEMPLATED_MEMBER_CALL(Get, T4),
- args[3].wxTEMPLATED_MEMBER_CALL(Get, T5),
- args[4].wxTEMPLATED_MEMBER_CALL(Get, T6)
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL)),
+ (args[4]).As(static_cast<T4*>(NULL)),
+ (args[5]).As(static_cast<T5*>(NULL)),
+ (args[6]).As(static_cast<T6*>(NULL))
);
return o != NULL;
}
typename T6, typename T7>
struct wxObjectAllocatorAndCreator_8 : public wxObjectAllocatorAndCreator
{
- bool Create(wxObject * &o, wxVariantBase *args)
+ bool Create(wxObject * &o, wxAny *args)
{
Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create(
- args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
- args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
- args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
- args[3].wxTEMPLATED_MEMBER_CALL(Get, T3),
- args[4].wxTEMPLATED_MEMBER_CALL(Get, T4),
- args[5].wxTEMPLATED_MEMBER_CALL(Get, T5),
- args[6].wxTEMPLATED_MEMBER_CALL(Get, T6),
- args[7].wxTEMPLATED_MEMBER_CALL(Get, T7)
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL)),
+ (args[4]).As(static_cast<T4*>(NULL)),
+ (args[5]).As(static_cast<T5*>(NULL)),
+ (args[6]).As(static_cast<T6*>(NULL)),
+ (args[7]).As(static_cast<T7*>(NULL))
);
}
};
typename T6, typename T7>
struct wxDirectConstructorBridge_8 : public wxObjectAllocator
{
- bool Create(wxObject * &o, wxVariantBase *args)
+ bool Create(wxObject * &o, wxAny *args)
{
o = new Class(
- args[0].wxTEMPLATED_MEMBER_CALL(Get, T0),
- args[1].wxTEMPLATED_MEMBER_CALL(Get, T1),
- args[2].wxTEMPLATED_MEMBER_CALL(Get, T2),
- args[3].wxTEMPLATED_MEMBER_CALL(Get, T3),
- args[4].wxTEMPLATED_MEMBER_CALL(Get, T4),
- args[3].wxTEMPLATED_MEMBER_CALL(Get, T5),
- args[4].wxTEMPLATED_MEMBER_CALL(Get, T6),
- args[4].wxTEMPLATED_MEMBER_CALL(Get, T7)
+ (args[0]).As(static_cast<T0*>(NULL)),
+ (args[1]).As(static_cast<T1*>(NULL)),
+ (args[2]).As(static_cast<T2*>(NULL)),
+ (args[3]).As(static_cast<T3*>(NULL)),
+ (args[4]).As(static_cast<T4*>(NULL)),
+ (args[5]).As(static_cast<T5*>(NULL)),
+ (args[6]).As(static_cast<T6*>(NULL)),
+ (args[7]).As(static_cast<T7*>(NULL))
);
return o != NULL;
}
#if wxUSE_EXTENDED_RTTI
-#include "wx/string.h"
-
-class WXDLLIMPEXP_BASE wxObject;
-class WXDLLIMPEXP_BASE wxClassInfo;
-class WXDLLIMPEXP_BASE wxDynamicClassInfo;
-class WXDLLIMPEXP_BASE wxHashTable;
-class WXDLLIMPEXP_BASE wxHashTable_Node;
-class WXDLLIMPEXP_BASE wxObjectRefData;
-class WXDLLIMPEXP_BASE wxEvent;
-class WXDLLIMPEXP_BASE wxEvtHandler;
-
-typedef void (wxObject::*wxObjectEventFunction)(wxEvent&);
+#include "wx/xti.h"
+
+// copied from event.h which cannot be included at this place, TODO MOVE to common file
+
+class WXDLLIMPEXP_FWD_BASE wxEvent;
+
+#ifdef __VISUALC__
+#define wxMSVC_FWD_MULTIPLE_BASES __multiple_inheritance
+#else
+#define wxMSVC_FWD_MULTIPLE_BASES
+#endif
+
+class WXDLLIMPEXP_FWD_BASE wxMSVC_FWD_MULTIPLE_BASES wxEvtHandler;
+typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
+typedef wxEventFunction wxObjectEventFunction;
// ----------------------------------------------------------------------------
// Handler Info
#if wxUSE_EXTENDED_RTTI
-#include "wx/string.h"
-#include "wx/variant.h"
-#include "wx/intl.h"
-#include "wx/log.h"
-#include "wx/xtitypes.h"
+#include "wx/xti.h"
+#include "wx/any.h"
class WXDLLIMPEXP_BASE wxObject;
class WXDLLIMPEXP_BASE wxClassInfo;
class WXDLLIMPEXP_BASE wxDynamicClassInfo;
class WXDLLIMPEXP_BASE wxHashTable;
class WXDLLIMPEXP_BASE wxHashTable_Node;
-class WXDLLIMPEXP_BASE wxObjectRefData;
class WXDLLIMPEXP_BASE wxEvent;
class WXDLLIMPEXP_BASE wxEvtHandler;
wxPropertySetter( const wxString name ) { m_name = name; }
virtual ~wxPropertySetter() {}
- virtual void Set( wxObject *object, const wxVariantBase &variantValue ) const = 0;
+ virtual void Set( wxObject *object, const wxAny &variantValue ) const = 0;
const wxString& GetName() const { return m_name; }
private:
wxPropertyGetter( const wxString name ) { m_name = name; }
virtual ~wxPropertyGetter() {}
- virtual void Get( const wxObject *object, wxVariantBase& result) const = 0;
+ virtual void Get( const wxObject *object, wxAny& result) const = 0;
const wxString& GetName() const { return m_name; }
private:
wxPropertyCollectionGetter( const wxString name ) { m_name = name; }
virtual ~wxPropertyCollectionGetter() {}
- virtual void Get( const wxObject *object, wxVariantBaseArray& result) const = 0;
+ virtual void Get( const wxObject *object, wxAnyList& result) const = 0;
const wxString& GetName() const { return m_name; }
private:
};
template<typename coll_t> void WXDLLIMPEXP_BASE \
- wxCollectionToVariantArray( const coll_t& coll, wxVariantBaseArray& result );
+ wxCollectionToVariantArray( const coll_t& coll, wxAnyList& result );
class WXDLLIMPEXP_BASE wxPropertyCollectionAdder
{
wxPropertyCollectionAdder( const wxString name ) { m_name = name; }
virtual ~wxPropertyCollectionAdder() {}
- virtual void Add( wxObject *object, const wxVariantBase &variantValue ) const= 0;
+ virtual void Add( wxObject *object, const wxAny &variantValue ) const= 0;
const wxString& GetName() const { return m_name; }
private:
wxString m_name;
};
-#define wxPROPERTY_SETTER( property, Klass, valueType, setterMethod ) \
-class wxPropertySetter##property : public wxPropertySetter \
+#define wxPROPERTY_SETTER( property, Klass, valueType, setterMethod ) \
+class wxPropertySetter##property : public wxPropertySetter \
{ \
public: \
wxINFUNC_CLASS_TYPE_FIX(Klass) \
wxPropertySetter##property() : wxPropertySetter( wxT(#setterMethod) ) {} \
- virtual ~wxPropertySetter##property() {} \
+ virtual ~wxPropertySetter##property() {} \
\
- void Set( wxObject *object, const wxVariantBase &variantValue ) const \
+ void Set( wxObject *object, const wxAny &variantValue ) const \
{ \
- Klass *obj = dynamic_cast<Klass*>(object); \
- if ( variantValue.wxTEMPLATED_MEMBER_CALL(HasData, valueType) ) \
- obj->setterMethod(variantValue.wxTEMPLATED_MEMBER_CALL(Get, valueType)); \
- else \
- obj->setterMethod(*variantValue.wxTEMPLATED_MEMBER_CALL(Get, valueType*)); \
- } \
+ Klass *obj = dynamic_cast<Klass*>(object); \
+ valueType tempobj; \
+ if ( variantValue.GetAs(&tempobj) ) \
+ obj->setterMethod(tempobj); \
+ else \
+ obj->setterMethod(*wxANY_AS(variantValue, valueType*)); \
+ } \
};
#define wxPROPERTY_GETTER( property, Klass, valueType, gettermethod ) \
wxPropertyGetter##property() : wxPropertyGetter( wxT(#gettermethod) ) {} \
virtual ~wxPropertyGetter##property() {} \
\
- void Get( const wxObject *object, wxVariantBase &result) const \
+ void Get( const wxObject *object, wxAny &result) const \
{ \
const Klass *obj = dynamic_cast<const Klass*>(object); \
- result = wxVariantBase( obj->gettermethod() ); \
+ result = wxAny( obj->gettermethod() ); \
} \
};
wxPropertyCollectionAdder##property() : wxPropertyCollectionAdder( wxT(#addermethod) ) {} \
virtual ~wxPropertyCollectionAdder##property() {} \
\
- void Add( wxObject *object, const wxVariantBase &variantValue ) const \
+ void Add( wxObject *object, const wxAny &variantValue ) const \
{ \
Klass *obj = dynamic_cast<Klass*>(object); \
- if ( variantValue.wxTEMPLATED_MEMBER_CALL(HasData, valueType) ) \
- obj->addermethod(variantValue.wxTEMPLATED_MEMBER_CALL(Get, valueType)); \
+ valueType tempobj; \
+ if ( variantValue.GetAs(&tempobj) ) \
+ obj->addermethod(tempobj); \
else \
- obj->addermethod(*variantValue.wxTEMPLATED_MEMBER_CALL(Get, valueType*)); \
+ obj->addermethod(*wxANY_AS(variantValue, valueType*)); \
} \
};
wxPropertyCollectionGetter##property() : wxPropertyCollectionGetter( wxT(#gettermethod) ) {} \
virtual ~wxPropertyCollectionGetter##property() {} \
\
- void Get( const wxObject *object, wxVariantBaseArray &result) const \
+ void Get( const wxObject *object, wxAnyList &result) const \
{ \
const Klass *obj = dynamic_cast<const Klass*>(object); \
wxCollectionToVariantArray( obj->gettermethod(), result ); \
virtual ~wxPropertyAccessor() {}
// Setting a simple property (non-collection)
- virtual void SetProperty(wxObject *object, const wxVariantBase &value) const
+ virtual void SetProperty(wxObject *object, const wxAny &value) const
{
if ( m_setter )
m_setter->Set( object, value );
}
// Getting a simple property (non-collection)
- virtual void GetProperty(const wxObject *object, wxVariantBase &result) const
+ virtual void GetProperty(const wxObject *object, wxAny &result) const
{
if ( m_getter )
m_getter->Get( object, result );
}
// Adding an element to a collection property
- virtual void AddToPropertyCollection(wxObject *object, const wxVariantBase &value) const
+ virtual void AddToPropertyCollection(wxObject *object, const wxAny &value) const
{
if ( m_adder )
m_adder->Add( object, value );
}
// Getting a collection property
- virtual void GetPropertyCollection( const wxObject *obj, wxVariantBaseArray &result) const
+ virtual void GetPropertyCollection( const wxObject *obj, wxAnyList &result) const
{
if ( m_collectionGetter )
m_collectionGetter->Get( obj, result);
virtual const wxString& GetSetterName() const
{ return m_setterName; }
- virtual void SetProperty(wxObject *object, const wxVariantBase &value) const;
- virtual void GetProperty(const wxObject *object, wxVariantBase &value) const;
+ virtual void SetProperty(wxObject *object, const wxAny &value) const;
+ virtual void GetProperty(const wxObject *object, wxAny &value) const;
// Adding an element to a collection property
virtual void AddToPropertyCollection(wxObject *WXUNUSED(object),
- const wxVariantBase &WXUNUSED(value)) const
+ const wxAny &WXUNUSED(value)) const
{
wxLogError( _("AddToPropertyCollection called on a generic accessor") );
}
// Getting a collection property
virtual void GetPropertyCollection( const wxObject *WXUNUSED(obj),
- wxVariantBaseArray &WXUNUSED(result)) const
+ wxAnyList &WXUNUSED(result)) const
{
wxLogError ( _("GetPropertyCollection called on a generic accessor") );
}
const wxString& name,
const wxString& typeName,
wxPropertyAccessor *accessor,
- wxVariantBase dv,
+ wxAny dv,
wxPropertyInfoFlags flags = 0,
const wxString& helpString = wxEmptyString,
const wxString& groupString = wxEmptyString) :
const wxString& name,
const char* typeName,
wxPropertyAccessor *accessor,
- wxVariantBase dv,
+ wxAny dv,
wxPropertyInfoFlags flags = 0,
const wxString& helpString = wxEmptyString,
const wxString& groupString = wxEmptyString) :
const wxString& name,
wxEventSourceTypeInfo* type,
wxPropertyAccessor *accessor,
- wxVariantBase dv,
+ wxAny dv,
wxPropertyInfoFlags flags = 0,
const wxString& helpString = wxEmptyString,
const wxString& groupString = wxEmptyString) :
wxPropertyInfo* GetNext() const { return m_next; }
// returns the default value of this property, its kind may be wxT_VOID if it is not valid
- wxVariantBase GetDefaultValue() const { return m_defaultValue; }
+ wxAny GetDefaultValue() const { return m_defaultValue; }
private:
mutable wxTypeInfo* m_collectionElementTypeInfo;
wxString m_collectionElementTypeName;
wxPropertyAccessor* m_accessor;
- wxVariantBase m_defaultValue;
+ wxAny m_defaultValue;
wxPropertyInfoFlags m_flags;
wxString m_helpString;
wxString m_groupString;
#define wxHIDE_PROPERTY( pname ) \
static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
- wxT(#pname), typeid(void).name(), NULL, wxVariantBase(), wxPROP_DONT_STREAM, \
+ wxT(#pname), typeid(void).name(), NULL, wxAny(), wxPROP_DONT_STREAM, \
wxEmptyString, wxEmptyString );
#define wxPROPERTY( pname, type, setter, getter, defaultValue, flags, help, group) \
&_getter##pname, NULL, NULL ); \
static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
wxT(#pname), typeid(type).name(), &_accessor##pname, \
- wxVariantBase(defaultValue), flags, group, help );
+ wxAny(defaultValue), flags, group, help );
#define wxPROPERTY_FLAGS( pname, flags, type, setter, getter,defaultValue, \
pflags, help, group) \
&_getter##pname, NULL, NULL ); \
static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
wxT(#pname), typeid(flags).name(), &_accessor##pname, \
- wxVariantBase(defaultValue), wxPROP_ENUM_STORE_LONG | pflags, help, group );
+ wxAny(defaultValue), wxPROP_ENUM_STORE_LONG | pflags, help, group );
#define wxREADONLY_PROPERTY( pname, type, getter,defaultValue, flags, help, group) \
wxPROPERTY_GETTER( pname, class_t, type, getter ) \
static wxPropertyAccessor _accessor##pname( NULL, &_getter##pname, NULL, NULL ); \
static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
wxT(#pname), typeid(type).name(),&_accessor##pname, \
- wxVariantBase(defaultValue), flags, help, group );
+ wxAny(defaultValue), flags, help, group );
#define wxREADONLY_PROPERTY_FLAGS( pname, flags, type, getter,defaultValue, \
pflags, help, group) \
static wxPropertyAccessor _accessor##pname( NULL, &_getter##pname, NULL, NULL ); \
static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
wxT(#pname), typeid(flags).name(),&_accessor##pname, \
- wxVariantBase(defaultValue), wxPROP_ENUM_STORE_LONG | pflags, help, group );
+ wxAny(defaultValue), wxPROP_ENUM_STORE_LONG | pflags, help, group );
#define wxPROPERTY_COLLECTION( pname, colltype, addelemtype, adder, getter, \
flags, help, group ) \
#define wxEVENT_PROPERTY( name, eventType, eventClass ) \
static wxEventSourceTypeInfo _typeInfo##name( eventType, CLASSINFO( eventClass ) ); \
static wxPropertyInfo _propertyInfo##name( first,class_t::GetClassInfoStatic(), \
- wxT(#name), &_typeInfo##name, NULL, wxVariantBase() );
+ wxT(#name), &_typeInfo##name, NULL, wxAny() );
#define wxEVENT_RANGE_PROPERTY( name, eventType, lastEventType, eventClass ) \
static wxEventSourceTypeInfo _typeInfo##name( eventType, lastEventType, \
CLASSINFO( eventClass ) ); \
static wxPropertyInfo _propertyInfo##name( first, class_t::GetClassInfoStatic(), \
- wxT(#name), &_typeInfo##name, NULL, wxVariantBase() );
+ wxT(#name), &_typeInfo##name, NULL, wxAny() );
// ----------------------------------------------------------------------------
// Implementation Helper for Simple Properties
void Set##name( type const & p) { m_##name = p; } \
type const & Get##name() const { return m_##name; }
+WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxAny, wxStringToAnyHashMap,
+ class WXDLLIMPEXP_BASE );
+
#endif // wxUSE_EXTENDED_RTTI
#endif // _XTIPROP_H_
#define wxENUM_MEMBER( v ) { wxT(#v), v },
+/*
+WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<e>) \
+WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<e*>) \
+*/
+
#define wxEND_ENUM( e ) \
{ NULL, 0 } }; \
wxEnumData s_enumData##e( s_enumDataMembers##e ); \
{ data = (e) s_enumData##e.GetEnumMemberValue(s); } \
template<> void wxStringWriteValue(wxString &s, const e &data ) \
{ s = s_enumData##e.GetEnumMemberName((int)data); } \
- void FromLong##e( long data, wxVariantBase& result ) \
- { result = wxVariantBase((e)data); } \
- void ToLong##e( const wxVariantBase& data, long &result ) \
- { result = (long) data.wxTEMPLATED_MEMBER_CALL(Get, e); } \
+ void FromLong##e( long data, wxAny& result ) \
+ { result = wxAny((e)data); } \
+ void ToLong##e( const wxAny& data, long &result ) \
+ { result = (long) (data).As(static_cast<e*>(NULL)); } \
\
wxTO_STRING_IMP( e ) \
wxFROM_STRING_IMP( e ) \
{ wxSetFromString( s, data ); } \
template<> void wxStringWriteValue( wxString &s, const wxBitset<e> &data ) \
{ wxSetToString( s, data ); } \
- void FromLong##SetName( long data, wxVariantBase& result ) \
- { result = wxVariantBase(SetName((unsigned long)data)); } \
- void ToLong##SetName( const wxVariantBase& data, long &result ) \
- { result = (long) data.wxTEMPLATED_MEMBER_CALL(Get, SetName).to_ulong(); } \
+ void FromLong##SetName( long data, wxAny& result ) \
+ { result = wxAny(SetName((unsigned long)data)); } \
+ void ToLong##SetName( const wxAny& data, long &result ) \
+ { result = (long) (data).As(static_cast<SetName*>(NULL)).to_ulong(); } \
wxTO_STRING_IMP( SetName ) \
wxFROM_STRING_IMP( SetName ) \
wxEnumTypeInfo s_typeInfo##SetName(wxT_SET, &s_enumData##e, \
#define wxFLAGS_MEMBER( v ) { wxT(#v), v },
+/*
+WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<e>) \
+WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<e*>) \
+*/
+
#define wxEND_FLAGS( e ) \
{ NULL, 0 } }; \
wxEnumData s_enumData##e( s_enumDataMembers##e ); \
{ wxFlagsFromString<e>( s, data ); } \
template<> void wxStringWriteValue( wxString &s, const e& data ) \
{ wxFlagsToString<e>( s, data ); } \
- void FromLong##e( long data, wxVariantBase& result ) \
- { result = wxVariantBase(e(data)); } \
- void ToLong##e( const wxVariantBase& data, long &result ) \
- { result = (long) data.wxTEMPLATED_MEMBER_CALL(Get, e).m_data; } \
+ void FromLong##e( long data, wxAny& result ) \
+ { result = wxAny(e(data)); } \
+ void ToLong##e( const wxAny& data, long &result ) \
+ { result = (long) (data).As(static_cast<e*>(NULL)).m_data; } \
wxTO_STRING_IMP( e ) \
wxFROM_STRING_IMP( e ) \
wxEnumTypeInfo s_typeInfo##e(wxT_SET, &s_enumData##e, \
wxT_UINT,
wxT_LONG,
wxT_ULONG,
+ wxT_LONGLONG,
+ wxT_ULONGLONG,
wxT_FLOAT,
wxT_DOUBLE,
wxT_STRING, // must be wxString
wxT_LAST_TYPE_KIND = wxT_DELEGATE // sentinel for bad data, asserts, debugging
};
-class WXDLLIMPEXP_BASE wxVariantBase;
+class WXDLLIMPEXP_BASE wxAny;
class WXDLLIMPEXP_BASE wxTypeInfo;
WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxTypeInfo*, wxTypeInfoMap, class WXDLLIMPEXP_BASE );
class WXDLLIMPEXP_BASE wxTypeInfo
{
public:
- typedef void (*wxVariant2StringFnc)( const wxVariantBase& data, wxString &result );
- typedef void (*wxString2VariantFnc)( const wxString& data, wxVariantBase &result );
+ typedef void (*wxVariant2StringFnc)( const wxAny& data, wxString &result );
+ typedef void (*wxString2VariantFnc)( const wxString& data, wxAny &result );
wxTypeInfo(wxTypeKind kind,
wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL,
// can the content of this type be converted to and from strings ?
bool HasStringConverters() const { return m_toString != NULL && m_fromString != NULL; }
- // convert a wxVariantBase holding data of this type into a string
- void ConvertToString( const wxVariantBase& data, wxString &result ) const
+ // convert a wxAny holding data of this type into a string
+ void ConvertToString( const wxAny& data, wxString &result ) const
{
if ( m_toString )
(*m_toString)( data, result );
wxLogError( wxGetTranslation(_T("String conversions not supported")) );
}
- // convert a string into a wxVariantBase holding the corresponding data in this type
- void ConvertFromString( const wxString& data, wxVariantBase &result ) const
+ // convert a string into a wxAny holding the corresponding data in this type
+ void ConvertFromString( const wxString& data, wxAny &result ) const
{
if( m_fromString )
(*m_fromString)( data, result );
// statics:
+ static wxTypeInfo *FindType( const wxString& typeName );
+#if 0 // TODO
#if wxUSE_UNICODE
static wxTypeInfo *FindType(const char *typeName)
{ return FindType( wxString::FromAscii(typeName) ); }
return FindType( typeName.char_str() );
#endif
}
-
+#endif
private:
void Register();
void Unregister();
class WXDLLIMPEXP_BASE wxEnumTypeInfo : public wxTypeInfo
{
public:
- typedef void (*converterToLong_t)( const wxVariantBase& data, long &result );
- typedef void (*converterFromLong_t)( long data, wxVariantBase &result );
+ typedef void (*converterToLong_t)( const wxAny& data, long &result );
+ typedef void (*converterFromLong_t)( long data, wxAny &result );
wxEnumTypeInfo( wxTypeKind kind, wxEnumData* enumInfo, wxVariant2StringFnc to,
wxString2VariantFnc from, converterToLong_t toLong,
#endif
const wxEnumData* GetEnumData() const { return m_enumInfo; }
- // convert a wxVariantBase holding data of this type into a long
- void ConvertToLong( const wxVariantBase& data, long &result ) const
+ // convert a wxAny holding data of this type into a long
+ void ConvertToLong( const wxAny& data, long &result ) const
{
if( m_toLong )
(*m_toLong)( data, result );
wxLogError( wxGetTranslation(_T("Long Conversions not supported")) );
}
- // convert a long into a wxVariantBase holding the corresponding data in this type
- void ConvertFromLong( long data, wxVariantBase &result ) const
+ // convert a long into a wxAny holding the corresponding data in this type
+ void ConvertFromLong( long data, wxAny &result ) const
{
if( m_fromLong )
(*m_fromLong)( data, result );
int m_lastEventType;
};
-template<typename T> const wxTypeInfo* wxGetTypeInfo( T * ) \
+template<typename T> const wxTypeInfo* wxGetTypeInfo( T * )
{ return wxTypeInfo::FindType(typeid(T).name()); }
// this macro is for usage with custom, non-object derived classes and structs,
wxCustomTypeInfo s_typeInfo##e(typeid(e).name(), &toString, &fromString);
#else
#define wxCUSTOM_TYPE_INFO( e, toString, fromString ) \
- void ToString##e( const wxVariantBase& data, wxString &result ) \
+ void ToString##e( const wxAny& data, wxString &result ) \
{ toString(data, result); } \
- void FromString##e( const wxString& data, wxVariantBase &result ) \
+ void FromString##e( const wxString& data, wxAny &result ) \
{ fromString(data, result); } \
wxCustomTypeInfo s_typeInfo##e(typeid(e).name(), \
&ToString##e, &FromString##e);