]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/combobox.cpp
Added friend wxNotebook
[wxWidgets.git] / src / gtk1 / combobox.cpp
index bf9aa9dcc731ac2ade1f370ce883051fafc85668..302cf3abda986047292eb01fe594abe275a54e07 100644 (file)
@@ -143,22 +143,33 @@ void wxComboBox::Append( const wxString &item, char *clientData )
   gtk_signal_connect( GTK_OBJECT(list_item), "select", 
     GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
   
+  m_clientData.Append( (wxObject*)clientData );
+  
   gtk_container_add( GTK_CONTAINER(list), list_item );
     
   gtk_widget_show( list_item );
-  
-  m_clientData.Append( (wxObject*)clientData );
 }
 
 void wxComboBox::Delete( int n )
 {
-  GtkWidget *list = GTK_COMBO(m_widget)->list;
-  gtk_list_clear_items( GTK_LIST(list), n, n );
+  GtkList *listbox = GTK_LIST( GTK_COMBO(m_widget)->list );
+  
+  GList *child = g_list_nth( listbox->children, n );
+  
+  if (!child)
+  {
+    wxFAIL_MSG("wrong index");
+    return;
+  }
+  
+  GList *list = g_list_append( NULL, child->data );
+  gtk_list_remove_items( listbox, list );
+  g_list_free( list );
   
   wxNode *node = m_clientData.Nth( n );
   if (!node)
   {
-    wxFAIL_MSG( "wxComboBox: wrong index" );
+    wxFAIL_MSG( "wrong index" );
   }
   else
     m_clientData.DeleteNode( node );
@@ -191,7 +202,7 @@ char* wxComboBox::GetClientData( int n )
   
   wxFAIL_MSG( "wxComboBox: wrong index" );
   
-  return NULL;
+  return (char *) NULL;
 }
 
 void wxComboBox::SetClientData( int n, char * clientData )