[gtk+/wip/actor: 3/24] css: Add min/max-width/height CSS properties
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/actor: 3/24] css: Add min/max-width/height CSS properties
- Date: Sat, 5 Jan 2013 19:22:44 +0000 (UTC)
commit 99e9dc83faf63c69cae2c047206adebf7cdff881
Author: Benjamin Otte <otte redhat com>
Date: Thu Dec 13 03:10:25 2012 +0100
css: Add min/max-width/height CSS properties
Nothing is using them yet.
gtk/gtkcssstylepropertyimpl.c | 44 +++++++++++++++++++++++++++++++++++++++++
gtk/gtkcsstypesprivate.h | 4 +++
2 files changed, 48 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index c58edd8..8120ef2 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -713,6 +713,15 @@ border_image_width_parse (GtkCssStyleProperty *property,
}
static GtkCssValue *
+minmax_parse (GtkCssStyleProperty *property,
+ GtkCssParser *parser)
+{
+ return _gtk_css_number_value_parse (parser,
+ GTK_CSS_PARSE_LENGTH
+ | GTK_CSS_POSITIVE_ONLY);
+}
+
+static GtkCssValue *
transition_property_parse_one (GtkCssParser *parser)
{
GtkCssValue *value;
@@ -1283,6 +1292,41 @@ _gtk_css_style_property_init_properties (void)
_gtk_css_number_value_new (1, GTK_CSS_NUMBER),
_gtk_css_number_value_new (1, GTK_CSS_NUMBER)));
+ gtk_css_style_property_register ("min-width",
+ GTK_CSS_PROPERTY_MIN_WIDTH,
+ G_TYPE_NONE,
+ GTK_STYLE_PROPERTY_ANIMATED,
+ minmax_parse,
+ NULL,
+ NULL,
+ _gtk_css_number_value_new (0, GTK_CSS_PX));
+ gtk_css_style_property_register ("max-width",
+ GTK_CSS_PROPERTY_MAX_WIDTH,
+ G_TYPE_NONE,
+ GTK_STYLE_PROPERTY_ANIMATED,
+ minmax_parse,
+ NULL,
+ NULL,
+ /* XXX: Should be 'none' */
+ _gtk_css_number_value_new (G_MAXDOUBLE, GTK_CSS_PX));
+ gtk_css_style_property_register ("min-height",
+ GTK_CSS_PROPERTY_MIN_HEIGHT,
+ G_TYPE_NONE,
+ GTK_STYLE_PROPERTY_ANIMATED,
+ minmax_parse,
+ NULL,
+ NULL,
+ _gtk_css_number_value_new (0, GTK_CSS_PX));
+ gtk_css_style_property_register ("max-height",
+ GTK_CSS_PROPERTY_MAX_HEIGHT,
+ G_TYPE_NONE,
+ GTK_STYLE_PROPERTY_ANIMATED,
+ minmax_parse,
+ NULL,
+ NULL,
+ /* XXX: Should be 'none' */
+ _gtk_css_number_value_new (G_MAXDOUBLE, GTK_CSS_PX));
+
gtk_css_style_property_register ("transition-property",
GTK_CSS_PROPERTY_TRANSITION_PROPERTY,
G_TYPE_NONE,
diff --git a/gtk/gtkcsstypesprivate.h b/gtk/gtkcsstypesprivate.h
index 9c1f92b..8837d0a 100644
--- a/gtk/gtkcsstypesprivate.h
+++ b/gtk/gtkcsstypesprivate.h
@@ -120,6 +120,10 @@ enum { /*< skip >*/
GTK_CSS_PROPERTY_BORDER_IMAGE_REPEAT,
GTK_CSS_PROPERTY_BORDER_IMAGE_SLICE,
GTK_CSS_PROPERTY_BORDER_IMAGE_WIDTH,
+ GTK_CSS_PROPERTY_MIN_WIDTH,
+ GTK_CSS_PROPERTY_MAX_WIDTH,
+ GTK_CSS_PROPERTY_MIN_HEIGHT,
+ GTK_CSS_PROPERTY_MAX_HEIGHT,
GTK_CSS_PROPERTY_TRANSITION_PROPERTY,
GTK_CSS_PROPERTY_TRANSITION_DURATION,
GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]