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
This commit is contained in:
Gilles Depeyrot
2002-01-07 21:52:28 +00:00
parent 0926b2fcc2
commit 799ea01170
28 changed files with 84 additions and 57 deletions

View File

@@ -88,6 +88,7 @@ class WXDLLEXPORT wxAppBase : public wxEvtHandler
{ {
public: public:
wxAppBase(); wxAppBase();
virtual ~wxAppBase();
// the virtual functions which may/must be overridden in the derived class // the virtual functions which may/must be overridden in the derived class
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@@ -326,11 +327,6 @@ public:
static wxAppInitializerFunction GetInitializerFunction() static wxAppInitializerFunction GetInitializerFunction()
{ return m_appInitFn; } { return m_appInitFn; }
// needed to avoid link errors
#ifdef __DARWIN__
virtual ~wxAppBase() { }
#endif
// process all events in the wxPendingEvents list // process all events in the wxPendingEvents list
virtual void ProcessPendingEvents(); virtual void ProcessPendingEvents();

View File

@@ -38,9 +38,7 @@ class WXDLLEXPORT wxChoiceBase : public wxControlWithItems
{ {
public: public:
// all generic methods are in wxControlWithItems // all generic methods are in wxControlWithItems
#ifdef __DARWIN__ virtual ~wxChoiceBase();
virtual ~wxChoiceBase() {}
#endif
// single selection logic // single selection logic
virtual void SetSelection(int n) = 0; virtual void SetSelection(int n) = 0;
@@ -56,7 +54,6 @@ public:
// emulate selecting the item event.GetInt() // emulate selecting the item event.GetInt()
void Command(wxCommandEvent& event); void Command(wxCommandEvent& event);
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -33,6 +33,8 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxControlNameStr;
class WXDLLEXPORT wxControlBase : public wxWindow class WXDLLEXPORT wxControlBase : public wxWindow
{ {
public: public:
virtual ~wxControlBase();
// Create() function adds the validator parameter // Create() function adds the validator parameter
bool Create(wxWindow *parent, wxWindowID id, bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
@@ -48,10 +50,6 @@ public:
// get the control alignment (left/right/centre, top/bottom/centre) // get the control alignment (left/right/centre, top/bottom/centre)
int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; } int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; }
#ifdef __DARWIN__
virtual ~wxControlBase() { }
#endif
protected: protected:
// creates the control (calls wxWindowBase::CreateBase inside) and adds it // creates the control (calls wxWindowBase::CreateBase inside) and adds it
// to the list of parents children // to the list of parents children

View File

@@ -32,6 +32,7 @@ class WXDLLEXPORT wxItemContainer
{ {
public: public:
wxItemContainer() { m_clientDataItemsType = wxClientData_None; } wxItemContainer() { m_clientDataItemsType = wxClientData_None; }
virtual ~wxItemContainer();
// adding items // adding items
// ------------ // ------------
@@ -86,10 +87,6 @@ public:
int Number() const { return GetCount(); } int Number() const { return GetCount(); }
#endif // WXWIN_COMPATIBILITY_2_2 #endif // WXWIN_COMPATIBILITY_2_2
#ifdef __DARWIN__
virtual ~wxItemContainer() { }
#endif
protected: protected:
virtual int DoAppend(const wxString& item) = 0; virtual int DoAppend(const wxString& item) = 0;

View File

@@ -78,9 +78,7 @@ class WXDLLEXPORT wxFontBase : public wxGDIObject
{ {
public: public:
// creator function // creator function
#ifdef __DARWIN__ virtual ~wxFontBase();
virtual ~wxFontBase() { }
#endif
// from the font components // from the font components
static wxFont *New( static wxFont *New(

View File

@@ -54,9 +54,7 @@ class WXDLLEXPORT wxFrameBase : public wxTopLevelWindow
public: public:
// construction // construction
wxFrameBase(); wxFrameBase();
#ifdef __DARWIN__ virtual ~wxFrameBase();
virtual ~wxFrameBase() { }
#endif
wxFrame *New(wxWindow *parent, wxFrame *New(wxWindow *parent,
wxWindowID id, wxWindowID id,

View File

@@ -31,9 +31,8 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxGaugeNameStr;
class WXDLLEXPORT wxGaugeBase : public wxControl class WXDLLEXPORT wxGaugeBase : public wxControl
{ {
public: public:
#ifdef __DARWIN__ virtual ~wxGaugeBase();
virtual ~wxGaugeBase() { }
#endif
bool Create(wxWindow *parent, bool Create(wxWindow *parent,
wxWindowID id, wxWindowID id,
int range, int range,

View File

@@ -31,9 +31,7 @@
#ifdef __WXMSW__ #ifdef __WXMSW__
#define wxMulDivInt32( a , b , c ) ::MulDiv( a , b , c ) #define wxMulDivInt32( a , b , c ) ::MulDiv( a , b , c )
#elif defined( __WXMAC__ ) #elif defined( __WXMAC__ )
#ifndef __DARWIN__ #include "Math64.h"
#include "Math64.h"
#endif
#define wxMulDivInt32( a , b , c ) S32Set( S64Div( S64Multiply( S64Set(a) , S64Set(b) ) , S64Set(c) ) ) #define wxMulDivInt32( a , b , c ) S32Set( S64Div( S64Multiply( S64Set(a) , S64Set(b) ) , S64Set(c) ) )
#else #else
#define wxMulDivInt32( a , b , c ) ((wxInt32)((a)*(((wxDouble)b)/((wxDouble)c)))) #define wxMulDivInt32( a , b , c ) ((wxInt32)((a)*(((wxDouble)b)/((wxDouble)c))))

View File

@@ -493,9 +493,8 @@ class WXDLLEXPORT wxList : public wxObjectList
{ {
public: public:
wxList(int key_type = wxKEY_NONE) : wxObjectList((wxKeyType)key_type) { } wxList(int key_type = wxKEY_NONE) : wxObjectList((wxKeyType)key_type) { }
#ifdef __DARWIN__ // this destructor is required for Darwin
~wxList() { } ~wxList() { }
#endif
wxList& operator=(const wxList& list) wxList& operator=(const wxList& list)
{ return (wxList&)wxListBase::operator=(list); } { return (wxList&)wxListBase::operator=(list); }

View File

@@ -45,9 +45,7 @@ class WXDLLEXPORT wxListBoxBase : public wxControlWithItems
public: public:
// all generic methods are in wxControlWithItems, except for the following // all generic methods are in wxControlWithItems, except for the following
// ones which are not yet implemented by wxChoice/wxCombobox // ones which are not yet implemented by wxChoice/wxCombobox
#ifdef __DARWIN__ virtual ~wxListBoxBase();
virtual ~wxListBoxBase() { }
#endif
void Insert(const wxString& item, int pos) void Insert(const wxString& item, int pos)
{ DoInsert(item, pos); } { DoInsert(item, pos); }

View File

@@ -28,9 +28,7 @@ class WXDLLEXPORT wxPopupWindowBase : public wxWindow
{ {
public: public:
wxPopupWindowBase() { } wxPopupWindowBase() { }
#ifdef __DARWIN__ virtual ~wxPopupWindowBase();
virtual ~wxPopupWindowBase() { }
#endif
// create the popup window // create the popup window
// //

View File

@@ -30,9 +30,7 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBitmapNameStr;
class WXDLLEXPORT wxStaticBitmapBase : public wxControl class WXDLLEXPORT wxStaticBitmapBase : public wxControl
{ {
public: public:
#ifdef __DARWIN__ virtual ~wxStaticBitmapBase();
~wxStaticBitmapBase() { }
#endif
// our interface // our interface
virtual void SetIcon(const wxIcon& icon) = 0; virtual void SetIcon(const wxIcon& icon) = 0;

View File

@@ -49,9 +49,7 @@ public:
void SetOwner(wxEvtHandler *owner, int id = -1) void SetOwner(wxEvtHandler *owner, int id = -1)
{ m_owner = owner; m_idTimer = id; } { m_owner = owner; m_idTimer = id; }
#ifdef __DARWIN__ virtual ~wxTimerBase();
virtual ~wxTimerBase() { }
#endif
// working with the timer // working with the timer
// ---------------------- // ----------------------

View File

@@ -74,10 +74,7 @@ class WXDLLEXPORT wxTopLevelWindowBase : public wxWindow
public: public:
// construction // construction
wxTopLevelWindowBase(); wxTopLevelWindowBase();
virtual ~wxTopLevelWindowBase();
#ifdef __DARWIN__
virtual ~wxTopLevelWindowBase() {}
#endif
// top level wnd state // top level wnd state
// -------------------- // --------------------

View File

@@ -76,6 +76,11 @@ wxAppBase::wxAppBase()
#endif // wxUSE_GUI #endif // wxUSE_GUI
} }
wxAppBase::~wxAppBase()
{
// this destructor is required for Darwin
}
#if wxUSE_GUI #if wxUSE_GUI
bool wxAppBase::OnInitGui() bool wxAppBase::OnInitGui()
{ {

View File

@@ -109,8 +109,6 @@ void wxBitmapBase::CleanUpHandlers()
} }
} }
class wxBitmapBaseModule: public wxModule class wxBitmapBaseModule: public wxModule
{ {
DECLARE_DYNAMIC_CLASS(wxBitmapBaseModule) DECLARE_DYNAMIC_CLASS(wxBitmapBaseModule)

View File

@@ -38,6 +38,11 @@
// implementation // implementation
// ============================================================================ // ============================================================================
wxChoiceBase::~wxChoiceBase()
{
// this destructor is required for Darwin
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// selection // selection
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -45,6 +45,11 @@
// implementation // implementation
// ============================================================================ // ============================================================================
wxControlBase::~wxControlBase()
{
// this destructor is required for Darwin
}
bool wxControlBase::Create(wxWindow *parent, bool wxControlBase::Create(wxWindow *parent,
wxWindowID id, wxWindowID id,
const wxPoint &pos, const wxPoint &pos,
@@ -125,6 +130,11 @@ void wxControlBase::InitCommandEvent(wxCommandEvent& event) const
#if wxUSE_STATBMP #if wxUSE_STATBMP
wxStaticBitmapBase::~wxStaticBitmapBase()
{
// this destructor is required for Darwin
}
wxSize wxStaticBitmapBase::DoGetBestClientSize() const wxSize wxStaticBitmapBase::DoGetBestClientSize() const
{ {
wxBitmap bmp = GetBitmap(); wxBitmap bmp = GetBitmap();

View File

@@ -38,6 +38,11 @@
// implementation // implementation
// ============================================================================ // ============================================================================
wxItemContainer::~wxItemContainer()
{
// this destructor is required for Darwin
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// selection // selection
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -49,6 +49,11 @@
wxFontEncoding wxFontBase::ms_encodingDefault = wxFONTENCODING_SYSTEM; wxFontEncoding wxFontBase::ms_encodingDefault = wxFONTENCODING_SYSTEM;
wxFontBase::~wxFontBase()
{
// this destructor is required for Darwin
}
/* static */ /* static */
wxFont *wxFontBase::New(int size, wxFont *wxFontBase::New(int size,
int family, int family,

View File

@@ -78,6 +78,11 @@ wxFrameBase::wxFrameBase()
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
wxFrameBase::~wxFrameBase()
{
// this destructor is required for Darwin
}
wxFrame *wxFrameBase::New(wxWindow *parent, wxFrame *wxFrameBase::New(wxWindow *parent,
wxWindowID id, wxWindowID id,
const wxString& title, const wxString& title,

View File

@@ -39,6 +39,11 @@
// implementation // implementation
// ============================================================================ // ============================================================================
wxGaugeBase::~wxGaugeBase()
{
// this destructor is required for Darwin
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxGauge creation // wxGauge creation
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -623,7 +623,7 @@ wxBrushList::~wxBrushList ()
{ {
wxBrush *brush = (wxBrush *) node->Data (); wxBrush *brush = (wxBrush *) node->Data ();
wxNode *next = node->Next (); wxNode *next = node->Next ();
if (brush->GetVisible()) if (brush && brush->GetVisible())
delete brush; delete brush;
node = next; node = next;
} }

View File

@@ -38,6 +38,11 @@
// implementation // implementation
// ============================================================================ // ============================================================================
wxListBoxBase::~wxListBoxBase()
{
// this destructor is required for Darwin
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// adding items // adding items
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -108,6 +108,11 @@ END_EVENT_TABLE()
// wxPopupWindowBase // wxPopupWindowBase
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxPopupWindowBase::~wxPopupWindowBase()
{
// this destructor is required for Darwin
}
bool wxPopupWindowBase::Create(wxWindow* WXUNUSED(parent), int WXUNUSED(flags)) bool wxPopupWindowBase::Create(wxWindow* WXUNUSED(parent), int WXUNUSED(flags))
{ {
return TRUE; return TRUE;

View File

@@ -27,16 +27,16 @@
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxSizerItem, wxObject); IMPLEMENT_ABSTRACT_CLASS(wxSizerItem, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxSizer, wxObject); IMPLEMENT_ABSTRACT_CLASS(wxSizer, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxGridSizer, wxSizer); IMPLEMENT_ABSTRACT_CLASS(wxGridSizer, wxSizer)
IMPLEMENT_ABSTRACT_CLASS(wxFlexGridSizer, wxGridSizer); IMPLEMENT_ABSTRACT_CLASS(wxFlexGridSizer, wxGridSizer)
IMPLEMENT_ABSTRACT_CLASS(wxBoxSizer, wxSizer); IMPLEMENT_ABSTRACT_CLASS(wxBoxSizer, wxSizer)
#if wxUSE_STATBOX #if wxUSE_STATBOX
IMPLEMENT_ABSTRACT_CLASS(wxStaticBoxSizer, wxBoxSizer); IMPLEMENT_ABSTRACT_CLASS(wxStaticBoxSizer, wxBoxSizer)
#endif #endif
#if wxUSE_NOTEBOOK #if wxUSE_NOTEBOOK
IMPLEMENT_ABSTRACT_CLASS(wxNotebookSizer, wxSizer); IMPLEMENT_ABSTRACT_CLASS(wxNotebookSizer, wxSizer)
#endif #endif
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@@ -110,6 +110,11 @@
#if wxUSE_GUI && wxUSE_TIMER #if wxUSE_GUI && wxUSE_TIMER
wxTimerBase::~wxTimerBase()
{
// this destructor is required for Darwin
}
void wxTimerBase::Notify() void wxTimerBase::Notify()
{ {
// the base class version generates an event if it has owner - which it // the base class version generates an event if it has owner - which it

View File

@@ -60,6 +60,11 @@ wxTopLevelWindowBase::wxTopLevelWindowBase()
{ {
} }
wxTopLevelWindowBase::~wxTopLevelWindowBase()
{
// this destructor is required for Darwin
}
bool wxTopLevelWindowBase::Destroy() bool wxTopLevelWindowBase::Destroy()
{ {
// delayed destruction: the frame will be deleted during the next idle // delayed destruction: the frame will be deleted during the next idle