1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 2011 Benjamin Otte <otte@gnome.org>
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 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 
18 #ifndef __GTK_CSS_TYPES_PRIVATE_H__
19 #define __GTK_CSS_TYPES_PRIVATE_H__
20 
21 #include <glib-object.h>
22 #include <gsk/gsk.h>
23 
24 #include <gtk/gtkenums.h>
25 
26 G_BEGIN_DECLS
27 
28 typedef struct _GtkCssNode GtkCssNode;
29 typedef struct _GtkCssNodeDeclaration GtkCssNodeDeclaration;
30 typedef struct _GtkCssStyle GtkCssStyle;
31 typedef struct _GtkCssStaticStyle GtkCssStaticStyle;
32 
33 #define GTK_CSS_CHANGE_CLASS                          (1ULL <<  0)
34 #define GTK_CSS_CHANGE_NAME                           (1ULL <<  1)
35 #define GTK_CSS_CHANGE_ID                             (1ULL <<  2)
36 #define GTK_CSS_CHANGE_FIRST_CHILD                    (1ULL <<  3)
37 #define GTK_CSS_CHANGE_LAST_CHILD                     (1ULL <<  4)
38 #define GTK_CSS_CHANGE_NTH_CHILD                      (1ULL <<  5)
39 #define GTK_CSS_CHANGE_NTH_LAST_CHILD                 (1ULL <<  6)
40 #define GTK_CSS_CHANGE_STATE                          (1ULL <<  7)
41 #define GTK_CSS_CHANGE_HOVER                          (1ULL <<  8)
42 #define GTK_CSS_CHANGE_DISABLED                       (1ULL <<  9)
43 #define GTK_CSS_CHANGE_BACKDROP                       (1ULL << 10)
44 #define GTK_CSS_CHANGE_SELECTED                       (1ULL << 11)
45 
46 #define GTK_CSS_CHANGE_SIBLING_SHIFT 12
47 
48 #define GTK_CSS_CHANGE_SIBLING_CLASS                  (1ULL << 12)
49 #define GTK_CSS_CHANGE_SIBLING_NAME                   (1ULL << 13)
50 #define GTK_CSS_CHANGE_SIBLING_ID                     (1ULL << 14)
51 #define GTK_CSS_CHANGE_SIBLING_FIRST_CHILD            (1ULL << 15)
52 #define GTK_CSS_CHANGE_SIBLING_LAST_CHILD             (1ULL << 16)
53 #define GTK_CSS_CHANGE_SIBLING_NTH_CHILD              (1ULL << 17)
54 #define GTK_CSS_CHANGE_SIBLING_NTH_LAST_CHILD         (1ULL << 18)
55 #define GTK_CSS_CHANGE_SIBLING_STATE                  (1ULL << 19)
56 #define GTK_CSS_CHANGE_SIBLING_HOVER                  (1ULL << 20)
57 #define GTK_CSS_CHANGE_SIBLING_DISABLED               (1ULL << 21)
58 #define GTK_CSS_CHANGE_SIBLING_BACKDROP               (1ULL << 22)
59 #define GTK_CSS_CHANGE_SIBLING_SELECTED               (1ULL << 23)
60 
61 #define GTK_CSS_CHANGE_PARENT_SHIFT (GTK_CSS_CHANGE_SIBLING_SHIFT + GTK_CSS_CHANGE_SIBLING_SHIFT)
62 
63 #define GTK_CSS_CHANGE_PARENT_CLASS                   (1ULL << 24)
64 #define GTK_CSS_CHANGE_PARENT_NAME                    (1ULL << 25)
65 #define GTK_CSS_CHANGE_PARENT_ID                      (1ULL << 26)
66 #define GTK_CSS_CHANGE_PARENT_FIRST_CHILD             (1ULL << 27)
67 #define GTK_CSS_CHANGE_PARENT_LAST_CHILD              (1ULL << 28)
68 #define GTK_CSS_CHANGE_PARENT_NTH_CHILD               (1ULL << 29)
69 #define GTK_CSS_CHANGE_PARENT_NTH_LAST_CHILD          (1ULL << 30)
70 #define GTK_CSS_CHANGE_PARENT_STATE                   (1ULL << 31)
71 #define GTK_CSS_CHANGE_PARENT_HOVER                   (1ULL << 32)
72 #define GTK_CSS_CHANGE_PARENT_DISABLED                (1ULL << 33)
73 #define GTK_CSS_CHANGE_PARENT_BACKDROP                (1ULL << 34)
74 #define GTK_CSS_CHANGE_PARENT_SELECTED                (1ULL << 35)
75 
76 #define GTK_CSS_CHANGE_PARENT_SIBLING_SHIFT (GTK_CSS_CHANGE_PARENT_SHIFT + GTK_CSS_CHANGE_SIBLING_SHIFT)
77 
78 #define GTK_CSS_CHANGE_PARENT_SIBLING_CLASS           (1ULL << 36)
79 #define GTK_CSS_CHANGE_PARENT_SIBLING_NAME            (1ULL << 37)
80 #define GTK_CSS_CHANGE_PARENT_SIBLING_ID              (1ULL << 38)
81 #define GTK_CSS_CHANGE_PARENT_SIBLING_FIRST_CHILD     (1ULL << 39)
82 #define GTK_CSS_CHANGE_PARENT_SIBLING_LAST_CHILD      (1ULL << 40)
83 #define GTK_CSS_CHANGE_PARENT_SIBLING_NTH_CHILD       (1ULL << 41)
84 #define GTK_CSS_CHANGE_PARENT_SIBLING_NTH_LAST_CHILD  (1ULL << 42)
85 #define GTK_CSS_CHANGE_PARENT_SIBLING_STATE           (1ULL << 43)
86 #define GTK_CSS_CHANGE_PARENT_SIBLING_HOVER           (1ULL << 44)
87 #define GTK_CSS_CHANGE_PARENT_SIBLING_DISABLED        (1ULL << 45)
88 #define GTK_CSS_CHANGE_PARENT_SIBLING_BACKDROP        (1ULL << 46)
89 #define GTK_CSS_CHANGE_PARENT_SIBLING_SELECTED        (1ULL << 47)
90 
91 /* add more */
92 #define GTK_CSS_CHANGE_SOURCE                         (1ULL << 48)
93 #define GTK_CSS_CHANGE_PARENT_STYLE                   (1ULL << 49)
94 #define GTK_CSS_CHANGE_TIMESTAMP                      (1ULL << 50)
95 #define GTK_CSS_CHANGE_ANIMATIONS                     (1ULL << 51)
96 
97 #define GTK_CSS_CHANGE_RESERVED_BIT                   (1ULL << 62)
98 
99 typedef guint64 GtkCssChange;
100 
101 #define GTK_CSS_CHANGE_POSITION (GTK_CSS_CHANGE_FIRST_CHILD | \
102                                  GTK_CSS_CHANGE_LAST_CHILD  | \
103                                  GTK_CSS_CHANGE_NTH_CHILD   | \
104                                  GTK_CSS_CHANGE_NTH_LAST_CHILD)
105 #define GTK_CSS_CHANGE_SIBLING_POSITION (GTK_CSS_CHANGE_POSITION << GTK_CSS_CHANGE_SIBLING_SHIFT)
106 
107 #define GTK_CSS_CHANGE_ANY_SELF (GTK_CSS_CHANGE_CLASS    | \
108                                  GTK_CSS_CHANGE_NAME     | \
109                                  GTK_CSS_CHANGE_ID       | \
110                                  GTK_CSS_CHANGE_POSITION | \
111                                  GTK_CSS_CHANGE_STATE    | \
112                                  GTK_CSS_CHANGE_DISABLED | \
113                                  GTK_CSS_CHANGE_BACKDROP | \
114                                  GTK_CSS_CHANGE_SELECTED | \
115                                  GTK_CSS_CHANGE_HOVER)
116 #define GTK_CSS_CHANGE_ANY_SIBLING (GTK_CSS_CHANGE_ANY_SELF << GTK_CSS_CHANGE_SIBLING_SHIFT)
117 #define GTK_CSS_CHANGE_ANY_PARENT (GTK_CSS_CHANGE_ANY_SELF << GTK_CSS_CHANGE_PARENT_SHIFT)
118 #define GTK_CSS_CHANGE_ANY_PARENT_SIBLING (GTK_CSS_CHANGE_ANY_SELF << GTK_CSS_CHANGE_PARENT_SIBLING_SHIFT)
119 
120 #define GTK_CSS_CHANGE_ANY (GTK_CSS_CHANGE_ANY_SELF           | \
121                             GTK_CSS_CHANGE_ANY_SIBLING        | \
122                             GTK_CSS_CHANGE_ANY_PARENT         | \
123                             GTK_CSS_CHANGE_ANY_PARENT_SIBLING | \
124                             GTK_CSS_CHANGE_SOURCE             | \
125                             GTK_CSS_CHANGE_PARENT_STYLE       | \
126                             GTK_CSS_CHANGE_TIMESTAMP          | \
127                             GTK_CSS_CHANGE_ANIMATIONS)
128 
129 /*
130  * GtkCssAffects:
131  * @GTK_CSS_AFFECTS_CONTENT: The content rendering is affected.
132  *   This does not include things that affect the font. For those,
133  *   see @GTK_CSS_AFFECTS_TEXT.
134  * @GTK_CSS_AFFECTS_BACKGROUND: The background rendering is affected.
135  * @GTK_CSS_AFFECTS_BORDER: The border styling is affected.
136  * @GTK_CSS_AFFECTS_TEXT_ATTRS: Text attributes are affected.
137  * @GTK_CSS_AFFECTS_TEXT_SIZE: Text size is affected.
138  * @GTK_CSS_AFFECTS_TEXT_CONTENT: Text rendering is affected, but size or
139  *   attributes are not.
140  * @GTK_CSS_AFFECTS_ICON_SIZE: Icon size is affected.
141  * @GTK_CSS_AFFECTS_ICON_TEXTURE: The icon texture has changed and needs to be
142  *   reloaded.
143  * @GTK_CSS_AFFECTS_ICON_REDRAW: Icons need to be redrawn (both symbolic and
144  *   non-symbolic).
145  * @GTK_CSS_AFFECTS_ICON_REDRAW_SYMBOLIC: Symbolic icons need to be redrawn.
146  * @GTK_CSS_AFFECTS_OUTLINE: The outline styling is affected.
147  * @GTK_CSS_AFFECTS_SIZE: Changes in this property may have an effect
148  *   on the allocated size of the element. Changes in these properties
149  *   should cause a recomputation of the element's allocated size.
150  * @GTK_CSS_AFFECTS_POSTEFFECT: An effect is applied after drawing that changes
151  * @GTK_CSS_AFFECTS_TEXT: Affects anything related to text rendering.
152  * @GTK_CSS_AFFECTS_REDRAW: Affects anything that requires redraw.
153  * @GTK_CSS_AFFECTS_TRANSFORM: Affects the element transformation.
154  *
155  * The generic effects that a CSS property can have. If a value is
156  * set, then the property will have an influence on that feature.
157  *
158  * Note that multiple values can be set.
159  */
160 typedef enum {
161   GTK_CSS_AFFECTS_CONTENT              = (1 << 0),
162   GTK_CSS_AFFECTS_BACKGROUND           = (1 << 1),
163   GTK_CSS_AFFECTS_BORDER               = (1 << 2),
164   GTK_CSS_AFFECTS_TEXT_ATTRS           = (1 << 3),
165   GTK_CSS_AFFECTS_TEXT_SIZE            = (1 << 4),
166   GTK_CSS_AFFECTS_TEXT_CONTENT         = (1 << 5),
167   GTK_CSS_AFFECTS_ICON_SIZE            = (1 << 6),
168   GTK_CSS_AFFECTS_ICON_TEXTURE         = (1 << 7),
169   GTK_CSS_AFFECTS_ICON_REDRAW          = (1 << 8),
170   GTK_CSS_AFFECTS_ICON_REDRAW_SYMBOLIC = (1 << 9),
171   GTK_CSS_AFFECTS_OUTLINE              = (1 << 10),
172   GTK_CSS_AFFECTS_SIZE                 = (1 << 11),
173   GTK_CSS_AFFECTS_POSTEFFECT           = (1 << 12),
174   GTK_CSS_AFFECTS_TRANSFORM            = (1 << 13),
175 } GtkCssAffects;
176 
177 #define GTK_CSS_AFFECTS_REDRAW (GTK_CSS_AFFECTS_CONTENT |       \
178                                 GTK_CSS_AFFECTS_BACKGROUND |    \
179                                 GTK_CSS_AFFECTS_BORDER |        \
180                                 GTK_CSS_AFFECTS_OUTLINE |       \
181                                 GTK_CSS_AFFECTS_POSTEFFECT)
182 
183 #define GTK_CSS_AFFECTS_TEXT (GTK_CSS_AFFECTS_TEXT_SIZE | \
184                               GTK_CSS_AFFECTS_TEXT_CONTENT)
185 
186 
187 enum { /*< skip >*/
188   GTK_CSS_PROPERTY_COLOR,
189   GTK_CSS_PROPERTY_DPI,
190   GTK_CSS_PROPERTY_FONT_SIZE,
191   GTK_CSS_PROPERTY_ICON_PALETTE,
192   GTK_CSS_PROPERTY_BACKGROUND_COLOR,
193   GTK_CSS_PROPERTY_FONT_FAMILY,
194   GTK_CSS_PROPERTY_FONT_STYLE,
195   GTK_CSS_PROPERTY_FONT_WEIGHT,
196   GTK_CSS_PROPERTY_FONT_STRETCH,
197   GTK_CSS_PROPERTY_LETTER_SPACING,
198   GTK_CSS_PROPERTY_TEXT_DECORATION_LINE,
199   GTK_CSS_PROPERTY_TEXT_DECORATION_COLOR,
200   GTK_CSS_PROPERTY_TEXT_DECORATION_STYLE,
201   GTK_CSS_PROPERTY_FONT_KERNING,
202   GTK_CSS_PROPERTY_FONT_VARIANT_LIGATURES,
203   GTK_CSS_PROPERTY_FONT_VARIANT_POSITION,
204   GTK_CSS_PROPERTY_FONT_VARIANT_CAPS,
205   GTK_CSS_PROPERTY_FONT_VARIANT_NUMERIC,
206   GTK_CSS_PROPERTY_FONT_VARIANT_ALTERNATES,
207   GTK_CSS_PROPERTY_FONT_VARIANT_EAST_ASIAN,
208   GTK_CSS_PROPERTY_TEXT_SHADOW,
209   GTK_CSS_PROPERTY_BOX_SHADOW,
210   GTK_CSS_PROPERTY_MARGIN_TOP,
211   GTK_CSS_PROPERTY_MARGIN_LEFT,
212   GTK_CSS_PROPERTY_MARGIN_BOTTOM,
213   GTK_CSS_PROPERTY_MARGIN_RIGHT,
214   GTK_CSS_PROPERTY_PADDING_TOP,
215   GTK_CSS_PROPERTY_PADDING_LEFT,
216   GTK_CSS_PROPERTY_PADDING_BOTTOM,
217   GTK_CSS_PROPERTY_PADDING_RIGHT,
218   GTK_CSS_PROPERTY_BORDER_TOP_STYLE,
219   GTK_CSS_PROPERTY_BORDER_TOP_WIDTH,
220   GTK_CSS_PROPERTY_BORDER_LEFT_STYLE,
221   GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH,
222   GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE,
223   GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH,
224   GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE,
225   GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH,
226   GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS,
227   GTK_CSS_PROPERTY_BORDER_TOP_RIGHT_RADIUS,
228   GTK_CSS_PROPERTY_BORDER_BOTTOM_RIGHT_RADIUS,
229   GTK_CSS_PROPERTY_BORDER_BOTTOM_LEFT_RADIUS,
230   GTK_CSS_PROPERTY_OUTLINE_STYLE,
231   GTK_CSS_PROPERTY_OUTLINE_WIDTH,
232   GTK_CSS_PROPERTY_OUTLINE_OFFSET,
233   GTK_CSS_PROPERTY_BACKGROUND_CLIP,
234   GTK_CSS_PROPERTY_BACKGROUND_ORIGIN,
235   GTK_CSS_PROPERTY_BACKGROUND_SIZE,
236   GTK_CSS_PROPERTY_BACKGROUND_POSITION,
237   GTK_CSS_PROPERTY_BORDER_TOP_COLOR,
238   GTK_CSS_PROPERTY_BORDER_RIGHT_COLOR,
239   GTK_CSS_PROPERTY_BORDER_BOTTOM_COLOR,
240   GTK_CSS_PROPERTY_BORDER_LEFT_COLOR,
241   GTK_CSS_PROPERTY_OUTLINE_COLOR,
242   GTK_CSS_PROPERTY_BACKGROUND_REPEAT,
243   GTK_CSS_PROPERTY_BACKGROUND_IMAGE,
244   GTK_CSS_PROPERTY_BACKGROUND_BLEND_MODE,
245   GTK_CSS_PROPERTY_BORDER_IMAGE_SOURCE,
246   GTK_CSS_PROPERTY_BORDER_IMAGE_REPEAT,
247   GTK_CSS_PROPERTY_BORDER_IMAGE_SLICE,
248   GTK_CSS_PROPERTY_BORDER_IMAGE_WIDTH,
249   GTK_CSS_PROPERTY_ICON_SOURCE,
250   GTK_CSS_PROPERTY_ICON_SIZE,
251   GTK_CSS_PROPERTY_ICON_SHADOW,
252   GTK_CSS_PROPERTY_ICON_STYLE,
253   GTK_CSS_PROPERTY_ICON_TRANSFORM,
254   GTK_CSS_PROPERTY_ICON_FILTER,
255   GTK_CSS_PROPERTY_BORDER_SPACING,
256   GTK_CSS_PROPERTY_TRANSFORM,
257   GTK_CSS_PROPERTY_TRANSFORM_ORIGIN,
258   GTK_CSS_PROPERTY_MIN_WIDTH,
259   GTK_CSS_PROPERTY_MIN_HEIGHT,
260   GTK_CSS_PROPERTY_TRANSITION_PROPERTY,
261   GTK_CSS_PROPERTY_TRANSITION_DURATION,
262   GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION,
263   GTK_CSS_PROPERTY_TRANSITION_DELAY,
264   GTK_CSS_PROPERTY_ANIMATION_NAME,
265   GTK_CSS_PROPERTY_ANIMATION_DURATION,
266   GTK_CSS_PROPERTY_ANIMATION_TIMING_FUNCTION,
267   GTK_CSS_PROPERTY_ANIMATION_ITERATION_COUNT,
268   GTK_CSS_PROPERTY_ANIMATION_DIRECTION,
269   GTK_CSS_PROPERTY_ANIMATION_PLAY_STATE,
270   GTK_CSS_PROPERTY_ANIMATION_DELAY,
271   GTK_CSS_PROPERTY_ANIMATION_FILL_MODE,
272   GTK_CSS_PROPERTY_OPACITY,
273   GTK_CSS_PROPERTY_FILTER,
274   GTK_CSS_PROPERTY_CARET_COLOR,
275   GTK_CSS_PROPERTY_SECONDARY_CARET_COLOR,
276   GTK_CSS_PROPERTY_FONT_FEATURE_SETTINGS,
277   GTK_CSS_PROPERTY_FONT_VARIATION_SETTINGS,
278   /* add more */
279   GTK_CSS_PROPERTY_N_PROPERTIES
280 };
281 
282 typedef enum /*< skip >*/ {
283   GTK_CSS_AREA_BORDER_BOX,
284   GTK_CSS_AREA_PADDING_BOX,
285   GTK_CSS_AREA_CONTENT_BOX
286 } GtkCssArea;
287 
288 typedef enum /*< skip >*/ {
289   GTK_CSS_DIRECTION_NORMAL,
290   GTK_CSS_DIRECTION_REVERSE,
291   GTK_CSS_DIRECTION_ALTERNATE,
292   GTK_CSS_DIRECTION_ALTERNATE_REVERSE
293 } GtkCssDirection;
294 
295 typedef enum /*< skip >*/ {
296   GTK_CSS_PLAY_STATE_RUNNING,
297   GTK_CSS_PLAY_STATE_PAUSED
298 } GtkCssPlayState;
299 
300 typedef enum /*< skip >*/ {
301   GTK_CSS_FILL_NONE,
302   GTK_CSS_FILL_FORWARDS,
303   GTK_CSS_FILL_BACKWARDS,
304   GTK_CSS_FILL_BOTH
305 } GtkCssFillMode;
306 
307 typedef enum /*< skip >*/ {
308   GTK_CSS_ICON_STYLE_REQUESTED,
309   GTK_CSS_ICON_STYLE_REGULAR,
310   GTK_CSS_ICON_STYLE_SYMBOLIC
311 } GtkCssIconStyle;
312 
313 typedef enum /*< skip >*/ {
314   /* relative font sizes */
315   GTK_CSS_FONT_SIZE_SMALLER,
316   GTK_CSS_FONT_SIZE_LARGER,
317   /* absolute font sizes */
318   GTK_CSS_FONT_SIZE_XX_SMALL,
319   GTK_CSS_FONT_SIZE_X_SMALL,
320   GTK_CSS_FONT_SIZE_SMALL,
321   GTK_CSS_FONT_SIZE_MEDIUM,
322   GTK_CSS_FONT_SIZE_LARGE,
323   GTK_CSS_FONT_SIZE_X_LARGE,
324   GTK_CSS_FONT_SIZE_XX_LARGE
325 } GtkCssFontSize;
326 
327 typedef enum /*< skip >*/ {
328   GTK_CSS_TEXT_DECORATION_LINE_NONE         = 1 << 0,
329   GTK_CSS_TEXT_DECORATION_LINE_UNDERLINE    = 1 << 1,
330   GTK_CSS_TEXT_DECORATION_LINE_OVERLINE     = 1 << 2,
331   GTK_CSS_TEXT_DECORATION_LINE_LINE_THROUGH = 1 << 3
332 } GtkTextDecorationLine;
333 
334 typedef enum /*< skip >*/ {
335   GTK_CSS_TEXT_DECORATION_STYLE_SOLID,
336   GTK_CSS_TEXT_DECORATION_STYLE_DOUBLE,
337   GTK_CSS_TEXT_DECORATION_STYLE_WAVY
338 } GtkTextDecorationStyle;
339 
340 /* for the order in arrays */
341 typedef enum /*< skip >*/ {
342   GTK_CSS_TOP,
343   GTK_CSS_RIGHT,
344   GTK_CSS_BOTTOM,
345   GTK_CSS_LEFT
346 } GtkCssSide;
347 
348 typedef enum /*< skip >*/ {
349   GTK_CSS_DIMENSION_PERCENTAGE,
350   GTK_CSS_DIMENSION_NUMBER,
351   GTK_CSS_DIMENSION_LENGTH,
352   GTK_CSS_DIMENSION_ANGLE,
353   GTK_CSS_DIMENSION_TIME
354 } GtkCssDimension;
355 
356 typedef enum /*< skip >*/ {
357   /* CSS term: <number> */
358   GTK_CSS_NUMBER,
359   /* CSS term: <percentage> */
360   GTK_CSS_PERCENT,
361   /* CSS term: <length> */
362   GTK_CSS_PX,
363   GTK_CSS_PT,
364   GTK_CSS_EM,
365   GTK_CSS_EX,
366   GTK_CSS_REM,
367   GTK_CSS_PC,
368   GTK_CSS_IN,
369   GTK_CSS_CM,
370   GTK_CSS_MM,
371   /* CSS term: <angle> */
372   GTK_CSS_RAD,
373   GTK_CSS_DEG,
374   GTK_CSS_GRAD,
375   GTK_CSS_TURN,
376   /* CSS term: <time> */
377   GTK_CSS_S,
378   GTK_CSS_MS,
379 } GtkCssUnit;
380 
381 typedef enum /*< skip >*/ {
382   GTK_CSS_FONT_KERNING_AUTO,
383   GTK_CSS_FONT_KERNING_NORMAL,
384   GTK_CSS_FONT_KERNING_NONE
385 } GtkCssFontKerning;
386 
387 typedef enum /*< skip >*/ {
388   GTK_CSS_FONT_VARIANT_LIGATURE_NORMAL                     = 1 << 0,
389   GTK_CSS_FONT_VARIANT_LIGATURE_NONE                       = 1 << 1,
390   GTK_CSS_FONT_VARIANT_LIGATURE_COMMON_LIGATURES           = 1 << 2,
391   GTK_CSS_FONT_VARIANT_LIGATURE_NO_COMMON_LIGATURES        = 1 << 3,
392   GTK_CSS_FONT_VARIANT_LIGATURE_DISCRETIONARY_LIGATURES    = 1 << 4,
393   GTK_CSS_FONT_VARIANT_LIGATURE_NO_DISCRETIONARY_LIGATURES = 1 << 5,
394   GTK_CSS_FONT_VARIANT_LIGATURE_HISTORICAL_LIGATURES       = 1 << 6,
395   GTK_CSS_FONT_VARIANT_LIGATURE_NO_HISTORICAL_LIGATURES    = 1 << 7,
396   GTK_CSS_FONT_VARIANT_LIGATURE_CONTEXTUAL                 = 1 << 8,
397   GTK_CSS_FONT_VARIANT_LIGATURE_NO_CONTEXTUAL              = 1 << 9
398 } GtkCssFontVariantLigature;
399 
400 typedef enum /*< skip >*/ {
401   GTK_CSS_FONT_VARIANT_POSITION_NORMAL,
402   GTK_CSS_FONT_VARIANT_POSITION_SUB,
403   GTK_CSS_FONT_VARIANT_POSITION_SUPER
404 } GtkCssFontVariantPosition;
405 
406 typedef enum /*< skip >*/ {
407   GTK_CSS_FONT_VARIANT_NUMERIC_NORMAL             = 1 << 0,
408   GTK_CSS_FONT_VARIANT_NUMERIC_LINING_NUMS        = 1 << 1,
409   GTK_CSS_FONT_VARIANT_NUMERIC_OLDSTYLE_NUMS      = 1 << 2,
410   GTK_CSS_FONT_VARIANT_NUMERIC_PROPORTIONAL_NUMS  = 1 << 3,
411   GTK_CSS_FONT_VARIANT_NUMERIC_TABULAR_NUMS       = 1 << 4,
412   GTK_CSS_FONT_VARIANT_NUMERIC_DIAGONAL_FRACTIONS = 1 << 5,
413   GTK_CSS_FONT_VARIANT_NUMERIC_STACKED_FRACTIONS  = 1 << 6,
414   GTK_CSS_FONT_VARIANT_NUMERIC_ORDINAL            = 1 << 7,
415   GTK_CSS_FONT_VARIANT_NUMERIC_SLASHED_ZERO       = 1 << 8
416 } GtkCssFontVariantNumeric;
417 
418 typedef enum /*< skip >*/ {
419   GTK_CSS_FONT_VARIANT_CAPS_NORMAL,
420   GTK_CSS_FONT_VARIANT_CAPS_SMALL_CAPS,
421   GTK_CSS_FONT_VARIANT_CAPS_ALL_SMALL_CAPS,
422   GTK_CSS_FONT_VARIANT_CAPS_PETITE_CAPS,
423   GTK_CSS_FONT_VARIANT_CAPS_ALL_PETITE_CAPS,
424   GTK_CSS_FONT_VARIANT_CAPS_UNICASE,
425   GTK_CSS_FONT_VARIANT_CAPS_TITLING_CAPS
426 } GtkCssFontVariantCaps;
427 
428 typedef enum /*< skip >*/ {
429   GTK_CSS_FONT_VARIANT_ALTERNATE_NORMAL,
430   GTK_CSS_FONT_VARIANT_ALTERNATE_HISTORICAL_FORMS
431 } GtkCssFontVariantAlternate;
432 
433 typedef enum /*< skip >*/ {
434   GTK_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL       = 1 << 0,
435   GTK_CSS_FONT_VARIANT_EAST_ASIAN_JIS78        = 1 << 1,
436   GTK_CSS_FONT_VARIANT_EAST_ASIAN_JIS83        = 1 << 2,
437   GTK_CSS_FONT_VARIANT_EAST_ASIAN_JIS90        = 1 << 3,
438   GTK_CSS_FONT_VARIANT_EAST_ASIAN_JIS04        = 1 << 4,
439   GTK_CSS_FONT_VARIANT_EAST_ASIAN_SIMPLIFIED   = 1 << 5,
440   GTK_CSS_FONT_VARIANT_EAST_ASIAN_TRADITIONAL  = 1 << 6,
441   GTK_CSS_FONT_VARIANT_EAST_ASIAN_FULL_WIDTH   = 1 << 7,
442   GTK_CSS_FONT_VARIANT_EAST_ASIAN_PROPORTIONAL = 1 << 8,
443   GTK_CSS_FONT_VARIANT_EAST_ASIAN_RUBY         = 1 << 9
444 } GtkCssFontVariantEastAsian;
445 
446 GtkCssChange            _gtk_css_change_for_sibling              (GtkCssChange       match);
447 GtkCssChange            _gtk_css_change_for_child                (GtkCssChange       match);
448 
449 GtkCssDimension         gtk_css_unit_get_dimension               (GtkCssUnit         unit);
450 
451 char *                  gtk_css_change_to_string                 (GtkCssChange       change);
452 void                    gtk_css_change_print                     (GtkCssChange       change,
453                                                                   GString           *string);
454 
455 const char *            gtk_css_pseudoclass_name                 (GtkStateFlags      flags);
456 
457 /* These hash functions are selected so they achieve 2 things:
458  * 1. collision free among each other
459  *    Hashing the CSS selectors "button", ".button" and "#button" should give different results.
460  *    So we multiply the hash values with distinct prime numbers.
461  * 2. generate small numbers
462  *    It's why the code uses quarks instead of interned strings. Interned strings are random
463  *    pointers, quarks are numbers increasing from 0.
464  * Both of these goals should achieve a bloom filter for selector matching that is as free
465  * of collisions as possible.
466  */
467 static inline guint
gtk_css_hash_class(GQuark klass)468 gtk_css_hash_class (GQuark klass)
469 {
470   return klass * 5;
471 }
472 static inline guint
gtk_css_hash_name(GQuark name)473 gtk_css_hash_name (GQuark name)
474 {
475   return name * 7;
476 }
477 static inline guint
gtk_css_hash_id(GQuark id)478 gtk_css_hash_id (GQuark id)
479 {
480   return id * 11;
481 }
482 
483 G_END_DECLS
484 
485 #endif /* __GTK_CSS_TYPES_PRIVATE_H__ */
486