fix window rectangle computation in Centre(wxCENTER_ON_SCREEN)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53617 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2008-05-17 12:56:18 +00:00
parent d2f3b08582
commit 75454d243d

View File

@ -273,8 +273,11 @@ void wxTopLevelWindowBase::DoCentre(int dir)
if((rectParent == rectDisplay) && IsMaximized()) if((rectParent == rectDisplay) && IsMaximized())
return; return;
if ( !(dir & wxBOTH) )
dir |= wxBOTH; // if neither is specified, center in both directions
// the new window rect candidate // 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 // 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 // this is (almost?) never wanted and it would be very difficult to prevent