#pragma hdrstop
#endif
+#include "wx/toplevel.h"
+
#ifndef WX_PRECOMP
- #include "wx/toplevel.h"
#include "wx/dcclient.h"
#include "wx/app.h"
#endif // WX_PRECOMP
{
// Unlike windows, top level windows are created hidden by default.
m_isShown = false;
+ m_winDefault = NULL;
+ m_winTmpDefault = NULL;
}
wxTopLevelWindowBase::~wxTopLevelWindowBase()
// parent frame under Mac but could happen elsewhere too if the frame
// was hidden/moved away for some reason), don't use it as otherwise
// this window wouldn't be visible at all
- if ( !rectDisplay.Inside(rectParent.GetTopLeft()) &&
- !rectParent.Inside(rectParent.GetBottomRight()) )
+ if ( !rectDisplay.Contains(rectParent.GetTopLeft()) &&
+ !rectParent.Contains(rectParent.GetBottomRight()) )
{
// this is enough to make IsEmpty() test below pass
rectParent.width = 0;
// 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
// it from happening from the user code if we didn't check for it here
- if ( rectDisplay.Inside(rect.GetTopLeft()) )
+ if ( rectDisplay.Contains(rect.GetTopLeft()) )
{
- if ( !rectDisplay.Inside(rect.GetBottomRight()) )
+ if ( !rectDisplay.Contains(rect.GetBottomRight()) )
{
// check if we can move the window so that the bottom right corner
// is visible without hiding the top left one
// for whatever reasons, wxGTK wants to have a small offset - it
// probably looks better with it?
#ifdef __WXGTK__
- static const int ofs = 1;
+ const int ofs = 1;
+ clientW -= 2 * ofs;
+ clientH -= 2 * ofs;
+ if (clientW < 0)
+ clientW = 0;
+ if (clientH < 0)
+ clientH = 0;
#else
- static const int ofs = 0;
+ const int ofs = 0;
#endif
- child->SetSize(ofs, ofs, clientW - 2*ofs, clientH - 2*ofs);
+ child->SetSize(ofs, ofs, clientW, clientH);
}
}
}
// it's probably better than do nothing, isn't it?
Raise();
}
+
+void wxTopLevelWindowBase::RemoveChild(wxWindowBase *child)
+{
+ if ( child == m_winDefault )
+ m_winDefault = NULL;
+
+ if ( child == m_winTmpDefault )
+ m_winTmpDefault = NULL;
+
+ wxWindow::RemoveChild(child);
+}