gtkrc.h 12.4 KB
Newer Older
Cody Russell's avatar
Cody Russell committed
1
/* GTK - The GIMP Toolkit
Elliot Lee's avatar
Elliot Lee committed
2
3
4
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 *
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Lesser General Public
Elliot Lee's avatar
Elliot Lee committed
6
7
8
9
10
 * 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
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Lesser General Public License for more details.
Elliot Lee's avatar
Elliot Lee committed
13
 *
14
 * You should have received a copy of the GNU Lesser General Public
Javier Jardón's avatar
Javier Jardón committed
15
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
Elliot Lee's avatar
Elliot Lee committed
16
 */
17
18

/*
19
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
20
21
 * file for a list of people on the GTK+ Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
22
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23
24
 */

25
26
27
#ifndef __GTK_RC_H__
#define __GTK_RC_H__

28
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
29
30
31
#error "Only <gtk/gtk.h> can be included directly."
#endif

32
#include <gtk/gtkwidget.h>
Matthias Clasen's avatar
Matthias Clasen committed
33
#include <gtk/gtkbindings.h>
Elliot Lee's avatar
Elliot Lee committed
34

35
G_BEGIN_DECLS
Elliot Lee's avatar
Elliot Lee committed
36

37
38
/* Forward declarations */
typedef struct _GtkRcContext    GtkRcContext;
39
40
typedef struct _GtkRcStyleClass GtkRcStyleClass;

41
42
43
44
45
46
#define GTK_TYPE_RC_STYLE              (gtk_rc_style_get_type ())
#define GTK_RC_STYLE(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_RC_STYLE, GtkRcStyle))
#define GTK_RC_STYLE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RC_STYLE, GtkRcStyleClass))
#define GTK_IS_RC_STYLE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_RC_STYLE))
#define GTK_IS_RC_STYLE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RC_STYLE))
#define GTK_RC_STYLE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RC_STYLE, GtkRcStyleClass))
47

48
49
50
51
52
53
54
55
56
/**
 * GtkRcFlags:
 * @GTK_RC_FG :Deprecated
 * @GTK_RC_BG: Deprecated
 * @GTK_RC_TEXT: Deprecated
 * @GTK_RC_BASE: Deprecated
 *
 * Deprecated
 */
57
58
typedef enum
{
59
60
61
62
  GTK_RC_FG             = 1 << 0,
  GTK_RC_BG             = 1 << 1,
  GTK_RC_TEXT           = 1 << 2,
  GTK_RC_BASE           = 1 << 3
63
64
} GtkRcFlags;

65
66
/**
 * GtkRcStyle:
67
68
69
70
71
72
73
74
75
76
 * @name: Name
 * @bg_pixmap_name: Pixmap name
 * @font_desc: A #PangoFontDescription
 * @color_flags: #GtkRcFlags
 * @fg: Foreground colors
 * @bg: Background colors
 * @text: Text colors
 * @base: Base colors
 * @xthickness: X thickness
 * @ythickness: Y thickness
77
 *
78
 * The #GtkRcStyle-struct is used to represent a set
79
80
 * of information about the appearance of a widget.
 * This can later be composited together with other
81
 * #GtkRcStyle-struct<!-- -->s to form a #GtkStyle.
82
 */
83
84
struct _GtkRcStyle
{
85
86
87
  GObject parent_instance;

  /*< public >*/
88

89
90
  gchar *name;
  gchar *bg_pixmap_name[5];
91
  PangoFontDescription *font_desc;
92
93
94
95
96
97
98

  GtkRcFlags color_flags[5];
  GdkColor   fg[5];
  GdkColor   bg[5];
  GdkColor   text[5];
  GdkColor   base[5];

99
100
  gint xthickness;
  gint ythickness;
101

102
  /*< private >*/
103
  GArray *rc_properties;
104

105
106
  /* list of RC style lists including this RC style */
  GSList *rc_style_lists;
107
108

  GSList *icon_factories;
109

110
  guint engine_specified : 1;   /* The RC file specified the engine */
111
112
};

William Jon McCann's avatar
William Jon McCann committed
113
114
115
116
117
118
119
120
/**
 * GtkRcStyleClass:
 * @parent_class: The parent class.
 * @create_rc_style: 
 * @parse: 
 * @merge: 
 * @create_style: 
 */
