forked from AuroraMiddleware/gtk
css: Add "border-spacing" CSS property
It's using a GtkCssPositionValue, even though that name is wrong. But the functionality of managing 2 lengths is exactly what we want. Nobody is using this yet.
This commit is contained in:
parent
438ad208e7
commit
d7148a4718
@ -291,6 +291,32 @@ _gtk_css_position_value_try_parse (GtkCssParser *parser)
|
||||
return position_value_parse (parser, TRUE);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
gtk_css_position_value_parse_spacing (GtkCssParser *parser)
|
||||
{
|
||||
GtkCssValue *x, *y;
|
||||
|
||||
x = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_POSITIVE_ONLY);
|
||||
if (x == NULL)
|
||||
return NULL;
|
||||
|
||||
if (gtk_css_number_value_can_parse (parser))
|
||||
{
|
||||
y = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_POSITIVE_ONLY);
|
||||
if (y == NULL)
|
||||
{
|
||||
_gtk_css_value_unref (x);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
y = _gtk_css_value_ref (x);
|
||||
}
|
||||
|
||||
return _gtk_css_position_value_new (x, y);
|
||||
}
|
||||
|
||||
double
|
||||
_gtk_css_position_value_get_x (const GtkCssValue *position,
|
||||
double one_hundred_percent)
|
||||
|
@ -29,6 +29,7 @@ GtkCssValue * _gtk_css_position_value_new (GtkCssValue *x
|
||||
GtkCssValue *y);
|
||||
GtkCssValue * _gtk_css_position_value_parse (GtkCssParser *parser);
|
||||
GtkCssValue * _gtk_css_position_value_try_parse (GtkCssParser *parser);
|
||||
GtkCssValue * gtk_css_position_value_parse_spacing (GtkCssParser *parser);
|
||||
|
||||
double _gtk_css_position_value_get_x (const GtkCssValue *position,
|
||||
double one_hundred_percent);
|
||||
|
@ -562,6 +562,13 @@ transform_value_parse (GtkCssStyleProperty *property,
|
||||
return _gtk_css_transform_value_parse (parser);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
border_spacing_value_parse (GtkCssStyleProperty *property,
|
||||
GtkCssParser *parser)
|
||||
{
|
||||
return gtk_css_position_value_parse_spacing (parser);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
border_corner_radius_value_parse (GtkCssStyleProperty *property,
|
||||
GtkCssParser *parser)
|
||||
@ -1448,6 +1455,16 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
_gtk_css_transform_value_new_none ());
|
||||
|
||||
gtk_css_style_property_register ("border-spacing",
|
||||
GTK_CSS_PROPERTY_BORDER_SPACING,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_SIZE,
|
||||
border_spacing_value_parse,
|
||||
NULL,
|
||||
_gtk_css_position_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
|
||||
_gtk_css_number_value_new (0, GTK_CSS_PX)));
|
||||
|
||||
gtk_css_style_property_register ("min-width",
|
||||
GTK_CSS_PROPERTY_MIN_WIDTH,
|
||||
G_TYPE_INT,
|
||||
|
@ -207,6 +207,7 @@ enum { /*< skip >*/
|
||||
GTK_CSS_PROPERTY_ICON_SHADOW,
|
||||
GTK_CSS_PROPERTY_ICON_STYLE,
|
||||
GTK_CSS_PROPERTY_ICON_TRANSFORM,
|
||||
GTK_CSS_PROPERTY_BORDER_SPACING,
|
||||
GTK_CSS_PROPERTY_MIN_WIDTH,
|
||||
GTK_CSS_PROPERTY_MIN_HEIGHT,
|
||||
GTK_CSS_PROPERTY_TRANSITION_PROPERTY,
|
||||
|
Loading…
Reference in New Issue
Block a user