Re: [gtk-list] Re: [Q] gtk_widget_set_style
- From: Robert Roebling <roebling ruf uni-freiburg de>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: [Q] gtk_widget_set_style
- Date: Sat, 31 Jan 1998 13:05:05 +0100
here is a late follow-up
Tero Pulkkinen wrote:
> I want to change the label font
> > dynamicaly. What I do is:
> > > style = gtk_widget_get_style (label);
> > > font = gdk_font_load (pattern);
> > > style->font = font;
> > > gtk_widget_set_style (label, style);
> > Well, this works, but the new font is now used in all widgets
> > of my app, not only the label.
> I'm not sure exactly how the style stuffs work, but by default
> I'd guess the get_style() function returns a ptr to a statically
> allocated "default" style and changing that will cause every
> widget in your app have that change.
> Thus, you should make a new style with gtk_style_new() and copy
> the default to it.
How do I "copy the default style to it"? Do I have to copy
every single field of the struct? That seems like a lot of
work for changing only the font in one widget.
Is there any reason for not supplying a new
GtkStyle *gtk_style_new( GtkStyle* template );
function, which would copy the field and you could
then selectivly change the field you want to change.
Apart from that, I don't think that the font should
be in the style struct. Changing an item's font is
nothing unusual. Changing the style of all item seems
like a drastic measure.
] [Thread Prev