X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e63fdcd600e2eb717a19f9fa2895e9256e83c890..ce16e5d78fad60b6bbc6ef8889a663fd1c9f23d2:/src/common/wincmn.cpp diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index b95dde4a4b..59f3a09ffb 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -393,8 +393,9 @@ void wxWindowBase::Centre(int direction) xNew += posParent.x; yNew += posParent.y; - // move the centre of this window to this position - Move(xNew, yNew); + // move the window to this position (keeping the old size but using + // SetSize() and not Move() to allow xNew and/or yNew to be -1) + SetSize(xNew, yNew, width, height, wxSIZE_ALLOW_MINUS_ONE); } // fits the window around the children @@ -402,7 +403,14 @@ void wxWindowBase::Fit() { if ( GetChildren().GetCount() > 0 ) { - SetClientSize(DoGetBestSize()); + wxSize size = DoGetBestSize(); + + // for compatibility with the old versions and because it really looks + // slightly more pretty like this, add a pad + size.x += 7; + size.y += 14; + + SetClientSize(size); } //else: do nothing if we have no children } @@ -446,8 +454,7 @@ wxSize wxWindowBase::DoGetBestSize() const maxY = wy + wh; } - // leave a margin - return wxSize(maxX + 7, maxY + 14); + return wxSize(maxX, maxY); } else {