]> Pileus Git - ~andy/gtk/blob - gtk/gtkrc.h
Move more text widget headers into the private header list
[~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 #ifndef __GTK_RC_H__
28 #define __GTK_RC_H__
29
30
31 #include <gtk/gtkstyle.h>
32 #include <gtk/gtkwidget.h>
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif /* __cplusplus */
37
38 /* Forward declaration */
39 typedef struct _GtkIconFactory GtkIconFactory;
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 typedef enum
49 {
50   GTK_RC_FG             = 1 << 0,
51   GTK_RC_BG             = 1 << 1,
52   GTK_RC_TEXT           = 1 << 2,
53   GTK_RC_BASE           = 1 << 3
54 } GtkRcFlags;
55
56 typedef struct _GtkRcStyleClass GtkRcStyleClass;
57
58 struct _GtkRcStyle
59 {
60   GObject parent_instance;
61
62   /*< public >*/
63   
64   gchar *name;
65   gchar *bg_pixmap_name[5];
66   PangoFontDescription *font_desc;
67
68   GtkRcFlags color_flags[5];
69   GdkColor   fg[5];
70   GdkColor   bg[5];
71   GdkColor   text[5];
72   GdkColor   base[5];
73
74   gint xthickness;
75   gint ythickness;
76   
77   /*< private >*/
78   
79   /* list of RC style lists including this RC style */
80   GSList *rc_style_lists;
81
82   GSList *icon_factories;
83 };
84
85 struct _GtkRcStyleClass
86 {
87   GObjectClass parent_class;
88
89   /* Create an empty RC style of the same type as this RC style.
90    * The default implementation, which does
91    * g_object_new (G_OBJECT_TYPE (style), NULL);
92    * should work in most cases.
93    */
94   GtkRcStyle *(*clone) (GtkRcStyle *rc_style);
95
96   /* Fill in engine specific parts of GtkRcStyle by parsing contents
97    * of brackets. Returns G_TOKEN_NONE if succesful, otherwise returns
98    * the token it expected but didn't get.
99    */
100   guint     (*parse)  (GtkRcStyle *rc_style, GScanner *scanner);
101   
102   /* Combine RC style data from src into dest. If overriden, this
103    * function should chain to the parent.
104    */
105   void      (*merge)  (GtkRcStyle *dest, GtkRcStyle *src);
106
107   /* Create an empty style suitable to this RC style
108    */
109   GtkStyle *(*create_style) (GtkRcStyle *rc_style);
110 };
111
112 void      gtk_rc_init                   (void);
113 void      gtk_rc_add_default_file    (const gchar *filename);
114 void      gtk_rc_set_default_files      (gchar **filenames);
115 gchar**   gtk_rc_get_default_files      (void);
116 void      gtk_rc_parse                  (const gchar *filename);
117 void      gtk_rc_parse_string           (const gchar *rc_string);
118 gboolean  gtk_rc_reparse_all            (void);
119 GtkStyle* gtk_rc_get_style              (GtkWidget   *widget);
120 void      gtk_rc_add_widget_name_style  (GtkRcStyle  *rc_style,
121                                          const gchar *pattern);
122 void      gtk_rc_add_widget_class_style (GtkRcStyle  *rc_style,
123                                          const gchar *pattern);
124 void      gtk_rc_add_class_style        (GtkRcStyle  *rc_style,
125                                          const gchar *pattern);
126
127 GType       gtk_rc_style_get_type   (void) G_GNUC_CONST;
128 GtkRcStyle* gtk_rc_style_new        (void);
129 GtkRcStyle *gtk_rc_style_copy       (GtkRcStyle *orig);
130 void        gtk_rc_style_ref        (GtkRcStyle *rc_style);
131 void        gtk_rc_style_unref      (GtkRcStyle *rc_style);
132
133 /* Tell gtkrc to use a custom routine to load images specified in rc files instead of
134  *   the default xpm-only loader
135  */
136 typedef GdkPixmap*  (*GtkImageLoader)           (GdkWindow      *window,
137                                                  GdkColormap    *colormap,
138                                                  GdkBitmap     **mask,
139                                                  GdkColor       *transparent_color,
140                                                  const gchar    *filename);
141 void            gtk_rc_set_image_loader         (GtkImageLoader  loader);
142
143 GdkPixmap*      gtk_rc_load_image               (GdkColormap    *colormap,
144                                                  GdkColor       *transparent_color,
145                                                  const gchar    *filename);
146 gchar*          gtk_rc_find_pixmap_in_path      (GScanner       *scanner,
147                                                  const gchar    *pixmap_file);
148 gchar*          gtk_rc_find_module_in_path      (const gchar    *module_file);
149 gchar*          gtk_rc_get_theme_dir            (void);
150 gchar*          gtk_rc_get_module_dir           (void);
151
152 /* private functions/definitions */
153 typedef enum {
154   GTK_RC_TOKEN_INVALID = G_TOKEN_LAST,
155   GTK_RC_TOKEN_INCLUDE,
156   GTK_RC_TOKEN_NORMAL,
157   GTK_RC_TOKEN_ACTIVE,
158   GTK_RC_TOKEN_PRELIGHT,
159   GTK_RC_TOKEN_SELECTED,
160   GTK_RC_TOKEN_INSENSITIVE,
161   GTK_RC_TOKEN_FG,
162   GTK_RC_TOKEN_BG,
163   GTK_RC_TOKEN_TEXT,
164   GTK_RC_TOKEN_BASE,
165   GTK_RC_TOKEN_XTHICKNESS,
166   GTK_RC_TOKEN_YTHICKNESS,
167   GTK_RC_TOKEN_FONT,
168   GTK_RC_TOKEN_FONTSET,
169   GTK_RC_TOKEN_FONT_NAME,
170   GTK_RC_TOKEN_BG_PIXMAP,
171   GTK_RC_TOKEN_PIXMAP_PATH,
172   GTK_RC_TOKEN_STYLE,
173   GTK_RC_TOKEN_BINDING,
174   GTK_RC_TOKEN_BIND,
175   GTK_RC_TOKEN_WIDGET,
176   GTK_RC_TOKEN_WIDGET_CLASS,
177   GTK_RC_TOKEN_CLASS,
178   GTK_RC_TOKEN_LOWEST,
179   GTK_RC_TOKEN_GTK,
180   GTK_RC_TOKEN_APPLICATION,
181   GTK_RC_TOKEN_RC,
182   GTK_RC_TOKEN_HIGHEST,
183   GTK_RC_TOKEN_ENGINE,
184   GTK_RC_TOKEN_MODULE_PATH,
185   GTK_RC_TOKEN_STOCK,
186   GTK_RC_TOKEN_LTR,
187   GTK_RC_TOKEN_RTL,
188   GTK_RC_TOKEN_LAST
189 } GtkRcTokenType;
190
191 guint   gtk_rc_parse_color      (GScanner            *scanner,
192                                  GdkColor            *color);
193 guint   gtk_rc_parse_state      (GScanner            *scanner,
194                                  GtkStateType        *state);
195 guint   gtk_rc_parse_priority   (GScanner            *scanner,
196                                  GtkPathPriorityType *priority);
197      
198 #ifdef G_OS_WIN32
199
200 gchar  *gtk_win32_get_installation_directory (void);
201
202 #endif
203
204
205 #ifdef __cplusplus
206 }
207 #endif /* __cplusplus */
208
209
210 #endif /* __GTK_RC_H__ */