121
122
123
124
struct _GtkRcStyleClass
{
  GObjectClass parent_class;

William Jon McCann's avatar
William Jon McCann committed
125
126
  /*< public >*/

127
128
129
130
131
  /* Create an empty RC style of the same type as this RC style.
   * The default implementation, which does
   * g_object_new (G_OBJECT_TYPE (style), NULL);
   * should work in most cases.
   */
132
  GtkRcStyle * (*create_rc_style) (GtkRcStyle *rc_style);
133
134

  /* Fill in engine specific parts of GtkRcStyle by parsing contents
Kristian Rietveld's avatar
Kristian Rietveld committed
135
   * of brackets. Returns G_TOKEN_NONE if successful, otherwise returns
136
137
   * the token it expected but didn't get.
   */
138
  guint     (*parse)  (GtkRcStyle   *rc_style,
139
140
                       GtkSettings  *settings,
                       GScanner     *scanner);
141

142
  /* Combine RC style data from src into dest. If overridden, this
143
144
   * function should chain to the parent.
   */
145
  void      (*merge)  (GtkRcStyle *dest,
146
                       GtkRcStyle *src);
147
148
149

  /* Create an empty style suitable to this RC style
   */
150
  GtkStyle * (*create_style) (GtkRcStyle *rc_style);
151

William Jon McCann's avatar
William Jon McCann committed
152
153
  /*< private >*/

154
155
156
157
158
  /* Padding for future expansion */
  void (*_gtk_reserved1) (void);
  void (*_gtk_reserved2) (void);
  void (*_gtk_reserved3) (void);
  void (*_gtk_reserved4) (void);
159
};
Elliot Lee's avatar
Elliot Lee committed
160

161
162
163
164
165
166
167
GSList*   _gtk_rc_parse_widget_class_path (const gchar *pattern);
void      _gtk_rc_free_widget_class_path (GSList       *list);
gboolean  _gtk_rc_match_widget_class     (GSList       *list,
                                          gint          length,
                                          gchar        *path,
                                          gchar        *path_reversed);

168
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
169
void      gtk_rc_add_default_file       (const gchar *filename);
170
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
171
void      gtk_rc_set_default_files      (gchar **filenames);
172
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
173
gchar**   gtk_rc_get_default_files      (void);
174
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
175
GtkStyle* gtk_rc_get_style              (GtkWidget   *widget);
176
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
177
GtkStyle* gtk_rc_get_style_by_paths     (GtkSettings *settings,
178
179
180
                                         const char  *widget_path,
                                         const char  *class_path,
                                         GType        type);
181

182
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
183
gboolean gtk_rc_reparse_all_for_settings (GtkSettings *settings,
184
                                          gboolean     force_load);
185
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
186
187
void     gtk_rc_reset_styles             (GtkSettings *settings);

188
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
Owen Taylor's avatar
Owen Taylor committed
189
gchar*   gtk_rc_find_pixmap_in_path (GtkSettings  *settings,
190
191
                                     GScanner     *scanner,
                                     const gchar  *pixmap_file);
192

193
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
194
void     gtk_rc_parse                   (const gchar *filename);
195
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
196
void      gtk_rc_parse_string           (const gchar *rc_string);
197
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
198
gboolean  gtk_rc_reparse_all            (void);
199

200
GDK_DEPRECATED_IN_3_0
Elliot Lee's avatar
Elliot Lee committed
201
GType       gtk_rc_style_get_type   (void) G_GNUC_CONST;
202
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
203
GtkRcStyle* gtk_rc_style_new        (void);
204
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
205
GtkRcStyle* gtk_rc_style_copy       (GtkRcStyle *orig);
206

207
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
208
gchar*      gtk_rc_find_module_in_path (const gchar *module_file);
209
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
210
gchar*      gtk_rc_get_theme_dir       (void);
211
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
212
gchar*      gtk_rc_get_module_dir      (void);
213
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
214
gchar*      gtk_rc_get_im_module_path  (void);
215
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
216
gchar*      gtk_rc_get_im_module_file  (void);
Elliot Lee's avatar
Elliot Lee committed
217

218
/* private functions/definitions */
219
220
221

