X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4262848117c2844a0e1f82638f1bad36150fbe05..708cc39462e4f113ab1a52b502b79d1e473059e7:/src/gtk/combobox.cpp diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index e5a8a75d6d..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); @@ -251,10 +264,8 @@ GtkWidget* wxComboBox::GetConnectWidget() return GTK_WIDGET( GetEntry() ); } -GdkWindow *wxComboBox::GTKGetWindow(wxArrayGdkWindows& windows) const +GdkWindow* wxComboBox::GTKGetWindow(wxArrayGdkWindows& /* windows */) const { - wxUnusedVar(windows); - return GetEntry()->text_area; } @@ -265,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 // ---------------------------------------------------------------------------- @@ -339,4 +358,13 @@ void wxComboBox::OnUpdateSelectAll(wxUpdateUIEvent& event) event.Enable(!wxTextEntry::IsEmpty()); } +void wxComboBox::Popup() +{ + gtk_combo_box_popup( GTK_COMBO_BOX(m_widget) ); +} + +void wxComboBox::Dismiss() +{ + gtk_combo_box_popdown( GTK_COMBO_BOX(m_widget) ); +} #endif // wxUSE_COMBOBOX