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
|
/* GTK+ Pixbuf Engine
* Copyright (C) 1998-2000 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Written by Owen Taylor <otaylor@redhat.com>, based on code by
* Carsten Haitzler <raster@rasterman.com>
*/
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
/* internals */
typedef struct _ThemeData ThemeData;
typedef struct _ThemeImage ThemeImage;
typedef struct _ThemeMatchData ThemeMatchData;
typedef struct _ThemePixbuf ThemePixbuf;
enum
{
TOKEN_IMAGE = G_TOKEN_LAST + 1,
TOKEN_FUNCTION,
TOKEN_FILE,
TOKEN_STRETCH,
TOKEN_RECOLORABLE,
TOKEN_BORDER,
TOK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H_EAST,
TOKEN_WEST,
TOKEN_EAST,
TOKEN_SOUTH_WEST,
TOKEN_SOUTH,
TOKEN_SOUTH_EAST
};
typedef enum
{
COMPONENT_NORTH_WEST = 1 << 0,
COMPONENT_NORTH = 1 << 1,
COMPONENT_NORTH_EAST = 1 << 2,
COMPONENT_WEST = 1 << 3,
COMPONENT_CENTER = 1 << 4,
COMPONENT_EAST = 1 << 5,
COMPONENT_SOUTH_EAST = 1 << 6,
COMPONENT_SOUTH = 1 << 7,
COMPONENT_SOUTH_WEST = 1 << 8,
COMPONENT_ALL = 1 << 9
} ThemePixbufComponent;
typedef enum {
THEME_MATCH_GAP_SIDE = 1 << 0,
THEME_MATCH_ORIENTATION = 1 << 1,
THEME_MATCH_STATE = 1 << 2,
THEME_MATCH_SHADOW = 1 << 3,
THEME_MATCH_ARROW_DIRECTION = 1 << 4,
THEME_MATCH_EXPANDER_STYLE = 1 << 5,
THEME_MATCH_WINDOW_EDGE = 1 << 6
} ThemeMatchFlags;
typedef enum {
THEME_CONSTANT_ROWS = 1 << 0,
THEME_CONSTANT_COLS = 1 << 1,
THEME_MISSING = 1 << 2
} ThemeRenderHints;
struct _ThemePixbuf
{
gchar *filename;
GdkPixbuf *pixbuf;
gboolean stretch;
gint border_left;
gint border_right;
gint border_bottom;
gint border_top;
guint hints[3][3];
};
struct _ThemeMatchData
{
guint function; /* Mandatory */
gchar *detail;
ThemeMatchFlags flags;
GtkPositionType gap_side;
GtkOrientation orientation;
GtkStateType state;
GtkShadowType shadow;
GtkArrowType arrow_direction;
GtkExpanderStyle expander_style;
GdkWindowEdge window_edge;
};
struct _ThemeImage
{
guint refcount;
ThemePixbuf *background;
ThemePixbuf *overlay;
ThemePixbuf *gap_start;
ThemePixbuf *gap;
ThemePixbuf *gap_end;
gchar recolorable;
ThemeMatchData match_data;
};
G_GNUC_INTERNAL ThemePixbuf *theme_pixbuf_new (void);
G_GNUC_INTERNAL void theme_pixbuf_destroy (ThemePixbuf *theme_pb);
G_GNUC_INTERNAL void theme_pixbuf_set_filename (ThemePixbuf *theme_pb,
const char *filename);
G_GNUC_INTERNAL GdkPixbuf * theme_pixbuf_get_pixbuf (ThemePixbuf *theme_pb);
G_GNUC_INTERNAL void theme_pixbuf_set_border (ThemePixbuf *theme_pb,
gint left,
gint right,
gint top,
gint bottom);
G_GNUC_INTERNAL void theme_pixbuf_set_stretch (ThemePixbuf *theme_pb,
gboolean stretch);
G_GNUC_INTERNAL void theme_pixbuf_render (ThemePixbuf *theme_pb,
cairo_t *cr,
guint component_mask,
gboolean center,
gint dest_x,
gint dest_y,
gint dest_width,
gint dest_height);
extern GtkStyleClass pixmap_default_class;
|