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__
|
|
|
|
|
|
|
|
#include "gtkcssnodedeclarationprivate.h"
|
2015-02-09 08:41:48 +00:00
|
|
|
#include "gtkbitmaskprivate.h"
|
|
|
|
#include "gtkcsstypesprivate.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))
|
|
|
|
|
|
|
|
typedef struct _GtkCssNodeClass GtkCssNodeClass;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2015-01-10 22:49:04 +00:00
|
|
|
GtkCssNodeDeclaration *decl;
|
|
|
|
GtkCssStyle *style;
|
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,
|
|
|
|
GtkCssStyle *old_style,
|
|
|
|
GtkCssStyle *new_style);
|
2015-03-01 20:33:54 +00:00
|
|
|
|
2015-02-09 08:41:48 +00:00
|
|
|
gboolean (* init_matcher) (GtkCssNode *cssnode,
|
2015-02-09 16:26:07 +00:00
|
|
|
GtkCssMatcher *matcher);
|
2015-01-12 02:58:21 +00:00
|
|
|
GtkWidgetPath * (* create_widget_path) (GtkCssNode *cssnode);
|
|
|
|
const GtkWidgetPath * (* get_widget_path) (GtkCssNode *cssnode);
|
2015-02-17 14:18:32 +00:00
|
|
|
/* get style provider to use or NULL to use parent's */
|
2015-01-31 15:30:05 +00:00
|
|
|
GtkStyleProviderPrivate *(* 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,
|
|
|
|
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
|
|
|
void gtk_css_node_reverse_children (GtkCssNode *cssnode);
|
|
|
|
|
2015-01-09 23:47:32 +00:00
|
|
|
GtkCssNode * gtk_css_node_get_parent (GtkCssNode *cssnode);
|
2015-01-26 01:18:06 +00:00
|
|
|
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);
|
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);
|
|
|
|
gboolean gtk_css_node_get_visible (GtkCssNode *cssnode);
|
|
|
|
|
2015-09-05 04:31:32 +00:00
|
|
|
void gtk_css_node_set_name (GtkCssNode *cssnode,
|
|
|
|
/*interned*/const char*name);
|
|
|
|
/*interned*/const char *gtk_css_node_get_name (GtkCssNode *cssnode);
|
2015-01-10 21:35:38 +00:00
|
|
|
void gtk_css_node_set_widget_type (GtkCssNode *cssnode,
|
|
|
|
GType widget_type);
|
|
|
|
GType gtk_css_node_get_widget_type (GtkCssNode *cssnode);
|
2015-01-25 01:40:40 +00:00
|
|
|
void gtk_css_node_set_id (GtkCssNode *cssnode,
|
2015-10-27 03:35:22 +00:00
|
|
|
/*interned*/const char*id);
|
|
|
|
/*interned*/const char *gtk_css_node_get_id (GtkCssNode *cssnode);
|
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);
|
|
|
|
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);
|
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,
|
|
|
|
GQuark style_class);
|
2015-09-11 15:49:59 +00:00
|
|
|
const GQuark * gtk_css_node_list_classes (GtkCssNode *cssnode,
|
|
|
|
guint *n_classes);
|
2015-01-25 01:40:40 +00:00
|
|
|
void gtk_css_node_add_region (GtkCssNode *cssnode,
|
2015-01-10 21:35:38 +00:00
|
|
|
GQuark region,
|
|
|
|
GtkRegionFlags flags);
|
2015-01-25 01:40:40 +00:00
|
|
|
void gtk_css_node_remove_region (GtkCssNode *cssnode,
|
2015-01-10 21:35:38 +00:00
|
|
|
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);
|
2015-01-09 23:47:32 +00:00
|
|
|
GtkCssStyle * gtk_css_node_get_style (GtkCssNode *cssnode);
|
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
|
|
|
|
|
|
|
gboolean gtk_css_node_init_matcher (GtkCssNode *cssnode,
|
2015-02-09 16:26:07 +00:00
|
|
|
GtkCssMatcher *matcher);
|
2015-01-12 02:58:21 +00:00
|
|
|
GtkWidgetPath * gtk_css_node_create_widget_path (GtkCssNode *cssnode);
|
|
|
|
const GtkWidgetPath * gtk_css_node_get_widget_path (GtkCssNode *cssnode);
|
2015-01-31 15:30:05 +00:00
|
|
|
GtkStyleProviderPrivate *gtk_css_node_get_style_provider(GtkCssNode *cssnode);
|
2015-01-12 02:58:21 +00:00
|
|
|
|
2015-01-09 23:47:32 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GTK_CSS_NODE_PRIVATE_H__ */
|