Re: Unable to make a color change
- From: Havoc Pennington <hp redhat com>
- To: MC_Vai <estoy ver megared net mx>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Unable to make a color change
- Date: 19 Jul 2001 14:08:23 -0400
MC_Vai <estoy ver megared net mx> writes:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* 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 );
You don't need to fool with colormaps, the colors in a GtkRcStyle
don't have to be allocated. This shouldn't keep things from working
though.
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).
Maybe your theme is a pixmap theme? That would cover up the
background.
I don't see the mistake in your code, but I may be missing something.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]