2015-01-09 23:47:32 +00:00
|
|
|
/* 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__
|
|
|
|
|
2020-01-26 03:37:17 +00:00
|
|
|
#include "gtkcountingbloomfilterprivate.h"
|
2015-01-09 23:47:32 +00:00
|
|
|
#include "gtkcssnodedeclarationprivate.h"
|
2016-01-15 22:27:51 +00:00
|
|
|
#include "gtkcssnodestylecacheprivate.h"
|
2015-12-12 01:02:04 +00:00
|
|
|
#include "gtkcssstylechangeprivate.h"
|
2015-02-09 08:41:48 +00:00
|
|
|
#include "gtkbitmaskprivate.h"
|
|
|
|
#include "gtkcsstypesprivate.h"
|
2022-10-07 19:51:02 +00:00
|
|
|
#include "gtklistlistmodelprivate.h"
|
2015-01-09 23:47:32 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2015-01-10 22:49:04 +00:00
|
|
|
#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))
|
|
|
|
|
2015-12-12 01:02:04 +00:00
|
|
|
typedef struct _GtkCssNodeClass GtkCssNodeClass;
|
2015-01-10 22:49:04 +00:00
|
|
|
|
|
|
|
struct _GtkCssNode
|
|
|
|
{
|
|
|
|
GObject object;
|
|
|
|
|
2015-01-26 01:18:06 +00:00
|
|
|
GtkCssNode *parent;
|
|
|
|
GtkCssNode *previous_sibling;
|
|
|
|
GtkCssNode *next_sibling;
|
|
|
|
GtkCssNode *first_child;
|
|
|
|
GtkCssNode *last_child;
|
|
|
|
|
2022-10-07 19:51:02 +00:00
|
|
|
GtkListListModel *children_observer;
|
|
|
|
|
2015-01-10 22:49:04 +00:00
|
|
|
GtkCssNodeDeclaration *decl;
|
|
|
|
GtkCssStyle *style;
|
2016-01-15 22:27:51 +00:00
|
|
|
GtkCssNodeStyleCache *cache; /* cache for children to look up styles */
|
2015-01-28 04:14:47 +00:00
|
|
|
|
2015-02-03 14:36:01 +00:00
|
|
|
GtkCssChange pending_changes; /* changes that accumulated since the style was last computed */
|
|
|
|
|
2015-02-10 01:50:57 +00:00
|
|
|
guint visible :1; /* node will be skipped when validating or computing styles */
|
2015-02-07 18:03:37 +00:00
|
|
|
guint invalid :1; /* node or a child needs to be validated (even if just for animation) */
|
2015-03-01 12:14:01 +00:00
|
|
|
guint needs_propagation :1; /* children have state changes that need to be propagated to their siblings */
|
2015-02-17 04:01:09 +00:00
|
|
|
/* Two invariants hold for this variable:
|
|
|
|
* style_is_invalid == TRUE => next_sibling->style_is_invalid == TRUE
|
|
|
|
* style_is_invalid == FALSE => first_child->style_is_invalid == TRUE
|
|
|
|
* So if a valid style is computed, one has to previously ensure that the parent's and the previous sibling's style
|
|
|
|
* are valid. This allows both validation and invalidation to run in O(nodes-in-tree) */
|
|
|
|
guint style_is_invalid :1; /* the style needs to be recomputed */
|
2015-01-10 22:49:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GtkCssNodeClass
|
|
|
|
{
|
|
|
|
GObjectClass object_class;
|
2015-01-12 02:58:21 +00:00
|
|
|
|
2015-03-01 20:33:54 +00:00
|
|
|
void (* node_added) (GtkCssNode *cssnode,
|
|
|
|
GtkCssNode *child,
|
|
|
|
GtkCssNode *previous);
|
|
|
|
void (* node_removed) (GtkCssNode *cssnode,
|
|
|
|
GtkCssNode *child,
|
|
|
|
GtkCssNode *previous);
|
2015-03-05 16:35:57 +00:00
|
|
|
void (* style_changed) (GtkCssNode *cssnode,
|
2015-12-12 01:02:04 +00:00
|
|
|
GtkCssStyleChange *style_change);
|
2015-03-01 20:33:54 +00:00
|
|
|
|
2015-02-17 14:18:32 +00:00
|
|
|
/* get style provider to use or NULL to use parent's */
|
2017-10-31 03:31:46 +00:00
|
|
|
GtkStyleProvider * (* get_style_provider) (GtkCssNode *cssnode);
|
2015-02-18 23:54:14 +00:00
|
|
|
/* get frame clock or NULL (only relevant for root node) */
|
|
|
|
GdkFrameClock * (* get_frame_clock) (GtkCssNode *cssnode);
|
2015-02-04 03:43:55 +00:00
|
|
|
GtkCssStyle * (* update_style) (GtkCssNode *cssnode,
|
2020-01-26 03:37:17 +00:00
|
|
|
const GtkCountingBloomFilter *filter,
|
2015-02-04 03:43:55 +00:00
|
|
|
GtkCssChange pending_changes,
|
2015-02-18 23:54:14 +00:00
|
|
|
gint64 timestamp,
|
2015-02-04 03:43:55 +00:00
|
|
|
GtkCssStyle *old_style);
|
|
|
|
void (* invalidate) (GtkCssNode *node);
|
2015-02-07 16:19:07 +00:00
|
|
|
void (* queue_validate) (GtkCssNode *node);
|
|
|
|
void (* dequeue_validate) (GtkCssNode *node);
|
2015-02-22 22:28:04 +00:00
|
|
|
void (* validate) (GtkCssNode *node);
|
2015-01-10 22:49:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GType gtk_css_node_get_type (void) G_GNUC_CONST;
|
2015-01-09 23:47:32 +00:00
|
|
|
|
2015-02-16 22:05:05 +00:00
|
|
|
GtkCssNode * gtk_css_node_new (void);
|
|
|
|
|
2015-01-10 21:35:38 +00:00
|
|
|
void gtk_css_node_set_parent (GtkCssNode *cssnode,
|
|
|
|
GtkCssNode *parent);
|
2015-07-12 19:39:49 +00:00
|
|
|
void gtk_css_node_insert_after (GtkCssNode *parent,
|
|
|
|
GtkCssNode *cssnode,
|
2015-02-09 21:51:28 +00:00
|
|
|
GtkCssNode *previous_sibling);
|
2015-07-12 19:39:49 +00:00
|
|
|
void gtk_css_node_insert_before (GtkCssNode *parent,
|
|
|
|
GtkCssNode *cssnode,
|
2015-02-09 21:51:28 +00:00
|
|
|
GtkCssNode *next_sibling);
|
2015-07-12 21:11:11 +00:00
|
|
|
|
2019-02-15 03:06:22 +00:00
|
|
|
GtkCssNode * gtk_css_node_get_parent (GtkCssNode *cssnode) G_GNUC_PURE;
|
|
|
|
GtkCssNode * gtk_css_node_get_first_child (GtkCssNode *cssnode) G_GNUC_PURE;
|
|
|
|
GtkCssNode * gtk_css_node_get_last_child (GtkCssNode *cssnode) G_GNUC_PURE;
|
|
|
|
GtkCssNode * gtk_css_node_get_previous_sibling(GtkCssNode *cssnode) G_GNUC_PURE;
|
|
|
|
GtkCssNode * gtk_css_node_get_next_sibling (GtkCssNode *cssnode) G_GNUC_PURE;
|
2015-01-09 23:47:32 +00:00
|
|
|
|
2015-02-10 01:50:57 +00:00
|
|
|
void gtk_css_node_set_visible (GtkCssNode *cssnode,
|
|
|
|
gboolean visible);
|
2019-02-15 03:06:22 +00:00
|
|
|
gboolean gtk_css_node_get_visible (GtkCssNode *cssnode) G_GNUC_PURE;
|
2015-02-10 01:50:57 +00:00
|
|
|
|
2015-09-05 04:31:32 +00:00
|
|
|
void gtk_css_node_set_name (GtkCssNode *cssnode,
|
2020-01-23 23:43:26 +00:00
|
|
|
GQuark name);
|
|
|
|
GQuark gtk_css_node_get_name (GtkCssNode *cssnode) G_GNUC_PURE;
|
2015-01-25 01:40:40 +00:00
|
|
|
void gtk_css_node_set_id (GtkCssNode *cssnode,
|
2020-01-23 23:43:26 +00:00
|
|
|
GQuark id);
|
|
|
|
GQuark gtk_css_node_get_id (GtkCssNode *cssnode) G_GNUC_PURE;
|
2015-01-25 01:40:40 +00:00
|
|
|
void gtk_css_node_set_state (GtkCssNode *cssnode,
|
2015-01-10 21:35:38 +00:00
|
|
|
GtkStateFlags state_flags);
|
2019-02-15 03:06:22 +00:00
|
|
|
GtkStateFlags gtk_css_node_get_state (GtkCssNode *cssnode) G_GNUC_PURE;
|
2015-03-05 19:29:37 +00:00
|
|
|
void gtk_css_node_set_classes (GtkCssNode *cssnode,
|
|
|
|
const char **classes);
|
|
|
|
char ** gtk_css_node_get_classes (GtkCssNode *cssnode);
|
2015-01-25 01:40:40 +00:00
|
|
|
void gtk_css_node_add_class (GtkCssNode *cssnode,
|
2015-01-10 21:35:38 +00:00
|
|
|
GQuark style_class);
|
2015-01-25 01:40:40 +00:00
|
|
|
void gtk_css_node_remove_class (GtkCssNode *cssnode,
|
2015-01-10 21:35:38 +00:00
|
|
|
GQuark style_class);
|
|
|
|
gboolean gtk_css_node_has_class (GtkCssNode *cssnode,
|
2019-02-15 03:06:22 +00:00
|
|
|
GQuark style_class) G_GNUC_PURE;
|
2015-09-11 15:49:59 +00:00
|
|
|
const GQuark * gtk_css_node_list_classes (GtkCssNode *cssnode,
|
|
|
|
guint *n_classes);
|
2015-01-10 21:35:38 +00:00
|
|
|
|
|
|
|
const GtkCssNodeDeclaration *
|
2019-02-15 03:06:22 +00:00
|
|
|
gtk_css_node_get_declaration (GtkCssNode *cssnode) G_GNUC_PURE;
|
|
|
|
GtkCssStyle * gtk_css_node_get_style (GtkCssNode *cssnode) G_GNUC_PURE;
|
2015-02-23 02:06:02 +00:00
|
|
|
|
2015-01-09 23:47:32 +00:00
|
|
|
|
2015-02-17 15:11:38 +00:00
|
|
|
void gtk_css_node_invalidate_style_provider
|
|
|
|
(GtkCssNode *cssnode);
|
2015-02-18 23:54:14 +00:00
|
|
|
void gtk_css_node_invalidate_frame_clock
|
|
|
|
(GtkCssNode *cssnode,
|
|
|
|
gboolean just_timestamp);
|
2015-01-25 01:40:40 +00:00
|
|
|
void gtk_css_node_invalidate (GtkCssNode *cssnode,
|
|
|
|
GtkCssChange change);
|
2015-02-20 16:28:23 +00:00
|
|
|
void gtk_css_node_validate (GtkCssNode *cssnode);
|
2015-02-09 08:41:48 +00:00
|
|
|
|
2019-02-15 03:06:22 +00:00
|
|
|
GtkStyleProvider * gtk_css_node_get_style_provider (GtkCssNode *cssnode) G_GNUC_PURE;
|
2015-01-12 02:58:21 +00:00
|
|
|
|
2022-10-12 13:47:33 +00:00
|
|
|
typedef enum {
|
|
|
|
GTK_CSS_NODE_PRINT_NONE = 0,
|
|
|
|
GTK_CSS_NODE_PRINT_RECURSE = 1 << 0,
|
|
|
|
GTK_CSS_NODE_PRINT_SHOW_STYLE = 1 << 1,
|
|
|
|
GTK_CSS_NODE_PRINT_SHOW_CHANGE = 1 << 2
|
|
|
|
} GtkCssNodePrintFlags;
|
|
|
|
|
|
|
|
void gtk_css_node_print (GtkCssNode *cssnode,
|
|
|
|
GtkCssNodePrintFlags flags,
|
|
|
|
GString *string,
|
|
|
|
guint indent);
|
2015-12-28 06:09:54 +00:00
|
|
|
|
2022-10-07 19:51:02 +00:00
|
|
|
GListModel * gtk_css_node_observe_children (GtkCssNode *cssnode);
|
|
|
|
|
2015-01-09 23:47:32 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GTK_CSS_NODE_PRIVATE_H__ */
|