xti changes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66626 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2011-01-07 17:43:12 +00:00
parent 4e3762c9e2
commit 6c887ddefb
4 changed files with 199 additions and 191 deletions

View File

@@ -17,17 +17,7 @@
#if wxUSE_EXTENDED_RTTI #if wxUSE_EXTENDED_RTTI
#include "wx/string.h" #include "wx/xti.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;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Constructor Bridges // Constructor Bridges
@@ -39,7 +29,7 @@ class WXDLLIMPEXP_BASE wxObjectAllocatorAndCreator
{ {
public: public:
virtual ~wxObjectAllocatorAndCreator() { } 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 // a direct constructor bridge calls the operator new for this class and
@@ -48,7 +38,7 @@ public:
class WXDLLIMPEXP_BASE wxObjectAllocator : public wxObjectAllocatorAndCreator class WXDLLIMPEXP_BASE wxObjectAllocator : public wxObjectAllocatorAndCreator
{ {
public: public:
virtual bool Create(wxObject * &o, wxVariantBase *args) = 0; virtual bool Create(wxObject * &o, wxAny *args) = 0;
}; };
@@ -61,7 +51,7 @@ public:
template<typename Class> template<typename Class>
struct wxObjectAllocatorAndCreator_0 : public wxObjectAllocatorAndCreator struct wxObjectAllocatorAndCreator_0 : public wxObjectAllocatorAndCreator
{ {
bool Create(wxObject * &o, wxVariantBase *) bool Create(wxObject * &o, wxAny *)
{ {
Class *obj = wx_dynamic_cast(Class*, o); Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create(); return obj->Create();
@@ -70,7 +60,7 @@ struct wxObjectAllocatorAndCreator_0 : public wxObjectAllocatorAndCreator
struct wxObjectAllocatorAndCreator_Dummy : public wxObjectAllocatorAndCreator struct wxObjectAllocatorAndCreator_Dummy : public wxObjectAllocatorAndCreator
{ {
bool Create(wxObject *&, wxVariantBase *) bool Create(wxObject *&, wxAny *)
{ {
return true; return true;
} }
@@ -93,7 +83,7 @@ struct wxObjectAllocatorAndCreator_Dummy : public wxObjectAllocatorAndCreator
template<typename Class> template<typename Class>
struct wxDirectConstructorBridge_0 : public wxObjectAllocator struct wxDirectConstructorBridge_0 : public wxObjectAllocator
{ {
bool Create(wxObject * &o, wxVariantBase *args) bool Create(wxObject * &o, wxAny *args)
{ {
o = new Class( ); o = new Class( );
return o != NULL; return o != NULL;
@@ -112,11 +102,11 @@ struct wxDirectConstructorBridge_0 : public wxObjectAllocator
template<typename Class, typename T0> template<typename Class, typename T0>
struct wxObjectAllocatorAndCreator_1 : public wxObjectAllocatorAndCreator struct wxObjectAllocatorAndCreator_1 : public wxObjectAllocatorAndCreator
{ {
bool Create(wxObject * &o, wxVariantBase *args) bool Create(wxObject * &o, wxAny *args)
{ {
Class *obj = wx_dynamic_cast(Class*, o); Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create( return obj->Create(
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0) (args[0]).As(static_cast<T0*>(NULL))
); );
} }
}; };
@@ -132,10 +122,10 @@ struct wxObjectAllocatorAndCreator_1 : public wxObjectAllocatorAndCreator
template<typename Class, typename T0> template<typename Class, typename T0>
struct wxDirectConstructorBridge_1 : public wxObjectAllocator struct wxDirectConstructorBridge_1 : public wxObjectAllocator
{ {
bool Create(wxObject * &o, wxVariantBase *args) bool Create(wxObject * &o, wxAny *args)
{ {
o = new Class( o = new Class(
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0) (args[0]).As(static_cast<T0*>(NULL))
); );
return o != NULL; return o != NULL;
} }
@@ -154,12 +144,12 @@ template<typename Class,
typename T0, typename T1> typename T0, typename T1>
struct wxObjectAllocatorAndCreator_2 : public wxObjectAllocatorAndCreator struct wxObjectAllocatorAndCreator_2 : public wxObjectAllocatorAndCreator
{ {
bool Create(wxObject * &o, wxVariantBase *args) bool Create(wxObject * &o, wxAny *args)
{ {
Class *obj = wx_dynamic_cast(Class*, o); Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create( return obj->Create(
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0), (args[0]).As(static_cast<T0*>(NULL)),
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1) (args[1]).As(static_cast<T1*>(NULL))
); );
} }
}; };
@@ -176,11 +166,11 @@ template<typename Class,
typename T0, typename T1> typename T0, typename T1>
struct wxDirectConstructorBridge_2 : public wxObjectAllocator struct wxDirectConstructorBridge_2 : public wxObjectAllocator
{ {
bool Create(wxObject * &o, wxVariantBase *args) bool Create(wxObject * &o, wxAny *args)
{ {
o = new Class( o = new Class(
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0), (args[0]).As(static_cast<T0*>(NULL)),
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1) (args[1]).As(static_cast<T1*>(NULL))
); );
return o != NULL; return o != NULL;
} }
@@ -199,13 +189,13 @@ template<typename Class,
typename T0, typename T1, typename T2> typename T0, typename T1, typename T2>
struct wxObjectAllocatorAndCreator_3 : public wxObjectAllocatorAndCreator struct wxObjectAllocatorAndCreator_3 : public wxObjectAllocatorAndCreator
{ {
bool Create(wxObject * &o, wxVariantBase *args) bool Create(wxObject * &o, wxAny *args)
{ {
Class *obj = wx_dynamic_cast(Class*, o); Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create( return obj->Create(
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0), (args[0]).As(static_cast<T0*>(NULL)),
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1), (args[1]).As(static_cast<T1*>(NULL)),
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2) (args[2]).As(static_cast<T2*>(NULL))
); );
} }
}; };
@@ -222,12 +212,12 @@ template<typename Class,
typename T0, typename T1, typename T2> typename T0, typename T1, typename T2>
struct wxDirectConstructorBridge_3 : public wxObjectAllocator struct wxDirectConstructorBridge_3 : public wxObjectAllocator
{ {
bool Create(wxObject * &o, wxVariantBase *args) bool Create(wxObject * &o, wxAny *args)
{ {
o = new Class( o = new Class(
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0), (args[0]).As(static_cast<T0*>(NULL)),
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1), (args[1]).As(static_cast<T1*>(NULL)),
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2) (args[2]).As(static_cast<T2*>(NULL))
); );
return o != NULL; return o != NULL;
} }
@@ -246,14 +236,14 @@ template<typename Class,
typename T0, typename T1, typename T2, typename T3> typename T0, typename T1, typename T2, typename T3>
struct wxObjectAllocatorAndCreator_4 : public wxObjectAllocatorAndCreator struct wxObjectAllocatorAndCreator_4 : public wxObjectAllocatorAndCreator
{ {
bool Create(wxObject * &o, wxVariantBase *args) bool Create(wxObject * &o, wxAny *args)
{ {
Class *obj = wx_dynamic_cast(Class*, o); Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create( return obj->Create(
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0), (args[0]).As(static_cast<T0*>(NULL)),
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1), (args[1]).As(static_cast<T1*>(NULL)),
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2), (args[2]).As(static_cast<T2*>(NULL)),
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3) (args[3]).As(static_cast<T3*>(NULL))
); );
} }
}; };
@@ -271,13 +261,13 @@ template<typename Class,
typename T0, typename T1, typename T2, typename T3> typename T0, typename T1, typename T2, typename T3>
struct wxDirectConstructorBridge_4 : public wxObjectAllocator struct wxDirectConstructorBridge_4 : public wxObjectAllocator
{ {
bool Create(wxObject * &o, wxVariantBase *args) bool Create(wxObject * &o, wxAny *args)
{ {
o = new Class( o = new Class(
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0), (args[0]).As(static_cast<T0*>(NULL)),
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1), (args[1]).As(static_cast<T1*>(NULL)),
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2), (args[2]).As(static_cast<T2*>(NULL)),
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3) (args[3]).As(static_cast<T3*>(NULL))
); );
return o != NULL; return o != NULL;
} }
@@ -297,15 +287,15 @@ template<typename Class,
typename T0, typename T1, typename T2, typename T3, typename T4> typename T0, typename T1, typename T2, typename T3, typename T4>
struct wxObjectAllocatorAndCreator_5 : public wxObjectAllocatorAndCreator struct wxObjectAllocatorAndCreator_5 : public wxObjectAllocatorAndCreator
{ {
bool Create(wxObject * &o, wxVariantBase *args) bool Create(wxObject * &o, wxAny *args)
{ {
Class *obj = wx_dynamic_cast(Class*, o); Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create( return obj->Create(
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0), (args[0]).As(static_cast<T0*>(NULL)),
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1), (args[1]).As(static_cast<T1*>(NULL)),
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2), (args[2]).As(static_cast<T2*>(NULL)),
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3), (args[3]).As(static_cast<T3*>(NULL)),
args[4].wxTEMPLATED_MEMBER_CALL(Get, T4) (args[4]).As(static_cast<T4*>(NULL))
); );
} }
}; };
@@ -323,14 +313,14 @@ template<typename Class,
typename T0, typename T1, typename T2, typename T3, typename T4> typename T0, typename T1, typename T2, typename T3, typename T4>
struct wxDirectConstructorBridge_5 : public wxObjectAllocator struct wxDirectConstructorBridge_5 : public wxObjectAllocator
{ {
bool Create(wxObject * &o, wxVariantBase *args) bool Create(wxObject * &o, wxAny *args)
{ {
o = new Class( o = new Class(
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0), (args[0]).As(static_cast<T0*>(NULL)),
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1), (args[1]).As(static_cast<T1*>(NULL)),
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2), (args[2]).As(static_cast<T2*>(NULL)),
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3), (args[3]).As(static_cast<T3*>(NULL)),
args[4].wxTEMPLATED_MEMBER_CALL(Get, T4) (args[4]).As(static_cast<T4*>(NULL))
); );
return o != NULL; return o != NULL;
} }
@@ -350,16 +340,16 @@ template<typename Class,
typename T0, typename T1, typename T2, typename T3, typename T4, typename T5> typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
struct wxObjectAllocatorAndCreator_6 : public wxObjectAllocatorAndCreator struct wxObjectAllocatorAndCreator_6 : public wxObjectAllocatorAndCreator
{ {
bool Create(wxObject * &o, wxVariantBase *args) bool Create(wxObject * &o, wxAny *args)
{ {
Class *obj = wx_dynamic_cast(Class*, o); Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create( return obj->Create(
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0), (args[0]).As(static_cast<T0*>(NULL)),
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1), (args[1]).As(static_cast<T1*>(NULL)),
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2), (args[2]).As(static_cast<T2*>(NULL)),
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3), (args[3]).As(static_cast<T3*>(NULL)),
args[4].wxTEMPLATED_MEMBER_CALL(Get, T4), (args[4]).As(static_cast<T4*>(NULL)),
args[5].wxTEMPLATED_MEMBER_CALL(Get, T5) (args[5]).As(static_cast<T5*>(NULL))
); );
} }
}; };
@@ -377,15 +367,15 @@ template<typename Class,
typename T0, typename T1, typename T2, typename T3, typename T4, typename T5> typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
struct wxDirectConstructorBridge_6 : public wxObjectAllocator struct wxDirectConstructorBridge_6 : public wxObjectAllocator
{ {
bool Create(wxObject * &o, wxVariantBase *args) bool Create(wxObject * &o, wxAny *args)
{ {
o = new Class( o = new Class(
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0), (args[0]).As(static_cast<T0*>(NULL)),
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1), (args[1]).As(static_cast<T1*>(NULL)),
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2), (args[2]).As(static_cast<T2*>(NULL)),
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3), (args[3]).As(static_cast<T3*>(NULL)),
args[4].wxTEMPLATED_MEMBER_CALL(Get, T4), (args[4]).As(static_cast<T4*>(NULL)),
args[5].wxTEMPLATED_MEMBER_CALL(Get, T5) (args[5]).As(static_cast<T5*>(NULL))
); );
return o != NULL; return o != NULL;
} }
@@ -405,17 +395,17 @@ template<typename Class,
typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
struct wxObjectAllocatorAndCreator_7 : public wxObjectAllocatorAndCreator struct wxObjectAllocatorAndCreator_7 : public wxObjectAllocatorAndCreator
{ {
bool Create(wxObject * &o, wxVariantBase *args) bool Create(wxObject * &o, wxAny *args)
{ {
Class *obj = wx_dynamic_cast(Class*, o); Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create( return obj->Create(
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0), (args[0]).As(static_cast<T0*>(NULL)),
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1), (args[1]).As(static_cast<T1*>(NULL)),
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2), (args[2]).As(static_cast<T2*>(NULL)),
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3), (args[3]).As(static_cast<T3*>(NULL)),
args[4].wxTEMPLATED_MEMBER_CALL(Get, T4), (args[4]).As(static_cast<T4*>(NULL)),
args[5].wxTEMPLATED_MEMBER_CALL(Get, T5), (args[5]).As(static_cast<T5*>(NULL)),
args[6].wxTEMPLATED_MEMBER_CALL(Get, T6) (args[6]).As(static_cast<T6*>(NULL))
); );
} }
}; };
@@ -433,16 +423,16 @@ template<typename Class,
typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
struct wxDirectConstructorBridge_7 : public wxObjectAllocator struct wxDirectConstructorBridge_7 : public wxObjectAllocator
{ {
bool Create(wxObject * &o, wxVariantBase *args) bool Create(wxObject * &o, wxAny *args)
{ {
o = new Class( o = new Class(
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0), (args[0]).As(static_cast<T0*>(NULL)),
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1), (args[1]).As(static_cast<T1*>(NULL)),
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2), (args[2]).As(static_cast<T2*>(NULL)),
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3), (args[3]).As(static_cast<T3*>(NULL)),
args[4].wxTEMPLATED_MEMBER_CALL(Get, T4), (args[4]).As(static_cast<T4*>(NULL)),
args[3].wxTEMPLATED_MEMBER_CALL(Get, T5), (args[5]).As(static_cast<T5*>(NULL)),
args[4].wxTEMPLATED_MEMBER_CALL(Get, T6) (args[6]).As(static_cast<T6*>(NULL))
); );
return o != NULL; return o != NULL;
} }
@@ -463,18 +453,18 @@ typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, \
typename T6, typename T7> typename T6, typename T7>
struct wxObjectAllocatorAndCreator_8 : public wxObjectAllocatorAndCreator struct wxObjectAllocatorAndCreator_8 : public wxObjectAllocatorAndCreator
{ {
bool Create(wxObject * &o, wxVariantBase *args) bool Create(wxObject * &o, wxAny *args)
{ {
Class *obj = wx_dynamic_cast(Class*, o); Class *obj = wx_dynamic_cast(Class*, o);
return obj->Create( return obj->Create(
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0), (args[0]).As(static_cast<T0*>(NULL)),
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1), (args[1]).As(static_cast<T1*>(NULL)),
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2), (args[2]).As(static_cast<T2*>(NULL)),
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3), (args[3]).As(static_cast<T3*>(NULL)),
args[4].wxTEMPLATED_MEMBER_CALL(Get, T4), (args[4]).As(static_cast<T4*>(NULL)),
args[5].wxTEMPLATED_MEMBER_CALL(Get, T5), (args[5]).As(static_cast<T5*>(NULL)),
args[6].wxTEMPLATED_MEMBER_CALL(Get, T6), (args[6]).As(static_cast<T6*>(NULL)),
args[7].wxTEMPLATED_MEMBER_CALL(Get, T7) (args[7]).As(static_cast<T7*>(NULL))
); );
} }
}; };
@@ -493,17 +483,17 @@ typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, \
typename T6, typename T7> typename T6, typename T7>
struct wxDirectConstructorBridge_8 : public wxObjectAllocator struct wxDirectConstructorBridge_8 : public wxObjectAllocator
{ {
bool Create(wxObject * &o, wxVariantBase *args) bool Create(wxObject * &o, wxAny *args)
{ {
o = new Class( o = new Class(
args[0].wxTEMPLATED_MEMBER_CALL(Get, T0), (args[0]).As(static_cast<T0*>(NULL)),
args[1].wxTEMPLATED_MEMBER_CALL(Get, T1), (args[1]).As(static_cast<T1*>(NULL)),
args[2].wxTEMPLATED_MEMBER_CALL(Get, T2), (args[2]).As(static_cast<T2*>(NULL)),
args[3].wxTEMPLATED_MEMBER_CALL(Get, T3), (args[3]).As(static_cast<T3*>(NULL)),
args[4].wxTEMPLATED_MEMBER_CALL(Get, T4), (args[4]).As(static_cast<T4*>(NULL)),
args[3].wxTEMPLATED_MEMBER_CALL(Get, T5), (args[5]).As(static_cast<T5*>(NULL)),
args[4].wxTEMPLATED_MEMBER_CALL(Get, T6), (args[6]).As(static_cast<T6*>(NULL)),
args[4].wxTEMPLATED_MEMBER_CALL(Get, T7) (args[7]).As(static_cast<T7*>(NULL))
); );
return o != NULL; return o != NULL;
} }

View File

@@ -17,18 +17,21 @@
#if wxUSE_EXTENDED_RTTI #if wxUSE_EXTENDED_RTTI
#include "wx/string.h" #include "wx/xti.h"
class WXDLLIMPEXP_BASE wxObject; // copied from event.h which cannot be included at this place, TODO MOVE to common file
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&); 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 // Handler Info

View File

@@ -17,18 +17,14 @@
#if wxUSE_EXTENDED_RTTI #if wxUSE_EXTENDED_RTTI
#include "wx/string.h" #include "wx/xti.h"
#include "wx/variant.h" #include "wx/any.h"
#include "wx/intl.h"
#include "wx/log.h"
#include "wx/xtitypes.h"
class WXDLLIMPEXP_BASE wxObject; class WXDLLIMPEXP_BASE wxObject;
class WXDLLIMPEXP_BASE wxClassInfo; class WXDLLIMPEXP_BASE wxClassInfo;
class WXDLLIMPEXP_BASE wxDynamicClassInfo; class WXDLLIMPEXP_BASE wxDynamicClassInfo;
class WXDLLIMPEXP_BASE wxHashTable; class WXDLLIMPEXP_BASE wxHashTable;
class WXDLLIMPEXP_BASE wxHashTable_Node; class WXDLLIMPEXP_BASE wxHashTable_Node;
class WXDLLIMPEXP_BASE wxObjectRefData;
class WXDLLIMPEXP_BASE wxEvent; class WXDLLIMPEXP_BASE wxEvent;
class WXDLLIMPEXP_BASE wxEvtHandler; class WXDLLIMPEXP_BASE wxEvtHandler;
@@ -46,7 +42,7 @@ public:
wxPropertySetter( const wxString name ) { m_name = name; } wxPropertySetter( const wxString name ) { m_name = name; }
virtual ~wxPropertySetter() {} 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; } const wxString& GetName() const { return m_name; }
private: private:
@@ -59,7 +55,7 @@ public:
wxPropertyGetter( const wxString name ) { m_name = name; } wxPropertyGetter( const wxString name ) { m_name = name; }
virtual ~wxPropertyGetter() {} 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; } const wxString& GetName() const { return m_name; }
private: private:
@@ -72,7 +68,7 @@ public:
wxPropertyCollectionGetter( const wxString name ) { m_name = name; } wxPropertyCollectionGetter( const wxString name ) { m_name = name; }
virtual ~wxPropertyCollectionGetter() {} 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; } const wxString& GetName() const { return m_name; }
private: private:
@@ -80,7 +76,7 @@ private:
}; };
template<typename coll_t> void WXDLLIMPEXP_BASE \ 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 class WXDLLIMPEXP_BASE wxPropertyCollectionAdder
{ {
@@ -88,7 +84,7 @@ public:
wxPropertyCollectionAdder( const wxString name ) { m_name = name; } wxPropertyCollectionAdder( const wxString name ) { m_name = name; }
virtual ~wxPropertyCollectionAdder() {} 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; } const wxString& GetName() const { return m_name; }
private: private:
@@ -103,13 +99,14 @@ public: \
wxPropertySetter##property() : wxPropertySetter( wxT(#setterMethod) ) {} \ 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); \ Klass *obj = dynamic_cast<Klass*>(object); \
if ( variantValue.wxTEMPLATED_MEMBER_CALL(HasData, valueType) ) \ valueType tempobj; \
obj->setterMethod(variantValue.wxTEMPLATED_MEMBER_CALL(Get, valueType)); \ if ( variantValue.GetAs(&tempobj) ) \
obj->setterMethod(tempobj); \
else \ else \
obj->setterMethod(*variantValue.wxTEMPLATED_MEMBER_CALL(Get, valueType*)); \ obj->setterMethod(*wxANY_AS(variantValue, valueType*)); \
} \ } \
}; };
@@ -121,10 +118,10 @@ public: \
wxPropertyGetter##property() : wxPropertyGetter( wxT(#gettermethod) ) {} \ wxPropertyGetter##property() : wxPropertyGetter( wxT(#gettermethod) ) {} \
virtual ~wxPropertyGetter##property() {} \ 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); \ const Klass *obj = dynamic_cast<const Klass*>(object); \
result = wxVariantBase( obj->gettermethod() ); \ result = wxAny( obj->gettermethod() ); \
} \ } \
}; };
@@ -136,13 +133,14 @@ public: \
wxPropertyCollectionAdder##property() : wxPropertyCollectionAdder( wxT(#addermethod) ) {} \ wxPropertyCollectionAdder##property() : wxPropertyCollectionAdder( wxT(#addermethod) ) {} \
virtual ~wxPropertyCollectionAdder##property() {} \ 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); \ Klass *obj = dynamic_cast<Klass*>(object); \
if ( variantValue.wxTEMPLATED_MEMBER_CALL(HasData, valueType) ) \ valueType tempobj; \
obj->addermethod(variantValue.wxTEMPLATED_MEMBER_CALL(Get, valueType)); \ if ( variantValue.GetAs(&tempobj) ) \
obj->addermethod(tempobj); \
else \ else \
obj->addermethod(*variantValue.wxTEMPLATED_MEMBER_CALL(Get, valueType*)); \ obj->addermethod(*wxANY_AS(variantValue, valueType*)); \
} \ } \
}; };
@@ -154,7 +152,7 @@ public: \
wxPropertyCollectionGetter##property() : wxPropertyCollectionGetter( wxT(#gettermethod) ) {} \ wxPropertyCollectionGetter##property() : wxPropertyCollectionGetter( wxT(#gettermethod) ) {} \
virtual ~wxPropertyCollectionGetter##property() {} \ 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); \ const Klass *obj = dynamic_cast<const Klass*>(object); \
wxCollectionToVariantArray( obj->gettermethod(), result ); \ wxCollectionToVariantArray( obj->gettermethod(), result ); \
@@ -172,7 +170,7 @@ public:
virtual ~wxPropertyAccessor() {} virtual ~wxPropertyAccessor() {}
// Setting a simple property (non-collection) // 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 ) if ( m_setter )
m_setter->Set( object, value ); m_setter->Set( object, value );
@@ -181,7 +179,7 @@ public:
} }
// Getting a simple property (non-collection) // 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 ) if ( m_getter )
m_getter->Get( object, result ); m_getter->Get( object, result );
@@ -190,7 +188,7 @@ public:
} }
// Adding an element to a collection property // 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 ) if ( m_adder )
m_adder->Add( object, value ); m_adder->Add( object, value );
@@ -199,7 +197,7 @@ public:
} }
// Getting a collection property // 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 ) if ( m_collectionGetter )
m_collectionGetter->Get( obj, result); m_collectionGetter->Get( obj, result);
@@ -250,19 +248,19 @@ public:
virtual const wxString& GetSetterName() const virtual const wxString& GetSetterName() const
{ return m_setterName; } { return m_setterName; }
virtual void SetProperty(wxObject *object, const wxVariantBase &value) const; virtual void SetProperty(wxObject *object, const wxAny &value) const;
virtual void GetProperty(const wxObject *object, wxVariantBase &value) const; virtual void GetProperty(const wxObject *object, wxAny &value) const;
// Adding an element to a collection property // Adding an element to a collection property
virtual void AddToPropertyCollection(wxObject *WXUNUSED(object), virtual void AddToPropertyCollection(wxObject *WXUNUSED(object),
const wxVariantBase &WXUNUSED(value)) const const wxAny &WXUNUSED(value)) const
{ {
wxLogError( _("AddToPropertyCollection called on a generic accessor") ); wxLogError( _("AddToPropertyCollection called on a generic accessor") );
} }
// Getting a collection property // Getting a collection property
virtual void GetPropertyCollection( const wxObject *WXUNUSED(obj), virtual void GetPropertyCollection( const wxObject *WXUNUSED(obj),
wxVariantBaseArray &WXUNUSED(result)) const wxAnyList &WXUNUSED(result)) const
{ {
wxLogError ( _("GetPropertyCollection called on a generic accessor") ); wxLogError ( _("GetPropertyCollection called on a generic accessor") );
} }
@@ -312,7 +310,7 @@ public:
const wxString& name, const wxString& name,
const wxString& typeName, const wxString& typeName,
wxPropertyAccessor *accessor, wxPropertyAccessor *accessor,
wxVariantBase dv, wxAny dv,
wxPropertyInfoFlags flags = 0, wxPropertyInfoFlags flags = 0,
const wxString& helpString = wxEmptyString, const wxString& helpString = wxEmptyString,
const wxString& groupString = wxEmptyString) : const wxString& groupString = wxEmptyString) :
@@ -336,7 +334,7 @@ public:
const wxString& name, const wxString& name,
const char* typeName, const char* typeName,
wxPropertyAccessor *accessor, wxPropertyAccessor *accessor,
wxVariantBase dv, wxAny dv,
wxPropertyInfoFlags flags = 0, wxPropertyInfoFlags flags = 0,
const wxString& helpString = wxEmptyString, const wxString& helpString = wxEmptyString,
const wxString& groupString = wxEmptyString) : const wxString& groupString = wxEmptyString) :
@@ -359,7 +357,7 @@ public:
const wxString& name, const wxString& name,
wxEventSourceTypeInfo* type, wxEventSourceTypeInfo* type,
wxPropertyAccessor *accessor, wxPropertyAccessor *accessor,
wxVariantBase dv, wxAny dv,
wxPropertyInfoFlags flags = 0, wxPropertyInfoFlags flags = 0,
const wxString& helpString = wxEmptyString, const wxString& helpString = wxEmptyString,
const wxString& groupString = wxEmptyString) : const wxString& groupString = wxEmptyString) :
@@ -462,7 +460,7 @@ public:
wxPropertyInfo* GetNext() const { return m_next; } wxPropertyInfo* GetNext() const { return m_next; }
// returns the default value of this property, its kind may be wxT_VOID if it is not valid // 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: private:
@@ -480,7 +478,7 @@ private:
mutable wxTypeInfo* m_collectionElementTypeInfo; mutable wxTypeInfo* m_collectionElementTypeInfo;
wxString m_collectionElementTypeName; wxString m_collectionElementTypeName;
wxPropertyAccessor* m_accessor; wxPropertyAccessor* m_accessor;
wxVariantBase m_defaultValue; wxAny m_defaultValue;
wxPropertyInfoFlags m_flags; wxPropertyInfoFlags m_flags;
wxString m_helpString; wxString m_helpString;
wxString m_groupString; wxString m_groupString;
@@ -506,7 +504,7 @@ WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxPropertyInfo*, wxPropertyInfoMap,
#define wxHIDE_PROPERTY( pname ) \ #define wxHIDE_PROPERTY( pname ) \
static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \ 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 ); wxEmptyString, wxEmptyString );
#define wxPROPERTY( pname, type, setter, getter, defaultValue, flags, help, group) \ #define wxPROPERTY( pname, type, setter, getter, defaultValue, flags, help, group) \
@@ -518,7 +516,7 @@ WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxPropertyInfo*, wxPropertyInfoMap,
&_getter##pname, NULL, NULL ); \ &_getter##pname, NULL, NULL ); \
static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \ static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
wxT(#pname), typeid(type).name(), &_accessor##pname, \ 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, \ #define wxPROPERTY_FLAGS( pname, flags, type, setter, getter,defaultValue, \
pflags, help, group) \ pflags, help, group) \
@@ -530,7 +528,7 @@ WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxPropertyInfo*, wxPropertyInfoMap,
&_getter##pname, NULL, NULL ); \ &_getter##pname, NULL, NULL ); \
static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \ static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
wxT(#pname), typeid(flags).name(), &_accessor##pname, \ 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) \ #define wxREADONLY_PROPERTY( pname, type, getter,defaultValue, flags, help, group) \
wxPROPERTY_GETTER( pname, class_t, type, getter ) \ wxPROPERTY_GETTER( pname, class_t, type, getter ) \
@@ -538,7 +536,7 @@ WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxPropertyInfo*, wxPropertyInfoMap,
static wxPropertyAccessor _accessor##pname( NULL, &_getter##pname, NULL, NULL ); \ static wxPropertyAccessor _accessor##pname( NULL, &_getter##pname, NULL, NULL ); \
static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \ static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
wxT(#pname), typeid(type).name(),&_accessor##pname, \ 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, \ #define wxREADONLY_PROPERTY_FLAGS( pname, flags, type, getter,defaultValue, \
pflags, help, group) \ pflags, help, group) \
@@ -547,7 +545,7 @@ WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxPropertyInfo*, wxPropertyInfoMap,
static wxPropertyAccessor _accessor##pname( NULL, &_getter##pname, NULL, NULL ); \ static wxPropertyAccessor _accessor##pname( NULL, &_getter##pname, NULL, NULL ); \
static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \ static wxPropertyInfo _propertyInfo##pname( first, class_t::GetClassInfoStatic(), \
wxT(#pname), typeid(flags).name(),&_accessor##pname, \ 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, \ #define wxPROPERTY_COLLECTION( pname, colltype, addelemtype, adder, getter, \
flags, help, group ) \ flags, help, group ) \
@@ -574,13 +572,13 @@ WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxPropertyInfo*, wxPropertyInfoMap,
#define wxEVENT_PROPERTY( name, eventType, eventClass ) \ #define wxEVENT_PROPERTY( name, eventType, eventClass ) \
static wxEventSourceTypeInfo _typeInfo##name( eventType, CLASSINFO( eventClass ) ); \ static wxEventSourceTypeInfo _typeInfo##name( eventType, CLASSINFO( eventClass ) ); \
static wxPropertyInfo _propertyInfo##name( first,class_t::GetClassInfoStatic(), \ 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 ) \ #define wxEVENT_RANGE_PROPERTY( name, eventType, lastEventType, eventClass ) \
static wxEventSourceTypeInfo _typeInfo##name( eventType, lastEventType, \ static wxEventSourceTypeInfo _typeInfo##name( eventType, lastEventType, \
CLASSINFO( eventClass ) ); \ CLASSINFO( eventClass ) ); \
static wxPropertyInfo _propertyInfo##name( first, class_t::GetClassInfoStatic(), \ 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 // Implementation Helper for Simple Properties
@@ -593,5 +591,8 @@ public: \
void Set##name( type const & p) { m_##name = p; } \ void Set##name( type const & p) { m_##name = p; } \
type const & Get##name() const { return m_##name; } 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 // wxUSE_EXTENDED_RTTI
#endif // _XTIPROP_H_ #endif // _XTIPROP_H_

