* New function wxObjectInputStream::Recall()
* Fixes in object serializer,dynlib,LoadObject/StoreObject * Updates for serialization. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@625 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
def172b2af
commit
1d44aaf824
@ -27,7 +27,7 @@ class wxObjectStreamInfo : public wxObject {
|
||||
wxList children;
|
||||
wxObjectStreamInfo *parent;
|
||||
wxObject *object;
|
||||
bool duplicate;
|
||||
bool duplicate, recall;
|
||||
};
|
||||
|
||||
class wxObjectOutputStream : public wxFilterOutputStream {
|
||||
@ -57,6 +57,9 @@ class wxObjectInputStream : public wxFilterInputStream {
|
||||
public:
|
||||
wxObjectInputStream(wxInputStream& s);
|
||||
|
||||
bool SecondCall() const { return m_secondcall; }
|
||||
void Recall(bool on = TRUE) { m_current_info->recall = on; }
|
||||
|
||||
wxObject *GetChild(int no) const;
|
||||
wxObject *GetChild();
|
||||
int NumberOfChildren() const { return m_current_info->n_children; }
|
||||
@ -72,6 +75,7 @@ class wxObjectInputStream : public wxFilterInputStream {
|
||||
void ProcessObjectData(wxObjectStreamInfo *info);
|
||||
|
||||
protected:
|
||||
bool m_secondcall;
|
||||
wxObjectStreamInfo *m_current_info;
|
||||
wxList m_solver;
|
||||
};
|
||||
|
@ -1286,27 +1286,32 @@ if test "$USE_THREADS" = "1"; then
|
||||
AC_CHECK_LIB(pthread-0.7, pthread_create, [
|
||||
UNIX_THREAD="gtk/threadpsx.cpp"
|
||||
THREADS_LINK="-lpthread-0.7"
|
||||
AC_DEFINE(USE_THREADS)
|
||||
],[
|
||||
AC_CHECK_HEADER(sys/prctl.h, [
|
||||
UNIX_THREAD="gtk/threadsgi.cpp"
|
||||
AC_DEFINE(USE_THREADS)
|
||||
])
|
||||
AC_CHECK_LIB(pthread, pthread_create, [
|
||||
|
||||
dnl pthread_create is always available in pthread but it seems not to be
|
||||
dnl the case for pthread_setcanceltype.
|
||||
|
||||
AC_CHECK_LIB(pthread, pthread_setcanceltype, [
|
||||
UNIX_THREAD="gtk/threadpsx.cpp"
|
||||
THREADS_LINK="-lpthread"
|
||||
AC_DEFINE(USE_THREADS)
|
||||
])
|
||||
])
|
||||
AC_CHECK_LIB(pthreads, pthread_create, [
|
||||
AC_CHECK_LIB(pthreads, pthread_setcanceltype, [
|
||||
UNIX_THREAD="gtk/threadpsx.cpp"
|
||||
THREADS_LINK="-lpthreads"
|
||||
AC_DEFINE(USE_THREADS)
|
||||
])
|
||||
fi
|
||||
|
||||
if test -z "$UNIX_THREAD"; then
|
||||
USE_THREADS=0
|
||||
fi
|
||||
|
||||
AC_SUBST(UNIX_THREAD)
|
||||
AC_SUBST(THREADS_LINK)
|
||||
AC_DEFINE(USE_THREADS)
|
||||
|
||||
dnl defines UNIX_THREAD it contains the source file to use for threads. (GL)
|
||||
dnl defines THREADS_LINK it contains the thread library to link with. (GL)
|
||||
|
@ -118,7 +118,7 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name)
|
||||
return ((wxLibrary *)node->Data());
|
||||
|
||||
#ifdef __UNIX__
|
||||
lib_name.Prepend("lib");
|
||||
lib_name.Prepend("./lib");
|
||||
lib_name += ".so";
|
||||
|
||||
printf("lib_name = %s\n", WXSTRINGCAST lib_name);
|
||||
|
@ -235,8 +235,13 @@ 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 );
|
||||
WXSERIAL(wxObject) *serial;
|
||||
|
||||
if (!lib) {
|
||||
wxMessageBox("Can't load wxSerial dynamic library.", "Alert !");
|
||||
return;
|
||||
}
|
||||
serial = (WXSERIAL(wxObject) *)lib->CreateObject( obj_name );
|
||||
|
||||
if (!serial) {
|
||||
wxString message;
|
||||
|
@ -56,6 +56,7 @@ void wxObjectOutputStream::WriteObjectDef(wxObjectStreamInfo& info)
|
||||
data_s.WriteString(info.object->GetClassInfo()->GetClassName());
|
||||
} else {
|
||||
data_s.WriteString(TAG_EMPTY_OBJECT);
|
||||
return;
|
||||
}
|
||||
|
||||
data_s.WriteString(GetObjectName(info.object));
|
||||
@ -80,6 +81,9 @@ void wxObjectOutputStream::AddChild(wxObject *obj)
|
||||
info->duplicate = FALSE;
|
||||
m_saved_objs.Append(obj);
|
||||
}
|
||||
if (!obj)
|
||||
info->duplicate = FALSE;
|
||||
|
||||
info->n_children = 0;
|
||||
info->object = obj;
|
||||
info->parent = m_current_info; // Not useful here.
|
||||
@ -135,6 +139,7 @@ bool wxObjectOutputStream::SaveObject(wxObject& obj)
|
||||
m_stage = 0;
|
||||
info.object = &obj;
|
||||
info.n_children = 0;
|
||||
info.duplicate = FALSE;
|
||||
ProcessObjectDef(&info);
|
||||
|
||||
m_stage = 1;
|
||||
@ -180,11 +185,25 @@ wxObject *wxObjectInputStream::GetParent() const
|
||||
return m_current_info->parent->object;
|
||||
}
|
||||
|
||||
wxObject *wxObjectInputStream::GetChild()
|
||||
{
|
||||
wxObject *obj = GetChild(0);
|
||||
|
||||
m_current_info->children_removed++;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
wxObject *wxObjectInputStream::GetChild(int no) const
|
||||
{
|
||||
wxNode *node = m_current_info->children.Nth(m_current_info->children_removed+no);
|
||||
wxNode *node;
|
||||
wxObjectStreamInfo *info;
|
||||
|
||||
if (m_current_info->children_removed >= m_current_info->n_children)
|
||||
return NULL;
|
||||
|
||||
node = m_current_info->children.Nth(m_current_info->children_removed+no);
|
||||
|
||||
if (!node)
|
||||
return (wxObject *) NULL;
|
||||
|
||||
@ -210,17 +229,18 @@ bool wxObjectInputStream::ReadObjectDef(wxObjectStreamInfo *info)
|
||||
return FALSE;
|
||||
|
||||
class_name = data_s.ReadString();
|
||||
info->object_name = data_s.ReadString();
|
||||
info->children_removed = 0;
|
||||
|
||||
if (class_name == TAG_EMPTY_OBJECT)
|
||||
info->object = (wxObject *) NULL;
|
||||
else if (class_name == TAG_DUPLICATE_OBJECT) {
|
||||
info->object_name = data_s.ReadString();
|
||||
info->object = SolveName(info->object_name);
|
||||
info->n_children = 0;
|
||||
} else {
|
||||
info->object_name = data_s.ReadString();
|
||||
info->object = wxCreateDynamicObject( WXSTRINGCAST class_name);
|
||||
info->n_children = data_s.Read8();
|
||||
info->n_children = data_s.Read32();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -261,6 +281,14 @@ void wxObjectInputStream::ProcessObjectData(wxObjectStreamInfo *info)
|
||||
ProcessObjectData((wxObjectStreamInfo *)node->Data());
|
||||
node = node->Next();
|
||||
}
|
||||
|
||||
m_current_info = info;
|
||||
|
||||
if (info->recall) {
|
||||
m_secondcall = TRUE;
|
||||
info->object->LoadObject(*this);
|
||||
m_secondcall = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
wxObject *wxObjectInputStream::LoadObject()
|
||||
|
@ -46,6 +46,7 @@ IMPLEMENT_SERIAL_CLASS(wxRadioBox, wxControl)
|
||||
IMPLEMENT_SERIAL_CLASS(wxRadioButton, wxControl)
|
||||
IMPLEMENT_SERIAL_CLASS(wxButton, wxControl)
|
||||
IMPLEMENT_SERIAL_CLASS(wxStaticText, wxControl)
|
||||
IMPLEMENT_SERIAL_CLASS(wxStaticBox, wxControl)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@ -244,40 +245,45 @@ void WXSERIAL(wxNotebook)::StoreObject(wxObjectOutputStream& s)
|
||||
wxImageList *imaglist = notebook->GetImageList();
|
||||
int i, pcount = notebook->GetPageCount();
|
||||
|
||||
WXSERIAL(wxControl)::StoreObject(s);
|
||||
if (s.FirstStage()) {
|
||||
s.AddChild(imaglist);
|
||||
WXSERIAL(wxControl)::StoreObject(s);
|
||||
return;
|
||||
}
|
||||
|
||||
wxDataOutputStream data_s(s);
|
||||
|
||||
data_s.Write8( pcount );
|
||||
WXSERIAL(wxControl)::StoreObject(s);
|
||||
|
||||
for (i=0;i<pcount;i++)
|
||||
data_s.WriteString( notebook->GetPageText(i) );
|
||||
|
||||
}
|
||||
|
||||
void WXSERIAL(wxNotebook)::LoadObject(wxObjectInputStream& s)
|
||||
{
|
||||
wxNotebook *notebook = (wxNotebook *)Object();
|
||||
int i, pcount;
|
||||
int i;
|
||||
wxImageList *imaglist;
|
||||
|
||||
imaglist = (wxImageList *)s.GetChild();
|
||||
if (s.SecondCall()) {
|
||||
for (i=0;i<m_pcount;i++)
|
||||
notebook->AddPage( (wxWindow *)s.GetChild(), m_stringlist[i] );
|
||||
return;
|
||||
}
|
||||
|
||||
WXSERIAL(wxControl)::LoadObject(s);
|
||||
|
||||
imaglist = (wxImageList *)s.GetChild();
|
||||
|
||||
notebook->Create(m_parent, m_id, wxPoint(m_x, m_y), wxSize(m_w, m_h),
|
||||
m_style, m_name);
|
||||
|
||||
wxDataInputStream data_s(s);
|
||||
|
||||
pcount = data_s.Read8();
|
||||
for (i=0;i<pcount;i++)
|
||||
notebook->SetPageText(i, data_s.ReadString() );
|
||||
m_pcount = data_s.Read8();
|
||||
for (i=0;i<m_pcount;i++)
|
||||
m_stringlist.Add(data_s.ReadString());
|
||||
s.Recall();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -27,10 +27,21 @@ DECLARE_SERIAL_CLASS(wxChoice, wxControl)
|
||||
DECLARE_SERIAL_CLASS(wxComboBox, wxControl)
|
||||
DECLARE_SERIAL_CLASS(wxGauge, wxControl)
|
||||
DECLARE_SERIAL_CLASS(wxListBox, wxControl)
|
||||
DECLARE_SERIAL_CLASS(wxNotebook, wxControl)
|
||||
DECLARE_SERIAL_CLASS(wxRadioBox, wxControl)
|
||||
DECLARE_SERIAL_CLASS(wxRadioButton, wxControl)
|
||||
DECLARE_SERIAL_CLASS(wxStaticText, wxControl)
|
||||
DECLARE_SERIAL_CLASS(wxStaticBox, wxControl)
|
||||
|
||||
|
||||
class WXSERIAL(wxNotebook) : public WXSERIAL(wxControl) {
|
||||
DECLARE_DYNAMIC_CLASS( wxNotebook_Serialize )
|
||||
public:
|
||||
void StoreObject(wxObjectOutputStream& s);
|
||||
void LoadObject(wxObjectInputStream& s);
|
||||
|
||||
protected:
|
||||
int m_pcount;
|
||||
wxArrayString m_stringlist;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -21,10 +21,15 @@
|
||||
#include <wx/brush.h>
|
||||
#include <wx/serbase.h>
|
||||
#include <wx/imaglist.h>
|
||||
#include <wx/region.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/palette.h>
|
||||
#include <wx/dcmemory.h>
|
||||
#include "sergdi.h"
|
||||
|
||||
IMPLEMENT_SERIAL_CLASS(wxBitmap, wxObject)
|
||||
IMPLEMENT_SERIAL_CLASS(wxGDIObject, wxObject)
|
||||
IMPLEMENT_SERIAL_CLASS(wxRegion, wxGDIObject)
|
||||
IMPLEMENT_SERIAL_CLASS(wxColour, wxGDIObject)
|
||||
IMPLEMENT_SERIAL_CLASS(wxFont, wxGDIObject)
|
||||
IMPLEMENT_SERIAL_CLASS(wxPen, wxGDIObject)
|
||||
@ -37,16 +42,69 @@ IMPLEMENT_ALIAS_SERIAL_CLASS(wxFontList, wxList)
|
||||
IMPLEMENT_ALIAS_SERIAL_CLASS(wxColourDatabase, wxList)
|
||||
IMPLEMENT_ALIAS_SERIAL_CLASS(wxBitmapList, wxList)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void WXSERIAL(wxBitmap)::StoreObject(wxObjectOutputStream& s)
|
||||
{
|
||||
// TODO
|
||||
// I implemented a basic image saving (maybe I'll need to improve wxWin API).
|
||||
|
||||
int x, y, w, h;
|
||||
wxDataOutputStream data_s(s);
|
||||
wxBitmap *bitmap = (wxBitmap *)Object();
|
||||
wxColour col;
|
||||
wxMemoryDC dc;
|
||||
|
||||
w = bitmap->GetWidth();
|
||||
h = bitmap->GetHeight();
|
||||
|
||||
if (s.FirstStage()) {
|
||||
s.AddChild(bitmap->GetMask());
|
||||
}
|
||||
|
||||
dc.SelectObject(*bitmap);
|
||||
|
||||
data_s.Write16(w);
|
||||
data_s.Write16(h);
|
||||
for (y=0;y<h;y++)
|
||||
for (x=0;x<w;x++) {
|
||||
dc.GetPixel(x, y, &col);
|
||||
data_s.Write8( col.Red() );
|
||||
data_s.Write8( col.Green() );
|
||||
data_s.Write8( col.Blue() );
|
||||
}
|
||||
}
|
||||
|
||||
void WXSERIAL(wxBitmap)::LoadObject(wxObjectInputStream& s)
|
||||
{
|
||||
// TODO
|
||||
// I implemented a basic image loading (maybe I'll need to improve wxWin API).
|
||||
wxDataInputStream data_s(s);
|
||||
wxBitmap *bitmap = (wxBitmap *)Object();
|
||||
wxMemoryDC dc;
|
||||
wxPen pen;
|
||||
int x, y, w, h;
|
||||
int r, g, b;
|
||||
|
||||
w = data_s.Read16();
|
||||
h = data_s.Read16();
|
||||
|
||||
bitmap->Resize(w, h);
|
||||
dc.SelectObject(*bitmap);
|
||||
|
||||
for (y=0;y<h;y++)
|
||||
for (x=0;x<w;x++) {
|
||||
r = data_s.Read8();
|
||||
g = data_s.Read8();
|
||||
b = data_s.Read8();
|
||||
pen.SetColour(r, g, b);
|
||||
dc.SetPen(pen);
|
||||
dc.DrawPoint(x,y);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void WXSERIAL(wxGDIObject)::StoreObject(wxObjectOutputStream& s)
|
||||
{
|
||||
if (s.FirstStage())
|
||||
@ -65,6 +123,42 @@ void WXSERIAL(wxGDIObject)::LoadObject(wxObjectInputStream& s)
|
||||
((wxGDIObject *)Object())->SetVisible( data_s.Read8() );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void WXSERIAL(wxRegion)::StoreObject(wxObjectOutputStream& s)
|
||||
{
|
||||
WXSERIAL(wxGDIObject)::StoreObject(s);
|
||||
|
||||
if (s.FirstStage())
|
||||
return;
|
||||
|
||||
wxDataOutputStream data_s(s);
|
||||
wxRect rect = ((wxRegion *)Object())->GetBox();
|
||||
|
||||
data_s.Write16( rect.GetX() );
|
||||
data_s.Write16( rect.GetY() );
|
||||
data_s.Write16( rect.GetWidth() );
|
||||
data_s.Write16( rect.GetHeight() );
|
||||
}
|
||||
|
||||
void WXSERIAL(wxRegion)::LoadObject(wxObjectInputStream& s)
|
||||
{
|
||||
WXSERIAL(wxGDIObject)::LoadObject(s);
|
||||
|
||||
wxDataInputStream data_s(s);
|
||||
wxRegion *region = (wxRegion *)Object();
|
||||
wxRect rect;
|
||||
|
||||
rect.SetX( data_s.Read16() );
|
||||
rect.SetY( data_s.Read16() );
|
||||
rect.SetWidth( data_s.Read16() );
|
||||
rect.SetHeight( data_s.Read16() );
|
||||
|
||||
*region = wxRegion(rect);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void WXSERIAL(wxColour)::StoreObject(wxObjectOutputStream& s)
|
||||
{
|
||||
WXSERIAL(wxGDIObject)::StoreObject(s);
|
||||
@ -95,6 +189,8 @@ void WXSERIAL(wxColour)::LoadObject(wxObjectInputStream& s)
|
||||
colour->Set(r, g, b);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void WXSERIAL(wxPen)::StoreObject(wxObjectOutputStream& s)
|
||||
{
|
||||
wxPen *pen = (wxPen *)Object();
|
||||
@ -129,6 +225,7 @@ void WXSERIAL(wxPen)::LoadObject(wxObjectInputStream& s)
|
||||
pen->SetWidth( data_s.Read8() );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void WXSERIAL(wxBrush)::StoreObject(wxObjectOutputStream& s)
|
||||
{
|
||||
wxBrush *brush = (wxBrush *)Object();
|
||||
@ -159,6 +256,7 @@ void WXSERIAL(wxBrush)::LoadObject(wxObjectInputStream& s)
|
||||
*brush = wxBrush(bmap);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void WXSERIAL(wxFont)::StoreObject(wxObjectOutputStream& s)
|
||||
{
|
||||
wxFont *font = (wxFont *)Object();
|
||||
@ -199,6 +297,8 @@ void WXSERIAL(wxFont)::LoadObject(wxObjectInputStream& s)
|
||||
*font = wxFont(psize, face_name, family, style, weight, underlined);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void WXSERIAL(wxImageList)::StoreObject(wxObjectOutputStream& s)
|
||||
{
|
||||
wxImageList *list = (wxImageList *)Object();
|
||||
|
@ -21,16 +21,13 @@
|
||||
|
||||
DECLARE_SERIAL_CLASS(wxBitmap, wxObject)
|
||||
DECLARE_SERIAL_CLASS(wxGDIObject, wxObject)
|
||||
DECLARE_SERIAL_CLASS(wxRegion, wxGDIObject)
|
||||
DECLARE_SERIAL_CLASS(wxColour, wxGDIObject)
|
||||
DECLARE_SERIAL_CLASS(wxFont, wxGDIObject)
|
||||
DECLARE_SERIAL_CLASS(wxPen, wxGDIObject)
|
||||
DECLARE_SERIAL_CLASS(wxBrush, wxGDIObject)
|
||||
DECLARE_SERIAL_CLASS(wxImageList, wxObject)
|
||||
|
||||
//DECLARE_SERIAL_CLASS(wxSize, wxObject)
|
||||
//DECLARE_SERIAL_CLASS(wxRealPoint, wxObject)
|
||||
//DECLARE_SERIAL_CLASS(wxRect, wxObject)
|
||||
|
||||
DECLARE_ALIAS_SERIAL_CLASS(wxPenList, wxList)
|
||||
DECLARE_ALIAS_SERIAL_CLASS(wxBrushList, wxList)
|
||||
DECLARE_ALIAS_SERIAL_CLASS(wxFontList, wxList)
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "serwnd.h"
|
||||
#include "sergdi.h"
|
||||
#include "serctrl.h"
|
||||
#include "serext.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxObject_Serialize, wxObject)
|
||||
|
||||
@ -41,9 +42,13 @@ WXDLL_ENTRY_FUNCTION()
|
||||
REGISTER_CLASS(wxMenu);
|
||||
REGISTER_CLASS(wxMenuItem);
|
||||
REGISTER_CLASS(wxMenuBar);
|
||||
REGISTER_CLASS(wxMDIParentFrame);
|
||||
REGISTER_CLASS(wxMDIChildFrame);
|
||||
REGISTER_CLASS(wxMDIClientWindow);
|
||||
|
||||
REGISTER_CLASS(wxGDIObject);
|
||||
REGISTER_CLASS(wxBitmap);
|
||||
REGISTER_CLASS(wxRegion);
|
||||
REGISTER_CLASS(wxColour);
|
||||
REGISTER_CLASS(wxFont);
|
||||
REGISTER_CLASS(wxPen);
|
||||
@ -54,6 +59,7 @@ WXDLL_ENTRY_FUNCTION()
|
||||
REGISTER_CLASS(wxFontList);
|
||||
REGISTER_CLASS(wxColourDatabase);
|
||||
REGISTER_CLASS(wxBitmapList);
|
||||
REGISTER_CLASS(wxImageList);
|
||||
|
||||
REGISTER_CLASS(wxControl);
|
||||
REGISTER_CLASS(wxSlider);
|
||||
@ -63,10 +69,15 @@ WXDLL_ENTRY_FUNCTION()
|
||||
REGISTER_CLASS(wxListBox);
|
||||
REGISTER_CLASS(wxButton);
|
||||
REGISTER_CLASS(wxStaticText);
|
||||
REGISTER_CLASS(wxStaticBox);
|
||||
REGISTER_CLASS(wxRadioBox);
|
||||
REGISTER_CLASS(wxComboBox);
|
||||
REGISTER_CLASS(wxNotebook);
|
||||
|
||||
REGISTER_CLASS(wxSplitterWindow);
|
||||
REGISTER_CLASS(wxGrid);
|
||||
REGISTER_CLASS(wxGridCell);
|
||||
|
||||
return lib;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <wx/serbase.h>
|
||||
#include <wx/statusbr.h>
|
||||
#include <wx/mdi.h>
|
||||
#include "wx/log.h"
|
||||
#include "serwnd.h"
|
||||
|
||||
|
||||
@ -49,9 +50,10 @@ IMPLEMENT_SERIAL_CLASS(wxMDIClientWindow, wxWindow)
|
||||
void WXSERIAL(wxWindow)::StoreObject(wxObjectOutputStream& s)
|
||||
{
|
||||
wxWindow *win_object = (wxWindow *)Object();
|
||||
wxNode *node = win_object->GetChildren()->First();
|
||||
|
||||
if (s.FirstStage()) {
|
||||
wxNode *node = win_object->GetChildren()->First();
|
||||
|
||||
s.AddChild(win_object->GetConstraints());
|
||||
s.AddChild(win_object->GetValidator());
|
||||
|
||||
@ -71,14 +73,16 @@ void WXSERIAL(wxWindow)::StoreObject(wxObjectOutputStream& s)
|
||||
wxDataOutputStream data(s);
|
||||
int x,y,w,h;
|
||||
|
||||
data.WriteString(win_object->GetName());
|
||||
data.WriteString(win_object->GetLabel());
|
||||
data.WriteString(win_object->GetTitle());
|
||||
data.WriteString( win_object->GetName() );
|
||||
data.WriteString( win_object->GetLabel() );
|
||||
data.WriteString( win_object->GetTitle() );
|
||||
|
||||
data.Write8(win_object->GetAutoLayout());
|
||||
data.Write8(win_object->IsShown());
|
||||
data.Write8( win_object->GetAutoLayout() );
|
||||
data.Write8( win_object->IsShown() );
|
||||
data.Write32( win_object->GetWindowStyleFlag() );
|
||||
data.Write32(win_object->GetId());
|
||||
data.Write32( win_object->GetId() );
|
||||
wxLogDebug( "Number = %d", win_object->GetChildren()->Number() );
|
||||
data.Write8( win_object->GetChildren()->Number() );
|
||||
|
||||
win_object->GetSize(&w, &h);
|
||||
win_object->GetPosition(&x, &y);
|
||||
@ -92,6 +96,9 @@ void WXSERIAL(wxWindow)::LoadObject(wxObjectInputStream& s)
|
||||
{
|
||||
wxDataInputStream data_s(s);
|
||||
wxWindow *win_object = (wxWindow *)Object();
|
||||
wxColour *colour;
|
||||
wxFont *font;
|
||||
int number;
|
||||
|
||||
m_parent = (wxWindow *)s.GetParent();
|
||||
|
||||
@ -103,6 +110,7 @@ void WXSERIAL(wxWindow)::LoadObject(wxObjectInputStream& s)
|
||||
m_shown = data_s.Read8();
|
||||
m_style = data_s.Read32();
|
||||
m_id = data_s.Read32();
|
||||
number = data_s.Read8();
|
||||
|
||||
m_x = data_s.Read16();
|
||||
m_y = data_s.Read16();
|
||||
@ -110,11 +118,23 @@ void WXSERIAL(wxWindow)::LoadObject(wxObjectInputStream& s)
|
||||
m_h = data_s.Read16();
|
||||
|
||||
/* I assume we will never create raw wxWindow object */
|
||||
(void)s.GetChild(); // We pass wxLayoutConstraints.
|
||||
|
||||
m_validator = (wxValidator *)s.GetChild();
|
||||
win_object->SetDefaultBackgroundColour(*((wxColour *)s.GetChild()));
|
||||
win_object->SetDefaultForegroundColour(*((wxColour *)s.GetChild()));
|
||||
win_object->SetFont(*((wxFont *)s.GetChild()));
|
||||
if (!m_validator)
|
||||
m_validator = (wxValidator *)&wxDefaultValidator;
|
||||
|
||||
colour = (wxColour *)s.GetChild();
|
||||
if (colour)
|
||||
win_object->SetDefaultBackgroundColour(*colour);
|
||||
colour = (wxColour *)s.GetChild();
|
||||
if (colour)
|
||||
win_object->SetDefaultForegroundColour(*colour);
|
||||
font = (wxFont *)s.GetChild();
|
||||
if (font)
|
||||
win_object->SetFont(*font);
|
||||
|
||||
s.RemoveChildren(number);
|
||||
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user