summaryrefslogtreecommitdiff
path: root/gtk/gtkcssenumvalue.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2012-03-30 02:19:39 +0200
committerBenjamin Otte <otte@redhat.com>2012-04-17 08:59:15 +0200
commit4ba9be5b976df6f51b7ae0f81af5b29246b7ac80 (patch)
tree522839fd82c7012564b3a58f08546e3fb48bf059 /gtk/gtkcssenumvalue.c
parent8e17f9c2338c2e64ced679dc11cc9d2c3d76daf6 (diff)
downloadgtk+-4ba9be5b976df6f51b7ae0f81af5b29246b7ac80.tar.gz
cssvalue: Add GtkCssArea to the enum values
... and get rid of its GType. This makes it non-queryable using gtk_style_context_get() but it used to be a private struct anyway.
Diffstat (limited to 'gtk/gtkcssenumvalue.c')
-rw-r--r--gtk/gtkcssenumvalue.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/gtk/gtkcssenumvalue.c b/gtk/gtkcssenumvalue.c
index 7e79fc7407..ee786b67cb 100644
--- a/gtk/gtkcssenumvalue.c
+++ b/gtk/gtkcssenumvalue.c
@@ -256,3 +256,55 @@ _gtk_css_font_weight_value_get (const GtkCssValue *value)
return value->value;
}
+/* GtkCssArea */
+
+static const GtkCssValueClass GTK_CSS_VALUE_AREA = {
+ gtk_css_value_enum_free,
+ gtk_css_value_enum_equal,
+ gtk_css_value_enum_print
+};
+
+static GtkCssValue area_values[] = {
+ { &GTK_CSS_VALUE_AREA, 1, GTK_CSS_AREA_BORDER_BOX, "border-box" },
+ { &GTK_CSS_VALUE_AREA, 1, GTK_CSS_AREA_PADDING_BOX, "padding-box" },
+ { &GTK_CSS_VALUE_AREA, 1, GTK_CSS_AREA_CONTENT_BOX, "content-box" }
+};
+
+GtkCssValue *
+_gtk_css_area_value_new (GtkCssArea area)
+{
+ guint i;
+
+ for (i = 0; i < G_N_ELEMENTS (area_values); i++)
+ {
+ if (area_values[i].value == area)
+ return _gtk_css_value_ref (&area_values[i]);
+ }
+
+ g_return_val_if_reached (NULL);
+}
+
+GtkCssValue *
+_gtk_css_area_value_try_parse (GtkCssParser *parser)
+{
+ guint i;
+
+ g_return_val_if_fail (parser != NULL, NULL);
+
+ for (i = 0; i < G_N_ELEMENTS (area_values); i++)
+ {
+ if (_gtk_css_parser_try (parser, area_values[i].name, TRUE))
+ return _gtk_css_value_ref (&area_values[i]);
+ }
+
+ return NULL;
+}
+
+GtkCssArea
+_gtk_css_area_value_get (const GtkCssValue *value)
+{
+ g_return_val_if_fail (value->class == &GTK_CSS_VALUE_AREA, GTK_CSS_AREA_BORDER_BOX);
+
+ return value->value;
+}
+