forked from AuroraMiddleware/gtk
drawingarea: Update docs around background handling
The behavior changed this cycle. Update the docs to recommend an explicit gtk_render_background call.
This commit is contained in:
parent
52e0ab53dc
commit
5a80a35757
@ -56,9 +56,10 @@
|
|||||||
* area to display a circle in the normal widget foreground
|
* area to display a circle in the normal widget foreground
|
||||||
* color.
|
* color.
|
||||||
*
|
*
|
||||||
* Note that GDK automatically clears the exposed area to the
|
* Note that GDK automatically clears the exposed area before sending
|
||||||
* background color before sending the expose event, and that
|
* the expose event, and that drawing is implicitly clipped to the exposed
|
||||||
* drawing is implicitly clipped to the exposed area.
|
* area. If you want to have a theme-provided background, you need
|
||||||
|
* to call gtk_render_background() in your ::draw method.
|
||||||
*
|
*
|
||||||
* ## Simple GtkDrawingArea usage
|
* ## Simple GtkDrawingArea usage
|
||||||
*
|
*
|
||||||
@ -68,16 +69,22 @@
|
|||||||
* {
|
* {
|
||||||
* guint width, height;
|
* guint width, height;
|
||||||
* GdkRGBA color;
|
* GdkRGBA color;
|
||||||
|
* GtkStyleContext *context;
|
||||||
|
*
|
||||||
|
* context = gtk_widget_get_style_context (widget);
|
||||||
*
|
*
|
||||||
* width = gtk_widget_get_allocated_width (widget);
|
* width = gtk_widget_get_allocated_width (widget);
|
||||||
* height = gtk_widget_get_allocated_height (widget);
|
* height = gtk_widget_get_allocated_height (widget);
|
||||||
|
*
|
||||||
|
* gtk_render_background (context, cr, 0, 0, width, height);
|
||||||
|
*
|
||||||
* cairo_arc (cr,
|
* cairo_arc (cr,
|
||||||
* width / 2.0, height / 2.0,
|
* width / 2.0, height / 2.0,
|
||||||
* MIN (width, height) / 2.0,
|
* MIN (width, height) / 2.0,
|
||||||
* 0, 2 * G_PI);
|
* 0, 2 * G_PI);
|
||||||
*
|
*
|
||||||
* gtk_style_context_get_color (gtk_widget_get_style_context (widget),
|
* gtk_style_context_get_color (context,
|
||||||
* 0,
|
* gtk_style_context_get_state (context),
|
||||||
* &color);
|
* &color);
|
||||||
* gdk_cairo_set_source_rgba (cr, &color);
|
* gdk_cairo_set_source_rgba (cr, &color);
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user