1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /*
3  * st-theme-node-private.h: private structures and functions for StThemeNode
4  *
5  * Copyright 2009, 2010 Red Hat, Inc.
6  * Copyright 2011 Quentin "Sardem FF7" Glidic
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as
10  * published by the Free Software Foundation, either version 2.1 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope it will be useful, but WITHOUT ANY
14  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef __ST_THEME_NODE_PRIVATE_H__
23 #define __ST_THEME_NODE_PRIVATE_H__
24 
25 #include <gdk/gdk.h>
26 
27 #include "st-theme-node.h"
28 #include "croco/libcroco.h"
29 #include "st-types.h"
30 
31 G_BEGIN_DECLS
32 
33 struct _StThemeNode {
34   GObject parent;
35 
36   StThemeContext *context;
37   StThemeNode *parent_node;
38   StTheme *theme;
39 
40   PangoFontDescription *font_desc;
41 
42   ClutterColor background_color;
43   /* If gradient is set, then background_color is the gradient start */
44   StGradientType background_gradient_type;
45   ClutterColor background_gradient_end;
46 
47   int background_position_x;
48   int background_position_y;
49 
50   StBackgroundSize background_size;
51   gint background_size_w;
52   gint background_size_h;
53 
54   ClutterColor foreground_color;
55   ClutterColor border_color[4];
56   ClutterColor outline_color;
57 
58   int border_width[4];
59   int border_radius[4];
60   int outline_width;
61   guint padding[4];
62   guint margin[4];
63 
64   int width;
65   int height;
66   int min_width;
67   int min_height;
68   int max_width;
69   int max_height;
70 
71   int transition_duration;
72 
73   GFile *background_image;
74   StBorderImage *border_image;
75   StShadow *box_shadow;
76   StShadow *background_image_shadow;
77   StShadow *text_shadow;
78   StIconColors *icon_colors;
79 
80   GType element_type;
81   char *element_id;
82   GStrv element_classes;
83   GStrv pseudo_classes;
84   char *inline_style;
85 
86   CRDeclaration **properties;
87   int n_properties;
88 
89   /* We hold onto these separately so we can destroy them on finalize */
90   CRDeclaration *inline_properties;
91 
92   guint background_position_set : 1;
93   guint background_repeat : 1;
94 
95   guint properties_computed : 1;
96   guint geometry_computed : 1;
97   guint background_computed : 1;
98   guint foreground_computed : 1;
99   guint border_image_computed : 1;
100   guint box_shadow_computed : 1;
101   guint background_image_shadow_computed : 1;
102   guint text_shadow_computed : 1;
103   guint link_type : 2;
104   guint rendered_once : 1;
105   guint cached_textures : 1;
106 
107   int box_shadow_min_width;
108   int box_shadow_min_height;
109 
110   guint stylesheets_changed_id;
111 
112   CoglPipeline *border_slices_texture;
113   CoglPipeline *border_slices_pipeline;
114   CoglPipeline *background_texture;
115   CoglPipeline *background_pipeline;
116   CoglPipeline *background_shadow_pipeline;
117   CoglPipeline *color_pipeline;
118 
119   StThemeNodePaintState cached_state;
120 
121   int cached_scale_factor;
122 };
123 
124 void _st_theme_node_ensure_background (StThemeNode *node);
125 void _st_theme_node_ensure_geometry (StThemeNode *node);
126 void _st_theme_node_apply_margins (StThemeNode *node,
127                                    ClutterActor *actor);
128 
129 G_END_DECLS
130 
131 #endif /* __ST_THEME_NODE_PRIVATE_H__ */
132