/**
 * GtkRcTokenType:
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
 * @GTK_RC_TOKEN_INVALID: Deprecated
 * @GTK_RC_TOKEN_INCLUDE: Deprecated
 * @GTK_RC_TOKEN_NORMAL: Deprecated
 * @GTK_RC_TOKEN_ACTIVE: Deprecated
 * @GTK_RC_TOKEN_PRELIGHT: Deprecated
 * @GTK_RC_TOKEN_SELECTED: Deprecated
 * @GTK_RC_TOKEN_INSENSITIVE: Deprecated
 * @GTK_RC_TOKEN_FG: Deprecated
 * @GTK_RC_TOKEN_BG: Deprecated
 * @GTK_RC_TOKEN_TEXT: Deprecated
 * @GTK_RC_TOKEN_BASE: Deprecated
 * @GTK_RC_TOKEN_XTHICKNESS: Deprecated
 * @GTK_RC_TOKEN_YTHICKNESS: Deprecated
 * @GTK_RC_TOKEN_FONT: Deprecated
 * @GTK_RC_TOKEN_FONTSET: Deprecated
 * @GTK_RC_TOKEN_FONT_NAME: Deprecated
 * @GTK_RC_TOKEN_BG_PIXMAP: Deprecated
 * @GTK_RC_TOKEN_PIXMAP_PATH: Deprecated
 * @GTK_RC_TOKEN_STYLE: Deprecated
 * @GTK_RC_TOKEN_BINDING: Deprecated
 * @GTK_RC_TOKEN_BIND: Deprecated
 * @GTK_RC_TOKEN_WIDGET: Deprecated
 * @GTK_RC_TOKEN_WIDGET_CLASS: Deprecated
 * @GTK_RC_TOKEN_CLASS: Deprecated
 * @GTK_RC_TOKEN_LOWEST: Deprecated
 * @GTK_RC_TOKEN_GTK: Deprecated
 * @GTK_RC_TOKEN_APPLICATION: Deprecated
 * @GTK_RC_TOKEN_THEME: Deprecated
 * @GTK_RC_TOKEN_RC: Deprecated
 * @GTK_RC_TOKEN_HIGHEST: Deprecated
 * @GTK_RC_TOKEN_ENGINE: Deprecated
 * @GTK_RC_TOKEN_MODULE_PATH: Deprecated
 * @GTK_RC_TOKEN_IM_MODULE_PATH: Deprecated
 * @GTK_RC_TOKEN_IM_MODULE_FILE: Deprecated
 * @GTK_RC_TOKEN_STOCK: Deprecated
 * @GTK_RC_TOKEN_LTR: Deprecated
 * @GTK_RC_TOKEN_RTL: Deprecated
 * @GTK_RC_TOKEN_COLOR: Deprecated
 * @GTK_RC_TOKEN_UNBIND: Deprecated
 * @GTK_RC_TOKEN_LAST: Deprecated
262
263
264
265
266
267
268
269
 *
 * The #GtkRcTokenType enumeration represents the tokens
 * in the RC file. It is exposed so that theme engines
 * can reuse these tokens when parsing the theme-engine
 * specific portions of a RC file.
 *
 * Deprecated: 3.0: Use #GtkCssProvider instead.
 */
270
271
272
273
274
275
276
277
278
279
280
typedef enum {
  GTK_RC_TOKEN_INVALID = G_TOKEN_LAST,
  GTK_RC_TOKEN_INCLUDE,
  GTK_RC_TOKEN_NORMAL,
  GTK_RC_TOKEN_ACTIVE,
  GTK_RC_TOKEN_PRELIGHT,
  GTK_RC_TOKEN_SELECTED,
  GTK_RC_TOKEN_INSENSITIVE,
  GTK_RC_TOKEN_FG,
  GTK_RC_TOKEN_BG,
  GTK_RC_TOKEN_TEXT,
281
282
283
  GTK_RC_TOKEN_BASE,
  GTK_RC_TOKEN_XTHICKNESS,
  GTK_RC_TOKEN_YTHICKNESS,
284
285
  GTK_RC_TOKEN_FONT,
  GTK_RC_TOKEN_FONTSET,
286
  GTK_RC_TOKEN_FONT_NAME,
287
288
289
290
291
292
293
294
295
296
297
  GTK_RC_TOKEN_BG_PIXMAP,
  GTK_RC_TOKEN_PIXMAP_PATH,
  GTK_RC_TOKEN_STYLE,
  GTK_RC_TOKEN_BINDING,
  GTK_RC_TOKEN_BIND,
  GTK_RC_TOKEN_WIDGET,
  GTK_RC_TOKEN_WIDGET_CLASS,
  GTK_RC_TOKEN_CLASS,
  GTK_RC_TOKEN_LOWEST,
  GTK_RC_TOKEN_GTK,
  GTK_RC_TOKEN_APPLICATION,
298
  GTK_RC_TOKEN_THEME,
299
300
  GTK_RC_TOKEN_RC,
  GTK_RC_TOKEN_HIGHEST,
301
302
  GTK_RC_TOKEN_ENGINE,
  GTK_RC_TOKEN_MODULE_PATH,
Owen Taylor's avatar
Owen Taylor committed
303
304
  GTK_RC_TOKEN_IM_MODULE_PATH,
  GTK_RC_TOKEN_IM_MODULE_FILE,
305
306
307
  GTK_RC_TOKEN_STOCK,
  GTK_RC_TOKEN_LTR,
  GTK_RC_TOKEN_RTL,
308
  GTK_RC_TOKEN_COLOR,
309
  GTK_RC_TOKEN_UNBIND,
310
311
312
  GTK_RC_TOKEN_LAST
} GtkRcTokenType;

