X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/18868d62a29e40215e1f069a7934054564989411..025644120d48ad13f1bb1fd82d9cc8f61c505364:/src/common/toplvcmn.cpp diff --git a/src/common/toplvcmn.cpp b/src/common/toplvcmn.cpp index 4f34b30e4d..d33262d20e 100644 --- a/src/common/toplvcmn.cpp +++ b/src/common/toplvcmn.cpp @@ -39,7 +39,6 @@ BEGIN_EVENT_TABLE(wxTopLevelWindowBase, wxWindow) EVT_CLOSE(wxTopLevelWindowBase::OnCloseWindow) EVT_SIZE(wxTopLevelWindowBase::OnSize) - EVT_WINDOW_DESTROY(wxTopLevelWindowBase::OnChildDestroy) WX_EVENT_TABLE_CONTROL_CONTAINER(wxTopLevelWindowBase) END_EVENT_TABLE() @@ -59,17 +58,12 @@ wxTopLevelWindowBase::wxTopLevelWindowBase() { // Unlike windows, top level windows are created hidden by default. m_isShown = false; - m_winDefault = - m_winTmpDefault = NULL; WX_INIT_CONTROL_CONTAINER(); } wxTopLevelWindowBase::~wxTopLevelWindowBase() { - m_winDefault = - m_winTmpDefault = NULL; - // don't let wxTheApp keep any stale pointers to us if ( wxTheApp && wxTheApp->GetTopWindow() == this ) wxTheApp->SetTopWindow(NULL); @@ -124,13 +118,12 @@ bool wxTopLevelWindowBase::Destroy() // any more as no events will be sent to the hidden window and without idle // events we won't prune wxPendingDelete list and the application won't // terminate - const wxWindowList::const_iterator end = wxTopLevelWindows.end(); for ( wxWindowList::const_iterator i = wxTopLevelWindows.begin(), end = wxTopLevelWindows.end(); i != end; ++i ) { - wxTopLevelWindow * const win = wx_static_cast(wxTopLevelWindow *, *i); + wxTopLevelWindow * const win = static_cast(*i); if ( win != this && win->IsShown() ) { // there remains at least one other visible TLW, we can hide this @@ -157,7 +150,7 @@ bool wxTopLevelWindowBase::IsLastBeforeExit() const // then decide whether we should exit at all for ( i = wxTopLevelWindows.begin(); i != end; ++i ) { - wxTopLevelWindow * const win = wx_static_cast(wxTopLevelWindow *, *i); + wxTopLevelWindow * const win = static_cast(*i); if ( win->ShouldPreventAppExit() ) { // there remains at least one important TLW, don't exit @@ -169,7 +162,7 @@ bool wxTopLevelWindowBase::IsLastBeforeExit() const for ( i = wxTopLevelWindows.begin(); i != end; ++i ) { // don't close twice the windows which are already marked for deletion - wxTopLevelWindow * const win = wx_static_cast(wxTopLevelWindow *, *i); + wxTopLevelWindow * const win = static_cast(*i); if ( !wxPendingDelete.Member(win) && !win->Close() ) { // one of the windows refused to close, don't exit @@ -274,8 +267,11 @@ void wxTopLevelWindowBase::DoCentre(int dir) if((rectParent == rectDisplay) && IsMaximized()) return; + if ( !(dir & wxBOTH) ) + dir |= wxBOTH; // if neither is specified, center in both directions + // the new window rect candidate - wxRect rect = GetRect().CentreIn(rectParent, dir); + wxRect rect = GetRect().CentreIn(rectParent, dir & ~wxCENTRE_ON_SCREEN); // we don't want to place the window off screen if Centre() is called as // this is (almost?) never wanted and it would be very difficult to prevent @@ -420,17 +416,6 @@ void wxTopLevelWindowBase::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) Destroy(); } -void wxTopLevelWindowBase::OnChildDestroy(wxWindowDestroyEvent& event) -{ - event.Skip(); - - wxWindow * const win = event.GetWindow(); - if ( win == m_winDefault ) - m_winDefault = NULL; - if ( win == m_winTmpDefault ) - m_winTmpDefault = NULL; -} - bool wxTopLevelWindowBase::SendIconizeEvent(bool iconized) { wxIconizeEvent event(GetId(), iconized);