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, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef __GTK_CSS_TYPES_PRIVATE_H__
21 #define __GTK_CSS_TYPES_PRIVATE_H__
23 #include <glib-object.h>
24 #include <gtk/gtkstylecontext.h>
33 /* We encode horizontal and vertical repeat in one enum value.
34 * This eases parsing and storage, but you need to be aware that
35 * you have to "unpack" this value.
37 #define GTK_CSS_BACKGROUND_REPEAT_SHIFT (8)
38 #define GTK_CSS_BACKGROUND_REPEAT_MASK ((1 << GTK_CSS_BACKGROUND_REPEAT_SHIFT) - 1)
39 #define GTK_CSS_BACKGROUND_HORIZONTAL(repeat) ((repeat) & GTK_CSS_BACKGROUND_REPEAT_MASK)
40 #define GTK_CSS_BACKGROUND_VERTICAL(repeat) (((repeat) >> GTK_CSS_BACKGROUND_REPEAT_SHIFT) & GTK_CSS_BACKGROUND_REPEAT_MASK)
41 typedef enum /*< enum >*/
43 GTK_CSS_BACKGROUND_INVALID, /*< skip >*/
44 GTK_CSS_BACKGROUND_REPEAT, /* start at one so we know if a value has been set */
45 GTK_CSS_BACKGROUND_SPACE,
46 GTK_CSS_BACKGROUND_ROUND,
47 GTK_CSS_BACKGROUND_NO_REPEAT,
48 /* need to hardcode the numer or glib-mkenums makes us into a flags type */
49 GTK_CSS_BACKGROUND_REPEAT_X = 1025,
50 GTK_CSS_BACKGROUND_REPEAT_Y = 260
51 } GtkCssBackgroundRepeat;
54 GTK_CSS_REPEAT_STYLE_STRETCH,
55 GTK_CSS_REPEAT_STYLE_REPEAT,
56 GTK_CSS_REPEAT_STYLE_ROUND,
57 GTK_CSS_REPEAT_STYLE_SPACE
58 } GtkCssBorderRepeatStyle;
61 GTK_CSS_AREA_BORDER_BOX,
62 GTK_CSS_AREA_PADDING_BOX,
63 GTK_CSS_AREA_CONTENT_BOX
66 /* for the order in arrays */
67 typedef enum /*< skip >*/ {
74 typedef enum /*< skip >*/ {
81 typedef enum /*< skip >*/ {
82 /* CSS term: <number> */
84 /* CSS term: <percentage> */
86 /* CSS term: <length> */
95 /* CSS term: <angle> */
102 typedef struct _GtkCssNumber GtkCssNumber;
103 typedef struct _GtkCssBackgroundSize GtkCssBackgroundSize;
104 typedef struct _GtkCssBorderCornerRadius GtkCssBorderCornerRadius;
105 typedef struct _GtkCssBorderImageRepeat GtkCssBorderImageRepeat;
107 struct _GtkCssNumber {
112 struct _GtkCssBackgroundSize {
113 GtkCssNumber width; /* 0 means auto here */
114 GtkCssNumber height; /* 0 means auto here */
119 struct _GtkCssBorderCornerRadius {
120 GtkCssNumber horizontal;
121 GtkCssNumber vertical;
124 struct _GtkCssBorderImageRepeat {
125 GtkCssBorderRepeatStyle vrepeat;
126 GtkCssBorderRepeatStyle hrepeat;
129 #define GTK_TYPE_CSS_BACKGROUND_SIZE _gtk_css_background_size_get_type ()
130 #define GTK_TYPE_CSS_BORDER_CORNER_RADIUS _gtk_css_border_corner_radius_get_type ()
131 #define GTK_TYPE_CSS_BORDER_IMAGE_REPEAT _gtk_css_border_image_repeat_get_type ()
132 #define GTK_TYPE_CSS_NUMBER _gtk_css_number_get_type ()
134 GType _gtk_css_background_size_get_type (void);
135 GType _gtk_css_border_corner_radius_get_type (void);
136 GType _gtk_css_border_image_repeat_get_type (void);
137 GType _gtk_css_number_get_type (void);
139 #define GTK_CSS_NUMBER_INIT(_value,_unit) { (_value), (_unit) }
140 void _gtk_css_number_init (GtkCssNumber *number,
143 gboolean _gtk_css_number_equal (const GtkCssNumber *one,
144 const GtkCssNumber *two);
145 double _gtk_css_number_get (const GtkCssNumber *number,
146 double one_hundred_percent);
147 void _gtk_css_number_compute (GtkCssNumber *dest,
148 const GtkCssNumber *src,
149 GtkStyleContext *context);
150 void _gtk_css_number_print (const GtkCssNumber *number,
156 #endif /* __GTK_CSS_TYPES_PRIVATE_H__ */