View File

@@ -83,6 +83,11 @@ private:
#define wxENUM_MEMBER( v ) { wxT(#v), v }, #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 ) \ #define wxEND_ENUM( e ) \
{ NULL, 0 } }; \ { NULL, 0 } }; \
wxEnumData s_enumData##e( s_enumDataMembers##e ); \ wxEnumData s_enumData##e( s_enumDataMembers##e ); \
@@ -91,10 +96,10 @@ private:
{ data = (e) s_enumData##e.GetEnumMemberValue(s); } \ { data = (e) s_enumData##e.GetEnumMemberValue(s); } \
template<> void wxStringWriteValue(wxString &s, const e &data ) \ template<> void wxStringWriteValue(wxString &s, const e &data ) \
{ s = s_enumData##e.GetEnumMemberName((int)data); } \ { s = s_enumData##e.GetEnumMemberName((int)data); } \
void FromLong##e( long data, wxVariantBase& result ) \ void FromLong##e( long data, wxAny& result ) \
{ result = wxVariantBase((e)data); } \ { result = wxAny((e)data); } \
void ToLong##e( const wxVariantBase& data, long &result ) \ void ToLong##e( const wxAny& data, long &result ) \
{ result = (long) data.wxTEMPLATED_MEMBER_CALL(Get, e); } \ { result = (long) (data).As(static_cast<e*>(NULL)); } \
\ \
wxTO_STRING_IMP( e ) \ wxTO_STRING_IMP( e ) \
wxFROM_STRING_IMP( e ) \ wxFROM_STRING_IMP( e ) \
@@ -180,10 +185,10 @@ void wxSetToString( wxString &s, const wxBitset<e> &data )
{ wxSetFromString( s, data ); } \ { wxSetFromString( s, data ); } \
template<> void wxStringWriteValue( wxString &s, const wxBitset<e> &data ) \ template<> void wxStringWriteValue( wxString &s, const wxBitset<e> &data ) \
{ wxSetToString( s, data ); } \ { wxSetToString( s, data ); } \
void FromLong##SetName( long data, wxVariantBase& result ) \ void FromLong##SetName( long data, wxAny& result ) \
{ result = wxVariantBase(SetName((unsigned long)data)); } \ { result = wxAny(SetName((unsigned long)data)); } \
void ToLong##SetName( const wxVariantBase& data, long &result ) \ void ToLong##SetName( const wxAny& data, long &result ) \
{ result = (long) data.wxTEMPLATED_MEMBER_CALL(Get, SetName).to_ulong(); } \ { result = (long) (data).As(static_cast<SetName*>(NULL)).to_ulong(); } \
wxTO_STRING_IMP( SetName ) \ wxTO_STRING_IMP( SetName ) \
wxFROM_STRING_IMP( SetName ) \ wxFROM_STRING_IMP( SetName ) \
wxEnumTypeInfo s_typeInfo##SetName(wxT_SET, &s_enumData##e, \ wxEnumTypeInfo s_typeInfo##SetName(wxT_SET, &s_enumData##e, \
@@ -239,6 +244,11 @@ void wxFlagsToString( wxString &s, const e& data )
#define wxFLAGS_MEMBER( v ) { wxT(#v), v }, #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 ) \ #define wxEND_FLAGS( e ) \
{ NULL, 0 } }; \ { NULL, 0 } }; \
wxEnumData s_enumData##e( s_enumDataMembers##e ); \ wxEnumData s_enumData##e( s_enumDataMembers##e ); \
@@ -247,10 +257,10 @@ void wxFlagsToString( wxString &s, const e& data )
{ wxFlagsFromString<e>( s, data ); } \ { wxFlagsFromString<e>( s, data ); } \
template<> void wxStringWriteValue( wxString &s, const e& data ) \ template<> void wxStringWriteValue( wxString &s, const e& data ) \
{ wxFlagsToString<e>( s, data ); } \ { wxFlagsToString<e>( s, data ); } \
void FromLong##e( long data, wxVariantBase& result ) \ void FromLong##e( long data, wxAny& result ) \
{ result = wxVariantBase(e(data)); } \ { result = wxAny(e(data)); } \
void ToLong##e( const wxVariantBase& data, long &result ) \ void ToLong##e( const wxAny& data, long &result ) \
{ result = (long) data.wxTEMPLATED_MEMBER_CALL(Get, e).m_data; } \ { result = (long) (data).As(static_cast<e*>(NULL)).m_data; } \
wxTO_STRING_IMP( e ) \ wxTO_STRING_IMP( e ) \
wxFROM_STRING_IMP( e ) \ wxFROM_STRING_IMP( e ) \
wxEnumTypeInfo s_typeInfo##e(wxT_SET, &s_enumData##e, \ wxEnumTypeInfo s_typeInfo##e(wxT_SET, &s_enumData##e, \
@@ -278,6 +288,8 @@ enum wxTypeKind
wxT_UINT, wxT_UINT,
wxT_LONG, wxT_LONG,
wxT_ULONG, wxT_ULONG,
wxT_LONGLONG,
wxT_ULONGLONG,
wxT_FLOAT, wxT_FLOAT,
wxT_DOUBLE, wxT_DOUBLE,
wxT_STRING, // must be wxString wxT_STRING, // must be wxString
@@ -296,7 +308,7 @@ enum wxTypeKind
wxT_LAST_TYPE_KIND = wxT_DELEGATE // sentinel for bad data, asserts, debugging wxT_LAST_TYPE_KIND = wxT_DELEGATE // sentinel for bad data, asserts, debugging
}; };
class WXDLLIMPEXP_BASE wxVariantBase; class WXDLLIMPEXP_BASE wxAny;
class WXDLLIMPEXP_BASE wxTypeInfo; class WXDLLIMPEXP_BASE wxTypeInfo;
WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxTypeInfo*, wxTypeInfoMap, class WXDLLIMPEXP_BASE ); WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxTypeInfo*, wxTypeInfoMap, class WXDLLIMPEXP_BASE );
@@ -304,8 +316,8 @@ WX_DECLARE_STRING_HASH_MAP_WITH_DECL( wxTypeInfo*, wxTypeInfoMap, class WXDLLIMP
class WXDLLIMPEXP_BASE wxTypeInfo class WXDLLIMPEXP_BASE wxTypeInfo
{ {
public: public:
typedef void (*wxVariant2StringFnc)( const wxVariantBase& data, wxString &result ); typedef void (*wxVariant2StringFnc)( const wxAny& data, wxString &result );
typedef void (*wxString2VariantFnc)( const wxString& data, wxVariantBase &result ); typedef void (*wxString2VariantFnc)( const wxString& data, wxAny &result );
wxTypeInfo(wxTypeKind kind, wxTypeInfo(wxTypeKind kind,
wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL, wxVariant2StringFnc to = NULL, wxString2VariantFnc from = NULL,
@@ -348,8 +360,8 @@ public:
// can the content of this type be converted to and from strings ? // can the content of this type be converted to and from strings ?
bool HasStringConverters() const { return m_toString != NULL && m_fromString != NULL; } bool HasStringConverters() const { return m_toString != NULL && m_fromString != NULL; }
// convert a wxVariantBase holding data of this type into a string // convert a wxAny holding data of this type into a string
void ConvertToString( const wxVariantBase& data, wxString &result ) const void ConvertToString( const wxAny& data, wxString &result ) const
{ {
if ( m_toString ) if ( m_toString )
(*m_toString)( data, result ); (*m_toString)( data, result );
@@ -357,8 +369,8 @@ public:
wxLogError( wxGetTranslation(_T("String conversions not supported")) ); wxLogError( wxGetTranslation(_T("String conversions not supported")) );
} }
// convert a string into a wxVariantBase holding the corresponding data in this type // convert a string into a wxAny holding the corresponding data in this type
void ConvertFromString( const wxString& data, wxVariantBase &result ) const void ConvertFromString( const wxString& data, wxAny &result ) const
{ {
if( m_fromString ) if( m_fromString )
(*m_fromString)( data, result ); (*m_fromString)( data, result );
@@ -368,6 +380,8 @@ public:
// statics: // statics:
static wxTypeInfo *FindType( const wxString& typeName );
#if 0 // TODO
#if wxUSE_UNICODE #if wxUSE_UNICODE
static wxTypeInfo *FindType(const char *typeName) static wxTypeInfo *FindType(const char *typeName)
{ return FindType( wxString::FromAscii(typeName) ); } { return FindType( wxString::FromAscii(typeName) ); }
@@ -381,7 +395,7 @@ public:
return FindType( typeName.char_str() ); return FindType( typeName.char_str() );
#endif #endif
} }
#endif
private: private:
void Register(); void Register();
void Unregister(); void Unregister();
@@ -432,8 +446,8 @@ public:
class WXDLLIMPEXP_BASE wxEnumTypeInfo : public wxTypeInfo class WXDLLIMPEXP_BASE wxEnumTypeInfo : public wxTypeInfo
{ {
public: public:
typedef void (*converterToLong_t)( const wxVariantBase& data, long &result ); typedef void (*converterToLong_t)( const wxAny& data, long &result );
typedef void (*converterFromLong_t)( long data, wxVariantBase &result ); typedef void (*converterFromLong_t)( long data, wxAny &result );
wxEnumTypeInfo( wxTypeKind kind, wxEnumData* enumInfo, wxVariant2StringFnc to, wxEnumTypeInfo( wxTypeKind kind, wxEnumData* enumInfo, wxVariant2StringFnc to,
wxString2VariantFnc from, converterToLong_t toLong, wxString2VariantFnc from, converterToLong_t toLong,
@@ -458,8 +472,8 @@ public:
#endif #endif
const wxEnumData* GetEnumData() const { return m_enumInfo; } const wxEnumData* GetEnumData() const { return m_enumInfo; }
// convert a wxVariantBase holding data of this type into a long // convert a wxAny holding data of this type into a long
void ConvertToLong( const wxVariantBase& data, long &result ) const void ConvertToLong( const wxAny& data, long &result ) const
{ {
if( m_toLong ) if( m_toLong )
(*m_toLong)( data, result ); (*m_toLong)( data, result );
@@ -467,8 +481,8 @@ public:
wxLogError( wxGetTranslation(_T("Long Conversions not supported")) ); wxLogError( wxGetTranslation(_T("Long Conversions not supported")) );
} }
// convert a long into a wxVariantBase holding the corresponding data in this type // convert a long into a wxAny holding the corresponding data in this type
void ConvertFromLong( long data, wxVariantBase &result ) const void ConvertFromLong( long data, wxAny &result ) const
{ {
if( m_fromLong ) if( m_fromLong )
(*m_fromLong)( data, result ); (*m_fromLong)( data, result );
@@ -547,7 +561,7 @@ private:
int m_lastEventType; int m_lastEventType;
}; };
template<typename T> const wxTypeInfo* wxGetTypeInfo( T * ) \ template<typename T> const wxTypeInfo* wxGetTypeInfo( T * )
{ return wxTypeInfo::FindType(typeid(T).name()); } { return wxTypeInfo::FindType(typeid(T).name()); }
// this macro is for usage with custom, non-object derived classes and structs, // this macro is for usage with custom, non-object derived classes and structs,
@@ -558,9 +572,9 @@ template<typename T> const wxTypeInfo* wxGetTypeInfo( T * ) \
wxCustomTypeInfo s_typeInfo##e(typeid(e).name(), &toString, &fromString); wxCustomTypeInfo s_typeInfo##e(typeid(e).name(), &toString, &fromString);
#else #else
#define wxCUSTOM_TYPE_INFO( e, toString, fromString ) \ #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); } \ { toString(data, result); } \
void FromString##e( const wxString& data, wxVariantBase &result ) \ void FromString##e( const wxString& data, wxAny &result ) \
{ fromString(data, result); } \ { fromString(data, result); } \
wxCustomTypeInfo s_typeInfo##e(typeid(e).name(), \ wxCustomTypeInfo s_typeInfo##e(typeid(e).name(), \
&ToString##e, &FromString##e); &ToString##e, &FromString##e);