shorthand: Move pack funcs from base class
Also make the vfuncs take the shorthand as an argument.
This commit is contained in:
parent
aa98aca45f
commit
e603992ac7
@ -68,10 +68,11 @@ _gtk_css_shorthand_property_assign (GtkStyleProperty *property,
|
||||
GtkStateFlags state,
|
||||
const GValue *value)
|
||||
{
|
||||
GtkCssShorthandProperty *shorthand = GTK_CSS_SHORTHAND_PROPERTY (property);
|
||||
GParameter *parameters;
|
||||
guint i, n_parameters;
|
||||
|
||||
parameters = property->unpack_func (value, &n_parameters);
|
||||
parameters = shorthand->assign (shorthand, value, &n_parameters);
|
||||
|
||||
for (i = 0; i < n_parameters; i++)
|
||||
{
|
||||
@ -90,7 +91,9 @@ _gtk_css_shorthand_property_query (GtkStyleProperty *property,
|
||||
GtkStateFlags state,
|
||||
GValue *value)
|
||||
{
|
||||
property->pack_func (value, props, state);
|
||||
GtkCssShorthandProperty *shorthand = GTK_CSS_SHORTHAND_PROPERTY (property);
|
||||
|
||||
shorthand->query (shorthand, value, props, state);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -567,7 +567,8 @@ pack_border (GValue *value,
|
||||
}
|
||||
|
||||
static GParameter *
|
||||
unpack_border_width (const GValue *value,
|
||||
unpack_border_width (GtkCssShorthandProperty *shorthand,
|
||||
const GValue *value,
|
||||
guint *n_params)
|
||||
{
|
||||
return unpack_border (value, n_params,
|
||||
@ -576,7 +577,8 @@ unpack_border_width (const GValue *value,
|
||||
}
|
||||
|
||||
static void
|
||||
pack_border_width (GValue *value,
|
||||
pack_border_width (GtkCssShorthandProperty *shorthand,
|
||||
GValue *value,
|
||||
GtkStyleProperties *props,
|
||||
GtkStateFlags state)
|
||||
{
|
||||
@ -586,7 +588,8 @@ pack_border_width (GValue *value,
|
||||
}
|
||||
|
||||
static GParameter *
|
||||
unpack_padding (const GValue *value,
|
||||
unpack_padding (GtkCssShorthandProperty *shorthand,
|
||||
const GValue *value,
|
||||
guint *n_params)
|
||||
{
|
||||
return unpack_border (value, n_params,
|
||||
@ -595,7 +598,8 @@ unpack_padding (const GValue *value,
|
||||
}
|
||||
|
||||
static void
|
||||
pack_padding (GValue *value,
|
||||
pack_padding (GtkCssShorthandProperty *shorthand,
|
||||
GValue *value,
|
||||
GtkStyleProperties *props,
|
||||
GtkStateFlags state)
|
||||
{
|
||||
@ -605,7 +609,8 @@ pack_padding (GValue *value,
|
||||
}
|
||||
|
||||
static GParameter *
|
||||
unpack_margin (const GValue *value,
|
||||
unpack_margin (GtkCssShorthandProperty *shorthand,
|
||||
const GValue *value,
|
||||
guint *n_params)
|
||||
{
|
||||
return unpack_border (value, n_params,
|
||||
@ -614,7 +619,8 @@ unpack_margin (const GValue *value,
|
||||
}
|
||||
|
||||
static void
|
||||
pack_margin (GValue *value,
|
||||
pack_margin (GtkCssShorthandProperty *shorthand,
|
||||
GValue *value,
|
||||
GtkStyleProperties *props,
|
||||
GtkStateFlags state)
|
||||
{
|
||||
@ -624,7 +630,8 @@ pack_margin (GValue *value,
|
||||
}
|
||||
|
||||
static GParameter *
|
||||
unpack_border_radius (const GValue *value,
|
||||
unpack_border_radius (GtkCssShorthandProperty *shorthand,
|
||||
const GValue *value,
|
||||
guint *n_params)
|
||||
{
|
||||
GParameter *parameter = g_new0 (GParameter, 4);
|
||||
@ -650,7 +657,8 @@ unpack_border_radius (const GValue *value,
|
||||
}
|
||||
|
||||
static void
|
||||
pack_border_radius (GValue *value,
|
||||
pack_border_radius (GtkCssShorthandProperty *shorthand,
|
||||
GValue *value,
|
||||
GtkStyleProperties *props,
|
||||
GtkStateFlags state)
|
||||
{
|
||||
@ -672,7 +680,8 @@ pack_border_radius (GValue *value,
|
||||
}
|
||||
|
||||
static GParameter *
|
||||
unpack_font_description (const GValue *value,
|
||||
unpack_font_description (GtkCssShorthandProperty *shorthand,
|
||||
const GValue *value,
|
||||
guint *n_params)
|
||||
{
|
||||
GParameter *parameter = g_new0 (GParameter, 5);
|
||||
@ -750,7 +759,8 @@ unpack_font_description (const GValue *value,
|
||||
}
|
||||
|
||||
static void
|
||||
pack_font_description (GValue *value,
|
||||
pack_font_description (GtkCssShorthandProperty *shorthand,
|
||||
GValue *value,
|
||||
GtkStyleProperties *props,
|
||||
GtkStateFlags state)
|
||||
{
|
||||
@ -785,7 +795,8 @@ pack_font_description (GValue *value,
|
||||
}
|
||||
|
||||
static GParameter *
|
||||
unpack_border_color (const GValue *value,
|
||||
unpack_border_color (GtkCssShorthandProperty *shorthand,
|
||||
const GValue *value,
|
||||
guint *n_params)
|
||||
{
|
||||
GParameter *parameter = g_new0 (GParameter, 4);
|
||||
@ -828,7 +839,8 @@ unpack_border_color (const GValue *value,
|
||||
}
|
||||
|
||||
static void
|
||||
pack_border_color (GValue *value,
|
||||
pack_border_color (GtkCssShorthandProperty *shorthand,
|
||||
GValue *value,
|
||||
GtkStyleProperties *props,
|
||||
GtkStateFlags state)
|
||||
{
|
||||
@ -841,7 +853,8 @@ pack_border_color (GValue *value,
|
||||
}
|
||||
|
||||
static GParameter *
|
||||
unpack_border_style (const GValue *value,
|
||||
unpack_border_style (GtkCssShorthandProperty *shorthand,
|
||||
const GValue *value,
|
||||
guint *n_params)
|
||||
{
|
||||
GParameter *parameter = g_new0 (GParameter, 4);
|
||||
@ -867,7 +880,8 @@ unpack_border_style (const GValue *value,
|
||||
}
|
||||
|
||||
static void
|
||||
pack_border_style (GValue *value,
|
||||
pack_border_style (GtkCssShorthandProperty *shorthand,
|
||||
GValue *value,
|
||||
GtkStyleProperties *props,
|
||||
GtkStateFlags state)
|
||||
{
|
||||
@ -883,10 +897,10 @@ _gtk_css_shorthand_property_register (const char *name,
|
||||
GType value_type,
|
||||
const char **subproperties,
|
||||
GtkCssShorthandPropertyParseFunc parse_func,
|
||||
GtkStyleUnpackFunc unpack_func,
|
||||
GtkStylePackFunc pack_func)
|
||||
GtkCssShorthandPropertyAssignFunc assign_func,
|
||||
GtkCssShorthandPropertyQueryFunc query_func)
|
||||
{
|
||||
GtkStyleProperty *node;
|
||||
GtkCssShorthandProperty *node;
|
||||
|
||||
node = g_object_new (GTK_TYPE_CSS_SHORTHAND_PROPERTY,
|
||||
"name", name,
|
||||
@ -894,9 +908,9 @@ _gtk_css_shorthand_property_register (const char *name,
|
||||
"subproperties", subproperties,
|
||||
NULL);
|
||||
|
||||
GTK_CSS_SHORTHAND_PROPERTY (node)->parse = parse_func;
|
||||
node->pack_func = pack_func;
|
||||
node->unpack_func = unpack_func;
|
||||
node->parse = parse_func;
|
||||
node->assign = assign_func;
|
||||
node->query = query_func;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -43,6 +43,14 @@ typedef gboolean (* GtkCssShorthandPropertyParseFunc) (GtkCssS
|
||||
GValue *values,
|
||||
GtkCssParser *parser,
|
||||
GFile *base);
|
||||
typedef GParameter * (* GtkCssShorthandPropertyAssignFunc) (GtkCssShorthandProperty *shorthand,
|
||||
const GValue *value,
|
||||
guint *n_params);
|
||||
typedef void (* GtkCssShorthandPropertyQueryFunc) (GtkCssShorthandProperty *shorthand,
|
||||
GValue *value,
|
||||
GtkStyleProperties *props,
|
||||
GtkStateFlags state);
|
||||
|
||||
struct _GtkCssShorthandProperty
|
||||
{
|
||||
GtkStyleProperty parent;
|
||||
@ -50,6 +58,8 @@ struct _GtkCssShorthandProperty
|
||||
GPtrArray *subproperties;
|
||||
|
||||
GtkCssShorthandPropertyParseFunc parse;
|
||||
GtkCssShorthandPropertyAssignFunc assign;
|
||||
GtkCssShorthandPropertyQueryFunc query;
|
||||
};
|
||||
|
||||
struct _GtkCssShorthandPropertyClass
|
||||
|
@ -39,21 +39,12 @@ typedef enum {
|
||||
GTK_STYLE_PROPERTY_INHERIT = (1 << 0)
|
||||
} GtkStylePropertyFlags;
|
||||
|
||||
typedef GParameter * (* GtkStyleUnpackFunc) (const GValue *value,
|
||||
guint *n_params);
|
||||
typedef void (* GtkStylePackFunc) (GValue *value,
|
||||
GtkStyleProperties *props,
|
||||
GtkStateFlags state);
|
||||
|
||||
struct _GtkStyleProperty
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
char *name;
|
||||
GType value_type;
|
||||
|
||||
GtkStyleUnpackFunc unpack_func;
|
||||
GtkStylePackFunc pack_func;
|
||||
};
|
||||
|
||||
struct _GtkStylePropertyClass
|
||||
|
Loading…
Reference in New Issue
Block a user