* Fixes and new features in wxObject*Stream
* Fixes: wxChoice (GTK), wxCheckBox (GTK) * Fixes: wxStream * wxObject calls wx*Serialize::LoadObject/StoreObject in StoreObject/LoadObject * Added support for dynamic library (Linux only, Windows will follow) * Added serbase.h (Serialization base defines and base object) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@436 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -221,12 +221,57 @@ wxObject *wxCreateDynamicObject(char *name)
|
||||
|
||||
#ifdef USE_STORABLE_CLASSES
|
||||
|
||||
#include "wx/serbase.h"
|
||||
#include "wx/dynlib.h"
|
||||
#include "wx/msgdlg.h"
|
||||
|
||||
wxObject* wxCreateStoredObject( wxInputStream &stream )
|
||||
{
|
||||
wxObjectInputStream obj_s(stream);
|
||||
return obj_s.LoadObject();
|
||||
};
|
||||
|
||||
void wxObject::StoreObject( wxObjectOutputStream& stream )
|
||||
{
|
||||
wxString obj_name = wxString(GetClassInfo()->GetClassName()) + "_Serialize";
|
||||
wxLibrary *lib = wxTheLibraries.LoadLibrary("wxserial");
|
||||
WXSERIAL(wxObject) *serial =
|
||||
(WXSERIAL(wxObject) *)lib->CreateObject( obj_name );
|
||||
|
||||
if (!serial) {
|
||||
wxString message;
|
||||
|
||||
message.Printf("Can't find the serialization object (%s) for the object %s",
|
||||
WXSTRINGCAST obj_name, WXSTRINGCAST GetClassInfo()->GetClassName());
|
||||
wxMessageBox(message, "Alert !");
|
||||
return;
|
||||
}
|
||||
|
||||
serial->SetObject(this);
|
||||
serial->StoreObject(stream);
|
||||
}
|
||||
|
||||
void wxObject::LoadObject( wxObjectInputStream& stream )
|
||||
{
|
||||
wxString obj_name = wxString(GetClassInfo()->GetClassName()) + "_Serialize";
|
||||
wxLibrary *lib = wxTheLibraries.LoadLibrary("wxserial");
|
||||
WXSERIAL(wxObject) *serial =
|
||||
(WXSERIAL(wxObject) *)lib->CreateObject( obj_name );
|
||||
|
||||
if (!serial) {
|
||||
wxString message;
|
||||
|
||||
message.Printf("Can't find the serialization object (%s) for the object %s",
|
||||
WXSTRINGCAST obj_name,
|
||||
WXSTRINGCAST GetClassInfo()->GetClassName());
|
||||
wxMessageBox(message, "Alert !");
|
||||
return;
|
||||
}
|
||||
|
||||
serial->SetObject(this);
|
||||
serial->LoadObject(stream);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user