const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxControlNameStr);
- virtual ~wxControl();
// Simulates an event
virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
{
Create( pParent, vId, rPos, rSize, lStyle, rValidator, rsName );
}
- virtual ~wxControl();
bool Create( wxWindow* pParent
,wxWindowID vId
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxControlNameStr);
- virtual ~wxControl();
// Simulates an event
virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
void SatisfyConstraints();
#endif // wxUSE_CONSTRAINTS
- // Send the wxWindowDestroyEvent
+ // Send the wxWindowDestroyEvent if not done yet and sets m_isBeingDeleted
+ // to true
void SendDestroyEvent();
// returns the main window of composite control; this is the window
wxAuiNotebook::~wxAuiNotebook()
{
// Indicate we're deleting pages
- m_isBeingDeleted = true;
+ SendDestroyEvent();
while ( GetPageCount() > 0 )
DeletePage(0);
m_cocoaNSView = NULL;
m_cocoaHider = NULL;
m_wxCocoaScrollView = NULL;
- m_isBeingDeleted = false;
m_isInPaint = false;
m_visibleTrackingRectManager = NULL;
}
// Whether we're using the current theme for this window (wxGTK only for now)
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_freezeCount = 0;
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;
event.SetEventObject(this);
event.SetId(GetId());
wxNonOwnedWindow::~wxNonOwnedWindow()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
// 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:
{
SendDestroyEvent();
- m_isBeingDeleted = true;
-
if ( gs_mouseCapture == this )
ReleaseMouse();
wxDialog::~wxDialog()
{
- m_isBeingDeleted = true;
-
// if the dialog is modal, this will end its event loop
if ( IsModal() )
EndModal(wxID_CANCEL);
wxFrame::~wxFrame()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
+
DeleteAllBars();
}
RemoveGrab();
}
- m_isBeingDeleted = true;
+ SendDestroyEvent();
// it may also be GtkScrolledWindow in the case of an MDI child
if (GTK_IS_WINDOW(m_widget))
m_height = 0;
m_hasVMT = false;
- m_isBeingDeleted = false;
- m_showOnIdle= false;
+ m_showOnIdle = false;
m_noExpose = false;
m_nativeSizeEvent = false;
if ( gs_deferredFocusOut == this )
gs_deferredFocusOut = NULL;
- m_isBeingDeleted = true;
m_hasVMT = false;
// destroy children before destroying this window itself
wxFrame::~wxFrame()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
+
DeleteAllBars();
}
RemoveGrab();
}
- m_isBeingDeleted = true;
+ SendDestroyEvent();
// it may also be GtkScrolledWindow in the case of an MDI child
if (GTK_IS_WINDOW(m_widget))
m_sizeSet = false;
m_hasVMT = false;
m_needParent = true;
- m_isBeingDeleted = false;
m_noExpose = false;
m_nativeSizeEvent = false;
if ( g_delayedFocus == this )
g_delayedFocus = NULL;
- m_isBeingDeleted = true;
m_hasVMT = false;
// destroy children before destroying this window itself
{
SendDestroyEvent();
- m_isBeingDeleted = true;
-
if ( gs_mouseCapture == this )
ReleaseMouse();
wxDialog::~wxDialog()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
// if the dialog is modal, this will end its event loop
Show(false);
wxFrame::~wxFrame()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
if (m_clientArea)
{
// Destructor
wxWindow::~wxWindow()
{
+ SendDestroyEvent();
+
if (g_captureWindow == this)
g_captureWindow = NULL;
- m_isBeingDeleted = true;
-
// Motif-specific actions first
WXWidget wMain = GetMainWidget();
if ( wMain )
// wxControl implementation
// ============================================================================
-// ----------------------------------------------------------------------------
-// wxControl ctor/dtor
-// ----------------------------------------------------------------------------
-
-wxControl::~wxControl()
-{
- m_isBeingDeleted = true;
-}
-
// ----------------------------------------------------------------------------
// control window creation
// ----------------------------------------------------------------------------
wxDialog::~wxDialog()
{
- m_isBeingDeleted = true;
-
// this will also reenable all the other windows for a modal dialog
Show(false);
wxFrame::~wxFrame()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
+
DeleteAllBars();
}
wxRadioBox::~wxRadioBox()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
delete m_radioButtons;
if ( m_dummyHwnd )
wxTopLevelWindowMSW::~wxTopLevelWindowMSW()
{
+ SendDestroyEvent();
+
#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
SHACTIVATEINFO* info = (SHACTIVATEINFO*) m_activateInfo;
delete info;
void wxWindowMSW::Init()
{
// MSW specific
- m_isBeingDeleted = false;
m_oldWndProc = NULL;
m_mouseInWindow = false;
m_lastKeydownProcessed = false;
// Destructor
wxWindowMSW::~wxWindowMSW()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
#ifndef __WXUNIVERSAL__
// VS: make sure there's no wxFrame with last focus set to us:
bool wxWindowMSW::HandleDestroy()
{
- SendDestroyEvent();
-
// delete our drop target if we've got one
#if wxUSE_DRAG_AND_DROP
if ( m_dropTarget != NULL )
return bRval;
} // end of wxControl::Create
-wxControl::~wxControl()
-{
- m_isBeingDeleted = true;
-}
-
bool wxControl::OS2CreateControl( const wxChar* zClassname,
const wxString& rsLabel,
const wxPoint& rPos,
wxDialog::~wxDialog()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
// this will also reenable all the other windows for a modal dialog
Show(false);
wxFrame::~wxFrame()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
+
DeleteAllBars();
} // end of wxFrame::~wxFrame
wxRadioBox::~wxRadioBox()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
if (m_hWnd)
wxRemoveHandleAssociation(this);
//
wxWindowOS2::~wxWindowOS2()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent())
{
return rval;
}
-wxControl::~wxControl()
-{
- m_isBeingDeleted = true;
-}
-
bool wxControl::ProcessCommand( wxCommandEvent &event )
{
// Tries:
// Drawer windows appear under their parent window and
// behave like a drawer, opening and closing to reveal
// 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)
// Created: 2004-30-01
// RCS-ID: $Id$
}
wxDrawerWindow::~wxDrawerWindow()
-{
- m_isBeingDeleted = TRUE;
- this->Show(FALSE);
+{
+ SendDestroyEvent();
+ Show(FALSE);
}
-
+
bool wxDrawerWindow::Create(wxWindow *parent,
wxWindowID id, const wxString& title,
wxSize size, wxDirection edge, const wxString& name)
{
wxASSERT_MSG(NULL != parent, wxT("wxDrawerWindows must be attached to a parent window."));
-
+
// Constrain the drawer size to the parent window.
const wxSize parentSize(parent->GetClientSize());
if (wxLEFT == edge || wxRIGHT == edge)
if (size.GetWidth() > parentSize.GetWidth())
size.SetWidth(parentSize.GetWidth() - (kLeadingOffset + kTrailingOffset));
}
-
- // Create the drawer window.
+
+ // Create the drawer window.
const wxPoint pos(0, 0);
const wxSize dummySize(0,0);
const long style = wxFRAME_DRAWER;
-
+
bool success = wxNonOwnedWindow::Create(parent, id, pos, size, style, name);
if (success)
{
// this->MacCreateRealWindow(pos, size, style, name);
success = (GetWXWindow() != NULL);
}
-
+
if (success)
{
// Use drawer brush.
SetBackgroundColour( wxColour( wxMacCreateCGColorFromHITheme( kThemeBrushDrawerBackground ) ) );
::SetThemeWindowBackground((WindowRef)GetWXWindow(), kThemeBrushDrawerBackground, false);
-
+
// Leading and trailing offset are gaps from parent window edges
// to where the drawer starts.
::SetDrawerOffsets((WindowRef)GetWXWindow() , kLeadingOffset, kTrailingOffset);
// Is there a better way to get the parent's WindowRef?
wxTopLevelWindow* tlwParent = wxDynamicCast(parent, wxTopLevelWindow);
if (NULL != tlwParent)
- {
+ {
OSStatus status = ::SetDrawerParent((WindowRef) GetWXWindow(),
(WindowRef)tlwParent->GetWXWindow());
success = (noErr == status);
else
success = false;
}
-
+
return success && SetPreferredEdge(edge);
}
case wxTOP:
edge = kWindowEdgeTop;
break;
-
+
case wxBOTTOM:
edge = kWindowEdgeBottom;
break;
-
+
case wxRIGHT:
edge = kWindowEdgeRight;
break;
-
+
case wxLEFT:
default:
edge = kWindowEdgeLeft;
case kWindowEdgeTop:
direction = wxTOP;
break;
-
+
case kWindowEdgeBottom:
direction = wxBOTTOM;
break;
-
+
case kWindowEdgeRight:
direction = wxRIGHT;
break;
-
+
case kWindowEdgeDefault: // store current preferred and return that here?
case kWindowEdgeLeft:
default:
direction = wxLEFT;
break;
}
-
+
return direction;
}
-#endif // defined( __WXMAC__ )
+#endif // defined( __WXMAC__ )
wxFrame::~wxFrame()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
+
DeleteAllBars();
}
int cw, ch;
GetSize( &cw , &ch ) ;
-
+
int statusX = 0 ;
int statusY = 0 ;
wxDialog::~wxDialog()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
// if the dialog is modal, this will end its event loop
Show(false);
wxNonOwnedWindow::~wxNonOwnedWindow()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
wxRemoveWXWindowAssociation( this ) ;
wxRadioBox::~wxRadioBox()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
wxRadioButton *next, *current;
totWidth = GetColumnCount() * (maxWidth + charWidth);
wxSize sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) ) ;
-
+
// change the width / height only when specified
if ( width == wxDefaultCoord )
{
wxSize sz = DoGetSizeFromClientSize( wxSize( totWidth, totHeight ) );
totWidth = sz.x;
totHeight = sz.y;
-
+
// optimum size is an additional 5 pt border to all sides
totWidth += 10;
totHeight += 10;
{
SendDestroyEvent();
- m_isBeingDeleted = true;
-
MacInvalidateBorders() ;
#ifndef __WXUNIVERSAL__
wxControl::~wxControl()
{
+ SendDestroyEvent();
+
SetLabel(wxEmptyString);
- m_isBeingDeleted = true;
DestroyChildren();
wxDialog::~wxDialog()
{
- m_isBeingDeleted = true;
-
// if the dialog is modal, this will end its event loop
Show(false);
wxWindow::~wxWindow()
{
- m_isBeingDeleted = true;
+ SendDestroyEvent();
#if wxUSE_SCROLLBAR
// clear pointers to scrollbar before deleting the children: they are
if (g_captureWindow == this)
g_captureWindow = NULL;
- m_isBeingDeleted = true;
-
DestroyChildren();
if (m_clientWindow != m_mainWindow)