Re: setting background color to drawing area



Paul Barton-Davis wrote:
> then to change colors:
> 
>    gtk_widget_set_state (area_widget, GTK_STATE_SELECTED);

Ooo, neat, never thought of that.

> this only works if you have a limited number of colors, of course. if
> you really want to change to one of more than about 4 colors, you'll
> have to use mark's suggested method

Tiny point: you can do it with gtkrc files with more than 4 colours by
changing the name, rather than the state. Eg.:

	style "colour1_style" {
		bg[NORMAL]={1.0,0.0,0.0}
	}
	widget "*colour1_widget" style "colour1_style"
	style "colour2_style" {
		bg[NORMAL]={0.0,1.0,0.0}
	}
	widget "*colour2_widget" style "colour2_style"
	etc.

then:
	
	gtk_widget_set_name( my_widget, "colour1_widget" );
	gtk_widget_set_name( my_widget, "colour2_widget" );
	etc.

I guess this'll be a little slower than setting the state (though I've
not timed it), but it's fast enough for most things.

John




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