Re: custom widget and styles



I'm not so sure how the "syle" api
works but I don't think gtk_style_attach()
makes any duplicates. It's probably just:
GTK_WIDGET(object)->style = style and
maybe a rc_reparse or something like that.

I can tell you that if you want your style to
be on a class scope (all instances use the
same object) point to it in your class structure;
create it in _class_init; destroy it in _class_finalize;
but you probably want one "style" per instance so
create it in _init (instance_init) and in _class_init
override G_OBJECT_CLASS(obj)->finalize and destroy it
in your version of finalize.

this is the wierd thing; the tools you have in a GTypeInfo
are

instance_init
class_init
class_finalize
(base...*)

and G_OBJECT_CLASS(obj)->finalize is
actualy a method of the GObjectClass.



Paul Pogonyshev wrote:

override G_OBJECT(obj)->finalize in your init and
chain to G_OBJECT_CLASS(obj)->finalize in your
version of finalize where you kill your style.
        -Tristan

in _class_init():

  my_style = gtk_style_new();
  [modifying *my_style fields]

But i'm creating the style only once, in class initialization. Or
should i just create it in the _new() function? I don't really
understand what gtk_style_attach() does, won't it create a copy of
my_style?

Paul Pogonyshev

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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