]> git.saurik.com Git - wxWidgets.git/commitdiff
* Some new feature in wxObject*Stream (objects aren't duplicated)
authorGuilhem Lavaux <lavaux@easynet.fr>
Wed, 19 Aug 1998 18:33:19 +0000 (18:33 +0000)
committerGuilhem Lavaux <lavaux@easynet.fr>
Wed, 19 Aug 1998 18:33:19 +0000 (18:33 +0000)
* 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

13 files changed:
include/wx/generic/gridg.h
include/wx/objstrm.h
src/common/objstrm.cpp
utils/serialize/sercore.cpp
utils/serialize/sercore.h
utils/serialize/serctrl.cpp
utils/serialize/serctrl.h
utils/serialize/serext.cpp
utils/serialize/serext.h
utils/serialize/sergdi.cpp
utils/serialize/sermain.cpp
utils/serialize/serwnd.cpp
utils/serialize/serwnd.h

index 50795a21152059c0566a848695aa7922bddf7445..ae1724ad7ef5153fe42f5cbaf39b1e200664c1ff 100644 (file)
@@ -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; }
index fbe79e4503378bd5efaf4d71f6ab3ea3db3b61a2..9f419e38eca586899ea1771b0ca1a516284a98d3 100644 (file)
@@ -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;
index dda2e77591d34a37316e50e017304a4958501574..0b7fa3503b14e36a08548f3d9f73b705cec92a7c 100644 (file)
@@ -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;
 
index 8c83acbe021e62db267e870ef00752536151ae81..0fffba7f5b23eaef297f83d95d3f381488adca39 100644 (file)
 #endif
 #include <wx/objstrm.h>
 #include <wx/datstrm.h>
+#include <wx/list.h>
+#include <wx/hash.h>
 #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;i<number;i++)
-      list->Append( data_s.Read32(), s.GetChild(i) );
+      list->Append( data_s.Read32(), s.GetChild() );
   } else {
     for (i=0;i<number;i++)
-      list->Append( 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;i<table->n;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;i<n;i++)
+    table->hash_table[i] = (wxList *)s.GetChild();
+}
index 676c04a4497f618bccc19ea4b3c65f25bc618adc..57651eab6da773e54503d8294ec46e2da34bd9fc 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <wx/serbase.h>
 
-DECLARE_SERIAL_CLASS(wxList,wxObject)
+DECLARE_SERIAL_CLASS(wxList, wxObject)
+DECLARE_SERIAL_CLASS(wxHashTable, wxObject)
 
 #endif
index 7bd86d8f6d5677aeb4b351cec4e35ff17d94f94c..982dbc5440285e2d5cb9036785379adc3f92eccd 100644 (file)
@@ -23,7 +23,9 @@
 #include <wx/listbox.h>
 #include <wx/notebook.h>
 #include <wx/radiobox.h>
+#include <wx/radiobut.h>
 #include <wx/stattext.h>
+#include <wx/statbox.h>
 #include <wx/combobox.h>
 #include <wx/imaglist.h>
 #include <wx/objstrm.h>
@@ -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);
+}
index d2eeb8244993d988e44c2fc6f6d7d35762a73e8a..a3b3ffc2798d2d4358c1fdec802ac3d3bf219732 100644 (file)
@@ -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
index da6d92785abb263d14260789d7d0e40ca1740883..aaddb4066ac765d79cfd375082745834b9f1e369 100644 (file)
 #pragma implementation "serext.h"
 #endif
 
+#include "serext.h"
+#include <wx/wx.h>
 #include <wx/splitter.h>
+#include <wx/grid.h>
 #include <wx/objstrm.h>
 #include <wx/datstrm.h>
-#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;r<n_rows;r++)
+      for (c=0;c<n_cols;c++)
+       s.AddChild( grid->GetCell(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);
+}
index 5856e50edd94a9f023a88fde38579b94d0710b56..540bb998b507e6e6dca66104ee6be8e73fa3513c 100644 (file)
@@ -20,5 +20,7 @@
 #include "serwnd.h"
 
 DECLARE_SERIAL_CLASS(wxSplitterWindow, wxWindow)
+DECLARE_SERIAL_CLASS(wxGrid, wxPanel)
+DECLARE_SERIAL_CLASS(wxGridCell, wxObject)
 
 #endif
index 85072dbaba7f923d4b5ffa0c95293ee403853bb7..bedaddf300492f9765443a74c80d2fee541edf9f 100644 (file)
@@ -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;i<count;i++)
-    list->Add(*((wxBitmap *)s.GetChild(i)));
+    list->Add(*((wxBitmap *)s.GetChild()));
 }
index 95194106fc5cd3bff03b77475033a2acec70b555..4ef76703dd253b9314afeb3ce79a9c86dadb6a06 100644 (file)
@@ -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);
index 7c8fc6d161b7b3ff3aa88a9ad64f0a0e8fdfaf42..1efa161336765ba31d937aa659ae2cf48889361a 100644 (file)
@@ -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;i<mcount;i++) {
-    wxMenu *menu = (wxMenu *)s.GetChild(0);
+    wxMenu *menu = (wxMenu *)s.GetChild();
     mbar->Append( 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);
+}
index 769715e2b0dc5c5ff0c0b87dbd1bc17a6dc01003..14c3423ff9d7628c9c0a7c0de667bfa8770de352 100644 (file)
@@ -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