From 799ea01170e831c212320b0cb3038a91785e4789 Mon Sep 17 00:00:00 2001 From: Gilles Depeyrot Date: Mon, 7 Jan 2002 21:52:28 +0000 Subject: [PATCH] implement out-of-line destructors where needed instead of using __DARWIN__ specific conditional compilation git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13447 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/app.h | 6 +----- include/wx/choice.h | 5 +---- include/wx/control.h | 6 ++---- include/wx/ctrlsub.h | 5 +---- include/wx/font.h | 4 +--- include/wx/frame.h | 4 +--- include/wx/gauge.h | 5 ++--- include/wx/geometry.h | 4 +--- include/wx/list.h | 3 +-- include/wx/listbox.h | 4 +--- include/wx/popupwin.h | 4 +--- include/wx/statbmp.h | 4 +--- include/wx/timer.h | 4 +--- include/wx/toplevel.h | 5 +---- src/common/appcmn.cpp | 5 +++++ src/common/bmpbase.cpp | 2 -- src/common/choiccmn.cpp | 5 +++++ src/common/ctrlcmn.cpp | 10 ++++++++++ src/common/ctrlsub.cpp | 5 +++++ src/common/fontcmn.cpp | 5 +++++ src/common/framecmn.cpp | 5 +++++ src/common/gaugecmn.cpp | 5 +++++ src/common/gdicmn.cpp | 2 +- src/common/lboxcmn.cpp | 5 +++++ src/common/popupcmn.cpp | 5 +++++ src/common/sizer.cpp | 14 +++++++------- src/common/timercmn.cpp | 5 +++++ src/common/toplvcmn.cpp | 5 +++++ 28 files changed, 84 insertions(+), 57 deletions(-) diff --git a/include/wx/app.h b/include/wx/app.h index 4e562c5968..9c76ed5d7e 100644 --- a/include/wx/app.h +++ b/include/wx/app.h @@ -88,6 +88,7 @@ class WXDLLEXPORT wxAppBase : public wxEvtHandler { public: wxAppBase(); + virtual ~wxAppBase(); // the virtual functions which may/must be overridden in the derived class // ----------------------------------------------------------------------- @@ -326,11 +327,6 @@ public: static wxAppInitializerFunction GetInitializerFunction() { return m_appInitFn; } - // needed to avoid link errors -#ifdef __DARWIN__ - virtual ~wxAppBase() { } -#endif - // process all events in the wxPendingEvents list virtual void ProcessPendingEvents(); diff --git a/include/wx/choice.h b/include/wx/choice.h index 6110e4b35b..6664996a0b 100644 --- a/include/wx/choice.h +++ b/include/wx/choice.h @@ -38,9 +38,7 @@ class WXDLLEXPORT wxChoiceBase : public wxControlWithItems { public: // all generic methods are in wxControlWithItems -#ifdef __DARWIN__ - virtual ~wxChoiceBase() {} -#endif + virtual ~wxChoiceBase(); // single selection logic virtual void SetSelection(int n) = 0; @@ -56,7 +54,6 @@ public: // emulate selecting the item event.GetInt() void Command(wxCommandEvent& event); - }; // ---------------------------------------------------------------------------- diff --git a/include/wx/control.h b/include/wx/control.h index 549f98d183..24338b06b5 100644 --- a/include/wx/control.h +++ b/include/wx/control.h @@ -33,6 +33,8 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxControlNameStr; class WXDLLEXPORT wxControlBase : public wxWindow { public: + virtual ~wxControlBase(); + // Create() function adds the validator parameter bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, @@ -48,10 +50,6 @@ public: // get the control alignment (left/right/centre, top/bottom/centre) int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; } -#ifdef __DARWIN__ - virtual ~wxControlBase() { } -#endif - protected: // creates the control (calls wxWindowBase::CreateBase inside) and adds it // to the list of parents children diff --git a/include/wx/ctrlsub.h b/include/wx/ctrlsub.h index 0fa00d4e64..ac07defc27 100644 --- a/include/wx/ctrlsub.h +++ b/include/wx/ctrlsub.h @@ -32,6 +32,7 @@ class WXDLLEXPORT wxItemContainer { public: wxItemContainer() { m_clientDataItemsType = wxClientData_None; } + virtual ~wxItemContainer(); // adding items // ------------ @@ -86,10 +87,6 @@ public: int Number() const { return GetCount(); } #endif // WXWIN_COMPATIBILITY_2_2 -#ifdef __DARWIN__ - virtual ~wxItemContainer() { } -#endif - protected: virtual int DoAppend(const wxString& item) = 0; diff --git a/include/wx/font.h b/include/wx/font.h index f324d115c9..7eac1f1dc5 100644 --- a/include/wx/font.h +++ b/include/wx/font.h @@ -78,9 +78,7 @@ class WXDLLEXPORT wxFontBase : public wxGDIObject { public: // creator function -#ifdef __DARWIN__ - virtual ~wxFontBase() { } -#endif + virtual ~wxFontBase(); // from the font components static wxFont *New( diff --git a/include/wx/frame.h b/include/wx/frame.h index 2fa2d92fec..ac7e48f61c 100644 --- a/include/wx/frame.h +++ b/include/wx/frame.h @@ -54,9 +54,7 @@ class WXDLLEXPORT wxFrameBase : public wxTopLevelWindow public: // construction wxFrameBase(); -#ifdef __DARWIN__ - virtual ~wxFrameBase() { } -#endif + virtual ~wxFrameBase(); wxFrame *New(wxWindow *parent, wxWindowID id, diff --git a/include/wx/gauge.h b/include/wx/gauge.h index 801dab1943..5f2634a606 100644 --- a/include/wx/gauge.h +++ b/include/wx/gauge.h @@ -31,9 +31,8 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxGaugeNameStr; class WXDLLEXPORT wxGaugeBase : public wxControl { public: -#ifdef __DARWIN__ - virtual ~wxGaugeBase() { } -#endif + virtual ~wxGaugeBase(); + bool Create(wxWindow *parent, wxWindowID id, int range, diff --git a/include/wx/geometry.h b/include/wx/geometry.h index 7ff4213e3b..d8d0a8a226 100644 --- a/include/wx/geometry.h +++ b/include/wx/geometry.h @@ -31,9 +31,7 @@ #ifdef __WXMSW__ #define wxMulDivInt32( a , b , c ) ::MulDiv( a , b , c ) #elif defined( __WXMAC__ ) - #ifndef __DARWIN__ - #include "Math64.h" - #endif + #include "Math64.h" #define wxMulDivInt32( a , b , c ) S32Set( S64Div( S64Multiply( S64Set(a) , S64Set(b) ) , S64Set(c) ) ) #else #define wxMulDivInt32( a , b , c ) ((wxInt32)((a)*(((wxDouble)b)/((wxDouble)c)))) diff --git a/include/wx/list.h b/include/wx/list.h index ef40e6d6f1..477e4fc48d 100644 --- a/include/wx/list.h +++ b/include/wx/list.h @@ -493,9 +493,8 @@ class WXDLLEXPORT wxList : public wxObjectList { public: wxList(int key_type = wxKEY_NONE) : wxObjectList((wxKeyType)key_type) { } -#ifdef __DARWIN__ + // this destructor is required for Darwin ~wxList() { } -#endif wxList& operator=(const wxList& list) { return (wxList&)wxListBase::operator=(list); } diff --git a/include/wx/listbox.h b/include/wx/listbox.h index afe6348038..23f3100c53 100644 --- a/include/wx/listbox.h +++ b/include/wx/listbox.h @@ -45,9 +45,7 @@ class WXDLLEXPORT wxListBoxBase : public wxControlWithItems public: // all generic methods are in wxControlWithItems, except for the following // ones which are not yet implemented by wxChoice/wxCombobox -#ifdef __DARWIN__ - virtual ~wxListBoxBase() { } -#endif + virtual ~wxListBoxBase(); void Insert(const wxString& item, int pos) { DoInsert(item, pos); } diff --git a/include/wx/popupwin.h b/include/wx/popupwin.h index 3d9bb5e966..55862dea2d 100644 --- a/include/wx/popupwin.h +++ b/include/wx/popupwin.h @@ -28,9 +28,7 @@ class WXDLLEXPORT wxPopupWindowBase : public wxWindow { public: wxPopupWindowBase() { } -#ifdef __DARWIN__ - virtual ~wxPopupWindowBase() { } -#endif + virtual ~wxPopupWindowBase(); // create the popup window // diff --git a/include/wx/statbmp.h b/include/wx/statbmp.h index 93f26e7924..9f90791f5b 100644 --- a/include/wx/statbmp.h +++ b/include/wx/statbmp.h @@ -30,9 +30,7 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBitmapNameStr; class WXDLLEXPORT wxStaticBitmapBase : public wxControl { public: -#ifdef __DARWIN__ - ~wxStaticBitmapBase() { } -#endif + virtual ~wxStaticBitmapBase(); // our interface virtual void SetIcon(const wxIcon& icon) = 0; diff --git a/include/wx/timer.h b/include/wx/timer.h index f835029b3c..b5ce8d830c 100644 --- a/include/wx/timer.h +++ b/include/wx/timer.h @@ -49,9 +49,7 @@ public: void SetOwner(wxEvtHandler *owner, int id = -1) { m_owner = owner; m_idTimer = id; } -#ifdef __DARWIN__ - virtual ~wxTimerBase() { } -#endif + virtual ~wxTimerBase(); // working with the timer // ---------------------- diff --git a/include/wx/toplevel.h b/include/wx/toplevel.h index ce0ec8aece..c07f0232bd 100644 --- a/include/wx/toplevel.h +++ b/include/wx/toplevel.h @@ -74,10 +74,7 @@ class WXDLLEXPORT wxTopLevelWindowBase : public wxWindow public: // construction wxTopLevelWindowBase(); - -#ifdef __DARWIN__ - virtual ~wxTopLevelWindowBase() {} -#endif + virtual ~wxTopLevelWindowBase(); // top level wnd state // -------------------- diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index 59e2ef34c6..c3461c2934 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -76,6 +76,11 @@ wxAppBase::wxAppBase() #endif // wxUSE_GUI } +wxAppBase::~wxAppBase() +{ + // this destructor is required for Darwin +} + #if wxUSE_GUI bool wxAppBase::OnInitGui() { diff --git a/src/common/bmpbase.cpp b/src/common/bmpbase.cpp index 8715e67d10..bc47df63a5 100644 --- a/src/common/bmpbase.cpp +++ b/src/common/bmpbase.cpp @@ -109,8 +109,6 @@ void wxBitmapBase::CleanUpHandlers() } } - - class wxBitmapBaseModule: public wxModule { DECLARE_DYNAMIC_CLASS(wxBitmapBaseModule) diff --git a/src/common/choiccmn.cpp b/src/common/choiccmn.cpp index 06345dbdc6..de1d8431a9 100644 --- a/src/common/choiccmn.cpp +++ b/src/common/choiccmn.cpp @@ -38,6 +38,11 @@ // implementation // ============================================================================ +wxChoiceBase::~wxChoiceBase() +{ + // this destructor is required for Darwin +} + // ---------------------------------------------------------------------------- // selection // ---------------------------------------------------------------------------- diff --git a/src/common/ctrlcmn.cpp b/src/common/ctrlcmn.cpp index 97ea795e57..a61beaa16c 100644 --- a/src/common/ctrlcmn.cpp +++ b/src/common/ctrlcmn.cpp @@ -45,6 +45,11 @@ // implementation // ============================================================================ +wxControlBase::~wxControlBase() +{ + // this destructor is required for Darwin +} + bool wxControlBase::Create(wxWindow *parent, wxWindowID id, const wxPoint &pos, @@ -125,6 +130,11 @@ void wxControlBase::InitCommandEvent(wxCommandEvent& event) const #if wxUSE_STATBMP +wxStaticBitmapBase::~wxStaticBitmapBase() +{ + // this destructor is required for Darwin +} + wxSize wxStaticBitmapBase::DoGetBestClientSize() const { wxBitmap bmp = GetBitmap(); diff --git a/src/common/ctrlsub.cpp b/src/common/ctrlsub.cpp index 1d8421d728..1c7e18ea27 100644 --- a/src/common/ctrlsub.cpp +++ b/src/common/ctrlsub.cpp @@ -38,6 +38,11 @@ // implementation // ============================================================================ +wxItemContainer::~wxItemContainer() +{ + // this destructor is required for Darwin +} + // ---------------------------------------------------------------------------- // selection // ---------------------------------------------------------------------------- diff --git a/src/common/fontcmn.cpp b/src/common/fontcmn.cpp index 94b9bab49b..938e9259fd 100644 --- a/src/common/fontcmn.cpp +++ b/src/common/fontcmn.cpp @@ -49,6 +49,11 @@ wxFontEncoding wxFontBase::ms_encodingDefault = wxFONTENCODING_SYSTEM; +wxFontBase::~wxFontBase() +{ + // this destructor is required for Darwin +} + /* static */ wxFont *wxFontBase::New(int size, int family, diff --git a/src/common/framecmn.cpp b/src/common/framecmn.cpp index 7b067ddf0d..544189a24c 100644 --- a/src/common/framecmn.cpp +++ b/src/common/framecmn.cpp @@ -78,6 +78,11 @@ wxFrameBase::wxFrameBase() #endif // wxUSE_STATUSBAR } +wxFrameBase::~wxFrameBase() +{ + // this destructor is required for Darwin +} + wxFrame *wxFrameBase::New(wxWindow *parent, wxWindowID id, const wxString& title, diff --git a/src/common/gaugecmn.cpp b/src/common/gaugecmn.cpp index 585f8e6f68..eeee356908 100644 --- a/src/common/gaugecmn.cpp +++ b/src/common/gaugecmn.cpp @@ -39,6 +39,11 @@ // implementation // ============================================================================ +wxGaugeBase::~wxGaugeBase() +{ + // this destructor is required for Darwin +} + // ---------------------------------------------------------------------------- // wxGauge creation // ---------------------------------------------------------------------------- diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index d33e03f739..b881532410 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -623,7 +623,7 @@ wxBrushList::~wxBrushList () { wxBrush *brush = (wxBrush *) node->Data (); wxNode *next = node->Next (); - if (brush->GetVisible()) + if (brush && brush->GetVisible()) delete brush; node = next; } diff --git a/src/common/lboxcmn.cpp b/src/common/lboxcmn.cpp index 39e70a027c..55ab6ade5e 100644 --- a/src/common/lboxcmn.cpp +++ b/src/common/lboxcmn.cpp @@ -38,6 +38,11 @@ // implementation // ============================================================================ +wxListBoxBase::~wxListBoxBase() +{ + // this destructor is required for Darwin +} + // ---------------------------------------------------------------------------- // adding items // ---------------------------------------------------------------------------- diff --git a/src/common/popupcmn.cpp b/src/common/popupcmn.cpp index ff6d0c0818..b06a532c7a 100644 --- a/src/common/popupcmn.cpp +++ b/src/common/popupcmn.cpp @@ -108,6 +108,11 @@ END_EVENT_TABLE() // wxPopupWindowBase // ---------------------------------------------------------------------------- +wxPopupWindowBase::~wxPopupWindowBase() +{ + // this destructor is required for Darwin +} + bool wxPopupWindowBase::Create(wxWindow* WXUNUSED(parent), int WXUNUSED(flags)) { return TRUE; diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index 410aac2bd8..d11c537e32 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -27,16 +27,16 @@ //--------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxSizerItem, wxObject); -IMPLEMENT_ABSTRACT_CLASS(wxSizer, wxObject); -IMPLEMENT_ABSTRACT_CLASS(wxGridSizer, wxSizer); -IMPLEMENT_ABSTRACT_CLASS(wxFlexGridSizer, wxGridSizer); -IMPLEMENT_ABSTRACT_CLASS(wxBoxSizer, wxSizer); +IMPLEMENT_ABSTRACT_CLASS(wxSizerItem, wxObject) +IMPLEMENT_ABSTRACT_CLASS(wxSizer, wxObject) +IMPLEMENT_ABSTRACT_CLASS(wxGridSizer, wxSizer) +IMPLEMENT_ABSTRACT_CLASS(wxFlexGridSizer, wxGridSizer) +IMPLEMENT_ABSTRACT_CLASS(wxBoxSizer, wxSizer) #if wxUSE_STATBOX -IMPLEMENT_ABSTRACT_CLASS(wxStaticBoxSizer, wxBoxSizer); +IMPLEMENT_ABSTRACT_CLASS(wxStaticBoxSizer, wxBoxSizer) #endif #if wxUSE_NOTEBOOK -IMPLEMENT_ABSTRACT_CLASS(wxNotebookSizer, wxSizer); +IMPLEMENT_ABSTRACT_CLASS(wxNotebookSizer, wxSizer) #endif //--------------------------------------------------------------------------- diff --git a/src/common/timercmn.cpp b/src/common/timercmn.cpp index 3ff1adf9d1..b9f1269ec0 100644 --- a/src/common/timercmn.cpp +++ b/src/common/timercmn.cpp @@ -110,6 +110,11 @@ #if wxUSE_GUI && wxUSE_TIMER +wxTimerBase::~wxTimerBase() +{ + // this destructor is required for Darwin +} + void wxTimerBase::Notify() { // the base class version generates an event if it has owner - which it diff --git a/src/common/toplvcmn.cpp b/src/common/toplvcmn.cpp index ea6992d636..87a63e8648 100644 --- a/src/common/toplvcmn.cpp +++ b/src/common/toplvcmn.cpp @@ -60,6 +60,11 @@ wxTopLevelWindowBase::wxTopLevelWindowBase() { } +wxTopLevelWindowBase::~wxTopLevelWindowBase() +{ + // this destructor is required for Darwin +} + bool wxTopLevelWindowBase::Destroy() { // delayed destruction: the frame will be deleted during the next idle -- 2.45.2