Re: Theme in drawing area



Paul Coates wrote:
> 
>         I have been using double buffering quite happily for a while now to
>         draw graphics in a gtk application. I have just started to use Gnome
>         and themes and all the widgets change to use the theme as expected
>         leaving the drawing area the same. I want to use a pixmap from the
>         theme to use as a background for the drawing area so it blends in
>         with the rest of the application. Can this be done and if so how?
> 


	I have discovered the gtk_draw_box function that will almost do what
	I want except it draws a border around the box. If I use
gtk_draw_flat_box
	it does not draw the border but the pixmap is only 100x100 so I have to
do
	the following,

	int x, y, w, h;
	GtkStyle *style;

	x = drawingarea1->allocation.width;
	y = drawingarea1->allocation.height;
	w = x/100;
	h = y/100;
	style = gtk_widget_get_style(machine);
	for (x=0; x<=w; x++)
		for (y=0; y<=h; y++)
			gtk_draw_flat_box(style, drawingarea1->window,
			GTK_STATE_NORMAL, GTK_SHADOW_NONE, x*100, y*100, 100, 100);

	I don't know if this is the best way of doing this.

	The question is can I be sure that the pixmap will always be 100x100 in
size
	i.e. is it a condition of creating a theme, and if not how do I work
out how
	big it is to adjust the code above.

	Paul


Paul A Coates, Computing Service    Web: http://xander.ncl.ac.uk/~npac/
Newcastle University, Claremont Road,      Email: Paul.Coates@ncl.ac.uk
Newcastle Upon Tyne, NE1 7RU, England             Tel: +44-191-222-7986



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