diff --git a/docs/reference/gtk/Makefile.am b/docs/reference/gtk/Makefile.am index 9af5bd6935..62f4556b8c 100644 --- a/docs/reference/gtk/Makefile.am +++ b/docs/reference/gtk/Makefile.am @@ -346,7 +346,8 @@ HTML_IMAGES = \ $(srcdir)/images/options.png \ $(srcdir)/images/arrows.png \ $(srcdir)/images/expanders.png \ - $(srcdir)/images/background.png + $(srcdir)/images/background.png \ + $(srcdir)/images/frames.png # Extra options to supply to gtkdoc-fixref FIXXREF_OPTIONS=--extra-dir=../gdk/html \ diff --git a/docs/reference/gtk/images/frames.png b/docs/reference/gtk/images/frames.png new file mode 100644 index 0000000000..12d6c7efc7 Binary files /dev/null and b/docs/reference/gtk/images/frames.png differ diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index dbde6231ee..205a7e6990 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -2986,7 +2986,7 @@ gtk_render_option (GtkStyleContext *context, * Renders an arrow pointing to @angle. * * - * Typical arrow renderings at 0, 1&solidus;2 π, π and 3&solidus;2 π + * Typical arrow rendering at 0, 1&solidus;2 π, π and 3&solidus;2 π * * * @@ -3029,7 +3029,9 @@ gtk_render_arrow (GtkStyleContext *context, * * * Typical background rendering, showing the effect of - * @border-image, @border-width and @border-radius + * background-image, + * border-widthborder-radius * * * @@ -3069,6 +3071,16 @@ gtk_render_background (GtkStyleContext *context, * * Renders a frame around the rectangle defined by @x, @y, @width, @height. * + * + * Examples of frame rendering, showing the effect of + * <parameter>border-image</parameter>, + * <parameter>border-color</parameter>, + * <parameter>border-width</parameter>, + * <parameter>border-radius</parameter> and + * junctions + * + * + * * Since: 3.0 **/ void @@ -3108,7 +3120,7 @@ gtk_render_frame (GtkStyleContext *context, * determines whether the expander is collapsed or expanded. * * - * Typical expander renderings + * Typical expander rendering * * * diff --git a/tests/styleexamples.c b/tests/styleexamples.c index a382c8868d..c43336f4f6 100644 --- a/tests/styleexamples.c +++ b/tests/styleexamples.c @@ -132,13 +132,40 @@ draw_cb_frame (GtkWidget *widget, cairo_t *cr) provider = (GtkStyleProvider *)gtk_css_provider_new (); gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider), - ".frame {\n" + ".frame1 {\n" " border-image: url('gradient1.png') 10 10 10 10 stretch;\n" - " border-style; solid\n" - "}\n", -1, NULL); + "}\n" + ".frame2 {\n" + " border-style: solid;\n" + " border-color: rgb(255,0,0);\n" + " border-width: 10;\n" + " border-radius: 10;\n" + "}\n" + ".frame3 {\n" + " border-style: solid;\n" + " border-color: rgb(0,0,0);\n" + " border-width: 2;\n" + " border-radius: 10;\n" + "}\n", + -1, NULL); gtk_style_context_add_provider (context, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + + gtk_style_context_add_class (context, "frame1"); gtk_style_context_set_junction_sides (context, 0); - gtk_render_frame (context, cr, 12, 12, 25, 25); + gtk_render_frame (context, cr, 12, 12, 50, 50); + gtk_style_context_remove_class (context, "frame1"); + + gtk_style_context_add_class (context, "frame2"); + gtk_render_frame (context, cr, 74, 12, 50, 50); + gtk_style_context_remove_class (context, "frame2"); + + gtk_style_context_add_class (context, "frame3"); + gtk_style_context_set_junction_sides (context, GTK_JUNCTION_RIGHT); + gtk_render_frame (context, cr, 12, 74, 56, 50); + gtk_style_context_set_junction_sides (context, GTK_JUNCTION_LEFT); + gtk_render_frame (context, cr, 68, 74, 56, 50); + gtk_style_context_remove_class (context, "frame3"); + gtk_style_context_remove_provider (context, provider); gtk_style_context_restore (context);