From df336b7f251b1df65c27d761beb9fff7cdf34e9a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 27 Nov 2001 16:15:25 +0000 Subject: [PATCH] fudged the extra width in GetBestSize() to fit better git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12729 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/choice.cpp | 25 ++++++++++++++----------- src/gtk1/choice.cpp | 25 ++++++++++++++----------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index ca9d9c1785..5d129bb5af 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -114,14 +114,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, SetFont( parent->GetFont() ); - wxSize size_best( DoGetBestSize() ); - wxSize new_size( size ); - if (new_size.x == -1) - new_size.x = size_best.x; - if (new_size.y == -1) - new_size.y = size_best.y; - if ((new_size.x != size.x) || (new_size.y != size.y)) - SetSize( new_size.x, new_size.y ); + SetBestSize(size); SetBackgroundColour( parent->GetBackgroundColour() ); SetForegroundColour( parent->GetForegroundColour() ); @@ -424,8 +417,17 @@ wxSize wxChoice::DoGetBestSize() const ret.x = width; } - // for the choice "=" button - ret.x += 20; + // add extra for the choice "=" button + + // VZ: I don't know how to get the right value, it seems to be in + // GtkOptionMenuProps struct from gtkoptionmenu.c but we can't get + // to it - maybe we can use gtk_option_menu_size_request() for this + // somehow? + // + // This default value works only for the default GTK+ theme (i.e. + // no theme at all) (FIXME) + static const int widthChoiceIndicator = 35; + ret.x += widthChoiceIndicator; } // but not less than the minimal width @@ -436,4 +438,5 @@ wxSize wxChoice::DoGetBestSize() const return ret; } -#endif +#endif // wxUSE_CHOICE + diff --git a/src/gtk1/choice.cpp b/src/gtk1/choice.cpp index ca9d9c1785..5d129bb5af 100644 --- a/src/gtk1/choice.cpp +++ b/src/gtk1/choice.cpp @@ -114,14 +114,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, SetFont( parent->GetFont() ); - wxSize size_best( DoGetBestSize() ); - wxSize new_size( size ); - if (new_size.x == -1) - new_size.x = size_best.x; - if (new_size.y == -1) - new_size.y = size_best.y; - if ((new_size.x != size.x) || (new_size.y != size.y)) - SetSize( new_size.x, new_size.y ); + SetBestSize(size); SetBackgroundColour( parent->GetBackgroundColour() ); SetForegroundColour( parent->GetForegroundColour() ); @@ -424,8 +417,17 @@ wxSize wxChoice::DoGetBestSize() const ret.x = width; } - // for the choice "=" button - ret.x += 20; + // add extra for the choice "=" button + + // VZ: I don't know how to get the right value, it seems to be in + // GtkOptionMenuProps struct from gtkoptionmenu.c but we can't get + // to it - maybe we can use gtk_option_menu_size_request() for this + // somehow? + // + // This default value works only for the default GTK+ theme (i.e. + // no theme at all) (FIXME) + static const int widthChoiceIndicator = 35; + ret.x += widthChoiceIndicator; } // but not less than the minimal width @@ -436,4 +438,5 @@ wxSize wxChoice::DoGetBestSize() const return ret; } -#endif +#endif // wxUSE_CHOICE + -- 2.45.2