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()
{
// 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);
i != end;
++i )
{
- wxTopLevelWindow * const win = wx_static_cast(wxTopLevelWindow *, *i);
+ wxTopLevelWindow * const win = static_cast<wxTopLevelWindow *>(*i);
if ( win != this && win->IsShown() )
{
// there remains at least one other visible TLW, we can hide this
// 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<wxTopLevelWindow *>(*i);
if ( win->ShouldPreventAppExit() )
{
// there remains at least one important TLW, don't exit
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<wxTopLevelWindow *>(*i);
if ( !wxPendingDelete.Member(win) && !win->Close() )
{
// one of the windows refused to close, don't exit
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
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);