Re: CTree questions
- From: learfox furry ao net
- To: GTK Application Development List <gtk-app-devel-list gnome org>
- Subject: Re: CTree questions
- Date: Wed, 6 Dec 2000 22:26:19 -0800 (PST)
Thanks a bunch! It's working now! :)
I first got the GtkCTreeRow from the node then its GtkCListRow
and the nset the data and callback function.
Now I see you can use a special function on gtk_ctree_* to set it
in one pass. I don't know why I missed that one earlier but thanks for
pointing that out!
void cnode_destroy_notify_cb (gpointer data)
{
g_print ("cnode destroyed\n");
}
gint destroy_ctree_nodes (GtkWidget *button, gpointer data)
{
/* > How can I delete all GtkCTreeNodes in the GtkCTree? */
gtk_clist_clear (GTK_CLIST (data));
return FALSE;
}
int main (int argc, char *argv[])
{
GtkWidget *window, *vbox, *ctree, *button;
GtkCTreeNode *cnode;
gchar *ctree_titles[] = { "I", "II" };
gchar *ctree_data[] = { "Column One data", "Column Two data" };
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_usize (window, 200, 200);
gtk_signal_connect (GTK_OBJECT (window),
"destroy",
GTK_SIGNAL_FUNC (gtk_main_quit),
NULL);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
ctree = gtk_ctree_new_with_titles (2, 0, ctree_titles);
gtk_clist_set_column_width (GTK_CLIST (ctree), 0, 50);
gtk_clist_set_column_width (GTK_CLIST (ctree), 1, 50);
gtk_box_pack_start (GTK_BOX (vbox), ctree, TRUE, TRUE, 0);
/* > How do I add the first GtkCTreeNode since I can't give it a parent
* or sibling since there arn't any?
*/
cnode = gtk_ctree_insert_node (GTK_CTREE (ctree),
NULL,
NULL,
ctree_data,
10,
NULL, NULL,
NULL, NULL,
FALSE,
TRUE);
/* > How would I add row data to a newly added GtkCTreeNode?
*
* > How would I be notified when the GtkCTreeNode is destroyed so I
* can deallocate the row data?
*/
gtk_ctree_node_set_row_data_full (GTK_CTREE (ctree),
cnode,
NULL,
cnode_destroy_notify_cb);
button = gtk_button_new_with_label ("destroy ctree nodes?");
gtk_signal_connect (GTK_OBJECT (button),
"clicked",
GTK_SIGNAL_FUNC (destroy_ctree_nodes),
ctree);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show_all (window);
gtk_main ();
return 0;
}
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
--
Sincerely, ,"-_ \|/
-Capt. Taura M. , O=__ --X--
..__ ,_JNMNNEO=_ /|\
OMNOUMmnne. {OMMNNNEEEEOO=_
UOOOBIOOOEOMMn. 'LONMMMMNNEEEOOO=.__..,,..
UUOOEUUOOOOOOOObe '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
OOUUUIEEIOONNOIUbe. "7OMMMMNNNNNWWEEEEOOOOOO" "'.
EEBNNMMMNWNWWEEIMMNe. __ 7EMMMNNNNNWWWEEEEEEEOO. " .
NNMMMMWWWMMMWEINMMMNn "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._ .
http://furry.ao.net/~learfox/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]