X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c2dd8380badebac8dc01f8948288235ae91056ed..f9a3f576cccfd2c2296a24d74b05b9543c47fac7:/utils/serialize/serctrl.cpp?ds=inline diff --git a/utils/serialize/serctrl.cpp b/utils/serialize/serctrl.cpp index 7bd86d8f6d..e9e0d56af4 100644 --- a/utils/serialize/serctrl.cpp +++ b/utils/serialize/serctrl.cpp @@ -23,7 +23,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -33,17 +35,25 @@ #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(wxGauge, wxControl) IMPLEMENT_SERIAL_CLASS(wxListBox, wxControl) IMPLEMENT_SERIAL_CLASS(wxNotebook, wxControl) IMPLEMENT_SERIAL_CLASS(wxRadioBox, wxControl) - +IMPLEMENT_SERIAL_CLASS(wxRadioButton, wxControl) IMPLEMENT_SERIAL_CLASS(wxButton, wxControl) IMPLEMENT_SERIAL_CLASS(wxStaticText, wxControl) +IMPLEMENT_SERIAL_CLASS(wxStaticBox, wxControl) + +//----------------------------------------------------------------------------- void WXSERIAL(wxButton)::StoreObject(wxObjectOutputStream& s) { @@ -54,6 +64,9 @@ 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); @@ -61,6 +74,8 @@ void WXSERIAL(wxButton)::LoadObject(wxObjectInputStream& s) m_style, *m_validator, m_name); } +//----------------------------------------------------------------------------- + void WXSERIAL(wxCheckBox)::StoreObject(wxObjectOutputStream& s) { WXSERIAL(wxControl)::StoreObject(s); @@ -76,6 +91,9 @@ void WXSERIAL(wxCheckBox)::LoadObject(wxObjectInputStream& s) { WXSERIAL(wxControl)::LoadObject(s); + if (s.SecondCall()) + return; + wxDataInputStream data_s(s); wxCheckBox *chkbox = (wxCheckBox *)Object(); @@ -85,7 +103,13 @@ void WXSERIAL(wxCheckBox)::LoadObject(wxObjectInputStream& s) 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); @@ -106,10 +130,17 @@ void WXSERIAL(wxSlider)::StoreObject(wxObjectOutputStream& s) 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; @@ -130,7 +161,13 @@ void WXSERIAL(wxSlider)::LoadObject(wxObjectInputStream& s) 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); @@ -146,10 +183,17 @@ void WXSERIAL(wxGauge)::StoreObject(wxObjectOutputStream& s) 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; @@ -163,6 +207,8 @@ void WXSERIAL(wxGauge)::LoadObject(wxObjectInputStream& s) gauge->SetValue( data_s.Read32() ); } +//----------------------------------------------------------------------------- + void WXSERIAL(wxChoice)::StoreObject(wxObjectOutputStream& s) { WXSERIAL(wxControl)::StoreObject(s); @@ -183,6 +229,9 @@ 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(); @@ -194,6 +243,8 @@ void WXSERIAL(wxChoice)::LoadObject(wxObjectInputStream& s) choice->Append( data_s.ReadString() ); } +//----------------------------------------------------------------------------- + void WXSERIAL(wxListBox)::StoreObject(wxObjectOutputStream& s) { WXSERIAL(wxControl)::StoreObject(s); @@ -214,6 +265,9 @@ 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(); @@ -222,49 +276,57 @@ void WXSERIAL(wxListBox)::LoadObject(wxObjectInputStream& s) listbox->Append( data_s.ReadString() ); } +//----------------------------------------------------------------------------- + void WXSERIAL(wxNotebook)::StoreObject(wxObjectOutputStream& s) { wxNotebook *notebook = (wxNotebook *)Object(); wxImageList *imaglist = notebook->GetImageList(); int i, pcount = notebook->GetPageCount(); + WXSERIAL(wxControl)::StoreObject(s); if (s.FirstStage()) { s.AddChild(imaglist); - WXSERIAL(wxControl)::StoreObject(s); return; } wxDataOutputStream data_s(s); data_s.Write8( pcount ); - WXSERIAL(wxControl)::StoreObject(s); for (i=0;iGetPageText(i) ); - } void WXSERIAL(wxNotebook)::LoadObject(wxObjectInputStream& s) { wxNotebook *notebook = (wxNotebook *)Object(); - int i, pcount; + int i; wxImageList *imaglist; - imaglist = (wxImageList *)s.GetChild(0); - s.RemoveChildren(1); - WXSERIAL(wxControl)::LoadObject(s); + if (s.SecondCall()) { + for (i=0;iAddPage( (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); - pcount = data_s.Read8(); - for (i=0;iSetPageText(i, data_s.ReadString() ); + m_pcount = data_s.Read8(); + for (i=0;iGetValue() ); +} + +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); @@ -329,6 +421,9 @@ 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; @@ -346,6 +441,8 @@ void WXSERIAL(wxComboBox)::LoadObject(wxObjectInputStream& s) box->SetValue( data_s.ReadString() ); } +//----------------------------------------------------------------------------- + void WXSERIAL(wxStaticText)::StoreObject(wxObjectOutputStream& s) { WXSERIAL(wxControl)::StoreObject(s); @@ -355,6 +452,27 @@ 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); +}