Added new dynamic loading classes. (which handle proper

wxRTTI and wxModule initialisation and unloading)
Removed serialisation code from wxObject and elsewhere.
Added USER_EXPORTED hash and list macros.
Added *_PLUGGABLE_CLASS defines for exporting dynamic wxObjects
from dlls.

 ----------------------------------------------------------------------
 Modified Files:
 	Makefile.in configure configure.in setup.h.in debian/changelog
 	distrib/msw/tmake/filelist.txt include/wx/defs.h
 	include/wx/docview.h include/wx/dynlib.h include/wx/fileconf.h
 	include/wx/hash.h include/wx/list.h include/wx/module.h
 	include/wx/object.h include/wx/resource.h include/wx/stream.h
 	include/wx/gtk/setup0.h include/wx/msw/setup0.h src/files.lst
 	src/wxBase.dsp src/wxUniv.dsp src/wxWindows.dsp
 	src/common/dynlib.cpp src/common/filename.cpp
 	src/common/module.cpp src/common/object.cpp
 	src/common/stream.cpp src/gtk/files.lst src/mac/files.lst
 	src/mgl/files.lst src/mgl/makefile.wat src/motif/files.lst
 	src/msw/dialup.cpp src/msw/files.lst src/msw/helpchm.cpp
 	src/msw/makefile.b32 src/msw/makefile.bcc src/msw/makefile.dos
 	src/msw/makefile.g95 src/msw/makefile.sc src/msw/makefile.vc
 	src/msw/makefile.wat src/os2/files.lst src/univ/files.lst
 Added Files:
 	include/wx/dynload.h src/common/dynload.cpp
 Removed Files:
 	include/wx/objstrm.h include/wx/serbase.h
 	src/common/objstrm.cpp src/common/serbase.cpp
 	utils/serialize/.cvsignore utils/serialize/makefile.b32
 	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/sergdi.h
 	utils/serialize/sermain.cpp utils/serialize/serwnd.cpp
 	utils/serialize/serwnd.h
 ----------------------------------------------------------------------


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13088 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Ron Lee
2001-12-19 07:09:58 +00:00
parent 955b11918b
commit 0b9ab0bd82
66 changed files with 1838 additions and 3658 deletions

View File

@@ -1,3 +0,0 @@
Linux
linux-gnu
linux

View File

@@ -1,58 +0,0 @@
#
# File: makefile.b32
# Author: Patrick Halke, modified by Guilhem Lavaux
# Created: 1997
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds 32bit wxstring library for Windows 3.1
# and Borland C++ 4.x
WXDIR = $(WXWIN)
!if "$(DLL)" == "1"
WXBUILDDLL=1
WXUSINGDLL=1
!endif
!include $(WXDIR)\src\makeb32.env
WXLIBDIR = $(WXDIR)\lib
LIBS=$(WXLIB) cw32 import32 ole2w32
!ifndef DEBUG
DEBUG=0
!endif
LIBTARGET= $(WXLIBDIR)\wxserial.dll
CPPFLAGS= $(CPPFLAGS) -Od
.c.obj:
bcc32 $(CPPFLAGS) -P- -c {$< }
OBJECTS = sermain.obj sercore.obj serwnd.obj serctrl.obj sergdi.obj serext.obj
all: $(LIBTARGET)
sermain.obj: sermain.$(SRCSUFF)
bcc32 $(CPPFLAGS) -P- -u- -c sermain.$(SRCSUFF)
$(LIBTARGET): $(OBJECTS)
erase $(LIBTARGET)
tlink32 $(LINK_FLAGS) /v @&&!
c0d32.obj $(OBJECTS)
$(LIBTARGET)
nul
$(LIBS)
serial
!
clean:
-erase *.obj
-erase $(LIBTARGET)
-erase *.exe
-erase *.res
-erase *.map
-erase *.rws

View File

