1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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.
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.
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.
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/.
27 #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
28 #error "Only <gtk/gtk.h> can be included directly."
35 #include <gtk/gtkstyle.h>
39 /* Forward declarations */
40 typedef struct _GtkIconFactory GtkIconFactory;
41 typedef struct _GtkRcContext GtkRcContext;
43 typedef struct _GtkRcStyleClass GtkRcStyleClass;
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))
62 GObject parent_instance;
67 gchar *bg_pixmap_name[5];
68 PangoFontDescription *font_desc;
70 GtkRcFlags color_flags[5];
80 GArray *rc_properties;
82 /* list of RC style lists including this RC style */
83 GSList *rc_style_lists;
85 GSList *icon_factories;
87 guint engine_specified : 1; /* The RC file specified the engine */
90 struct _GtkRcStyleClass
92 GObjectClass parent_class;
94 /* Create an empty RC style of the same type as this RC style.
95 * The default implementation, which does
96 * g_object_new (G_OBJECT_TYPE (style), NULL);
97 * should work in most cases.
99 GtkRcStyle * (*create_rc_style) (GtkRcStyle *rc_style);
101 /* Fill in engine specific parts of GtkRcStyle by parsing contents
102 * of brackets. Returns G_TOKEN_NONE if successful, otherwise returns
103 * the token it expected but didn't get.
105 guint (*parse) (GtkRcStyle *rc_style,
106 GtkSettings *settings,
109 /* Combine RC style data from src into dest. If overridden, this
110 * function should chain to the parent.
112 void (*merge) (GtkRcStyle *dest,
115 /* Create an empty style suitable to this RC style
117 GtkStyle * (*create_style) (GtkRcStyle *rc_style);
119 /* Padding for future expansion */
120 void (*_gtk_reserved1) (void);
121 void (*_gtk_reserved2) (void);
122 void (*_gtk_reserved3) (void);
123 void (*_gtk_reserved4) (void);
127 /* Reserve old names for DLL ABI backward compatibility */
128 #define gtk_rc_add_default_file gtk_rc_add_default_file_utf8
129 #define gtk_rc_set_default_files gtk_rc_set_default_files_utf8
130 #define gtk_rc_parse gtk_rc_parse_utf8
133 void _gtk_rc_init (void);
134 GSList* _gtk_rc_parse_widget_class_path (const gchar *pattern);
135 void _gtk_rc_free_widget_class_path (GSList *list);
136 gboolean _gtk_rc_match_widget_class (GSList *list,
139 gchar *path_reversed);
141 void gtk_rc_add_default_file (const gchar *filename);
142 void gtk_rc_set_default_files (gchar **filenames);
143 gchar** gtk_rc_get_default_files (void);
144 GtkStyle* gtk_rc_get_style (GtkWidget *widget);
145 GtkStyle* gtk_rc_get_style_by_paths (GtkSettings *settings,
146 const char *widget_path,
147 const char *class_path,
150 gboolean gtk_rc_reparse_all_for_settings (GtkSettings *settings,
151 gboolean force_load);
152 void gtk_rc_reset_styles (GtkSettings *settings);
154 gchar* gtk_rc_find_pixmap_in_path (GtkSettings *settings,
156 const gchar *pixmap_file);
158 void gtk_rc_parse (const gchar *filename);
159 void gtk_rc_parse_string (const gchar *rc_string);
160 gboolean gtk_rc_reparse_all (void);
162 #ifndef GTK_DISABLE_DEPRECATED
163 void gtk_rc_add_widget_name_style (GtkRcStyle *rc_style,
164 const gchar *pattern);
165 void gtk_rc_add_widget_class_style (GtkRcStyle *rc_style,
166 const gchar *pattern);
167 void gtk_rc_add_class_style (GtkRcStyle *rc_style,
168 const gchar *pattern);
169 #endif /* GTK_DISABLE_DEPRECATED */
172 GType gtk_rc_style_get_type (void) G_GNUC_CONST;
173 GtkRcStyle* gtk_rc_style_new (void);
174 GtkRcStyle* gtk_rc_style_copy (GtkRcStyle *orig);
176 #ifndef GTK_DISABLE_DEPRECATED
177 void gtk_rc_style_ref (GtkRcStyle *rc_style);
178 void gtk_rc_style_unref (GtkRcStyle *rc_style);
181 gchar* gtk_rc_find_module_in_path (const gchar *module_file);
182 gchar* gtk_rc_get_theme_dir (void);
183 gchar* gtk_rc_get_module_dir (void);
184 gchar* gtk_rc_get_im_module_path (void);
185 gchar* gtk_rc_get_im_module_file (void);
187 /* private functions/definitions */
189 GTK_RC_TOKEN_INVALID = G_TOKEN_LAST,
190 GTK_RC_TOKEN_INCLUDE,
193 GTK_RC_TOKEN_PRELIGHT,
194 GTK_RC_TOKEN_SELECTED,
195 GTK_RC_TOKEN_INSENSITIVE,
200 GTK_RC_TOKEN_XTHICKNESS,
201 GTK_RC_TOKEN_YTHICKNESS,
203 GTK_RC_TOKEN_FONTSET,
204 GTK_RC_TOKEN_FONT_NAME,
205 GTK_RC_TOKEN_BG_PIXMAP,
206 GTK_RC_TOKEN_PIXMAP_PATH,
208 GTK_RC_TOKEN_BINDING,
211 GTK_RC_TOKEN_WIDGET_CLASS,
215 GTK_RC_TOKEN_APPLICATION,
218 GTK_RC_TOKEN_HIGHEST,
220 GTK_RC_TOKEN_MODULE_PATH,
221 GTK_RC_TOKEN_IM_MODULE_PATH,
222 GTK_RC_TOKEN_IM_MODULE_FILE,
231 GScanner* gtk_rc_scanner_new (void);
232 guint gtk_rc_parse_color (GScanner *scanner,
234 guint gtk_rc_parse_color_full (GScanner *scanner,
237 guint gtk_rc_parse_state (GScanner *scanner,
238 GtkStateType *state);
239 guint gtk_rc_parse_priority (GScanner *scanner,
240 GtkPathPriorityType *priority);
243 * (structure forward declared in gtkstyle.h)
245 struct _GtkRcProperty
247 /* quark-ified property identifier like "GtkScrollbar::spacing" */
249 GQuark property_name;
251 /* fields similar to GtkSettingsValue */
255 const GtkRcProperty* _gtk_rc_style_lookup_rc_property (GtkRcStyle *rc_style,
257 GQuark property_name);
258 void _gtk_rc_style_set_rc_property (GtkRcStyle *rc_style,
259 GtkRcProperty *property);
260 void _gtk_rc_style_unset_rc_property (GtkRcStyle *rc_style,
262 GQuark property_name);
264 GSList * _gtk_rc_style_get_color_hashes (GtkRcStyle *rc_style);
266 void _gtk_rc_style_set_symbolic_color (GtkRcStyle *rc_style,
268 const GdkColor *color);
270 const gchar* _gtk_rc_context_get_default_font_name (GtkSettings *settings);
271 void _gtk_rc_context_destroy (GtkSettings *settings);
275 #endif /* __GTK_RC_H__ */