Custom (Composed) Widget



I want to create a custom widget composed of several existing widgets but 
let me explain a little:

I already have a class (GcFullPanel) that is derived form GObject. This 
class populates an GtkTreeView with a directory listing and some other gtk 
widgets. All this widgets are stored in a GtkContainer that is a property of 
this class (named "view"). The way I'm working with this class now is like 
this:

GcFullPanel *panel = gc_fullpanel_new();
gc_fullpanel_set_directory ("/home");

GtkWidget *panel_view = gc_fullpanel_get_view(panel);
gtk_container_add (some_container, panel_view);


As you can see, is kind of lame, cause I'm working with 2 object : 
panel/GcFullPanel and panel_view/GtkWidget. The way is should be done is 
GcFullPanel derived from GtkWidget.

GcFullPanel *panel = gc_fullpanel_new();
gc_fullpanel_set_directory ("/home");

gtk_container_add (some_container, GTK_WIDGET(panel));



The Question :
What property/method of the GtkWidget should i rewrite to do this, having in 
mind that i already have a property in my class (view) that represents the 
view of my object. Where can i find a tutorial on custom gtk widgets ?
-- 
Razvan Gavril
razvan gavril gmail com



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