X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9d272435b816ad154a014a9019bab2c979f6f3ef..af7e24c33e1e6e00a7687ee965b921dbe60cdb36:/src/common/toplvcmn.cpp diff --git a/src/common/toplvcmn.cpp b/src/common/toplvcmn.cpp index bcfd529105..c45dd1d55e 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); @@ -129,7 +123,7 @@ bool wxTopLevelWindowBase::Destroy() 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 @@ -156,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 @@ -168,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 @@ -208,7 +202,7 @@ void wxTopLevelWindowBase::GetRectForTopLevelChildren(int *x, int *y, int *w, in wxSize wxTopLevelWindowBase::GetDefaultSize() { wxSize size = wxGetClientDisplayRect().GetSize(); - +#ifndef __WXOSX_IPHONE__ // create proportionally bigger windows on small screens if ( size.x >= 1024 ) size.x = 400; @@ -224,7 +218,7 @@ wxSize wxTopLevelWindowBase::GetDefaultSize() size.y *= 2; size.y /= 3; } - +#endif return size; } @@ -273,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 @@ -380,7 +377,7 @@ void wxTopLevelWindowBase::DoLayout() else { // do we have _exactly_ one child? - wxWindow *child = (wxWindow *)NULL; + wxWindow *child = NULL; for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); node; node = node->GetNext() ) @@ -419,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);