Re: Set the background color in GTK1
- From: Kevin DeKorte <kdekorte yahoo com>
- To: gtk-app-devel-list gnome org
- Cc: Peter Krueger <pkrueger appss de>
- Subject: Re: Set the background color in GTK1
- Date: Mon, 12 Apr 2004 14:42:18 -0600
Peter,
Didn't seem to do it
I do this to get the style
style = gtk_style_copy(gtk_widget_get_style(gtkwidget));
color.red = style->bg[GTK_STATE_NORMAL].red;
color.green = style->bg[GTK_STATE_NORMAL].green;
color.blue = style->bg[GTK_STATE_NORMAL].blue;
black.red = 0;
black.green = 0;
black.blue = 0;
This to set the color
style->bg[GTK_STATE_NORMAL].red = black.red;
style->bg[GTK_STATE_NORMAL].green = black.green;
style->bg[GTK_STATE_NORMAL].blue = black.blue;
gtk_widget_set_style(gtkwidget,style);
gtk_widget_ensure_style(gtkwidget);
And this to restore it
style->bg[GTK_STATE_NORMAL].red = color.red;
style->bg[GTK_STATE_NORMAL].green = color.green;
style->bg[GTK_STATE_NORMAL].blue = color.blue;
gtk_widget_set_style(gtkwidget,style);
gtk_widget_ensure_style(gtkwidget);
And the background color always stays the default grey.
Kevin
On Monday 12 April 2004 12:10 pm, Peter Krueger wrote:
On Fri, 9 Apr 2004, Kevin DeKorte wrote:
I have an application that I am working on that I need to set a
GtkWidow's background color. I have been able to do this in GTK2 pretty
easily, but how do I change in GTK1? I'm writing my app to work in both
GTK1 and GTK2 because it is a mozilla plugin and mozilla ships in both
flavors.
Hello Kevin!
in GTK1 you can change the background color by modifying the GtkStyle of
the widget. I'm not sure how you have to do it detail, since I'm not
using GTK1 for quite a time. Try getting the current style with
gtk_widget_get_style(window), then modify the color and set the style back
to the widget with gtk_widget_set_style() and / or
gtk_widget_ensure_style().
Regards,
Peter
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]