Matthias Clasen's avatar
Matthias Clasen committed
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356

/**
 * GtkPathPriorityType:
 * @GTK_PATH_PRIO_LOWEST: Deprecated
 * @GTK_PATH_PRIO_GTK: Deprecated
 * @GTK_PATH_PRIO_APPLICATION: Deprecated
 * @GTK_PATH_PRIO_THEME: Deprecated
 * @GTK_PATH_PRIO_RC: Deprecated
 * @GTK_PATH_PRIO_HIGHEST: Deprecated
 *
 * Priorities for path lookups.
 * See also gtk_binding_set_add_path().
 *
 * Deprecated: 3.0
 */
typedef enum
{
  GTK_PATH_PRIO_LOWEST      = 0,
  GTK_PATH_PRIO_GTK         = 4,
  GTK_PATH_PRIO_APPLICATION = 8,
  GTK_PATH_PRIO_THEME       = 10,
  GTK_PATH_PRIO_RC          = 12,
  GTK_PATH_PRIO_HIGHEST     = 15
} GtkPathPriorityType;
#define GTK_PATH_PRIO_MASK 0x0f

/**
 * GtkPathType:
 * @GTK_PATH_WIDGET: Deprecated
 * @GTK_PATH_WIDGET_CLASS: Deprecated
 * @GTK_PATH_CLASS: Deprecated
 *
 * Widget path types.
 * See also gtk_binding_set_add_path().
 *
 * Deprecated: 3.0
 */
typedef enum
{
  GTK_PATH_WIDGET,
  GTK_PATH_WIDGET_CLASS,
  GTK_PATH_CLASS
} GtkPathType;

357
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
358
GScanner* gtk_rc_scanner_new    (void);
359
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
360
361
guint     gtk_rc_parse_color    (GScanner            *scanner,
                                 GdkColor            *color);
362
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
363
guint     gtk_rc_parse_color_full (GScanner          *scanner,
364
                                   GtkRcStyle        *style,
365
                                   GdkColor          *color);
366
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
367
368
guint     gtk_rc_parse_state    (GScanner            *scanner,
                                 GtkStateType        *state);
369
GDK_DEPRECATED_IN_3_0_FOR(GtkStyleContext)
370
371
guint     gtk_rc_parse_priority (GScanner            *scanner,
                                 GtkPathPriorityType *priority);
Tor Lillqvist's avatar
Tor Lillqvist committed
372

373
374
375
/* rc properties
 * (structure forward declared in gtkstyle.h)
 */
376
377
378
379
/**
 * GtkRcProperty:
 * @type_name: quark-ified type identifier
 * @property_name: quark-ified property identifier like
William Jon McCann's avatar
William Jon McCann committed
380
 *   “GtkScrollbar::spacing”
381
382
383
384
385
 * @origin: field similar to one found in #GtkSettingsValue
 * @value:field similar to one found in #GtkSettingsValue
 *
 * Deprecated
 */
386
387
struct _GtkRcProperty
{
William Jon McCann's avatar
William Jon McCann committed
388
  /* quark-ified property identifier like “GtkScrollbar::spacing” */
389
390
391
392
393
394
395
  GQuark type_name;
  GQuark property_name;

  /* fields similar to GtkSettingsValue */
  gchar *origin;
  GValue value;
};
396

Matthias Clasen's avatar
Matthias Clasen committed
397
398
399
400
401
402
GDK_DEPRECATED_IN_3_0
void      gtk_binding_set_add_path (GtkBindingSet       *binding_set,
                                    GtkPathType          path_type,
                                    const gchar         *path_pattern,
                                    GtkPathPriorityType  priority);

403
G_END_DECLS
Elliot Lee's avatar
Elliot Lee committed
404
405

#endif /* __GTK_RC_H__ */