1/* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23 */
24
25#ifndef __GTK_RC_H__
26#define __GTK_RC_H__
27
28#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
29#error "Only <gtk/gtk.h> can be included directly."
30#endif
31
32#include <gtk/gtkwidget.h>
33#include <gtk/gtkbindings.h>
34
35G_BEGIN_DECLS
36
37/* Forward declarations */
38typedef struct _GtkRcContext GtkRcContext;
39typedef struct _GtkRcStyleClass GtkRcStyleClass;
40
41#define GTK_TYPE_RC_STYLE (gtk_rc_style_get_type ())
42#define GTK_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_RC_STYLE, GtkRcStyle))
43#define GTK_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RC_STYLE, GtkRcStyleClass))
44#define GTK_IS_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_RC_STYLE))
45#define GTK_IS_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RC_STYLE))
46#define GTK_RC_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RC_STYLE, GtkRcStyleClass))
47
48/**
49 * GtkRcFlags:
50 * @GTK_RC_FG :Deprecated
51 * @GTK_RC_BG: Deprecated
52 * @GTK_RC_TEXT: Deprecated
53 * @GTK_RC_BASE: Deprecated
54 *
55 * Deprecated
56 */
57typedef enum
58{
59 GTK_RC_FG = 1 << 0,
60 GTK_RC_BG = 1 << 1,
61 GTK_RC_TEXT = 1 << 2,
62 GTK_RC_BASE = 1 << 3
63} GtkRcFlags;
64
65/**
66 * GtkRcStyle:
67 * @name: Name
68 * @bg_pixmap_name: Pixmap name
69 * @font_desc: A #PangoFontDescription
70 * @color_flags: #GtkRcFlags
71 * @fg: Foreground colors
72 * @bg: Background colors
73 * @text: Text colors
74 * @base: Base colors
75 * @xthickness: X thickness
76 * @ythickness: Y thickness
77 *
78 * The #GtkRcStyle-struct is used to represent a set
79 * of information about the appearance of a widget.
80 * This can later be composited together with other
81 * #GtkRcStyle-struct<!-- -->s to form a #GtkStyle.
82 */
83struct _GtkRcStyle
84{
85 GObject parent_instance;
86
87 /*< public >*/
88
89 gchar *name;
90 gchar *bg_pixmap_name[5];
91 PangoFontDescription *font_desc;
92
93 GtkRcFlags color_flags[5];
94 GdkColor fg[5];
95 GdkColor bg[5];
96 GdkColor text[5];
97 GdkColor base[5];
98
99 gint xthickness;
100 gint ythickness;
101
102 /*< private >*/
103 GArray *rc_properties;
104
105 /* list of RC style lists including this RC style */
106 GSList *rc_style_lists;
107
108 GSList *icon_factories;
109
110 guint engine_specified : 1; /* The RC file specified the engine */
111};
112
113/**
114 * GtkRcStyleClass:
115 * @parent_class: The parent class.
116 * @create_rc_style:
117 * @parse:
118 * @merge:
119 * @create_style:
120 */
121struct _GtkRcStyleClass
122{
123 GObjectClass parent_class;
124
125 /*< public >*/
126
127 /* Create an empty RC style of the same type as this RC style.
128 * The default implementation, which does
129 * g_object_new (G_OBJECT_TYPE (style), NULL);
130 * should work in most cases.
131 */
132 GtkRcStyle * (*create_rc_style) (GtkRcStyle *rc_style);
133
134 /* Fill in engine specific parts of GtkRcStyle by parsing contents
135 * of brackets. Returns G_TOKEN_NONE if successful, otherwise returns
136 * the token it expected but didn't get.
137 */
138 guint (*parse) (GtkRcStyle *rc_style,
139 GtkSettings *settings,
140 GScanner *scanner);
141
142 /* Combine RC style data from src into dest. If overridden, this
143 * function should chain to the parent.
144 */
145 void (*merge) (GtkRcStyle *dest,
146 GtkRcStyle *src);
147
148 /* Create an empty style suitable to this RC style
149 */
150 GtkStyle * (*create_style) (GtkRcStyle *rc_style);
151
152 /*< private >*/
153
154 /* Padding for future expansion */
155 void (*_gtk_reserved1) (void);
156 void (*_gtk_reserved2) (void);
157 void (*_gtk_reserved3) (void);
158 void (*_gtk_reserved4) (void);
159};
160
161GSList* _gtk_rc_parse_widget_class_path (const gchar *pattern);
162void _gtk_rc_free_widget_class_path (GSList *list);
163gboolean _gtk_rc_match_widget_class (GSList *list,
164 gint length,
165 gchar *path,
166 gchar *path_reversed);
167
168GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
169void gtk_rc_add_default_file (const gchar *filename);
170GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
171void gtk_rc_set_default_files (gchar **filenames);
172GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
173gchar** gtk_rc_get_default_files (void);
174GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
175GtkStyle* gtk_rc_get_style (GtkWidget *widget);
176GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
177GtkStyle* gtk_rc_get_style_by_paths (GtkSettings *settings,
178 const char *widget_path,
179 const char *class_path,
180 GType type);
181
182GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
183gboolean gtk_rc_reparse_all_for_settings (GtkSettings *settings,
184 gboolean force_load);
185GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
186void gtk_rc_reset_styles (GtkSettings *settings);
187
188GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
189gchar* gtk_rc_find_pixmap_in_path (GtkSettings *settings,
190 GScanner *scanner,
191 const gchar *pixmap_file);
192
193GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
194void gtk_rc_parse (const gchar *filename);
195GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
196void gtk_rc_parse_string (const gchar *rc_string);
197GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
198gboolean gtk_rc_reparse_all (void);
199
200GDK_DEPRECATED_IN_3_0
201GType gtk_rc_style_get_type (void) G_GNUC_CONST;
202GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
203GtkRcStyle* gtk_rc_style_new (void);
204GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
205GtkRcStyle* gtk_rc_style_copy (GtkRcStyle *orig);
206
207GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
208gchar* gtk_rc_find_module_in_path (const gchar *module_file);
209GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
210gchar* gtk_rc_get_theme_dir (void);
211GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
212gchar* gtk_rc_get_module_dir (void);
213GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
214gchar* gtk_rc_get_im_module_path (void);
215GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
216gchar* gtk_rc_get_im_module_file (void);
217
218/* private functions/definitions */
219
220/**
221 * GtkRcTokenType:
222 * @GTK_RC_TOKEN_INVALID: Deprecated
223 * @GTK_RC_TOKEN_INCLUDE: Deprecated
224 * @GTK_RC_TOKEN_NORMAL: Deprecated
225 * @GTK_RC_TOKEN_ACTIVE: Deprecated
226 * @GTK_RC_TOKEN_PRELIGHT: Deprecated
227 * @GTK_RC_TOKEN_SELECTED: Deprecated
228 * @GTK_RC_TOKEN_INSENSITIVE: Deprecated
229 * @GTK_RC_TOKEN_FG: Deprecated
230 * @GTK_RC_TOKEN_BG: Deprecated
231 * @GTK_RC_TOKEN_TEXT: Deprecated
232 * @GTK_RC_TOKEN_BASE: Deprecated
233 * @GTK_RC_TOKEN_XTHICKNESS: Deprecated
234 * @GTK_RC_TOKEN_YTHICKNESS: Deprecated
235 * @GTK_RC_TOKEN_FONT: Deprecated
236 * @GTK_RC_TOKEN_FONTSET: Deprecated
237 * @GTK_RC_TOKEN_FONT_NAME: Deprecated
238 * @GTK_RC_TOKEN_BG_PIXMAP: Deprecated
239 * @GTK_RC_TOKEN_PIXMAP_PATH: Deprecated
240 * @GTK_RC_TOKEN_STYLE: Deprecated
241 * @GTK_RC_TOKEN_BINDING: Deprecated
242 * @GTK_RC_TOKEN_BIND: Deprecated
243 * @GTK_RC_TOKEN_WIDGET: Deprecated
244 * @GTK_RC_TOKEN_WIDGET_CLASS: Deprecated
245 * @GTK_RC_TOKEN_CLASS: Deprecated
246 * @GTK_RC_TOKEN_LOWEST: Deprecated
247 * @GTK_RC_TOKEN_GTK: Deprecated
248 * @GTK_RC_TOKEN_APPLICATION: Deprecated
249 * @GTK_RC_TOKEN_THEME: Deprecated
250 * @GTK_RC_TOKEN_RC: Deprecated
251 * @GTK_RC_TOKEN_HIGHEST: Deprecated
252 * @GTK_RC_TOKEN_ENGINE: Deprecated
253 * @GTK_RC_TOKEN_MODULE_PATH: Deprecated
254 * @GTK_RC_TOKEN_IM_MODULE_PATH: Deprecated
255 * @GTK_RC_TOKEN_IM_MODULE_FILE: Deprecated
256 * @GTK_RC_TOKEN_STOCK: Deprecated
257 * @GTK_RC_TOKEN_LTR: Deprecated
258 * @GTK_RC_TOKEN_RTL: Deprecated
259 * @GTK_RC_TOKEN_COLOR: Deprecated
260 * @GTK_RC_TOKEN_UNBIND: Deprecated
261 * @GTK_RC_TOKEN_LAST: Deprecated
262 *
263 * The #GtkRcTokenType enumeration represents the tokens
264 * in the RC file. It is exposed so that theme engines
265 * can reuse these tokens when parsing the theme-engine
266 * specific portions of a RC file.
267 *
268 * Deprecated: 3.0: Use #GtkCssProvider instead.
269 */
270typedef enum {
271 GTK_RC_TOKEN_INVALID = G_TOKEN_LAST,
272 GTK_RC_TOKEN_INCLUDE,
273 GTK_RC_TOKEN_NORMAL,
274 GTK_RC_TOKEN_ACTIVE,
275 GTK_RC_TOKEN_PRELIGHT,
276 GTK_RC_TOKEN_SELECTED,
277 GTK_RC_TOKEN_INSENSITIVE,
278 GTK_RC_TOKEN_FG,
279 GTK_RC_TOKEN_BG,
280 GTK_RC_TOKEN_TEXT,
281 GTK_RC_TOKEN_BASE,
282 GTK_RC_TOKEN_XTHICKNESS,
283 GTK_RC_TOKEN_YTHICKNESS,
284 GTK_RC_TOKEN_FONT,
285 GTK_RC_TOKEN_FONTSET,
286 GTK_RC_TOKEN_FONT_NAME,
287 GTK_RC_TOKEN_BG_PIXMAP,
288 GTK_RC_TOKEN_PIXMAP_PATH,
289 GTK_RC_TOKEN_STYLE,
290 GTK_RC_TOKEN_BINDING,
291 GTK_RC_TOKEN_BIND,
292 GTK_RC_TOKEN_WIDGET,
293 GTK_RC_TOKEN_WIDGET_CLASS,
294 GTK_RC_TOKEN_CLASS,
295 GTK_RC_TOKEN_LOWEST,
296 GTK_RC_TOKEN_GTK,
297 GTK_RC_TOKEN_APPLICATION,
298 GTK_RC_TOKEN_THEME,
299 GTK_RC_TOKEN_RC,
300 GTK_RC_TOKEN_HIGHEST,
301 GTK_RC_TOKEN_ENGINE,
302 GTK_RC_TOKEN_MODULE_PATH,
303 GTK_RC_TOKEN_IM_MODULE_PATH,
304 GTK_RC_TOKEN_IM_MODULE_FILE,
305 GTK_RC_TOKEN_STOCK,
306 GTK_RC_TOKEN_LTR,
307 GTK_RC_TOKEN_RTL,
308 GTK_RC_TOKEN_COLOR,
309 GTK_RC_TOKEN_UNBIND,
310 GTK_RC_TOKEN_LAST
311} GtkRcTokenType;
312
313
314/**
315 * GtkPathPriorityType:
316 * @GTK_PATH_PRIO_LOWEST: Deprecated
317 * @GTK_PATH_PRIO_GTK: Deprecated
318 * @GTK_PATH_PRIO_APPLICATION: Deprecated
319 * @GTK_PATH_PRIO_THEME: Deprecated
320 * @GTK_PATH_PRIO_RC: Deprecated
321 * @GTK_PATH_PRIO_HIGHEST: Deprecated
322 *
323 * Priorities for path lookups.
324 * See also gtk_binding_set_add_path().
325 *
326 * Deprecated: 3.0
327 */
328typedef enum
329{
330 GTK_PATH_PRIO_LOWEST = 0,
331 GTK_PATH_PRIO_GTK = 4,
332 GTK_PATH_PRIO_APPLICATION = 8,
333 GTK_PATH_PRIO_THEME = 10,
334 GTK_PATH_PRIO_RC = 12,
335 GTK_PATH_PRIO_HIGHEST = 15
336} GtkPathPriorityType;
337#define GTK_PATH_PRIO_MASK 0x0f
338
339/**
340 * GtkPathType:
341 * @GTK_PATH_WIDGET: Deprecated
342 * @GTK_PATH_WIDGET_CLASS: Deprecated
343 * @GTK_PATH_CLASS: Deprecated
344 *
345 * Widget path types.
346 * See also gtk_binding_set_add_path().
347 *
348 * Deprecated: 3.0
349 */
350typedef enum
351{
352 GTK_PATH_WIDGET,
353 GTK_PATH_WIDGET_CLASS,
354 GTK_PATH_CLASS
355} GtkPathType;
356
357GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
358GScanner* gtk_rc_scanner_new (void);
359GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
360guint gtk_rc_parse_color (GScanner *scanner,
361 GdkColor *color);
362GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
363guint gtk_rc_parse_color_full (GScanner *scanner,
364 GtkRcStyle *style,
365 GdkColor *color);
366GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
367guint gtk_rc_parse_state (GScanner *scanner,
368 GtkStateType *state);
369GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
370guint gtk_rc_parse_priority (GScanner *scanner,
371 GtkPathPriorityType *priority);
372
373/* rc properties
374 * (structure forward declared in gtkstyle.h)
375 */
376/**
377 * GtkRcProperty:
378 * @type_name: quark-ified type identifier
379 * @property_name: quark-ified property identifier like
380 * “GtkScrollbar::spacing”
381 * @origin: field similar to one found in #GtkSettingsValue
382 * @value:field similar to one found in #GtkSettingsValue
383 *
384 * Deprecated
385 */
386struct _GtkRcProperty
387{
388 /* quark-ified property identifier like “GtkScrollbar::spacing” */
389 GQuark type_name;
390 GQuark property_name;
391
392 /* fields similar to GtkSettingsValue */
393 gchar *origin;
394 GValue value;
395};
396
397GDK_DEPRECATED_IN_3_0
398void gtk_binding_set_add_path (GtkBindingSet *binding_set,
399 GtkPathType path_type,
400 const gchar *path_pattern,
401 GtkPathPriorityType priority);
402
403G_END_DECLS
404
405#endif /* __GTK_RC_H__ */
406