From b0021947ef615f812b70d0e35a7064a1f002a285 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sat, 23 Oct 2004 16:06:11 +0000 Subject: [PATCH] added InvalidateBestSize calls when combobox's content changes; DoGetBestSize now accounts for the width returned by GTK+ too git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30081 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/combobox.cpp | 21 ++++++++++++--------- src/gtk1/combobox.cpp | 21 ++++++++++++--------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index ab4f7bead8..858e3d13b6 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/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() @@ -720,14 +732,6 @@ 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 ); - - 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 } void wxComboBox::DoApplyWidgetStyle(GtkRcStyle *style) @@ -767,7 +771,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; diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index ab4f7bead8..858e3d13b6 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() @@ -720,14 +732,6 @@ 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 ); - - 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 } void wxComboBox::DoApplyWidgetStyle(GtkRcStyle *style) @@ -767,7 +771,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; -- 2.45.2