2012-03-17 01:17:23 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 2012 Benjamin Otte <otte@gnome.org>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GTK_CSS_MATCHER_PRIVATE_H__
|
|
|
|
#define __GTK_CSS_MATCHER_PRIVATE_H__
|
|
|
|
|
|
|
|
#include <gtk/gtkenums.h>
|
|
|
|
#include <gtk/gtktypes.h>
|
2012-03-18 15:13:09 +00:00
|
|
|
#include "gtk/gtkcsstypesprivate.h"
|
2012-03-17 01:17:23 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2015-02-09 15:41:06 +00:00
|
|
|
typedef struct _GtkCssMatcherNode GtkCssMatcherNode;
|
2012-03-18 15:13:09 +00:00
|
|
|
typedef struct _GtkCssMatcherSuperset GtkCssMatcherSuperset;
|
2012-03-17 13:32:52 +00:00
|
|
|
typedef struct _GtkCssMatcherWidgetPath GtkCssMatcherWidgetPath;
|
2012-03-17 13:28:07 +00:00
|
|
|
typedef struct _GtkCssMatcherClass GtkCssMatcherClass;
|
2012-03-17 01:17:23 +00:00
|
|
|
|
2012-03-17 13:28:07 +00:00
|
|
|
struct _GtkCssMatcherClass {
|
|
|
|
gboolean (* get_parent) (GtkCssMatcher *matcher,
|
2012-03-17 01:17:23 +00:00
|
|
|
const GtkCssMatcher *child);
|
2012-03-17 13:28:07 +00:00
|
|
|
gboolean (* get_previous) (GtkCssMatcher *matcher,
|
2012-03-17 01:17:23 +00:00
|
|
|
const GtkCssMatcher *next);
|
|
|
|
|
2012-03-17 13:28:07 +00:00
|
|
|
GtkStateFlags (* get_state) (const GtkCssMatcher *matcher);
|
2012-12-10 11:57:10 +00:00
|
|
|
gboolean (* has_type) (const GtkCssMatcher *matcher,
|
|
|
|
GType type);
|
2012-03-17 13:28:07 +00:00
|
|
|
gboolean (* has_class) (const GtkCssMatcher *matcher,
|
2012-03-24 00:13:50 +00:00
|
|
|
GQuark class_name);
|
2012-03-17 13:28:07 +00:00
|
|
|
gboolean (* has_id) (const GtkCssMatcher *matcher,
|
2012-03-17 01:17:23 +00:00
|
|
|
const char *id);
|
2012-03-17 13:28:07 +00:00
|
|
|
gboolean (* has_regions) (const GtkCssMatcher *matcher);
|
|
|
|
gboolean (* has_region) (const GtkCssMatcher *matcher,
|
2012-03-17 01:17:23 +00:00
|
|
|
const char *region,
|
|
|
|
GtkRegionFlags flags);
|
2012-03-18 01:11:44 +00:00
|
|
|
gboolean (* has_position) (const GtkCssMatcher *matcher,
|
|
|
|
gboolean forward,
|
|
|
|
int a,
|
|
|
|
int b);
|
2012-11-28 10:07:52 +00:00
|
|
|
gboolean is_any;
|
2012-03-17 13:28:07 +00:00
|
|
|
};
|
|
|
|
|
2012-03-17 13:32:52 +00:00
|
|
|
struct _GtkCssMatcherWidgetPath {
|
2012-03-17 13:28:07 +00:00
|
|
|
const GtkCssMatcherClass *klass;
|
2015-02-09 10:24:29 +00:00
|
|
|
const GtkCssNodeDeclaration *decl;
|
2012-03-17 13:28:07 +00:00
|
|
|
const GtkWidgetPath *path;
|
|
|
|
guint index;
|
|
|
|
guint sibling_index;
|
|
|
|
};
|
|
|
|
|
2015-02-09 15:41:06 +00:00
|
|
|
struct _GtkCssMatcherNode {
|
|
|
|
const GtkCssMatcherClass *klass;
|
|
|
|
GtkCssNode *node;
|
|
|
|
};
|
|
|
|
|
2012-03-18 15:13:09 +00:00
|
|
|
struct _GtkCssMatcherSuperset {
|
|
|
|
const GtkCssMatcherClass *klass;
|
|
|
|
const GtkCssMatcher *subset;
|
|
|
|
GtkCssChange relevant;
|
|
|
|
};
|
|
|
|
|
2012-03-17 13:32:52 +00:00
|
|
|
union _GtkCssMatcher {
|
|
|
|
const GtkCssMatcherClass *klass;
|
|
|
|
GtkCssMatcherWidgetPath path;
|
2015-02-09 15:41:06 +00:00
|
|
|
GtkCssMatcherNode node;
|
2012-03-18 15:13:09 +00:00
|
|
|
GtkCssMatcherSuperset superset;
|
2012-03-17 13:32:52 +00:00
|
|
|
};
|
|
|
|
|
2012-04-30 19:28:57 +00:00
|
|
|
gboolean _gtk_css_matcher_init (GtkCssMatcher *matcher,
|
2015-02-09 10:24:29 +00:00
|
|
|
const GtkWidgetPath *path,
|
|
|
|
const GtkCssNodeDeclaration *decl) G_GNUC_WARN_UNUSED_RESULT;
|
2015-02-09 15:41:06 +00:00
|
|
|
void _gtk_css_matcher_node_init (GtkCssMatcher *matcher,
|
|
|
|
GtkCssNode *node);
|
2012-03-18 13:42:50 +00:00
|
|
|
void _gtk_css_matcher_any_init (GtkCssMatcher *matcher);
|
2012-03-18 15:13:09 +00:00
|
|
|
void _gtk_css_matcher_superset_init (GtkCssMatcher *matcher,
|
|
|
|
const GtkCssMatcher *subset,
|
|
|
|
GtkCssChange relevant);
|
|
|
|
|
2012-03-17 13:28:07 +00:00
|
|
|
|
|
|
|
static inline gboolean
|
|
|
|
_gtk_css_matcher_get_parent (GtkCssMatcher *matcher,
|
|
|
|
const GtkCssMatcher *child)
|
|
|
|
{
|
|
|
|
return child->klass->get_parent (matcher, child);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline gboolean
|
|
|
|
_gtk_css_matcher_get_previous (GtkCssMatcher *matcher,
|
|
|
|
const GtkCssMatcher *next)
|
|
|
|
{
|
|
|
|
return next->klass->get_previous (matcher, next);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline GtkStateFlags
|
|
|
|
_gtk_css_matcher_get_state (const GtkCssMatcher *matcher)
|
|
|
|
{
|
|
|
|
return matcher->klass->get_state (matcher);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline gboolean
|
2012-12-10 11:57:10 +00:00
|
|
|
_gtk_css_matcher_has_type (const GtkCssMatcher *matcher,
|
|
|
|
GType type)
|
2012-03-17 13:28:07 +00:00
|
|
|
{
|
2012-12-10 11:57:10 +00:00
|
|
|
return matcher->klass->has_type (matcher, type);
|
2012-03-17 13:28:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline gboolean
|
|
|
|
_gtk_css_matcher_has_class (const GtkCssMatcher *matcher,
|
2012-03-24 00:13:50 +00:00
|
|
|
GQuark class_name)
|
2012-03-17 13:28:07 +00:00
|
|
|
{
|
|
|
|
return matcher->klass->has_class (matcher, class_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline gboolean
|
|
|
|
_gtk_css_matcher_has_id (const GtkCssMatcher *matcher,
|
|
|
|
const char *id)
|
|
|
|
{
|
|
|
|
return matcher->klass->has_id (matcher, id);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline gboolean
|
|
|
|
_gtk_css_matcher_has_regions (const GtkCssMatcher *matcher)
|
|
|
|
{
|
|
|
|
return matcher->klass->has_regions (matcher);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline gboolean
|
|
|
|
_gtk_css_matcher_has_region (const GtkCssMatcher *matcher,
|
|
|
|
const char *region,
|
|
|
|
GtkRegionFlags flags)
|
|
|
|
{
|
|
|
|
return matcher->klass->has_region (matcher, region, flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline guint
|
2012-03-18 01:11:44 +00:00
|
|
|
_gtk_css_matcher_has_position (const GtkCssMatcher *matcher,
|
|
|
|
gboolean forward,
|
|
|
|
int a,
|
|
|
|
int b)
|
2012-03-17 13:28:07 +00:00
|
|
|
{
|
2012-03-18 01:11:44 +00:00
|
|
|
return matcher->klass->has_position (matcher, forward, a, b);
|
2012-03-17 13:28:07 +00:00
|
|
|
}
|
|
|
|
|
2012-11-28 10:07:52 +00:00
|
|
|
static inline gboolean
|
|
|
|
_gtk_css_matcher_matches_any (const GtkCssMatcher *matcher)
|
|
|
|
{
|
|
|
|
return matcher->klass->is_any;
|
|
|
|
}
|
|
|
|
|
2012-03-17 01:17:23 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GTK_CSS_MATCHER_PRIVATE_H__ */
|