@@ -1,107 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: sercore.cpp
// Purpose: Serialization: core classes
// Author: Guilhem Lavaux
// Modified by:
// Created: July 1998
// RCS-ID: $Id$
// Copyright: (c) 1998 Guilhem Lavaux
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "sercore.h"
#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(wxHashTable, 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() );
} else {
for (i=0;i<number;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();
}

View File

@@ -1,24 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: sercore.h
// Purpose: Serialization: core classes
// Author: Guilhem Lavaux
// Modified by:
// Created: July 1998
// RCS-ID: $Id$
// Copyright: (c) 1998 Guilhem Lavaux
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __SERCORE_H__
#define __SERCORE_H__
#ifdef __GNUG__
#pragma interface
#endif
#include <wx/serbase.h>
DECLARE_SERIAL_CLASS(wxList, wxObject)
DECLARE_SERIAL_CLASS(wxHashTable, wxObject)
#endif

View File

@@ -1,478 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: serctrl.cpp
// Purpose: Serialization: control classes
// Author: Guilhem Lavaux
// Modified by:
// Created: July 1998
// RCS-ID: $Id$
// Copyright: (c) 1998 Guilhem Lavaux
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#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/radiobut.h>
#include <wx/stattext.h>
#include <wx/statbox.h>
#include <wx/combobox.h>
#include <wx/imaglist.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)
#ifdef __WINDOWS__
IMPLEMENT_SERIAL_CLASS(wxSlider95, wxControl)
IMPLEMENT_SERIAL_CLASS(wxGauge95, wxControl)
#else
IMPLEMENT_SERIAL_CLASS(wxSlider, wxControl)
IMPLEMENT_SERIAL_CLASS(wxGauge, wxControl)
#endif
IMPLEMENT_SERIAL_CLASS(wxCheckBox, wxControl)
IMPLEMENT_SERIAL_CLASS(wxChoice, wxControl)
IMPLEMENT_SERIAL_CLASS(wxComboBox, 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)
{
WXSERIAL(wxControl)::StoreObject(s);
}
void WXSERIAL(wxButton)::LoadObject(wxObjectInputStream& s)
{
WXSERIAL(wxControl)::LoadObject(s);
if (s.SecondCall())
return;
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_validator, 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);
if (s.SecondCall())
return;
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_validator, m_name);
chkbox->SetValue(data_s.Read8());
}
//-----------------------------------------------------------------------------
#ifdef __WXMSW__
void WXSERIAL(wxSlider95)::StoreObject(wxObjectOutputStream& s)
#else
void WXSERIAL(wxSlider)::StoreObject(wxObjectOutputStream& s)
#endif
{
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() );
}
#ifdef __WXMSW__
void WXSERIAL(wxSlider95)::LoadObject(wxObjectInputStream& s)
#else
void WXSERIAL(wxSlider)::LoadObject(wxObjectInputStream& s)
#endif
{
WXSERIAL(wxControl)::LoadObject(s);
if (s.SecondCall())
return;
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_validator, 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() );
}
//-----------------------------------------------------------------------------
#ifdef __WXMSW__
void WXSERIAL(wxGauge95)::StoreObject(wxObjectOutputStream& s)
#else
void WXSERIAL(wxGauge)::StoreObject(wxObjectOutputStream& s)
#endif
{
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() );
}
#ifdef __WXMSW__
void WXSERIAL(wxGauge95)::LoadObject(wxObjectInputStream& s)
#else
void WXSERIAL(wxGauge)::LoadObject(wxObjectInputStream& s)
#endif
{
WXSERIAL(wxControl)::LoadObject(s);
if (s.SecondCall())
return;
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_validator, 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);
if (s.SecondCall())
return;
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_validator, 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);
if (s.SecondCall())
return;
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();
wxImageList *imaglist = notebook->GetImageList();
int i, pcount = notebook->GetPageCount();
WXSERIAL(wxControl)::StoreObject(s);
if (s.FirstStage()) {
s.AddChild(imaglist);
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;
wxImageList *imaglist;
WXSERIAL(wxControl)::LoadObject(s);
if (s.SecondCall()) {
for (i=0;i<m_pcount;i++)
notebook->AddPage( (wxWindow *)s.GetChild(), m_stringlist[i] );
return;
}
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);
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();
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);
if (s.SecondCall())
return;
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_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);
if (s.SecondCall())
return;
((wxRadioButton *)Object())->SetValue( (bool)data_s.Read8() );
}
//-----------------------------------------------------------------------------
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);
if (s.SecondCall())
return;
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_validator, 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);
if (s.SecondCall())
return;
((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);
if (s.SecondCall())
return;
((wxStaticBox *)Object())->Create(m_parent, m_id, m_label, wxPoint(m_x, m_y),
wxSize(m_w, m_h), m_style, m_name);
}

View File

