Re: Fmaps and gtkglarea



Have you read the gtk tutorial (specifically the part about subclassing
widgets)?  If not, read it as it should tell you enough to start creating
new widgets.

Basically you have a get_type() function for the widget that registers the
name, size, class and instance initialisation routines, parent class, etc
for the class.  You then do your initialisation in the instance init
routine (the parent's instance init routine will automatically be called).
Then in your widget's new() routine, you use something like:
  widget = gtk_type_new(gtk_fmaps_get_type());

James.

--
Email: james@daa.com.au
WWW:   http://www.daa.com.au/~james/


On Wed, 19 Apr 2000, Franck Martin wrote:

>     I nearly got gtkfmaps child of gtkglarea. The trouble is that
> gtkglarea needs to be initialised, and the gtkglarea structure is not a
> pointer in gtkfmaps.
> 
> Struct _GtkFMaps
> {
>   GtkGLArea glarea;
> ....
> }
> 
> so in gtk_fmaps_new(GtkFMaps *fmaps) I cannot do a
> fmaps->glarea=gtk_gl_area_new(attrlist); as the result of
> gtk_gl_area_new is a pointer (incompatible types in assignement)
> 
> I will have certainly to copy the structure... So far I cannot find how
> to do it, nor do I find a widget in GTK+ that does similar stuff. I
> would like to copy the code...
> 
> Also it seems there is the same problem in the class as I have seen most
> users using a static GtkGLAreaClass parent_class=NULL; in their program
> instead of accessing the parent_class item in the GtkFMapsClass
> 
> struct _GtkFMapsClass
> {
> GtkGLAreaClass parent_class;
> ...
> }
> 
> Cheers
> Franck@sopac.org.fj
> 
> 
> 
> -- 
> To unsubscribe: mail gnome-devel-list-request@gnome.org with "unsubscribe"
> as the Subject.
> 



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