--- /dev/null
+include ../../src/gtk/setup/general/makeapp
--- /dev/null
+# WXXT base directory
+WXBASEDIR=@WXBASEDIR@
+
+# set the OS type for compilation
+OS=@OS@
+# compile a library only
+RULE=gslib
+
+# define common stuff
+
+# define library name
+LIB_TARGET=wxserial
+LIB_MAJOR=2
+LIB_MINOR=0
+# define library sources
+LIB_SRC=\
+sermain.cpp sercore.cpp sergdi.cpp serwnd.cpp serctrl.cpp serext.cpp
+#define library objects
+LIB_OBJ=\
+sermain.o sercore.o sergdi.o serwnd.o serctrl.o serext.o
+
+#additional things needed for compile
+
+# include the definitions now
+include ../../../template.mak
--- /dev/null
+#ifdef __GNUG__
+#pragma implementation "sercore.h"
+#endif
+#include <wx/objstrm.h>
+#include <wx/datstrm.h>
+#include "sercore.h"
+
+IMPLEMENT_SERIAL_CLASS(wxList,wxObject)
+
+void WXSERIAL(wxList)::StoreObject(wxObjectOutputStream& s)
+{
+ wxList *lst_object = (wxList *)Object();
+ wxNode *node = lst_object->First();
+
+ if (s.FirstStage()) {
+ while (node) {
+ s.AddChild(node->Data());
+ node = node->Next();
+ }
+ return;
+ }
+
+ wxDataOutputStream data_s(s);
+
+ data_s.Write8(lst_object->destroy_data);
+ data_s.Write8(lst_object->key_type);
+ data_s.Write32( lst_object->Number() );
+
+ if (lst_object->key_type == wxKEY_INTEGER) {
+ while (node) {
+ data_s.Write32(node->key.integer);
+ node = node->Next();
+ }
+ } else {
+ while (node) {
+ data_s.WriteString(node->key.string);
+ node = node->Next();
+ }
+ }
+}
+
+void WXSERIAL(wxList)::LoadObject(wxObjectInputStream& s)
+{
+ wxDataInputStream data_s(s);
+ wxList *list = (wxList *)Object();
+ int number, i;
+
+ list->DeleteContents( data_s.Read8() );
+ list->key_type = data_s.Read8();
+ number = data_s.Read32();
+
+ if (list->key_type == wxKEY_INTEGER) {
+ for (i=0;i<number;i++)
+ list->Append( data_s.Read32(), s.GetChild(i) );
+ } else {
+ for (i=0;i<number;i++)
+ list->Append( data_s.ReadString(), s.GetChild(i) );
+ }
+}
--- /dev/null
+#ifndef __SERCORE_H__
+#define __SERCORE_H__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include <wx/serbase.h>
+
+DECLARE_SERIAL_CLASS(wxList,wxObject)
+
+#endif
--- /dev/null
+#ifdef __GNUG__
+#pragma implementation "serctrl.h"
+#endif
+
+#include <wx/window.h>
+#include <wx/control.h>
+#include <wx/button.h>
+#include <wx/checkbox.h>
+#include <wx/slider.h>
+#include <wx/gauge.h>
+#include <wx/choice.h>
+#include <wx/listbox.h>
+#include <wx/notebook.h>
+#include <wx/radiobox.h>
+#include <wx/stattext.h>
+#include <wx/combobox.h>
+#include <wx/objstrm.h>
+#include <wx/datstrm.h>
+#include <wx/serbase.h>
+#include "serwnd.h"
+#include "serctrl.h"
+
+IMPLEMENT_ALIAS_SERIAL_CLASS(wxControl, wxWindow)
+IMPLEMENT_SERIAL_CLASS(wxSlider, wxControl)
+IMPLEMENT_SERIAL_CLASS(wxCheckBox, wxControl)
+IMPLEMENT_SERIAL_CLASS(wxChoice, wxControl)
+IMPLEMENT_SERIAL_CLASS(wxComboBox, wxControl)
+IMPLEMENT_SERIAL_CLASS(wxGauge, wxControl)
+IMPLEMENT_SERIAL_CLASS(wxListBox, wxControl)
+IMPLEMENT_SERIAL_CLASS(wxNotebook, wxControl)
+IMPLEMENT_SERIAL_CLASS(wxRadioBox, wxControl)
+
+IMPLEMENT_SERIAL_CLASS(wxButton, wxControl)
+IMPLEMENT_SERIAL_CLASS(wxStaticText, wxControl)
+
+void WXSERIAL(wxButton)::StoreObject(wxObjectOutputStream& s)
+{
+ WXSERIAL(wxControl)::StoreObject(s);
+}
+
+void WXSERIAL(wxButton)::LoadObject(wxObjectInputStream& s)
+{
+ WXSERIAL(wxControl)::LoadObject(s);
+
+ wxButton *button = (wxButton *)Object();
+
+ printf("label = %s\n", WXSTRINGCAST m_label);
+ button->Create(m_parent, m_id, m_label, wxPoint(m_x, m_y), wxSize(m_w, m_h),
+ m_style, m_name);
+}
+
+void WXSERIAL(wxCheckBox)::StoreObject(wxObjectOutputStream& s)
+{
+ WXSERIAL(wxControl)::StoreObject(s);
+
+ if (s.FirstStage())
+ return;
+
+ wxDataOutputStream data_s(s);
+ data_s.Write8( ((wxCheckBox *)Object())->GetValue() );
+}
+
+void WXSERIAL(wxCheckBox)::LoadObject(wxObjectInputStream& s)
+{
+ WXSERIAL(wxControl)::LoadObject(s);
+
+ wxDataInputStream data_s(s);
+ wxCheckBox *chkbox = (wxCheckBox *)Object();
+
+ chkbox->Create(m_parent, m_id, m_label, wxPoint(m_x, m_y), wxSize(m_w, m_h),
+ m_style, m_name);
+
+ chkbox->SetValue(data_s.Read8());
+}
+
+void WXSERIAL(wxSlider)::StoreObject(wxObjectOutputStream& s)
+{
+ WXSERIAL(wxControl)::StoreObject(s);
+
+ if (s.FirstStage())
+ return;
+
+ wxDataOutputStream data_s(s);
+ wxSlider *slider = (wxSlider *)Object();
+
+ data_s.Write32( slider->GetMin() );
+ data_s.Write32( slider->GetMax() );
+ data_s.Write32( slider->GetValue() );
+ data_s.Write32( slider->GetTickFreq() );
+ data_s.Write32( slider->GetPageSize() );
+ data_s.Write32( slider->GetLineSize() );
+ data_s.Write32( slider->GetSelStart() );
+ data_s.Write32( slider->GetSelEnd() );
+ data_s.Write32( slider->GetThumbLength() );
+}
+
+void WXSERIAL(wxSlider)::LoadObject(wxObjectInputStream& s)
+{
+ WXSERIAL(wxControl)::LoadObject(s);
+
+ wxDataInputStream data_s(s);
+ wxSlider *slider = (wxSlider *)Object();
+ int value, min, max;
+
+ min = data_s.Read32();
+ max = data_s.Read32();
+ value = data_s.Read32();
+
+ slider->Create(m_parent, m_id, value, min, max, wxPoint(m_x, m_y),
+ wxSize(m_w, m_h), m_style, m_name);
+
+ slider->SetTickFreq( 0, data_s.Read32() );
+ slider->SetPageSize( data_s.Read32() );
+ slider->SetLineSize( data_s.Read32() );
+ min = data_s.Read32();
+ max = data_s.Read32();
+ slider->SetSelection(min, max);
+ slider->SetThumbLength( data_s.Read32() );
+}
+
+void WXSERIAL(wxGauge)::StoreObject(wxObjectOutputStream& s)
+{
+ WXSERIAL(wxControl)::StoreObject(s);
+
+ if (s.FirstStage())
+ return;
+
+ wxDataOutputStream data_s(s);
+ wxGauge *gauge = (wxGauge *)Object();
+
+ data_s.Write32( gauge->GetRange() );
+ data_s.Write8( gauge->GetShadowWidth() );
+ data_s.Write8( gauge->GetBezelFace() );
+ data_s.Write32( gauge->GetValue() );
+}
+
+void WXSERIAL(wxGauge)::LoadObject(wxObjectInputStream& s)
+{
+ WXSERIAL(wxControl)::LoadObject(s);
+
+ wxDataInputStream data_s(s);
+ wxGauge *gauge = (wxGauge *)Object();
+ int range;
+
+ range = data_s.Read32();
+ gauge->Create(m_parent, m_id, range, wxPoint(m_x, m_y), wxSize(m_w, m_h),
+ m_style, m_name);
+
+ gauge->SetShadowWidth( data_s.Read8() );
+ gauge->SetBezelFace( data_s.Read8() );
+ gauge->SetValue( data_s.Read32() );
+}
+
+void WXSERIAL(wxChoice)::StoreObject(wxObjectOutputStream& s)
+{
+ WXSERIAL(wxControl)::StoreObject(s);
+
+ if (s.FirstStage())
+ return;
+
+ wxDataOutputStream data_s(s);
+ wxChoice *choice = (wxChoice *)Object();
+ int i, num = choice->Number();
+
+ data_s.Write32(num);
+ for (i=0;i<num;i++)
+ data_s.WriteString( choice->GetString(i) );
+}
+
+void WXSERIAL(wxChoice)::LoadObject(wxObjectInputStream& s)
+{
+ WXSERIAL(wxControl)::LoadObject(s);
+
+ wxDataInputStream data_s(s);
+ wxChoice *choice = (wxChoice *)Object();
+ int i,num = data_s.Read32();
+
+ choice->Create(m_parent, m_id, wxPoint(m_x, m_y), wxSize(m_w, m_h), 0, NULL,
+ m_style, m_name);
+
+ for (i=0;i<num;i++)
+ choice->Append( data_s.ReadString() );
+}
+
+void WXSERIAL(wxListBox)::StoreObject(wxObjectOutputStream& s)
+{
+ WXSERIAL(wxControl)::StoreObject(s);
+
+ if (s.FirstStage())
+ return;
+
+ wxDataOutputStream data_s(s);
+ wxListBox *listbox = (wxListBox *)Object();
+ int i, num = listbox->Number();
+
+ data_s.Write32(num);
+ for (i=0;i<num;i++)
+ data_s.WriteString( listbox->GetString(i) );
+}
+
+void WXSERIAL(wxListBox)::LoadObject(wxObjectInputStream& s)
+{
+ WXSERIAL(wxListBox)::LoadObject(s);
+
+ wxDataInputStream data_s(s);
+ wxListBox *listbox = (wxListBox *)Object();
+ int i, num = data_s.Read32();
+
+ for (i=0;i<num;i++)
+ listbox->Append( data_s.ReadString() );
+}
+
+void WXSERIAL(wxNotebook)::StoreObject(wxObjectOutputStream& s)
+{
+ wxNotebook *notebook = (wxNotebook *)Object();
+ int i, pcount = notebook->GetPageCount();
+
+ WXSERIAL(wxControl)::StoreObject(s);
+
+ if (s.FirstStage()) {
+ // Don't know how to retrieve images from wxImageList (copy to a DC ?)
+ return;
+ }
+
+ wxDataOutputStream data_s(s);
+
+ data_s.Write8( pcount );
+ 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;
+
+ WXSERIAL(wxControl)::LoadObject(s);
+
+ 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() );
+}
+
+void WXSERIAL(wxRadioBox)::StoreObject(wxObjectOutputStream& s)
+{
+ wxRadioBox *box = (wxRadioBox *)Object();
+ WXSERIAL(wxControl)::StoreObject(s);
+
+ if (s.FirstStage())
+ return;
+
+ wxDataOutputStream data_s(s);
+ int i, n_items = box->Number();
+
+ data_s.Write8( n_items );
+ data_s.Write8( box->GetNumberOfRowsOrCols() );
+
+ for (i=0;i<n_items;i++)
+ data_s.WriteString( box->GetString(i) );
+}
+
+void WXSERIAL(wxRadioBox)::LoadObject(wxObjectInputStream& s)
+{
+ wxRadioBox *box = (wxRadioBox *)Object();
+
+ WXSERIAL(wxControl)::LoadObject(s);
+
+ wxDataInputStream data_s(s);
+ int i, n_rows_cols, n_items;
+ wxString *items;
+
+ n_items = data_s.Read8();
+ n_rows_cols = data_s.Read8();
+
+ items = new wxString[n_items];
+ for (i=0;i<n_items;i++)
+ items[i] = data_s.ReadString();
+
+ box->Create(m_parent, m_id, m_title, wxPoint(m_x, m_y), wxSize(m_w, m_h),
+ n_items, items, 0, m_style, m_name);
+}
+
+void WXSERIAL(wxComboBox)::StoreObject(wxObjectOutputStream& s)
+{
+ WXSERIAL(wxControl)::StoreObject(s);
+
+ if (s.FirstStage())
+ return;
+
+ wxDataOutputStream data_s(s);
+ wxComboBox *box = (wxComboBox *)Object();
+ int i, num = box->Number();
+
+ data_s.Write8( num );
+ data_s.Write8( box->GetSelection() );
+ for (i=0;i<num;i++)
+ data_s.WriteString( box->GetString(i) );
+
+ data_s.WriteString( box->GetValue() );
+
+ // TODO: Editable flag
+}
+
+void WXSERIAL(wxComboBox)::LoadObject(wxObjectInputStream& s)
+{
+ WXSERIAL(wxControl)::LoadObject(s);
+
+ wxDataInputStream data_s(s);
+ wxComboBox *box = (wxComboBox *)Object();
+ int i, num, selection;
+
+ box->Create(m_parent, m_id, wxEmptyString, wxPoint(m_x, m_y), wxSize(m_w, m_h),
+ 0, NULL, m_style, m_name);
+
+ num = data_s.Read8();
+ selection = data_s.Read8();
+
+ for (i=0;i<num;i++)
+ box->Append( data_s.ReadString() );
+
+ box->SetSelection( selection );
+ box->SetValue( data_s.ReadString() );
+}
+
+void WXSERIAL(wxStaticText)::StoreObject(wxObjectOutputStream& s)
+{
+ WXSERIAL(wxControl)::StoreObject(s);
+}
+
+void WXSERIAL(wxStaticText)::LoadObject(wxObjectInputStream& s)
+{
+ WXSERIAL(wxControl)::LoadObject(s);
+
+ ((wxStaticText *)Object())->Create(m_parent, m_id, m_label, wxPoint(m_x, m_y),
+ wxSize(m_w, m_h), m_style, m_name);
+}
--- /dev/null
+#ifndef __SERCTRL_H__
+#define __SERCTRL_H__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include <wx/serbase.h>
+#include "serwnd.h"
+
+DECLARE_ALIAS_SERIAL_CLASS(wxControl, wxWindow)
+DECLARE_SERIAL_CLASS(wxButton, wxControl)
+DECLARE_SERIAL_CLASS(wxSlider, wxControl)
+DECLARE_SERIAL_CLASS(wxCheckBox, wxControl)
+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(wxStaticText, wxControl)
+
+#endif
--- /dev/null
+#ifdef __GNUG__
+#pragma implementation "serext.h"
+#endif
+
+#include <wx/splitter.h>
+#include <wx/objstrm.h>
+#include <wx/datstrm.h>
+#include "serext.h"
+
+IMPLEMENT_SERIAL_CLASS(wxSplitterWindow, wxWindow)
+
+void WXSERIAL(wxSplitterWindow)::StoreObject(wxObjectOutputStream& s)
+{
+ wxSplitterWindow *splitter = (wxSplitterWindow *)Object();
+ WXSERIAL(wxWindow)::StoreObject(s);
+
+ if (s.FirstStage()) {
+ s.AddChild( splitter->GetWindow1() );
+ s.AddChild( splitter->GetWindow2() );
+ return;
+ }
+
+ wxDataOutputStream data_s(s);
+ data_s.Write8( splitter->GetSplitMode() );
+ data_s.Write32( splitter->GetSashSize() );
+ data_s.Write8( splitter->GetBorderSize() );
+ data_s.Write32( splitter->GetSashPosition() );
+ data_s.Write32( splitter->GetMinimumPaneSize() );
+}
+
+void WXSERIAL(wxSplitterWindow)::LoadObject(wxObjectInputStream& s)
+{
+ wxSplitterWindow *splitter = (wxSplitterWindow *)Object();
+ WXSERIAL(wxWindow)::LoadObject(s);
+
+ wxDataInputStream data_s(s);
+ int split_mode, sash_size, border_size, sash_position, min_pane_size;
+
+ split_mode = data_s.Read8();
+ sash_size = data_s.Read32();
+ border_size = data_s.Read8();
+ sash_position = data_s.Read32();
+ min_pane_size = data_s.Read32();
+
+ splitter->Create(m_parent, m_id, wxPoint(m_x, m_y), wxSize(m_w, m_h), m_style,
+ m_name);
+
+ if (s.GetChild(1)) {
+ if (data_s.Read8() == wxSPLIT_VERTICAL)
+ splitter->SplitVertically((wxWindow *)s.GetChild(0),
+ (wxWindow *)s.GetChild(1), sash_position);
+ else
+ splitter->SplitHorizontally((wxWindow *)s.GetChild(0),
+ (wxWindow *)s.GetChild(1), sash_position);
+ }
+
+ splitter->SetSashSize(sash_size);
+ splitter->SetBorderSize(border_size);
+ splitter->SetMinimumPaneSize(min_pane_size);
+}
--- /dev/null
+#ifndef __SEREXT_H__
+#define __SEREXT_H__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include <wx/serbase.h>
+#include "serwnd.h"
+
+DECLARE_SERIAL_CLASS(wxSplitterWindow, wxWindow)
+
+#endif
--- /dev/null
+#ifdef __GNUG__
+#pragma implementation "sergdi.h"
+#endif
+#include <wx/objstrm.h>
+#include <wx/datstrm.h>
+#include <wx/gdicmn.h>
+#include <wx/bitmap.h>
+#include <wx/font.h>
+#include <wx/pen.h>
+#include <wx/brush.h>
+#include <wx/serbase.h>
+#include "sergdi.h"
+
+IMPLEMENT_SERIAL_CLASS(wxBitmap, wxObject)
+IMPLEMENT_SERIAL_CLASS(wxGDIObject, wxObject)
+IMPLEMENT_SERIAL_CLASS(wxColour, wxGDIObject)
+IMPLEMENT_SERIAL_CLASS(wxFont, wxGDIObject)
+IMPLEMENT_SERIAL_CLASS(wxPen, wxGDIObject)
+IMPLEMENT_SERIAL_CLASS(wxBrush, wxGDIObject)
+
+IMPLEMENT_ALIAS_SERIAL_CLASS(wxPenList, wxList)
+IMPLEMENT_ALIAS_SERIAL_CLASS(wxBrushList, wxList)
+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
+}
+
+void WXSERIAL(wxBitmap)::LoadObject(wxObjectInputStream& s)
+{
+ // TODO
+}
+
+void WXSERIAL(wxGDIObject)::StoreObject(wxObjectOutputStream& s)
+{
+ if (s.FirstStage())
+ return;
+
+ bool visible = ((wxGDIObject *)Object())->GetVisible();
+
+ wxDataOutputStream data_s(s);
+ data_s.Write8(visible);
+}
+
+void WXSERIAL(wxGDIObject)::LoadObject(wxObjectInputStream& s)
+{
+ wxDataInputStream data_s(s);
+
+ ((wxGDIObject *)Object())->SetVisible( data_s.Read8() );
+}
+
+void WXSERIAL(wxColour)::StoreObject(wxObjectOutputStream& s)
+{
+ WXSERIAL(wxGDIObject)::StoreObject(s);
+
+ if (s.FirstStage())
+ return;
+
+ wxDataOutputStream data_s(s);
+ wxColour *colour = (wxColour *)Object();
+
+ data_s.Write8(colour->Red());
+ data_s.Write8(colour->Green());
+ data_s.Write8(colour->Blue());
+}
+
+void WXSERIAL(wxColour)::LoadObject(wxObjectInputStream& s)
+{
+ WXSERIAL(wxGDIObject)::LoadObject(s);
+
+ wxDataInputStream data_s(s);
+ wxColour *colour = (wxColour *)Object();
+ int r, g, b;
+
+ r = data_s.Read8();
+ g = data_s.Read8();
+ b = data_s.Read8();
+
+ colour->Set(r, g, b);
+}
+
+void WXSERIAL(wxPen)::StoreObject(wxObjectOutputStream& s)
+{
+ wxPen *pen = (wxPen *)Object();
+ WXSERIAL(wxGDIObject)::StoreObject(s);
+
+ if (s.FirstStage()) {
+ s.AddChild(& (pen->GetColour()) );
+ return;
+ }
+
+ wxDataOutputStream data_s(s);
+
+ data_s.Write8( pen->GetCap() );
+ data_s.Write8( pen->GetJoin() );
+ data_s.Write8( pen->GetStyle() );
+ data_s.Write8( pen->GetWidth() );
+}
+
+void WXSERIAL(wxPen)::LoadObject(wxObjectInputStream& s)
+{
+ wxPen *pen = (wxPen *)Object();
+ wxColour *col = (wxColour *) s.GetChild(0);
+
+ s.RemoveChildren(1);
+
+ WXSERIAL(wxGDIObject)::LoadObject(s);
+
+ wxDataInputStream data_s(s);
+
+ pen->SetColour(*col);
+ pen->SetCap( data_s.Read8() );
+ pen->SetJoin( data_s.Read8() );
+ pen->SetStyle( data_s.Read8() );
+ pen->SetWidth( data_s.Read8() );
+}
+
+void WXSERIAL(wxBrush)::StoreObject(wxObjectOutputStream& s)
+{
+ wxBrush *brush = (wxBrush *)Object();
+ WXSERIAL(wxGDIObject)::StoreObject(s);
+
+ if (s.FirstStage()) {
+ s.AddChild( &(brush->GetColour()) );
+ s.AddChild( brush->GetStipple() );
+ return;
+ }
+
+ wxDataOutputStream data_s(s);
+ data_s.Write8( brush->GetStyle() );
+}
+
+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);
+
+ WXSERIAL(wxGDIObject)::LoadObject(s);
+
+ wxDataInputStream data_s(s);
+ if (bmap)
+ *brush = wxBrush(*col, data_s.Read8());
+ else
+ *brush = wxBrush(bmap);
+}
+
+void WXSERIAL(wxFont)::StoreObject(wxObjectOutputStream& s)
+{
+ wxFont *font = (wxFont *)Object();
+
+ WXSERIAL(wxGDIObject)::StoreObject(s);
+
+ if (s.FirstStage())
+ return;
+
+ wxDataOutputStream data_s(s);
+
+ data_s.Write8( font->GetPointSize() );
+ data_s.WriteString( font->GetFaceName() );
+ data_s.Write8( font->GetFamily() );
+ data_s.Write8( font->GetStyle() );
+ data_s.Write8( font->GetWeight() );
+ data_s.Write8( font->GetUnderlined() );
+}
+
+void WXSERIAL(wxFont)::LoadObject(wxObjectInputStream& s)
+{
+ wxFont *font = (wxFont *)Object();
+
+ WXSERIAL(wxGDIObject)::LoadObject(s);
+
+ wxDataInputStream data_s(s);
+ int psize, family, style, weight;
+ bool underlined;
+ wxString face_name;
+
+ psize = data_s.Read8();
+ face_name = data_s.ReadString();
+ family = data_s.Read8();
+ style = data_s.Read8();
+ weight = data_s.Read8();
+ underlined = data_s.Read8();
+
+ *font = wxFont(psize, face_name, family, style, weight, underlined);
+}
--- /dev/null
+#ifndef __SERGDI_H__
+#define __SERGDI_H__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include <wx/serbase.h>
+#include "sercore.h"
+
+DECLARE_SERIAL_CLASS(wxBitmap, wxObject)
+DECLARE_SERIAL_CLASS(wxGDIObject, wxObject)
+DECLARE_SERIAL_CLASS(wxColour, wxGDIObject)
+DECLARE_SERIAL_CLASS(wxFont, wxGDIObject)
+DECLARE_SERIAL_CLASS(wxPen, wxGDIObject)
+DECLARE_SERIAL_CLASS(wxBrush, wxGDIObject)
+
+//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)
+DECLARE_ALIAS_SERIAL_CLASS(wxColourDatabase, wxList)
+DECLARE_ALIAS_SERIAL_CLASS(wxBitmapList, wxList)
+
+#endif
--- /dev/null
+#include <wx/dynlib.h>
+#include <wx/serbase.h>
+
+#include "sercore.h"
+#include "serwnd.h"
+#include "sergdi.h"
+#include "serctrl.h"
+
+IMPLEMENT_DYNAMIC_CLASS(wxObject_Serialize, wxObject)
+
+#define REGISTER_CLASS(classname) \
+lib->RegisterClass(CLASSINFO(classname##_Serialize), #classname "_Serialize")
+
+WXDLL_ENTRY_FUNCTION()
+{
+ wxClassLibrary *lib = new wxClassLibrary;
+
+ REGISTER_CLASS(wxList);
+
+ REGISTER_CLASS(wxWindow);
+ REGISTER_CLASS(wxIndividualLayoutConstraint);
+ REGISTER_CLASS(wxLayoutConstraints);
+ REGISTER_CLASS(wxFrame);
+// REGISTER_CLASS(wxPanel);
+// REGISTER_CLASS(wxDialog);
+ REGISTER_CLASS(wxMenu);
+ REGISTER_CLASS(wxMenuItem);
+ REGISTER_CLASS(wxMenuBar);
+
+ REGISTER_CLASS(wxGDIObject);
+ REGISTER_CLASS(wxBitmap);
+ REGISTER_CLASS(wxColour);
+ REGISTER_CLASS(wxFont);
+ REGISTER_CLASS(wxPen);
+ REGISTER_CLASS(wxBrush);
+ REGISTER_CLASS(wxPenList);
+ REGISTER_CLASS(wxBrushList);
+ REGISTER_CLASS(wxFontList);
+ REGISTER_CLASS(wxColourDatabase);
+ REGISTER_CLASS(wxBitmapList);
+
+ REGISTER_CLASS(wxControl);
+ REGISTER_CLASS(wxSlider);
+ REGISTER_CLASS(wxCheckBox);
+ REGISTER_CLASS(wxChoice);
+ REGISTER_CLASS(wxGauge);
+ REGISTER_CLASS(wxListBox);
+ REGISTER_CLASS(wxButton);
+ REGISTER_CLASS(wxStaticText);
+ REGISTER_CLASS(wxRadioBox);
+ REGISTER_CLASS(wxComboBox);
+ REGISTER_CLASS(wxNotebook);
+
+ return lib;
+}
+
+WXDLL_EXIT_FUNCTION(lib)
+{
+ delete lib;
+}
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: serwnd.cpp
+// Purpose: Serialization: wxWindow classes
+// Author: Guilhem Lavaux
+// Modified by:
+// Created: 11/07/98
+// RCS-ID: $Id$
+// Copyright: (c) Guilhem Lavaux
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation "serwnd.h"
+#endif
+
+#include <wx/window.h>
+#include <wx/layout.h>
+#include <wx/stream.h>
+#include <wx/datstrm.h>
+#include <wx/objstrm.h>
+#include <wx/utils.h>
+#include <wx/frame.h>
+#include <wx/serbase.h>
+#include "serwnd.h"
+
+IMPLEMENT_SERIAL_CLASS(wxWindow, wxObject)
+IMPLEMENT_SERIAL_CLASS(wxIndividualLayoutConstraint, wxObject)
+IMPLEMENT_SERIAL_CLASS(wxLayoutConstraints, wxObject)
+IMPLEMENT_SERIAL_CLASS(wxFrame, wxWindow)
+//IMPLEMENT_SERIAL_CLASS(wxDialog, wxWindow)
+IMPLEMENT_SERIAL_CLASS(wxMenuBar, wxWindow)
+IMPLEMENT_SERIAL_CLASS(wxMenuItem, wxObject)
+IMPLEMENT_SERIAL_CLASS(wxMenu, wxObject)
+
+// IMPLEMENT_ALIAS_SERIAL_CLASS(wxPanel, wxWindow)
+
+void WXSERIAL(wxWindow)::StoreObject(wxObjectOutputStream& s)
+{
+ wxWindow *win_object = (wxWindow *)Object();
+ wxNode *node = win_object->GetChildren()->First();
+
+ if (s.FirstStage()) {
+ s.AddChild(win_object->GetConstraints());
+// s.AddChild(&(win_object->GetDefaultBackgroundColour()));
+// s.AddChild(&(win_object->GetDefaultForegroundColour()));
+ s.AddChild(win_object->GetFont());
+ while (node) {
+ s.AddChild(node->Data());
+ node = node->Next();
+ }
+ return;
+ }
+
+ wxDataOutputStream data(s);
+ int x,y,w,h;
+
+ 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.Write32( win_object->GetWindowStyleFlag() );
+ data.Write32(win_object->GetId());
+
+ win_object->GetSize(&w, &h);
+ win_object->GetPosition(&x, &y);
+ data.Write16(x);
+ data.Write16(y);
+ data.Write16(w);
+ data.Write16(h);
+}
+
+void WXSERIAL(wxWindow)::LoadObject(wxObjectInputStream& s)
+{
+ wxDataInputStream data_s(s);
+ wxWindow *win_object = (wxWindow *)Object();
+
+ m_parent = (wxWindow *)s.GetParent();
+
+ m_name = data_s.ReadString();
+ m_label = data_s.ReadString();
+ m_title = data_s.ReadString();
+
+ m_auto_layout = data_s.Read8();
+ m_shown = data_s.Read8();
+ m_style = data_s.Read32();
+ m_id = data_s.Read32();
+
+ m_x = data_s.Read16();
+ m_y = data_s.Read16();
+ m_w = data_s.Read16();
+ m_h = data_s.Read16();
+
+ /* I assume we will never create raw wxWindow object */
+
+ // This will be done by wxLayoutConstraints, as we need an initialized object.
+// win_object->SetConstraints((wxLayoutConstraints *)s.GetChild(0));
+// win_object->SetDefaultBackgroundColour(*((wxColour *)s.GetChild(1)));
+// win_object->SetDefaultForegroundColour(*((wxColour *)s.GetChild(2)));
+ win_object->SetFont(*((wxFont *)s.GetChild(1)));
+
+ return;
+}
+
+void WXSERIAL(wxIndividualLayoutConstraint)::StoreObject
+ (wxObjectOutputStream& s)
+{
+ wxIndividualLayoutConstraint *lay_object =
+ (wxIndividualLayoutConstraint *)Object();
+ if (s.FirstStage())
+ return;
+
+ wxDataOutputStream data_s(s);
+
+ data_s.WriteString(s.GetObjectName(lay_object->GetOtherWindow()));
+ data_s.Write8(lay_object->GetMyEdge());
+ data_s.Write8(lay_object->GetRelationship());
+ data_s.Write16(lay_object->GetMargin());
+ data_s.Write16(lay_object->GetValue());
+ data_s.Write8(lay_object->GetPercent());
+ data_s.Write8(lay_object->GetOtherEdge());
+}
+
+void WXSERIAL(wxIndividualLayoutConstraint)::
+ LoadObject(wxObjectInputStream& s)
+{
+ wxIndividualLayoutConstraint *lay_object =
+ (wxIndividualLayoutConstraint *)Object();
+ wxDataInputStream data_s(s);
+ wxString win_name;
+
+ win_name = data_s.ReadString();
+ lay_object->otherWin = (wxWindow *)s.SolveName(win_name);
+ lay_object->myEdge = (wxEdge)data_s.Read8();
+ lay_object->relationship = (wxRelationship)data_s.Read8();
+ lay_object->margin = data_s.Read16();
+ lay_object->value = data_s.Read16();
+ lay_object->percent = data_s.Read8();
+ lay_object->otherEdge = (wxEdge)data_s.Read8();
+}
+
+void WXSERIAL(wxLayoutConstraints)::StoreObject(wxObjectOutputStream& s)
+{
+ wxLayoutConstraints *lay_object = (wxLayoutConstraints *)Object();
+ WXSERIAL(wxIndividualLayoutConstraint) c;
+
+#define STORE(obj) c.SetObject(&(lay_object->obj)); c.StoreObject(s);
+
+ // I simplify the process for this object
+ STORE(left);
+ STORE(right);
+ STORE(bottom);
+ STORE(top);
+
+ STORE(width);
+ STORE(height);
+
+ STORE(centreX);
+ STORE(centreY);
+
+#undef STORE
+}
+
+void WXSERIAL(wxLayoutConstraints)::LoadObject(wxObjectInputStream& s)
+{
+ wxLayoutConstraints *lay_object = (wxLayoutConstraints *)Object();
+ WXSERIAL(wxIndividualLayoutConstraint) c;
+
+#define LOAD(obj) c.SetObject(&(lay_object->obj)); c.LoadObject(s);
+
+ // I simplify the process for this object
+ LOAD(left);
+ LOAD(right);
+ LOAD(bottom);
+ LOAD(top);
+
+ LOAD(width);
+ LOAD(height);
+
+ LOAD(centreX);
+ LOAD(centreY);
+
+#undef LOAD
+
+ // Initialize constraints
+ ((wxWindow *)s.GetParent())->SetConstraints(lay_object);
+}
+
+void WXSERIAL(wxFrame)::StoreObject(wxObjectOutputStream& s)
+{
+ wxFrame *frame = (wxFrame *)Object();
+
+ if (s.FirstStage()) {
+ s.AddChild(frame->GetMenuBar());
+ WXSERIAL(wxWindow)::StoreObject(s);
+ return;
+ }
+
+ WXSERIAL(wxWindow)::StoreObject(s);
+
+ wxDataOutputStream data_s(s);
+ wxStatusBar *statbar = frame->GetStatusBar();
+
+ if (statbar)
+ data_s.Write8(statbar->GetFieldsCount());
+ else
+ data_s.Write8(0);
+ // HOW CAN I ACCESS TO THIS FIELD ?
+ // for (...) { data_s.Write8(statbar->m_statusWidths[i]); }
+}
+
+void WXSERIAL(wxFrame)::LoadObject(wxObjectInputStream& s)
+{
+ wxFrame *frame = (wxFrame *)Object();
+ wxMenuBar *mbar = (wxMenuBar *)s.GetChild(0);
+
+ s.RemoveChildren(1);
+ WXSERIAL(wxWindow)::LoadObject(s);
+
+ wxDataInputStream data_s(s);
+
+ frame->SetMenuBar(mbar);
+ frame->Create(m_parent, m_id, m_title, wxPoint(m_x, m_y), wxSize(m_w, m_h),
+ m_style, m_name);
+
+ frame->CreateStatusBar(data_s.Read8());
+}
+
+void WXSERIAL(wxMenuBar)::StoreObject(wxObjectOutputStream& s)
+{
+ wxMenuBar *mbar = (wxMenuBar *)Object();
+ int i, mcount = mbar->GetMenuCount();
+
+ if (s.FirstStage()) {
+ for (i=0;i<mcount;i++)
+ s.AddChild( mbar->GetMenu(i) );
+ WXSERIAL(wxWindow)::StoreObject(s);
+ return;
+ }
+
+ wxDataOutputStream data_s(s);
+ data_s.Write8( mcount );
+
+ // It isn't necessary for this object.
+ // WXSERIAL(wxWindow)::StoreObject(s);
+}
+
+void WXSERIAL(wxMenuBar)::LoadObject(wxObjectInputStream& s)
+{
+ wxMenuBar *mbar = (wxMenuBar *)Object();
+ int i, mcount;
+ wxDataInputStream data_s(s);
+
+ mcount = data_s.Read8();
+ for (i=0;i<mcount;i++) {
+ wxMenu *menu = (wxMenu *)s.GetChild(0);
+ mbar->Append( menu, menu->GetTitle() );
+ }
+
+ // It isn't necessary for this object.
+ // WXSERIAL(wxWindow)::LoadObject(s);
+}
+
+void WXSERIAL(wxMenu)::StoreObject(wxObjectOutputStream& s)
+{
+ wxMenu *menu = (wxMenu *)Object();
+
+ if (s.FirstStage()) {
+ s.AddChild( &menu->GetItems() );
+ return;
+ }
+
+ wxDataOutputStream data_s(s);
+ data_s.WriteString( menu->GetTitle() );
+}
+
+void WXSERIAL(wxMenu)::LoadObject(wxObjectInputStream& s)
+{
+ wxMenu *menu = (wxMenu *)Object();
+ wxList *items = (wxList *)s.GetChild(0);
+ wxNode *node = items->First();
+
+ wxDataInputStream data_s(s);
+
+// menu->SetTitle( data_s.ReadString() );
+
+ while (node) {
+// NOT IMPLEMENTED in wxGTK
+// menu->Append( (wxMenuItem *)node->Data() );
+ node = node->Next();
+ }
+}
+
+void WXSERIAL(wxMenuItem)::StoreObject(wxObjectOutputStream& s)
+{
+ wxMenuItem *item = (wxMenuItem *)Object();
+
+ if (s.FirstStage()) {
+ s.AddChild(item->GetSubMenu());
+ return;
+ }
+
+ wxDataOutputStream data_s(s);
+
+ data_s.Write8( item->GetId() );
+ data_s.WriteString( item->GetText() );
+ data_s.Write8( item->IsCheckable() );
+ data_s.Write8( item->IsEnabled() );
+ data_s.Write8( item->IsChecked() );
+}
+
+void WXSERIAL(wxMenuItem)::LoadObject(wxObjectInputStream& s)
+{
+ wxMenuItem *item = (wxMenuItem *)Object();
+ wxDataInputStream data_s(s);
+
+ item->SetId( data_s.Read8() );
+ item->SetText( data_s.ReadString() );
+ item->SetCheckable( data_s.Read8() );
+ item->Enable( data_s.Read8() );
+ item->Check( data_s.Read8() );
+ item->SetSubMenu( (wxMenu *)s.GetChild(0) );
+}
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: serwnd.h
+// Purpose: Serialization: wxWindow classes
+// Author: Guilhem Lavaux
+// Modified by:
+// Created: July 1998
+// RCS-ID: $Id$
+// Copyright: (c) Guilhem Lavaux
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _SERIALIZE_SERWND_H_
+#define _SERIALIZE_SERWND_H_
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include <wx/window.h>
+#include <wx/serbase.h>
+
+class WXSERIAL(wxWindow) : public WXSERIAL(wxObject)
+{
+ DECLARE_DYNAMIC_CLASS( wxWindow_Serialize )
+ public:
+ WXSERIAL(wxWindow)() { }
+ virtual ~WXSERIAL(wxWindow)() { };
+
+ void StoreObject(wxObjectOutputStream& s);
+ void LoadObject(wxObjectInputStream& s);
+
+ public:
+ int m_x, m_y, m_w, m_h;
+ bool m_shown, m_auto_layout;
+ wxWindowID m_id;
+ wxString m_name, m_title, m_label;
+ wxWindow *m_parent;
+ long m_style;
+};
+
+DECLARE_SERIAL_CLASS(wxIndividualLayoutConstraint, wxObject)
+DECLARE_SERIAL_CLASS(wxLayoutConstraints, wxObject)
+DECLARE_SERIAL_CLASS(wxFrame, wxWindow)
+//DECLARE_SERIAL_CLASS(wxPanel, wxWindow)
+//DECLARE_SERIAL_CLASS(wxDialog, wxWindow)
+DECLARE_SERIAL_CLASS(wxMenuBar, wxWindow)
+DECLARE_SERIAL_CLASS(wxMenuItem, wxObject)
+DECLARE_SERIAL_CLASS(wxMenu, wxObject)
+
+#endif