#ifndef _WX_XTIH__
#define _WX_XTIH__
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma interface "xti.h"
-#endif
-
// We want to support properties, event sources and events sinks through
// explicit declarations, using templates and specialization to make the
// effort as painless as possible.
class WXDLLIMPEXP_BASE wxHashTable;
class WXDLLIMPEXP_BASE wxObjectRefData;
class WXDLLIMPEXP_BASE wxEvent;
+class WXDLLIMPEXP_BASE wxEvtHandler;
typedef void (wxObject::*wxObjectEventFunction)(wxEvent&);
if ( data.test( value ) )
{
// this could also be done by the templated calls
- if ( !s.IsEmpty() )
+ if ( !s.empty() )
s +=wxT("|") ;
s += edata->GetEnumMemberNameByIndex(i) ;
}
// clear the flags we just set
dataValue &= ~value ;
// this could also be done by the templated calls
- if ( !s.IsEmpty() )
+ if ( !s.empty() )
s +=wxT("|") ;
s += edata->GetEnumMemberNameByIndex(i) ;
}
wxxVariant& operator=(const wxxVariant &d)
{
- m_data = d.m_data->Clone() ;
+ delete m_data;
+ m_data = d.m_data ? d.m_data->Clone() : NULL ;
m_name = d.m_name ;
return *this ;
}
wxString m_name ;
} ;
-#include <wx/dynarray.h>
+#include "wx/dynarray.h"
WX_DECLARE_OBJARRAY_WITH_DECL(wxxVariant, wxxVariantArray, class WXDLLIMPEXP_BASE);
wxGenericPropertyAccessor( const wxString &propName ) ;
~wxGenericPropertyAccessor() ;
- void RenameProperty( const wxString &oldName , const wxString &newName )
+ void RenameProperty( const wxString& WXUNUSED_UNLESS_DEBUG(oldName),
+ const wxString& newName )
{
wxASSERT( oldName == m_propertyName ) ; m_propertyName = newName ;
}
const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) } ; \
const int klass::ms_constructorPropertiesCount = 3 ;
+// direct constructor version
+
+template<typename Class,
+typename T0, typename T1, typename T2>
+struct wxDirectConstructorBridge_3 : public wxDirectConstructorBrigde
+{
+ void Create(wxObject * &o, wxxVariant *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)
+ );
+ }
+};
+
+#define wxDIRECT_CONSTRUCTOR_3(klass,t0,v0,t1,v1,t2,v2) \
+ wxDirectConstructorBridge_3<klass,t0,t1,t2> constructor##klass ; \
+ wxConstructorBridge* klass::ms_constructor = &constructor##klass ; \
+ const wxChar *klass::ms_constructorProperties[] = { wxT(#v0) , wxT(#v1) , wxT(#v2) } ; \
+ const int klass::ms_constructorPropertiesCount = 3;
+
// 4 params
template<typename Class,
const wxChar *GetIncludeName() const { return m_unitName ; }
const wxClassInfo **GetParents() const { return m_parents; }
int GetSize() const { return m_objectSize; }
+ bool IsDynamic() const { return (NULL != m_objectConstructor); }
wxObjectConstructorFn GetConstructor() const { return m_objectConstructor; }
static const wxClassInfo *GetFirst() { return sm_first; }
#define IMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_NO_BASE_XTI( name , unit ) \
const wxClassInfo* name::ms_classParents[] = { NULL } ; \
- wxClassInfo name::ms_classInfo(name::ms_classParents , wxT("") , wxT(#name), \
+ wxClassInfo name::ms_classInfo(name::ms_classParents , wxEmptyString , wxT(#name), \
(int) sizeof(name), \
(wxObjectConstructorFn) 0 , \
name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \
#define IMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_XTI( name , basename, unit ) \
const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,NULL } ; \
- wxClassInfo name::ms_classInfo(name::ms_classParents , wxT("") , wxT(#name), \
+ wxClassInfo name::ms_classInfo(name::ms_classParents , wxEmptyString , wxT(#name), \
(int) sizeof(name), \
(wxObjectConstructorFn) 0 , \
name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \
wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \
wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \
wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast<name*> (data) ) ; } \
- wxClassInfo name::ms_classInfo(name::ms_classParents , wxT("") , wxT(#name), \
+ wxClassInfo name::ms_classInfo(name::ms_classParents , wxEmptyString , wxT(#name), \
(int) sizeof(name), \
(wxObjectConstructorFn) 0 , \
name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \
}
-#endif
+#endif // _WX_XTIH__