diff options
author | Benjamin Otte <otte@redhat.com> | 2012-03-18 14:42:50 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-04-17 08:59:08 +0200 |
commit | 5f5bf27287d188ac070ac7e02be2f6f81fb3874f (patch) | |
tree | 1eea1ed0dfa4402e57c490a6d91b771cce22d96a /gtk/gtkcssmatcher.c | |
parent | d115441a57d6bec49b43a40dee885647b8afbf99 (diff) | |
download | gtk+-5f5bf27287d188ac070ac7e02be2f6f81fb3874f.tar.gz |
matcher: Add a matcher that matches anything
Lesson learned: Adwaita uses all possible selector types and all of
those for parents, too. But so far no siblings.
Diffstat (limited to 'gtk/gtkcssmatcher.c')
-rw-r--r-- | gtk/gtkcssmatcher.c | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/gtk/gtkcssmatcher.c b/gtk/gtkcssmatcher.c index cf9489eab4..5a25bfd8a4 100644 --- a/gtk/gtkcssmatcher.c +++ b/gtk/gtkcssmatcher.c @@ -199,3 +199,95 @@ _gtk_css_matcher_init (GtkCssMatcher *matcher, matcher->path.sibling_index = gtk_widget_path_iter_get_sibling_index (path, matcher->path.index); } +/* GTK_CSS_MATCHER_WIDGET_ANY */ + +static gboolean +gtk_css_matcher_any_get_parent (GtkCssMatcher *matcher, + const GtkCssMatcher *child) +{ + _gtk_css_matcher_any_init (matcher); + + return TRUE; +} + +static gboolean +gtk_css_matcher_any_get_previous (GtkCssMatcher *matcher, + const GtkCssMatcher *next) +{ + _gtk_css_matcher_any_init (matcher); + + return TRUE; +} + +static GtkStateFlags +gtk_css_matcher_any_get_state (const GtkCssMatcher *matcher) +{ + /* XXX: This gets tricky when we implement :not() */ + + return GTK_STATE_FLAG_ACTIVE | GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_SELECTED + | GTK_STATE_FLAG_INSENSITIVE | GTK_STATE_FLAG_INCONSISTENT + | GTK_STATE_FLAG_FOCUSED | GTK_STATE_FLAG_BACKDROP; +} + +static gboolean +gtk_css_matcher_any_has_name (const GtkCssMatcher *matcher, + const char *name) +{ + return TRUE; +} + +static gboolean +gtk_css_matcher_any_has_class (const GtkCssMatcher *matcher, + const char *class_name) +{ + return TRUE; +} + +static gboolean +gtk_css_matcher_any_has_id (const GtkCssMatcher *matcher, + const char *id) +{ + return TRUE; +} + +static gboolean +gtk_css_matcher_any_has_regions (const GtkCssMatcher *matcher) +{ + return TRUE; +} + +static gboolean +gtk_css_matcher_any_has_region (const GtkCssMatcher *matcher, + const char *region, + GtkRegionFlags flags) +{ + return TRUE; +} + +static gboolean +gtk_css_matcher_any_has_position (const GtkCssMatcher *matcher, + gboolean forward, + int a, + int b) +{ + return TRUE; +} + +static const GtkCssMatcherClass GTK_CSS_MATCHER_ANY = { + gtk_css_matcher_any_get_parent, + gtk_css_matcher_any_get_previous, + gtk_css_matcher_any_get_state, + gtk_css_matcher_any_has_name, + gtk_css_matcher_any_has_class, + gtk_css_matcher_any_has_id, + gtk_css_matcher_any_has_regions, + gtk_css_matcher_any_has_region, + gtk_css_matcher_any_has_position, +}; + +void +_gtk_css_matcher_any_init (GtkCssMatcher *matcher) +{ + matcher->klass = >K_CSS_MATCHER_ANY; +} + |