[gtk+/gtk-style-context: 467/533] Illustrate extension rendering
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-style-context: 467/533] Illustrate extension rendering
- Date: Wed, 1 Dec 2010 02:45:05 +0000 (UTC)
commit d88aab4ea10733b7a4336161d14627ee5459f66a
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Nov 23 18:00:43 2010 -0500
Illustrate extension rendering
docs/reference/gtk/images/extensions.png | Bin 0 -> 475 bytes
docs/reference/gtk/images/focus.png | Bin 0 -> 371 bytes
gtk/gtkstylecontext.c | 9 ++++++
tests/styleexamples.c | 41 ++++++++++++++++++++++++++++++
4 files changed, 50 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/images/extensions.png b/docs/reference/gtk/images/extensions.png
new file mode 100644
index 0000000..f41d710
Binary files /dev/null and b/docs/reference/gtk/images/extensions.png differ
diff --git a/docs/reference/gtk/images/focus.png b/docs/reference/gtk/images/focus.png
new file mode 100644
index 0000000..583d292
Binary files /dev/null and b/docs/reference/gtk/images/focus.png differ
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 78957e6..e5bd4cf 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -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
diff --git a/tests/styleexamples.c b/tests/styleexamples.c
index b66add5..6b65ba8 100644
--- a/tests/styleexamples.c
+++ b/tests/styleexamples.c
@@ -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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]