* 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:
Guilhem Lavaux
1998-08-19 18:33:19 +00:00
parent 4c444f19cf
commit 8d43638db1
13 changed files with 262 additions and 43 deletions

View File

@@ -14,9 +14,12 @@
#endif
#include <wx/objstrm.h>
#include <wx/datstrm.h>
#include <wx/list.h>
#include <wx/hash.h>
#include "sercore.h"
IMPLEMENT_SERIAL_CLASS(wxList,wxObject)
IMPLEMENT_SERIAL_CLASS(wxList, wxObject)
IMPLEMENT_SERIAL_CLASS(wxHashTable, wxObject)
void WXSERIAL(wxList)::StoreObject(wxObjectOutputStream& s)
{
@@ -62,9 +65,43 @@ void WXSERIAL(wxList)::LoadObject(wxObjectInputStream& s)
if (list->key_type == wxKEY_INTEGER) {
for (i=0;i<number;i++)
list->Append( data_s.Read32(), s.GetChild(i) );
list->Append( data_s.Read32(), s.GetChild() );
} else {
for (i=0;i<number;i++)
list->Append( data_s.ReadString(), s.GetChild(i) );
list->Append( data_s.ReadString(), s.GetChild() );
}
}
// ----------------------------------------------------------------------------
void WXSERIAL(wxHashTable)::StoreObject(wxObjectOutputStream& s)
{
wxHashTable *table = (wxHashTable *)Object();
int i;
if (s.FirstStage()) {
for (i=0;i<table->n;i++)
s.AddChild(table->hash_table[i]);
return;
}
wxDataOutputStream data_s(s);
data_s.Write8(table->key_type);
data_s.Write32(table->n);
}
void WXSERIAL(wxHashTable)::LoadObject(wxObjectInputStream& s)
{
wxHashTable *table = (wxHashTable *)Object();
wxDataInputStream data_s(s);
int i, key, n;
key = data_s.Read8();
n = data_s.Read32();
table->Create(key, n);
for (i=0;i<n;i++)
table->hash_table[i] = (wxList *)s.GetChild();
}