How to use gtk_render_handle on patterned widget?



Hi all,

I'm hoping to get some clarification regarding the semantics of
gtk_render_handle. The stock theming engine renders the handle centered
within the rectangle parameters (@x,y  width x height). Unfortunately,
it also wipes the background with the pattern scaled to width x height.

What's the correct method to render the handle on, for example, the left
side of a widget if the existing background is patterned?

The approach gnome-panel takes is:
	cairo_rectangle (cr,
			 frame->priv->handle_rect.x,
			 frame->priv->handle_rect.y,
			 frame->priv->handle_rect.width,
			 frame->priv->handle_rect.height);
	cairo_clip (cr);
	gtk_render_handle (context, cr,
			   0, 0,
			   gtk_widget_get_allocated_width (widget),
			   gtk_widget_get_allocated_height (widget));

Unfortunately, this often means that the handle is rendered outside the
clip and not visible.

Without changing the theming engine, ISTM that the only way to draw a
handle within a subarea of a patterned widget is to:
	set background to the widget pattern
	render background
	construct new subpattern from base widget pattern
	set background to the new subpattern
	render handle

Is this correct?

Regards,
Peter Hurley


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