Commit 76d0e1e3 authored by Benjamin Otte's avatar Benjamin Otte
Browse files

API: Remove gtk_render_frame_gap()

That function does not make sense at all in a CSS world. So better don't
support it anymore.
parent 14408b74
......@@ -4907,7 +4907,6 @@ gtk_render_check
gtk_render_expander
gtk_render_focus
gtk_render_frame
gtk_render_frame_gap
gtk_render_handle
gtk_render_layout
gtk_render_line
......
......@@ -508,131 +508,6 @@ gtk_render_line (GtkStyleContext *context,
gtk_do_render_line (context, cr, x0, y0, x1, y1);
}
static void
gtk_css_style_render_frame_gap (GtkCssStyle *style,
cairo_t *cr,
gdouble x,
gdouble y,
gdouble width,
gdouble height,
GtkPositionType gap_side,
gdouble xy0_gap,
gdouble xy1_gap)
{
gint border_width;
gdouble x0, y0, x1, y1, xc = 0.0, yc = 0.0, wc = 0.0, hc = 0.0;
GtkBorder border;
border.top = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100);
border.right = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH), 100);
border.bottom = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH), 100);
border.left = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100);
border_width = MIN (MIN (border.top, border.bottom),
MIN (border.left, border.right));
cairo_save (cr);
switch (gap_side)
{
case GTK_POS_TOP:
xc = x + xy0_gap + border_width;
yc = y;
wc = MAX (xy1_gap - xy0_gap - 2 * border_width, 0);
hc = border_width;
break;
case GTK_POS_BOTTOM:
xc = x + xy0_gap + border_width;
yc = y + height - border_width;
wc = MAX (xy1_gap - xy0_gap - 2 * border_width, 0);
hc = border_width;
break;
case GTK_POS_LEFT:
xc = x;
yc = y + xy0_gap + border_width;
wc = border_width;
hc = MAX (xy1_gap - xy0_gap - 2 * border_width, 0);
break;
case GTK_POS_RIGHT:
xc = x + width - border_width;
yc = y + xy0_gap + border_width;
wc = border_width;
hc = MAX (xy1_gap - xy0_gap - 2 * border_width, 0);
break;
default:
g_assert_not_reached ();
break;
}
cairo_clip_extents (cr, &x0, &y0, &x1, &y1);
cairo_rectangle (cr, x0, y0, x1 - x0, yc - y0);
cairo_rectangle (cr, x0, yc, xc - x0, hc);
cairo_rectangle (cr, xc + wc, yc, x1 - (xc + wc), hc);
cairo_rectangle (cr, x0, yc + hc, x1 - x0, y1 - (yc + hc));
cairo_clip (cr);
gtk_css_style_render_border (style, cr,
x, y, width, height);
cairo_restore (cr);
}
/**
* gtk_render_frame_gap:
* @context: a #GtkStyleContext
* @cr: a #cairo_t
* @x: X origin of the rectangle
* @y: Y origin of the rectangle
* @width: rectangle width
* @height: rectangle height
* @gap_side: side where the gap is
* @xy0_gap: initial coordinate (X or Y depending on @gap_side) for the gap
* @xy1_gap: end coordinate (X or Y depending on @gap_side) for the gap
*
* Renders a frame around the rectangle defined by (@x, @y, @width, @height),
* leaving a gap on one side. @xy0_gap and @xy1_gap will mean X coordinates
* for %GTK_POS_TOP and %GTK_POS_BOTTOM gap sides, and Y coordinates for
* %GTK_POS_LEFT and %GTK_POS_RIGHT.
*
* Typical rendering of a frame with a gap:
*
* ![](frame-gap.png)
**/
void
gtk_render_frame_gap (GtkStyleContext *context,
cairo_t *cr,
gdouble x,
gdouble y,
gdouble width,
gdouble height,
GtkPositionType gap_side,
gdouble xy0_gap,
gdouble xy1_gap)
{
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (cr != NULL);
g_return_if_fail (xy0_gap <= xy1_gap);
g_return_if_fail (xy0_gap >= 0);
if (width <= 0 || height <= 0)
return;
if (gap_side == GTK_POS_LEFT ||
gap_side == GTK_POS_RIGHT)
g_return_if_fail (xy1_gap <= height);
else
g_return_if_fail (xy1_gap <= width);
gtk_css_style_render_frame_gap (gtk_style_context_lookup_style (context),
cr,
x, y, width, height, gap_side,
xy0_gap, xy1_gap);
}
/**
* gtk_render_handle:
* @context: a #GtkStyleContext
......
......@@ -111,16 +111,6 @@ void gtk_render_slider (GtkStyleContext *context,
gdouble height,
GtkOrientation orientation);
GDK_AVAILABLE_IN_ALL
void gtk_render_frame_gap (GtkStyleContext *context,
cairo_t *cr,
gdouble x,
gdouble y,
gdouble width,
gdouble height,
GtkPositionType gap_side,
gdouble xy0_gap,
gdouble xy1_gap);
GDK_AVAILABLE_IN_ALL
void gtk_render_handle (GtkStyleContext *context,
cairo_t *cr,
gdouble x,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment