]> git.saurik.com Git - wxWidgets.git/commitdiff
use best size instead of hard coded 80*26 in SetSize(wxSIZE_AUTO)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 27 Mar 2004 20:46:58 +0000 (20:46 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 27 Mar 2004 20:46:58 +0000 (20:46 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26415 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/window.cpp
src/gtk1/window.cpp

index a471eeda228fd19323301fae4154d6ca70d1ac00..5eee285dc35c9fa7f4c301c2335d235833560b3c 100644 (file)
@@ -3004,18 +3004,22 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags
             m_x = x + pizza->xoffset;
             m_y = y + pizza->yoffset;
         }
-        if (width != -1) m_width = width;
-        if (height != -1) m_height = height;
 
-        if ((sizeFlags & wxSIZE_AUTO_WIDTH) == wxSIZE_AUTO_WIDTH)
+        // calculate the best size if we should auto size the window
+        if ( (sizeFlags & wxSIZE_AUTO_WIDTH) ||
+                (sizeFlags & wxSIZE_AUTO_HEIGHT) )
         {
-             if (width == -1) m_width = 80;
+            const wxSize sizeBest = GetBestSize();
+            if ( sizeFlags & wxSIZE_AUTO_WIDTH )
+                width = sizeBest.x;
+            if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
+                height = sizeBest.y;
         }
 
-        if ((sizeFlags & wxSIZE_AUTO_HEIGHT) == wxSIZE_AUTO_HEIGHT)
-        {
-             if (height == -1) m_height = 26;
-        }
+        if (width != -1)
+            m_width = width;
+        if (height != -1)
+            m_height = height;
 
         int minWidth = GetMinWidth(),
             minHeight = GetMinHeight(),
index a471eeda228fd19323301fae4154d6ca70d1ac00..5eee285dc35c9fa7f4c301c2335d235833560b3c 100644 (file)
@@ -3004,18 +3004,22 @@ void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags
             m_x = x + pizza->xoffset;
             m_y = y + pizza->yoffset;
         }
-        if (width != -1) m_width = width;
-        if (height != -1) m_height = height;
 
-        if ((sizeFlags & wxSIZE_AUTO_WIDTH) == wxSIZE_AUTO_WIDTH)
+        // calculate the best size if we should auto size the window
+        if ( (sizeFlags & wxSIZE_AUTO_WIDTH) ||
+                (sizeFlags & wxSIZE_AUTO_HEIGHT) )
         {
-             if (width == -1) m_width = 80;
+            const wxSize sizeBest = GetBestSize();
+            if ( sizeFlags & wxSIZE_AUTO_WIDTH )
+                width = sizeBest.x;
+            if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
+                height = sizeBest.y;
         }
 
-        if ((sizeFlags & wxSIZE_AUTO_HEIGHT) == wxSIZE_AUTO_HEIGHT)
-        {
-             if (height == -1) m_height = 26;
-        }
+        if (width != -1)
+            m_width = width;
+        if (height != -1)
+            m_height = height;
 
         int minWidth = GetMinWidth(),
             minHeight = GetMinHeight(),