+ if (!combo->m_hasVMT) return;
+
+ wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
+ event.SetString( combo->GetValue() );
+ event.SetEventObject( combo );
+ combo->GetEventHandler()->ProcessEvent( event );
+}
+}
+
+extern "C" {
+static void
+gtkcombo_dummy_callback(GtkEntry *WXUNUSED(entry), GtkCombo *WXUNUSED(combo))
+{
+}
+}
+
+extern "C" {
+static void
+gtkcombo_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo)
+{
+ // when the popup is hidden, throw a SELECTED event only if the combobox
+ // selection changed.
+ const int curSelection = combo->GetCurrentSelection();
+
+ const bool hasChanged = curSelection != g_SelectionBeforePopup;
+
+ // reset the selection flag to value meaning that it is hidden and do it
+ // now, before generating the events, so that GetSelection() returns the
+ // new value from the event handler
+ g_SelectionBeforePopup = wxID_NONE;
+
+ if ( hasChanged )
+ {
+ wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, combo->GetId() );
+ event.SetInt( curSelection );
+ event.SetString( combo->GetStringSelection() );
+ event.SetEventObject( combo );
+ combo->GetEventHandler()->ProcessEvent( event );
+
+ // for consistency with the other ports, send TEXT event
+ wxCommandEvent event2( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
+ event2.SetString( combo->GetStringSelection() );
+ event2.SetEventObject( combo );
+ combo->GetEventHandler()->ProcessEvent( event2 );
+ }
+}
+}
+
+extern "C" {
+static void
+gtkcombo_popup_show_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo)
+{
+ // store the combobox selection value before the popup is shown
+ g_SelectionBeforePopup = combo->GetCurrentSelection();
+}
+}
+
+//-----------------------------------------------------------------------------
+// "select-child" - click/cursor get select-child, changed, select-child
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static void
+gtkcombo_combo_select_child_callback( GtkList *WXUNUSED(list), GtkWidget *WXUNUSED(widget), wxComboBox *combo )
+{
+ if (g_isIdle) wxapp_install_idle_handler();
+
+ if (!combo->m_hasVMT) return;
+
+ if (g_blockEventsOnDrag) return;
+
+ int curSelection = combo->GetCurrentSelection();
+
+ if (combo->m_prevSelection == curSelection) return;
+
+ GtkWidget *list = GTK_COMBO(combo->m_widget)->list;
+ gtk_list_unselect_item( GTK_LIST(list), combo->m_prevSelection );
+
+ combo->m_prevSelection = curSelection;
+
+ // Quickly set the value of the combo box
+ // as GTK+ does that only AFTER the event
+ // is sent.
+ g_signal_handlers_disconnect_by_func (GTK_COMBO (combo->GetHandle())->entry,
+ (gpointer) gtkcombo_text_changed_callback,
+ combo);
+ combo->SetValue( combo->GetStringSelection() );
+ g_signal_connect_after (GTK_COMBO (combo->GetHandle())->entry, "changed",
+ G_CALLBACK (gtkcombo_text_changed_callback), combo);
+
+ // throw a SELECTED event only if the combobox popup is hidden (wxID_NONE)
+ // because when combobox popup is shown, gtkcombo_combo_select_child_callback is
+ // called each times the mouse is over an item with a pressed button so a lot
+ // of SELECTED event could be generated if the user keep the mouse button down
+ // and select other items ...
+ if (g_SelectionBeforePopup == wxID_NONE)
+ {
+ wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, combo->GetId() );
+ event.SetInt( curSelection );
+ event.SetString( combo->GetStringSelection() );
+ event.SetEventObject( combo );
+ combo->GetEventHandler()->ProcessEvent( event );
+
+ // for consistency with the other ports, don't generate text update
+ // events while the user is browsing the combobox neither
+ wxCommandEvent event2( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
+ event2.SetString( combo->GetValue() );
+ event2.SetEventObject( combo );
+ combo->GetEventHandler()->ProcessEvent( event2 );
+ }
+}
+}
+
+#ifdef __WXGTK24__
+extern "C" {
+static void
+gtkcombobox_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
+{
+ if (g_isIdle) wxapp_install_idle_handler();
+
+ if (!combo->m_hasVMT) return;
+
+ wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
+ event.SetString( combo->GetValue() );
+ event.SetEventObject( combo );
+ combo->GetEventHandler()->ProcessEvent( event );
+}
+}
+
+extern "C" {
+static void
+gtkcombobox_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
+{
+ if (g_isIdle) wxapp_install_idle_handler();
+
+ if (!combo->m_hasVMT) return;
+
+ if (combo->GetSelection() == -1)
+ return;
+
+ wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, combo->GetId() );