@@ -1,52 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: serctrl.h
// Purpose: Serialization: control classes
// Author: Guilhem Lavaux
// Modified by:
// Created: July 1998
// RCS-ID: $Id$
// Copyright: (c) 1998 Guilhem Lavaux
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#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)
#ifdef __WINDOWS__
DECLARE_SERIAL_CLASS(wxSlider95, wxControl)
DECLARE_SERIAL_CLASS(wxGauge95, wxControl)
#else
DECLARE_SERIAL_CLASS(wxSlider, wxControl)
DECLARE_SERIAL_CLASS(wxGauge, wxControl)
#endif
DECLARE_SERIAL_CLASS(wxCheckBox, wxControl)
DECLARE_SERIAL_CLASS(wxChoice, wxControl)
DECLARE_SERIAL_CLASS(wxComboBox, wxControl)
DECLARE_SERIAL_CLASS(wxListBox, 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

View File

@@ -1,137 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: serext.cpp
// Purpose: Serialization: Other classes
// Author: Guilhem Lavaux
// Modified by:
// Created: July 1998
// RCS-ID: $Id$
// Copyright: (c) 1998 Guilhem Lavaux
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#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>
IMPLEMENT_SERIAL_CLASS(wxSplitterWindow, wxWindow)
IMPLEMENT_SERIAL_CLASS(wxGridCell, wxObject)
IMPLEMENT_SERIAL_CLASS(wxGrid, wxPanel)
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);
}
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);
}

View File

@@ -1,26 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: serext.cpp
// Purpose: Serialization: Other classes
// Author: Guilhem Lavaux
// Modified by:
// Created: July 1998
// RCS-ID: $Id$
// Copyright: (c) 1998 Guilhem Lavaux
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __SEREXT_H__
#define __SEREXT_H__
#ifdef __GNUG__
#pragma interface
#endif
#include <wx/serbase.h>
#include "serwnd.h"
DECLARE_SERIAL_CLASS(wxSplitterWindow, wxWindow)
DECLARE_SERIAL_CLASS(wxGrid, wxPanel)
DECLARE_SERIAL_CLASS(wxGridCell, wxObject)
#endif

View File

@@ -1,334 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: sergdi.cpp
// Purpose: Serialization: GDI classes
// Author: Guilhem Lavaux
// Modified by:
// Created: July 1998
// RCS-ID: $Id$
// Copyright: (c) 1998 Guilhem Lavaux
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#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 <wx/imaglist.h>
#include <wx/region.h>
#include <wx/colour.h>
#include <wx/palette.h>
#include <wx/dcmemory.h>
#include <wx/log.h>
#include "sergdi.h"
IMPLEMENT_SERIAL_CLASS(wxBitmap, wxObject)
IMPLEMENT_SERIAL_CLASS(wxGDIObject, wxObject)
IMPLEMENT_SERIAL_CLASS(wxRegion, wxGDIObject)
IMPLEMENT_SERIAL_CLASS(wxColour, wxObject)
IMPLEMENT_SERIAL_CLASS(wxFont, wxGDIObject)
IMPLEMENT_SERIAL_CLASS(wxPen, wxGDIObject)
IMPLEMENT_SERIAL_CLASS(wxBrush, wxGDIObject)
IMPLEMENT_SERIAL_CLASS(wxImageList, wxObject)
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
// 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->SetWidth(w);
bitmap->SetHeight(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())
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(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)
{
if (s.FirstStage())
return;
wxDataOutputStream data_s(s);
wxColour *colour = (wxColour *)Object();
if (!colour->Ok()) {
data_s.Write8(0);
data_s.Write8(0);
data_s.Write8(0);
wxLogDebug("wxColour (0x%x) isn't ready.\n", colour);
return;
}
data_s.Write8(colour->Red());
data_s.Write8(colour->Green());
data_s.Write8(colour->Blue());
}
void WXSERIAL(wxColour)::LoadObject(wxObjectInputStream& 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();
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();
wxBitmap *bmap = (wxBitmap *)s.GetChild();
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);
}
// ----------------------------------------------------------------------------
void WXSERIAL(wxImageList)::StoreObject(wxObjectOutputStream& s)
{
wxImageList *list = (wxImageList *)Object();
int i;
if (s.FirstStage()) {
#ifdef __WXGTK__
for (i=0;i<list->GetImageCount();i++)
s.AddChild(list->GetBitmap(i));
#endif
}
wxDataOutputStream data_s(s);
data_s.Write32(list->GetImageCount());
}
void WXSERIAL(wxImageList)::LoadObject(wxObjectInputStream& s)
{
int i, count;
wxImageList *list = (wxImageList *)Object();
wxDataInputStream data_s(s);
count = data_s.Read32();
for (i=0;i<count;i++)
list->Add(*((wxBitmap *)s.GetChild()));
}

