]> Pileus Git - ~andy/gtk/blob - gtk/gtkrc.h
8fc54b1e7b4c7534fba22ffcde5a820fdb0766bd
[~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 Library 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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library 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-1999.  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 #define GTK_TYPE_RC_STYLE              (gtk_rc_style_get_type ())
39 #define GTK_RC_STYLE(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_RC_STYLE, GtkRcStyle))
40 #define GTK_RC_STYLE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RC_STYLE, GtkRcStyleClass))
41 #define GTK_IS_RC_STYLE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_RC_STYLE))
42 #define GTK_IS_RC_STYLE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RC_STYLE))
43 #define GTK_RC_STYLE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RC_STYLE, GtkRcStyleClass))
44
45 typedef enum
46 {
47   GTK_RC_FG             = 1 << 0,
48   GTK_RC_BG             = 1 << 1,
49   GTK_RC_TEXT           = 1 << 2,
50   GTK_RC_BASE           = 1 << 3
51 } GtkRcFlags;
52
53 typedef struct _GtkRcStyleClass GtkRcStyleClass;
54
55 struct _GtkRcStyle
56 {
57   GObject parent_instance;
58
59   /*< public >*/
60   
61   gchar *name;
62   gchar *bg_pixmap_name[5];
63   PangoFontDescription *font_desc;
64
65   GtkRcFlags color_flags[5];
66   GdkColor   fg[5];
67   GdkColor   bg[5];
68   GdkColor   text[5];
69   GdkColor   base[5];
70
71   gint xthickness;
72   gint ythickness;
73
74   GtkThemeEngine *engine;
75   gpointer        engine_data;
76
77   /*< private >*/
78   
79   /* list of RC style lists including this RC style */
80   GSList *rc_style_lists;
81 };
82
83 struct _GtkRcStyleClass
84 {
85   GObjectClass parent_class;
86
87 };
88
89 void      gtk_rc_init                   (void);
90 void      gtk_rc_add_default_file    (const gchar *filename);
91 void      gtk_rc_set_default_files      (gchar **filenames);
92 gchar**   gtk_rc_get_default_files      (void);
93 void      gtk_rc_parse                  (const gchar *filename);
94 void      gtk_rc_parse_string           (const gchar *rc_string);
95 gboolean  gtk_rc_reparse_all            (void);
96 GtkStyle* gtk_rc_get_style              (GtkWidget   *widget);
97 void      gtk_rc_add_widget_name_style  (GtkRcStyle  *rc_style,
98                                          const gchar *pattern);
99 void      gtk_rc_add_widget_class_style (GtkRcStyle  *rc_style,
100                                          const gchar *pattern);
101 void      gtk_rc_add_class_style        (GtkRcStyle  *rc_style,
102                                          const gchar *pattern);
103
104 GType       gtk_rc_style_get_type         (void);
105 GtkRcStyle* gtk_rc_style_new              (void);
106 void        gtk_rc_style_ref              (GtkRcStyle  *rc_style);
107 void        gtk_rc_style_unref            (GtkRcStyle  *rc_style);
108
109 /* Tell gtkrc to use a custom routine to load images specified in rc files instead of
110  *   the default xpm-only loader
111  */
112 typedef GdkPixmap*  (*GtkImageLoader)           (GdkWindow      *window,
113                                                  GdkColormap    *colormap,
114                                                  GdkBitmap     **mask,
115                                                  GdkColor       *transparent_color,
116                                                  const gchar    *filename);
117 void            gtk_rc_set_image_loader         (GtkImageLoader  loader);
118
119 GdkPixmap*      gtk_rc_load_image               (GdkColormap    *colormap,
120                                                  GdkColor       *transparent_color,
121                                                  const gchar    *filename);
122 gchar*          gtk_rc_find_pixmap_in_path      (GScanner       *scanner,
123                                                  const gchar    *pixmap_file);
124 gchar*          gtk_rc_find_module_in_path      (const gchar    *module_file);
125 gchar*          gtk_rc_get_theme_dir            (void);
126 gchar*          gtk_rc_get_module_dir           (void);
127
128 /* private functions/definitions */
129 typedef enum {
130   GTK_RC_TOKEN_INVALID = G_TOKEN_LAST,
131   GTK_RC_TOKEN_INCLUDE,
132   GTK_RC_TOKEN_NORMAL,
133   GTK_RC_TOKEN_ACTIVE,
134   GTK_RC_TOKEN_PRELIGHT,
135   GTK_RC_TOKEN_SELECTED,
136   GTK_RC_TOKEN_INSENSITIVE,
137   GTK_RC_TOKEN_FG,
138   GTK_RC_TOKEN_BG,
139   GTK_RC_TOKEN_TEXT,
140   GTK_RC_TOKEN_BASE,
141   GTK_RC_TOKEN_XTHICKNESS,
142   GTK_RC_TOKEN_YTHICKNESS,
143   GTK_RC_TOKEN_FONT,
144   GTK_RC_TOKEN_FONTSET,
145   GTK_RC_TOKEN_FONT_NAME,
146   GTK_RC_TOKEN_BG_PIXMAP,
147   GTK_RC_TOKEN_PIXMAP_PATH,
148   GTK_RC_TOKEN_STYLE,
149   GTK_RC_TOKEN_BINDING,
150   GTK_RC_TOKEN_BIND,
151   GTK_RC_TOKEN_WIDGET,
152   GTK_RC_TOKEN_WIDGET_CLASS,
153   GTK_RC_TOKEN_CLASS,
154   GTK_RC_TOKEN_LOWEST,
155   GTK_RC_TOKEN_GTK,
156   GTK_RC_TOKEN_APPLICATION,
157   GTK_RC_TOKEN_RC,
158   GTK_RC_TOKEN_HIGHEST,
159   GTK_RC_TOKEN_ENGINE,
160   GTK_RC_TOKEN_MODULE_PATH,
161   GTK_RC_TOKEN_LAST
162 } GtkRcTokenType;
163
164 guint   gtk_rc_parse_color      (GScanner            *scanner,
165                                  GdkColor            *color);
166 guint   gtk_rc_parse_state      (GScanner            *scanner,
167                                  GtkStateType        *state);
168 guint   gtk_rc_parse_priority   (GScanner            *scanner,
169                                  GtkPathPriorityType *priority);
170      
171
172
173 #ifdef __cplusplus
174 }
175 #endif /* __cplusplus */
176
177
178 #endif /* __GTK_RC_H__ */