Re: gtk_widget_set_color()




Havoc Pennington <rhp@zirx.pair.com> writes:

> On Fri, 2 Jul 1999, Havoc Pennington wrote:
> > 
> > Also a gtk_widget_set_color_rgb() variant that took RGB args and alloced
> > the color might be nice.
> > 
> 
> Or rather, picked the color from the GdkRGB colormap. Allocing it might
> encourage people to spew colormap entries.

This, actually, would be the way such a function would
work in general. Widget styles are currenly implemented
in terms of unallocated colors - colors are allocated
as necessary when styles are realized.

As a general principle, in fact, all color arguments for 
GTK+ are expressed as _unallocated_ GdkColors. 

As for the existance of such functions - basically I would 
agree that they would be good
to have. (Though I'd _don't_ want people to use them.
Setting colors is generically a bad idea, when 
the user is allowed to change, say, background colors).
In fact, if we had a bit more time, they might have
been in 1.2.

Probably, the way they would look would be something like:

 gtk_widget_modify_fg (GtkWidget *widget, GtkStateType state, GdkColor *color);
 gtk_widget_modify_bg (GtkWidget *widget, GtkStateType state, GdkColor *color);
 gtk_widget_modify_base (GtkWidget *widget, GtkStateType state, GdkColor *color);
 gtk_widget_modify_text (GtkWidget *widget, GtkStateType state, GdkColor *color
);
 gtk_widget_modify_font (GtkWidget *widget, GdkFont *font);

This can be implemented internally in terms of the
mechansim that gtk_widget_modify_style() uses - where
there is a single per-widget tightly bound RC_STYLE.

It would be nice if GtkStateType was a mask to allow people
to set multiple states simultaneously, but for a lot
of purposes people can just get away with settings
GTK_STATE_NORMAL anyways.

Regards,
                                        Owen



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