X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/071a2d78147df569d57b1ef138ab126a586b594d..f22e0c3c3f90510f1a92ab148f20b2453e338626:/src/gtk/combobox.cpp diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 32b082064a..b8ed05b45f 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -101,11 +101,21 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, m_needParent = TRUE; m_acceptsFocus = TRUE; - if (!PreCreation( parent, pos, size ) || + wxSize newSize = size, + bestSize = DoGetBestSize(); + + if (newSize.x == -1) + newSize.x = bestSize.x; + if (newSize.y == -1) + newSize.y = bestSize.y; + if (newSize.y > 30) + newSize.y = 30; + + if (!PreCreation( parent, pos, newSize ) || !CreateBase( parent, id, pos, size, style, validator, name )) { wxFAIL_MSG( wxT("wxComboBox creation failed") ); - return FALSE; + return FALSE; } m_widget = gtk_combo_new(); @@ -113,14 +123,12 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, // make it more useable gtk_combo_set_use_arrows_always(GTK_COMBO(m_widget), TRUE); - SetSizeOrDefault( size ); - GtkWidget *list = GTK_COMBO(m_widget)->list; for (int i = 0; i < n; i++) { /* don't send first event, which GTK sends aways when - inserting the first item */ + inserting the first item */ m_alreadySent = TRUE; GtkWidget *list_item = gtk_list_item_new_with_label( choices[i].mbc_str() ); @@ -455,7 +463,7 @@ void wxComboBox::Copy() wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); GtkWidget *entry = GTK_COMBO(m_widget)->entry; -#if (GTK_MINOR_VERSION > 0) +#if defined(__WXGTK13__) || (GTK_MINOR_VERSION > 0) gtk_editable_copy_clipboard( GTK_EDITABLE(entry) ); #else gtk_editable_copy_clipboard( GTK_EDITABLE(entry), 0 ); @@ -467,7 +475,7 @@ void wxComboBox::Cut() wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); GtkWidget *entry = GTK_COMBO(m_widget)->entry; -#if (GTK_MINOR_VERSION > 0) +#if defined(__WXGTK13__) || (GTK_MINOR_VERSION > 0) gtk_editable_cut_clipboard( GTK_EDITABLE(entry) ); #else gtk_editable_cut_clipboard( GTK_EDITABLE(entry), 0 ); @@ -479,7 +487,7 @@ void wxComboBox::Paste() wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); GtkWidget *entry = GTK_COMBO(m_widget)->entry; -#if (GTK_MINOR_VERSION > 0) +#if defined(__WXGTK13__) || (GTK_MINOR_VERSION > 0) gtk_editable_paste_clipboard( GTK_EDITABLE(entry) ); #else gtk_editable_paste_clipboard( GTK_EDITABLE(entry), 0 ); @@ -657,6 +665,7 @@ bool wxComboBox::IsOwnGtkWindow( GdkWindow *window ) wxSize wxComboBox::DoGetBestSize() const { + // totally bogus - should measure the strings in the combo! return wxSize(100, 26); }