diff --git a/include/wx/stream.h b/include/wx/stream.h index 13ee1dce42..a2f1c0f89b 100644 --- a/include/wx/stream.h +++ b/include/wx/stream.h @@ -91,8 +91,15 @@ class WXDLLEXPORT wxInputStream { wxInputStream& operator>>(wxString& line); wxInputStream& operator>>(char& c); wxInputStream& operator>>(short& i); + wxInputStream& operator>>(int& i); wxInputStream& operator>>(long& i); wxInputStream& operator>>(float& i); + wxInputStream& operator>>(wxObject *& obj); + + wxInputStream& operator>>(unsigned char& c) { return operator>>((char&)c); } + wxInputStream& operator>>(unsigned short& i) { return operator>>((short&)i); } + wxInputStream& operator>>(unsigned int& i) { return operator>>((int&)i); } + wxInputStream& operator>>(unsigned long& i) { return operator>>((long&)i); } wxInputStream& operator>>( __wxInputManip func) { return func(*this); } protected: @@ -136,13 +143,13 @@ class WXDLLEXPORT wxOutputStream { wxOutputStream& operator<<(int i); wxOutputStream& operator<<(long i); wxOutputStream& operator<<(double f); + wxOutputStream& operator<<(wxObject& obj); wxOutputStream& operator<<(float f) { return operator<<((double)f); } wxOutputStream& operator<<(unsigned char c) { return operator<<((char)c); } wxOutputStream& operator<<(unsigned short i) { return operator<<((short)i); } wxOutputStream& operator<<(unsigned int i) { return operator<<((int)i); } wxOutputStream& operator<<(unsigned long i) { return operator<<((long)i); } - wxOutputStream& operator<<( __wxOutputManip func) { return func(*this); } protected: diff --git a/samples/thread/test.cpp b/samples/thread/test.cpp index 3d7e70edc7..47149b62a7 100644 --- a/samples/thread/test.cpp +++ b/samples/thread/test.cpp @@ -35,6 +35,8 @@ class MyApp: public wxApp bool OnInit(void); }; +wxMutex text_mutex; + WX_DEFINE_ARRAY(wxThread *,wxArrayThread); // Define a new frame type @@ -83,7 +85,9 @@ void *MyThread::Entry() while (1) { TestDestroy(); + text_mutex.Lock(); m_frame->m_txtctrl->WriteText(text); + text_mutex.UnLock(); wxSleep(1); } diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp index 4f638aac53..7a76f087f6 100644 --- a/src/common/dynlib.cpp +++ b/src/common/dynlib.cpp @@ -26,6 +26,10 @@ #include #endif +#ifdef __WINDOWS__ +#include +#endif + // --------------------------------------------------------------------------- // Global variables // --------------------------------------------------------------------------- @@ -59,7 +63,12 @@ wxLibrary::~wxLibrary() else delete m_liblist; +#ifdef linux dlclose(m_handle); +#endif +#ifdef __WINDOWS__ + FreeLibrary((HMODULE)m_handle); +#endif } } @@ -71,8 +80,12 @@ wxObject *wxLibrary::CreateObject(const wxString& name) void *wxLibrary::GetSymbol(const wxString& symbname) { #ifdef linux - return dlsym(m_handle, symbname.GetData()); + return dlsym(m_handle, WXSTRINGCAST symbname); #endif +#ifdef __WINDOWS__ + return GetProcAddress(m_handle, WXSTRINGCAST symbname); +#endif + return NULL; } // --------------------------------------------------------------------------- @@ -105,21 +118,24 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name) return ((wxLibrary *)node->Data()); #ifdef linux - lib_name.Prepend("./lib"); + lib_name.Prepend("lib"); lib_name += ".so"; printf("lib_name = %s\n", WXSTRINGCAST lib_name); - void *handle = dlopen(lib_name.GetData(), RTLD_LAZY); - - printf("handle = %x\n", handle); - lib = new wxLibrary(handle); + void *handle = dlopen(WXSTRINGCAST lib_name, RTLD_LAZY); + if (!handle) + return NULL; #endif #ifdef __WINDOWS__ lib_name += ".dll"; + HMODULE handle = LoadLibrary(lib_name); + if (!handle) + return NULL; #endif + lib = new wxLibrary((void *)handle); m_loaded.Append(name.GetData(), lib); return lib; diff --git a/src/common/stream.cpp b/src/common/stream.cpp index 66538c9ddd..44226e5721 100644 --- a/src/common/stream.cpp +++ b/src/common/stream.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #ifdef __BORLANDC__ #pragma hdrstop @@ -270,6 +271,15 @@ wxInputStream& wxInputStream::operator>>(short& i) return *this; } +wxInputStream& wxInputStream::operator>>(int& i) +{ + long l; + + *this >> l; + i = (short)l; + return *this; +} + wxInputStream& wxInputStream::operator>>(long& i) { /* I only implemented a simple integer parser */ @@ -341,6 +351,13 @@ wxInputStream& wxInputStream::operator>>(float& f) return *this; } +wxInputStream& wxInputStream::operator>>(wxObject *& obj) +{ + wxObjectInputStream obj_s(*this); + obj = obj_s.LoadObject(); + return *this; +} + off_t wxInputStream::SeekI(off_t pos, wxSeekMode mode) { off_t ret_off; @@ -504,6 +521,13 @@ wxOutputStream& wxOutputStream::operator<<(double f) return Write(strfloat, strfloat.Len()); } +wxOutputStream& wxOutputStream::operator<<(wxObject& obj) +{ + wxObjectOutputStream obj_s(*this); + obj_s.SaveObject(obj); + return *this; +} + // ---------------------------------------------------------------------------- // wxFilterInputStream // ---------------------------------------------------------------------------- diff --git a/utils/serialize/sercore.cpp b/utils/serialize/sercore.cpp index dbd55e2510..8c83acbe02 100644 --- a/utils/serialize/sercore.cpp +++ b/utils/serialize/sercore.cpp @@ -1,3 +1,14 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 diff --git a/utils/serialize/sercore.h b/utils/serialize/sercore.h index af3d016824..676c04a449 100644 --- a/utils/serialize/sercore.h +++ b/utils/serialize/sercore.h @@ -1,3 +1,14 @@ +///////////////////////////////////////////////////////////////////////////// +// 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__ diff --git a/utils/serialize/serctrl.cpp b/utils/serialize/serctrl.cpp index 59aabe8f7f..022f940d76 100644 --- a/utils/serialize/serctrl.cpp +++ b/utils/serialize/serctrl.cpp @@ -1,3 +1,14 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 diff --git a/utils/serialize/serctrl.h b/utils/serialize/serctrl.h index 1f922cf4b6..d2eeb82449 100644 --- a/utils/serialize/serctrl.h +++ b/utils/serialize/serctrl.h @@ -1,3 +1,14 @@ +///////////////////////////////////////////////////////////////////////////// +// 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__ diff --git a/utils/serialize/serext.cpp b/utils/serialize/serext.cpp index ce8c34d1fb..da6d92785a 100644 --- a/utils/serialize/serext.cpp +++ b/utils/serialize/serext.cpp @@ -1,3 +1,14 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 diff --git a/utils/serialize/serext.h b/utils/serialize/serext.h index f1d36fbbc6..5856e50edd 100644 --- a/utils/serialize/serext.h +++ b/utils/serialize/serext.h @@ -1,3 +1,14 @@ +///////////////////////////////////////////////////////////////////////////// +// 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__ diff --git a/utils/serialize/sergdi.cpp b/utils/serialize/sergdi.cpp index a734234303..e76c555ffc 100644 --- a/utils/serialize/sergdi.cpp +++ b/utils/serialize/sergdi.cpp @@ -1,3 +1,14 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 diff --git a/utils/serialize/sergdi.h b/utils/serialize/sergdi.h index 1ab04142b2..98a3957ac0 100644 --- a/utils/serialize/sergdi.h +++ b/utils/serialize/sergdi.h @@ -1,3 +1,14 @@ +///////////////////////////////////////////////////////////////////////////// +// 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__ diff --git a/utils/serialize/sermain.cpp b/utils/serialize/sermain.cpp index 0e2a730220..95194106fc 100644 --- a/utils/serialize/sermain.cpp +++ b/utils/serialize/sermain.cpp @@ -1,3 +1,18 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 #include diff --git a/utils/serialize/serwnd.cpp b/utils/serialize/serwnd.cpp index 52914a0d89..e9143391f3 100644 --- a/utils/serialize/serwnd.cpp +++ b/utils/serialize/serwnd.cpp @@ -3,9 +3,9 @@ // Purpose: Serialization: wxWindow classes // Author: Guilhem Lavaux // Modified by: -// Created: 11/07/98 +// Created: July 1998 // RCS-ID: $Id$ -// Copyright: (c) Guilhem Lavaux +// Copyright: (c) 1998 Guilhem Lavaux // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "serwnd.h" @@ -27,13 +28,12 @@ IMPLEMENT_SERIAL_CLASS(wxWindow, wxObject) IMPLEMENT_SERIAL_CLASS(wxIndividualLayoutConstraint, wxObject) IMPLEMENT_SERIAL_CLASS(wxLayoutConstraints, 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_ALIAS_SERIAL_CLASS(wxPanel, wxWindow) - void WXSERIAL(wxWindow)::StoreObject(wxObjectOutputStream& s) { wxWindow *win_object = (wxWindow *)Object(); @@ -322,3 +322,16 @@ void WXSERIAL(wxMenuItem)::LoadObject(wxObjectInputStream& s) item->Check( data_s.Read8() ); item->SetSubMenu( (wxMenu *)s.GetChild(0) ); } + +void WXSERIAL(wxPanel)::StoreObject(wxObjectOutputStream& s) +{ + WXSERIAL(wxWindow)::StoreObject(s); +} + +void WXSERIAL(wxPanel)::LoadObject(wxObjectInputStream& s) +{ + WXSERIAL(wxWindow)::LoadObject(s); + + ((wxPanel *)Object())->Create(m_parent, m_id, wxPoint(m_x, m_y), + wxSize(m_w, m_h), m_style, m_name); +} diff --git a/utils/serialize/serwnd.h b/utils/serialize/serwnd.h index b195ec300a..943374c3f7 100644 --- a/utils/serialize/serwnd.h +++ b/utils/serialize/serwnd.h @@ -5,7 +5,7 @@ // Modified by: // Created: July 1998 // RCS-ID: $Id$ -// Copyright: (c) Guilhem Lavaux +// Copyright: (c) 1998 Guilhem Lavaux // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// @@ -41,7 +41,7 @@ class WXSERIAL(wxWindow) : public WXSERIAL(wxObject) DECLARE_SERIAL_CLASS(wxIndividualLayoutConstraint, wxObject) DECLARE_SERIAL_CLASS(wxLayoutConstraints, wxObject) DECLARE_SERIAL_CLASS(wxFrame, wxWindow) -//DECLARE_SERIAL_CLASS(wxPanel, wxWindow) +DECLARE_SERIAL_CLASS(wxPanel, wxWindow) //DECLARE_SERIAL_CLASS(wxDialog, wxWindow) DECLARE_SERIAL_CLASS(wxMenuBar, wxWindow) DECLARE_SERIAL_CLASS(wxMenuItem, wxObject)