s = data.Format(wxT("%Y-%m-%d %H:%M:%S")) ;
}
-WX_CUSTOM_TYPE_INFO(wxDateTime, wxToStringConverter<wxDateTime> , wxFromStringConverter<wxDateTime>)
+wxCUSTOM_TYPE_INFO(wxDateTime, wxToStringConverter<wxDateTime> , wxFromStringConverter<wxDateTime>)
#endif
#if wxUSE_EXTENDED_RTTI
-WX_BEGIN_ENUM( wxFontEncoding )
- WX_ENUM_MEMBER( wxFONTENCODING_SYSTEM )
- WX_ENUM_MEMBER( wxFONTENCODING_DEFAULT )
-
- WX_ENUM_MEMBER( wxFONTENCODING_ISO8859_1 )
- WX_ENUM_MEMBER( wxFONTENCODING_ISO8859_2 )
- WX_ENUM_MEMBER( wxFONTENCODING_ISO8859_3 )
- WX_ENUM_MEMBER( wxFONTENCODING_ISO8859_4 )
- WX_ENUM_MEMBER( wxFONTENCODING_ISO8859_5 )
- WX_ENUM_MEMBER( wxFONTENCODING_ISO8859_6 )
- WX_ENUM_MEMBER( wxFONTENCODING_ISO8859_7 )
- WX_ENUM_MEMBER( wxFONTENCODING_ISO8859_8 )
- WX_ENUM_MEMBER( wxFONTENCODING_ISO8859_9 )
- WX_ENUM_MEMBER( wxFONTENCODING_ISO8859_10 )
- WX_ENUM_MEMBER( wxFONTENCODING_ISO8859_11 )
- WX_ENUM_MEMBER( wxFONTENCODING_ISO8859_12 )
- WX_ENUM_MEMBER( wxFONTENCODING_ISO8859_13 )
- WX_ENUM_MEMBER( wxFONTENCODING_ISO8859_14 )
- WX_ENUM_MEMBER( wxFONTENCODING_ISO8859_15 )
- WX_ENUM_MEMBER( wxFONTENCODING_ISO8859_MAX )
- WX_ENUM_MEMBER( wxFONTENCODING_KOI8 )
- WX_ENUM_MEMBER( wxFONTENCODING_ALTERNATIVE )
- WX_ENUM_MEMBER( wxFONTENCODING_BULGARIAN )
- WX_ENUM_MEMBER( wxFONTENCODING_CP437 )
- WX_ENUM_MEMBER( wxFONTENCODING_CP850 )
- WX_ENUM_MEMBER( wxFONTENCODING_CP852 )
- WX_ENUM_MEMBER( wxFONTENCODING_CP855 )
- WX_ENUM_MEMBER( wxFONTENCODING_CP866 )
-
- WX_ENUM_MEMBER( wxFONTENCODING_CP874 )
- WX_ENUM_MEMBER( wxFONTENCODING_CP932 )
- WX_ENUM_MEMBER( wxFONTENCODING_CP936 )
- WX_ENUM_MEMBER( wxFONTENCODING_CP949 )
- WX_ENUM_MEMBER( wxFONTENCODING_CP950 )
- WX_ENUM_MEMBER( wxFONTENCODING_CP1250 )
- WX_ENUM_MEMBER( wxFONTENCODING_CP1251 )
- WX_ENUM_MEMBER( wxFONTENCODING_CP1252 )
- WX_ENUM_MEMBER( wxFONTENCODING_CP1253 )
- WX_ENUM_MEMBER( wxFONTENCODING_CP1254 )
- WX_ENUM_MEMBER( wxFONTENCODING_CP1255 )
- WX_ENUM_MEMBER( wxFONTENCODING_CP1256 )
- WX_ENUM_MEMBER( wxFONTENCODING_CP1257 )
- WX_ENUM_MEMBER( wxFONTENCODING_CP12_MAX )
- WX_ENUM_MEMBER( wxFONTENCODING_UTF7 )
- WX_ENUM_MEMBER( wxFONTENCODING_UTF8 )
- WX_ENUM_MEMBER( wxFONTENCODING_GB2312 )
- WX_ENUM_MEMBER( wxFONTENCODING_BIG5 )
- WX_ENUM_MEMBER( wxFONTENCODING_SHIFT_JIS )
- WX_ENUM_MEMBER( wxFONTENCODING_EUC_JP )
- WX_ENUM_MEMBER( wxFONTENCODING_UNICODE )
-WX_END_ENUM( wxFontEncoding )
+wxBEGIN_ENUM( wxFontEncoding )
+ wxENUM_MEMBER( wxFONTENCODING_SYSTEM )
+ wxENUM_MEMBER( wxFONTENCODING_DEFAULT )
+
+ wxENUM_MEMBER( wxFONTENCODING_ISO8859_1 )
+ wxENUM_MEMBER( wxFONTENCODING_ISO8859_2 )
+ wxENUM_MEMBER( wxFONTENCODING_ISO8859_3 )
+ wxENUM_MEMBER( wxFONTENCODING_ISO8859_4 )
+ wxENUM_MEMBER( wxFONTENCODING_ISO8859_5 )
+ wxENUM_MEMBER( wxFONTENCODING_ISO8859_6 )
+ wxENUM_MEMBER( wxFONTENCODING_ISO8859_7 )
+ wxENUM_MEMBER( wxFONTENCODING_ISO8859_8 )
+ wxENUM_MEMBER( wxFONTENCODING_ISO8859_9 )
+ wxENUM_MEMBER( wxFONTENCODING_ISO8859_10 )
+ wxENUM_MEMBER( wxFONTENCODING_ISO8859_11 )
+ wxENUM_MEMBER( wxFONTENCODING_ISO8859_12 )
+ wxENUM_MEMBER( wxFONTENCODING_ISO8859_13 )
+ wxENUM_MEMBER( wxFONTENCODING_ISO8859_14 )
+ wxENUM_MEMBER( wxFONTENCODING_ISO8859_15 )
+ wxENUM_MEMBER( wxFONTENCODING_ISO8859_MAX )
+ wxENUM_MEMBER( wxFONTENCODING_KOI8 )
+ wxENUM_MEMBER( wxFONTENCODING_ALTERNATIVE )
+ wxENUM_MEMBER( wxFONTENCODING_BULGARIAN )
+ wxENUM_MEMBER( wxFONTENCODING_CP437 )
+ wxENUM_MEMBER( wxFONTENCODING_CP850 )
+ wxENUM_MEMBER( wxFONTENCODING_CP852 )
+ wxENUM_MEMBER( wxFONTENCODING_CP855 )
+ wxENUM_MEMBER( wxFONTENCODING_CP866 )
+
+ wxENUM_MEMBER( wxFONTENCODING_CP874 )
+ wxENUM_MEMBER( wxFONTENCODING_CP932 )
+ wxENUM_MEMBER( wxFONTENCODING_CP936 )
+ wxENUM_MEMBER( wxFONTENCODING_CP949 )
+ wxENUM_MEMBER( wxFONTENCODING_CP950 )
+ wxENUM_MEMBER( wxFONTENCODING_CP1250 )
+ wxENUM_MEMBER( wxFONTENCODING_CP1251 )
+ wxENUM_MEMBER( wxFONTENCODING_CP1252 )
+ wxENUM_MEMBER( wxFONTENCODING_CP1253 )
+ wxENUM_MEMBER( wxFONTENCODING_CP1254 )
+ wxENUM_MEMBER( wxFONTENCODING_CP1255 )
+ wxENUM_MEMBER( wxFONTENCODING_CP1256 )
+ wxENUM_MEMBER( wxFONTENCODING_CP1257 )
+ wxENUM_MEMBER( wxFONTENCODING_CP12_MAX )
+ wxENUM_MEMBER( wxFONTENCODING_UTF7 )
+ wxENUM_MEMBER( wxFONTENCODING_UTF8 )
+ wxENUM_MEMBER( wxFONTENCODING_GB2312 )
+ wxENUM_MEMBER( wxFONTENCODING_BIG5 )
+ wxENUM_MEMBER( wxFONTENCODING_SHIFT_JIS )
+ wxENUM_MEMBER( wxFONTENCODING_EUC_JP )
+ wxENUM_MEMBER( wxFONTENCODING_UNICODE )
+wxEND_ENUM( wxFontEncoding )
#endif
// ----------------------------------------------------------------------------
s = wxString::Format(wxT("%d,%d"), data.x , data.y ) ;
}
-WX_CUSTOM_TYPE_INFO(wxPoint, wxToStringConverter<wxPoint> , wxFromStringConverter<wxPoint>)
+wxCUSTOM_TYPE_INFO(wxPoint, wxToStringConverter<wxPoint> , wxFromStringConverter<wxPoint>)
template<> void wxStringReadValue(const wxString &s , wxSize &data )
{
s = wxString::Format(wxT("%d,%d"), data.x , data.y ) ;
}
-WX_CUSTOM_TYPE_INFO(wxSize, wxToStringConverter<wxSize> , wxFromStringConverter<wxSize>)
+wxCUSTOM_TYPE_INFO(wxSize, wxToStringConverter<wxSize> , wxFromStringConverter<wxSize>)
#endif
// this are compiler induced specialization which are never used anywhere
-WX_ILLEGAL_TYPE_SPECIALIZATION( char const * )
-WX_ILLEGAL_TYPE_SPECIALIZATION( char * )
-WX_ILLEGAL_TYPE_SPECIALIZATION( unsigned char * )
-WX_ILLEGAL_TYPE_SPECIALIZATION( int * )
-WX_ILLEGAL_TYPE_SPECIALIZATION( bool * )
-WX_ILLEGAL_TYPE_SPECIALIZATION( long * )
-WX_ILLEGAL_TYPE_SPECIALIZATION( wxString * )
+wxILLEGAL_TYPE_SPECIALIZATION( char const * )
+wxILLEGAL_TYPE_SPECIALIZATION( char * )
+wxILLEGAL_TYPE_SPECIALIZATION( unsigned char * )
+wxILLEGAL_TYPE_SPECIALIZATION( int * )
+wxILLEGAL_TYPE_SPECIALIZATION( bool * )
+wxILLEGAL_TYPE_SPECIALIZATION( long * )
+wxILLEGAL_TYPE_SPECIALIZATION( wxString * )
-WX_COLLECTION_TYPE_INFO( wxString , wxArrayString ) ;
+wxCOLLECTION_TYPE_INFO( wxString , wxArrayString ) ;
template<> void wxCollectionToVariantArray( wxArrayString const &theArray, wxxVariantArray &value)
{
// own attributes in a hash map. Like this it is possible to create the objects and
// stream them, as if their class information was already available from compiled data
+// can't keep the attributes in a hash map, because if someone renames a property in
+// the class info, then things go potty later on when we try to iterate through
+// the property values by name.
+struct wxDynamicProperty__
+{
+#if wxUSE_UNICODE
+ wstring name;
+#else
+ string name;
+#endif
+ wxxVariant value;
+ wxDynamicProperty__ *next;
+};
+
struct wxDynamicObject::wxDynamicObjectInternal
{
+ wxDynamicObjectInternal() : m_properties(NULL) {}
+ wxDynamicProperty__ *m_properties;
+#if 0
#if wxUSE_UNICODE
map<wstring,wxxVariant> m_properties ;
#else
map<string,wxxVariant> m_properties ;
#endif
+#endif
} ;
// instantiates this object with an instance of its superclass
void wxDynamicObject::SetProperty (const wxChar *propertyName, const wxxVariant &value)
{
wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),wxT("Accessing Unknown Property in a Dynamic Object") ) ;
- m_data->m_properties[propertyName] = value ;
+ wxDynamicProperty__ *prop;
+ prop = m_data->m_properties;
+ while (prop)
+ {
+ if (!strcmp(prop->name.c_str(), propertyName))
+ {
+ prop->value = value;
+ return;
+ }
+ prop = prop->next;
+ }
+ prop = new wxDynamicProperty__;
+ prop->name = propertyName;
+ prop->value = value;
+ prop->next = m_data->m_properties;
+ m_data->m_properties = prop;
+// m_data->m_properties[propertyName] = value ;
}
wxxVariant wxDynamicObject::GetProperty (const wxChar *propertyName) const
{
wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),wxT("Accessing Unknown Property in a Dynamic Object") ) ;
- return m_data->m_properties[propertyName] ;
+ wxDynamicProperty__ *prop;
+ prop = m_data->m_properties;
+ while (prop)
+ {
+ if (!strcmp(prop->name.c_str(), propertyName))
+ return prop->value;
+ prop = prop->next;
+ }
+ // FIXME: needs to return something a little more sane here.
+ return wxxVariant();
+// return m_data->m_properties[propertyName] ;
}
// ----------------------------------------------------------------------------
DoBeginWriteElement() ;
wxxVariant value = data[i] ;
- if ( persister->BeforeWriteProperty( this , pi , value ) )
+ if ( persister->BeforeWriteProperty( this , obj, pi , value ) )
{
const wxClassTypeInfo* cti = dynamic_cast< const wxClassTypeInfo* > ( elementType ) ;
if ( cti )
if ( cti && value.GetAsObject() == NULL )
return ;
- if ( persister->BeforeWriteProperty( this , pi , value ) )
+ if ( persister->BeforeWriteProperty( this , obj, pi , value ) )
{
DoBeginWriteProperty( pi ) ;
if ( cti )
void wxRuntimeDepersister::SetConnect(int eventSourceObjectID,
const wxClassInfo *WXUNUSED(eventSourceClassInfo),
- const wxDelegateTypeInfo *delegateInfo ,
+ const wxPropertyInfo *delegateInfo ,
const wxClassInfo *WXUNUSED(eventSinkClassInfo) ,
const wxHandlerInfo* handlerInfo ,
int eventSinkObjectID )
if ( ehsource && ehsink )
{
- if( delegateInfo->GetLastEventType() == -1 )
+ const wxDelegateTypeInfo *delegateTypeInfo = dynamic_cast<const wxDelegateTypeInfo*>(delegateInfo->GetTypeInfo());
+ if( delegateTypeInfo && delegateTypeInfo->GetLastEventType() == -1 )
{
- ehsource->Connect( -1 , delegateInfo->GetEventType() ,
+ ehsource->Connect( -1 , delegateTypeInfo->GetEventType() ,
handlerInfo->GetEventFunction() , NULL /*user data*/ ,
ehsink ) ;
}
else
{
- for ( wxEventType iter = delegateInfo->GetEventType() ; iter <= delegateInfo->GetLastEventType() ; ++iter )
+ for ( wxEventType iter = delegateTypeInfo->GetEventType() ; iter <= delegateTypeInfo->GetLastEventType() ; ++iter )
{
ehsource->Connect( -1 , iter ,
handlerInfo->GetEventFunction() , NULL /*user data*/ ,
ehsink ) ;
}
- }
-
+ }
}
}
void wxCodeDepersister::SetConnect(int eventSourceObjectID,
const wxClassInfo *WXUNUSED(eventSourceClassInfo),
- const wxDelegateTypeInfo *delegateInfo ,
+ const wxPropertyInfo *delegateInfo ,
const wxClassInfo *eventSinkClassInfo ,
const wxHandlerInfo* handlerInfo ,
int eventSinkObjectID )
wxString ehsource = m_data->GetObjectName( eventSourceObjectID ) ;
wxString ehsink = m_data->GetObjectName(eventSinkObjectID) ;
wxString ehsinkClass = eventSinkClassInfo->GetClassName() ;
- int eventType = delegateInfo->GetEventType() ;
+ const wxDelegateTypeInfo *delegateTypeInfo = dynamic_cast<const wxDelegateTypeInfo*>(delegateInfo->GetTypeInfo());
+ wxASSERT_MSG(delegateTypeInfo, "delegate has no type info");
+ int eventType = delegateTypeInfo->GetEventType() ;
wxString handlerName = handlerInfo->GetName() ;
m_fp->WriteString( wxString::Format( wxT("\t%s->Connect( %s->GetId() , %d , (wxObjectEventFunction)(wxEventFunction) & %s::%s , NULL , %s ) ;") ,
wxString handlerName = resstring.Mid(pos+1) ;
wxClassInfo* sinkClassInfo = GetObjectClassInfo( sinkOid ) ;
- callbacks->SetConnect( objectID , classInfo , dynamic_cast<const wxDelegateTypeInfo*>(pi->GetTypeInfo()) , sinkClassInfo ,
+ callbacks->SetConnect( objectID , classInfo , pi , sinkClassInfo ,
sinkClassInfo->FindHandlerInfo(handlerName) , sinkOid ) ;
}