From: <kr_...@us...> - 2003-07-12 08:41:41
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK In directory sc8-pr-cvs1:/tmp/cvs-serv4984/src/cbits/GTK Modified Files: ListBox.c Log Message: Bugfix Index: ListBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/ListBox.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ListBox.c 10 Jul 2003 20:49:08 -0000 1.7 --- ListBox.c 12 Jul 2003 08:41:38 -0000 1.8 *************** *** 62,89 **** void osInsertListBoxItem(WindowHandle listbox, int index, char *title) { ! /* GtkWidget *li; GtkWidget *lbox = GTK_BIN(listbox)->child; ! ! li = gtk_list_item_new_with_label(title); ! if (GTK_LIST(listbox)->selection_mode == GTK_SELECTION_MULTIPLE) ! { ! gtk_signal_connect (GTK_OBJECT(li), "select", ! GTK_SIGNAL_FUNC(hh), ! listbox); ! gtk_signal_connect (GTK_OBJECT(li), "deselect", ! GTK_SIGNAL_FUNC(hh), ! listbox); ! } ! ! gtk_list_insert_items(GTK_LIST(listbox), g_list_append(NULL,li), index); ! gtk_widget_show(li); ! */ ! }; void osRemoveListBoxItem(WindowHandle listbox, int index) { ! GList *tmp_list = g_list_append(NULL, g_list_nth(GTK_LIST(listbox)->children, index)->data); ! gtk_list_remove_items (GTK_LIST(listbox),tmp_list); ! g_list_free(tmp_list); }; --- 62,84 ---- void osInsertListBoxItem(WindowHandle listbox, int index, char *title) { ! GtkTreeIter iter; GtkWidget *lbox = GTK_BIN(listbox)->child; ! GtkListStore *store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(lbox))); ! gtk_list_store_insert(store, &iter, index); ! gtk_list_store_set(store, &iter, 0, title, -1);}; void osRemoveListBoxItem(WindowHandle listbox, int index) { ! GtkTreeIter iter; ! GtkWidget *lbox; ! GtkTreeModel *model; ! GtkTreePath *path; ! ! lbox = GTK_BIN(listbox)->child; ! model = gtk_tree_view_get_model(GTK_TREE_VIEW(lbox)); ! path = gtk_tree_path_new_from_indices(index, -1); ! if (gtk_tree_model_get_iter(model,&iter,path)) ! gtk_list_store_remove(GTK_LIST_STORE(model), &iter); ! gtk_tree_path_free(path); }; |