* Some new feature in wxObject*Stream (objects aren't duplicated)
* Added SetBackgroundBrush in wxGridCell * New classes/fixes in wxSerial git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@611 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -302,6 +302,7 @@ class WXDLLEXPORT wxGridCell: public wxObject
|
|||||||
inline wxColour& GetBackgroundColour(void) { return backgroundColour; }
|
inline wxColour& GetBackgroundColour(void) { return backgroundColour; }
|
||||||
void SetBackgroundColour(const wxColour& colour);
|
void SetBackgroundColour(const wxColour& colour);
|
||||||
inline wxBrush *GetBackgroundBrush(void) { return backgroundBrush; }
|
inline wxBrush *GetBackgroundBrush(void) { return backgroundBrush; }
|
||||||
|
inline void SetBackgroundBrush(wxBrush *brush) { backgroundBrush = brush; }
|
||||||
inline int GetAlignment(void) { return alignment; }
|
inline int GetAlignment(void) { return alignment; }
|
||||||
inline void SetAlignment(int align) { alignment = align; }
|
inline void SetAlignment(int align) { alignment = align; }
|
||||||
inline wxBitmap *GetCellBitmap(void) { return cellBitmap; }
|
inline wxBitmap *GetCellBitmap(void) { return cellBitmap; }
|
||||||
|
@@ -27,6 +27,7 @@ class wxObjectStreamInfo : public wxObject {
|
|||||||
wxList children;
|
wxList children;
|
||||||
wxObjectStreamInfo *parent;
|
wxObjectStreamInfo *parent;
|
||||||
wxObject *object;
|
wxObject *object;
|
||||||
|
bool duplicate;
|
||||||
};
|
};
|
||||||
|
|
||||||
class wxObjectOutputStream : public wxFilterOutputStream {
|
class wxObjectOutputStream : public wxFilterOutputStream {
|
||||||
@@ -49,6 +50,7 @@ class wxObjectOutputStream : public wxFilterOutputStream {
|
|||||||
int m_stage;
|
int m_stage;
|
||||||
bool m_saving;
|
bool m_saving;
|
||||||
wxObjectStreamInfo *m_current_info;
|
wxObjectStreamInfo *m_current_info;
|
||||||
|
wxList m_saved_objs;
|
||||||
};
|
};
|
||||||
|
|
||||||
class wxObjectInputStream : public wxFilterInputStream {
|
class wxObjectInputStream : public wxFilterInputStream {
|
||||||
@@ -56,6 +58,7 @@ class wxObjectInputStream : public wxFilterInputStream {
|
|||||||
wxObjectInputStream(wxInputStream& s);
|
wxObjectInputStream(wxInputStream& s);
|
||||||
|
|
||||||
wxObject *GetChild(int no) const;
|
wxObject *GetChild(int no) const;
|
||||||
|
wxObject *GetChild();
|
||||||
int NumberOfChildren() const { return m_current_info->n_children; }
|
int NumberOfChildren() const { return m_current_info->n_children; }
|
||||||
void RemoveChildren(int nb);
|
void RemoveChildren(int nb);
|
||||||
wxObject *GetParent() const;
|
wxObject *GetParent() const;
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#define WXOBJ_BEG_LEN 6
|
#define WXOBJ_BEG_LEN 6
|
||||||
|
|
||||||
#define TAG_EMPTY_OBJECT "NULL"
|
#define TAG_EMPTY_OBJECT "NULL"
|
||||||
|
#define TAG_DUPLICATE_OBJECT "DUPLIC"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxObjectOutputStream
|
// wxObjectOutputStream
|
||||||
@@ -45,6 +46,12 @@ void wxObjectOutputStream::WriteObjectDef(wxObjectStreamInfo& info)
|
|||||||
|
|
||||||
Write(WXOBJ_BEGIN, WXOBJ_BEG_LEN);
|
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) {
|
if (info.object) {
|
||||||
data_s.WriteString(info.object->GetClassInfo()->GetClassName());
|
data_s.WriteString(info.object->GetClassInfo()->GetClassName());
|
||||||
} else {
|
} else {
|
||||||
@@ -54,7 +61,8 @@ void wxObjectOutputStream::WriteObjectDef(wxObjectStreamInfo& info)
|
|||||||
data_s.WriteString(GetObjectName(info.object));
|
data_s.WriteString(GetObjectName(info.object));
|
||||||
|
|
||||||
// I assume an object will not have millions of children
|
// 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)
|
void wxObjectOutputStream::AddChild(wxObject *obj)
|
||||||
@@ -65,6 +73,13 @@ void wxObjectOutputStream::AddChild(wxObject *obj)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
info = new wxObjectStreamInfo;
|
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->n_children = 0;
|
||||||
info->object = obj;
|
info->object = obj;
|
||||||
info->parent = m_current_info; // Not useful here.
|
info->parent = m_current_info; // Not useful here.
|
||||||
@@ -78,7 +93,7 @@ void wxObjectOutputStream::ProcessObjectDef(wxObjectStreamInfo *info)
|
|||||||
|
|
||||||
m_current_info = info;
|
m_current_info = info;
|
||||||
// First stage: get children of obj
|
// First stage: get children of obj
|
||||||
if (info->object)
|
if (info->object && !info->duplicate)
|
||||||
info->object->StoreObject(*this);
|
info->object->StoreObject(*this);
|
||||||
|
|
||||||
// Prepare and write the sub-entry about the child obj.
|
// Prepare and write the sub-entry about the child obj.
|
||||||
@@ -98,7 +113,7 @@ void wxObjectOutputStream::ProcessObjectData(wxObjectStreamInfo *info)
|
|||||||
|
|
||||||
m_current_info = info;
|
m_current_info = info;
|
||||||
|
|
||||||
if (info->object)
|
if (info->object && !info->duplicate)
|
||||||
info->object->StoreObject(*this);
|
info->object->StoreObject(*this);
|
||||||
|
|
||||||
while (node) {
|
while (node) {
|
||||||
@@ -126,6 +141,7 @@ bool wxObjectOutputStream::SaveObject(wxObject& obj)
|
|||||||
ProcessObjectData(&info);
|
ProcessObjectData(&info);
|
||||||
|
|
||||||
info.children.Clear();
|
info.children.Clear();
|
||||||
|
m_saved_objs.Clear();
|
||||||
|
|
||||||
m_saving = FALSE;
|
m_saving = FALSE;
|
||||||
|
|
||||||
@@ -194,17 +210,18 @@ bool wxObjectInputStream::ReadObjectDef(wxObjectStreamInfo *info)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
class_name = data_s.ReadString();
|
class_name = data_s.ReadString();
|
||||||
printf("class_name = %s\n", WXSTRINGCAST class_name);
|
info->object_name = data_s.ReadString();
|
||||||
|
info->children_removed = 0;
|
||||||
|
|
||||||
if (class_name == TAG_EMPTY_OBJECT)
|
if (class_name == TAG_EMPTY_OBJECT)
|
||||||
info->object = NULL;
|
info->object = NULL;
|
||||||
else
|
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->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->n_children = data_s.Read8();
|
||||||
info->children_removed = 0;
|
}
|
||||||
printf("n_children = %d\n", info->n_children);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,7 +252,6 @@ wxObjectStreamInfo *wxObjectInputStream::ProcessObjectDef(wxObjectStreamInfo *pa
|
|||||||
void wxObjectInputStream::ProcessObjectData(wxObjectStreamInfo *info)
|
void wxObjectInputStream::ProcessObjectData(wxObjectStreamInfo *info)
|
||||||
{
|
{
|
||||||
wxNode *node = info->children.First();
|
wxNode *node = info->children.First();
|
||||||
wxObjectStreamInfo *c_info;
|
|
||||||
|
|
||||||
m_current_info = info;
|
m_current_info = info;
|
||||||
|
|
||||||
|
@@ -14,9 +14,12 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <wx/objstrm.h>
|
#include <wx/objstrm.h>
|
||||||
#include <wx/datstrm.h>
|
#include <wx/datstrm.h>
|
||||||
|
#include <wx/list.h>
|
||||||
|
#include <wx/hash.h>
|
||||||
#include "sercore.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)
|
void WXSERIAL(wxList)::StoreObject(wxObjectOutputStream& s)
|
||||||
{
|
{
|
||||||
@@ -62,9 +65,43 @@ void WXSERIAL(wxList)::LoadObject(wxObjectInputStream& s)
|
|||||||
|
|
||||||
if (list->key_type == wxKEY_INTEGER) {
|
if (list->key_type == wxKEY_INTEGER) {
|
||||||
for (i=0;i<number;i++)
|
for (i=0;i<number;i++)
|
||||||
list->Append( data_s.Read32(), s.GetChild(i) );
|
list->Append( data_s.Read32(), s.GetChild() );
|
||||||
} else {
|
} else {
|
||||||
for (i=0;i<number;i++)
|
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();
|
||||||
|
}
|
||||||
|
@@ -19,5 +19,6 @@
|
|||||||
#include <wx/serbase.h>
|
#include <wx/serbase.h>
|
||||||
|
|
||||||
DECLARE_SERIAL_CLASS(wxList, wxObject)
|
DECLARE_SERIAL_CLASS(wxList, wxObject)
|
||||||
|
DECLARE_SERIAL_CLASS(wxHashTable, wxObject)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -23,7 +23,9 @@
|
|||||||
#include <wx/listbox.h>
|
#include <wx/listbox.h>
|
||||||
#include <wx/notebook.h>
|
#include <wx/notebook.h>
|
||||||
#include <wx/radiobox.h>
|
#include <wx/radiobox.h>
|
||||||
|
#include <wx/radiobut.h>
|
||||||
#include <wx/stattext.h>
|
#include <wx/stattext.h>
|
||||||
|
#include <wx/statbox.h>
|
||||||
#include <wx/combobox.h>
|
#include <wx/combobox.h>
|
||||||
#include <wx/imaglist.h>
|
#include <wx/imaglist.h>
|
||||||
#include <wx/objstrm.h>
|
#include <wx/objstrm.h>
|
||||||
@@ -41,10 +43,12 @@ IMPLEMENT_SERIAL_CLASS(wxGauge, wxControl)
|
|||||||
IMPLEMENT_SERIAL_CLASS(wxListBox, wxControl)
|
IMPLEMENT_SERIAL_CLASS(wxListBox, wxControl)
|
||||||
IMPLEMENT_SERIAL_CLASS(wxNotebook, wxControl)
|
IMPLEMENT_SERIAL_CLASS(wxNotebook, wxControl)
|
||||||
IMPLEMENT_SERIAL_CLASS(wxRadioBox, wxControl)
|
IMPLEMENT_SERIAL_CLASS(wxRadioBox, wxControl)
|
||||||
|
IMPLEMENT_SERIAL_CLASS(wxRadioButton, wxControl)
|
||||||
IMPLEMENT_SERIAL_CLASS(wxButton, wxControl)
|
IMPLEMENT_SERIAL_CLASS(wxButton, wxControl)
|
||||||
IMPLEMENT_SERIAL_CLASS(wxStaticText, wxControl)
|
IMPLEMENT_SERIAL_CLASS(wxStaticText, wxControl)
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void WXSERIAL(wxButton)::StoreObject(wxObjectOutputStream& s)
|
void WXSERIAL(wxButton)::StoreObject(wxObjectOutputStream& s)
|
||||||
{
|
{
|
||||||
WXSERIAL(wxControl)::StoreObject(s);
|
WXSERIAL(wxControl)::StoreObject(s);
|
||||||
@@ -61,6 +65,8 @@ void WXSERIAL(wxButton)::LoadObject(wxObjectInputStream& s)
|
|||||||
m_style, *m_validator, m_name);
|
m_style, *m_validator, m_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void WXSERIAL(wxCheckBox)::StoreObject(wxObjectOutputStream& s)
|
void WXSERIAL(wxCheckBox)::StoreObject(wxObjectOutputStream& s)
|
||||||
{
|
{
|
||||||
WXSERIAL(wxControl)::StoreObject(s);
|
WXSERIAL(wxControl)::StoreObject(s);
|
||||||
@@ -85,6 +91,8 @@ void WXSERIAL(wxCheckBox)::LoadObject(wxObjectInputStream& s)
|
|||||||
chkbox->SetValue(data_s.Read8());
|
chkbox->SetValue(data_s.Read8());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void WXSERIAL(wxSlider)::StoreObject(wxObjectOutputStream& s)
|
void WXSERIAL(wxSlider)::StoreObject(wxObjectOutputStream& s)
|
||||||
{
|
{
|
||||||
WXSERIAL(wxControl)::StoreObject(s);
|
WXSERIAL(wxControl)::StoreObject(s);
|
||||||
@@ -130,6 +138,8 @@ void WXSERIAL(wxSlider)::LoadObject(wxObjectInputStream& s)
|
|||||||
slider->SetThumbLength( data_s.Read32() );
|
slider->SetThumbLength( data_s.Read32() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void WXSERIAL(wxGauge)::StoreObject(wxObjectOutputStream& s)
|
void WXSERIAL(wxGauge)::StoreObject(wxObjectOutputStream& s)
|
||||||
{
|
{
|
||||||
WXSERIAL(wxControl)::StoreObject(s);
|
WXSERIAL(wxControl)::StoreObject(s);
|
||||||
@@ -163,6 +173,8 @@ void WXSERIAL(wxGauge)::LoadObject(wxObjectInputStream& s)
|
|||||||
gauge->SetValue( data_s.Read32() );
|
gauge->SetValue( data_s.Read32() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void WXSERIAL(wxChoice)::StoreObject(wxObjectOutputStream& s)
|
void WXSERIAL(wxChoice)::StoreObject(wxObjectOutputStream& s)
|
||||||
{
|
{
|
||||||
WXSERIAL(wxControl)::StoreObject(s);
|
WXSERIAL(wxControl)::StoreObject(s);
|
||||||
@@ -194,6 +206,8 @@ void WXSERIAL(wxChoice)::LoadObject(wxObjectInputStream& s)
|
|||||||
choice->Append( data_s.ReadString() );
|
choice->Append( data_s.ReadString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void WXSERIAL(wxListBox)::StoreObject(wxObjectOutputStream& s)
|
void WXSERIAL(wxListBox)::StoreObject(wxObjectOutputStream& s)
|
||||||
{
|
{
|
||||||
WXSERIAL(wxControl)::StoreObject(s);
|
WXSERIAL(wxControl)::StoreObject(s);
|
||||||
@@ -222,6 +236,8 @@ void WXSERIAL(wxListBox)::LoadObject(wxObjectInputStream& s)
|
|||||||
listbox->Append( data_s.ReadString() );
|
listbox->Append( data_s.ReadString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void WXSERIAL(wxNotebook)::StoreObject(wxObjectOutputStream& s)
|
void WXSERIAL(wxNotebook)::StoreObject(wxObjectOutputStream& s)
|
||||||
{
|
{
|
||||||
wxNotebook *notebook = (wxNotebook *)Object();
|
wxNotebook *notebook = (wxNotebook *)Object();
|
||||||
@@ -250,8 +266,7 @@ void WXSERIAL(wxNotebook)::LoadObject(wxObjectInputStream& s)
|
|||||||
int i, pcount;
|
int i, pcount;
|
||||||
wxImageList *imaglist;
|
wxImageList *imaglist;
|
||||||
|
|
||||||
imaglist = (wxImageList *)s.GetChild(0);
|
imaglist = (wxImageList *)s.GetChild();
|
||||||
s.RemoveChildren(1);
|
|
||||||
|
|
||||||
WXSERIAL(wxControl)::LoadObject(s);
|
WXSERIAL(wxControl)::LoadObject(s);
|
||||||
|
|
||||||
@@ -265,6 +280,8 @@ void WXSERIAL(wxNotebook)::LoadObject(wxObjectInputStream& s)
|
|||||||
notebook->SetPageText(i, data_s.ReadString() );
|
notebook->SetPageText(i, data_s.ReadString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void WXSERIAL(wxRadioBox)::StoreObject(wxObjectOutputStream& s)
|
void WXSERIAL(wxRadioBox)::StoreObject(wxObjectOutputStream& s)
|
||||||
{
|
{
|
||||||
wxRadioBox *box = (wxRadioBox *)Object();
|
wxRadioBox *box = (wxRadioBox *)Object();
|
||||||
@@ -304,6 +321,29 @@ void WXSERIAL(wxRadioBox)::LoadObject(wxObjectInputStream& s)
|
|||||||
n_items, items, 0, m_style, *m_validator, m_name);
|
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)
|
void WXSERIAL(wxComboBox)::StoreObject(wxObjectOutputStream& s)
|
||||||
{
|
{
|
||||||
WXSERIAL(wxControl)::StoreObject(s);
|
WXSERIAL(wxControl)::StoreObject(s);
|
||||||
@@ -346,6 +386,8 @@ void WXSERIAL(wxComboBox)::LoadObject(wxObjectInputStream& s)
|
|||||||
box->SetValue( data_s.ReadString() );
|
box->SetValue( data_s.ReadString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void WXSERIAL(wxStaticText)::StoreObject(wxObjectOutputStream& s)
|
void WXSERIAL(wxStaticText)::StoreObject(wxObjectOutputStream& s)
|
||||||
{
|
{
|
||||||
WXSERIAL(wxControl)::StoreObject(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),
|
((wxStaticText *)Object())->Create(m_parent, m_id, m_label, wxPoint(m_x, m_y),
|
||||||
wxSize(m_w, m_h), m_style, m_name);
|
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);
|
||||||
|
}
|
||||||
|
@@ -29,6 +29,8 @@ DECLARE_SERIAL_CLASS(wxGauge, wxControl)
|
|||||||
DECLARE_SERIAL_CLASS(wxListBox, wxControl)
|
DECLARE_SERIAL_CLASS(wxListBox, wxControl)
|
||||||
DECLARE_SERIAL_CLASS(wxNotebook, wxControl)
|
DECLARE_SERIAL_CLASS(wxNotebook, wxControl)
|
||||||
DECLARE_SERIAL_CLASS(wxRadioBox, wxControl)
|
DECLARE_SERIAL_CLASS(wxRadioBox, wxControl)
|
||||||
|
DECLARE_SERIAL_CLASS(wxRadioButton, wxControl)
|
||||||
DECLARE_SERIAL_CLASS(wxStaticText, wxControl)
|
DECLARE_SERIAL_CLASS(wxStaticText, wxControl)
|
||||||
|
DECLARE_SERIAL_CLASS(wxStaticBox, wxControl)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -13,12 +13,16 @@
|
|||||||
#pragma implementation "serext.h"
|
#pragma implementation "serext.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "serext.h"
|
||||||
|
#include <wx/wx.h>
|
||||||
#include <wx/splitter.h>
|
#include <wx/splitter.h>
|
||||||
|
#include <wx/grid.h>
|
||||||
#include <wx/objstrm.h>
|
#include <wx/objstrm.h>
|
||||||
#include <wx/datstrm.h>
|
#include <wx/datstrm.h>
|
||||||
#include "serext.h"
|
|
||||||
|
|
||||||
IMPLEMENT_SERIAL_CLASS(wxSplitterWindow, wxWindow)
|
IMPLEMENT_SERIAL_CLASS(wxSplitterWindow, wxWindow)
|
||||||
|
IMPLEMENT_SERIAL_CLASS(wxGridCell, wxObject)
|
||||||
|
IMPLEMENT_SERIAL_CLASS(wxGrid, wxPanel)
|
||||||
|
|
||||||
void WXSERIAL(wxSplitterWindow)::StoreObject(wxObjectOutputStream& s)
|
void WXSERIAL(wxSplitterWindow)::StoreObject(wxObjectOutputStream& s)
|
||||||
{
|
{
|
||||||
@@ -69,3 +73,65 @@ void WXSERIAL(wxSplitterWindow)::LoadObject(wxObjectInputStream& s)
|
|||||||
splitter->SetBorderSize(border_size);
|
splitter->SetBorderSize(border_size);
|
||||||
splitter->SetMinimumPaneSize(min_pane_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);
|
||||||
|
}
|
||||||
|
@@ -20,5 +20,7 @@
|
|||||||
#include "serwnd.h"
|
#include "serwnd.h"
|
||||||
|
|
||||||
DECLARE_SERIAL_CLASS(wxSplitterWindow, wxWindow)
|
DECLARE_SERIAL_CLASS(wxSplitterWindow, wxWindow)
|
||||||
|
DECLARE_SERIAL_CLASS(wxGrid, wxPanel)
|
||||||
|
DECLARE_SERIAL_CLASS(wxGridCell, wxObject)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -116,9 +116,7 @@ void WXSERIAL(wxPen)::StoreObject(wxObjectOutputStream& s)
|
|||||||
void WXSERIAL(wxPen)::LoadObject(wxObjectInputStream& s)
|
void WXSERIAL(wxPen)::LoadObject(wxObjectInputStream& s)
|
||||||
{
|
{
|
||||||
wxPen *pen = (wxPen *)Object();
|
wxPen *pen = (wxPen *)Object();
|
||||||
wxColour *col = (wxColour *) s.GetChild(0);
|
wxColour *col = (wxColour *) s.GetChild();
|
||||||
|
|
||||||
s.RemoveChildren(1);
|
|
||||||
|
|
||||||
WXSERIAL(wxGDIObject)::LoadObject(s);
|
WXSERIAL(wxGDIObject)::LoadObject(s);
|
||||||
|
|
||||||
@@ -149,10 +147,8 @@ void WXSERIAL(wxBrush)::StoreObject(wxObjectOutputStream& s)
|
|||||||
void WXSERIAL(wxBrush)::LoadObject(wxObjectInputStream& s)
|
void WXSERIAL(wxBrush)::LoadObject(wxObjectInputStream& s)
|
||||||
{
|
{
|
||||||
wxBrush *brush = (wxBrush *)Object();
|
wxBrush *brush = (wxBrush *)Object();
|
||||||
wxColour *col = (wxColour *)s.GetChild(0);
|
wxColour *col = (wxColour *)s.GetChild();
|
||||||
wxBitmap *bmap = (wxBitmap *)s.GetChild(1);
|
wxBitmap *bmap = (wxBitmap *)s.GetChild();
|
||||||
|
|
||||||
s.RemoveChildren(2);
|
|
||||||
|
|
||||||
WXSERIAL(wxGDIObject)::LoadObject(s);
|
WXSERIAL(wxGDIObject)::LoadObject(s);
|
||||||
|
|
||||||
@@ -226,5 +222,5 @@ void WXSERIAL(wxImageList)::LoadObject(wxObjectInputStream& s)
|
|||||||
|
|
||||||
count = data_s.Read32();
|
count = data_s.Read32();
|
||||||
for (i=0;i<count;i++)
|
for (i=0;i<count;i++)
|
||||||
list->Add(*((wxBitmap *)s.GetChild(i)));
|
list->Add(*((wxBitmap *)s.GetChild()));
|
||||||
}
|
}
|
||||||
|
@@ -36,8 +36,8 @@ WXDLL_ENTRY_FUNCTION()
|
|||||||
REGISTER_CLASS(wxIndividualLayoutConstraint);
|
REGISTER_CLASS(wxIndividualLayoutConstraint);
|
||||||
REGISTER_CLASS(wxLayoutConstraints);
|
REGISTER_CLASS(wxLayoutConstraints);
|
||||||
REGISTER_CLASS(wxFrame);
|
REGISTER_CLASS(wxFrame);
|
||||||
// REGISTER_CLASS(wxPanel);
|
REGISTER_CLASS(wxPanel);
|
||||||
// REGISTER_CLASS(wxDialog);
|
REGISTER_CLASS(wxDialog);
|
||||||
REGISTER_CLASS(wxMenu);
|
REGISTER_CLASS(wxMenu);
|
||||||
REGISTER_CLASS(wxMenuItem);
|
REGISTER_CLASS(wxMenuItem);
|
||||||
REGISTER_CLASS(wxMenuBar);
|
REGISTER_CLASS(wxMenuBar);
|
||||||
@@ -48,6 +48,7 @@ WXDLL_ENTRY_FUNCTION()
|
|||||||
REGISTER_CLASS(wxFont);
|
REGISTER_CLASS(wxFont);
|
||||||
REGISTER_CLASS(wxPen);
|
REGISTER_CLASS(wxPen);
|
||||||
REGISTER_CLASS(wxBrush);
|
REGISTER_CLASS(wxBrush);
|
||||||
|
REGISTER_CLASS(wxImageList);
|
||||||
REGISTER_CLASS(wxPenList);
|
REGISTER_CLASS(wxPenList);
|
||||||
REGISTER_CLASS(wxBrushList);
|
REGISTER_CLASS(wxBrushList);
|
||||||
REGISTER_CLASS(wxFontList);
|
REGISTER_CLASS(wxFontList);
|
||||||
|
@@ -40,6 +40,10 @@ IMPLEMENT_SERIAL_CLASS(wxMenuBar, wxWindow)
|
|||||||
IMPLEMENT_SERIAL_CLASS(wxMenuItem, wxObject)
|
IMPLEMENT_SERIAL_CLASS(wxMenuItem, wxObject)
|
||||||
IMPLEMENT_SERIAL_CLASS(wxMenu, 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)
|
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 */
|
/* I assume we will never create raw wxWindow object */
|
||||||
|
|
||||||
m_validator = (wxValidator *)s.GetChild(1);
|
m_validator = (wxValidator *)s.GetChild();
|
||||||
win_object->SetDefaultBackgroundColour(*((wxColour *)s.GetChild(2)));
|
win_object->SetDefaultBackgroundColour(*((wxColour *)s.GetChild()));
|
||||||
win_object->SetDefaultForegroundColour(*((wxColour *)s.GetChild(3)));
|
win_object->SetDefaultForegroundColour(*((wxColour *)s.GetChild()));
|
||||||
win_object->SetFont(*((wxFont *)s.GetChild(4)));
|
win_object->SetFont(*((wxFont *)s.GetChild()));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -220,6 +224,9 @@ void WXSERIAL(wxFrame)::StoreObject(wxObjectOutputStream& s)
|
|||||||
wxDataOutputStream data_s(s);
|
wxDataOutputStream data_s(s);
|
||||||
wxStatusBar *statbar = frame->GetStatusBar();
|
wxStatusBar *statbar = frame->GetStatusBar();
|
||||||
|
|
||||||
|
// AAARGH !! I absolutely need to be able to modify internal fields of
|
||||||
|
// wxFrame (wxToolBar and wxStatusBar)
|
||||||
|
|
||||||
if (statbar)
|
if (statbar)
|
||||||
data_s.Write8(statbar->GetFieldsCount());
|
data_s.Write8(statbar->GetFieldsCount());
|
||||||
else
|
else
|
||||||
@@ -231,9 +238,8 @@ void WXSERIAL(wxFrame)::StoreObject(wxObjectOutputStream& s)
|
|||||||
void WXSERIAL(wxFrame)::LoadObject(wxObjectInputStream& s)
|
void WXSERIAL(wxFrame)::LoadObject(wxObjectInputStream& s)
|
||||||
{
|
{
|
||||||
wxFrame *frame = (wxFrame *)Object();
|
wxFrame *frame = (wxFrame *)Object();
|
||||||
wxMenuBar *mbar = (wxMenuBar *)s.GetChild(0);
|
wxMenuBar *mbar = (wxMenuBar *)s.GetChild();
|
||||||
|
|
||||||
s.RemoveChildren(1);
|
|
||||||
WXSERIAL(wxWindow)::LoadObject(s);
|
WXSERIAL(wxWindow)::LoadObject(s);
|
||||||
|
|
||||||
wxDataInputStream data_s(s);
|
wxDataInputStream data_s(s);
|
||||||
@@ -275,7 +281,7 @@ void WXSERIAL(wxMenuBar)::LoadObject(wxObjectInputStream& s)
|
|||||||
|
|
||||||
mcount = data_s.Read8();
|
mcount = data_s.Read8();
|
||||||
for (i=0;i<mcount;i++) {
|
for (i=0;i<mcount;i++) {
|
||||||
wxMenu *menu = (wxMenu *)s.GetChild(0);
|
wxMenu *menu = (wxMenu *)s.GetChild();
|
||||||
mbar->Append( menu, menu->GetTitle() );
|
mbar->Append( menu, menu->GetTitle() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,12 +307,12 @@ void WXSERIAL(wxMenu)::StoreObject(wxObjectOutputStream& s)
|
|||||||
void WXSERIAL(wxMenu)::LoadObject(wxObjectInputStream& s)
|
void WXSERIAL(wxMenu)::LoadObject(wxObjectInputStream& s)
|
||||||
{
|
{
|
||||||
wxMenu *menu = (wxMenu *)Object();
|
wxMenu *menu = (wxMenu *)Object();
|
||||||
wxList *items = (wxList *)s.GetChild(0);
|
wxList *items = (wxList *)s.GetChild();
|
||||||
wxNode *node = items->First();
|
wxNode *node = items->First();
|
||||||
|
|
||||||
wxDataInputStream data_s(s);
|
wxDataInputStream data_s(s);
|
||||||
|
|
||||||
// menu->SetTitle( data_s.ReadString() );
|
menu->SetTitle( data_s.ReadString() );
|
||||||
|
|
||||||
while (node) {
|
while (node) {
|
||||||
// NOT IMPLEMENTED in wxGTK
|
// NOT IMPLEMENTED in wxGTK
|
||||||
@@ -345,7 +351,7 @@ void WXSERIAL(wxMenuItem)::LoadObject(wxObjectInputStream& s)
|
|||||||
item->SetCheckable( data_s.Read8() );
|
item->SetCheckable( data_s.Read8() );
|
||||||
item->Enable( data_s.Read8() );
|
item->Enable( data_s.Read8() );
|
||||||
item->Check( 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();
|
wxMDIParentFrame *frame = (wxMDIParentFrame *)Object();
|
||||||
wxMDIClientWindow *client;
|
wxMDIClientWindow *client;
|
||||||
|
|
||||||
client = (wxMDIClientWindow *) s.GetChild(0);
|
client = (wxMDIClientWindow *) s.GetChild();
|
||||||
s.RemoveChildren(1);
|
|
||||||
|
|
||||||
frame->Create(m_parent, m_id, m_title, wxPoint(m_x, m_y),
|
frame->Create(m_parent, m_id, m_title, wxPoint(m_x, m_y),
|
||||||
wxSize(m_w, m_h), m_style, m_name);
|
wxSize(m_w, m_h), m_style, m_name);
|
||||||
// client->CreateClient(this, style_client);
|
|
||||||
|
|
||||||
WXSERIAL(wxFrame)::LoadObject(s);
|
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);
|
||||||
|
}
|
||||||
|
@@ -50,5 +50,7 @@ DECLARE_SERIAL_CLASS(wxMenuBar, wxWindow)
|
|||||||
DECLARE_SERIAL_CLASS(wxMenuItem, wxObject)
|
DECLARE_SERIAL_CLASS(wxMenuItem, wxObject)
|
||||||
DECLARE_SERIAL_CLASS(wxMenu, wxObject)
|
DECLARE_SERIAL_CLASS(wxMenu, wxObject)
|
||||||
DECLARE_SERIAL_CLASS(wxMDIParentFrame, wxFrame)
|
DECLARE_SERIAL_CLASS(wxMDIParentFrame, wxFrame)
|
||||||
|
DECLARE_SERIAL_CLASS(wxMDIChildFrame, wxFrame)
|
||||||
|
DECLARE_SERIAL_CLASS(wxMDIClientWindow, wxFrame)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user