GtkStyle changes



I get myself a new style like this,

	redstyle = gtk_style_copy(gtk_widget_get_style(GTK_WIDGET(groups)));

	GdkColormap* colormap = gtk_widget_get_colormap(GTK_WIDGET(window));

	redcolor.red =   255 <<8;
	redcolor.green =   0 <<8;
	redcolor.blue =    0 <<8;
	if (gdk_colormap_alloc_color(colormap, &redcolor, FALSE, TRUE))
		redstyle->fg[GTK_STATE_NORMAL] = redcolor;
	
	GdkColor yellow;
	yellow.red =   255 <<8;
	yellow.green = 255 <<8;
	yellow.blue =    0 <<8;
	if (gdk_colormap_alloc_color(colormap, &yellow, FALSE, TRUE))
		redstyle->fg[GTK_STATE_SELECTED] = yellow;

and then use it like

			gtk_clist_set_cell_style(groups, row, 0, redstyle);

for cells that I want highlighted. I cannot use
gtk_clist_set_foreground() since only one column should be changed.

However, when changing GTK+ themes (using gnomecc), the old style will
be left. That looks quite ugly when the theme is changing the
background of my GtkCList. How can I avoid this?

Is there a way to get notified when the theme changes so I can
recreate my style variable?

Or is there a way to set the foreground of just one cell so it does
not matter that the background is changing?

Incidentally, is the above the correct way to modify a style?


Thanks,
Anders.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]