Re: CTree questions
- From: Angelo Cano <acano systec com>
- To: gtk-app-devel-list gnome org
- Subject: Re: CTree questions
- Date: Thu, 7 Dec 2000 00:20:56 -0500
On Mon, Dec 04, 2000 at 12:42:03AM -0800, learfox furry ao net wrote:
(I'm having mail problems, I'm resending this just incase it didn't get
through.)
---------- Forwarded message ----------
Date: Sun, 3 Dec 2000 22:33:01 -0800 (PST)
From: learfox furry ao net
To: GTK Application Development List <gtk-app-devel-list gnome org>
Subject: CTree questions
I'm trying to learn how to use the GtkCTree and I've come across
some questions that don't seem to be apparent from reading the header
file.
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?
How can I delete all GtkCTreeNodes in the GtkCTree?
How do I add the first GtkCTreeNode since I can't give it a parent or
sibling since there arn't any?
Thanks in advance! :)
[snip]
I never use GtkCTree so I'm not too sure about this...
#include <gtk/gtk.h>
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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]