summaryrefslogtreecommitdiff
path: root/tests/styleexamples.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2010-11-23 22:55:52 -0500
committerCarlos Garnacho <carlosg@gnome.org>2010-12-04 15:39:42 +0100
commitd1f1af202b0d3389e049ff33cee2f8887f2ec585 (patch)
treeadbc7b8b08ba88d5b11919a16c2808ea3bf3ae24 /tests/styleexamples.c
parent1391a61bc56e802d2ce2f2b302ddc316e762edbb (diff)
downloadgtk+-d1f1af202b0d3389e049ff33cee2f8887f2ec585.tar.gz
Add a frame-gap illustration
Diffstat (limited to 'tests/styleexamples.c')
-rw-r--r--tests/styleexamples.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/styleexamples.c b/tests/styleexamples.c
index 6b65ba86bd..b20c7e4eea 100644
--- a/tests/styleexamples.c
+++ b/tests/styleexamples.c
@@ -265,6 +265,38 @@ draw_cb_extension (GtkWidget *widget, cairo_t *cr)
return TRUE;
}
+static gboolean
+draw_cb_frame_gap (GtkWidget *widget, cairo_t *cr)
+{
+ GtkStyleContext *context;
+ GtkStyleProvider *provider;
+
+ context = gtk_widget_get_style_context (widget);
+
+ gtk_style_context_save (context);
+
+ provider = (GtkStyleProvider *)gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider),
+ ".frame {\n"
+ " border-style: solid;\n"
+ " border-width: 1;\n"
+ " border-radius: 0;\n"
+ "}\n",
+ -1, NULL);
+ gtk_style_context_add_provider (context, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
+ gtk_style_context_add_class (context, "frame");
+ gtk_style_context_set_junction_sides (context, 0);
+ gtk_render_frame_gap (context, cr, 12, 12, 50, 50, GTK_POS_TOP, 15, 35);
+ gtk_style_context_remove_class (context, "frame");
+
+ gtk_style_context_remove_provider (context, provider);
+
+ gtk_style_context_restore (context);
+
+ return TRUE;
+}
+
static char *what;
static gboolean
@@ -290,6 +322,8 @@ draw_cb (GtkWidget *widget, cairo_t *cr)
return draw_cb_focus (widget, cr);
else if (strcmp (what, "extension") == 0)
return draw_cb_extension (widget, cr);
+ else if (strcmp (what, "frame-gap") == 0)
+ return draw_cb_frame_gap (widget, cr);
return FALSE;
}