X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d1d1f8175d3f71a4f021ffa8d255f80a05eaffd0..f13d956e6a1acc9f22b802e8ad614bf08e47a3d1:/src/gtk/combobox.cpp diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 3abab97145..a0fb1e962d 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -118,7 +118,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, } if (HasFlag(wxCB_SORT)) - m_strings = new wxSortedArrayString(); + m_strings = new wxGtkCollatedArrayString(); GTKCreateComboBoxWidget(); @@ -222,11 +222,26 @@ void wxComboBox::OnChar( wxKeyEvent &event ) event.Skip(); } -void wxComboBox::DisableEvents() +void wxComboBox::EnableTextChangedEvents(bool enable) { - if ( GetEntry() ) + if ( !GetEntry() ) + return; + + if ( enable ) + { + g_signal_handlers_unblock_by_func(GTK_BIN(m_widget)->child, + (gpointer)gtkcombobox_text_changed_callback, this); + } + else // disable + { g_signal_handlers_block_by_func(GTK_BIN(m_widget)->child, (gpointer)gtkcombobox_text_changed_callback, this); + } +} + +void wxComboBox::GTKDisableEvents() +{ + EnableTextChangedEvents(false); g_signal_handlers_block_by_func(m_widget, (gpointer)gtkcombobox_changed_callback, this); @@ -234,11 +249,9 @@ void wxComboBox::DisableEvents() (gpointer)gtkcombobox_popupshown_callback, this); } -void wxComboBox::EnableEvents() +void wxComboBox::GTKEnableEvents() { - if ( GetEntry() ) - g_signal_handlers_unblock_by_func(GTK_BIN(m_widget)->child, - (gpointer)gtkcombobox_text_changed_callback, this); + EnableTextChangedEvents(true); g_signal_handlers_unblock_by_func(m_widget, (gpointer)gtkcombobox_changed_callback, this); @@ -263,6 +276,14 @@ wxComboBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) return GetDefaultAttributesFromGTKWidget(gtk_combo_box_entry_new, true); } +void wxComboBox::SetValue(const wxString& value) +{ + if ( HasFlag(wxCB_READONLY) ) + SetStringSelection(value); + else + wxTextEntry::SetValue(value); +} + // ---------------------------------------------------------------------------- // standard event handling // ----------------------------------------------------------------------------