better approach to centering windows (in absence of somebody else's solution...)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14299 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -405,18 +405,18 @@ void wxWindowBase::Centre(int direction)
|
|||||||
wxRect rect = wxGetClientDisplayRect();
|
wxRect rect = wxGetClientDisplayRect();
|
||||||
wxSize size (rect.width,rect.height);
|
wxSize size (rect.width,rect.height);
|
||||||
|
|
||||||
#ifndef __WXMGL__ // FIXME - temporary dirty hack!!
|
// NB: in wxMSW, negative position may not neccessary mean "out of screen",
|
||||||
if (posParent.x >= 0) // if parent is on the main display
|
// but it may mean that the window is placed on other than the main
|
||||||
#endif
|
// display. Therefore we only make sure centered window is on the main display
|
||||||
|
// if the parent is at least partially present here.
|
||||||
|
if (posParent.x + widthParent >= 0) // if parent is (partially) on the main display
|
||||||
{
|
{
|
||||||
if (xNew < 0)
|
if (xNew < 0)
|
||||||
xNew = 0;
|
xNew = 0;
|
||||||
else if (xNew+width > size.x)
|
else if (xNew+width > size.x)
|
||||||
xNew = size.x-width-1;
|
xNew = size.x-width-1;
|
||||||
}
|
}
|
||||||
#ifndef __WXMGL__ // FIXME - temporary dirty hack!!
|
if (posParent.y + heightParent >= 0) // if parent is (partially) on the main display
|
||||||
if (posParent.y >= 0) // if parent is on the main display
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (yNew+height > size.y)
|
if (yNew+height > size.y)
|
||||||
yNew = size.y-height-1;
|
yNew = size.y-height-1;
|
||||||
|
Reference in New Issue
Block a user