- wxSize ret( wxControl::DoGetBestSize() );
-
- // we know better our horizontal extent: it depends on the longest string
- // we have
- ret.x = 0;
- if ( m_widget )
- {
- int width;
- size_t count = GetCount();
- for ( size_t n = 0; n < count; n++ )
- {
- GetTextExtent( GetString(n), &width, NULL, NULL, NULL );
- if ( width > ret.x )
- ret.x = width;
- }
-
- // 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
- if ( ret.x < 80 )
- ret.x = 80;
-
- // 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();
-
- CacheBestSize(ret);
- return ret;
+ // Get the height of the control from GTK+ itself, but use our own version
+ // to compute the width large enough to show all our strings as GTK+
+ // doesn't seem to take the control contents into account.
+ return wxSize(wxChoiceBase::DoGetBestSize().x + 40,
+ wxControl::DoGetBestSize().y);