Re: progress bar color
- From: Owen Taylor <otaylor redhat com>
- To: Nick Soffe <nick soffe bioch ox ac uk>
- Cc: gtk-list gnome org
- Subject: Re: progress bar color
- Date: Mon, 18 Aug 2003 09:53:38 -0400
On Mon, 2003-08-18 at 08:57, Nick Soffe wrote:
> Hi,
> I'm still having a problem changing the color of a progress bar in one of
> my programs using gtk 2.0. I've extracted the offending code into a
> trivial test program and I still can't make it work. Can anyone tell me
> what I'm doing wrong? I've modified the colors of various other widgets in
> the app and these work fine. I'm sure I've done this under gtk1.2 using
> modify_style and it worked ok then.
Probably you theme - your test program works fine for me in the
default theme, but Red Hat's "Bluecurve" theme ignores the
progress bar color from the theme - I think it uses a pixmap.
Other theme engines may do similar things.
If you want to ignore the theme for the widget, an old fashioned:
style = gtk_style_new ();
gdk_color_parse ("red", &style->bg[GTK_STATE_PRELIGHT]);
gtk_widget_set_style (widget, style);
g_object_unref (style);
Should do it. Standard disclaimers about the affects on consistency
and accessibility of ignoring the theme and of setting your own
colors.
Regards,
Owen
> gint main(gint argc,gchar *argv[])
> {
> GtkWidget *window;
> GtkWidget* bar;
> GdkColor color;
>
> gtk_init (&argc,&argv);
> window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
> bar=gtk_progress_bar_new();
> gdk_color_parse("red",&color);
> gtk_widget_modify_bg(bar,GTK_STATE_PRELIGHT, &color);
> gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(bar),0.5);
> gtk_container_add(GTK_CONTAINER(window),bar);
> gtk_widget_show_all (window);
> gtk_main();
> return 0;
> }
>
> Nick Soffe.
>
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]