From ebbb22bd7fd61025ea69869a85a7da4897cda47b Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sat, 15 May 2004 15:08:30 +0000 Subject: [PATCH] Improve default size for wxGauge and wxChoice. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27292 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/choice.cpp | 6 +++++- src/gtk/gauge.cpp | 6 +++--- src/gtk1/choice.cpp | 6 +++++- src/gtk1/gauge.cpp | 6 +++--- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index 384f8b5d00..54f9b1de42 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -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; } diff --git a/src/gtk/gauge.cpp b/src/gtk/gauge.cpp index b6cd78c4c5..7fe754a52e 100644 --- a/src/gtk/gauge.cpp +++ b/src/gtk/gauge.cpp @@ -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 ) diff --git a/src/gtk1/choice.cpp b/src/gtk1/choice.cpp index 384f8b5d00..54f9b1de42 100644 --- a/src/gtk1/choice.cpp +++ b/src/gtk1/choice.cpp @@ -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; } diff --git a/src/gtk1/gauge.cpp b/src/gtk1/gauge.cpp index b6cd78c4c5..7fe754a52e 100644 --- a/src/gtk1/gauge.cpp +++ b/src/gtk1/gauge.cpp @@ -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 ) -- 2.47.2