X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/071a2d78147df569d57b1ef138ab126a586b594d..e4315700228573d42a9afb1498fec4ee7b95ccb0:/src/gtk1/choice.cpp?ds=sidebyside diff --git a/src/gtk1/choice.cpp b/src/gtk1/choice.cpp index 97ea9be8b9..0106c68dff 100644 --- a/src/gtk1/choice.cpp +++ b/src/gtk1/choice.cpp @@ -12,10 +12,12 @@ #pragma implementation "choice.h" #endif -#include "wx/choice.h" +#include "wx/defs.h" #if wxUSE_CHOICE +#include "wx/choice.h" + #include #include @@ -90,8 +92,6 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, m_widget = gtk_option_menu_new(); - SetSizeOrDefault( size ); - if ( style & wxCB_SORT ) { // if our m_strings != NULL, DoAppend() will check for it and insert @@ -112,9 +112,19 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, PostCreation(); + 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 ); + SetBackgroundColour( parent->GetBackgroundColour() ); SetForegroundColour( parent->GetForegroundColour() ); - SetFont( parent->GetFont() ); Show( TRUE ); @@ -396,7 +406,10 @@ size_t wxChoice::GtkAppendHelper(GtkWidget *menu, const wxString& item) wxSize wxChoice::DoGetBestSize() const { - return wxSize(80, 26); + wxSize ret( wxControl::DoGetBestSize() ); + if (ret.x < 80) ret.x = 80; + ret.y = 16 + gdk_char_height( m_widget->style->font, 'H' ); + return ret; } #endif