Illustrate extension rendering

This commit is contained in:
Matthias Clasen
2010-11-23 18:00:43 -05:00
committed by Carlos Garnacho
parent 8589c5c65e
commit e57e0e978d
4 changed files with 50 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

View File

@@ -3159,6 +3159,10 @@ gtk_render_expander (GtkStyleContext *context,
* @height: rectangle height
*
* Renders a focus indicator on the rectangle determined by @x, @y, @width, @height.
* <example>
* <title>Typical focus rendering</title>
* <inlinegraphic fileref="focus.png" format="PNG"/>
* </example>
*
* Since: 3.0
**/
@@ -3357,6 +3361,11 @@ gtk_render_frame_gap (GtkStyleContext *context,
* defined by @x, @y, @width, @height. The side where the extension
* connects to is defined by @gap_side.
*
* <example>
* <title>Typical extension rendering</title>
* <inlinegraphic fileref="extensions.png" format="PNG"/>
* </example>
*
* Since: 3.0
**/
void

View File

@@ -226,7 +226,44 @@ draw_cb_slider (GtkWidget *widget, cairo_t *cr)
return TRUE;
}
static gboolean
draw_cb_focus (GtkWidget *widget, cairo_t *cr)
{
GtkStyleContext *context;
context = gtk_widget_get_style_context (widget);
gtk_style_context_save (context);
gtk_render_focus (context, cr, 12, 12, 50, 50);
gtk_style_context_restore (context);
return TRUE;
}
static gboolean
draw_cb_extension (GtkWidget *widget, cairo_t *cr)
{
GtkStyleContext *context;
context = gtk_widget_get_style_context (widget);
gtk_style_context_save (context);
gtk_style_context_add_class (context, "notebook");
gtk_style_context_add_region (context, GTK_STYLE_REGION_TAB, 0);
gtk_style_context_set_state (context, 0);
gtk_render_extension (context, cr, 26, 12, 24, 12, GTK_POS_BOTTOM);
gtk_render_extension (context, cr, 12, 26, 12, 24, GTK_POS_RIGHT);
gtk_render_extension (context, cr, 26, 52, 24, 12, GTK_POS_TOP);
gtk_render_extension (context, cr, 52, 26, 12, 24, GTK_POS_LEFT);
gtk_style_context_restore (context);
return TRUE;
}
static char *what;
@@ -249,6 +286,10 @@ draw_cb (GtkWidget *widget, cairo_t *cr)
return draw_cb_activity (widget, cr);
else if (strcmp (what, "slider") == 0)
return draw_cb_slider (widget, cr);
else if (strcmp (what, "focus") == 0)
return draw_cb_focus (widget, cr);
else if (strcmp (what, "extension") == 0)
return draw_cb_extension (widget, cr);
return FALSE;
}