gtkcssnodeprivate.h 9.07 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/* GTK - The GIMP Toolkit
 * Copyright (C) 2014 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_NODE_PRIVATE_H__
#define __GTK_CSS_NODE_PRIVATE_H__

#include "gtkcssnodedeclarationprivate.h"
22 23
#include "gtkbitmaskprivate.h"
#include "gtkcsstypesprivate.h"
24 25 26

G_BEGIN_DECLS

27 28 29 30 31 32 33 34 35 36 37 38 39 40
#define GTK_TYPE_CSS_NODE           (gtk_css_node_get_type ())
#define GTK_CSS_NODE(obj)           (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_CSS_NODE, GtkCssNode))
#define GTK_CSS_NODE_CLASS(cls)     (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_CSS_NODE, GtkCssNodeClass))
#define GTK_IS_CSS_NODE(obj)        (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_CSS_NODE))
#define GTK_IS_CSS_NODE_CLASS(obj)  (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_CSS_NODE))
#define GTK_CSS_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CSS_NODE, GtkCssNodeClass))

typedef struct _GtkCssNode           GtkCssNode;
typedef struct _GtkCssNodeClass      GtkCssNodeClass;

struct _GtkCssNode
{
  GObject object;

41 42 43 44 45 46
  GtkCssNode *parent;
  GtkCssNode *previous_sibling;
  GtkCssNode *next_sibling;
  GtkCssNode *first_child;
  GtkCssNode *last_child;

47 48
  GtkCssNodeDeclaration *decl;
  GtkCssStyle           *style;
49

50 51
  GtkCssChange           pending_changes;       /* changes that accumulated since the style was last computed */

52
  guint                  visible :1;            /* node will be skipped when validating or computing styles */
53
  guint                  invalid :1;            /* node or a child needs to be validated (even if just for animation) */
54
  guint                  children_changed :1;   /* the children changed since last validation */
55 56 57 58 59
};

struct _GtkCssNodeClass
{
  GObjectClass object_class;
60

61
  gboolean              (* init_matcher)                (GtkCssNode            *cssnode,
62
                                                         GtkCssMatcher         *matcher);
63 64
  GtkWidgetPath *       (* create_widget_path)          (GtkCssNode            *cssnode);
  const GtkWidgetPath * (* get_widget_path)             (GtkCssNode            *cssnode);
65
  GtkStyleProviderPrivate *(* get_style_provider)       (GtkCssNode            *cssnode);
66 67 68 69
  GtkCssStyle *         (* update_style)                (GtkCssNode            *cssnode,
                                                         GtkCssChange           pending_changes,
                                                         GtkCssStyle           *old_style);
  void                  (* invalidate)                  (GtkCssNode            *node);
70 71
  void                  (* queue_validate)              (GtkCssNode            *node);
  void                  (* dequeue_validate)            (GtkCssNode            *node);
Benjamin Otte's avatar
Benjamin Otte committed
72 73
  GtkCssStyle *         (* validate)                    (GtkCssNode            *cssnode,
                                                         GtkCssStyle           *current_style,
74 75
                                                         gint64                 timestamp,
                                                         GtkCssChange           change,
76
                                                         gboolean               parent_changed);
77 78 79
};

GType                   gtk_css_node_get_type           (void) G_GNUC_CONST;
80

81 82
void                    gtk_css_node_set_parent         (GtkCssNode            *cssnode,
                                                         GtkCssNode            *parent);
83 84 85 86
void                    gtk_css_node_set_after          (GtkCssNode            *cssnode,
                                                         GtkCssNode            *previous_sibling);
void                    gtk_css_node_set_before         (GtkCssNode            *cssnode,
                                                         GtkCssNode            *next_sibling);
