1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
|
/*
* Copyright (C) 2001 Havoc Pennington
* Copyright (C) 2016 Alberts Muktupāvels
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef META_DRAW_OP_PRIVATE_H
#define META_DRAW_OP_PRIVATE_H
#include <gtk/gtk.h>
#include "meta-color-spec-private.h"
#include "meta-draw-spec-private.h"
#include "meta-frame-borders.h"
#include "meta-gradient-spec-private.h"
G_BEGIN_DECLS
typedef struct _MetaDrawInfo MetaDrawInfo;
typedef struct _MetaDrawOp MetaDrawOp;
typedef struct _MetaDrawOpList MetaDrawOpList;
/**
* A drawing operation in our simple vector drawing language.
*/
typedef enum
{
/** Basic drawing-- line */
META_DRAW_LINE,
/** Basic drawing-- rectangle */
META_DRAW_RECTANGLE,
/** Basic drawing-- arc */
META_DRAW_ARC,
/** Clip to a rectangle */
META_DRAW_CLIP,
/* Texture thingies */
/** Just a filled rectangle with alpha */
META_DRAW_TINT,
META_DRAW_GRADIENT,
META_DRAW_IMAGE,
/** GTK theme engine stuff */
META_DRAW_GTK_ARROW,
META_DRAW_GTK_BOX,
META_DRAW_GTK_VLINE,
/** App's window icon */
META_DRAW_ICON,
/** App's window title */
META_DRAW_TITLE,
/** a draw op list */
META_DRAW_OP_LIST,
/** tiled draw op list */
META_DRAW_TILE
} MetaDrawType;
typedef enum
{
META_IMAGE_FILL_SCALE, /* default, needs to be all-bits-zero for g_new0 */
META_IMAGE_FILL_TILE
} MetaImageFillType;
struct _MetaDrawInfo
{
GdkPixbuf *mini_icon;
GdkPixbuf *icon;
PangoLayout *title_layout;
int title_layout_width;
int title_layout_height;
gint left_width;
gint right_width;
gint top_height;
gint bottom_height;
gint width;
gint height;
};
/**
* A single drawing operation in our simple vector drawing language.
*/
struct _MetaDrawOp
{
MetaDrawType type;
/* Positions are strings because they can be expressions */
union
{
struct {
MetaColorSpec *color_spec;
int dash_on_length;
int dash_off_length;
int width;
MetaDrawSpec *x1;
MetaDrawSpec *y1;
MetaDrawSpec *x2;
MetaDrawSpec *y2;
} line;
struct {
MetaColorSpec *color_spec;
gboolean filled;
MetaDrawSpec *x;
MetaDrawSpec *y;
MetaDrawSpec *width;
MetaDrawSpec *height;
} rectangle;
struct {
MetaColorSpec *color_spec;
gboolean filled;
MetaDrawSpec *x;
MetaDrawSpec *y;
MetaDrawSpec *width;
MetaDrawSpec *height;
double start_angle;
double extent_angle;
} arc;
struct {
MetaDrawSpec *x;
MetaDrawSpec *y;
MetaDrawSpec *width;
MetaDrawSpec *height;
} clip;
struct {
MetaColorSpec *color_spec;
MetaAlphaGradientSpec *alpha_spec;
MetaDrawSpec *x;
MetaDrawSpec *y;
MetaDrawSpec *width;
MetaDrawSpec *height;
} tint;
struct {
MetaGradientSpec *gradient_spec;
MetaAlphaGradientSpec *alpha_spec;
MetaDrawSpec *x;
MetaDrawSpec *y;
MetaDrawSpec *width;
MetaDrawSpec *height;
} gradient;
struct {
MetaColorSpec *colorize_spec;
MetaAlphaGradientSpec *alpha_spec;
GdkPixbuf *pixbuf;
MetaDrawSpec *x;
MetaDrawSpec *y;
MetaDrawSpec *width;
MetaDrawSpec *height;
guint32 colorize_cache_pixel;
GdkPixbuf *colorize_cache_pixbuf;
MetaImageFillType fill_type;
unsigned int vertical_stripes : 1;
unsigned int horizontal_stripes : 1;
} image;
struct {
GtkStateFlags state;
GtkShadowType shadow;
GtkArrowType arrow;
gboolean filled;
MetaDrawSpec *x;
MetaDrawSpec *y;
MetaDrawSpec *width;
MetaDrawSpec *height;
} gtk_arrow;
struct {
GtkStateFlags state;
GtkShadowType shadow;
MetaDrawSpec *x;
MetaDrawSpec *y;
MetaDrawSpec *width;
MetaDrawSpec *height;
} gtk_box;
struct {
GtkStateFlags state;
MetaDrawSpec *x;
MetaDrawSpec *y1;
MetaDrawSpec *y2;
} gtk_vline;
struct {
MetaAlphaGradientSpec *alpha_spec;
MetaDrawSpec *x;
MetaDrawSpec *y;
MetaDrawSpec *width;
MetaDrawSpec *height;
MetaImageFillType fill_type;
} icon;
struct {
MetaColorSpec *color_spec;
MetaDrawSpec *x;
MetaDrawSpec *y;
MetaDrawSpec *ellipsize_width;
} title;
struct {
MetaDrawOpList *op_list;
MetaDrawSpec *x;
MetaDrawSpec *y;
MetaDrawSpec *width;
MetaDrawSpec *height;
} op_list;
struct {
MetaDrawOpList *op_list;
MetaDrawSpec *x;
MetaDrawSpec *y;
MetaDrawSpec *width;
MetaDrawSpec *height;
MetaDrawSpec *tile_xoffset;
MetaDrawSpec *tile_yoffset;
MetaDrawSpec *tile_width;
MetaDrawSpec *tile_height;
} tile;
} data;
};
G_GNUC_INTERNAL
MetaDrawOp *meta_draw_op_new (MetaDrawType type);
G_GNUC_INTERNAL
void meta_draw_op_free (MetaDrawOp *op);
G_GNUC_INTERNAL
MetaDrawOpList *meta_draw_op_list_new (int n_preallocs);
G_GNUC_INTERNAL
void meta_draw_op_list_ref (MetaDrawOpList *op_list);
G_GNUC_INTERNAL
void meta_draw_op_list_unref (MetaDrawOpList *op_list);
G_GNUC_INTERNAL
void meta_draw_op_list_draw_with_style (const MetaDrawOpList *op_list,
GtkStyleContext *context,
cairo_t *cr,
const MetaDrawInfo *info,
GdkRectangle rect);
G_GNUC_INTERNAL
void meta_draw_op_list_append (MetaDrawOpList *op_list,
MetaDrawOp *op);
G_GNUC_INTERNAL
gboolean meta_draw_op_list_validate (MetaDrawOpList *op_list,
GError **error);
G_GNUC_INTERNAL
gboolean meta_draw_op_list_contains (MetaDrawOpList *op_list,
MetaDrawOpList *child);
G_END_DECLS
#endif
|