]> git.saurik.com Git - wxWidgets.git/commitdiff
Sizer based dialogs (like wxSingleChoiceDialog) are now forced to initially appear...
authorGeorge Tasker <gtasker@allenbrook.com>
Fri, 11 May 2001 20:23:58 +0000 (20:23 +0000)
committerGeorge Tasker <gtasker@allenbrook.com>
Fri, 11 May 2001 20:23:58 +0000 (20:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10134 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/sizer.cpp
src/common/wincmn.cpp

index 049760f8c2db8b157a45ba0547208fa12ccb23c6..3915938467a1d3bb43c3db71d1500268d18fee80 100644 (file)
@@ -378,9 +378,12 @@ void wxSizer::SetSizeHints( wxWindow *window )
 
 wxSize wxSizer::GetMaxWindowSize( wxWindow *WXUNUSED(window) )
 {
-    wxSize sizeMax = wxGetDisplaySize();
-    // make the max size a bit smaller than the screen, a window which takes
-    // the entire screen doesn't look very nice neither
+    wxRect rect = wxGetClientDisplayRect();
+    wxSize sizeMax (rect.width,rect.height);
+
+    // Make the max size a bit smaller than the visible portion of 
+    // the screen.  A window which takes the entire screen doesn't 
+    // look very nice either
     sizeMax.x *= 9;
     sizeMax.x /= 10;
 
index 48e44b9946e314ae3a365f4039d32a1ae94f437f..95c51f5899b248dfd7e48b7757cf31c65fd15784 100644 (file)
@@ -395,6 +395,30 @@ void wxWindowBase::Centre(int direction)
     xNew += posParent.x;
     yNew += posParent.y;
 
+    // Base size of the visible dimensions of the display
+    // to take into account the taskbar
+    wxRect rect = wxGetClientDisplayRect();
+    wxSize size (rect.width,rect.height);
+
+    if (posParent.x >= 0)  // if parent is on the main display
+    {
+        if (xNew < 0)
+            xNew = 0;
+        else if (xNew+width > size.x)
+            xNew = size.x-width-1;
+    }
+    if (posParent.y >= 0)  // if parent is on the main display
+    {
+        if (yNew+height > size.y)
+            yNew = size.y-height-1;
+
+        // Make certain that the title bar is initially visible
+        // always, even if this would push the bottom of the
+        // dialog of the visible area of the display
+        if (yNew < 0)
+            yNew = 0;
+    }
+
     // 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);