Unable to make a color change
- From: MC_Vai <estoy ver megared net mx>
- To: gtk-app-devel-list gnome org
- Subject: Unable to make a color change
- Date: Wed, 18 Jul 2001 23:53:16 +0000
As a disclaimer I did read
http://www106.pair.com/rhp/gtk-colors.html
But still I haven't been able to change the color of
a GtkLabel's background.
Here is my code:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* file1.c */
GtkWidget *eb, *label;
eb = gtk_event_box_new();
...
label = gtk_label_new( whatever );
...
gtk_container_add( GTK_CONTAINER(eb), label );
...
set_display_style( label->parent, label );
/* file2.c */
void
set_display_style( GtkWidget *bgwidget,
GtkWidget *label )
{
GtkRcStyle *display_rcstyle;
GdkColor black_color;
GdkColormap *colormap;
colormap = gdk_window_get_colormap( win );
gdk_colormap_ref( colormap );
black_color.red = black_color.green = black_color.blue = 0;
gdk_color_alloc( colormap, &black_color );
gtk_colormap_unref( colormap );
display_rcstyle = gtk_rc_style_new();
display_rcstyle->bg[GTK_STATE_NORMAL] = black_color;
display_rcstyle->color_flags[GTK_STATE_NORMAL] |= GTK_RC_BG;
gtk_widget_modify_style( bgwidget, display_rcstyle );
gtk_rc_style_unref( display_rcstyle );
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
But is not working... (the color shown is the same of my
desktop's theme).
Is there something I'm missing?
Thanks a lot in advance for your help.
Regards,
- Eduardo.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]