1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 2012 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_MATCHER_PRIVATE_H__
19 #define __GTK_CSS_MATCHER_PRIVATE_H__
21 #include <gtk/gtkenums.h>
22 #include <gtk/gtktypes.h>
26 typedef union _GtkCssMatcher GtkCssMatcher;
27 typedef struct _GtkCssMatcherWidgetPath GtkCssMatcherWidgetPath;
28 typedef struct _GtkCssMatcherClass GtkCssMatcherClass;
30 struct _GtkCssMatcherClass {
31 gboolean (* get_parent) (GtkCssMatcher *matcher,
32 const GtkCssMatcher *child);
33 gboolean (* get_previous) (GtkCssMatcher *matcher,
34 const GtkCssMatcher *next);
36 GtkStateFlags (* get_state) (const GtkCssMatcher *matcher);
37 gboolean (* has_name) (const GtkCssMatcher *matcher,
39 gboolean (* has_class) (const GtkCssMatcher *matcher,
40 const char *class_name);
41 gboolean (* has_id) (const GtkCssMatcher *matcher,
43 gboolean (* has_regions) (const GtkCssMatcher *matcher);
44 gboolean (* has_region) (const GtkCssMatcher *matcher,
46 GtkRegionFlags flags);
47 guint (* get_sibling_index) (const GtkCssMatcher *matcher);
48 guint (* get_n_siblings) (const GtkCssMatcher *matcher);
51 struct _GtkCssMatcherWidgetPath {
52 const GtkCssMatcherClass *klass;
53 const GtkWidgetPath *path;
54 GtkStateFlags state_flags;
59 union _GtkCssMatcher {
60 const GtkCssMatcherClass *klass;
61 GtkCssMatcherWidgetPath path;
64 void _gtk_css_matcher_init (GtkCssMatcher *matcher,
65 const GtkWidgetPath *path,
68 static inline gboolean
69 _gtk_css_matcher_get_parent (GtkCssMatcher *matcher,
70 const GtkCssMatcher *child)
72 return child->klass->get_parent (matcher, child);
75 static inline gboolean
76 _gtk_css_matcher_get_previous (GtkCssMatcher *matcher,
77 const GtkCssMatcher *next)
79 return next->klass->get_previous (matcher, next);
82 static inline GtkStateFlags
83 _gtk_css_matcher_get_state (const GtkCssMatcher *matcher)
85 return matcher->klass->get_state (matcher);
88 static inline gboolean
89 _gtk_css_matcher_has_name (const GtkCssMatcher *matcher,
92 return matcher->klass->has_name (matcher, name);
95 static inline gboolean
96 _gtk_css_matcher_has_class (const GtkCssMatcher *matcher,
97 const char *class_name)
99 return matcher->klass->has_class (matcher, class_name);
102 static inline gboolean
103 _gtk_css_matcher_has_id (const GtkCssMatcher *matcher,
106 return matcher->klass->has_id (matcher, id);
110 static inline gboolean
111 _gtk_css_matcher_has_regions (const GtkCssMatcher *matcher)
113 return matcher->klass->has_regions (matcher);
116 static inline gboolean
117 _gtk_css_matcher_has_region (const GtkCssMatcher *matcher,
119 GtkRegionFlags flags)
121 return matcher->klass->has_region (matcher, region, flags);
125 _gtk_css_matcher_get_sibling_index (const GtkCssMatcher *matcher)
127 return matcher->klass->get_sibling_index (matcher);
131 _gtk_css_matcher_get_n_siblings (const GtkCssMatcher *matcher)
133 return matcher->klass->get_n_siblings (matcher);
139 #endif /* __GTK_CSS_MATCHER_PRIVATE_H__ */