API: Remove everything relating to "grip"

Grips have long been unused in GTK, so remove all support for them.
This removes the GTK_STYLE_CLASS_GRIP and the special
gtk_render_handle() code for drawing those grips.
This commit is contained in:
Benjamin Otte
2016-11-16 19:27:43 +01:00
parent 56e11f057c
commit bcf70e3a03
5 changed files with 1 additions and 331 deletions

View File

@@ -5212,7 +5212,6 @@ GTK_STYLE_CLASS_ERROR
GTK_STYLE_CLASS_EXPANDER
GTK_STYLE_CLASS_FRAME
GTK_STYLE_CLASS_FLAT
GTK_STYLE_CLASS_GRIP
GTK_STYLE_CLASS_HEADER
GTK_STYLE_CLASS_HIGHLIGHT
GTK_STYLE_CLASS_HORIZONTAL

View File

@@ -351,282 +351,6 @@ render_dot (cairo_t *cr,
}
}
static void
add_path_line (cairo_t *cr,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2)
{
/* Adjust endpoints */
if (y1 == y2)
{
y1 += 0.5;
y2 += 0.5;
x2 += 1;
}
else if (x1 == x2)
{
x1 += 0.5;
x2 += 0.5;
y2 += 1;
}
cairo_move_to (cr, x1, y1);
cairo_line_to (cr, x2, y2);
}
static void
gtk_css_image_builtin_draw_grip (GtkCssImage *image,
cairo_t *cr,
double width,
double height,
GtkCssImageBuiltinType image_type)
{
GtkCssImageBuiltin *builtin = GTK_CSS_IMAGE_BUILTIN (image);
GdkRGBA lighter, darker;
cairo_set_line_width (cr, 1.0);
color_shade (&builtin->bg_color, 0.7, &darker);
color_shade (&builtin->bg_color, 1.3, &lighter);
/* align drawing area to the connected side */
if (image_type == GTK_CSS_IMAGE_BUILTIN_GRIP_LEFT)
{
if (height < width)
width = height;
}
else if (image_type == GTK_CSS_IMAGE_BUILTIN_GRIP_TOPLEFT)
{
if (width < height)
height = width;
else if (height < width)
width = height;
}
else if (image_type == GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOMLEFT)
{
/* make it square, aligning to bottom left */
if (width < height)
{
cairo_translate (cr, 0, height - width);
height = width;
}
else if (height < width)
width = height;
}
else if (image_type == GTK_CSS_IMAGE_BUILTIN_GRIP_RIGHT)
{
/* aligning to right */
if (height < width)
{
cairo_translate (cr, width - height, 0);
width = height;
}
}
else if (image_type == GTK_CSS_IMAGE_BUILTIN_GRIP_TOPRIGHT)
{
if (width < height)
height = width;
else if (height < width)
{
cairo_translate (cr, width - height, 0);
width = height;
}
}
else if (image_type == GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOMRIGHT)
{
/* make it square, aligning to bottom right */
if (width < height)
{
cairo_translate (cr, 0, height - width);
height = width;
}
else if (height < width)
{
cairo_translate (cr, width - height, 0);
width = height;
}
}
else if (image_type == GTK_CSS_IMAGE_BUILTIN_GRIP_TOP)
{
if (width < height)
height = width;
}
else if (image_type == GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOM)
{
/* align to bottom */
if (width < height)
{
cairo_translate (cr, 0, height - width);
height = width;
}
}
else
g_assert_not_reached ();
if (image_type == GTK_CSS_IMAGE_BUILTIN_GRIP_LEFT ||
image_type == GTK_CSS_IMAGE_BUILTIN_GRIP_RIGHT)
{
gint xi;
xi = 0;
while (xi < width)
{
gdk_cairo_set_source_rgba (cr, &lighter);
add_path_line (cr, 0, 0, 0, height);
cairo_stroke (cr);
xi++;
gdk_cairo_set_source_rgba (cr, &darker);
add_path_line (cr, xi, 0, xi, height);
cairo_stroke (cr);
xi += 2;
}
}
else if (image_type == GTK_CSS_IMAGE_BUILTIN_GRIP_TOP ||
image_type == GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOM)
{
gint yi;
yi = 0;
while (yi < height)
{
gdk_cairo_set_source_rgba (cr, &lighter);
add_path_line (cr, 0, yi, width, yi);
cairo_stroke (cr);
yi++;
gdk_cairo_set_source_rgba (cr, &darker);
add_path_line (cr, 0, yi, width, yi);
cairo_stroke (cr);
yi += 2;
}
}
else if (image_type == GTK_CSS_IMAGE_BUILTIN_GRIP_TOPLEFT)
{
gint xi, yi;
xi = width;
yi = height;
while (xi > 3)
{
gdk_cairo_set_source_rgba (cr, &darker);
add_path_line (cr, xi, 0, 0, yi);
cairo_stroke (cr);
--xi;
--yi;
add_path_line (cr, xi, 0, 0, yi);
cairo_stroke (cr);
--xi;
--yi;
gdk_cairo_set_source_rgba (cr, &lighter);
add_path_line (cr, xi, 0, 0, yi);
cairo_stroke (cr);
xi -= 3;
yi -= 3;
}
}
else if (image_type == GTK_CSS_IMAGE_BUILTIN_GRIP_TOPRIGHT)
{
gint xi, yi;
xi = 0;
yi = height;
while (xi < (width - 3))
{
gdk_cairo_set_source_rgba (cr, &lighter);
add_path_line (cr, xi, 0, width, yi);
cairo_stroke (cr);
++xi;
--yi;
gdk_cairo_set_source_rgba (cr, &darker);
add_path_line (cr, xi, 0, width, yi);
cairo_stroke (cr);
++xi;
--yi;
add_path_line (cr, xi, 0, width, yi);
cairo_stroke (cr);
xi += 3;
yi -= 3;
}
}
else if (image_type == GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOMLEFT)
{
gint xi, yi;
xi = width;
yi = 0;
while (xi > 3)
{
gdk_cairo_set_source_rgba (cr, &darker);
add_path_line (cr, 0, yi, xi, height);
cairo_stroke (cr);
--xi;
++yi;
add_path_line (cr, 0, yi, xi, height);
cairo_stroke (cr);
--xi;
++yi;
gdk_cairo_set_source_rgba (cr, &lighter);
add_path_line (cr, 0, yi, xi, height);
cairo_stroke (cr);
xi -= 3;
yi += 3;
}
}
else if (image_type == GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOMRIGHT)
{
gint xi, yi;
xi = 0;
yi = 0;
while (xi < (width - 3))
{
gdk_cairo_set_source_rgba (cr, &lighter);
add_path_line (cr, xi, height, width, yi);
cairo_stroke (cr);
++xi;
++yi;
gdk_cairo_set_source_rgba (cr, &darker);
add_path_line (cr, xi, height, width, yi);
cairo_stroke (cr);
++xi;
++yi;
add_path_line (cr, xi, height, width, yi);
cairo_stroke (cr);
xi += 3;
yi += 3;
}
}
}
static void
gtk_css_image_builtin_draw_pane_separator (GtkCssImage *image,
cairo_t *cr,
@@ -904,18 +628,6 @@ gtk_css_image_builtin_draw (GtkCssImage *image,
width, height,
FALSE, TRUE, TRUE);
break;
case GTK_CSS_IMAGE_BUILTIN_GRIP_TOPLEFT:
case GTK_CSS_IMAGE_BUILTIN_GRIP_TOP:
case GTK_CSS_IMAGE_BUILTIN_GRIP_TOPRIGHT:
case GTK_CSS_IMAGE_BUILTIN_GRIP_RIGHT:
case GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOMRIGHT:
case GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOM:
case GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOMLEFT:
case GTK_CSS_IMAGE_BUILTIN_GRIP_LEFT:
gtk_css_image_builtin_draw_grip (image, cr,
width, height,
image_type);
break;
case GTK_CSS_IMAGE_BUILTIN_PANE_SEPARATOR:
gtk_css_image_builtin_draw_pane_separator (image, cr,
width, height);

View File

@@ -267,14 +267,6 @@ typedef enum /*< skip >*/ {
GTK_CSS_IMAGE_BUILTIN_EXPANDER_VERTICAL_LEFT_EXPANDED,
GTK_CSS_IMAGE_BUILTIN_EXPANDER_HORIZONTAL_RIGHT_EXPANDED,
GTK_CSS_IMAGE_BUILTIN_EXPANDER_VERTICAL_RIGHT_EXPANDED,
GTK_CSS_IMAGE_BUILTIN_GRIP_TOPLEFT,
GTK_CSS_IMAGE_BUILTIN_GRIP_TOP,
GTK_CSS_IMAGE_BUILTIN_GRIP_TOPRIGHT,
GTK_CSS_IMAGE_BUILTIN_GRIP_RIGHT,
GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOMRIGHT,
GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOM,
GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOMLEFT,
GTK_CSS_IMAGE_BUILTIN_GRIP_LEFT,
GTK_CSS_IMAGE_BUILTIN_PANE_SEPARATOR,
GTK_CSS_IMAGE_BUILTIN_HANDLE,
GTK_CSS_IMAGE_BUILTIN_SPINNER

View File

@@ -803,31 +803,7 @@ gtk_do_render_handle (GtkStyleContext *context,
gtk_render_background (context, cr, x, y, width, height);
gtk_render_frame (context, cr, x, y, width, height);
if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_GRIP))
{
GtkJunctionSides sides = gtk_style_context_get_junction_sides (context);
/* order is important here for when too many (or too few) sides are set */
if ((sides & GTK_JUNCTION_CORNER_BOTTOMRIGHT) == GTK_JUNCTION_CORNER_BOTTOMRIGHT)
type = GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOMRIGHT;
else if ((sides & GTK_JUNCTION_CORNER_TOPRIGHT) == GTK_JUNCTION_CORNER_TOPRIGHT)
type = GTK_CSS_IMAGE_BUILTIN_GRIP_TOPRIGHT;
else if ((sides & GTK_JUNCTION_CORNER_BOTTOMLEFT) == GTK_JUNCTION_CORNER_BOTTOMLEFT)
type = GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOMLEFT;
else if ((sides & GTK_JUNCTION_CORNER_TOPLEFT) == GTK_JUNCTION_CORNER_TOPLEFT)
type = GTK_CSS_IMAGE_BUILTIN_GRIP_TOPLEFT;
else if (sides & GTK_JUNCTION_RIGHT)
type = GTK_CSS_IMAGE_BUILTIN_GRIP_RIGHT;
else if (sides & GTK_JUNCTION_BOTTOM)
type = GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOM;
else if (sides & GTK_JUNCTION_TOP)
type = GTK_CSS_IMAGE_BUILTIN_GRIP_TOP;
else if (sides & GTK_JUNCTION_LEFT)
type = GTK_CSS_IMAGE_BUILTIN_GRIP_LEFT;
else
type = GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOMRIGHT;
}
else if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_PANE_SEPARATOR))
if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_PANE_SEPARATOR))
{
type = GTK_CSS_IMAGE_BUILTIN_PANE_SEPARATOR;
}

View File

@@ -487,15 +487,6 @@ struct _GtkStyleContextClass
*/
#define GTK_STYLE_CLASS_LINKED "linked"
/**
* GTK_STYLE_CLASS_GRIP:
*
* A CSS class defining a resize grip.
*
* Refer to individual widget documentation for used style classes.
*/
#define GTK_STYLE_CLASS_GRIP "grip"
/**
* GTK_STYLE_CLASS_DOCK:
*