Re: custom widget and styles



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


Paul Pogonyshev wrote:

Hi.

I'm writing a custom widget which must have a custom background
(independent of user's settings). I'm using this code:

  static GtkStyle *my_style; /* global */

in _class_init():

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

and in _realize():

  gtk_style_attach(my_style, widget->window);
  gtk_style_set_background(widget->style, widget->window,
                           GTK_STATE_NORMAL);

I wanted to ask if this is a correct way of using gtk styles or if i
should have implemented it another way.

Also, where should i kill my_style? _class_finalize() is never used in
gtk code, so i'm not sure whether i should use it myself.

Thank you,
  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]