forked from AuroraMiddleware/gtk
cssshadowvalue: Add a parsing function
Add a variant of the parse function that parses just a single (non-box) shadow, as required for the drop-shadow filter.
This commit is contained in:
parent
60ff231fac
commit
de24b4f91b
@ -326,6 +326,21 @@ gtk_css_shadow_value_new (ShadowValue *shadows,
|
||||
return retval;
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
gtk_css_shadow_value_new_filter (void)
|
||||
{
|
||||
ShadowValue value;
|
||||
|
||||
value.inset = FALSE;
|
||||
value.hoffset = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
value.voffset = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
value.radius = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
value.spread = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
value.color = _gtk_css_color_value_new_current_color ();
|
||||
|
||||
return gtk_css_shadow_value_new (&value, 1);
|
||||
}
|
||||
|
||||
enum {
|
||||
HOFFSET,
|
||||
VOFFSET,
|
||||
@ -497,6 +512,22 @@ fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
_gtk_css_shadow_value_parse_filter (GtkCssParser *parser)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
|
||||
result = _gtk_css_shadow_value_parse (parser, FALSE);
|
||||
|
||||
if (result && result->n_shadows != 1)
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "A single shadow is required");
|
||||
g_clear_pointer (&result, gtk_css_value_unref);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_css_shadow_value_get_extents (const GtkCssValue *value,
|
||||
GtkBorder *border)
|
||||
|
@ -35,9 +35,11 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GtkCssValue * gtk_css_shadow_value_new_none (void);
|
||||
GtkCssValue * gtk_css_shadow_value_new_filter (void);
|
||||
|
||||
GtkCssValue * _gtk_css_shadow_value_parse (GtkCssParser *parser,
|
||||
gboolean box_shadow_mode);
|
||||
GtkCssValue * _gtk_css_shadow_value_parse_filter (GtkCssParser *parser);
|
||||
|
||||
void gtk_css_shadow_value_get_extents (const GtkCssValue *shadow,
|
||||
GtkBorder *border);
|
||||
|
Loading…
Reference in New Issue
Block a user