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> */
97 typedef struct _GtkCssNumber GtkCssNumber;
98 typedef struct _GtkCssBorderCornerRadius GtkCssBorderCornerRadius;
99 typedef struct _GtkCssBorderImageRepeat GtkCssBorderImageRepeat;
101 struct _GtkCssNumber {
106 struct _GtkCssBorderCornerRadius {
107 GtkCssNumber horizontal;
108 GtkCssNumber vertical;
111 struct _GtkCssBorderImageRepeat {
112 GtkCssBorderRepeatStyle vrepeat;
113 GtkCssBorderRepeatStyle hrepeat;
116 #define GTK_TYPE_CSS_BORDER_CORNER_RADIUS _gtk_css_border_corner_radius_get_type ()
117 #define GTK_TYPE_CSS_BORDER_IMAGE_REPEAT _gtk_css_border_image_repeat_get_type ()
118 #define GTK_TYPE_CSS_NUMBER _gtk_css_number_get_type ()
120 GType _gtk_css_border_corner_radius_get_type (void);
121 GType _gtk_css_border_image_repeat_get_type (void);
122 GType _gtk_css_number_get_type (void);
124 #define GTK_CSS_NUMBER_INIT(_value,_unit) { (_value), (_unit) }
125 void _gtk_css_number_init (GtkCssNumber *number,
128 gboolean _gtk_css_number_equal (const GtkCssNumber *one,
129 const GtkCssNumber *two);
130 double _gtk_css_number_get (const GtkCssNumber *number,
131 double one_hundred_percent);
132 void _gtk_css_number_compute (GtkCssNumber *dest,
133 const GtkCssNumber *src,
134 GtkStyleContext *context);
135 void _gtk_css_number_print (const GtkCssNumber *number,
141 #endif /* __GTK_CSS_TYPES_PRIVATE_H__ */