-bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
-  const wxPoint& pos, const wxSize& size,
-  int n, const wxString choices[],
-  long style, const wxString& name )
-{
-  m_needParent = TRUE;
-  
-  PreCreation( parent, id, pos, size, style, name );
-  
-  m_widget = gtk_combo_new();
-  
-  wxSize newSize = size;
-  if (newSize.x == -1) newSize.x = 100;
-  if (newSize.y == -1) newSize.y = 26;
-  SetSize( newSize.x, newSize.y );
-  
-  GtkWidget *list = GTK_COMBO(m_widget)->list;
-  
-  for (int i = 0; i < n; i++)
-  {
-    GtkWidget *list_item;
-    list_item = gtk_list_item_new_with_label( choices[i] ); 
-  
-    gtk_signal_connect( GTK_OBJECT(list_item), "select", 
-      GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
-  
-    gtk_container_add( GTK_CONTAINER(list), list_item );
-    
-    gtk_widget_show( list_item );
-  };
-  
-  PostCreation();
-
-  if (!value.IsNull()) SetValue( value );
-    
-  Show( TRUE );
-    
-  return TRUE;
-};
-
-void wxComboBox::Clear(void)
-{
-  GtkWidget *list = GTK_COMBO(m_widget)->list;
-  gtk_list_clear_items( GTK_LIST(list), 0, Number() );
-};
-
-void wxComboBox::Append( const wxString &item )
-{
-  GtkWidget *list = GTK_COMBO(m_widget)->list;
-  
-  GtkWidget *list_item;
-  list_item = gtk_list_item_new_with_label( item ); 
-  
- gtk_signal_connect( GTK_OBJECT(list_item), "select", 
-    GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
-  
-  gtk_container_add( GTK_CONTAINER(list), list_item );
-    
-  gtk_widget_show( list_item );
-};
-
-void wxComboBox::Append( const wxString &WXUNUSED(item), char* WXUNUSED(clientData) )
-{
-};
-
-void wxComboBox::Delete( int n )
-{
-  GtkWidget *list = GTK_COMBO(m_widget)->list;
-  gtk_list_clear_items( GTK_LIST(list), n, n );
-};
-
-int wxComboBox::FindString( const wxString &item )
-{
-  GtkWidget *list = GTK_COMBO(m_widget)->list;
-  
-  GList *child = GTK_LIST(list)->children;
-  int count = 0;
-  while (child)
-  {
-    GtkBin *bin = GTK_BIN( child->data );
-    GtkLabel *label = GTK_LABEL( bin->child );
-    if (item == label->label) return count;
-    count++;
-    child = child->next;
-  };
-  return -1;
-};
-
-char* wxComboBox::GetClientData( int n )
-{
-  wxNode *node = m_clientData.Nth( n );
-  if (node) return (char*)node->Data();
-  return NULL;
-};
-
-void wxComboBox::SetClientData( int n, char * clientData )
-{
-  wxNode *node = m_clientData.Nth( n );
-  if (node) node->SetData( (wxObject*) clientData );
-};
-
-int wxComboBox::GetSelection(void) const
-{
-  GtkWidget *list = GTK_COMBO(m_widget)->list;
-  
-  GList *selection = GTK_LIST(list)->selection;
-  if (selection)
-  {
-    GList *child = GTK_LIST(list)->children;
-    int count = 0;
-    while (child)
-    {
-      if (child->data == selection->data) return count;
-      count++;
-      child = child->next;
-    };
-  };
-  return -1;
-};
-
-wxString wxComboBox::GetString( int n ) const
-{
-  GtkWidget *list = GTK_COMBO(m_widget)->list;
-  
-  GList *child = g_list_nth( GTK_LIST(list)->children, n );
-  if (child)
-  {
-    GtkBin *bin = GTK_BIN( child->data );
-    GtkLabel *label = GTK_LABEL( bin->child );
-    return label->label;
-  };
-  return "";
-};
-
-wxString wxComboBox::GetStringSelection(void) const
-{
-  GtkWidget *list = GTK_COMBO(m_widget)->list;
-  
-  GList *selection = GTK_LIST(list)->selection;
-  if (selection)
-  {
-    GtkBin *bin = GTK_BIN( selection->data );
-    wxString tmp = GTK_LABEL( bin->child )->label;
-    return tmp;
-  };
-  return "";
-};
+BEGIN_EVENT_TABLE(wxComboBox, wxControl)
+    EVT_SIZE(wxComboBox::OnSize)
+    EVT_CHAR(wxComboBox::OnChar)
+
+    EVT_MENU(wxID_CUT, wxComboBox::OnCut)
+    EVT_MENU(wxID_COPY, wxComboBox::OnCopy)
+    EVT_MENU(wxID_PASTE, wxComboBox::OnPaste)
+    EVT_MENU(wxID_UNDO, wxComboBox::OnUndo)
+    EVT_MENU(wxID_REDO, wxComboBox::OnRedo)
+    EVT_MENU(wxID_CLEAR, wxComboBox::OnDelete)
+    EVT_MENU(wxID_SELECTALL, wxComboBox::OnSelectAll)
+
+    EVT_UPDATE_UI(wxID_CUT, wxComboBox::OnUpdateCut)
+    EVT_UPDATE_UI(wxID_COPY, wxComboBox::OnUpdateCopy)
+    EVT_UPDATE_UI(wxID_PASTE, wxComboBox::OnUpdatePaste)
+    EVT_UPDATE_UI(wxID_UNDO, wxComboBox::OnUpdateUndo)
+    EVT_UPDATE_UI(wxID_REDO, wxComboBox::OnUpdateRedo)
+    EVT_UPDATE_UI(wxID_CLEAR, wxComboBox::OnUpdateDelete)
+    EVT_UPDATE_UI(wxID_SELECTALL, wxComboBox::OnUpdateSelectAll)
+END_EVENT_TABLE()
+
+bool wxComboBox::Create( wxWindow *parent, wxWindowID id,
+                         const wxString& value,
+                         const wxPoint& pos, const wxSize& size,
+                         const wxArrayString& choices,
+                         long style, const wxValidator& validator,
+                         const wxString& name )
+{
+    wxCArrayString chs(choices);
+
+    return Create( parent, id, value, pos, size, chs.GetCount(),
+                   chs.GetStrings(), style, validator, name );
+}
+
+bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
+                         const wxPoint& pos, const wxSize& size,
+                         int n, const wxString choices[],
+                         long style, const wxValidator& validator,
+                         const wxString& name )
+{
+    m_strings = NULL;
+    m_ignoreNextUpdate = false;
+    m_prevSelection = 0;
+
+    if (!PreCreation( parent, pos, size ) ||
+        !CreateBase( parent, id, pos, size, style, validator, name ))
+    {
+        wxFAIL_MSG( wxT("wxComboBox creation failed") );
+        return false;
+    }
+
+    if(HasFlag(wxCB_SORT))
+        m_strings = new wxSortedArrayString();
+
+#ifdef __WXGTK24__
+    if (!gtk_check_version(2,4,0))
+    {
+        m_widget = gtk_combo_box_entry_new_text();
+
+        gtk_entry_set_editable( GTK_ENTRY( GTK_BIN(m_widget)->child ), TRUE );
+    }
+    else
+#endif
+    {
+        m_widget = gtk_combo_new();
+        GtkCombo* combo = GTK_COMBO(m_widget);
+
+        // Disable GTK's broken events ...
+        g_signal_handler_disconnect (combo->entry, combo->entry_change_id);
+        // ... and add surrogate handler.
+        combo->entry_change_id = g_signal_connect (combo->entry, "changed",
+                                               G_CALLBACK (gtkcombo_dummy_callback),
+                                               combo);
+
+        // make it more useable
+        gtk_combo_set_use_arrows_always( GTK_COMBO(m_widget), TRUE );
+
+        // and case-sensitive
+        gtk_combo_set_case_sensitive( GTK_COMBO(m_widget), TRUE );
+
+        if (style & wxNO_BORDER)
+            g_object_set (combo->entry, "has-frame", FALSE, NULL );
+    }
+
+    Append(n, choices);
+
+    m_parent->DoAddChild( this );
+
+    GtkEntry *entry = NULL;
+#ifdef __WXGTK24__
+    if (!gtk_check_version(2,4,0))
+        entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
+    else
+#endif
+        entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
+
+    m_focusWidget = GTK_WIDGET( entry );
+
+    PostCreation(size);
+
+#ifdef __WXGTK24__
+    if (!gtk_check_version(2,4,0))
+        ConnectWidget( m_widget );
+    else
+#endif
+        ConnectWidget( GTK_COMBO(m_widget)->button );
+
+#ifdef __WXGTK24__
+    if (!gtk_check_version(2,4,0))
+    {
+        gtk_entry_set_text( entry, wxGTK_CONV(value) );
+
+        if (style & wxCB_READONLY)
+            gtk_entry_set_editable( entry, FALSE );
+
+        g_signal_connect_after (entry, "changed",
+                            G_CALLBACK (gtkcombobox_text_changed_callback), this);
+
+        g_signal_connect_after (m_widget, "changed",
+                            G_CALLBACK (gtkcombobox_changed_callback), this);
+
+    }
+    else
+#endif
+    {
+        GtkCombo *combo = GTK_COMBO(m_widget);
+        // MSW's combo box shows the value and the selection is -1
+        gtk_entry_set_text( entry, wxGTK_CONV(value) );
+        gtk_list_unselect_all( GTK_LIST(combo->list) );
+
+        if (style & wxCB_READONLY)
+            gtk_entry_set_editable( entry, FALSE );
+
+        // "show" and "hide" events are generated when user click on the combobox button which popups a list
+        // this list is the "popwin" gtk widget
+        g_signal_connect (GTK_COMBO(combo)->popwin, "hide",
+                      G_CALLBACK (gtkcombo_popup_hide_callback), this);
+        g_signal_connect (GTK_COMBO(combo)->popwin, "show",
+                      G_CALLBACK (gtkcombo_popup_show_callback), this);
+        g_signal_connect_after (combo->list, "select-child",
+                            G_CALLBACK (gtkcombo_combo_select_child_callback),
+                            this);
+        g_signal_connect_after (entry, "changed",
+                            G_CALLBACK (gtkcombo_text_changed_callback), this);
+    }
+
+    SetInitialSize(size); // need this too because this is a wxControlWithItems
+
+    return true;
+}
+
+wxComboBox::~wxComboBox()
+{
+    Clear();
+
+    delete m_strings;
+}
+
+void wxComboBox::SetFocus()
+{
+    if ( m_hasFocus )
+    {
+        // don't do anything if we already have focus
+        return;
+    }
+
+    gtk_widget_grab_focus( m_focusWidget );
+}
+
+int wxComboBox::DoInsertItems(const wxArrayStringsAdapter & items,
+                              unsigned int pos,
+                              void **clientData, wxClientDataType type)
+{
+    wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid combobox") );
+
+    wxASSERT_MSG( !IsSorted() || (pos == GetCount()),
+                 _T("In a sorted combobox data could only be appended"));
+
+    const int count = items.GetCount();
+
+    int n = wxNOT_FOUND;
+
+#ifdef __WXGTK24__
+    if (!gtk_check_version(2,4,0))
+    {
+        GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
+        for( int i = 0; i < count; ++i )
+        {
+            n = pos + i;
+            // If sorted, use this wxSortedArrayStrings to determine
+            // the right insertion point
+            if(m_strings)
+                n = m_strings->Add(items[i]);
+
+            gtk_combo_box_insert_text( combobox, n, wxGTK_CONV( items[i] ) );
+
+            m_clientData.Insert( NULL, n );
+            AssignNewItemClientData(n, clientData, i, type);
+        }
+    }
+    else
+#endif
+    {
+        DisableEvents();
+
+        GtkWidget *list = GTK_COMBO(m_widget)->list;
+        for( int i = 0; i < count; ++i )
+        {
+            n = pos + i;
+            // If sorted, use this wxSortedArrayStrings to determine
+            // the right insertion point
+            if(m_strings)
+                n = m_strings->Add(items[i]);
+
+            GtkWidget *list_item = gtk_list_item_new_with_label( wxGTK_CONV( items[i] ) );
+
+            // TODO construct a list with all items and call gtk_list_insert_items once?
+            GList *gitem_list = g_list_alloc ();
+            gitem_list->data = list_item;
+            gtk_list_insert_items( GTK_LIST (list), gitem_list, n );
+
+            m_clientData.Insert( NULL, n );
+            AssignNewItemClientData(n, clientData, i, type);
+
+            if (GTK_WIDGET_REALIZED(m_widget))
+            {
+                gtk_widget_realize( list_item );
+                gtk_widget_realize( GTK_BIN(list_item)->child );
+
+                ApplyWidgetStyle();
+            }
+
+            gtk_widget_show( list_item );
+        }
+
+        EnableEvents();
+    }
+
+    InvalidateBestSize();
+
+    return n;
+}
+
+void wxComboBox::DoSetItemClientData(unsigned int n, void* clientData)
+{
+    m_clientData[n] = clientData;
+}
+
+void* wxComboBox::DoGetItemClientData(unsigned int n) const
+{
+    return m_clientData[n];
+}
+
+void wxComboBox::DoClear()
+{
+    wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
+
+    DisableEvents();
+
+#ifdef __WXGTK24__
+    if (!gtk_check_version(2,4,0))
+    {
+        GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
+        const unsigned int count = GetCount();
+        for (unsigned int i = 0; i < count; i++)
+            gtk_combo_box_remove_text( combobox, 0 );
+    }
+    else // GTK+ < 2.4.0
+#endif // __WXGTK24__
+    {
+        GtkWidget *list = GTK_COMBO(m_widget)->list;
+        gtk_list_clear_items( GTK_LIST(list), 0, GetCount() );
+    }
+
+    m_clientData.Clear();
+
+    if(m_strings)
+        m_strings->Clear();
+
+    EnableEvents();
+
+    InvalidateBestSize();
+}
+
+void wxComboBox::DoDeleteOneItem(unsigned int n)
+{
+    wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
+
+#ifdef __WXGTK24__
+    if (!gtk_check_version(2,4,0))
+    {
+        wxCHECK_RET( IsValid(n), wxT("invalid index") );
+
+        GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
+        gtk_combo_box_remove_text( combobox, n );
+    }
+    else
+#endif
+    {
+        GtkList *listbox = GTK_LIST( GTK_COMBO(m_widget)->list );
+
+        GList *child = g_list_nth( listbox->children, n );
+
+        if (!child)
+        {
+            wxFAIL_MSG(wxT("wrong index"));
+            return;
+        }
+
+        DisableEvents();
+
+        GList *list = g_list_append( (GList*) NULL, child->data );
+        gtk_list_remove_items( listbox, list );
+        g_list_free( list );
+
+        EnableEvents();
+    }
+
+    m_clientData.RemoveAt( n );
+    if(m_strings)
+        m_strings->RemoveAt( n );
+
+    InvalidateBestSize();
+}
+
+void wxComboBox::SetString(unsigned int n, const wxString &text)
+{
+    wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
+
+#ifdef __WXGTK24__
+    if (!gtk_check_version(2,4,0))
+    {
+        GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
+        wxCHECK_RET( IsValid(n), wxT("invalid index") );
+
+        GtkTreeModel *model = gtk_combo_box_get_model( combobox );
+        GtkTreeIter iter;
+        if (gtk_tree_model_iter_nth_child (model, &iter, NULL, n))
+        {
+            GValue value = { 0, };
+            g_value_init( &value, G_TYPE_STRING );
+            g_value_set_string( &value, wxGTK_CONV( text ) );
+            gtk_list_store_set_value( GTK_LIST_STORE(model), &iter, 0, &value );
+            g_value_unset( &value );
+        }
+    }
+    else
+#endif
+    {
+        GtkWidget *list = GTK_COMBO(m_widget)->list;
+
+        GList *child = g_list_nth( GTK_LIST(list)->children, n );
+        if (child)
+        {
+            GtkBin *bin = GTK_BIN( child->data );
+            GtkLabel *label = GTK_LABEL( bin->child );
+            gtk_label_set_text(label, wxGTK_CONV(text));
+        }
+        else
+        {
+            wxFAIL_MSG( wxT("wxComboBox: wrong index") );
+        }
+    }
+
+    InvalidateBestSize();
+}
+
+int wxComboBox::FindString( const wxString &item, bool bCase ) const
+{
+    wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid combobox") );
+
+#ifdef __WXGTK24__
+    if (!gtk_check_version(2,4,0))
+    {
+        GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
+        GtkTreeModel* model = gtk_combo_box_get_model( combobox );
+        GtkTreeIter iter;
+        gtk_tree_model_get_iter_first( model, &iter );
+        if (!gtk_list_store_iter_is_valid(GTK_LIST_STORE(model), &iter ))
+            return -1;
+        int count = 0;
+        do
+        {
+            GValue value = { 0, };
+            gtk_tree_model_get_value( model, &iter, 0, &value );
+            wxString str = wxGTK_CONV_BACK( g_value_get_string( &value ) );
+            g_value_unset( &value );
+
+            if (item.IsSameAs( str, bCase ) )
+                return count;
+
+            count++;
+
+        } while (gtk_tree_model_iter_next( model, &iter ));
+    }
+    else
+#endif
+    {
+        GtkWidget *list = GTK_COMBO(m_widget)->list;
+
+        GList *child = GTK_LIST(list)->children;
+        int count = 0;
+        while (child)
+        {
+            GtkBin *bin = GTK_BIN( child->data );
+            GtkLabel *label = GTK_LABEL( bin->child );
+            wxString str( wxGTK_CONV_BACK( gtk_label_get_text(label) ) );
+
+            if (item.IsSameAs( str , bCase ) )
+                return count;
+
+            count++;
+            child = child->next;
+        }
+    }
+
+    return wxNOT_FOUND;
+}
+
+int wxComboBox::GetSelection() const
+{
+#ifdef __WXGTK24__
+    if (!gtk_check_version(2,4,0))
+    {
+        GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
+        return gtk_combo_box_get_active( combobox );
+    }
+    else
+#endif
+        // if the popup is currently opened, use the selection as it had been
+        // before it dropped down
+        return g_SelectionBeforePopup == wxID_NONE ? GetCurrentSelection()
+                                               : g_SelectionBeforePopup;
+}
+
+int wxComboBox::GetCurrentSelection() const
+{
+    wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid combobox") );
+
+#ifdef __WXGTK24__
+    if (!gtk_check_version(2,4,0))
+    {
+        GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
+        return gtk_combo_box_get_active( combobox );
+    }
+    else
+#endif
+    {
+        GtkWidget *list = GTK_COMBO(m_widget)->list;
+
+        GList *selection = GTK_LIST(list)->selection;
+        if (selection)
+        {
+            GList *child = GTK_LIST(list)->children;
+            int count = 0;
+            while (child)
+            {
+                if (child->data == selection->data) return count;
+                count++;
+                child = child->next;
+            }
+        }
+    }
+
+    return -1;
+}