custom widget and styles



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




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