]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/serialize/serctrl.cpp
wxFileConfig ctor now (again) uses the files in the correct locations if the
[wxWidgets.git] / utils / serialize / serctrl.cpp
index 7bd86d8f6d5677aeb4b351cec4e35ff17d94f94c..13e54517215e922b721b85f4ba313b9df68adcb0 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,9 +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)
+IMPLEMENT_SERIAL_CLASS(wxStaticBox, wxControl)
+
+//-----------------------------------------------------------------------------
 
 void WXSERIAL(wxButton)::StoreObject(wxObjectOutputStream& s)
 {
@@ -61,6 +66,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 +92,8 @@ void WXSERIAL(wxCheckBox)::LoadObject(wxObjectInputStream& s)
   chkbox->SetValue(data_s.Read8());
 }
 
+//-----------------------------------------------------------------------------
+
 void WXSERIAL(wxSlider)::StoreObject(wxObjectOutputStream& s)
 {
   WXSERIAL(wxControl)::StoreObject(s);
@@ -130,6 +139,8 @@ void WXSERIAL(wxSlider)::LoadObject(wxObjectInputStream& s)
   slider->SetThumbLength( data_s.Read32() );
 }
 
+//-----------------------------------------------------------------------------
+
 void WXSERIAL(wxGauge)::StoreObject(wxObjectOutputStream& s)
 {
   WXSERIAL(wxControl)::StoreObject(s);
@@ -163,6 +174,8 @@ void WXSERIAL(wxGauge)::LoadObject(wxObjectInputStream& s)
   gauge->SetValue( data_s.Read32() );
 }
 
+//-----------------------------------------------------------------------------
+
 void WXSERIAL(wxChoice)::StoreObject(wxObjectOutputStream& s)
 {
   WXSERIAL(wxControl)::StoreObject(s);
@@ -194,6 +207,8 @@ void WXSERIAL(wxChoice)::LoadObject(wxObjectInputStream& s)
     choice->Append( data_s.ReadString() );
 }
 
+//-----------------------------------------------------------------------------
+
 void WXSERIAL(wxListBox)::StoreObject(wxObjectOutputStream& s)
 {
   WXSERIAL(wxControl)::StoreObject(s);
@@ -222,49 +237,57 @@ void WXSERIAL(wxListBox)::LoadObject(wxObjectInputStream& s)
     listbox->Append( data_s.ReadString() );
 }
 
+//-----------------------------------------------------------------------------
+
 void WXSERIAL(wxNotebook)::StoreObject(wxObjectOutputStream& s)
 {
   wxNotebook *notebook = (wxNotebook *)Object();
   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(0);
-  s.RemoveChildren(1);
+  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();
 }
 
+//-----------------------------------------------------------------------------
+
 void WXSERIAL(wxRadioBox)::StoreObject(wxObjectOutputStream& s)
 {
   wxRadioBox *box = (wxRadioBox *)Object();
@@ -304,6 +327,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 +392,8 @@ void WXSERIAL(wxComboBox)::LoadObject(wxObjectInputStream& s)
   box->SetValue( data_s.ReadString() );
 }
 
+//-----------------------------------------------------------------------------
+
 void WXSERIAL(wxStaticText)::StoreObject(wxObjectOutputStream& s)
 {
   WXSERIAL(wxControl)::StoreObject(s);
@@ -358,3 +406,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);
+}