Add examples for frame rendering

This commit is contained in:
Matthias Clasen 2010-11-23 16:35:28 -05:00 committed by Carlos Garnacho
parent 4c04d944e8
commit 7e96a51953
4 changed files with 48 additions and 8 deletions

View File

@ -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 \

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -2986,7 +2986,7 @@ gtk_render_option (GtkStyleContext *context,
* Renders an arrow pointing to @angle.
*
* <example>
* <title>Typical arrow renderings at 0, 1&solidus;2 &pi;, &pi; and 3&solidus;2 &pi;</title>
* <title>Typical arrow rendering at 0, 1&solidus;2 &pi;, &pi; and 3&solidus;2 &pi;</title>
* <inlinegraphic fileref="arrows.png" format="PNG"/>
* </example>
*
@ -3029,7 +3029,9 @@ gtk_render_arrow (GtkStyleContext *context,
*
* <example>
* <title>Typical background rendering, showing the effect of
* @border-image, @border-width and @border-radius</title>
* <parameter>background-image</parameter>,
* <parameter>border-width</parameter and
* <parameter>border-radius</parameter></title>
* <inlinegraphic fileref="background.png" format="PNG"/>
* </example>
*
@ -3069,6 +3071,16 @@ gtk_render_background (GtkStyleContext *context,
*
* Renders a frame around the rectangle defined by @x, @y, @width, @height.
*
* <example>
* <title>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</title>
* <inlinegraphic fileref="frames.png" format="PNG"/>
* </example>
*
* Since: 3.0
**/
void
@ -3108,7 +3120,7 @@ gtk_render_frame (GtkStyleContext *context,
* determines whether the expander is collapsed or expanded.
*
* <example>
* <title>Typical expander renderings</title>
* <title>Typical expander rendering</title>
* <inlinegraphic fileref="expanders.png" format="PNG"/>
* </example>
*

View File

@ -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);