From 8d43638db10823193952af62215f4c9e900f312a Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Wed, 19 Aug 1998 18:33:19 +0000 Subject: [PATCH] * Some new feature in wxObject*Stream (objects aren't duplicated) * Added SetBackgroundBrush in wxGridCell * New classes/fixes in wxSerial git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@611 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/gridg.h | 1 + include/wx/objstrm.h | 3 ++ src/common/objstrm.cpp | 40 +++++++++++++++------- utils/serialize/sercore.cpp | 43 +++++++++++++++++++++-- utils/serialize/sercore.h | 3 +- utils/serialize/serctrl.cpp | 63 ++++++++++++++++++++++++++++++++-- utils/serialize/serctrl.h | 2 ++ utils/serialize/serext.cpp | 68 ++++++++++++++++++++++++++++++++++++- utils/serialize/serext.h | 2 ++ utils/serialize/sergdi.cpp | 12 +++---- utils/serialize/sermain.cpp | 5 +-- utils/serialize/serwnd.cpp | 61 ++++++++++++++++++++++++++------- utils/serialize/serwnd.h | 2 ++ 13 files changed, 262 insertions(+), 43 deletions(-) diff --git a/include/wx/generic/gridg.h b/include/wx/generic/gridg.h index 50795a2115..ae1724ad7e 100644 --- a/include/wx/generic/gridg.h +++ b/include/wx/generic/gridg.h @@ -302,6 +302,7 @@ class WXDLLEXPORT wxGridCell: public wxObject inline wxColour& GetBackgroundColour(void) { return backgroundColour; } void SetBackgroundColour(const wxColour& colour); inline wxBrush *GetBackgroundBrush(void) { return backgroundBrush; } + inline void SetBackgroundBrush(wxBrush *brush) { backgroundBrush = brush; } inline int GetAlignment(void) { return alignment; } inline void SetAlignment(int align) { alignment = align; } inline wxBitmap *GetCellBitmap(void) { return cellBitmap; } diff --git a/include/wx/objstrm.h b/include/wx/objstrm.h index fbe79e4503..9f419e38ec 100644 --- a/include/wx/objstrm.h +++ b/include/wx/objstrm.h @@ -27,6 +27,7 @@ class wxObjectStreamInfo : public wxObject { wxList children; wxObjectStreamInfo *parent; wxObject *object; + bool duplicate; }; class wxObjectOutputStream : public wxFilterOutputStream { @@ -49,6 +50,7 @@ class wxObjectOutputStream : public wxFilterOutputStream { int m_stage; bool m_saving; wxObjectStreamInfo *m_current_info; + wxList m_saved_objs; }; class wxObjectInputStream : public wxFilterInputStream { @@ -56,6 +58,7 @@ class wxObjectInputStream : public wxFilterInputStream { wxObjectInputStream(wxInputStream& s); wxObject *GetChild(int no) const; + wxObject *GetChild(); int NumberOfChildren() const { return m_current_info->n_children; } void RemoveChildren(int nb); wxObject *GetParent() const; diff --git a/src/common/objstrm.cpp b/src/common/objstrm.cpp index dda2e77591..0b7fa3503b 100644 --- a/src/common/objstrm.cpp +++ b/src/common/objstrm.cpp @@ -20,6 +20,7 @@ #define WXOBJ_BEG_LEN 6 #define TAG_EMPTY_OBJECT "NULL" +#define TAG_DUPLICATE_OBJECT "DUPLIC" // ---------------------------------------------------------------------------- // wxObjectOutputStream @@ -45,6 +46,12 @@ void wxObjectOutputStream::WriteObjectDef(wxObjectStreamInfo& info) Write(WXOBJ_BEGIN, WXOBJ_BEG_LEN); + if (info.duplicate) { + data_s.WriteString(TAG_DUPLICATE_OBJECT); + data_s.WriteString(GetObjectName(info.object)); + return; + } + if (info.object) { data_s.WriteString(info.object->GetClassInfo()->GetClassName()); } else { @@ -54,7 +61,8 @@ void wxObjectOutputStream::WriteObjectDef(wxObjectStreamInfo& info) data_s.WriteString(GetObjectName(info.object)); // I assume an object will not have millions of children - data_s.Write8(info.children.Number()); + // Hmmm ... it could have (for example wxGrid) + data_s.Write32(info.children.Number()); } void wxObjectOutputStream::AddChild(wxObject *obj) @@ -65,6 +73,13 @@ void wxObjectOutputStream::AddChild(wxObject *obj) return; info = new wxObjectStreamInfo; + + if (m_saved_objs.Member(obj) != NULL) { + info->duplicate = TRUE; + } else { + info->duplicate = FALSE; + m_saved_objs.Append(obj); + } info->n_children = 0; info->object = obj; info->parent = m_current_info; // Not useful here. @@ -78,7 +93,7 @@ void wxObjectOutputStream::ProcessObjectDef(wxObjectStreamInfo *info) m_current_info = info; // First stage: get children of obj - if (info->object) + if (info->object && !info->duplicate) info->object->StoreObject(*this); // Prepare and write the sub-entry about the child obj. @@ -98,7 +113,7 @@ void wxObjectOutputStream::ProcessObjectData(wxObjectStreamInfo *info) m_current_info = info; - if (info->object) + if (info->object && !info->duplicate) info->object->StoreObject(*this); while (node) { @@ -126,6 +141,7 @@ bool wxObjectOutputStream::SaveObject(wxObject& obj) ProcessObjectData(&info); info.children.Clear(); + m_saved_objs.Clear(); m_saving = FALSE; @@ -194,17 +210,18 @@ bool wxObjectInputStream::ReadObjectDef(wxObjectStreamInfo *info) return FALSE; class_name = data_s.ReadString(); - printf("class_name = %s\n", WXSTRINGCAST class_name); - if (class_name == TAG_EMPTY_OBJECT) - info->object = NULL; - else - info->object = wxCreateDynamicObject( WXSTRINGCAST class_name); info->object_name = data_s.ReadString(); - printf("object_name = %s\n", WXSTRINGCAST info->object_name); - info->n_children = data_s.Read8(); info->children_removed = 0; - printf("n_children = %d\n", info->n_children); + if (class_name == TAG_EMPTY_OBJECT) + info->object = NULL; + else if (class_name == TAG_DUPLICATE_OBJECT) { + info->object = SolveName(info->object_name); + info->n_children = 0; + } else { + info->object = wxCreateDynamicObject( WXSTRINGCAST class_name); + info->n_children = data_s.Read8(); + } return TRUE; } @@ -235,7 +252,6 @@ wxObjectStreamInfo *wxObjectInputStream::ProcessObjectDef(wxObjectStreamInfo *pa void wxObjectInputStream::ProcessObjectData(wxObjectStreamInfo *info) { wxNode *node = info->children.First(); - wxObjectStreamInfo *c_info; m_current_info = info; diff --git a/utils/serialize/sercore.cpp b/utils/serialize/sercore.cpp index 8c83acbe02..0fffba7f5b 100644 --- a/utils/serialize/sercore.cpp +++ b/utils/serialize/sercore.cpp @@ -14,9 +14,12 @@ #endif #include #include +#include +#include #include "sercore.h" -IMPLEMENT_SERIAL_CLASS(wxList,wxObject) +IMPLEMENT_SERIAL_CLASS(wxList, wxObject) +IMPLEMENT_SERIAL_CLASS(wxHashTable, wxObject) void WXSERIAL(wxList)::StoreObject(wxObjectOutputStream& s) { @@ -62,9 +65,43 @@ void WXSERIAL(wxList)::LoadObject(wxObjectInputStream& s) if (list->key_type == wxKEY_INTEGER) { for (i=0;iAppend( data_s.Read32(), s.GetChild(i) ); + list->Append( data_s.Read32(), s.GetChild() ); } else { for (i=0;iAppend( data_s.ReadString(), s.GetChild(i) ); + list->Append( data_s.ReadString(), s.GetChild() ); } } + +// ---------------------------------------------------------------------------- + +void WXSERIAL(wxHashTable)::StoreObject(wxObjectOutputStream& s) +{ + wxHashTable *table = (wxHashTable *)Object(); + int i; + + if (s.FirstStage()) { + for (i=0;in;i++) + s.AddChild(table->hash_table[i]); + return; + } + + wxDataOutputStream data_s(s); + + data_s.Write8(table->key_type); + data_s.Write32(table->n); +} + +void WXSERIAL(wxHashTable)::LoadObject(wxObjectInputStream& s) +{ + wxHashTable *table = (wxHashTable *)Object(); + wxDataInputStream data_s(s); + int i, key, n; + + key = data_s.Read8(); + n = data_s.Read32(); + + table->Create(key, n); + + for (i=0;ihash_table[i] = (wxList *)s.GetChild(); +} diff --git a/utils/serialize/sercore.h b/utils/serialize/sercore.h index 676c04a449..57651eab6d 100644 --- a/utils/serialize/sercore.h +++ b/utils/serialize/sercore.h @@ -18,6 +18,7 @@ #include -DECLARE_SERIAL_CLASS(wxList,wxObject) +DECLARE_SERIAL_CLASS(wxList, wxObject) +DECLARE_SERIAL_CLASS(wxHashTable, wxObject) #endif diff --git a/utils/serialize/serctrl.cpp b/utils/serialize/serctrl.cpp index 7bd86d8f6d..982dbc5440 100644 --- a/utils/serialize/serctrl.cpp +++ b/utils/serialize/serctrl.cpp @@ -23,7 +23,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -41,10 +43,12 @@ IMPLEMENT_SERIAL_CLASS(wxGauge, wxControl) IMPLEMENT_SERIAL_CLASS(wxListBox, wxControl) IMPLEMENT_SERIAL_CLASS(wxNotebook, wxControl) IMPLEMENT_SERIAL_CLASS(wxRadioBox, wxControl) - +IMPLEMENT_SERIAL_CLASS(wxRadioButton, wxControl) IMPLEMENT_SERIAL_CLASS(wxButton, wxControl) IMPLEMENT_SERIAL_CLASS(wxStaticText, wxControl) +//----------------------------------------------------------------------------- + void WXSERIAL(wxButton)::StoreObject(wxObjectOutputStream& s) { WXSERIAL(wxControl)::StoreObject(s); @@ -61,6 +65,8 @@ void WXSERIAL(wxButton)::LoadObject(wxObjectInputStream& s) m_style, *m_validator, m_name); } +//----------------------------------------------------------------------------- + void WXSERIAL(wxCheckBox)::StoreObject(wxObjectOutputStream& s) { WXSERIAL(wxControl)::StoreObject(s); @@ -85,6 +91,8 @@ void WXSERIAL(wxCheckBox)::LoadObject(wxObjectInputStream& s) chkbox->SetValue(data_s.Read8()); } +//----------------------------------------------------------------------------- + void WXSERIAL(wxSlider)::StoreObject(wxObjectOutputStream& s) { WXSERIAL(wxControl)::StoreObject(s); @@ -130,6 +138,8 @@ void WXSERIAL(wxSlider)::LoadObject(wxObjectInputStream& s) slider->SetThumbLength( data_s.Read32() ); } +//----------------------------------------------------------------------------- + void WXSERIAL(wxGauge)::StoreObject(wxObjectOutputStream& s) { WXSERIAL(wxControl)::StoreObject(s); @@ -163,6 +173,8 @@ void WXSERIAL(wxGauge)::LoadObject(wxObjectInputStream& s) gauge->SetValue( data_s.Read32() ); } +//----------------------------------------------------------------------------- + void WXSERIAL(wxChoice)::StoreObject(wxObjectOutputStream& s) { WXSERIAL(wxControl)::StoreObject(s); @@ -194,6 +206,8 @@ void WXSERIAL(wxChoice)::LoadObject(wxObjectInputStream& s) choice->Append( data_s.ReadString() ); } +//----------------------------------------------------------------------------- + void WXSERIAL(wxListBox)::StoreObject(wxObjectOutputStream& s) { WXSERIAL(wxControl)::StoreObject(s); @@ -222,6 +236,8 @@ void WXSERIAL(wxListBox)::LoadObject(wxObjectInputStream& s) listbox->Append( data_s.ReadString() ); } +//----------------------------------------------------------------------------- + void WXSERIAL(wxNotebook)::StoreObject(wxObjectOutputStream& s) { wxNotebook *notebook = (wxNotebook *)Object(); @@ -250,8 +266,7 @@ void WXSERIAL(wxNotebook)::LoadObject(wxObjectInputStream& s) int i, pcount; wxImageList *imaglist; - imaglist = (wxImageList *)s.GetChild(0); - s.RemoveChildren(1); + imaglist = (wxImageList *)s.GetChild(); WXSERIAL(wxControl)::LoadObject(s); @@ -265,6 +280,8 @@ void WXSERIAL(wxNotebook)::LoadObject(wxObjectInputStream& s) notebook->SetPageText(i, data_s.ReadString() ); } +//----------------------------------------------------------------------------- + void WXSERIAL(wxRadioBox)::StoreObject(wxObjectOutputStream& s) { wxRadioBox *box = (wxRadioBox *)Object(); @@ -304,6 +321,29 @@ void WXSERIAL(wxRadioBox)::LoadObject(wxObjectInputStream& s) n_items, items, 0, m_style, *m_validator, m_name); } +//----------------------------------------------------------------------------- + +void WXSERIAL(wxRadioButton)::StoreObject(wxObjectOutputStream& s) +{ + WXSERIAL(wxControl)::StoreObject(s); + + if (s.FirstStage()) + return; + + wxDataOutputStream data_s(s); + data_s.Write8( (char) ((wxRadioButton *)Object())->GetValue() ); +} + +void WXSERIAL(wxRadioButton)::LoadObject(wxObjectInputStream& s) +{ + wxDataInputStream data_s(s); + + WXSERIAL(wxControl)::LoadObject(s); + ((wxRadioButton *)Object())->SetValue( (bool)data_s.Read8() ); +} + +//----------------------------------------------------------------------------- + void WXSERIAL(wxComboBox)::StoreObject(wxObjectOutputStream& s) { WXSERIAL(wxControl)::StoreObject(s); @@ -346,6 +386,8 @@ void WXSERIAL(wxComboBox)::LoadObject(wxObjectInputStream& s) box->SetValue( data_s.ReadString() ); } +//----------------------------------------------------------------------------- + void WXSERIAL(wxStaticText)::StoreObject(wxObjectOutputStream& s) { WXSERIAL(wxControl)::StoreObject(s); @@ -358,3 +400,18 @@ void WXSERIAL(wxStaticText)::LoadObject(wxObjectInputStream& s) ((wxStaticText *)Object())->Create(m_parent, m_id, m_label, wxPoint(m_x, m_y), wxSize(m_w, m_h), m_style, m_name); } + +//----------------------------------------------------------------------------- + +void WXSERIAL(wxStaticBox)::StoreObject(wxObjectOutputStream& s) +{ + WXSERIAL(wxControl)::StoreObject(s); +} + +void WXSERIAL(wxStaticBox)::LoadObject(wxObjectInputStream& s) +{ + WXSERIAL(wxControl)::LoadObject(s); + + ((wxStaticBox *)Object())->Create(m_parent, m_id, m_label, wxPoint(m_x, m_y), + wxSize(m_w, m_h), m_style, m_name); +} diff --git a/utils/serialize/serctrl.h b/utils/serialize/serctrl.h index d2eeb82449..a3b3ffc279 100644 --- a/utils/serialize/serctrl.h +++ b/utils/serialize/serctrl.h @@ -29,6 +29,8 @@ 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) #endif diff --git a/utils/serialize/serext.cpp b/utils/serialize/serext.cpp index da6d92785a..aaddb4066a 100644 --- a/utils/serialize/serext.cpp +++ b/utils/serialize/serext.cpp @@ -13,12 +13,16 @@ #pragma implementation "serext.h" #endif +#include "serext.h" +#include #include +#include #include #include -#include "serext.h" IMPLEMENT_SERIAL_CLASS(wxSplitterWindow, wxWindow) +IMPLEMENT_SERIAL_CLASS(wxGridCell, wxObject) +IMPLEMENT_SERIAL_CLASS(wxGrid, wxPanel) void WXSERIAL(wxSplitterWindow)::StoreObject(wxObjectOutputStream& s) { @@ -69,3 +73,65 @@ void WXSERIAL(wxSplitterWindow)::LoadObject(wxObjectInputStream& s) splitter->SetBorderSize(border_size); splitter->SetMinimumPaneSize(min_pane_size); } + +void WXSERIAL(wxGridCell)::StoreObject(wxObjectOutputStream& s) +{ + wxGridCell *cell = (wxGridCell *)Object(); + wxDataOutputStream data_s(s); + + if (s.FirstStage()) { + s.AddChild( cell->GetFont() ); + s.AddChild( cell->GetBackgroundBrush() ); + s.AddChild( cell->GetCellBitmap() ); + s.AddChild( &(cell->GetTextColour()) ); + s.AddChild( &(cell->GetBackgroundColour()) ); + return; + } + + data_s.WriteString( cell->GetTextValue() ); + data_s.Write16( cell->GetAlignment() ); +} + +void WXSERIAL(wxGridCell)::LoadObject(wxObjectInputStream& s) +{ + wxGridCell *cell = (wxGridCell *)Object(); + wxDataInputStream data_s(s); + + cell->SetTextValue( data_s.ReadString() ); + cell->SetAlignment( data_s.Read16() ); + cell->SetFont( (wxFont *)s.GetChild() ); + cell->SetBackgroundBrush( (wxBrush *)s.GetChild() ); + cell->SetCellBitmap( (wxBitmap *)s.GetChild() ); + cell->SetTextColour( *((wxColour *)s.GetChild()) ); + cell->SetBackgroundColour( *((wxColour *)s.GetChild()) ); +} + +void WXSERIAL(wxGrid)::StoreObject(wxObjectOutputStream& s) +{ + wxDataOutputStream data_s(s); + wxGrid *grid = (wxGrid *)Object(); + int n_rows = grid->GetRows(), n_cols = grid->GetCols(); + int r, c; + + if (s.FirstStage()) { + for (r=0;rGetCell(r, c) ); + + s.AddChild( grid->GetDividerPen() ); + WXSERIAL(wxPanel)::StoreObject(s); + return; + } + + data_s.Write16( n_rows ); + data_s.Write16( n_cols ); + data_s.Write16( grid->GetCursorRow() ); + data_s.Write16( grid->GetCursorColumn() ); + + WXSERIAL(wxPanel)::StoreObject(s); +} + +void WXSERIAL(wxGrid)::LoadObject(wxObjectInputStream& s) +{ + WXSERIAL(wxPanel)::LoadObject(s); +} diff --git a/utils/serialize/serext.h b/utils/serialize/serext.h index 5856e50edd..540bb998b5 100644 --- a/utils/serialize/serext.h +++ b/utils/serialize/serext.h @@ -20,5 +20,7 @@ #include "serwnd.h" DECLARE_SERIAL_CLASS(wxSplitterWindow, wxWindow) +DECLARE_SERIAL_CLASS(wxGrid, wxPanel) +DECLARE_SERIAL_CLASS(wxGridCell, wxObject) #endif diff --git a/utils/serialize/sergdi.cpp b/utils/serialize/sergdi.cpp index 85072dbaba..bedaddf300 100644 --- a/utils/serialize/sergdi.cpp +++ b/utils/serialize/sergdi.cpp @@ -116,9 +116,7 @@ void WXSERIAL(wxPen)::StoreObject(wxObjectOutputStream& s) void WXSERIAL(wxPen)::LoadObject(wxObjectInputStream& s) { wxPen *pen = (wxPen *)Object(); - wxColour *col = (wxColour *) s.GetChild(0); - - s.RemoveChildren(1); + wxColour *col = (wxColour *) s.GetChild(); WXSERIAL(wxGDIObject)::LoadObject(s); @@ -149,10 +147,8 @@ void WXSERIAL(wxBrush)::StoreObject(wxObjectOutputStream& s) void WXSERIAL(wxBrush)::LoadObject(wxObjectInputStream& s) { wxBrush *brush = (wxBrush *)Object(); - wxColour *col = (wxColour *)s.GetChild(0); - wxBitmap *bmap = (wxBitmap *)s.GetChild(1); - - s.RemoveChildren(2); + wxColour *col = (wxColour *)s.GetChild(); + wxBitmap *bmap = (wxBitmap *)s.GetChild(); WXSERIAL(wxGDIObject)::LoadObject(s); @@ -226,5 +222,5 @@ void WXSERIAL(wxImageList)::LoadObject(wxObjectInputStream& s) count = data_s.Read32(); for (i=0;iAdd(*((wxBitmap *)s.GetChild(i))); + list->Add(*((wxBitmap *)s.GetChild())); } diff --git a/utils/serialize/sermain.cpp b/utils/serialize/sermain.cpp index 95194106fc..4ef76703dd 100644 --- a/utils/serialize/sermain.cpp +++ b/utils/serialize/sermain.cpp @@ -36,8 +36,8 @@ WXDLL_ENTRY_FUNCTION() REGISTER_CLASS(wxIndividualLayoutConstraint); REGISTER_CLASS(wxLayoutConstraints); REGISTER_CLASS(wxFrame); -// REGISTER_CLASS(wxPanel); -// REGISTER_CLASS(wxDialog); + REGISTER_CLASS(wxPanel); + REGISTER_CLASS(wxDialog); REGISTER_CLASS(wxMenu); REGISTER_CLASS(wxMenuItem); REGISTER_CLASS(wxMenuBar); @@ -48,6 +48,7 @@ WXDLL_ENTRY_FUNCTION() REGISTER_CLASS(wxFont); REGISTER_CLASS(wxPen); REGISTER_CLASS(wxBrush); + REGISTER_CLASS(wxImageList); REGISTER_CLASS(wxPenList); REGISTER_CLASS(wxBrushList); REGISTER_CLASS(wxFontList); diff --git a/utils/serialize/serwnd.cpp b/utils/serialize/serwnd.cpp index 7c8fc6d161..1efa161336 100644 --- a/utils/serialize/serwnd.cpp +++ b/utils/serialize/serwnd.cpp @@ -40,6 +40,10 @@ IMPLEMENT_SERIAL_CLASS(wxMenuBar, wxWindow) IMPLEMENT_SERIAL_CLASS(wxMenuItem, wxObject) IMPLEMENT_SERIAL_CLASS(wxMenu, wxObject) +IMPLEMENT_SERIAL_CLASS(wxMDIParentFrame, wxFrame) +IMPLEMENT_SERIAL_CLASS(wxMDIChildFrame, wxFrame) +IMPLEMENT_SERIAL_CLASS(wxMDIClientWindow, wxWindow) + ///////////////////////////////////////////////////////////////////////////// void WXSERIAL(wxWindow)::StoreObject(wxObjectOutputStream& s) @@ -107,10 +111,10 @@ void WXSERIAL(wxWindow)::LoadObject(wxObjectInputStream& s) /* I assume we will never create raw wxWindow object */ - m_validator = (wxValidator *)s.GetChild(1); - win_object->SetDefaultBackgroundColour(*((wxColour *)s.GetChild(2))); - win_object->SetDefaultForegroundColour(*((wxColour *)s.GetChild(3))); - win_object->SetFont(*((wxFont *)s.GetChild(4))); + m_validator = (wxValidator *)s.GetChild(); + win_object->SetDefaultBackgroundColour(*((wxColour *)s.GetChild())); + win_object->SetDefaultForegroundColour(*((wxColour *)s.GetChild())); + win_object->SetFont(*((wxFont *)s.GetChild())); return; } @@ -219,6 +223,9 @@ void WXSERIAL(wxFrame)::StoreObject(wxObjectOutputStream& s) wxDataOutputStream data_s(s); wxStatusBar *statbar = frame->GetStatusBar(); + + // AAARGH !! I absolutely need to be able to modify internal fields of + // wxFrame (wxToolBar and wxStatusBar) if (statbar) data_s.Write8(statbar->GetFieldsCount()); @@ -231,9 +238,8 @@ void WXSERIAL(wxFrame)::StoreObject(wxObjectOutputStream& s) void WXSERIAL(wxFrame)::LoadObject(wxObjectInputStream& s) { wxFrame *frame = (wxFrame *)Object(); - wxMenuBar *mbar = (wxMenuBar *)s.GetChild(0); + wxMenuBar *mbar = (wxMenuBar *)s.GetChild(); - s.RemoveChildren(1); WXSERIAL(wxWindow)::LoadObject(s); wxDataInputStream data_s(s); @@ -275,7 +281,7 @@ void WXSERIAL(wxMenuBar)::LoadObject(wxObjectInputStream& s) mcount = data_s.Read8(); for (i=0;iAppend( menu, menu->GetTitle() ); } @@ -301,12 +307,12 @@ void WXSERIAL(wxMenu)::StoreObject(wxObjectOutputStream& s) void WXSERIAL(wxMenu)::LoadObject(wxObjectInputStream& s) { wxMenu *menu = (wxMenu *)Object(); - wxList *items = (wxList *)s.GetChild(0); + wxList *items = (wxList *)s.GetChild(); wxNode *node = items->First(); wxDataInputStream data_s(s); -// menu->SetTitle( data_s.ReadString() ); + menu->SetTitle( data_s.ReadString() ); while (node) { // NOT IMPLEMENTED in wxGTK @@ -345,7 +351,7 @@ void WXSERIAL(wxMenuItem)::LoadObject(wxObjectInputStream& s) item->SetCheckable( data_s.Read8() ); item->Enable( data_s.Read8() ); item->Check( data_s.Read8() ); - item->SetSubMenu( (wxMenu *)s.GetChild(0) ); + item->SetSubMenu( (wxMenu *)s.GetChild() ); } ///////////////////////////////////////////////////////////////////////////// @@ -398,12 +404,41 @@ void WXSERIAL(wxMDIParentFrame)::LoadObject(wxObjectInputStream& s) wxMDIParentFrame *frame = (wxMDIParentFrame *)Object(); wxMDIClientWindow *client; - client = (wxMDIClientWindow *) s.GetChild(0); - s.RemoveChildren(1); + client = (wxMDIClientWindow *) s.GetChild(); frame->Create(m_parent, m_id, m_title, wxPoint(m_x, m_y), wxSize(m_w, m_h), m_style, m_name); -// client->CreateClient(this, style_client); WXSERIAL(wxFrame)::LoadObject(s); } + +///////////////////////////////////////////////////////////////////////////// + +void WXSERIAL(wxMDIChildFrame)::StoreObject(wxObjectOutputStream& s) +{ + WXSERIAL(wxFrame)::StoreObject(s); +} + +void WXSERIAL(wxMDIChildFrame)::LoadObject(wxObjectInputStream& s) +{ + WXSERIAL(wxFrame)::LoadObject(s); + + ((wxMDIChildFrame *)Object())->Create((wxMDIParentFrame *)m_parent, + m_id, m_title, + wxPoint(m_x, m_y), wxSize(m_w, m_h), + m_style, m_name); +} + +///////////////////////////////////////////////////////////////////////////// + +void WXSERIAL(wxMDIClientWindow)::StoreObject(wxObjectOutputStream& s) +{ + WXSERIAL(wxWindow)::StoreObject(s); +} + +void WXSERIAL(wxMDIClientWindow)::LoadObject(wxObjectInputStream& s) +{ + WXSERIAL(wxWindow)::LoadObject(s); + + ((wxMDIClientWindow *)Object())->CreateClient((wxMDIParentFrame *)m_parent, m_style); +} diff --git a/utils/serialize/serwnd.h b/utils/serialize/serwnd.h index 769715e2b0..14c3423ff9 100644 --- a/utils/serialize/serwnd.h +++ b/utils/serialize/serwnd.h @@ -50,5 +50,7 @@ DECLARE_SERIAL_CLASS(wxMenuBar, wxWindow) DECLARE_SERIAL_CLASS(wxMenuItem, wxObject) DECLARE_SERIAL_CLASS(wxMenu, wxObject) DECLARE_SERIAL_CLASS(wxMDIParentFrame, wxFrame) +DECLARE_SERIAL_CLASS(wxMDIChildFrame, wxFrame) +DECLARE_SERIAL_CLASS(wxMDIClientWindow, wxFrame) #endif -- 2.45.2