- wxCHECK_RET( m_widget != NULL, wxT("invalid choice") );
- wxCHECK_RET( IsValid(n), _T("invalid index in wxChoice::Delete") );
-
- // if the item to delete is before the selection, and the selection is valid
- if (((int)n < m_selection_hack) && (m_selection_hack != wxNOT_FOUND))
- {
- // move the selection back one
- m_selection_hack--;
- }
- else if ((int)n == m_selection_hack)
- {
- // invalidate the selection
- m_selection_hack = wxNOT_FOUND;
- }
-
- // VZ: apparently GTK+ doesn't have a built-in function to do it (not even
- // in 2.0), hence this dumb implementation -- still better than nothing
- const unsigned int count = GetCount();
-
- wxArrayString items;
- wxArrayPtrVoid itemsData;
- items.Alloc(count - 1);
- itemsData.Alloc(count - 1);
- for ( unsigned i = 0; i < count; i++ )
- {
- if ( i != n )
- {
- items.Add(GetString(i));
- itemsData.Add(m_clientData[i]);
- }
- }
-
- wxChoice::DoClear();
+ wxCHECK_RET( m_widget != NULL, wxT("invalid control") );
+ wxCHECK_RET( IsValid(n), wxT("invalid index in wxChoice::Delete") );
+
+ GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
+ GtkTreeModel* model = gtk_combo_box_get_model( combobox );
+ GtkListStore* store = GTK_LIST_STORE(model);
+ GtkTreeIter iter;
+ gtk_tree_model_iter_nth_child( model, &iter,
+ NULL, (gint) n );
+ gtk_list_store_remove( store, &iter );
+
+ m_clientData.RemoveAt( n );
+ if ( m_strings )
+ m_strings->RemoveAt( n );