1 /*
2  * Copyright © 2012 Red Hat Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16  *
17  * Authors: Alexander Larsson <alexl@gnome.org>
18  */
19 
20 #ifndef __GTK_CSS_NUMBER_VALUE_PRIVATE_H__
21 #define __GTK_CSS_NUMBER_VALUE_PRIVATE_H__
22 
23 #include "gtkcssparserprivate.h"
24 #include "gtkcsstypesprivate.h"
25 #include "gtkcssvalueprivate.h"
26 
27 G_BEGIN_DECLS
28 
29 typedef enum /*< skip >*/ {
30   GTK_CSS_POSITIVE_ONLY = (1 << 0),
31   GTK_CSS_PARSE_PERCENT = (1 << 1),
32   GTK_CSS_PARSE_NUMBER = (1 << 2),
33   GTK_CSS_NUMBER_AS_PIXELS = (1 << 3),
34   GTK_CSS_PARSE_LENGTH = (1 << 4),
35   GTK_CSS_PARSE_ANGLE = (1 << 5),
36   GTK_CSS_PARSE_TIME = (1 << 6)
37 } GtkCssNumberParseFlags;
38 
39 typedef struct _GtkCssNumberValueClass GtkCssNumberValueClass;
40 
41 struct _GtkCssNumberValueClass {
42   GtkCssValueClass      value_class;
43 
44   double                (* get)                     (const GtkCssValue      *value,
45                                                      double                  one_hundred_percent);
46   GtkCssDimension       (* get_dimension)           (const GtkCssValue      *value);
47   gboolean              (* has_percent)             (const GtkCssValue      *value);
48   GtkCssValue *         (* multiply)                (const GtkCssValue      *value,
49                                                      double                  factor);
50   GtkCssValue *         (* try_add)                 (const GtkCssValue      *value1,
51                                                      const GtkCssValue      *value2);
52   gint                  (* get_calc_term_order)     (const GtkCssValue      *value);
53 };
54 
55 GtkCssValue *   _gtk_css_number_value_new           (double                  value,
56                                                      GtkCssUnit              unit);
57 GtkCssValue *   gtk_css_number_value_transition     (GtkCssValue            *start,
58                                                      GtkCssValue            *end,
59                                                      guint                   property_id,
60                                                      double                  progress);
61 gboolean        gtk_css_number_value_can_parse      (GtkCssParser           *parser);
62 GtkCssValue *   _gtk_css_number_value_parse         (GtkCssParser           *parser,
63                                                      GtkCssNumberParseFlags  flags);
64 
65 GtkCssDimension gtk_css_number_value_get_dimension  (const GtkCssValue      *value);
66 gboolean        gtk_css_number_value_has_percent    (const GtkCssValue      *value);
67 GtkCssValue *   gtk_css_number_value_multiply       (const GtkCssValue      *value,
68                                                      double                  factor);
69 GtkCssValue *   gtk_css_number_value_add            (GtkCssValue            *value1,
70                                                      GtkCssValue            *value2);
71 GtkCssValue *   gtk_css_number_value_try_add        (const GtkCssValue      *value1,
72                                                      const GtkCssValue      *value2);
73 gint            gtk_css_number_value_get_calc_term_order (const GtkCssValue *value);
74 
75 double          _gtk_css_number_value_get           (const GtkCssValue      *number,
76                                                      double                  one_hundred_percent);
77 
78 
79 G_END_DECLS
80 
81 #endif /* __GTK_CSS_NUMBER_VALUE_PRIVATE_H__ */
82