// wxTopLevelWindow geometry
// ----------------------------------------------------------------------------
+void wxTopLevelWindowBase::SetMinSize(const wxSize& minSize)
+{
+ SetSizeHints( minSize.x, minSize.y, GetMaxWidth(), GetMaxHeight() );
+}
+
+void wxTopLevelWindowBase::SetMaxSize(const wxSize& maxSize)
+{
+ SetSizeHints( GetMinWidth(), GetMinHeight(), maxSize.x, maxSize.y );
+}
+
// set the min/max size of the window
void wxTopLevelWindowBase::DoSetSizeHints(int minW, int minH,
int maxW, int maxH,
GetSize(w,h);
}
-wxSize wxTopLevelWindowBase::GetMaxSize() const
-{
- wxSize size = wxWindow::GetMaxSize();
-
- int w, h;
- wxClientDisplayRect(NULL, NULL, &w, &h );
-
- if ( size.GetWidth() == wxDefaultCoord )
- size.SetWidth(w);
-
- if ( size.GetHeight() == wxDefaultCoord )
- size.SetHeight(h);
-
- return size;
-}
-
/* static */
wxSize wxTopLevelWindowBase::GetDefaultSize()
{
if ( rectParent.IsEmpty() )
{
- // we were explicitely asked to centre this window on the entire screen
+ // we were explicitly asked to centre this window on the entire screen
// or if we have no parent anyhow and so can't centre on it
rectParent = rectDisplay;
}
{
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
+ // move the window just enough for the bottom right corner to
+ // become visible
int dx = rectDisplay.GetRight() - rect.GetRight();
int dy = rectDisplay.GetBottom() - rect.GetBottom();
- rect.Offset(dx, dy);
+ rect.Offset(dx < 0 ? dx : 0, dy < 0 ? dy : 0);
}
//else: the window top left and bottom right corner are both visible,
// although the window might still be not entirely on screen (with
int clientW, clientH;
DoGetClientSize(&clientW, &clientH);
- // for whatever reasons, wxGTK wants to have a small offset - it
- // probably looks better with it?
-#ifdef __WXGTK__
- const int ofs = 1;
- clientW -= 2 * ofs;
- clientH -= 2 * ofs;
- if (clientW < 0)
- clientW = 0;
- if (clientH < 0)
- clientH = 0;
-#else
- const int ofs = 0;
-#endif
-
- child->SetSize(ofs, ofs, clientW, clientH);
+ child->SetSize(0, 0, clientW, clientH);
}
}
}