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);
// 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;
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);