]> git.saurik.com Git - wxWidgets.git/commitdiff
Improve default size for wxGauge and wxChoice.
authorRobert Roebling <robert@roebling.de>
Sat, 15 May 2004 15:08:30 +0000 (15:08 +0000)
committerRobert Roebling <robert@roebling.de>
Sat, 15 May 2004 15:08:30 +0000 (15:08 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27292 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/choice.cpp
src/gtk/gauge.cpp
src/gtk1/choice.cpp
src/gtk1/gauge.cpp

index 384f8b5d0048366b24c45f4d8736dff21b23c026..54f9b1de429bc3f67edbf1ae2f50881a0eaed2b8 100644 (file)
@@ -560,7 +560,11 @@ wxSize wxChoice::DoGetBestSize() const
     if ( ret.x < 80 )
         ret.x = 80;
 
-    ret.y = 16 + GetCharHeight();
+    // If this request_size is called with no entries then
+    // the returned height is wrong. Give it a reasonable
+    // default value.
+    if (ret.y <= 18)
+        ret.y = 8 + GetCharHeight();
 
     return ret;
 }
index b6cd78c4c5a4c1905bc56b3a5e8eef5647d59999..7fe754a52e2f6a68a1ac1de0925ea6e787a1f43e 100644 (file)
@@ -72,10 +72,10 @@ void wxGauge::DoSetGauge()
 
 wxSize wxGauge::DoGetBestSize() const
 {
-    if (HasFlag(wxGA_HORIZONTAL))
-        return wxSize(100, 28);
-    else
+    if (HasFlag(wxGA_VERTICAL))
         return wxSize(28, 100);
+    else
+        return wxSize(100, 28);
 }
 
 void wxGauge::SetRange( int range )
index 384f8b5d0048366b24c45f4d8736dff21b23c026..54f9b1de429bc3f67edbf1ae2f50881a0eaed2b8 100644 (file)
@@ -560,7 +560,11 @@ wxSize wxChoice::DoGetBestSize() const
     if ( ret.x < 80 )
         ret.x = 80;
 
-    ret.y = 16 + GetCharHeight();
+    // If this request_size is called with no entries then
+    // the returned height is wrong. Give it a reasonable
+    // default value.
+    if (ret.y <= 18)
+        ret.y = 8 + GetCharHeight();
 
     return ret;
 }
index b6cd78c4c5a4c1905bc56b3a5e8eef5647d59999..7fe754a52e2f6a68a1ac1de0925ea6e787a1f43e 100644 (file)
@@ -72,10 +72,10 @@ void wxGauge::DoSetGauge()
 
 wxSize wxGauge::DoGetBestSize() const
 {
-    if (HasFlag(wxGA_HORIZONTAL))
-        return wxSize(100, 28);
-    else
+    if (HasFlag(wxGA_VERTICAL))
         return wxSize(28, 100);
+    else
+        return wxSize(100, 28);
 }
 
 void wxGauge::SetRange( int range )