[gtk+/wip/otte/gadget: 19/22] css: Add min-width/height CSS properties



commit e70b4dda69eb6cf7e348240b7deb7123f44f77a0
Author: Benjamin Otte <otte redhat com>
Date:   Thu Dec 13 03:10:25 2012 +0100

    css: Add min-width/height CSS properties

 gtk/gtkcssstylepropertyimpl.c |   28 ++++++++++++++++++++++++++++
 gtk/gtkcsstypesprivate.h      |    2 ++
 2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 9dd95b3..9a9fe3c 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -836,6 +836,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;
@@ -1598,6 +1607,25 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           _gtk_css_transform_value_new_none ());
 
+  gtk_css_style_property_register        ("min-width",
+                                          GTK_CSS_PROPERTY_MIN_WIDTH,
+                                          G_TYPE_NONE,
+                                          GTK_STYLE_PROPERTY_ANIMATED,
+                                          GTK_CSS_AFFECTS_SIZE,
+                                          minmax_parse,
+                                          NULL,
+                                          NULL,
+                                          _gtk_css_number_value_new (0, GTK_CSS_PX));
+  gtk_css_style_property_register        ("min-height",
+                                          GTK_CSS_PROPERTY_MIN_HEIGHT,
+                                          G_TYPE_NONE,
+                                          GTK_STYLE_PROPERTY_ANIMATED,
+                                          GTK_CSS_AFFECTS_SIZE,
+                                          minmax_parse,
+                                          NULL,
+                                          NULL,
+                                          _gtk_css_number_value_new (0, 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 1f3252a..8d9fc81 100644
--- a/gtk/gtkcsstypesprivate.h
+++ b/gtk/gtkcsstypesprivate.h
@@ -203,6 +203,8 @@ enum { /*< skip >*/
   GTK_CSS_PROPERTY_ICON_SHADOW,
   GTK_CSS_PROPERTY_ICON_STYLE,
   GTK_CSS_PROPERTY_ICON_TRANSFORM,
+  GTK_CSS_PROPERTY_MIN_WIDTH,
+  GTK_CSS_PROPERTY_MIN_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]