xti changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66630 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -516,6 +516,14 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxUSE_EXTENDED_RTTI
|
||||||
|
virtual const wxTypeInfo* GetTypeInfo() const
|
||||||
|
{
|
||||||
|
wxFAIL_MSG("Null Type Info not available");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -32,6 +32,11 @@ IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(wxBitmap,WXDLLEXPORT)
|
|||||||
IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(wxIcon,WXDLLEXPORT)
|
IMPLEMENT_VARIANT_OBJECT_EXPORTED_SHALLOWCMP(wxIcon,WXDLLEXPORT)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_EXTENDED_RTTI
|
||||||
|
//WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxBitmap>)
|
||||||
|
//WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxIcon>)
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxBitmapBase
|
// wxBitmapBase
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -59,7 +59,7 @@ wxFROM_STRING_IMP( wxColour )
|
|||||||
|
|
||||||
wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( wxColour, wxObject, \
|
wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( wxColour, wxObject, \
|
||||||
"wx/colour.h", &wxTO_STRING( wxColour ), &wxFROM_STRING( wxColour ))
|
"wx/colour.h", &wxTO_STRING( wxColour ), &wxFROM_STRING( wxColour ))
|
||||||
|
//WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxColour>)
|
||||||
wxBEGIN_PROPERTIES_TABLE(wxColour)
|
wxBEGIN_PROPERTIES_TABLE(wxColour)
|
||||||
wxREADONLY_PROPERTY( Red, unsigned char, Red, wxEMPTY_PARAMETER_VALUE, \
|
wxREADONLY_PROPERTY( Red, unsigned char, Red, wxEMPTY_PARAMETER_VALUE, \
|
||||||
0 /*flags*/, wxT("Helpstring"), wxT("group"))
|
0 /*flags*/, wxT("Helpstring"), wxT("group"))
|
||||||
|
@@ -76,37 +76,39 @@ extern const char *wxDumpFont(const wxFont *font)
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxBEGIN_ENUM( wxFontFamily )
|
wxBEGIN_ENUM( wxFontFamily )
|
||||||
wxENUM_MEMBER( wxDEFAULT )
|
wxENUM_MEMBER( wxFONTFAMILY_DEFAULT )
|
||||||
wxENUM_MEMBER( wxDECORATIVE )
|
wxENUM_MEMBER( wxFONTFAMILY_DECORATIVE )
|
||||||
wxENUM_MEMBER( wxROMAN )
|
wxENUM_MEMBER( wxFONTFAMILY_ROMAN )
|
||||||
wxENUM_MEMBER( wxSCRIPT )
|
wxENUM_MEMBER( wxFONTFAMILY_SCRIPT )
|
||||||
wxENUM_MEMBER( wxSWISS )
|
wxENUM_MEMBER( wxFONTFAMILY_SWISS )
|
||||||
wxENUM_MEMBER( wxMODERN )
|
wxENUM_MEMBER( wxFONTFAMILY_MODERN )
|
||||||
wxENUM_MEMBER( wxTELETYPE )
|
wxENUM_MEMBER( wxFONTFAMILY_TELETYPE )
|
||||||
wxEND_ENUM( wxFontFamily )
|
wxEND_ENUM( wxFontFamily )
|
||||||
|
|
||||||
wxBEGIN_ENUM( wxFontStyle )
|
wxBEGIN_ENUM( wxFontStyle )
|
||||||
wxENUM_MEMBER( wxNORMAL )
|
wxENUM_MEMBER( wxFONTSTYLE_NORMAL )
|
||||||
wxENUM_MEMBER( wxITALIC )
|
wxENUM_MEMBER( wxFONTSTYLE_ITALIC )
|
||||||
wxENUM_MEMBER( wxSLANT )
|
wxENUM_MEMBER( wxFONTSTYLE_SLANT )
|
||||||
wxEND_ENUM( wxFontStyle )
|
wxEND_ENUM( wxFontStyle )
|
||||||
|
|
||||||
wxBEGIN_ENUM( wxFontWeight )
|
wxBEGIN_ENUM( wxFontWeight )
|
||||||
wxENUM_MEMBER( wxNORMAL )
|
wxENUM_MEMBER( wxFONTWEIGHT_NORMAL )
|
||||||
wxENUM_MEMBER( wxLIGHT )
|
wxENUM_MEMBER( wxFONTWEIGHT_LIGHT )
|
||||||
wxENUM_MEMBER( wxBOLD )
|
wxENUM_MEMBER( wxFONTWEIGHT_BOLD )
|
||||||
wxEND_ENUM( wxFontWeight )
|
wxEND_ENUM( wxFontWeight )
|
||||||
|
|
||||||
wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI(wxFont, wxGDIObject, "wx/font.h")
|
wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI(wxFont, wxGDIObject, "wx/font.h")
|
||||||
|
|
||||||
|
//WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxFont>)
|
||||||
|
|
||||||
wxBEGIN_PROPERTIES_TABLE(wxFont)
|
wxBEGIN_PROPERTIES_TABLE(wxFont)
|
||||||
wxPROPERTY( Size,int, SetPointSize, GetPointSize, 12, 0 /*flags*/, \
|
wxPROPERTY( Size,int, SetPointSize, GetPointSize, 12, 0 /*flags*/, \
|
||||||
wxT("Helpstring"), wxT("group"))
|
wxT("Helpstring"), wxT("group"))
|
||||||
wxPROPERTY( Family, int , SetFamily, GetFamily, (int)wxDEFAULT, \
|
wxPROPERTY( Family, wxFontFamily , SetFamily, GetFamily, (wxFontFamily)wxDEFAULT, \
|
||||||
0 /*flags*/, wxT("Helpstring"), wxT("group")) // wxFontFamily
|
0 /*flags*/, wxT("Helpstring"), wxT("group")) // wxFontFamily
|
||||||
wxPROPERTY( Style, int, SetStyle, GetStyle, (int)wxNORMAL, 0 /*flags*/, \
|
wxPROPERTY( Style, wxFontStyle, SetStyle, GetStyle, (wxFontStyle)wxNORMAL, 0 /*flags*/, \
|
||||||
wxT("Helpstring"), wxT("group")) // wxFontStyle
|
wxT("Helpstring"), wxT("group")) // wxFontStyle
|
||||||
wxPROPERTY( Weight, int, SetWeight, GetWeight, (int)wxNORMAL, 0 /*flags*/, \
|
wxPROPERTY( Weight, wxFontWeight, SetWeight, GetWeight, (wxFontWeight)wxNORMAL, 0 /*flags*/, \
|
||||||
wxT("Helpstring"), wxT("group")) // wxFontWeight
|
wxT("Helpstring"), wxT("group")) // wxFontWeight
|
||||||
wxPROPERTY( Underlined, bool, SetUnderlined, GetUnderlined, false, 0 /*flags*/, \
|
wxPROPERTY( Underlined, bool, SetUnderlined, GetUnderlined, false, 0 /*flags*/, \
|
||||||
wxT("Helpstring"), wxT("group"))
|
wxT("Helpstring"), wxT("group"))
|
||||||
@@ -116,7 +118,7 @@ wxPROPERTY( Encoding, wxFontEncoding, SetEncoding, GetEncoding, \
|
|||||||
wxFONTENCODING_DEFAULT, 0 /*flags*/, wxT("Helpstring"), wxT("group"))
|
wxFONTENCODING_DEFAULT, 0 /*flags*/, wxT("Helpstring"), wxT("group"))
|
||||||
wxEND_PROPERTIES_TABLE()
|
wxEND_PROPERTIES_TABLE()
|
||||||
|
|
||||||
wxCONSTRUCTOR_6( wxFont, int, Size, int, Family, int, Style, int, Weight, \
|
wxCONSTRUCTOR_6( wxFont, int, Size, wxFontFamily, Family, wxFontStyle, Style, wxFontWeight, Weight, \
|
||||||
bool, Underlined, wxString, Face )
|
bool, Underlined, wxString, Face )
|
||||||
|
|
||||||
wxEMPTY_HANDLERS_TABLE(wxFont)
|
wxEMPTY_HANDLERS_TABLE(wxFont)
|
||||||
|
@@ -21,9 +21,9 @@
|
|||||||
|
|
||||||
#include "wx/ipcbase.h"
|
#include "wx/ipcbase.h"
|
||||||
|
|
||||||
IMPLEMENT_CLASS(wxServerBase, wxObject)
|
wxIMPLEMENT_ABSTRACT_CLASS(wxServerBase, wxObject)
|
||||||
IMPLEMENT_CLASS(wxClientBase, wxObject)
|
wxIMPLEMENT_ABSTRACT_CLASS(wxClientBase, wxObject)
|
||||||
IMPLEMENT_CLASS(wxConnectionBase, wxObject)
|
wxIMPLEMENT_ABSTRACT_CLASS(wxConnectionBase, wxObject)
|
||||||
|
|
||||||
wxConnectionBase::wxConnectionBase(void *buffer, size_t bytes)
|
wxConnectionBase::wxConnectionBase(void *buffer, size_t bytes)
|
||||||
: m_buffer((char *)buffer),
|
: m_buffer((char *)buffer),
|
||||||
|
@@ -65,9 +65,9 @@ wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxMenu, wxEvtHandler, "wx/menu.h")
|
|||||||
wxCOLLECTION_TYPE_INFO( wxMenuItem *, wxMenuItemList ) ;
|
wxCOLLECTION_TYPE_INFO( wxMenuItem *, wxMenuItemList ) ;
|
||||||
|
|
||||||
template<> void wxCollectionToVariantArray( wxMenuItemList const &theList,
|
template<> void wxCollectionToVariantArray( wxMenuItemList const &theList,
|
||||||
wxVariantBaseArray &value)
|
wxAnyList &value)
|
||||||
{
|
{
|
||||||
wxListCollectionToVariantArray<wxMenuItemList::compatibility_iterator>( theList, value ) ;
|
wxListCollectionToAnyList<wxMenuItemList::compatibility_iterator>( theList, value ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBEGIN_PROPERTIES_TABLE(wxMenu)
|
wxBEGIN_PROPERTIES_TABLE(wxMenu)
|
||||||
@@ -97,7 +97,7 @@ wxEND_FLAGS( wxMenuBarStyle )
|
|||||||
// the negative id would lead the window (its superclass !) to
|
// the negative id would lead the window (its superclass !) to
|
||||||
// vetoe streaming out otherwise
|
// vetoe streaming out otherwise
|
||||||
bool wxMenuBarStreamingCallback( const wxObject *WXUNUSED(object), wxObjectWriter *,
|
bool wxMenuBarStreamingCallback( const wxObject *WXUNUSED(object), wxObjectWriter *,
|
||||||
wxObjectReaderCallback *, wxVariantBaseArray & )
|
wxObjectWriterCallback *, const wxStringToAnyHashMap & )
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -122,9 +122,9 @@ wxCONSTRUCTOR_2( wxMenuInfo, wxMenu*, Menu, wxString, Title )
|
|||||||
wxCOLLECTION_TYPE_INFO( wxMenuInfo *, wxMenuInfoList ) ;
|
wxCOLLECTION_TYPE_INFO( wxMenuInfo *, wxMenuInfoList ) ;
|
||||||
|
|
||||||
template<> void wxCollectionToVariantArray( wxMenuInfoList const &theList,
|
template<> void wxCollectionToVariantArray( wxMenuInfoList const &theList,
|
||||||
wxVariantBaseArray &value)
|
wxAnyList &value)
|
||||||
{
|
{
|
||||||
wxListCollectionToVariantArray<wxMenuInfoList::compatibility_iterator>( theList, value ) ;
|
wxListCollectionToAnyList<wxMenuInfoList::compatibility_iterator>( theList, value ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBEGIN_PROPERTIES_TABLE(wxMenuBar)
|
wxBEGIN_PROPERTIES_TABLE(wxMenuBar)
|
||||||
@@ -136,6 +136,25 @@ wxEMPTY_HANDLERS_TABLE(wxMenuBar)
|
|||||||
|
|
||||||
wxCONSTRUCTOR_DUMMY( wxMenuBar )
|
wxCONSTRUCTOR_DUMMY( wxMenuBar )
|
||||||
|
|
||||||
|
const wxMenuInfoList& wxMenuBarBase::GetMenuInfos() const
|
||||||
|
{
|
||||||
|
wxMenuInfoList* list = const_cast< wxMenuInfoList* > (& m_menuInfos);
|
||||||
|
WX_CLEAR_LIST( wxMenuInfoList, *list);
|
||||||
|
for (size_t i = 0 ; i < GetMenuCount(); ++i)
|
||||||
|
{
|
||||||
|
wxMenuInfo* info = new wxMenuInfo();
|
||||||
|
info->Create( GetMenu(i), GetMenuLabel(i));
|
||||||
|
list->Append(info);
|
||||||
|
}
|
||||||
|
return m_menuInfos;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxMenu**>)
|
||||||
|
WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxMenuItem**>)
|
||||||
|
WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxMenuBar**>)
|
||||||
|
WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxMenuInfo**>)
|
||||||
|
*/
|
||||||
#else
|
#else
|
||||||
// IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
|
// IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
|
||||||
// IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow)
|
// IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow)
|
||||||
@@ -150,7 +169,7 @@ wxCONSTRUCTOR_DUMMY( wxMenuBar )
|
|||||||
#if wxUSE_EXTENDED_RTTI
|
#if wxUSE_EXTENDED_RTTI
|
||||||
|
|
||||||
bool wxMenuItemStreamingCallback( const wxObject *object, wxObjectWriter *,
|
bool wxMenuItemStreamingCallback( const wxObject *object, wxObjectWriter *,
|
||||||
wxObjectReaderCallback *, wxVariantBaseArray & )
|
wxObjectWriterCallback *, const wxStringToAnyHashMap & )
|
||||||
{
|
{
|
||||||
const wxMenuItem * mitem = wx_dynamic_cast(const wxMenuItem*, object);
|
const wxMenuItem * mitem = wx_dynamic_cast(const wxMenuItem*, object);
|
||||||
if ( mitem->GetMenu() && !mitem->GetMenu()->GetTitle().empty() )
|
if ( mitem->GetMenu() && !mitem->GetMenu()->GetTitle().empty() )
|
||||||
@@ -164,6 +183,8 @@ bool wxMenuItemStreamingCallback( const wxObject *object, wxObjectWriter *,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
wxBEGIN_ENUM( wxItemKind )
|
wxBEGIN_ENUM( wxItemKind )
|
||||||
wxENUM_MEMBER( wxITEM_SEPARATOR )
|
wxENUM_MEMBER( wxITEM_SEPARATOR )
|
||||||
wxENUM_MEMBER( wxITEM_NORMAL )
|
wxENUM_MEMBER( wxITEM_NORMAL )
|
||||||
@@ -179,7 +200,7 @@ wxPROPERTY( Parent, wxMenu*, SetMenu, GetMenu, wxEMPTY_PARAMETER_VALUE, \
|
|||||||
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
||||||
wxPROPERTY( Id, int, SetId, GetId, wxEMPTY_PARAMETER_VALUE, \
|
wxPROPERTY( Id, int, SetId, GetId, wxEMPTY_PARAMETER_VALUE, \
|
||||||
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
||||||
wxPROPERTY( Text, wxString, SetText, GetText, wxString(), \
|
wxPROPERTY( ItemLabel, wxString, SetItemLabel, GetItemLabel, wxString(), \
|
||||||
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
||||||
wxPROPERTY( Help, wxString, SetHelp, GetHelp, wxString(), \
|
wxPROPERTY( Help, wxString, SetHelp, GetHelp, wxString(), \
|
||||||
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
||||||
@@ -187,11 +208,11 @@ wxREADONLY_PROPERTY( Kind, wxItemKind, GetKind, wxEMPTY_PARAMETER_VALUE, \
|
|||||||
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
||||||
wxPROPERTY( SubMenu, wxMenu*, SetSubMenu, GetSubMenu, wxEMPTY_PARAMETER_VALUE, \
|
wxPROPERTY( SubMenu, wxMenu*, SetSubMenu, GetSubMenu, wxEMPTY_PARAMETER_VALUE, \
|
||||||
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
||||||
wxPROPERTY( Enabled, bool, Enable, IsEnabled, wxVariantBase((bool)true), \
|
wxPROPERTY( Enabled, bool, Enable, IsEnabled, wxAny((bool)true), \
|
||||||
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
||||||
wxPROPERTY( Checked, bool, Check, IsChecked, wxVariantBase((bool)false), \
|
wxPROPERTY( Checked, bool, Check, IsChecked, wxAny((bool)false), \
|
||||||
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
||||||
wxPROPERTY( Checkable, bool, SetCheckable, IsCheckable, wxVariantBase((bool)false), \
|
wxPROPERTY( Checkable, bool, SetCheckable, IsCheckable, wxAny((bool)false), \
|
||||||
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
0 /*flags*/, wxT("Helpstring"), wxT("group") )
|
||||||
wxEND_PROPERTIES_TABLE()
|
wxEND_PROPERTIES_TABLE()
|
||||||
|
|
||||||
@@ -199,9 +220,6 @@ wxEMPTY_HANDLERS_TABLE(wxMenuItem)
|
|||||||
|
|
||||||
wxDIRECT_CONSTRUCTOR_6( wxMenuItem, wxMenu*, Parent, int, Id, wxString, \
|
wxDIRECT_CONSTRUCTOR_6( wxMenuItem, wxMenu*, Parent, int, Id, wxString, \
|
||||||
Text, wxString, Help, wxItemKind, Kind, wxMenu*, SubMenu )
|
Text, wxString, Help, wxItemKind, Kind, wxMenu*, SubMenu )
|
||||||
#else
|
|
||||||
//IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxMenuItemBase
|
// wxMenuItemBase
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
WX_DEFINE_LIST(wxModuleList)
|
WX_DEFINE_LIST(wxModuleList)
|
||||||
|
|
||||||
IMPLEMENT_CLASS(wxModule, wxObject)
|
wxIMPLEMENT_ABSTRACT_CLASS(wxModule, wxObject)
|
||||||
|
|
||||||
wxModuleList wxModule::m_modules;
|
wxModuleList wxModule::m_modules;
|
||||||
|
|
||||||
|
@@ -93,13 +93,11 @@ wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebookPageInfo, wxObject, "wx/notebook.h" )
|
|||||||
|
|
||||||
wxCOLLECTION_TYPE_INFO( wxNotebookPageInfo *, wxNotebookPageInfoList );
|
wxCOLLECTION_TYPE_INFO( wxNotebookPageInfo *, wxNotebookPageInfoList );
|
||||||
|
|
||||||
#if wxUSE_EXTENDED_RTTI
|
|
||||||
template<> void wxCollectionToVariantArray( wxNotebookPageInfoList const &theList,
|
template<> void wxCollectionToVariantArray( wxNotebookPageInfoList const &theList,
|
||||||
wxVariantBaseArray &value)
|
wxAnyList &value)
|
||||||
{
|
{
|
||||||
wxListCollectionToVariantArray<wxNotebookPageInfoList::compatibility_iterator>( theList, value );
|
wxListCollectionToAnyList<wxNotebookPageInfoList::compatibility_iterator>( theList, value );
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
wxBEGIN_PROPERTIES_TABLE(wxNotebook)
|
wxBEGIN_PROPERTIES_TABLE(wxNotebook)
|
||||||
wxEVENT_PROPERTY( PageChanging, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, wxNotebookEvent )
|
wxEVENT_PROPERTY( PageChanging, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, wxNotebookEvent )
|
||||||
@@ -134,6 +132,7 @@ wxEMPTY_HANDLERS_TABLE(wxNotebookPageInfo)
|
|||||||
wxCONSTRUCTOR_4( wxNotebookPageInfo, wxNotebookPage*, Page, \
|
wxCONSTRUCTOR_4( wxNotebookPageInfo, wxNotebookPage*, Page, \
|
||||||
wxString, Text, bool, Selected, int, ImageId )
|
wxString, Text, bool, Selected, int, ImageId )
|
||||||
|
|
||||||
|
WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxNotebookPageInfo**>)
|
||||||
// XTI accessors:
|
// XTI accessors:
|
||||||
|
|
||||||
void wxNotebookBase::AddPageInfo( wxNotebookPageInfo* info )
|
void wxNotebookBase::AddPageInfo( wxNotebookPageInfo* info )
|
||||||
|
@@ -44,21 +44,20 @@
|
|||||||
|
|
||||||
#if wxUSE_EXTENDED_RTTI
|
#if wxUSE_EXTENDED_RTTI
|
||||||
const wxClassInfo* wxObject::ms_classParents[] = { NULL } ;
|
const wxClassInfo* wxObject::ms_classParents[] = { NULL } ;
|
||||||
wxObject* wxVariantToObjectConverterwxObject ( wxxVariant &data )
|
wxObject* wxVariantOfPtrToObjectConverterwxObject ( const wxAny &data )
|
||||||
{ return data.wxTEMPLATED_MEMBER_CALL(Get , wxObject*) ; }
|
{ return wxANY_AS(data, wxObject*); }
|
||||||
wxObject* wxVariantOfPtrToObjectConverterwxObject ( wxxVariant &data )
|
wxAny wxObjectToVariantConverterwxObject ( wxObject *data )
|
||||||
{ return &data.wxTEMPLATED_MEMBER_CALL(Get , wxObject) ; }
|
{ return wxAny( dynamic_cast<wxObject*> (data) ) ; }
|
||||||
wxxVariant wxObjectToVariantConverterwxObject ( wxObject *data )
|
|
||||||
{ return wxxVariant( dynamic_cast<wxObject*> (data) ) ; }
|
|
||||||
wxClassInfo wxObject::ms_classInfo(ms_classParents , wxEmptyString , wxT("wxObject"),
|
wxClassInfo wxObject::ms_classInfo(ms_classParents , wxEmptyString , wxT("wxObject"),
|
||||||
(int) sizeof(wxObject), \
|
(int) sizeof(wxObject), \
|
||||||
(wxObjectConstructorFn) 0 ,
|
(wxObjectConstructorFn) 0 ,
|
||||||
NULL,NULL,0 , 0 ,
|
NULL,NULL,0 , 0 ,
|
||||||
0 , wxVariantOfPtrToObjectConverterwxObject , wxVariantToObjectConverterwxObject , wxObjectToVariantConverterwxObject);
|
0 , wxVariantOfPtrToObjectConverterwxObject , 0 , wxObjectToVariantConverterwxObject);
|
||||||
template<> void wxStringReadValue(const wxString & , wxObject * & ){ wxFAIL_MSG("unreachable"); }
|
|
||||||
template<> void wxStringWriteValue(wxString & , wxObject* const & ){ wxFAIL_MSG("unreachable"); }
|
template<> void wxStringWriteValue(wxString & , wxObject* const & ){ wxFAIL_MSG("unreachable"); }
|
||||||
template<> void wxStringReadValue(const wxString & , wxObject & ){ wxFAIL_MSG("unreachable"); }
|
|
||||||
template<> void wxStringWriteValue(wxString & , wxObject const & ){ wxFAIL_MSG("unreachable"); }
|
template<> void wxStringWriteValue(wxString & , wxObject const & ){ wxFAIL_MSG("unreachable"); }
|
||||||
|
|
||||||
wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &wxObject::ms_classInfo , NULL , NULL , typeid(wxObject*).name() ) ;
|
wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &wxObject::ms_classInfo , NULL , NULL , typeid(wxObject*).name() ) ;
|
||||||
wxClassTypeInfo s_typeInfowxObject(wxT_OBJECT , &wxObject::ms_classInfo , NULL , NULL , typeid(wxObject).name() ) ;
|
wxClassTypeInfo s_typeInfowxObject(wxT_OBJECT , &wxObject::ms_classInfo , NULL , NULL , typeid(wxObject).name() ) ;
|
||||||
#else
|
#else
|
||||||
|
@@ -70,7 +70,7 @@ wxFLAGS_MEMBER(wxSP_ARROW_KEYS)
|
|||||||
wxFLAGS_MEMBER(wxSP_WRAP)
|
wxFLAGS_MEMBER(wxSP_WRAP)
|
||||||
wxEND_FLAGS( wxSpinCtrlStyle )
|
wxEND_FLAGS( wxSpinCtrlStyle )
|
||||||
|
|
||||||
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxSpinCtrl, wxControl, "wx/spinbut.h")
|
wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxSpinCtrl, wxControl, "wx/spinctrl.h")
|
||||||
|
|
||||||
wxBEGIN_PROPERTIES_TABLE(wxSpinCtrl)
|
wxBEGIN_PROPERTIES_TABLE(wxSpinCtrl)
|
||||||
wxEVENT_RANGE_PROPERTY( Spin, wxEVT_SCROLL_TOP, wxEVT_SCROLL_CHANGED, wxSpinEvent )
|
wxEVENT_RANGE_PROPERTY( Spin, wxEVT_SCROLL_TOP, wxEVT_SCROLL_CHANGED, wxSpinEvent )
|
||||||
|
@@ -127,8 +127,9 @@ END_EVENT_TABLE()
|
|||||||
// separately otherwise chaos occurs. Right now easiest is to test for negative ids,
|
// separately otherwise chaos occurs. Right now easiest is to test for negative ids,
|
||||||
// as windows with negative ids never can be recreated anyway
|
// as windows with negative ids never can be recreated anyway
|
||||||
|
|
||||||
|
|
||||||
bool wxWindowStreamingCallback( const wxObject *object, wxObjectWriter *,
|
bool wxWindowStreamingCallback( const wxObject *object, wxObjectWriter *,
|
||||||
wxObjectReaderCallback *, wxVariantBaseArray & )
|
wxObjectWriterCallback *, const wxStringToAnyHashMap & )
|
||||||
{
|
{
|
||||||
const wxWindow * win = wx_dynamic_cast(const wxWindow*, object);
|
const wxWindow * win = wx_dynamic_cast(const wxWindow*, object);
|
||||||
if ( win && win->GetId() < 0 )
|
if ( win && win->GetId() < 0 )
|
||||||
@@ -144,9 +145,9 @@ wxIMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK(wxWindow, wxWindowBase, "wx/window.h", \
|
|||||||
wxCOLLECTION_TYPE_INFO( wxWindow*, wxWindowList );
|
wxCOLLECTION_TYPE_INFO( wxWindow*, wxWindowList );
|
||||||
|
|
||||||
template<> void wxCollectionToVariantArray( wxWindowList const &theList,
|
template<> void wxCollectionToVariantArray( wxWindowList const &theList,
|
||||||
wxVariantBaseArray &value)
|
wxAnyList &value)
|
||||||
{
|
{
|
||||||
wxListCollectionToVariantArray<wxWindowList::compatibility_iterator>( theList, value );
|
wxListCollectionToAnyList<wxWindowList::compatibility_iterator>( theList, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDEFINE_FLAGS( wxWindowStyle )
|
wxDEFINE_FLAGS( wxWindowStyle )
|
||||||
@@ -215,9 +216,9 @@ wxPROPERTY( BackgroundColour, wxColour, SetBackgroundColour, GetBackgroundColour
|
|||||||
wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, wxT("Helpstring"), wxT("group")) // bg
|
wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, wxT("Helpstring"), wxT("group")) // bg
|
||||||
wxPROPERTY( ForegroundColour, wxColour, SetForegroundColour, GetForegroundColour, \
|
wxPROPERTY( ForegroundColour, wxColour, SetForegroundColour, GetForegroundColour, \
|
||||||
wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, wxT("Helpstring"), wxT("group")) // fg
|
wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, wxT("Helpstring"), wxT("group")) // fg
|
||||||
wxPROPERTY( Enabled, bool, Enable, IsEnabled, wxVariantBase((bool)true), 0 /*flags*/, \
|
wxPROPERTY( Enabled, bool, Enable, IsEnabled, wxAny((bool)true), 0 /*flags*/, \
|
||||||
wxT("Helpstring"), wxT("group"))
|
wxT("Helpstring"), wxT("group"))
|
||||||
wxPROPERTY( Shown, bool, Show, IsShown, wxVariantBase((bool)true), 0 /*flags*/, \
|
wxPROPERTY( Shown, bool, Show, IsShown, wxAny((bool)true), 0 /*flags*/, \
|
||||||
wxT("Helpstring"), wxT("group"))
|
wxT("Helpstring"), wxT("group"))
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@@ -28,6 +28,8 @@
|
|||||||
#include "wx/xti.h"
|
#include "wx/xti.h"
|
||||||
#include "wx/xml/xml.h"
|
#include "wx/xml/xml.h"
|
||||||
#include "wx/tokenzr.h"
|
#include "wx/tokenzr.h"
|
||||||
|
#include "wx/range.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "wx/beforestd.h"
|
#include "wx/beforestd.h"
|
||||||
@@ -200,6 +202,27 @@ template<> void wxStringWriteValue(wxString &s, const unsigned long &data )
|
|||||||
s = wxString::Format(_T("%ld"), data );
|
s = wxString::Format(_T("%ld"), data );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef wxLongLong_t
|
||||||
|
template<> void wxStringReadValue(const wxString &s, wxLongLong_t &data )
|
||||||
|
{
|
||||||
|
wxSscanf(s, _T("%lld"), &data );
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> void wxStringWriteValue(wxString &s, const wxLongLong_t &data )
|
||||||
|
{
|
||||||
|
s = wxString::Format(_T("%lld"), data );
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> void wxStringReadValue(const wxString &s, wxULongLong_t &data )
|
||||||
|
{
|
||||||
|
wxSscanf(s, _T("%lld"), &data );
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> void wxStringWriteValue(wxString &s, const wxULongLong_t &data )
|
||||||
|
{
|
||||||
|
s = wxString::Format(_T("%lld"), data );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
// float
|
// float
|
||||||
|
|
||||||
template<> void wxStringReadValue(const wxString &s, float &data )
|
template<> void wxStringReadValue(const wxString &s, float &data )
|
||||||
@@ -247,9 +270,9 @@ template<> void wxStringWriteValue(wxString &s, const wxString &data )
|
|||||||
&wxFromStringConverter<type>, typeid(type).name());
|
&wxFromStringConverter<type>, typeid(type).name());
|
||||||
#else
|
#else
|
||||||
#define wxBUILTIN_TYPE_INFO( element, type ) \
|
#define wxBUILTIN_TYPE_INFO( element, type ) \
|
||||||
void _toString##element( const wxVariantBase& data, wxString &result ) \
|
void _toString##element( const wxAny& data, wxString &result ) \
|
||||||
{ wxToStringConverter<type, data, result); } \
|
{ wxToStringConverter<type, data, result); } \
|
||||||
void _fromString##element( const wxString& data, wxVariantBase &result ) \
|
void _fromString##element( const wxString& data, wxAny &result ) \
|
||||||
{ wxFromStringConverter<type, data, result); } \
|
{ wxFromStringConverter<type, data, result); } \
|
||||||
wxBuiltInTypeInfo s_typeInfo##type(element, &_toString##element, \
|
wxBuiltInTypeInfo s_typeInfo##type(element, &_toString##element, \
|
||||||
&_fromString##element, typeid(type).name());
|
&_fromString##element, typeid(type).name());
|
||||||
@@ -271,6 +294,10 @@ wxBUILTIN_TYPE_INFO( wxT_FLOAT, float);
|
|||||||
wxBUILTIN_TYPE_INFO( wxT_DOUBLE, double);
|
wxBUILTIN_TYPE_INFO( wxT_DOUBLE, double);
|
||||||
wxBUILTIN_TYPE_INFO( wxT_STRING, wxString);
|
wxBUILTIN_TYPE_INFO( wxT_STRING, wxString);
|
||||||
|
|
||||||
|
#ifdef wxLongLong_t
|
||||||
|
wxBUILTIN_TYPE_INFO(wxT_LONGLONG, wxLongLong_t)
|
||||||
|
wxBUILTIN_TYPE_INFO(wxT_ULONGLONG, wxULongLong_t)
|
||||||
|
#endif
|
||||||
|
|
||||||
// this are compiler induced specialization which are never used anywhere
|
// this are compiler induced specialization which are never used anywhere
|
||||||
|
|
||||||
@@ -282,17 +309,35 @@ wxILLEGAL_TYPE_SPECIALIZATION( bool * )
|
|||||||
wxILLEGAL_TYPE_SPECIALIZATION( long * )
|
wxILLEGAL_TYPE_SPECIALIZATION( long * )
|
||||||
wxILLEGAL_TYPE_SPECIALIZATION( wxString * )
|
wxILLEGAL_TYPE_SPECIALIZATION( wxString * )
|
||||||
|
|
||||||
|
// wxRange
|
||||||
|
|
||||||
|
template<> void wxStringReadValue(const wxString &s , wxRange &data)
|
||||||
|
{
|
||||||
|
int minValue, maxValue;
|
||||||
|
wxSscanf(s, wxT("%d,%d"), &minValue , &maxValue);
|
||||||
|
data = wxRange(minValue, maxValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<> void wxStringWriteValue(wxString &s , const wxRange &data)
|
||||||
|
{
|
||||||
|
s = wxString::Format(wxT("%d,%d"), data.GetMin() , data.GetMax());
|
||||||
|
}
|
||||||
|
|
||||||
|
wxCUSTOM_TYPE_INFO(wxRange, wxToStringConverter<wxRange> , wxFromStringConverter<wxRange>)
|
||||||
|
|
||||||
|
// other types
|
||||||
|
|
||||||
wxCOLLECTION_TYPE_INFO( wxString, wxArrayString );
|
wxCOLLECTION_TYPE_INFO( wxString, wxArrayString );
|
||||||
|
|
||||||
template<> void wxCollectionToVariantArray( wxArrayString const &theArray,
|
template<> void wxCollectionToVariantArray( wxArrayString const &theArray,
|
||||||
wxVariantBaseArray &value)
|
wxAnyList &value)
|
||||||
{
|
{
|
||||||
wxArrayCollectionToVariantArray( theArray, value );
|
wxArrayCollectionToVariantArray( theArray, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTypeInfoMap *wxTypeInfo::ms_typeTable = NULL;
|
wxTypeInfoMap *wxTypeInfo::ms_typeTable = NULL;
|
||||||
|
|
||||||
wxTypeInfo *wxTypeInfo::FindType(const wxChar *typeName)
|
wxTypeInfo *wxTypeInfo::FindType(const wxString& typeName)
|
||||||
{
|
{
|
||||||
wxTypeInfoMap::iterator iter = ms_typeTable->find(typeName);
|
wxTypeInfoMap::iterator iter = ms_typeTable->find(typeName);
|
||||||
|
|
||||||
@@ -418,6 +463,7 @@ void wxPropertyInfo::Remove()
|
|||||||
info = info->m_next;
|
info = info->m_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -466,7 +512,7 @@ void wxHandlerInfo::Remove()
|
|||||||
// wxClassInfo
|
// wxClassInfo
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxClassInfo::Create(wxObject *object, int ParamCount, wxVariantBase *Params) const
|
bool wxClassInfo::Create(wxObject *object, int ParamCount, wxAny *Params) const
|
||||||
{
|
{
|
||||||
if ( ParamCount != m_constructorPropertiesCount )
|
if ( ParamCount != m_constructorPropertiesCount )
|
||||||
{
|
{
|
||||||
@@ -478,7 +524,7 @@ bool wxClassInfo::Create(wxObject *object, int ParamCount, wxVariantBase *Params
|
|||||||
return m_constructor->Create( object, Params );
|
return m_constructor->Create( object, Params );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxObject *wxClassInfo::ConstructObject(int ParamCount, wxVariantBase *Params) const
|
wxObject *wxClassInfo::ConstructObject(int ParamCount, wxAny *Params) const
|
||||||
{
|
{
|
||||||
if ( ParamCount != m_constructorPropertiesCount )
|
if ( ParamCount != m_constructorPropertiesCount )
|
||||||
{
|
{
|
||||||
@@ -521,7 +567,7 @@ const wxPropertyAccessor *wxClassInfo::FindAccessor(const wxChar *PropertyName)
|
|||||||
|
|
||||||
wxPropertyInfo *wxClassInfo::FindPropertyInfoInThisClass (const wxChar *PropertyName) const
|
wxPropertyInfo *wxClassInfo::FindPropertyInfoInThisClass (const wxChar *PropertyName) const
|
||||||
{
|
{
|
||||||
wxPropertyInfo* info = m_firstProperty;
|
wxPropertyInfo* info = GetFirstProperty();
|
||||||
|
|
||||||
while( info )
|
while( info )
|
||||||
{
|
{
|
||||||
@@ -551,7 +597,7 @@ const wxPropertyInfo *wxClassInfo::FindPropertyInfo (const wxChar *PropertyName)
|
|||||||
|
|
||||||
wxHandlerInfo *wxClassInfo::FindHandlerInfoInThisClass (const wxChar *PropertyName) const
|
wxHandlerInfo *wxClassInfo::FindHandlerInfoInThisClass (const wxChar *PropertyName) const
|
||||||
{
|
{
|
||||||
wxHandlerInfo* info = m_firstHandler;
|
wxHandlerInfo* info = GetFirstHandler();
|
||||||
|
|
||||||
while( info )
|
while( info )
|
||||||
{
|
{
|
||||||
@@ -595,17 +641,17 @@ wxObjectStreamingCallback wxClassInfo::GetStreamingCallback() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool wxClassInfo::BeforeWriteObject( const wxObject *obj, wxObjectWriter *streamer,
|
bool wxClassInfo::BeforeWriteObject( const wxObject *obj, wxObjectWriter *streamer,
|
||||||
wxObjectReaderCallback *persister, wxVariantBaseArray &metadata) const
|
wxObjectWriterCallback *writercallback, const wxStringToAnyHashMap &metadata) const
|
||||||
{
|
{
|
||||||
wxObjectStreamingCallback sb = GetStreamingCallback();
|
wxObjectStreamingCallback sb = GetStreamingCallback();
|
||||||
if ( sb )
|
if ( sb )
|
||||||
return (*sb)(obj, streamer, persister, metadata );
|
return (*sb)(obj, streamer, writercallback, metadata );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxClassInfo::SetProperty(wxObject *object, const wxChar *propertyName,
|
void wxClassInfo::SetProperty(wxObject *object, const wxChar *propertyName,
|
||||||
const wxVariantBase &value) const
|
const wxAny &value) const
|
||||||
{
|
{
|
||||||
const wxPropertyAccessor *accessor;
|
const wxPropertyAccessor *accessor;
|
||||||
|
|
||||||
@@ -614,31 +660,31 @@ void wxClassInfo::SetProperty(wxObject *object, const wxChar *propertyName,
|
|||||||
accessor->SetProperty( object, value );
|
accessor->SetProperty( object, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxVariantBase wxClassInfo::GetProperty(wxObject *object, const wxChar *propertyName) const
|
wxAny wxClassInfo::GetProperty(wxObject *object, const wxChar *propertyName) const
|
||||||
{
|
{
|
||||||
const wxPropertyAccessor *accessor;
|
const wxPropertyAccessor *accessor;
|
||||||
|
|
||||||
accessor = FindAccessor(propertyName);
|
accessor = FindAccessor(propertyName);
|
||||||
wxASSERT(accessor->HasGetter());
|
wxASSERT(accessor->HasGetter());
|
||||||
wxVariantBase result;
|
wxAny result;
|
||||||
accessor->GetProperty(object,result);
|
accessor->GetProperty(object,result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxVariantBaseArray wxClassInfo::GetPropertyCollection(wxObject *object,
|
wxAnyList wxClassInfo::GetPropertyCollection(wxObject *object,
|
||||||
const wxChar *propertyName) const
|
const wxChar *propertyName) const
|
||||||
{
|
{
|
||||||
const wxPropertyAccessor *accessor;
|
const wxPropertyAccessor *accessor;
|
||||||
|
|
||||||
accessor = FindAccessor(propertyName);
|
accessor = FindAccessor(propertyName);
|
||||||
wxASSERT(accessor->HasGetter());
|
wxASSERT(accessor->HasGetter());
|
||||||
wxVariantBaseArray result;
|
wxAnyList result;
|
||||||
accessor->GetPropertyCollection(object,result);
|
accessor->GetPropertyCollection(object,result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxClassInfo::AddToPropertyCollection(wxObject *object, const wxChar *propertyName,
|
void wxClassInfo::AddToPropertyCollection(wxObject *object, const wxChar *propertyName,
|
||||||
const wxVariantBase& value) const
|
const wxAny& value) const
|
||||||
{
|
{
|
||||||
const wxPropertyAccessor *accessor;
|
const wxPropertyAccessor *accessor;
|
||||||
|
|
||||||
@@ -668,6 +714,23 @@ void wxClassInfo::GetProperties( wxPropertyInfoMap &infomap ) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxObject* wxClassInfo::AnyToObjectPtr( const wxAny &data) const
|
||||||
|
{
|
||||||
|
return m_variantOfPtrToObjectConverter(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxClassInfo::CallOnAny( const wxAny &data, wxObjectFunctor* functor ) const
|
||||||
|
{
|
||||||
|
if ( data.GetTypeInfo()->GetKind() == wxT_OBJECT )
|
||||||
|
return m_variantToObjectConverter(data, functor);
|
||||||
|
else
|
||||||
|
return (*functor)(m_variantOfPtrToObjectConverter(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
wxAny wxClassInfo::ObjectPtrToAny( wxObject* obj) const
|
||||||
|
{
|
||||||
|
return m_objectToVariantConverter(obj);
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxDynamicObject support
|
// wxDynamicObject support
|
||||||
@@ -681,11 +744,7 @@ struct wxDynamicObject::wxDynamicObjectInternal
|
|||||||
{
|
{
|
||||||
wxDynamicObjectInternal() {}
|
wxDynamicObjectInternal() {}
|
||||||
|
|
||||||
#if wxUSE_UNICODE
|
wxStringToAnyHashMap m_properties;
|
||||||
map<wstring,wxVariantBase> m_properties;
|
|
||||||
#else
|
|
||||||
map<string,wxVariantBase> m_properties;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef list< wxDynamicObject* > wxDynamicObjectList;
|
typedef list< wxDynamicObject* > wxDynamicObjectList;
|
||||||
@@ -711,14 +770,14 @@ wxDynamicObject::~wxDynamicObject()
|
|||||||
delete m_superClassInstance;
|
delete m_superClassInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDynamicObject::SetProperty (const wxChar *propertyName, const wxVariantBase &value)
|
void wxDynamicObject::SetProperty (const wxChar *propertyName, const wxAny &value)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),
|
wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),
|
||||||
wxT("Accessing Unknown Property in a Dynamic Object") );
|
wxT("Accessing Unknown Property in a Dynamic Object") );
|
||||||
m_data->m_properties[propertyName] = value;
|
m_data->m_properties[propertyName] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxVariantBase wxDynamicObject::GetProperty (const wxChar *propertyName) const
|
wxAny wxDynamicObject::GetProperty (const wxChar *propertyName) const
|
||||||
{
|
{
|
||||||
wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),
|
wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),
|
||||||
wxT("Accessing Unknown Property in a Dynamic Object") );
|
wxT("Accessing Unknown Property in a Dynamic Object") );
|
||||||
@@ -738,7 +797,7 @@ void wxDynamicObject::RenameProperty( const wxChar *oldPropertyName,
|
|||||||
wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(oldPropertyName),
|
wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(oldPropertyName),
|
||||||
wxT("Renaming Unknown Property in a Dynamic Object") );
|
wxT("Renaming Unknown Property in a Dynamic Object") );
|
||||||
|
|
||||||
wxVariantBase value = m_data->m_properties[oldPropertyName];
|
wxAny value = m_data->m_properties[oldPropertyName];
|
||||||
m_data->m_properties.erase( oldPropertyName );
|
m_data->m_properties.erase( oldPropertyName );
|
||||||
m_data->m_properties[newPropertyName] = value;
|
m_data->m_properties[newPropertyName] = value;
|
||||||
}
|
}
|
||||||
@@ -772,7 +831,7 @@ wxObject *wxDynamicClassInfo::AllocateObject() const
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDynamicClassInfo::Create (wxObject *object, int paramCount, wxVariantBase *params) const
|
bool wxDynamicClassInfo::Create (wxObject *object, int paramCount, wxAny *params) const
|
||||||
{
|
{
|
||||||
wxDynamicObject *dynobj = wx_dynamic_cast( wxDynamicObject *, object );
|
wxDynamicObject *dynobj = wx_dynamic_cast( wxDynamicObject *, object );
|
||||||
wxASSERT_MSG( dynobj,
|
wxASSERT_MSG( dynobj,
|
||||||
@@ -794,7 +853,7 @@ const wxChar* wxDynamicClassInfo::GetCreateParamName(int i) const
|
|||||||
return GetParents()[0]->GetCreateParamName( i );
|
return GetParents()[0]->GetCreateParamName( i );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDynamicClassInfo::SetProperty(wxObject *object, const wxChar *propertyName, const wxVariantBase &value) const
|
void wxDynamicClassInfo::SetProperty(wxObject *object, const wxChar *propertyName, const wxAny &value) const
|
||||||
{
|
{
|
||||||
wxDynamicObject* dynobj = wx_dynamic_cast(wxDynamicObject*, object);
|
wxDynamicObject* dynobj = wx_dynamic_cast(wxDynamicObject*, object);
|
||||||
wxASSERT_MSG( dynobj, wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") );
|
wxASSERT_MSG( dynobj, wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") );
|
||||||
@@ -804,7 +863,7 @@ void wxDynamicClassInfo::SetProperty(wxObject *object, const wxChar *propertyNam
|
|||||||
GetParents()[0]->SetProperty( dynobj->GetSuperClassInstance(), propertyName, value );
|
GetParents()[0]->SetProperty( dynobj->GetSuperClassInstance(), propertyName, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxVariantBase wxDynamicClassInfo::GetProperty(wxObject *object, const wxChar *propertyName) const
|
wxAny wxDynamicClassInfo::GetProperty(wxObject *object, const wxChar *propertyName) const
|
||||||
{
|
{
|
||||||
wxDynamicObject* dynobj = wx_dynamic_cast(wxDynamicObject*, object);
|
wxDynamicObject* dynobj = wx_dynamic_cast(wxDynamicObject*, object);
|
||||||
wxASSERT_MSG( dynobj, wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") );
|
wxASSERT_MSG( dynobj, wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") );
|
||||||
@@ -816,11 +875,13 @@ wxVariantBase wxDynamicClassInfo::GetProperty(wxObject *object, const wxChar *pr
|
|||||||
|
|
||||||
void wxDynamicClassInfo::AddProperty( const wxChar *propertyName, const wxTypeInfo* typeInfo )
|
void wxDynamicClassInfo::AddProperty( const wxChar *propertyName, const wxTypeInfo* typeInfo )
|
||||||
{
|
{
|
||||||
new wxPropertyInfo( m_firstProperty, this, propertyName, typeInfo->GetTypeName(), new wxGenericPropertyAccessor( propertyName ), wxVariantBase() );
|
EnsureInfosInited();
|
||||||
|
new wxPropertyInfo( m_firstProperty, this, propertyName, typeInfo->GetTypeName(), new wxGenericPropertyAccessor( propertyName ), wxAny() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDynamicClassInfo::AddHandler( const wxChar *handlerName, wxObjectEventFunction address, const wxClassInfo* eventClassInfo )
|
void wxDynamicClassInfo::AddHandler( const wxChar *handlerName, wxObjectEventFunction address, const wxClassInfo* eventClassInfo )
|
||||||
{
|
{
|
||||||
|
EnsureInfosInited();
|
||||||
new wxHandlerInfo( m_firstHandler, this, handlerName, address, eventClassInfo );
|
new wxHandlerInfo( m_firstHandler, this, handlerName, address, eventClassInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -879,18 +940,46 @@ wxGenericPropertyAccessor::~wxGenericPropertyAccessor()
|
|||||||
delete m_data;
|
delete m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGenericPropertyAccessor::SetProperty(wxObject *object, const wxVariantBase &value) const
|
void wxGenericPropertyAccessor::SetProperty(wxObject *object, const wxAny &value) const
|
||||||
{
|
{
|
||||||
wxDynamicObject* dynobj = wx_dynamic_cast(wxDynamicObject*, object);
|
wxDynamicObject* dynobj = wx_dynamic_cast(wxDynamicObject*, object);
|
||||||
wxASSERT_MSG( dynobj, wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") );
|
wxASSERT_MSG( dynobj, wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") );
|
||||||
dynobj->SetProperty(m_propertyName, value );
|
dynobj->SetProperty(m_propertyName, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGenericPropertyAccessor::GetProperty(const wxObject *object, wxVariantBase& value) const
|
void wxGenericPropertyAccessor::GetProperty(const wxObject *object, wxAny& value) const
|
||||||
{
|
{
|
||||||
const wxDynamicObject* dynobj = wx_dynamic_cast( const wxDynamicObject * , object );
|
const wxDynamicObject* dynobj = wx_dynamic_cast( const wxDynamicObject * , object );
|
||||||
wxASSERT_MSG( dynobj, wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") );
|
wxASSERT_MSG( dynobj, wxT("cannot call wxDynamicClassInfo::SetProperty on an object other than wxDynamicObject") );
|
||||||
value = dynobj->GetProperty( m_propertyName );
|
value = dynobj->GetProperty( m_propertyName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxGenericPropertyAccessor
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
wxString wxAnyGetAsString( const wxAny& data)
|
||||||
|
{
|
||||||
|
if ( data.IsNull() || data.GetTypeInfo()==NULL )
|
||||||
|
return wxEmptyString;
|
||||||
|
|
||||||
|
wxString s;
|
||||||
|
data.GetTypeInfo()->ConvertToString(data,s);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wxObject* wxAnyGetAsObjectPtr( const wxAny& data)
|
||||||
|
{
|
||||||
|
if ( !data.IsNull() )
|
||||||
|
{
|
||||||
|
const wxClassTypeInfo* ti = wx_dynamic_cast(const wxClassTypeInfo*, data.GetTypeInfo());
|
||||||
|
if( ti )
|
||||||
|
return ti->GetClassInfo()->AnyToObjectPtr(data);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxObjectFunctor::~wxObjectFunctor()
|
||||||
|
{};
|
||||||
|
|
||||||
#endif // wxUSE_EXTENDED_RTTI
|
#endif // wxUSE_EXTENDED_RTTI
|
||||||
|
@@ -73,22 +73,22 @@ void wxObjectWriter::ClearObjectContext()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void wxObjectWriter::WriteObject(const wxObject *object, const wxClassInfo *classInfo,
|
void wxObjectWriter::WriteObject(const wxObject *object, const wxClassInfo *classInfo,
|
||||||
wxObjectReaderCallback *persister, const wxString &name,
|
wxObjectWriterCallback *writercallback, const wxString &name,
|
||||||
wxVariantBaseArray &metadata )
|
const wxStringToAnyHashMap &metadata )
|
||||||
{
|
{
|
||||||
DoBeginWriteTopLevelEntry( name );
|
DoBeginWriteTopLevelEntry( name );
|
||||||
WriteObject( object, classInfo, persister, false, metadata);
|
WriteObject( object, classInfo, writercallback, false, metadata);
|
||||||
DoEndWriteTopLevelEntry( name );
|
DoEndWriteTopLevelEntry( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxObjectWriter::WriteObject(const wxObject *object, const wxClassInfo *classInfo,
|
void wxObjectWriter::WriteObject(const wxObject *object, const wxClassInfo *classInfo,
|
||||||
wxObjectReaderCallback *persister, bool isEmbedded,
|
wxObjectWriterCallback *writercallback, bool isEmbedded,
|
||||||
wxVariantBaseArray &metadata )
|
const wxStringToAnyHashMap &metadata )
|
||||||
{
|
{
|
||||||
if ( !classInfo->BeforeWriteObject( object, this, persister, metadata) )
|
if ( !classInfo->BeforeWriteObject( object, this, writercallback, metadata) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( persister->BeforeWriteObject( this, object, classInfo, metadata) )
|
if ( writercallback->BeforeWriteObject( this, object, classInfo, metadata) )
|
||||||
{
|
{
|
||||||
if ( object == NULL )
|
if ( object == NULL )
|
||||||
DoWriteNullObject();
|
DoWriteNullObject();
|
||||||
@@ -108,10 +108,10 @@ void wxObjectWriter::WriteObject(const wxObject *object, const wxClassInfo *clas
|
|||||||
|
|
||||||
DoBeginWriteObject( object, classInfo, oid, metadata );
|
DoBeginWriteObject( object, classInfo, oid, metadata );
|
||||||
wxObjectWriterInternalPropertiesData data;
|
wxObjectWriterInternalPropertiesData data;
|
||||||
WriteAllProperties( object, classInfo, persister, &data );
|
WriteAllProperties( object, classInfo, writercallback, &data );
|
||||||
DoEndWriteObject( object, classInfo, oid );
|
DoEndWriteObject( object, classInfo, oid );
|
||||||
}
|
}
|
||||||
persister->AfterWriteObject( this,object, classInfo );
|
writercallback->AfterWriteObject( this,object, classInfo );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,23 +124,22 @@ void wxObjectWriter::FindConnectEntry(const wxEvtHandler * evSource,
|
|||||||
|
|
||||||
if ( dynamicEvents )
|
if ( dynamicEvents )
|
||||||
{
|
{
|
||||||
wxList::compatibility_iterator node = dynamicEvents->GetFirst();
|
for ( wxList::const_iterator node = dynamicEvents->begin(); node != dynamicEvents->end(); ++node )
|
||||||
while (node)
|
|
||||||
{
|
{
|
||||||
wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData();
|
wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)(*node);
|
||||||
|
|
||||||
// find the match
|
// find the match
|
||||||
if ( entry->m_fn &&
|
if ( entry->m_fn &&
|
||||||
(dti->GetEventType() == entry->m_eventType) &&
|
(dti->GetEventType() == entry->m_eventType) &&
|
||||||
(entry->m_id == -1 ) &&
|
(entry->m_id == -1 ) &&
|
||||||
(entry->m_eventSink != NULL ) )
|
(entry->m_fn->GetEvtHandler() != NULL ) )
|
||||||
{
|
{
|
||||||
sink = entry->m_eventSink;
|
sink = entry->m_fn->GetEvtHandler();
|
||||||
const wxClassInfo* sinkClassInfo = sink->GetClassInfo();
|
const wxClassInfo* sinkClassInfo = sink->GetClassInfo();
|
||||||
const wxHandlerInfo* sinkHandler = sinkClassInfo->GetFirstHandler();
|
const wxHandlerInfo* sinkHandler = sinkClassInfo->GetFirstHandler();
|
||||||
while ( sinkHandler )
|
while ( sinkHandler )
|
||||||
{
|
{
|
||||||
if ( sinkHandler->GetEventFunction() == entry->m_fn )
|
if ( sinkHandler->GetEventFunction() == entry->m_fn->GetEvtMethod() )
|
||||||
{
|
{
|
||||||
handler = sinkHandler;
|
handler = sinkHandler;
|
||||||
break;
|
break;
|
||||||
@@ -149,12 +148,11 @@ void wxObjectWriter::FindConnectEntry(const wxEvtHandler * evSource,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
node = node->GetNext();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void wxObjectWriter::WriteAllProperties( const wxObject * obj, const wxClassInfo* ci,
|
void wxObjectWriter::WriteAllProperties( const wxObject * obj, const wxClassInfo* ci,
|
||||||
wxObjectReaderCallback *persister,
|
wxObjectWriterCallback *writercallback,
|
||||||
wxObjectWriterInternalPropertiesData * data )
|
wxObjectWriterInternalPropertiesData * data )
|
||||||
{
|
{
|
||||||
wxPropertyInfoMap map;
|
wxPropertyInfoMap map;
|
||||||
@@ -166,7 +164,7 @@ void wxObjectWriter::WriteAllProperties( const wxObject * obj, const wxClassInfo
|
|||||||
const wxPropertyInfo* prop = iter == map.end() ? NULL : iter->second;
|
const wxPropertyInfo* prop = iter == map.end() ? NULL : iter->second;
|
||||||
if ( prop )
|
if ( prop )
|
||||||
{
|
{
|
||||||
WriteOneProperty( obj, prop->GetDeclaringClass(), prop, persister, data );
|
WriteOneProperty( obj, prop->GetDeclaringClass(), prop, writercallback, data );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -180,7 +178,7 @@ void wxObjectWriter::WriteAllProperties( const wxObject * obj, const wxClassInfo
|
|||||||
const wxPropertyInfo* prop = iter->second;
|
const wxPropertyInfo* prop = iter->second;
|
||||||
if ( prop->GetFlags() & wxPROP_OBJECT_GRAPH )
|
if ( prop->GetFlags() & wxPROP_OBJECT_GRAPH )
|
||||||
{
|
{
|
||||||
WriteOneProperty( obj, prop->GetDeclaringClass(), prop, persister, data );
|
WriteOneProperty( obj, prop->GetDeclaringClass(), prop, writercallback, data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -190,14 +188,36 @@ void wxObjectWriter::WriteAllProperties( const wxObject * obj, const wxClassInfo
|
|||||||
const wxPropertyInfo* prop = iter->second;
|
const wxPropertyInfo* prop = iter->second;
|
||||||
if ( !(prop->GetFlags() & wxPROP_OBJECT_GRAPH) )
|
if ( !(prop->GetFlags() & wxPROP_OBJECT_GRAPH) )
|
||||||
{
|
{
|
||||||
WriteOneProperty( obj, prop->GetDeclaringClass(), prop, persister, data );
|
WriteOneProperty( obj, prop->GetDeclaringClass(), prop, writercallback, data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class WXDLLIMPEXP_BASE wxObjectPropertyWriter: public wxObjectWriterFunctor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxObjectPropertyWriter(const wxClassTypeInfo* cti,
|
||||||
|
wxObjectWriterCallback *writercallback,
|
||||||
|
wxObjectWriter* writer,
|
||||||
|
wxStringToAnyHashMap &props) :
|
||||||
|
m_cti(cti),m_persister(writercallback),m_writer(writer),m_props(props)
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual void operator()(const wxObject *vobj)
|
||||||
|
{
|
||||||
|
m_writer->WriteObject( vobj, (vobj ? vobj->GetClassInfo() : m_cti->GetClassInfo() ),
|
||||||
|
m_persister, m_cti->GetKind()== wxT_OBJECT, m_props );
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
const wxClassTypeInfo* m_cti;
|
||||||
|
wxObjectWriterCallback *m_persister;
|
||||||
|
wxObjectWriter* m_writer;
|
||||||
|
wxStringToAnyHashMap& m_props;
|
||||||
|
};
|
||||||
|
|
||||||
void wxObjectWriter::WriteOneProperty( const wxObject *obj, const wxClassInfo* ci,
|
void wxObjectWriter::WriteOneProperty( const wxObject *obj, const wxClassInfo* ci,
|
||||||
const wxPropertyInfo* pi, wxObjectReaderCallback *persister,
|
const wxPropertyInfo* pi, wxObjectWriterCallback *writercallback,
|
||||||
wxObjectWriterInternalPropertiesData *WXUNUSED(data) )
|
wxObjectWriterInternalPropertiesData *WXUNUSED(data) )
|
||||||
{
|
{
|
||||||
if ( pi->GetFlags() & wxPROP_DONT_STREAM )
|
if ( pi->GetFlags() & wxPROP_DONT_STREAM )
|
||||||
@@ -210,39 +230,39 @@ void wxObjectWriter::WriteOneProperty( const wxObject *obj, const wxClassInfo* c
|
|||||||
|
|
||||||
if ( pi->GetTypeInfo()->GetKind() == wxT_COLLECTION )
|
if ( pi->GetTypeInfo()->GetKind() == wxT_COLLECTION )
|
||||||
{
|
{
|
||||||
wxVariantBaseArray data;
|
wxAnyList data;
|
||||||
pi->GetAccessor()->GetPropertyCollection(obj, data);
|
pi->GetAccessor()->GetPropertyCollection(obj, data);
|
||||||
const wxTypeInfo * elementType =
|
const wxTypeInfo * elementType =
|
||||||
wx_dynamic_cast( const wxCollectionTypeInfo*, pi->GetTypeInfo() )->GetElementType();
|
wx_dynamic_cast( const wxCollectionTypeInfo*, pi->GetTypeInfo() )->GetElementType();
|
||||||
for ( size_t i = 0; i < data.GetCount(); ++i )
|
if ( !data.empty() )
|
||||||
{
|
{
|
||||||
if ( i == 0 )
|
DoBeginWriteProperty( pi );
|
||||||
DoBeginWriteProperty( pi );
|
for ( wxAnyList::const_iterator iter = data.begin(); iter != data.end(); ++iter )
|
||||||
|
|
||||||
DoBeginWriteElement();
|
|
||||||
wxVariantBase value = data[i];
|
|
||||||
if ( persister->BeforeWriteProperty( this, obj, pi, value ) )
|
|
||||||
{
|
{
|
||||||
const wxClassTypeInfo* cti =
|
DoBeginWriteElement();
|
||||||
wx_dynamic_cast( const wxClassTypeInfo*, elementType );
|
const wxAny* valptr = *iter;
|
||||||
if ( cti )
|
if ( writercallback->BeforeWriteProperty( this, obj, pi, *valptr ) )
|
||||||
{
|
{
|
||||||
const wxClassInfo* pci = cti->GetClassInfo();
|
const wxClassTypeInfo* cti =
|
||||||
wxObject *vobj = pci->VariantToInstance( value );
|
wx_dynamic_cast( const wxClassTypeInfo*, elementType );
|
||||||
wxVariantBaseArray md;
|
if ( cti )
|
||||||
WriteObject( vobj, (vobj ? vobj->GetClassInfo() : pci ),
|
{
|
||||||
persister, cti->GetKind()== wxT_OBJECT, md );
|
wxStringToAnyHashMap md;
|
||||||
}
|
wxObjectPropertyWriter pw(cti,writercallback,this, md);
|
||||||
else
|
|
||||||
{
|
const wxClassInfo* pci = cti->GetClassInfo();
|
||||||
DoWriteSimpleType( value );
|
pci->CallOnAny( *valptr, &pw);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DoWriteSimpleType( *valptr );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
DoEndWriteElement();
|
||||||
}
|
}
|
||||||
DoEndWriteElement();
|
DoEndWriteProperty( pi );
|
||||||
if ( i == data.GetCount() - 1 )
|
}
|
||||||
DoEndWriteProperty( pi );
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const wxEventSourceTypeInfo* dti =
|
const wxEventSourceTypeInfo* dti =
|
||||||
@@ -256,7 +276,7 @@ void wxObjectWriter::WriteOneProperty( const wxObject *obj, const wxClassInfo* c
|
|||||||
if ( evSource )
|
if ( evSource )
|
||||||
{
|
{
|
||||||
FindConnectEntry( evSource, dti, sink, handler );
|
FindConnectEntry( evSource, dti, sink, handler );
|
||||||
if ( persister->BeforeWriteDelegate( this, obj, ci, pi, sink, handler ) )
|
if ( writercallback->BeforeWriteDelegate( this, obj, ci, pi, sink, handler ) )
|
||||||
{
|
{
|
||||||
if ( sink != NULL && handler != NULL )
|
if ( sink != NULL && handler != NULL )
|
||||||
{
|
{
|
||||||
@@ -282,11 +302,12 @@ void wxObjectWriter::WriteOneProperty( const wxObject *obj, const wxClassInfo* c
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxVariantBase value;
|
wxAny value;
|
||||||
pi->GetAccessor()->GetProperty(obj, value);
|
pi->GetAccessor()->GetProperty(obj, value);
|
||||||
|
|
||||||
// avoid streaming out void objects
|
// avoid streaming out void objects
|
||||||
if( value.IsEmpty() )
|
// TODO Verify
|
||||||
|
if( value.IsNull() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( pi->GetFlags() & wxPROP_ENUM_STORE_LONG )
|
if ( pi->GetFlags() & wxPROP_ENUM_STORE_LONG )
|
||||||
@@ -295,7 +316,7 @@ void wxObjectWriter::WriteOneProperty( const wxObject *obj, const wxClassInfo* c
|
|||||||
wx_dynamic_cast(const wxEnumTypeInfo*, pi->GetTypeInfo() );
|
wx_dynamic_cast(const wxEnumTypeInfo*, pi->GetTypeInfo() );
|
||||||
if ( eti )
|
if ( eti )
|
||||||
{
|
{
|
||||||
eti->ConvertFromLong( value.wxTEMPLATED_MEMBER_CALL(Get, long), value );
|
eti->ConvertFromLong( wxANY_AS(value, long ), value );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -305,9 +326,9 @@ void wxObjectWriter::WriteOneProperty( const wxObject *obj, const wxClassInfo* c
|
|||||||
|
|
||||||
// avoid streaming out default values
|
// avoid streaming out default values
|
||||||
if ( pi->GetTypeInfo()->HasStringConverters() &&
|
if ( pi->GetTypeInfo()->HasStringConverters() &&
|
||||||
!pi->GetDefaultValue().IsEmpty() )
|
!pi->GetDefaultValue().IsNull() ) // TODO Verify
|
||||||
{
|
{
|
||||||
if ( value.GetAsString() == pi->GetDefaultValue().GetAsString() )
|
if ( wxAnyGetAsString(value) == wxAnyGetAsString(pi->GetDefaultValue()) )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,28 +336,28 @@ void wxObjectWriter::WriteOneProperty( const wxObject *obj, const wxClassInfo* c
|
|||||||
const wxClassTypeInfo* cti =
|
const wxClassTypeInfo* cti =
|
||||||
wx_dynamic_cast( const wxClassTypeInfo* , pi->GetTypeInfo() );
|
wx_dynamic_cast( const wxClassTypeInfo* , pi->GetTypeInfo() );
|
||||||
|
|
||||||
if ( cti && value.GetAsObject() == NULL )
|
if ( cti && cti->GetKind() == wxT_OBJECT_PTR && wxAnyGetAsObjectPtr(value) == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( persister->BeforeWriteProperty( this, obj, pi, value ) )
|
if ( writercallback->BeforeWriteProperty( this, obj, pi, value ) )
|
||||||
{
|
{
|
||||||
DoBeginWriteProperty( pi );
|
DoBeginWriteProperty( pi );
|
||||||
if ( cti )
|
if ( cti )
|
||||||
{
|
{
|
||||||
const wxClassInfo* pci = cti->GetClassInfo();
|
if ( cti->HasStringConverters() )
|
||||||
wxObject *vobj = pci->VariantToInstance( value );
|
|
||||||
if ( vobj && pi->GetTypeInfo()->HasStringConverters() )
|
|
||||||
{
|
{
|
||||||
wxString stringValue;
|
wxString stringValue;
|
||||||
cti->ConvertToString( value, stringValue );
|
cti->ConvertToString( value, stringValue );
|
||||||
wxVariantBase convertedValue(stringValue);
|
wxAny convertedValue(stringValue);
|
||||||
DoWriteSimpleType( convertedValue );
|
DoWriteSimpleType( convertedValue );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxVariantBaseArray md;
|
wxStringToAnyHashMap md;
|
||||||
WriteObject( vobj, (vobj ? vobj->GetClassInfo() : pci ),
|
wxObjectPropertyWriter pw(cti,writercallback,this, md);
|
||||||
persister, cti->GetKind()== wxT_OBJECT, md);
|
|
||||||
|
const wxClassInfo* pci = cti->GetClassInfo();
|
||||||
|
pci->CallOnAny(value, &pw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -476,7 +497,7 @@ wxObjectRuntimeReaderCallback::~wxObjectRuntimeReaderCallback()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void wxObjectRuntimeReaderCallback::AllocateObject(int objectID, wxClassInfo *classInfo,
|
void wxObjectRuntimeReaderCallback::AllocateObject(int objectID, wxClassInfo *classInfo,
|
||||||
wxVariantBaseArray &WXUNUSED(metadata))
|
wxStringToAnyHashMap &WXUNUSED(metadata))
|
||||||
{
|
{
|
||||||
wxObject *O;
|
wxObject *O;
|
||||||
O = classInfo->CreateObject();
|
O = classInfo->CreateObject();
|
||||||
@@ -486,10 +507,10 @@ void wxObjectRuntimeReaderCallback::AllocateObject(int objectID, wxClassInfo *cl
|
|||||||
void wxObjectRuntimeReaderCallback::CreateObject(int objectID,
|
void wxObjectRuntimeReaderCallback::CreateObject(int objectID,
|
||||||
const wxClassInfo *classInfo,
|
const wxClassInfo *classInfo,
|
||||||
int paramCount,
|
int paramCount,
|
||||||
wxVariantBase *params,
|
wxAny *params,
|
||||||
int *objectIdValues,
|
int *objectIdValues,
|
||||||
const wxClassInfo **objectClassInfos,
|
const wxClassInfo **objectClassInfos,
|
||||||
wxVariantBaseArray &WXUNUSED(metadata))
|
wxStringToAnyHashMap &WXUNUSED(metadata))
|
||||||
{
|
{
|
||||||
wxObject *o;
|
wxObject *o;
|
||||||
o = m_data->GetObject(objectID);
|
o = m_data->GetObject(objectID);
|
||||||
@@ -506,7 +527,7 @@ void wxObjectRuntimeReaderCallback::CreateObject(int objectID,
|
|||||||
{
|
{
|
||||||
o = dyno->GetSuperClassInstance();
|
o = dyno->GetSuperClassInstance();
|
||||||
}
|
}
|
||||||
params[i] = objectClassInfos[i]->InstanceToVariant(o);
|
params[i] = objectClassInfos[i]->ObjectPtrToAny(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
classInfo->Create(o, paramCount, params);
|
classInfo->Create(o, paramCount, params);
|
||||||
@@ -515,10 +536,10 @@ void wxObjectRuntimeReaderCallback::CreateObject(int objectID,
|
|||||||
void wxObjectRuntimeReaderCallback::ConstructObject(int objectID,
|
void wxObjectRuntimeReaderCallback::ConstructObject(int objectID,
|
||||||
const wxClassInfo *classInfo,
|
const wxClassInfo *classInfo,
|
||||||
int paramCount,
|
int paramCount,
|
||||||
wxVariantBase *params,
|
wxAny *params,
|
||||||
int *objectIdValues,
|
int *objectIdValues,
|
||||||
const wxClassInfo **objectClassInfos,
|
const wxClassInfo **objectClassInfos,
|
||||||
wxVariantBaseArray &WXUNUSED(metadata))
|
wxStringToAnyHashMap &WXUNUSED(metadata))
|
||||||
{
|
{
|
||||||
wxObject *o;
|
wxObject *o;
|
||||||
for ( int i = 0; i < paramCount; ++i )
|
for ( int i = 0; i < paramCount; ++i )
|
||||||
@@ -534,7 +555,7 @@ void wxObjectRuntimeReaderCallback::ConstructObject(int objectID,
|
|||||||
{
|
{
|
||||||
o = dyno->GetSuperClassInstance();
|
o = dyno->GetSuperClassInstance();
|
||||||
}
|
}
|
||||||
params[i] = objectClassInfos[i]->InstanceToVariant(o);
|
params[i] = objectClassInfos[i]->ObjectPtrToAny(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
o = classInfo->ConstructObject(paramCount, params);
|
o = classInfo->ConstructObject(paramCount, params);
|
||||||
@@ -552,7 +573,7 @@ void wxObjectRuntimeReaderCallback::DestroyObject(int objectID, wxClassInfo *WXU
|
|||||||
void wxObjectRuntimeReaderCallback::SetProperty(int objectID,
|
void wxObjectRuntimeReaderCallback::SetProperty(int objectID,
|
||||||
const wxClassInfo *classInfo,
|
const wxClassInfo *classInfo,
|
||||||
const wxPropertyInfo* propertyInfo,
|
const wxPropertyInfo* propertyInfo,
|
||||||
const wxVariantBase &value)
|
const wxAny &value)
|
||||||
{
|
{
|
||||||
wxObject *o;
|
wxObject *o;
|
||||||
o = m_data->GetObject(objectID);
|
o = m_data->GetObject(objectID);
|
||||||
@@ -579,7 +600,7 @@ void wxObjectRuntimeReaderCallback::SetPropertyAsObject(int objectID,
|
|||||||
}
|
}
|
||||||
|
|
||||||
classInfo->SetProperty( o, propertyInfo->GetName(),
|
classInfo->SetProperty( o, propertyInfo->GetName(),
|
||||||
valClassInfo->InstanceToVariant(valo) );
|
valClassInfo->ObjectPtrToAny(valo) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxObjectRuntimeReaderCallback::SetConnect(int eventSourceObjectID,
|
void wxObjectRuntimeReaderCallback::SetConnect(int eventSourceObjectID,
|
||||||
@@ -625,7 +646,7 @@ wxObject *wxObjectRuntimeReaderCallback::GetObject(int objectID)
|
|||||||
void wxObjectRuntimeReaderCallback::AddToPropertyCollection( int objectID,
|
void wxObjectRuntimeReaderCallback::AddToPropertyCollection( int objectID,
|
||||||
const wxClassInfo *classInfo,
|
const wxClassInfo *classInfo,
|
||||||
const wxPropertyInfo* propertyInfo,
|
const wxPropertyInfo* propertyInfo,
|
||||||
const wxVariantBase &value)
|
const wxAny &value)
|
||||||
{
|
{
|
||||||
wxObject *o;
|
wxObject *o;
|
||||||
o = m_data->GetObject(objectID);
|
o = m_data->GetObject(objectID);
|
||||||
@@ -654,12 +675,7 @@ void wxObjectRuntimeReaderCallback::AddToPropertyCollectionAsObject(int objectID
|
|||||||
}
|
}
|
||||||
|
|
||||||
classInfo->AddToPropertyCollection( o, propertyInfo->GetName(),
|
classInfo->AddToPropertyCollection( o, propertyInfo->GetName(),
|
||||||
valClassInfo->InstanceToVariant(valo) );
|
valClassInfo->ObjectPtrToAny(valo) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TEST_XVARIANT
|
|
||||||
#include "wx/arrimpl.cpp"
|
|
||||||
WX_DEFINE_OBJARRAY(wxVariantBaseArray);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // wxUSE_EXTENDED_RTTI
|
#endif // wxUSE_EXTENDED_RTTI
|
||||||
|
@@ -13,12 +13,12 @@
|
|||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_EXTENDED_RTTI
|
#if wxUSE_EXTENDED_RTTI
|
||||||
|
|
||||||
#include "wx/xtixml.h"
|
#include "wx/xtistrm.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/object.h"
|
#include "wx/object.h"
|
||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "wx/tokenzr.h"
|
#include "wx/tokenzr.h"
|
||||||
#include "wx/txtstrm.h"
|
#include "wx/txtstrm.h"
|
||||||
#include "wx/xtistrm.h"
|
#include "wx/xtistrm.h"
|
||||||
|
#include "wx/xtixml.h"
|
||||||
|
|
||||||
// STL headers
|
// STL headers
|
||||||
|
|
||||||
@@ -110,17 +111,19 @@ void wxObjectXmlWriter::DoEndWriteTopLevelEntry( const wxString &WXUNUSED(name)
|
|||||||
|
|
||||||
void wxObjectXmlWriter::DoBeginWriteObject(const wxObject *WXUNUSED(object),
|
void wxObjectXmlWriter::DoBeginWriteObject(const wxObject *WXUNUSED(object),
|
||||||
const wxClassInfo *classInfo,
|
const wxClassInfo *classInfo,
|
||||||
int objectID, wxVariantBaseArray &metadata )
|
int objectID, const wxStringToAnyHashMap &metadata )
|
||||||
{
|
{
|
||||||
wxXmlNode *pnode;
|
wxXmlNode *pnode;
|
||||||
pnode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("object"));
|
pnode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("object"));
|
||||||
pnode->AddProperty(wxT("class"), wxString(classInfo->GetClassName()));
|
pnode->AddProperty(wxT("class"), wxString(classInfo->GetClassName()));
|
||||||
pnode->AddProperty(wxT("id"), wxString::Format( wxT("%d"), objectID ) );
|
pnode->AddProperty(wxT("id"), wxString::Format( wxT("%d"), objectID ) );
|
||||||
|
|
||||||
for ( size_t i = 0; i < metadata.GetCount(); ++i )
|
wxStringToAnyHashMap::const_iterator it, en;
|
||||||
|
for( it = metadata.begin(), en = metadata.end(); it != en; ++it )
|
||||||
{
|
{
|
||||||
pnode->AddProperty( metadata[i].GetName(), metadata[i].GetAsString() );
|
pnode->AddProperty( it->first, wxAnyGetAsString(it->second) );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_data->m_current->AddChild(pnode);
|
m_data->m_current->AddChild(pnode);
|
||||||
m_data->Push( pnode );
|
m_data->Push( pnode );
|
||||||
}
|
}
|
||||||
@@ -132,9 +135,9 @@ void wxObjectXmlWriter::DoEndWriteObject(const wxObject *WXUNUSED(object),
|
|||||||
m_data->Pop();
|
m_data->Pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxObjectXmlWriter::DoWriteSimpleType( wxVariantBase &value )
|
void wxObjectXmlWriter::DoWriteSimpleType( const wxAny &value )
|
||||||
{
|
{
|
||||||
wxXmlAddContentToNode( m_data->m_current,value.GetAsString() );
|
wxXmlAddContentToNode( m_data->m_current,wxAnyGetAsString(value) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxObjectXmlWriter::DoBeginWriteElement()
|
void wxObjectXmlWriter::DoBeginWriteElement()
|
||||||
@@ -204,13 +207,13 @@ as properties are always sought by typeinfo over all levels
|
|||||||
and create params are always toplevel class only
|
and create params are always toplevel class only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectWriterCallback *callbacks)
|
int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectReaderCallback *callbacks)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( callbacks, wxT("Does not support reading without a Depersistor") );
|
wxASSERT_MSG( callbacks, wxT("Does not support reading without a Depersistor") );
|
||||||
wxString className;
|
wxString className;
|
||||||
wxClassInfo *classInfo;
|
wxClassInfo *classInfo;
|
||||||
|
|
||||||
wxVariantBase *createParams;
|
wxAny *createParams;
|
||||||
int *createParamOids;
|
int *createParamOids;
|
||||||
const wxClassInfo** createClassInfos;
|
const wxClassInfo** createClassInfos;
|
||||||
wxXmlNode *children;
|
wxXmlNode *children;
|
||||||
@@ -221,7 +224,7 @@ int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectWriterCallback *ca
|
|||||||
if (!children)
|
if (!children)
|
||||||
{
|
{
|
||||||
// check for a null object or href
|
// check for a null object or href
|
||||||
if (node->GetPropVal(wxT("href"), &ObjectIdString ) )
|
if (node->GetAttribute(wxT("href"), &ObjectIdString ) )
|
||||||
{
|
{
|
||||||
objectID = atoi( ObjectIdString.ToAscii() );
|
objectID = atoi( ObjectIdString.ToAscii() );
|
||||||
if ( HasObjectClassInfo( objectID ) )
|
if ( HasObjectClassInfo( objectID ) )
|
||||||
@@ -234,12 +237,12 @@ int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectWriterCallback *ca
|
|||||||
return wxInvalidObjectID;
|
return wxInvalidObjectID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !node->GetPropVal(wxT("id"), &ObjectIdString ) )
|
if ( !node->GetAttribute(wxT("id"), &ObjectIdString ) )
|
||||||
{
|
{
|
||||||
return wxNullObjectID;
|
return wxNullObjectID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!node->GetPropVal(wxT("class"), &className))
|
if (!node->GetAttribute(wxT("class"), &className))
|
||||||
{
|
{
|
||||||
// No class name. Eek. FIXME: error handling
|
// No class name. Eek. FIXME: error handling
|
||||||
return wxInvalidObjectID;
|
return wxInvalidObjectID;
|
||||||
@@ -257,7 +260,7 @@ int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectWriterCallback *ca
|
|||||||
wxLogError(_("objects cannot have XML Text Nodes") );
|
wxLogError(_("objects cannot have XML Text Nodes") );
|
||||||
return wxInvalidObjectID;
|
return wxInvalidObjectID;
|
||||||
}
|
}
|
||||||
if (!node->GetPropVal(wxT("id"), &ObjectIdString))
|
if (!node->GetAttribute(wxT("id"), &ObjectIdString))
|
||||||
{
|
{
|
||||||
wxLogError(_("Objects must have an id attribute") );
|
wxLogError(_("Objects must have an id attribute") );
|
||||||
// No object id. Eek. FIXME: error handling
|
// No object id. Eek. FIXME: error handling
|
||||||
@@ -276,14 +279,14 @@ int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectWriterCallback *ca
|
|||||||
// first make the object know to our internal registry
|
// first make the object know to our internal registry
|
||||||
SetObjectClassInfo( objectID, classInfo );
|
SetObjectClassInfo( objectID, classInfo );
|
||||||
|
|
||||||
wxVariantBaseArray metadata;
|
wxStringToAnyHashMap metadata;
|
||||||
wxXmlProperty *xp = node->GetProperties();
|
wxXmlProperty *xp = node->GetAttributes();
|
||||||
while ( xp )
|
while ( xp )
|
||||||
{
|
{
|
||||||
if ( xp->GetName() != wxString(wxT("class")) &&
|
if ( xp->GetName() != wxString(wxT("class")) &&
|
||||||
xp->GetName() != wxString(wxT("id")) )
|
xp->GetName() != wxString(wxT("id")) )
|
||||||
{
|
{
|
||||||
metadata.Add( new wxVariantBase( xp->GetValue(), xp->GetName() ) );
|
metadata[xp->GetName()] = wxAny( xp->GetValue() );
|
||||||
}
|
}
|
||||||
xp = xp->GetNext();
|
xp = xp->GetNext();
|
||||||
}
|
}
|
||||||
@@ -292,7 +295,7 @@ int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectWriterCallback *ca
|
|||||||
|
|
||||||
//
|
//
|
||||||
// stream back the Create parameters first
|
// stream back the Create parameters first
|
||||||
createParams = new wxVariantBase[ classInfo->GetCreateParamCount() ];
|
createParams = new wxAny[ classInfo->GetCreateParamCount() ];
|
||||||
createParamOids = new int[classInfo->GetCreateParamCount() ];
|
createParamOids = new int[classInfo->GetCreateParamCount() ];
|
||||||
createClassInfos = new const wxClassInfo*[classInfo->GetCreateParamCount() ];
|
createClassInfos = new const wxClassInfo*[classInfo->GetCreateParamCount() ];
|
||||||
|
|
||||||
@@ -309,7 +312,7 @@ int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectWriterCallback *ca
|
|||||||
while( children )
|
while( children )
|
||||||
{
|
{
|
||||||
wxString name;
|
wxString name;
|
||||||
children->GetPropVal( wxT("name"), &name );
|
children->GetAttribute( wxT("name"), &name );
|
||||||
propertyNames.push_back( (const wxChar*)name.c_str() );
|
propertyNames.push_back( (const wxChar*)name.c_str() );
|
||||||
propertyNodes[(const wxChar*)name.c_str()] = children->GetChildren();
|
propertyNodes[(const wxChar*)name.c_str()] = children->GetChildren();
|
||||||
children = children->GetNext();
|
children = children->GetNext();
|
||||||
@@ -347,7 +350,7 @@ int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectWriterCallback *ca
|
|||||||
{
|
{
|
||||||
long realval;
|
long realval;
|
||||||
eti->ConvertToLong( createParams[i], realval );
|
eti->ConvertToLong( createParams[i], realval );
|
||||||
createParams[i] = wxVariantBase( realval );
|
createParams[i] = wxAny( realval );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -435,7 +438,7 @@ int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectWriterCallback *ca
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxVariantBase elementValue = ReadValue( elementContent, elementType );
|
wxAny elementValue = ReadValue( elementContent, elementType );
|
||||||
if ( pi->GetAccessor()->HasAdder() )
|
if ( pi->GetAccessor()->HasAdder() )
|
||||||
callbacks->AddToPropertyCollection( objectID, classInfo,pi, elementValue );
|
callbacks->AddToPropertyCollection( objectID, classInfo,pi, elementValue );
|
||||||
}
|
}
|
||||||
@@ -462,7 +465,7 @@ int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectWriterCallback *ca
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxASSERT( pi->GetTypeInfo()->HasStringConverters() );
|
wxASSERT( pi->GetTypeInfo()->HasStringConverters() );
|
||||||
wxVariantBase nodeval = ReadValue( prop, pi->GetTypeInfo() );
|
wxAny nodeval = ReadValue( prop, pi->GetTypeInfo() );
|
||||||
callbacks->SetProperty( objectID, classInfo,pi, nodeval );
|
callbacks->SetProperty( objectID, classInfo,pi, nodeval );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -491,7 +494,7 @@ int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectWriterCallback *ca
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxVariantBase nodeval = ReadValue( prop, pi->GetTypeInfo() );
|
wxAny nodeval = ReadValue( prop, pi->GetTypeInfo() );
|
||||||
if( pi->GetFlags() & wxPROP_ENUM_STORE_LONG )
|
if( pi->GetFlags() & wxPROP_ENUM_STORE_LONG )
|
||||||
{
|
{
|
||||||
const wxEnumTypeInfo *eti =
|
const wxEnumTypeInfo *eti =
|
||||||
@@ -500,7 +503,7 @@ int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectWriterCallback *ca
|
|||||||
{
|
{
|
||||||
long realval;
|
long realval;
|
||||||
eti->ConvertToLong( nodeval, realval );
|
eti->ConvertToLong( nodeval, realval );
|
||||||
nodeval = wxVariantBase( realval );
|
nodeval = wxAny( realval );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -520,24 +523,24 @@ int wxObjectXmlReader::ReadComponent(wxXmlNode *node, wxObjectWriterCallback *ca
|
|||||||
return objectID;
|
return objectID;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxVariantBase wxObjectXmlReader::ReadValue(wxXmlNode *node,
|
wxAny wxObjectXmlReader::ReadValue(wxXmlNode *node,
|
||||||
const wxTypeInfo *type )
|
const wxTypeInfo *type )
|
||||||
{
|
{
|
||||||
wxString content;
|
wxString content;
|
||||||
if ( node )
|
if ( node )
|
||||||
content = node->GetContent();
|
content = node->GetContent();
|
||||||
wxVariantBase result;
|
wxAny result;
|
||||||
type->ConvertFromString( content, result );
|
type->ConvertFromString( content, result );
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxObjectXmlReader::ReadObject( const wxString &name, wxObjectWriterCallback *callbacks)
|
int wxObjectXmlReader::ReadObject( const wxString &name, wxObjectReaderCallback *callbacks)
|
||||||
{
|
{
|
||||||
wxXmlNode *iter = m_parent->GetChildren();
|
wxXmlNode *iter = m_parent->GetChildren();
|
||||||
while ( iter )
|
while ( iter )
|
||||||
{
|
{
|
||||||
wxString entryName;
|
wxString entryName;
|
||||||
if ( iter->GetPropVal(wxT("name"), &entryName) )
|
if ( iter->GetAttribute(wxT("name"), &entryName) )
|
||||||
{
|
{
|
||||||
if ( entryName == name )
|
if ( entryName == name )
|
||||||
return ReadComponent( iter->GetChildren(), callbacks );
|
return ReadComponent( iter->GetChildren(), callbacks );
|
||||||
|
Reference in New Issue
Block a user