]> Pileus Git - ~andy/gtk/blob - gtk/gtkrc.h
Move wholly deprecated files to a subdirectory
[~andy/gtk] / gtk / gtkrc.h
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, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
25  */
26
27 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
28 #error "Only <gtk/gtk.h> can be included directly."
29 #endif
30
31 #ifndef __GTK_RC_H__
32 #define __GTK_RC_H__
33
34
35 #include <gtk/gtkstyle.h>
36
37 G_BEGIN_DECLS
38
39 /* Forward declarations */
40 typedef struct _GtkIconFactory  GtkIconFactory;
41 typedef struct _GtkRcContext    GtkRcContext;
42
43 typedef struct _GtkRcStyleClass GtkRcStyleClass;
44
45 #define GTK_TYPE_RC_STYLE              (gtk_rc_style_get_type ())
46 #define GTK_RC_STYLE(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_RC_STYLE, GtkRcStyle))
47 #define GTK_RC_STYLE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RC_STYLE, GtkRcStyleClass))
48 #define GTK_IS_RC_STYLE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_RC_STYLE))
49 #define GTK_IS_RC_STYLE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RC_STYLE))
50 #define GTK_RC_STYLE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RC_STYLE, GtkRcStyleClass))
51
52 typedef enum
53 {
54   GTK_RC_FG             = 1 << 0,
55   GTK_RC_BG             = 1 << 1,
56   GTK_RC_TEXT           = 1 << 2,
57   GTK_RC_BASE           = 1 << 3
58 } GtkRcFlags;
59
60 /**
61  * GtkRcStyle:
62  * @name:
63  * @bg_pixmap_name:
64  * @font_desc:
65  * @color_flags:
66  * @fg:
67  * @bg:
68  * @text:
69  * @base:
70  * @xthickness:
71  * @ythickness:
72  *
73  * The #GtkRcStyle structure is used to represent a set
74  * of information about the appearance of a widget.
75  * This can later be composited together with other
76  * #GtkRcStyle structures to form a #GtkStyle.
77  */
78 struct _GtkRcStyle
79 {
80   GObject parent_instance;
81
82   /*< public >*/
83
84   gchar *name;
85   gchar *bg_pixmap_name[5];
86   PangoFontDescription *font_desc;
87
88   GtkRcFlags color_flags[5];
89   GdkColor   fg[5];
90   GdkColor   bg[5];
91   GdkColor   text[5];
92   GdkColor   base[5];
93
94   gint xthickness;
95   gint ythickness;
96
97   /*< private >*/
98   GArray *rc_properties;
99
100   /* list of RC style lists including this RC style */
101   GSList *rc_style_lists;
102
103   GSList *icon_factories;
104
105   guint engine_specified : 1;   /* The RC file specified the engine */
106 };
107
108 struct _GtkRcStyleClass
109 {
110   GObjectClass parent_class;
111
112   /* Create an empty RC style of the same type as this RC style.
113    * The default implementation, which does
114    * g_object_new (G_OBJECT_TYPE (style), NULL);
115    * should work in most cases.
116    */
117   GtkRcStyle * (*create_rc_style) (GtkRcStyle *rc_style);
118
119   /* Fill in engine specific parts of GtkRcStyle by parsing contents
120    * of brackets. Returns G_TOKEN_NONE if successful, otherwise returns
121    * the token it expected but didn't get.
122    */
123   guint     (*parse)  (GtkRcStyle   *rc_style,
124                        GtkSettings  *settings,
125                        GScanner     *scanner);
126
127   /* Combine RC style data from src into dest. If overridden, this
128    * function should chain to the parent.
129    */
130   void      (*merge)  (GtkRcStyle *dest,
131                        GtkRcStyle *src);
132
133   /* Create an empty style suitable to this RC style
134    */
135   GtkStyle * (*create_style) (GtkRcStyle *rc_style);
136
137   /* Padding for future expansion */
138   void (*_gtk_reserved1) (void);
139   void (*_gtk_reserved2) (void);
140   void (*_gtk_reserved3) (void);
141   void (*_gtk_reserved4) (void);
142 };
143
144 GSList*   _gtk_rc_parse_widget_class_path (const gchar *pattern);
145 void      _gtk_rc_free_widget_class_path (GSList       *list);
146 gboolean  _gtk_rc_match_widget_class     (GSList       *list,
147                                           gint          length,
148                                           gchar        *path,
149                                           gchar        *path_reversed);
150
151 #if !defined(GTK_DISABLE_DEPRECATED) || defined(GTK_COMPILATION)
152 GDK_DEPRECATED_FOR(GtkStyleContext)
153 void      gtk_rc_add_default_file       (const gchar *filename);
154 GDK_DEPRECATED_FOR(GtkStyleContext)
155 void      gtk_rc_set_default_files      (gchar **filenames);
156 GDK_DEPRECATED_FOR(GtkStyleContext)
157 gchar**   gtk_rc_get_default_files      (void);
158 GDK_DEPRECATED_FOR(GtkStyleContext)
159 GtkStyle* gtk_rc_get_style              (GtkWidget   *widget);
160 GDK_DEPRECATED_FOR(GtkStyleContext)
161 GtkStyle* gtk_rc_get_style_by_paths     (GtkSettings *settings,
162                                          const char  *widget_path,
163                                          const char  *class_path,
164                                          GType        type);
165
166 GDK_DEPRECATED_FOR(GtkStyleContext)
167 gboolean gtk_rc_reparse_all_for_settings (GtkSettings *settings,
168                                           gboolean     force_load);
169 GDK_DEPRECATED_FOR(GtkStyleContext)
170 void     gtk_rc_reset_styles             (GtkSettings *settings);
171
172 GDK_DEPRECATED_FOR(GtkStyleContext)
173 gchar*   gtk_rc_find_pixmap_in_path (GtkSettings  *settings,
174                                      GScanner     *scanner,
175                                      const gchar  *pixmap_file);
176
177 GDK_DEPRECATED_FOR(GtkStyleContext)
178 void     gtk_rc_parse                   (const gchar *filename);
179 GDK_DEPRECATED_FOR(GtkStyleContext)
180 void      gtk_rc_parse_string           (const gchar *rc_string);
181 GDK_DEPRECATED_FOR(GtkStyleContext)
182 gboolean  gtk_rc_reparse_all            (void);
183
184 GType       gtk_rc_style_get_type   (void) G_GNUC_CONST;
185 GDK_DEPRECATED_FOR(GtkStyleContext)
186 GtkRcStyle* gtk_rc_style_new        (void);
187 GDK_DEPRECATED_FOR(GtkStyleContext)
188 GtkRcStyle* gtk_rc_style_copy       (GtkRcStyle *orig);
189
190 GDK_DEPRECATED_FOR(GtkStyleContext)
191 gchar*      gtk_rc_find_module_in_path (const gchar *module_file);
192 GDK_DEPRECATED_FOR(GtkStyleContext)
193 gchar*      gtk_rc_get_theme_dir       (void);
194 GDK_DEPRECATED_FOR(GtkStyleContext)
195 gchar*      gtk_rc_get_module_dir      (void);
196 GDK_DEPRECATED_FOR(GtkStyleContext)
197 gchar*      gtk_rc_get_im_module_path  (void);
198 GDK_DEPRECATED_FOR(GtkStyleContext)
199 gchar*      gtk_rc_get_im_module_file  (void);
200
201 /* private functions/definitions */
202
203 /**
204  * GtkRcTokenType:
205  * @GTK_RC_TOKEN_INVALID:
206  * @GTK_RC_TOKEN_INCLUDE:
207  * @GTK_RC_TOKEN_NORMAL:
208  * @GTK_RC_TOKEN_ACTIVE:
209  * @GTK_RC_TOKEN_PRELIGHT:
210  * @GTK_RC_TOKEN_SELECTED:
211  * @GTK_RC_TOKEN_INSENSITIVE:
212  * @GTK_RC_TOKEN_FG:
213  * @GTK_RC_TOKEN_BG:
214  * @GTK_RC_TOKEN_TEXT:
215  * @GTK_RC_TOKEN_BASE:
216  * @GTK_RC_TOKEN_XTHICKNESS:
217  * @GTK_RC_TOKEN_YTHICKNESS:
218  * @GTK_RC_TOKEN_FONT:
219  * @GTK_RC_TOKEN_FONTSET:
220  * @GTK_RC_TOKEN_FONT_NAME:
221  * @GTK_RC_TOKEN_BG_PIXMAP:
222  * @GTK_RC_TOKEN_PIXMAP_PATH:
223  * @GTK_RC_TOKEN_STYLE:
224  * @GTK_RC_TOKEN_BINDING:
225  * @GTK_RC_TOKEN_BIND:
226  * @GTK_RC_TOKEN_WIDGET:
227  * @GTK_RC_TOKEN_WIDGET_CLASS:
228  * @GTK_RC_TOKEN_CLASS:
229  * @GTK_RC_TOKEN_LOWEST:
230  * @GTK_RC_TOKEN_GTK:
231  * @GTK_RC_TOKEN_APPLICATION:
232  * @GTK_RC_TOKEN_THEME:
233  * @GTK_RC_TOKEN_RC:
234  * @GTK_RC_TOKEN_HIGHEST:
235  * @GTK_RC_TOKEN_ENGINE:
236  * @GTK_RC_TOKEN_MODULE_PATH:
237  * @GTK_RC_TOKEN_IM_MODULE_PATH:
238  * @GTK_RC_TOKEN_IM_MODULE_FILE:
239  * @GTK_RC_TOKEN_STOCK:
240  * @GTK_RC_TOKEN_LTR:
241  * @GTK_RC_TOKEN_RTL:
242  * @GTK_RC_TOKEN_COLOR:
243  * @GTK_RC_TOKEN_UNBIND:
244  * @GTK_RC_TOKEN_LAST:
245  *
246  * The #GtkRcTokenType enumeration represents the tokens
247  * in the RC file. It is exposed so that theme engines
248  * can reuse these tokens when parsing the theme-engine
249  * specific portions of a RC file.
250  *
251  * Deprecated: 3.0: Use #GtkCssProvider instead.
252  */
253 typedef enum {
254   GTK_RC_TOKEN_INVALID = G_TOKEN_LAST,
255   GTK_RC_TOKEN_INCLUDE,
256   GTK_RC_TOKEN_NORMAL,
257   GTK_RC_TOKEN_ACTIVE,
258   GTK_RC_TOKEN_PRELIGHT,
259   GTK_RC_TOKEN_SELECTED,
260   GTK_RC_TOKEN_INSENSITIVE,
261   GTK_RC_TOKEN_FG,
262   GTK_RC_TOKEN_BG,
263   GTK_RC_TOKEN_TEXT,
264   GTK_RC_TOKEN_BASE,
265   GTK_RC_TOKEN_XTHICKNESS,
266   GTK_RC_TOKEN_YTHICKNESS,
267   GTK_RC_TOKEN_FONT,
268   GTK_RC_TOKEN_FONTSET,
269   GTK_RC_TOKEN_FONT_NAME,
270   GTK_RC_TOKEN_BG_PIXMAP,
271   GTK_RC_TOKEN_PIXMAP_PATH,
272   GTK_RC_TOKEN_STYLE,
273   GTK_RC_TOKEN_BINDING,
274   GTK_RC_TOKEN_BIND,
275   GTK_RC_TOKEN_WIDGET,
276   GTK_RC_TOKEN_WIDGET_CLASS,
277   GTK_RC_TOKEN_CLASS,
278   GTK_RC_TOKEN_LOWEST,
279   GTK_RC_TOKEN_GTK,
280   GTK_RC_TOKEN_APPLICATION,
281   GTK_RC_TOKEN_THEME,
282   GTK_RC_TOKEN_RC,
283   GTK_RC_TOKEN_HIGHEST,
284   GTK_RC_TOKEN_ENGINE,
285   GTK_RC_TOKEN_MODULE_PATH,
286   GTK_RC_TOKEN_IM_MODULE_PATH,
287   GTK_RC_TOKEN_IM_MODULE_FILE,
288   GTK_RC_TOKEN_STOCK,
289   GTK_RC_TOKEN_LTR,
290   GTK_RC_TOKEN_RTL,
291   GTK_RC_TOKEN_COLOR,
292   GTK_RC_TOKEN_UNBIND,
293   GTK_RC_TOKEN_LAST
294 } GtkRcTokenType;
295
296 GDK_DEPRECATED_FOR(GtkStyleContext)
297 GScanner* gtk_rc_scanner_new    (void);
298 GDK_DEPRECATED_FOR(GtkStyleContext)
299 guint     gtk_rc_parse_color    (GScanner            *scanner,
300                                  GdkColor            *color);
301 GDK_DEPRECATED_FOR(GtkStyleContext)
302 guint     gtk_rc_parse_color_full (GScanner          *scanner,
303                                    GtkRcStyle        *style,
304                                    GdkColor          *color);
305 GDK_DEPRECATED_FOR(GtkStyleContext)
306 guint     gtk_rc_parse_state    (GScanner            *scanner,
307                                  GtkStateType        *state);
308 GDK_DEPRECATED_FOR(GtkStyleContext)
309 guint     gtk_rc_parse_priority (GScanner            *scanner,
310                                  GtkPathPriorityType *priority);
311
312 #endif
313
314 /* rc properties
315  * (structure forward declared in gtkstyle.h)
316  */
317 struct _GtkRcProperty
318 {
319   /* quark-ified property identifier like "GtkScrollbar::spacing" */
320   GQuark type_name;
321   GQuark property_name;
322
323   /* fields similar to GtkSettingsValue */
324   gchar *origin;
325   GValue value;
326 };
327
328 G_END_DECLS
329
330 #endif /* __GTK_RC_H__ */