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