View File

@@ -1,37 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: sergdi.h
// Purpose: Serialization: GDI classes
// Author: Guilhem Lavaux
// Modified by:
// Created: July 1998
// RCS-ID: $Id$
// Copyright: (c) 1998 Guilhem Lavaux
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#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(wxRegion, wxGDIObject)
DECLARE_SERIAL_CLASS(wxColour, wxObject)
DECLARE_SERIAL_CLASS(wxFont, wxGDIObject)
DECLARE_SERIAL_CLASS(wxPen, wxGDIObject)
DECLARE_SERIAL_CLASS(wxBrush, wxGDIObject)
DECLARE_SERIAL_CLASS(wxImageList, 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

View File

@@ -1,27 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: sermain.cpp
// Purpose: Serialization: main
// Author: Guilhem Lavaux
// Modified by:
// Created: July 1998
// RCS-ID: $Id$
// Copyright: (c) 1998 Guilhem Lavaux
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "serbase.h"
#endif
#include <wx/dynlib.h>
#include <wx/serbase.h>
#include "sercore.h"
#include "serwnd.h"
#include "sergdi.h"
#include "serctrl.h"
#include "serext.h"
IMPLEMENT_DYNAMIC_CLASS(wxObject_Serialize, wxObject)
WXDLL_ENTRY_FUNCTION()

View File

@@ -1,498 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: serwnd.cpp
// Purpose: Serialization: wxWindow classes
// Author: Guilhem Lavaux
// Modified by:
// Created: July 1998
// RCS-ID: $Id$
// Copyright: (c) 1998 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/panel.h>
#include <wx/menu.h>
#include <wx/dialog.h>
#include <wx/serbase.h>
#include <wx/statusbr.h>
#include <wx/mdi.h>
#include "wx/log.h"
#include "serwnd.h"
IMPLEMENT_SERIAL_CLASS(wxWindow, wxObject)
IMPLEMENT_SERIAL_CLASS(wxIndividualLayoutConstraint, wxObject)
IMPLEMENT_SERIAL_CLASS(wxLayoutConstraints, wxObject)
IMPLEMENT_ALIAS_SERIAL_CLASS(wxValidator, wxObject)
IMPLEMENT_SERIAL_CLASS(wxFrame, wxWindow)
IMPLEMENT_SERIAL_CLASS(wxPanel, wxWindow)
IMPLEMENT_SERIAL_CLASS(wxDialog, wxWindow)
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)
{
wxWindow *win_object = (wxWindow *)Object();
if (s.FirstStage()) {
wxNode *node = win_object->GetChildren()->First();
s.AddChild(win_object->GetConstraints());
s.AddChild(win_object->GetValidator());
// BAD HACK, but I don't have access to the internal variable of wxWindow.
m_bg_colour = win_object->GetBackgroundColour();
m_fg_colour = win_object->GetForegroundColour();
s.AddChild(&m_bg_colour);
s.AddChild(&m_fg_colour);
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() );
wxLogDebug( "Number = %d", win_object->GetChildren()->Number() );
data.Write8( win_object->GetChildren()->Number() );
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();
wxColour *colour;
wxFont *font;
if (s.SecondCall()) {
/* I assume we will never create raw wxWindow object */
(void)s.GetChild(); // We pass wxLayoutConstraints.
(void)s.GetChild(); // We pass wxValidator.
colour = (wxColour *)s.GetChild();
if (colour)
win_object->SetBackgroundColour(*colour);
colour = (wxColour *)s.GetChild();
if (colour)
win_object->SetForegroundColour(*colour);
font = (wxFont *)s.GetChild();
if (font)
win_object->SetFont(*font);
s.RemoveChildren(m_number);
return;
}
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_number = data_s.Read8();
m_x = data_s.Read16();
m_y = data_s.Read16();
m_w = data_s.Read16();
m_h = data_s.Read16();
(void)s.GetChild(); // We pass wxLayoutConstraints.
m_validator = (wxValidator *)s.GetChild();
if (!m_validator)
m_validator = (wxValidator *)&wxDefaultValidator;
s.RemoveChildren(m_number+3);
s.Recall();
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();
// AAARGH !! I absolutely need to be able to modify internal fields of
// wxFrame (wxToolBar and wxStatusBar)
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();
WXSERIAL(wxWindow)::LoadObject(s);
if (s.SecondCall())
return;
wxDataInputStream data_s(s);
if (frame->GetClassInfo() == CLASSINFO(wxFrame))
frame->Create(m_parent, m_id, m_title, wxPoint(m_x, m_y),
wxSize(m_w, m_h), m_style, m_name);
frame->SetMenuBar(mbar);
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();
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();
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()) {
#ifdef __WXGTK__
s.AddChild(item->GetSubMenu());
#endif
return;
}
wxDataOutputStream data_s(s);
#ifdef __WXGTK__
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() );
#endif
}
void WXSERIAL(wxMenuItem)::LoadObject(wxObjectInputStream& s)
{
wxMenuItem *item = (wxMenuItem *)Object();
wxDataInputStream data_s(s);
#ifdef __WXGTK__
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() );
#endif
}
/////////////////////////////////////////////////////////////////////////////
void WXSERIAL(wxPanel)::StoreObject(wxObjectOutputStream& s)
{
WXSERIAL(wxWindow)::StoreObject(s);
}
void WXSERIAL(wxPanel)::LoadObject(wxObjectInputStream& s)
{
WXSERIAL(wxWindow)::LoadObject(s);
if (s.SecondCall())
return;
((wxPanel *)Object())->Create(m_parent, m_id, wxPoint(m_x, m_y),
wxSize(m_w, m_h), m_style, m_name);
}
/////////////////////////////////////////////////////////////////////////////
void WXSERIAL(wxDialog)::StoreObject(wxObjectOutputStream& s)
{
WXSERIAL(wxWindow)::StoreObject(s);
}
void WXSERIAL(wxDialog)::LoadObject(wxObjectInputStream& s)
{
WXSERIAL(wxWindow)::LoadObject(s);
if (s.SecondCall())
return;
((wxDialog *)Object())->Create(m_parent, m_id, m_title, wxPoint(m_x, m_y),
wxSize(m_w, m_h), m_style, m_name);
}
/////////////////////////////////////////////////////////////////////////////
void WXSERIAL(wxMDIParentFrame)::StoreObject(wxObjectOutputStream& s)
{
wxMDIParentFrame *frame = (wxMDIParentFrame *)Object();
if (s.FirstStage()) {
s.AddChild(frame->GetClientWindow());
WXSERIAL(wxMDIParentFrame)::StoreObject(s);
return;
}
WXSERIAL(wxMDIParentFrame)::StoreObject(s);
}
void WXSERIAL(wxMDIParentFrame)::LoadObject(wxObjectInputStream& s)
{
wxMDIParentFrame *frame = (wxMDIParentFrame *)Object();
wxMDIClientWindow *client;
if (s.SecondCall()) {
WXSERIAL(wxFrame)::LoadObject(s);
return;
}
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);
WXSERIAL(wxFrame)::LoadObject(s);
}
/////////////////////////////////////////////////////////////////////////////
void WXSERIAL(wxMDIChildFrame)::StoreObject(wxObjectOutputStream& s)
{
WXSERIAL(wxFrame)::StoreObject(s);
}
void WXSERIAL(wxMDIChildFrame)::LoadObject(wxObjectInputStream& s)
{
WXSERIAL(wxFrame)::LoadObject(s);
if (s.SecondCall())
return;
((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);
if (s.SecondCall())
return;
((wxMDIClientWindow *)Object())->CreateClient((wxMDIParentFrame *)m_parent, m_style);
}

View File

@@ -1,57 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: serwnd.h
// Purpose: Serialization: wxWindow classes
// Author: Guilhem Lavaux
// Modified by:
// Created: July 1998
// RCS-ID: $Id$
// Copyright: (c) 1998 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;
wxValidator *m_validator;
wxColour m_bg_colour, m_fg_colour;
long m_style;
int m_number;
};
DECLARE_SERIAL_CLASS(wxIndividualLayoutConstraint, wxObject)
DECLARE_SERIAL_CLASS(wxLayoutConstraints, wxObject)
DECLARE_ALIAS_SERIAL_CLASS(wxValidator, 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)
DECLARE_SERIAL_CLASS(wxMDIParentFrame, wxFrame)
DECLARE_SERIAL_CLASS(wxMDIChildFrame, wxFrame)
DECLARE_SERIAL_CLASS(wxMDIClientWindow, wxFrame)
#endif