X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3c4e4af64e63b096f5f58fd2482b48dc4725e841..1d6560d796aefb5dbdf217109767b1054c68c291:/src/gtk1/combobox.cpp?ds=inline diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index fc3754d399..7d42568e62 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -262,6 +262,8 @@ int wxComboBox::DoAppend( const wxString &item ) EnableEvents(); + InvalidateBestSize(); + return count - 1; } @@ -306,6 +308,8 @@ int wxComboBox::DoInsert( const wxString &item, int pos ) m_clientObjectList.Insert( pos, (wxObject*) NULL ); EnableEvents(); + + InvalidateBestSize(); return pos; } @@ -371,6 +375,8 @@ void wxComboBox::Clear() m_clientDataList.Clear(); EnableEvents(); + + InvalidateBestSize(); } void wxComboBox::Delete( int n ) @@ -406,6 +412,8 @@ void wxComboBox::Delete( int n ) m_clientDataList.Erase( node ); EnableEvents(); + + InvalidateBestSize(); } void wxComboBox::SetString(int n, const wxString &text) @@ -425,6 +433,8 @@ void wxComboBox::SetString(int n, const wxString &text) { wxFAIL_MSG( wxT("wxComboBox: wrong index") ); } + + InvalidateBestSize(); } int wxComboBox::FindString( const wxString &item ) const @@ -587,6 +597,8 @@ void wxComboBox::SetValue( const wxString& value ) wxString tmp = wxT(""); if (!value.IsNull()) tmp = value; gtk_entry_set_text( GTK_ENTRY(entry), wxGTK_CONV( tmp ) ); + + InvalidateBestSize(); } void wxComboBox::Copy() @@ -719,20 +731,22 @@ void wxComboBox::EnableEvents() void wxComboBox::OnSize( wxSizeEvent &event ) { - event.Skip(); - -#if 0 - int w = 21; - gtk_widget_set_usize( GTK_COMBO(m_widget)->entry, m_width-w-1, m_height ); + // NB: In some situations (e.g. on non-first page of a wizard, if the + // size used is default size), GtkCombo widget is resized correctly, + // but it's look is not updated, it's rendered as if it was much wider. + // No other widgets are affected, so it looks like a bug in GTK+. + // Manually requesting resize calculation (as gtk_pizza_set_size does) + // fixes it. + if (GTK_WIDGET_VISIBLE(m_widget)) + gtk_widget_queue_resize(m_widget); - gtk_widget_set_uposition( GTK_COMBO(m_widget)->button, m_x+m_width-w, m_y ); - gtk_widget_set_usize( GTK_COMBO(m_widget)->button, w, m_height ); -#endif // 0 + event.Skip(); } void wxComboBox::DoApplyWidgetStyle(GtkRcStyle *style) { // gtk_widget_modify_style( GTK_COMBO(m_widget)->button, syle ); + gtk_widget_modify_style( GTK_COMBO(m_widget)->entry, style ); gtk_widget_modify_style( GTK_COMBO(m_widget)->list, style ); @@ -766,7 +780,6 @@ wxSize wxComboBox::DoGetBestSize() const // we know better our horizontal extent: it depends on the longest string // in the combobox - ret.x = 0; if ( m_widget ) { int width;