[gtk+/gtk-style-context: 489/533] Add illustration to gtk_render_handle docs



commit c5e50009579460de49a55189b2573598d68e66bc
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Nov 23 23:16:22 2010 -0500

    Add illustration to gtk_render_handle docs

 docs/reference/gtk/Makefile.am        |    1 +
 docs/reference/gtk/images/handles.png |  Bin 0 -> 660 bytes
 gtk/gtkstylecontext.c                 |    5 +++++
 tests/styleexamples.c                 |   27 +++++++++++++++++++++++++++
 4 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/Makefile.am b/docs/reference/gtk/Makefile.am
index 23194b7..42d23fc 100644
--- a/docs/reference/gtk/Makefile.am
+++ b/docs/reference/gtk/Makefile.am
@@ -351,6 +351,7 @@ HTML_IMAGES = \
 	$(srcdir)/images/frame-gap.png					\
 	$(srcdir)/images/sliders.png					\
 	$(srcdir)/images/focus.png					\
+	$(srcdir)/images/handles.png					\
 	$(srcdir)/images/extensions.png
 
 # Extra options to supply to gtkdoc-fixref
diff --git a/docs/reference/gtk/images/handles.png b/docs/reference/gtk/images/handles.png
new file mode 100644
index 0000000..24151b5
Binary files /dev/null and b/docs/reference/gtk/images/handles.png differ
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 9c59552..2c863fa 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -3421,6 +3421,11 @@ gtk_render_extension (GtkStyleContext *context,
  * #GtkWindow<!-- -->'s resize grip), in the rectangle
  * determined by @x, @y, @width, @height.
  *
+ * <example>
+ * <title>Handles rendered for the paned and grip classes</title>
+ * <inlinegraphic fileref="handles.png" format="PNG"/>
+ * </example>
+ *
  * Since: 3.0
  **/
 void
diff --git a/tests/styleexamples.c b/tests/styleexamples.c
index b20c7e4..75350dd 100644
--- a/tests/styleexamples.c
+++ b/tests/styleexamples.c
@@ -297,6 +297,31 @@ draw_cb_frame_gap (GtkWidget *widget, cairo_t *cr)
   return TRUE;
 }
 
+static gboolean
+draw_cb_handles (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, "paned");
+  gtk_render_handle (context, cr, 12, 22, 20, 10);
+  gtk_render_handle (context, cr, 44, 12, 10, 20);
+  gtk_style_context_remove_class (context, "paned");
+
+  gtk_style_context_add_class (context, "grip");
+  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_CORNER_BOTTOMLEFT);
+  gtk_render_handle (context, cr, 12, 48, 12, 12);
+
+  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_CORNER_BOTTOMRIGHT);
+  gtk_render_handle (context, cr, 40, 48, 12, 12);
+
+  gtk_style_context_restore (context);
+
+  return TRUE;
+}
+
 static char *what;
 
 static gboolean
@@ -324,6 +349,8 @@ draw_cb (GtkWidget *widget, cairo_t *cr)
     return draw_cb_extension (widget, cr);
   else if (strcmp (what, "frame-gap") == 0)
     return draw_cb_frame_gap (widget, cr);
+  else if (strcmp (what, "handle") == 0)
+    return draw_cb_handles (widget, cr);
 
   return FALSE;
 }



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