87
GtkCssNode *            gtk_css_node_get_parent         (GtkCssNode            *cssnode);
88 89 90 91
GtkCssNode *            gtk_css_node_get_first_child    (GtkCssNode            *cssnode);
GtkCssNode *            gtk_css_node_get_last_child     (GtkCssNode            *cssnode);
GtkCssNode *            gtk_css_node_get_previous_sibling(GtkCssNode           *cssnode);
GtkCssNode *            gtk_css_node_get_next_sibling   (GtkCssNode            *cssnode);
92

93 94 95 96
void                    gtk_css_node_set_visible        (GtkCssNode            *cssnode,
                                                         gboolean               visible);
gboolean                gtk_css_node_get_visible        (GtkCssNode            *cssnode);

97 98 99
void                    gtk_css_node_set_widget_type    (GtkCssNode            *cssnode,
                                                         GType                  widget_type);
GType                   gtk_css_node_get_widget_type    (GtkCssNode            *cssnode);
100
void                    gtk_css_node_set_id             (GtkCssNode            *cssnode,
101 102
                                                         const char            *id);
const char *            gtk_css_node_get_id             (GtkCssNode            *cssnode);
103
void                    gtk_css_node_set_state          (GtkCssNode            *cssnode,
104 105 106 107 108
                                                         GtkStateFlags          state_flags);
GtkStateFlags           gtk_css_node_get_state          (GtkCssNode            *cssnode);
void                    gtk_css_node_set_junction_sides (GtkCssNode            *cssnode,
                                                         GtkJunctionSides       junction_sides);
GtkJunctionSides        gtk_css_node_get_junction_sides (GtkCssNode            *cssnode);
109
void                    gtk_css_node_add_class          (GtkCssNode            *cssnode,
110
                                                         GQuark                 style_class);
111
void                    gtk_css_node_remove_class       (GtkCssNode            *cssnode,
112 113 114 115
                                                         GQuark                 style_class);
gboolean                gtk_css_node_has_class          (GtkCssNode            *cssnode,
                                                         GQuark                 style_class);
GList *                 gtk_css_node_list_classes       (GtkCssNode            *cssnode);
116
void                    gtk_css_node_add_region         (GtkCssNode            *cssnode,
117 118
                                                         GQuark                 region,
                                                         GtkRegionFlags         flags);
119
void                    gtk_css_node_remove_region      (GtkCssNode            *cssnode,
120 121 122 123 124 125 126 127 128 129
                                                         GQuark                 region);
gboolean                gtk_css_node_has_region         (GtkCssNode            *cssnode,
                                                         GQuark                 region,
                                                         GtkRegionFlags        *out_flags);
GList *                 gtk_css_node_list_regions       (GtkCssNode            *cssnode);

const GtkCssNodeDeclaration *
                        gtk_css_node_get_declaration    (GtkCssNode            *cssnode);


130 131 132
GtkCssStyle *           gtk_css_node_get_style          (GtkCssNode            *cssnode);
void                    gtk_css_node_set_style          (GtkCssNode            *cssnode,
                                                         GtkCssStyle           *style);
133
GtkCssStyle *           gtk_css_node_create_style       (GtkCssNode            *cssnode);
134

135 136
void                    gtk_css_node_invalidate         (GtkCssNode            *cssnode,
                                                         GtkCssChange           change);
137 138
void                    gtk_css_node_validate           (GtkCssNode            *cssnode,
                                                         gint64                 timestamp,
139
                                                         gboolean               parent_changed);
140 141
void                    gtk_css_node_set_invalid        (GtkCssNode            *node,
                                                         gboolean               invalid);
142 143

gboolean                gtk_css_node_init_matcher       (GtkCssNode            *cssnode,
144
                                                         GtkCssMatcher         *matcher);
145 146
GtkWidgetPath *         gtk_css_node_create_widget_path (GtkCssNode            *cssnode);
const GtkWidgetPath *   gtk_css_node_get_widget_path    (GtkCssNode            *cssnode);
147
GtkStyleProviderPrivate *gtk_css_node_get_style_provider(GtkCssNode            *cssnode);
148

149 150 151
G_END_DECLS

#endif /* __GTK_CSS_NODE_PRIVATE_H__ */