set m_isBeingDeleted to true (only) in SendDestroyEvent(); call it as early as possible during the window destruction to ensure that destroy event handlers can still access the full window object
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58246 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -35,7 +35,6 @@ public:
|
|||||||
const wxValidator& validator = wxDefaultValidator,
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
const wxString& name = wxControlNameStr);
|
const wxString& name = wxControlNameStr);
|
||||||
|
|
||||||
virtual ~wxControl();
|
|
||||||
|
|
||||||
// Simulates an event
|
// Simulates an event
|
||||||
virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
|
virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
|
||||||
|
@@ -32,7 +32,6 @@ public:
|
|||||||
{
|
{
|
||||||
Create( pParent, vId, rPos, rSize, lStyle, rValidator, rsName );
|
Create( pParent, vId, rPos, rSize, lStyle, rValidator, rsName );
|
||||||
}
|
}
|
||||||
virtual ~wxControl();
|
|
||||||
|
|
||||||
bool Create( wxWindow* pParent
|
bool Create( wxWindow* pParent
|
||||||
,wxWindowID vId
|
,wxWindowID vId
|
||||||
|
@@ -35,7 +35,6 @@ public:
|
|||||||
const wxSize& size = wxDefaultSize, long style = 0,
|
const wxSize& size = wxDefaultSize, long style = 0,
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
const wxString& name = wxControlNameStr);
|
const wxString& name = wxControlNameStr);
|
||||||
virtual ~wxControl();
|
|
||||||
|
|
||||||
// Simulates an event
|
// Simulates an event
|
||||||
virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
|
virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
|
||||||
|
@@ -1402,7 +1402,8 @@ protected:
|
|||||||
void SatisfyConstraints();
|
void SatisfyConstraints();
|
||||||
#endif // wxUSE_CONSTRAINTS
|
#endif // wxUSE_CONSTRAINTS
|
||||||
|
|
||||||
// Send the wxWindowDestroyEvent
|
// Send the wxWindowDestroyEvent if not done yet and sets m_isBeingDeleted
|
||||||
|
// to true
|
||||||
void SendDestroyEvent();
|
void SendDestroyEvent();
|
||||||
|
|
||||||
// returns the main window of composite control; this is the window
|
// returns the main window of composite control; this is the window
|
||||||
|
@@ -2898,7 +2898,7 @@ void wxAuiNotebook::InitNotebook(long style)
|
|||||||
wxAuiNotebook::~wxAuiNotebook()
|
wxAuiNotebook::~wxAuiNotebook()
|
||||||
{
|
{
|
||||||
// Indicate we're deleting pages
|
// Indicate we're deleting pages
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
while ( GetPageCount() > 0 )
|
while ( GetPageCount() > 0 )
|
||||||
DeletePage(0);
|
DeletePage(0);
|
||||||
|
@@ -943,7 +943,6 @@ void wxWindowCocoa::Init()
|
|||||||
m_cocoaNSView = NULL;
|
m_cocoaNSView = NULL;
|
||||||
m_cocoaHider = NULL;
|
m_cocoaHider = NULL;
|
||||||
m_wxCocoaScrollView = NULL;
|
m_wxCocoaScrollView = NULL;
|
||||||
m_isBeingDeleted = false;
|
|
||||||
m_isInPaint = false;
|
m_isInPaint = false;
|
||||||
m_visibleTrackingRectManager = NULL;
|
m_visibleTrackingRectManager = NULL;
|
||||||
}
|
}
|
||||||
|
@@ -209,7 +209,9 @@ wxWindowBase::wxWindowBase()
|
|||||||
// Whether we're using the current theme for this window (wxGTK only for now)
|
// Whether we're using the current theme for this window (wxGTK only for now)
|
||||||
m_themeEnabled = false;
|
m_themeEnabled = false;
|
||||||
|
|
||||||
// VZ: this one shouldn't exist...
|
// This is set to true by SendDestroyEvent() which should be called by the
|
||||||
|
// most derived class to ensure that the destruction event is sent as soon
|
||||||
|
// as possible to allow its handlers to still see the undestroyed window
|
||||||
m_isBeingDeleted = false;
|
m_isBeingDeleted = false;
|
||||||
|
|
||||||
m_freezeCount = 0;
|
m_freezeCount = 0;
|
||||||
@@ -387,6 +389,16 @@ bool wxWindowBase::IsBeingDeleted() const
|
|||||||
|
|
||||||
void wxWindowBase::SendDestroyEvent()
|
void wxWindowBase::SendDestroyEvent()
|
||||||
{
|
{
|
||||||
|
if ( m_isBeingDeleted )
|
||||||
|
{
|
||||||
|
// we could have been already called from a more derived class dtor,
|
||||||
|
// e.g. ~wxTLW calls us and so does ~wxWindow and the latter call
|
||||||
|
// should be simply ignored
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_isBeingDeleted = true;
|
||||||
|
|
||||||
wxWindowDestroyEvent event;
|
wxWindowDestroyEvent event;
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
event.SetId(GetId());
|
event.SetId(GetId());
|
||||||
|
@@ -153,7 +153,7 @@ bool wxNonOwnedWindow::Create(wxWindow *parent,
|
|||||||
|
|
||||||
wxNonOwnedWindow::~wxNonOwnedWindow()
|
wxNonOwnedWindow::~wxNonOwnedWindow()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
// destroy all children before we destroy the underlying DirectFB window,
|
// destroy all children before we destroy the underlying DirectFB window,
|
||||||
// so that if any of them does something with the TLW, it will still work:
|
// so that if any of them does something with the TLW, it will still work:
|
||||||
|
@@ -88,8 +88,6 @@ wxWindowDFB::~wxWindowDFB()
|
|||||||
{
|
{
|
||||||
SendDestroyEvent();
|
SendDestroyEvent();
|
||||||
|
|
||||||
m_isBeingDeleted = true;
|
|
||||||
|
|
||||||
if ( gs_mouseCapture == this )
|
if ( gs_mouseCapture == this )
|
||||||
ReleaseMouse();
|
ReleaseMouse();
|
||||||
|
|
||||||
|
@@ -85,8 +85,6 @@ bool wxDialog::Show( bool show )
|
|||||||
|
|
||||||
wxDialog::~wxDialog()
|
wxDialog::~wxDialog()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
|
||||||
|
|
||||||
// if the dialog is modal, this will end its event loop
|
// if the dialog is modal, this will end its event loop
|
||||||
if ( IsModal() )
|
if ( IsModal() )
|
||||||
EndModal(wxID_CANCEL);
|
EndModal(wxID_CANCEL);
|
||||||
|
@@ -56,7 +56,8 @@ bool wxFrame::Create( wxWindow *parent,
|
|||||||
|
|
||||||
wxFrame::~wxFrame()
|
wxFrame::~wxFrame()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
DeleteAllBars();
|
DeleteAllBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -665,7 +665,7 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK()
|
|||||||
RemoveGrab();
|
RemoveGrab();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
// it may also be GtkScrolledWindow in the case of an MDI child
|
// it may also be GtkScrolledWindow in the case of an MDI child
|
||||||
if (GTK_IS_WINDOW(m_widget))
|
if (GTK_IS_WINDOW(m_widget))
|
||||||
|
@@ -2040,9 +2040,8 @@ void wxWindowGTK::Init()
|
|||||||
m_height = 0;
|
m_height = 0;
|
||||||
|
|
||||||
m_hasVMT = false;
|
m_hasVMT = false;
|
||||||
m_isBeingDeleted = false;
|
|
||||||
|
|
||||||
m_showOnIdle= false;
|
m_showOnIdle = false;
|
||||||
|
|
||||||
m_noExpose = false;
|
m_noExpose = false;
|
||||||
m_nativeSizeEvent = false;
|
m_nativeSizeEvent = false;
|
||||||
@@ -2210,7 +2209,6 @@ wxWindowGTK::~wxWindowGTK()
|
|||||||
if ( gs_deferredFocusOut == this )
|
if ( gs_deferredFocusOut == this )
|
||||||
gs_deferredFocusOut = NULL;
|
gs_deferredFocusOut = NULL;
|
||||||
|
|
||||||
m_isBeingDeleted = true;
|
|
||||||
m_hasVMT = false;
|
m_hasVMT = false;
|
||||||
|
|
||||||
// destroy children before destroying this window itself
|
// destroy children before destroying this window itself
|
||||||
|
@@ -229,7 +229,8 @@ bool wxFrame::Create( wxWindow *parent,
|
|||||||
|
|
||||||
wxFrame::~wxFrame()
|
wxFrame::~wxFrame()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
DeleteAllBars();
|
DeleteAllBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -660,7 +660,7 @@ wxTopLevelWindowGTK::~wxTopLevelWindowGTK()
|
|||||||
RemoveGrab();
|
RemoveGrab();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
// it may also be GtkScrolledWindow in the case of an MDI child
|
// it may also be GtkScrolledWindow in the case of an MDI child
|
||||||
if (GTK_IS_WINDOW(m_widget))
|
if (GTK_IS_WINDOW(m_widget))
|
||||||
|
@@ -2437,7 +2437,6 @@ void wxWindowGTK::Init()
|
|||||||
m_sizeSet = false;
|
m_sizeSet = false;
|
||||||
m_hasVMT = false;
|
m_hasVMT = false;
|
||||||
m_needParent = true;
|
m_needParent = true;
|
||||||
m_isBeingDeleted = false;
|
|
||||||
|
|
||||||
m_noExpose = false;
|
m_noExpose = false;
|
||||||
m_nativeSizeEvent = false;
|
m_nativeSizeEvent = false;
|
||||||
@@ -2613,7 +2612,6 @@ wxWindowGTK::~wxWindowGTK()
|
|||||||
if ( g_delayedFocus == this )
|
if ( g_delayedFocus == this )
|
||||||
g_delayedFocus = NULL;
|
g_delayedFocus = NULL;
|
||||||
|
|
||||||
m_isBeingDeleted = true;
|
|
||||||
m_hasVMT = false;
|
m_hasVMT = false;
|
||||||
|
|
||||||
// destroy children before destroying this window itself
|
// destroy children before destroying this window itself
|
||||||
|
@@ -559,8 +559,6 @@ wxWindowMGL::~wxWindowMGL()
|
|||||||
{
|
{
|
||||||
SendDestroyEvent();
|
SendDestroyEvent();
|
||||||
|
|
||||||
m_isBeingDeleted = true;
|
|
||||||
|
|
||||||
if ( gs_mouseCapture == this )
|
if ( gs_mouseCapture == this )
|
||||||
ReleaseMouse();
|
ReleaseMouse();
|
||||||
|
|
||||||
|
@@ -181,7 +181,7 @@ void wxDialog::SetModal(bool flag)
|
|||||||
|
|
||||||
wxDialog::~wxDialog()
|
wxDialog::~wxDialog()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
// if the dialog is modal, this will end its event loop
|
// if the dialog is modal, this will end its event loop
|
||||||
Show(false);
|
Show(false);
|
||||||
|
@@ -253,7 +253,7 @@ bool wxFrame::XmDoCreateTLW(wxWindow* WXUNUSED(parent),
|
|||||||
|
|
||||||
wxFrame::~wxFrame()
|
wxFrame::~wxFrame()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
if (m_clientArea)
|
if (m_clientArea)
|
||||||
{
|
{
|
||||||
|
@@ -345,11 +345,11 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
|
|||||||
// Destructor
|
// Destructor
|
||||||
wxWindow::~wxWindow()
|
wxWindow::~wxWindow()
|
||||||
{
|
{
|
||||||
|
SendDestroyEvent();
|
||||||
|
|
||||||
if (g_captureWindow == this)
|
if (g_captureWindow == this)
|
||||||
g_captureWindow = NULL;
|
g_captureWindow = NULL;
|
||||||
|
|
||||||
m_isBeingDeleted = true;
|
|
||||||
|
|
||||||
// Motif-specific actions first
|
// Motif-specific actions first
|
||||||
WXWidget wMain = GetMainWidget();
|
WXWidget wMain = GetMainWidget();
|
||||||
if ( wMain )
|
if ( wMain )
|
||||||
|
@@ -59,15 +59,6 @@ IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
|
|||||||
// wxControl implementation
|
// wxControl implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// wxControl ctor/dtor
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
wxControl::~wxControl()
|
|
||||||
{
|
|
||||||
m_isBeingDeleted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// control window creation
|
// control window creation
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -192,8 +192,6 @@ bool wxDialog::Create(wxWindow *parent,
|
|||||||
|
|
||||||
wxDialog::~wxDialog()
|
wxDialog::~wxDialog()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
|
||||||
|
|
||||||
// this will also reenable all the other windows for a modal dialog
|
// this will also reenable all the other windows for a modal dialog
|
||||||
Show(false);
|
Show(false);
|
||||||
|
|
||||||
|
@@ -209,7 +209,8 @@ bool wxFrame::Create(wxWindow *parent,
|
|||||||
|
|
||||||
wxFrame::~wxFrame()
|
wxFrame::~wxFrame()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
DeleteAllBars();
|
DeleteAllBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -254,7 +254,7 @@ bool wxRadioBox::Create(wxWindow *parent,
|
|||||||
|
|
||||||
wxRadioBox::~wxRadioBox()
|
wxRadioBox::~wxRadioBox()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
delete m_radioButtons;
|
delete m_radioButtons;
|
||||||
if ( m_dummyHwnd )
|
if ( m_dummyHwnd )
|
||||||
|
@@ -599,6 +599,8 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent,
|
|||||||
|
|
||||||
wxTopLevelWindowMSW::~wxTopLevelWindowMSW()
|
wxTopLevelWindowMSW::~wxTopLevelWindowMSW()
|
||||||
{
|
{
|
||||||
|
SendDestroyEvent();
|
||||||
|
|
||||||
#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
|
#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
|
||||||
SHACTIVATEINFO* info = (SHACTIVATEINFO*) m_activateInfo;
|
SHACTIVATEINFO* info = (SHACTIVATEINFO*) m_activateInfo;
|
||||||
delete info;
|
delete info;
|
||||||
|
@@ -518,7 +518,6 @@ bool wxWindowMSW::MSWCommand(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id))
|
|||||||
void wxWindowMSW::Init()
|
void wxWindowMSW::Init()
|
||||||
{
|
{
|
||||||
// MSW specific
|
// MSW specific
|
||||||
m_isBeingDeleted = false;
|
|
||||||
m_oldWndProc = NULL;
|
m_oldWndProc = NULL;
|
||||||
m_mouseInWindow = false;
|
m_mouseInWindow = false;
|
||||||
m_lastKeydownProcessed = false;
|
m_lastKeydownProcessed = false;
|
||||||
@@ -540,7 +539,7 @@ void wxWindowMSW::Init()
|
|||||||
// Destructor
|
// Destructor
|
||||||
wxWindowMSW::~wxWindowMSW()
|
wxWindowMSW::~wxWindowMSW()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
#ifndef __WXUNIVERSAL__
|
#ifndef __WXUNIVERSAL__
|
||||||
// VS: make sure there's no wxFrame with last focus set to us:
|
// VS: make sure there's no wxFrame with last focus set to us:
|
||||||
@@ -3949,8 +3948,6 @@ bool wxWindowMSW::HandleCreate(WXLPCREATESTRUCT WXUNUSED_IN_WINCE(cs),
|
|||||||
|
|
||||||
bool wxWindowMSW::HandleDestroy()
|
bool wxWindowMSW::HandleDestroy()
|
||||||
{
|
{
|
||||||
SendDestroyEvent();
|
|
||||||
|
|
||||||
// delete our drop target if we've got one
|
// delete our drop target if we've got one
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
if ( m_dropTarget != NULL )
|
if ( m_dropTarget != NULL )
|
||||||
|
@@ -60,11 +60,6 @@ bool wxControl::Create( wxWindow* pParent,
|
|||||||
return bRval;
|
return bRval;
|
||||||
} // end of wxControl::Create
|
} // end of wxControl::Create
|
||||||
|
|
||||||
wxControl::~wxControl()
|
|
||||||
{
|
|
||||||
m_isBeingDeleted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxControl::OS2CreateControl( const wxChar* zClassname,
|
bool wxControl::OS2CreateControl( const wxChar* zClassname,
|
||||||
const wxString& rsLabel,
|
const wxString& rsLabel,
|
||||||
const wxPoint& rPos,
|
const wxPoint& rPos,
|
||||||
|
@@ -147,7 +147,7 @@ void wxDialog::SetModal(bool WXUNUSED(bFlag))
|
|||||||
|
|
||||||
wxDialog::~wxDialog()
|
wxDialog::~wxDialog()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
// this will also reenable all the other windows for a modal dialog
|
// this will also reenable all the other windows for a modal dialog
|
||||||
Show(false);
|
Show(false);
|
||||||
|
@@ -127,7 +127,8 @@ bool wxFrame::Create( wxWindow* pParent,
|
|||||||
|
|
||||||
wxFrame::~wxFrame()
|
wxFrame::~wxFrame()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
DeleteAllBars();
|
DeleteAllBars();
|
||||||
} // end of wxFrame::~wxFrame
|
} // end of wxFrame::~wxFrame
|
||||||
|
|
||||||
|
@@ -76,7 +76,7 @@ wxRadioBox::wxRadioBox()
|
|||||||
|
|
||||||
wxRadioBox::~wxRadioBox()
|
wxRadioBox::~wxRadioBox()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
if (m_hWnd)
|
if (m_hWnd)
|
||||||
wxRemoveHandleAssociation(this);
|
wxRemoveHandleAssociation(this);
|
||||||
|
@@ -334,7 +334,7 @@ void wxWindowOS2::Init()
|
|||||||
//
|
//
|
||||||
wxWindowOS2::~wxWindowOS2()
|
wxWindowOS2::~wxWindowOS2()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent())
|
for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent())
|
||||||
{
|
{
|
||||||
|
@@ -63,11 +63,6 @@ bool wxControl::Create( wxWindow *parent,
|
|||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxControl::~wxControl()
|
|
||||||
{
|
|
||||||
m_isBeingDeleted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxControl::ProcessCommand( wxCommandEvent &event )
|
bool wxControl::ProcessCommand( wxCommandEvent &event )
|
||||||
{
|
{
|
||||||
// Tries:
|
// Tries:
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
// Drawer windows appear under their parent window and
|
// Drawer windows appear under their parent window and
|
||||||
// behave like a drawer, opening and closing to reveal
|
// behave like a drawer, opening and closing to reveal
|
||||||
// content that does not need to be visible at all times.
|
// content that does not need to be visible at all times.
|
||||||
// Author: Jason Bagley
|
// Author: Jason Bagley
|
||||||
// Modified by: Ryan Norton (To make it work :), plus bug fixes)
|
// Modified by: Ryan Norton (To make it work :), plus bug fixes)
|
||||||
// Created: 2004-30-01
|
// Created: 2004-30-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
@@ -40,17 +40,17 @@ wxDrawerWindow::wxDrawerWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxDrawerWindow::~wxDrawerWindow()
|
wxDrawerWindow::~wxDrawerWindow()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = TRUE;
|
SendDestroyEvent();
|
||||||
this->Show(FALSE);
|
Show(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDrawerWindow::Create(wxWindow *parent,
|
bool wxDrawerWindow::Create(wxWindow *parent,
|
||||||
wxWindowID id, const wxString& title,
|
wxWindowID id, const wxString& title,
|
||||||
wxSize size, wxDirection edge, const wxString& name)
|
wxSize size, wxDirection edge, const wxString& name)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG(NULL != parent, wxT("wxDrawerWindows must be attached to a parent window."));
|
wxASSERT_MSG(NULL != parent, wxT("wxDrawerWindows must be attached to a parent window."));
|
||||||
|
|
||||||
// Constrain the drawer size to the parent window.
|
// Constrain the drawer size to the parent window.
|
||||||
const wxSize parentSize(parent->GetClientSize());
|
const wxSize parentSize(parent->GetClientSize());
|
||||||
if (wxLEFT == edge || wxRIGHT == edge)
|
if (wxLEFT == edge || wxRIGHT == edge)
|
||||||
@@ -63,25 +63,25 @@ bool wxDrawerWindow::Create(wxWindow *parent,
|
|||||||
if (size.GetWidth() > parentSize.GetWidth())
|
if (size.GetWidth() > parentSize.GetWidth())
|
||||||
size.SetWidth(parentSize.GetWidth() - (kLeadingOffset + kTrailingOffset));
|
size.SetWidth(parentSize.GetWidth() - (kLeadingOffset + kTrailingOffset));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the drawer window.
|
// Create the drawer window.
|
||||||
const wxPoint pos(0, 0);
|
const wxPoint pos(0, 0);
|
||||||
const wxSize dummySize(0,0);
|
const wxSize dummySize(0,0);
|
||||||
const long style = wxFRAME_DRAWER;
|
const long style = wxFRAME_DRAWER;
|
||||||
|
|
||||||
bool success = wxNonOwnedWindow::Create(parent, id, pos, size, style, name);
|
bool success = wxNonOwnedWindow::Create(parent, id, pos, size, style, name);
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
// this->MacCreateRealWindow(pos, size, style, name);
|
// this->MacCreateRealWindow(pos, size, style, name);
|
||||||
success = (GetWXWindow() != NULL);
|
success = (GetWXWindow() != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
// Use drawer brush.
|
// Use drawer brush.
|
||||||
SetBackgroundColour( wxColour( wxMacCreateCGColorFromHITheme( kThemeBrushDrawerBackground ) ) );
|
SetBackgroundColour( wxColour( wxMacCreateCGColorFromHITheme( kThemeBrushDrawerBackground ) ) );
|
||||||
::SetThemeWindowBackground((WindowRef)GetWXWindow(), kThemeBrushDrawerBackground, false);
|
::SetThemeWindowBackground((WindowRef)GetWXWindow(), kThemeBrushDrawerBackground, false);
|
||||||
|
|
||||||
// Leading and trailing offset are gaps from parent window edges
|
// Leading and trailing offset are gaps from parent window edges
|
||||||
// to where the drawer starts.
|
// to where the drawer starts.
|
||||||
::SetDrawerOffsets((WindowRef)GetWXWindow() , kLeadingOffset, kTrailingOffset);
|
::SetDrawerOffsets((WindowRef)GetWXWindow() , kLeadingOffset, kTrailingOffset);
|
||||||
@@ -90,7 +90,7 @@ bool wxDrawerWindow::Create(wxWindow *parent,
|
|||||||
// Is there a better way to get the parent's WindowRef?
|
// Is there a better way to get the parent's WindowRef?
|
||||||
wxTopLevelWindow* tlwParent = wxDynamicCast(parent, wxTopLevelWindow);
|
wxTopLevelWindow* tlwParent = wxDynamicCast(parent, wxTopLevelWindow);
|
||||||
if (NULL != tlwParent)
|
if (NULL != tlwParent)
|
||||||
{
|
{
|
||||||
OSStatus status = ::SetDrawerParent((WindowRef) GetWXWindow(),
|
OSStatus status = ::SetDrawerParent((WindowRef) GetWXWindow(),
|
||||||
(WindowRef)tlwParent->GetWXWindow());
|
(WindowRef)tlwParent->GetWXWindow());
|
||||||
success = (noErr == status);
|
success = (noErr == status);
|
||||||
@@ -98,7 +98,7 @@ bool wxDrawerWindow::Create(wxWindow *parent,
|
|||||||
else
|
else
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return success && SetPreferredEdge(edge);
|
return success && SetPreferredEdge(edge);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,15 +152,15 @@ OptionBits DirectionToWindowEdge(wxDirection direction)
|
|||||||
case wxTOP:
|
case wxTOP:
|
||||||
edge = kWindowEdgeTop;
|
edge = kWindowEdgeTop;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxBOTTOM:
|
case wxBOTTOM:
|
||||||
edge = kWindowEdgeBottom;
|
edge = kWindowEdgeBottom;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxRIGHT:
|
case wxRIGHT:
|
||||||
edge = kWindowEdgeRight;
|
edge = kWindowEdgeRight;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxLEFT:
|
case wxLEFT:
|
||||||
default:
|
default:
|
||||||
edge = kWindowEdgeLeft;
|
edge = kWindowEdgeLeft;
|
||||||
@@ -177,23 +177,23 @@ wxDirection WindowEdgeToDirection(OptionBits edge)
|
|||||||
case kWindowEdgeTop:
|
case kWindowEdgeTop:
|
||||||
direction = wxTOP;
|
direction = wxTOP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kWindowEdgeBottom:
|
case kWindowEdgeBottom:
|
||||||
direction = wxBOTTOM;
|
direction = wxBOTTOM;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kWindowEdgeRight:
|
case kWindowEdgeRight:
|
||||||
direction = wxRIGHT;
|
direction = wxRIGHT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kWindowEdgeDefault: // store current preferred and return that here?
|
case kWindowEdgeDefault: // store current preferred and return that here?
|
||||||
case kWindowEdgeLeft:
|
case kWindowEdgeLeft:
|
||||||
default:
|
default:
|
||||||
direction = wxLEFT;
|
direction = wxLEFT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return direction;
|
return direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // defined( __WXMAC__ )
|
#endif // defined( __WXMAC__ )
|
||||||
|
@@ -61,7 +61,8 @@ bool wxFrame::Create(wxWindow *parent,
|
|||||||
|
|
||||||
wxFrame::~wxFrame()
|
wxFrame::~wxFrame()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
DeleteAllBars();
|
DeleteAllBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,7 +363,7 @@ void wxFrame::PositionToolBar()
|
|||||||
int cw, ch;
|
int cw, ch;
|
||||||
|
|
||||||
GetSize( &cw , &ch ) ;
|
GetSize( &cw , &ch ) ;
|
||||||
|
|
||||||
int statusX = 0 ;
|
int statusX = 0 ;
|
||||||
int statusY = 0 ;
|
int statusY = 0 ;
|
||||||
|
|
||||||
|
@@ -71,7 +71,7 @@ void wxDialog::SetModal( bool flag )
|
|||||||
|
|
||||||
wxDialog::~wxDialog()
|
wxDialog::~wxDialog()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
// if the dialog is modal, this will end its event loop
|
// if the dialog is modal, this will end its event loop
|
||||||
Show(false);
|
Show(false);
|
||||||
|
@@ -151,7 +151,7 @@ bool wxNonOwnedWindow::Create(wxWindow *parent,
|
|||||||
|
|
||||||
wxNonOwnedWindow::~wxNonOwnedWindow()
|
wxNonOwnedWindow::~wxNonOwnedWindow()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
wxRemoveWXWindowAssociation( this ) ;
|
wxRemoveWXWindowAssociation( this ) ;
|
||||||
|
|
||||||
|
@@ -52,7 +52,7 @@ wxRadioBox::wxRadioBox()
|
|||||||
|
|
||||||
wxRadioBox::~wxRadioBox()
|
wxRadioBox::~wxRadioBox()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
wxRadioButton *next, *current;
|
wxRadioButton *next, *current;
|
||||||
|
|
||||||
@@ -411,7 +411,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
totWidth = GetColumnCount() * (maxWidth + charWidth);
|
totWidth = GetColumnCount() * (maxWidth + charWidth);
|
||||||
|
|
||||||
wxSize sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) ) ;
|
wxSize sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) ) ;
|
||||||
|
|
||||||
// change the width / height only when specified
|
// change the width / height only when specified
|
||||||
if ( width == wxDefaultCoord )
|
if ( width == wxDefaultCoord )
|
||||||
{
|
{
|
||||||
@@ -502,7 +502,7 @@ wxSize wxRadioBox::DoGetBestSize() const
|
|||||||
wxSize sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) );
|
wxSize sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) );
|
||||||
totWidth = sz.x;
|
totWidth = sz.x;
|
||||||
totHeight = sz.y;
|
totHeight = sz.y;
|
||||||
|
|
||||||
// optimum size is an additional 5 pt border to all sides
|
// optimum size is an additional 5 pt border to all sides
|
||||||
totWidth += 10;
|
totWidth += 10;
|
||||||
totHeight += 10;
|
totHeight += 10;
|
||||||
|
@@ -141,8 +141,6 @@ wxWindowMac::~wxWindowMac()
|
|||||||
{
|
{
|
||||||
SendDestroyEvent();
|
SendDestroyEvent();
|
||||||
|
|
||||||
m_isBeingDeleted = true;
|
|
||||||
|
|
||||||
MacInvalidateBorders() ;
|
MacInvalidateBorders() ;
|
||||||
|
|
||||||
#ifndef __WXUNIVERSAL__
|
#ifndef __WXUNIVERSAL__
|
||||||
|
@@ -77,8 +77,9 @@ void wxControl::Init()
|
|||||||
|
|
||||||
wxControl::~wxControl()
|
wxControl::~wxControl()
|
||||||
{
|
{
|
||||||
|
SendDestroyEvent();
|
||||||
|
|
||||||
SetLabel(wxEmptyString);
|
SetLabel(wxEmptyString);
|
||||||
m_isBeingDeleted = true;
|
|
||||||
|
|
||||||
DestroyChildren();
|
DestroyChildren();
|
||||||
|
|
||||||
|
@@ -53,8 +53,6 @@ void wxDialog::Init()
|
|||||||
|
|
||||||
wxDialog::~wxDialog()
|
wxDialog::~wxDialog()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
|
||||||
|
|
||||||
// if the dialog is modal, this will end its event loop
|
// if the dialog is modal, this will end its event loop
|
||||||
Show(false);
|
Show(false);
|
||||||
|
|
||||||
|
@@ -224,7 +224,7 @@ bool wxWindow::Create(wxWindow *parent,
|
|||||||
|
|
||||||
wxWindow::~wxWindow()
|
wxWindow::~wxWindow()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = true;
|
SendDestroyEvent();
|
||||||
|
|
||||||
#if wxUSE_SCROLLBAR
|
#if wxUSE_SCROLLBAR
|
||||||
// clear pointers to scrollbar before deleting the children: they are
|
// clear pointers to scrollbar before deleting the children: they are
|
||||||
|
@@ -350,8 +350,6 @@ wxWindowX11::~wxWindowX11()
|
|||||||
if (g_captureWindow == this)
|
if (g_captureWindow == this)
|
||||||
g_captureWindow = NULL;
|
g_captureWindow = NULL;
|
||||||
|
|
||||||
m_isBeingDeleted = true;
|
|
||||||
|
|
||||||
DestroyChildren();
|
DestroyChildren();
|
||||||
|
|
||||||
if (m_clientWindow != m_mainWindow)
|
if (m_clientWindow != m_mainWindow)
|
||||||
|
Reference in New Issue
Block a user