styleproperty: Introduce "specified type" and "computed type"
Make the types explicit. This way, we can actually do useful stuff with them (like sanity checks, d'oh).
This commit is contained in:
parent
05f14af24c
commit
9fa764abec
@ -162,6 +162,7 @@ gtk_theming_engine_register_property (const gchar *name_space,
|
||||
node = g_object_new (GTK_TYPE_CSS_CUSTOM_PROPERTY,
|
||||
"initial-value", &initial,
|
||||
"name", name,
|
||||
"computed-type", pspec->value_type,
|
||||
"value-type", pspec->value_type,
|
||||
NULL);
|
||||
node->pspec = pspec;
|
||||
@ -197,6 +198,7 @@ gtk_style_properties_register_property (GtkStylePropertyParser parse_func,
|
||||
node = g_object_new (GTK_TYPE_CSS_CUSTOM_PROPERTY,
|
||||
"initial-value", &initial,
|
||||
"name", pspec->name,
|
||||
"computed-type", pspec->value_type,
|
||||
"value-type", pspec->value_type,
|
||||
NULL);
|
||||
node->pspec = pspec;
|
||||
|
@ -34,6 +34,8 @@
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_ID,
|
||||
PROP_SPECIFIED_TYPE,
|
||||
PROP_COMPUTED_TYPE,
|
||||
PROP_INHERIT,
|
||||
PROP_INITIAL
|
||||
};
|
||||
@ -72,6 +74,10 @@ gtk_css_style_property_set_property (GObject *object,
|
||||
g_value_init (&property->initial_value, G_VALUE_TYPE (initial));
|
||||
g_value_copy (initial, &property->initial_value);
|
||||
break;
|
||||
case PROP_COMPUTED_TYPE:
|
||||
property->computed_type = g_value_get_gtype (value);
|
||||
g_assert (property->computed_type != G_TYPE_NONE);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -88,6 +94,12 @@ gtk_css_style_property_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_SPECIFIED_TYPE:
|
||||
g_value_set_gtype (value, G_VALUE_TYPE (&property->initial_value));
|
||||
break;
|
||||
case PROP_COMPUTED_TYPE:
|
||||
g_value_set_gtype (value, property->computed_type);
|
||||
break;
|
||||
case PROP_ID:
|
||||
g_value_set_boolean (value, property->id);
|
||||
break;
|
||||
@ -216,6 +228,20 @@ _gtk_css_style_property_class_init (GtkCssStylePropertyClass *klass)
|
||||
P_("The numeric id for quick access"),
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READABLE));
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_SPECIFIED_TYPE,
|
||||
g_param_spec_gtype ("specified-type",
|
||||
P_("Specified type"),
|
||||
P_("The type of values after parsing"),
|
||||
G_TYPE_NONE,
|
||||
G_PARAM_READABLE));
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_COMPUTED_TYPE,
|
||||
g_param_spec_gtype ("computed-type",
|
||||
P_("Computed type"),
|
||||
P_("The type of values after style lookup"),
|
||||
G_TYPE_NONE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_INHERIT,
|
||||
g_param_spec_boolean ("inherit",
|
||||
@ -377,6 +403,45 @@ _gtk_css_style_property_get_initial_value (GtkCssStyleProperty *property)
|
||||
return &property->initial_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* _gtk_css_style_property_get_computed_type:
|
||||
* @property: the property to query
|
||||
*
|
||||
* Gets the #GType used for values for this property after a CSS lookup has
|
||||
* happened. _gtk_css_style_property_compute_value() will convert values to
|
||||
* this type.
|
||||
*
|
||||
* Returns: the #GType used for computed values.
|
||||
**/
|
||||
GType
|
||||
_gtk_css_style_property_get_computed_type (GtkCssStyleProperty *property)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), G_TYPE_NONE);
|
||||
|
||||
return property->computed_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* _gtk_css_style_property_get_specified_type:
|
||||
* @property: the property to query
|
||||
*
|
||||
* Gets the #GType used for values for this property after CSS parsing if
|
||||
* the value is not a special keyword. _gtk_css_style_property_compute_value()
|
||||
* will convert values of this type to the computed type.
|
||||
*
|
||||
* The initial value returned by _gtk_css_style_property_get_initial_value()
|
||||
* will be of this type.
|
||||
*
|
||||
* Returns: the #GType used for specified values.
|
||||
**/
|
||||
GType
|
||||
_gtk_css_style_property_get_specified_type (GtkCssStyleProperty *property)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), G_TYPE_NONE);
|
||||
|
||||
return G_VALUE_TYPE (&property->initial_value);
|
||||
}
|
||||
|
||||
/**
|
||||
* _gtk_css_style_property_compute_value:
|
||||
* @property: the property
|
||||
|
@ -103,6 +103,7 @@ restart:
|
||||
|
||||
static void
|
||||
_gtk_style_property_register (const char * name,
|
||||
GType computed_type,
|
||||
GType value_type,
|
||||
GtkStylePropertyFlags flags,
|
||||
GtkCssStylePropertyParseFunc parse_value,
|
||||
@ -113,10 +114,11 @@ _gtk_style_property_register (const char * name,
|
||||
GtkCssStyleProperty *node;
|
||||
|
||||
node = g_object_new (GTK_TYPE_CSS_STYLE_PROPERTY,
|
||||
"value-type", value_type,
|
||||
"computed-type", computed_type,
|
||||
"inherit", (flags & GTK_STYLE_PROPERTY_INHERIT) ? TRUE : FALSE,
|
||||
"initial-value", initial_value,
|
||||
"name", name,
|
||||
"value-type", value_type,
|
||||
NULL);
|
||||
|
||||
if (parse_value)
|
||||
@ -129,6 +131,8 @@ _gtk_style_property_register (const char * name,
|
||||
|
||||
static void
|
||||
gtk_style_property_register (const char * name,
|
||||
GType specified_type,
|
||||
GType computed_type,
|
||||
GType value_type,
|
||||
GtkStylePropertyFlags flags,
|
||||
GtkCssStylePropertyParseFunc parse_value,
|
||||
@ -141,7 +145,7 @@ gtk_style_property_register (const char * name,
|
||||
va_list args;
|
||||
|
||||
va_start (args, compute_value);
|
||||
G_VALUE_COLLECT_INIT (&initial_value, value_type,
|
||||
G_VALUE_COLLECT_INIT (&initial_value, specified_type,
|
||||
args, 0, &error);
|
||||
if (error)
|
||||
{
|
||||
@ -153,6 +157,7 @@ gtk_style_property_register (const char * name,
|
||||
va_end (args);
|
||||
|
||||
_gtk_style_property_register (name,
|
||||
computed_type,
|
||||
value_type,
|
||||
flags,
|
||||
parse_value,
|
||||
@ -538,18 +543,22 @@ background_repeat_value_print (GtkCssStyleProperty *property,
|
||||
|
||||
/*** REGISTRATION ***/
|
||||
|
||||
#define rgba_init(rgba, r, g, b, a) G_STMT_START{ \
|
||||
(rgba)->red = (r); \
|
||||
(rgba)->green = (g); \
|
||||
(rgba)->blue = (b); \
|
||||
(rgba)->alpha = (a); \
|
||||
}G_STMT_END
|
||||
static GtkSymbolicColor *
|
||||
gtk_symbolic_color_new_rgba (double red,
|
||||
double green,
|
||||
double blue,
|
||||
double alpha)
|
||||
{
|
||||
GdkRGBA rgba = { red, green, blue, alpha };
|
||||
|
||||
return gtk_symbolic_color_new_literal (&rgba);
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_css_style_property_init_properties (void)
|
||||
{
|
||||
GValue value = { 0, };
|
||||
char *default_font_family[] = { "Sans", NULL };
|
||||
GdkRGBA rgba;
|
||||
GtkSymbolicColor *symbolic;
|
||||
GtkCssBorderCornerRadius no_corner_radius = { 0, };
|
||||
GtkBorder border_of_ones = { 1, 1, 1, 1 };
|
||||
GtkCssBorderImageRepeat border_image_repeat = { GTK_CSS_REPEAT_STYLE_STRETCH, GTK_CSS_REPEAT_STYLE_STRETCH };
|
||||
@ -558,15 +567,20 @@ _gtk_css_style_property_init_properties (void)
|
||||
* so that when computing values later they are
|
||||
* done first. That way, 'currentColor' and font
|
||||
* sizes in em can be looked up properly */
|
||||
rgba_init (&rgba, 1, 1, 1, 1);
|
||||
symbolic = gtk_symbolic_color_new_rgba (1, 1, 1, 1);
|
||||
gtk_style_property_register ("color",
|
||||
GTK_TYPE_SYMBOLIC_COLOR,
|
||||
GDK_TYPE_RGBA,
|
||||
GDK_TYPE_RGBA,
|
||||
GTK_STYLE_PROPERTY_INHERIT,
|
||||
NULL,
|
||||
NULL,
|
||||
color_compute,
|
||||
&rgba);
|
||||
symbolic);
|
||||
gtk_symbolic_color_unref (symbolic);
|
||||
gtk_style_property_register ("font-size",
|
||||
G_TYPE_DOUBLE,
|
||||
G_TYPE_DOUBLE,
|
||||
G_TYPE_DOUBLE,
|
||||
GTK_STYLE_PROPERTY_INHERIT,
|
||||
NULL,
|
||||
@ -576,16 +590,21 @@ _gtk_css_style_property_init_properties (void)
|
||||
|
||||
/* properties that aren't referenced when computing values
|
||||
* start here */
|
||||
rgba_init (&rgba, 0, 0, 0, 0);
|
||||
symbolic = gtk_symbolic_color_new_rgba (0, 0, 0, 0);
|
||||
gtk_style_property_register ("background-color",
|
||||
GTK_TYPE_SYMBOLIC_COLOR,
|
||||
GDK_TYPE_RGBA,
|
||||
GDK_TYPE_RGBA,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
color_compute,
|
||||
&rgba);
|
||||
symbolic);
|
||||
gtk_symbolic_color_unref (symbolic);
|
||||
|
||||
gtk_style_property_register ("font-family",
|
||||
G_TYPE_STRV,
|
||||
G_TYPE_STRV,
|
||||
G_TYPE_STRV,
|
||||
GTK_STYLE_PROPERTY_INHERIT,
|
||||
font_family_parse,
|
||||
@ -593,6 +612,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
default_font_family);
|
||||
gtk_style_property_register ("font-style",
|
||||
PANGO_TYPE_STYLE,
|
||||
PANGO_TYPE_STYLE,
|
||||
PANGO_TYPE_STYLE,
|
||||
GTK_STYLE_PROPERTY_INHERIT,
|
||||
NULL,
|
||||
@ -600,6 +621,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
PANGO_STYLE_NORMAL);
|
||||
gtk_style_property_register ("font-variant",
|
||||
PANGO_TYPE_VARIANT,
|
||||
PANGO_TYPE_VARIANT,
|
||||
PANGO_TYPE_VARIANT,
|
||||
GTK_STYLE_PROPERTY_INHERIT,
|
||||
NULL,
|
||||
@ -608,6 +631,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
PANGO_VARIANT_NORMAL);
|
||||
/* xxx: need to parse this properly, ie parse the numbers */
|
||||
gtk_style_property_register ("font-weight",
|
||||
PANGO_TYPE_WEIGHT,
|
||||
PANGO_TYPE_WEIGHT,
|
||||
PANGO_TYPE_WEIGHT,
|
||||
GTK_STYLE_PROPERTY_INHERIT,
|
||||
NULL,
|
||||
@ -616,6 +641,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
PANGO_WEIGHT_NORMAL);
|
||||
|
||||
gtk_style_property_register ("text-shadow",
|
||||
GTK_TYPE_SHADOW,
|
||||
GTK_TYPE_SHADOW,
|
||||
GTK_TYPE_SHADOW,
|
||||
GTK_STYLE_PROPERTY_INHERIT,
|
||||
NULL,
|
||||
@ -624,6 +651,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL);
|
||||
|
||||
gtk_style_property_register ("icon-shadow",
|
||||
GTK_TYPE_SHADOW,
|
||||
GTK_TYPE_SHADOW,
|
||||
GTK_TYPE_SHADOW,
|
||||
GTK_STYLE_PROPERTY_INHERIT,
|
||||
NULL,
|
||||
@ -632,6 +661,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL);
|
||||
|
||||
gtk_style_property_register ("box-shadow",
|
||||
GTK_TYPE_SHADOW,
|
||||
GTK_TYPE_SHADOW,
|
||||
GTK_TYPE_SHADOW,
|
||||
0,
|
||||
NULL,
|
||||
@ -640,6 +671,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL);
|
||||
|
||||
gtk_style_property_register ("margin-top",
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
0,
|
||||
NULL,
|
||||
@ -647,6 +680,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
0);
|
||||
gtk_style_property_register ("margin-left",
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
0,
|
||||
NULL,
|
||||
@ -654,6 +689,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
0);
|
||||
gtk_style_property_register ("margin-bottom",
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
0,
|
||||
NULL,
|
||||
@ -661,6 +698,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
0);
|
||||
gtk_style_property_register ("margin-right",
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
0,
|
||||
NULL,
|
||||
@ -668,6 +707,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
0);
|
||||
gtk_style_property_register ("padding-top",
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
0,
|
||||
NULL,
|
||||
@ -675,6 +716,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
0);
|
||||
gtk_style_property_register ("padding-left",
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
0,
|
||||
NULL,
|
||||
@ -682,6 +725,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
0);
|
||||
gtk_style_property_register ("padding-bottom",
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
0,
|
||||
NULL,
|
||||
@ -689,6 +734,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
0);
|
||||
gtk_style_property_register ("padding-right",
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
0,
|
||||
NULL,
|
||||
@ -699,6 +746,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
* properties be immeditaly followed by the border-style properties
|
||||
*/
|
||||
gtk_style_property_register ("border-top-style",
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
0,
|
||||
NULL,
|
||||
@ -706,6 +755,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
GTK_BORDER_STYLE_NONE);
|
||||
gtk_style_property_register ("border-top-width",
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
0,
|
||||
NULL,
|
||||
@ -713,6 +764,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
compute_border_width,
|
||||
0);
|
||||
gtk_style_property_register ("border-left-style",
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
0,
|
||||
NULL,
|
||||
@ -720,6 +773,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
GTK_BORDER_STYLE_NONE);
|
||||
gtk_style_property_register ("border-left-width",
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
0,
|
||||
NULL,
|
||||
@ -727,6 +782,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
compute_border_width,
|
||||
0);
|
||||
gtk_style_property_register ("border-bottom-style",
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
0,
|
||||
NULL,
|
||||
@ -734,6 +791,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
GTK_BORDER_STYLE_NONE);
|
||||
gtk_style_property_register ("border-bottom-width",
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
0,
|
||||
NULL,
|
||||
@ -741,6 +800,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
compute_border_width,
|
||||
0);
|
||||
gtk_style_property_register ("border-right-style",
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
0,
|
||||
NULL,
|
||||
@ -748,6 +809,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
GTK_BORDER_STYLE_NONE);
|
||||
gtk_style_property_register ("border-right-width",
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
0,
|
||||
NULL,
|
||||
@ -756,6 +819,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
0);
|
||||
|
||||
gtk_style_property_register ("border-top-left-radius",
|
||||
GTK_TYPE_CSS_BORDER_CORNER_RADIUS,
|
||||
GTK_TYPE_CSS_BORDER_CORNER_RADIUS,
|
||||
GTK_TYPE_CSS_BORDER_CORNER_RADIUS,
|
||||
0,
|
||||
border_corner_radius_value_parse,
|
||||
@ -763,6 +828,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
&no_corner_radius);
|
||||
gtk_style_property_register ("border-top-right-radius",
|
||||
GTK_TYPE_CSS_BORDER_CORNER_RADIUS,
|
||||
GTK_TYPE_CSS_BORDER_CORNER_RADIUS,
|
||||
GTK_TYPE_CSS_BORDER_CORNER_RADIUS,
|
||||
0,
|
||||
border_corner_radius_value_parse,
|
||||
@ -770,6 +837,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
&no_corner_radius);
|
||||
gtk_style_property_register ("border-bottom-right-radius",
|
||||
GTK_TYPE_CSS_BORDER_CORNER_RADIUS,
|
||||
GTK_TYPE_CSS_BORDER_CORNER_RADIUS,
|
||||
GTK_TYPE_CSS_BORDER_CORNER_RADIUS,
|
||||
0,
|
||||
border_corner_radius_value_parse,
|
||||
@ -777,6 +846,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
&no_corner_radius);
|
||||
gtk_style_property_register ("border-bottom-left-radius",
|
||||
GTK_TYPE_CSS_BORDER_CORNER_RADIUS,
|
||||
GTK_TYPE_CSS_BORDER_CORNER_RADIUS,
|
||||
GTK_TYPE_CSS_BORDER_CORNER_RADIUS,
|
||||
0,
|
||||
border_corner_radius_value_parse,
|
||||
@ -785,6 +856,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
&no_corner_radius);
|
||||
|
||||
gtk_style_property_register ("outline-style",
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
0,
|
||||
NULL,
|
||||
@ -792,6 +865,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
GTK_BORDER_STYLE_NONE);
|
||||
gtk_style_property_register ("outline-width",
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
0,
|
||||
NULL,
|
||||
@ -799,6 +874,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
compute_border_width,
|
||||
0);
|
||||
gtk_style_property_register ("outline-offset",
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT,
|
||||
0,
|
||||
NULL,
|
||||
@ -807,6 +884,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
0);
|
||||
|
||||
gtk_style_property_register ("background-clip",
|
||||
GTK_TYPE_CSS_AREA,
|
||||
GTK_TYPE_CSS_AREA,
|
||||
GTK_TYPE_CSS_AREA,
|
||||
0,
|
||||
NULL,
|
||||
@ -815,6 +894,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_CSS_AREA_BORDER_BOX);
|
||||
|
||||
gtk_style_property_register ("background-origin",
|
||||
GTK_TYPE_CSS_AREA,
|
||||
GTK_TYPE_CSS_AREA,
|
||||
GTK_TYPE_CSS_AREA,
|
||||
0,
|
||||
NULL,
|
||||
@ -822,70 +903,83 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
GTK_CSS_AREA_PADDING_BOX);
|
||||
|
||||
g_value_init (&value, GTK_TYPE_SYMBOLIC_COLOR);
|
||||
g_value_set_boxed (&value, _gtk_symbolic_color_get_current_color ());
|
||||
_gtk_style_property_register ("border-top-color",
|
||||
gtk_style_property_register ("border-top-color",
|
||||
GTK_TYPE_SYMBOLIC_COLOR,
|
||||
GDK_TYPE_RGBA,
|
||||
GDK_TYPE_RGBA,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
color_compute,
|
||||
&value);
|
||||
_gtk_style_property_register ("border-right-color",
|
||||
_gtk_symbolic_color_get_current_color ());
|
||||
gtk_style_property_register ("border-right-color",
|
||||
GTK_TYPE_SYMBOLIC_COLOR,
|
||||
GDK_TYPE_RGBA,
|
||||
GDK_TYPE_RGBA,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
color_compute,
|
||||
&value);
|
||||
_gtk_style_property_register ("border-bottom-color",
|
||||
_gtk_symbolic_color_get_current_color ());
|
||||
gtk_style_property_register ("border-bottom-color",
|
||||
GTK_TYPE_SYMBOLIC_COLOR,
|
||||
GDK_TYPE_RGBA,
|
||||
GDK_TYPE_RGBA,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
color_compute,
|
||||
&value);
|
||||
_gtk_style_property_register ("border-left-color",
|
||||
_gtk_symbolic_color_get_current_color ());
|
||||
gtk_style_property_register ("border-left-color",
|
||||
GTK_TYPE_SYMBOLIC_COLOR,
|
||||
GDK_TYPE_RGBA,
|
||||
GDK_TYPE_RGBA,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
color_compute,
|
||||
&value);
|
||||
_gtk_style_property_register ("outline-color",
|
||||
_gtk_symbolic_color_get_current_color ());
|
||||
gtk_style_property_register ("outline-color",
|
||||
GTK_TYPE_SYMBOLIC_COLOR,
|
||||
GDK_TYPE_RGBA,
|
||||
GDK_TYPE_RGBA,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
color_compute,
|
||||
&value);
|
||||
g_value_unset (&value);
|
||||
_gtk_symbolic_color_get_current_color ());
|
||||
|
||||
gtk_style_property_register ("background-repeat",
|
||||
GTK_TYPE_CSS_BACKGROUND_REPEAT,
|
||||
GTK_TYPE_CSS_BACKGROUND_REPEAT,
|
||||
GTK_TYPE_CSS_BACKGROUND_REPEAT,
|
||||
0,
|
||||
background_repeat_value_parse,
|
||||
background_repeat_value_print,
|
||||
NULL,
|
||||
GTK_CSS_BACKGROUND_REPEAT | (GTK_CSS_BACKGROUND_REPEAT << GTK_CSS_BACKGROUND_REPEAT_SHIFT));
|
||||
g_value_init (&value, GTK_TYPE_CSS_IMAGE);
|
||||
_gtk_style_property_register ("background-image",
|
||||
gtk_style_property_register ("background-image",
|
||||
GTK_TYPE_CSS_IMAGE,
|
||||
GTK_TYPE_CSS_IMAGE,
|
||||
CAIRO_GOBJECT_TYPE_PATTERN,
|
||||
0,
|
||||
css_image_value_parse,
|
||||
css_image_value_print,
|
||||
css_image_value_compute,
|
||||
&value);
|
||||
NULL);
|
||||
|
||||
_gtk_style_property_register ("border-image-source",
|
||||
gtk_style_property_register ("border-image-source",
|
||||
GTK_TYPE_CSS_IMAGE,
|
||||
GTK_TYPE_CSS_IMAGE,
|
||||
CAIRO_GOBJECT_TYPE_PATTERN,
|
||||
0,
|
||||
css_image_value_parse,
|
||||
css_image_value_print,
|
||||
css_image_value_compute,
|
||||
&value);
|
||||
g_value_unset (&value);
|
||||
NULL);
|
||||
gtk_style_property_register ("border-image-repeat",
|
||||
GTK_TYPE_CSS_BORDER_IMAGE_REPEAT,
|
||||
GTK_TYPE_CSS_BORDER_IMAGE_REPEAT,
|
||||
GTK_TYPE_CSS_BORDER_IMAGE_REPEAT,
|
||||
0,
|
||||
NULL,
|
||||
@ -893,8 +987,10 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
&border_image_repeat);
|
||||
|
||||
/* XXX: The initial vaue is wrong, it should be 100% */
|
||||
/* XXX: The initial value is wrong, it should be 100% */
|
||||
gtk_style_property_register ("border-image-slice",
|
||||
GTK_TYPE_BORDER,
|
||||
GTK_TYPE_BORDER,
|
||||
GTK_TYPE_BORDER,
|
||||
0,
|
||||
NULL,
|
||||
@ -902,6 +998,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
&border_of_ones);
|
||||
gtk_style_property_register ("border-image-width",
|
||||
GTK_TYPE_BORDER,
|
||||
GTK_TYPE_BORDER,
|
||||
GTK_TYPE_BORDER,
|
||||
0,
|
||||
NULL,
|
||||
@ -909,6 +1007,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
NULL);
|
||||
gtk_style_property_register ("engine",
|
||||
GTK_TYPE_THEMING_ENGINE,
|
||||
GTK_TYPE_THEMING_ENGINE,
|
||||
GTK_TYPE_THEMING_ENGINE,
|
||||
0,
|
||||
NULL,
|
||||
@ -916,6 +1016,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
gtk_theming_engine_load (NULL));
|
||||
gtk_style_property_register ("transition",
|
||||
GTK_TYPE_ANIMATION_DESCRIPTION,
|
||||
GTK_TYPE_ANIMATION_DESCRIPTION,
|
||||
GTK_TYPE_ANIMATION_DESCRIPTION,
|
||||
0,
|
||||
NULL,
|
||||
@ -925,6 +1027,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
|
||||
/* Private property holding the binding sets */
|
||||
gtk_style_property_register ("gtk-key-bindings",
|
||||
G_TYPE_PTR_ARRAY,
|
||||
G_TYPE_PTR_ARRAY,
|
||||
G_TYPE_PTR_ARRAY,
|
||||
0,
|
||||
bindings_value_parse,
|
||||
|
@ -50,6 +50,7 @@ struct _GtkCssStyleProperty
|
||||
{
|
||||
GtkStyleProperty parent;
|
||||
|
||||
GType computed_type;
|
||||
GValue initial_value;
|
||||
guint id;
|
||||
guint inherit :1;
|
||||
@ -77,6 +78,8 @@ gboolean _gtk_css_style_property_is_inherit (GtkCssStyleProp
|
||||
guint _gtk_css_style_property_get_id (GtkCssStyleProperty *property);
|
||||
const GValue * _gtk_css_style_property_get_initial_value
|
||||
(GtkCssStyleProperty *property);
|
||||
GType _gtk_css_style_property_get_computed_type (GtkCssStyleProperty *property);
|
||||
GType _gtk_css_style_property_get_specified_type (GtkCssStyleProperty *property);
|
||||
|
||||
void _gtk_css_style_property_compute_value (GtkCssStyleProperty *property,
|
||||
GValue *computed,
|
||||
|
Loading…
Reference in New Issue
Block a user