1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 2011 Benjamin Otte <otte@gnome.org>
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 of the License, or (at your option) any later version.
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.
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/>.
18 #ifndef __GTK_CSS_TYPES_PRIVATE_H__
19 #define __GTK_CSS_TYPES_PRIVATE_H__
21 #include <glib-object.h>
22 #include <gtk/gtkstylecontext.h>
31 /* We encode horizontal and vertical repeat in one enum value.
32 * This eases parsing and storage, but you need to be aware that
33 * you have to "unpack" this value.
35 #define GTK_CSS_BACKGROUND_REPEAT_SHIFT (8)
36 #define GTK_CSS_BACKGROUND_REPEAT_MASK ((1 << GTK_CSS_BACKGROUND_REPEAT_SHIFT) - 1)
37 #define GTK_CSS_BACKGROUND_HORIZONTAL(repeat) ((repeat) & GTK_CSS_BACKGROUND_REPEAT_MASK)
38 #define GTK_CSS_BACKGROUND_VERTICAL(repeat) (((repeat) >> GTK_CSS_BACKGROUND_REPEAT_SHIFT) & GTK_CSS_BACKGROUND_REPEAT_MASK)
39 typedef enum /*< enum >*/
41 GTK_CSS_BACKGROUND_INVALID, /*< skip >*/
42 GTK_CSS_BACKGROUND_REPEAT, /* start at one so we know if a value has been set */
43 GTK_CSS_BACKGROUND_SPACE,
44 GTK_CSS_BACKGROUND_ROUND,
45 GTK_CSS_BACKGROUND_NO_REPEAT,
46 /* need to hardcode the numer or glib-mkenums makes us into a flags type */
47 GTK_CSS_BACKGROUND_REPEAT_X = 1025,
48 GTK_CSS_BACKGROUND_REPEAT_Y = 260
49 } GtkCssBackgroundRepeat;
52 GTK_CSS_REPEAT_STYLE_STRETCH,
53 GTK_CSS_REPEAT_STYLE_REPEAT,
54 GTK_CSS_REPEAT_STYLE_ROUND,
55 GTK_CSS_REPEAT_STYLE_SPACE
56 } GtkCssBorderRepeatStyle;
59 GTK_CSS_AREA_BORDER_BOX,
60 GTK_CSS_AREA_PADDING_BOX,
61 GTK_CSS_AREA_CONTENT_BOX
64 /* for the order in arrays */
65 typedef enum /*< skip >*/ {
72 typedef enum /*< skip >*/ {
79 typedef enum /*< skip >*/ {
80 /* CSS term: <number> */
82 /* CSS term: <percentage> */
84 /* CSS term: <length> */
93 /* CSS term: <angle> */
100 typedef struct _GtkCssNumber GtkCssNumber;
101 typedef struct _GtkCssBackgroundSize GtkCssBackgroundSize;
102 typedef struct _GtkCssBorderCornerRadius GtkCssBorderCornerRadius;
103 typedef struct _GtkCssBorderImageRepeat GtkCssBorderImageRepeat;
105 struct _GtkCssNumber {
110 struct _GtkCssBackgroundSize {
111 GtkCssNumber width; /* 0 means auto here */
112 GtkCssNumber height; /* 0 means auto here */
117 struct _GtkCssBorderCornerRadius {
118 GtkCssNumber horizontal;
119 GtkCssNumber vertical;
122 struct _GtkCssBorderImageRepeat {
123 GtkCssBorderRepeatStyle vrepeat;
124 GtkCssBorderRepeatStyle hrepeat;
127 #define GTK_TYPE_CSS_BACKGROUND_SIZE _gtk_css_background_size_get_type ()
128 #define GTK_TYPE_CSS_BORDER_CORNER_RADIUS _gtk_css_border_corner_radius_get_type ()
129 #define GTK_TYPE_CSS_BORDER_IMAGE_REPEAT _gtk_css_border_image_repeat_get_type ()
130 #define GTK_TYPE_CSS_NUMBER _gtk_css_number_get_type ()
132 GType _gtk_css_background_size_get_type (void);
133 GType _gtk_css_border_corner_radius_get_type (void);
134 GType _gtk_css_border_image_repeat_get_type (void);
135 GType _gtk_css_number_get_type (void);
137 #define GTK_CSS_NUMBER_INIT(_value,_unit) { (_value), (_unit) }
138 void _gtk_css_number_init (GtkCssNumber *number,
141 gboolean _gtk_css_number_equal (const GtkCssNumber *one,
142 const GtkCssNumber *two);
143 double _gtk_css_number_get (const GtkCssNumber *number,
144 double one_hundred_percent);
145 void _gtk_css_number_compute (GtkCssNumber *dest,
146 const GtkCssNumber *src,
147 GtkStyleContext *context);
148 void _gtk_css_number_print (const GtkCssNumber *number,
154 #endif /* __GTK_CSS_TYPES_PRIVATE_H__ */