Re: changing button colours
- From: Havoc Pennington <hp redhat com>
- To: bill p bigfoot com
- Cc: gtk-list gnome org
- Subject: Re: changing button colours
- Date: 29 Oct 2000 21:01:11 -0500
Bill Purvis <bill p bigfoot com> writes:
> > The correct way is:
> >
> > - create a GtkRcStyle
> > - set the background color in the RcStyle, and set the flag in
> > the RcStyle indicating that the background color is set
> > - call gtk_widget_modify_style() to override the widget's current
> > style with your RcStyle
> > - unref the RcStyle, the widget will have kept a reference to it
> >
>
> many thanks for the advice - I'll try to figure out how to do this.
> I've not come across a GtkRcStyle before - a quick grep around the
> sources for 1.2.7 didn't come up with any example codes, all the
> occurences seem to be in gtkrc.c which I've not had reason to look
> at yet. I'll do so, but any tips or pointers to sources of further
> information would be appreciated!
>
Yes, sorry for the brevity; I've typed it in a few times before, this
is one of the many FAQs not in the FAQ.
Something like:
GdkColor red = { 0, 65535, 0, 0 };
GtkRcStyle *rc_style = gtk_rc_style_new ();
rc_style->bg[GTK_STATE_NORMAL] = red;
rc_style->color_flags[GTK_STATE_NORMAL] |= GTK_RC_BG;
gtk_widget_modify_style (widget, rc_style);
gtk_rc_style_unref (rc_style);
Not tested. You may want to modify states other than NORMAL, but it
should be obvious how to do so following this example.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]