Creating a CTree class based widget



Hi, To all !

I'm making a new widget GtkCTree  based.

But I can't show it.

Is not the first widget I do, and all others seems work fine.(the others were 
much more easy, copied from Gtk Tutorials, and GtkBox based  ).

now I wnat  only see a CTree void widget , but I can't.

I have writted only. the _new() _init() _init_class() and _get_type() 
functions.

my _init() is like follows:

--------------------------------------------

static void
my_tree_init (MyTree *mytree)
{
	GtkCTree *ctree=GTK_CTREE(mytree);
	GtkWidget *label1;

/*setting columns*/
	gtk_clist_set_column_width (GTK_CLIST (ctree), 0, 80);

	gtk_clist_column_titles_show (GTK_CLIST (ctree));
/*labels*/
	label1 = gtk_label_new (_("Label"));
	gtk_widget_show (label1);
	gtk_clist_set_column_widget (GTK_CLIST (ctree), 0, label1);

/*ctree options*/
	gtk_clist_set_row_height (GTK_CLIST (ctree), GTKS_CTNODE_ROW_HEIGHT );
	gtk_clist_set_column_width (GTK_CLIST (ctree), 0,  GTKS_CTNODE_COLUMN_WIDTH);
	gtk_clist_set_selection_mode (GTK_CLIST (ctree),GTK_SELECTION_EXTENDED);
/*setting tree functions*/

	gtk_signal_connect_after (GTK_OBJECT (tree), "button_press_event",
			    GTK_SIGNAL_FUNC (on_mytree_button_press), NULL);
	gtk_signal_connect_after (GTK_OBJECT (cdatree), "tree_select_row",
			    GTK_SIGNAL_FUNC (on_mytree_select_node), NULL);
	gtk_signal_connect_after (GTK_OBJECT (cdatree), "tree_unselect_row",
			    GTK_SIGNAL_FUNC (on_mytree_unselect_node), NULL);
	gtk_widget_set_usize (GTK_WIDGET(ctree), 250, 320);



	return mytree;


}
-------------------------------------------

my first trouble is how to say the base widget ,  the initital values (on a 
composite I make a new Ctree by calling gtk_ctree_new(X,Y)), and here a don't 
now how to set X and Y to the parent widget.

I'm testing it, but nothing ocurrs, any window is created, any widget is 
drawn.

the test code is:
-------------------------------------------

int main (int argc, char *argv[])
{
	GtkWidget *window;
	GtkWidget *tree;
	GtkWidget *scrolled_win;

	gtk_init (&argc, &argv);

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title (GTK_WINDOW (window), "My tree example");
	gtk_signal_connect (	GTK_OBJECT (window), "destroy",
				GTK_SIGNAL_FUNC (gtk_exit), NULL);
	gtk_container_set_border_width (GTK_CONTAINER (window), 10);

	scrolled_win = gtk_scrolled_window_new (NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW 
(scrolled_win),GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
	gtk_widget_set_usize(scrolled_win,200,100);
	gtk_widget_show(scrolled_win);
        gtk_container_add (GTK_CONTAINER (window), scrolled_win);

	tree = gtks_mytree_new ();
	gtk_container_add (GTK_CONTAINER (scrolled_win), tree);
	gtk_widget_show (tree);

	gtk_widget_show (window);
	gtk_main ();
	return 0;

}

--------------------------------

thanks


-- 
=================
Toni Moreno Giménez
=================
Pje de las rosas  nº 22
Vilassar de Mar 
(Barcelona) España
CP: 08340



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]