forked from AuroraMiddleware/gtk
styleproperty: Make default_value() take a state
Because of this, resolve() needs to take a state, too. This is so that we can have default values depend on other values (like border color).
This commit is contained in:
parent
e0b1943c97
commit
ba7d1c2104
@ -669,7 +669,7 @@ _gtk_style_properties_peek_property (GtkStyleProperties *props,
|
||||
if (val == NULL)
|
||||
return NULL;
|
||||
|
||||
_gtk_style_property_resolve (node, props, val);
|
||||
_gtk_style_property_resolve (node, props, state, val);
|
||||
|
||||
return val;
|
||||
}
|
||||
@ -713,7 +713,7 @@ gtk_style_properties_get_property (GtkStyleProperties *props,
|
||||
else if (_gtk_style_property_is_shorthand (node))
|
||||
_gtk_style_property_pack (node, props, state, value);
|
||||
else
|
||||
_gtk_style_property_default_value (node, props, value);
|
||||
_gtk_style_property_default_value (node, props, state, value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -767,7 +767,7 @@ gtk_style_properties_get_valist (GtkStyleProperties *props,
|
||||
GValue default_value = { 0 };
|
||||
|
||||
g_value_init (&default_value, node->pspec->value_type);
|
||||
_gtk_style_property_default_value (node, props, &default_value);
|
||||
_gtk_style_property_default_value (node, props, state, &default_value);
|
||||
G_VALUE_LCOPY (&default_value, args, 0, &error);
|
||||
g_value_unset (&default_value);
|
||||
}
|
||||
|
@ -1683,6 +1683,7 @@ pack_border_radius (GValue *value,
|
||||
|
||||
static void
|
||||
border_image_width_default_value (GtkStyleProperties *props,
|
||||
GtkStateFlags state,
|
||||
GValue *value)
|
||||
{
|
||||
}
|
||||
@ -1858,10 +1859,11 @@ _gtk_style_property_print_value (const GtkStyleProperty *property,
|
||||
void
|
||||
_gtk_style_property_default_value (const GtkStyleProperty *property,
|
||||
GtkStyleProperties *properties,
|
||||
GtkStateFlags state,
|
||||
GValue *value)
|
||||
{
|
||||
if (property->default_value_func)
|
||||
property->default_value_func (properties, value);
|
||||
property->default_value_func (properties, state, value);
|
||||
else if (property->pspec->value_type == GTK_TYPE_THEMING_ENGINE)
|
||||
g_value_set_object (value, gtk_theming_engine_load (NULL));
|
||||
else if (property->pspec->value_type == PANGO_TYPE_FONT_DESCRIPTION)
|
||||
@ -1970,6 +1972,7 @@ resolve_shadow (GtkStyleProperties *props,
|
||||
void
|
||||
_gtk_style_property_resolve (const GtkStyleProperty *property,
|
||||
GtkStyleProperties *props,
|
||||
GtkStateFlags state,
|
||||
GValue *val)
|
||||
{
|
||||
if (G_VALUE_TYPE (val) == GTK_TYPE_SYMBOLIC_COLOR)
|
||||
@ -1987,12 +1990,12 @@ _gtk_style_property_resolve (const GtkStyleProperty *property,
|
||||
|
||||
g_value_unset (val);
|
||||
g_value_init (val, property->pspec->value_type);
|
||||
_gtk_style_property_default_value (property, props, val);
|
||||
_gtk_style_property_default_value (property, props, state, val);
|
||||
}
|
||||
else if (G_VALUE_TYPE (val) == GDK_TYPE_RGBA)
|
||||
{
|
||||
if (g_value_get_boxed (val) == NULL)
|
||||
_gtk_style_property_default_value (property, props, val);
|
||||
_gtk_style_property_default_value (property, props, state, val);
|
||||
}
|
||||
else if (G_VALUE_TYPE (val) == GTK_TYPE_GRADIENT)
|
||||
{
|
||||
@ -2002,13 +2005,13 @@ _gtk_style_property_resolve (const GtkStyleProperty *property,
|
||||
{
|
||||
g_value_unset (val);
|
||||
g_value_init (val, CAIRO_GOBJECT_TYPE_PATTERN);
|
||||
_gtk_style_property_default_value (property, props, val);
|
||||
_gtk_style_property_default_value (property, props, state, val);
|
||||
}
|
||||
}
|
||||
else if (G_VALUE_TYPE (val) == GTK_TYPE_SHADOW)
|
||||
{
|
||||
if (!resolve_shadow (props, val))
|
||||
_gtk_style_property_default_value (property, props, val);
|
||||
_gtk_style_property_default_value (property, props, state, val);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@ typedef gboolean (* GtkStyleParseFunc) (GtkCssParser
|
||||
typedef void (* GtkStylePrintFunc) (const GValue *value,
|
||||
GString *string);
|
||||
typedef void (* GtkStyleDefaultValueFunc) (GtkStyleProperties *props,
|
||||
GtkStateFlags state,
|
||||
GValue *value);
|
||||
|
||||
|
||||
@ -71,10 +72,12 @@ gboolean _gtk_style_property_is_inherit (const GtkStyleProper
|
||||
|
||||
void _gtk_style_property_default_value (const GtkStyleProperty *property,
|
||||
GtkStyleProperties *properties,
|
||||
GtkStateFlags state,
|
||||
GValue *value);
|
||||
|
||||
void _gtk_style_property_resolve (const GtkStyleProperty *property,
|
||||
GtkStyleProperties *properties,
|
||||
GtkStateFlags state,
|
||||
GValue *value);
|
||||
|
||||
gboolean _gtk_style_property_is_shorthand (const GtkStyleProperty *property);
|
||||
|
Loading…
Reference in New Issue
Block a user