1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 2000 Red Hat, Inc.
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 Free
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 #ifndef __GTK_SETTINGS_H__
19 #define __GTK_SETTINGS_H__
21 #include <gtk/gtkrc.h>
25 #endif /* __cplusplus */
28 /* -- type macros --- */
29 #define GTK_TYPE_SETTINGS (gtk_settings_get_type ())
30 #define GTK_SETTINGS(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_SETTINGS, GtkSettings))
31 #define GTK_SETTINGS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_SETTINGS, GtkSettingsClass))
32 #define GTK_IS_SETTINGS(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_SETTINGS))
33 #define GTK_IS_SETTINGS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SETTINGS))
34 #define GTK_SETTINGS_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_SETTINGS, GtkSettingsClass))
37 /* --- typedefs --- */
38 typedef struct _GtkSettingsClass GtkSettingsClass;
39 typedef struct _GtkSettingsValue GtkSettingsValue;
42 /* --- structures --- */
45 GObject parent_instance;
47 GData *queued_settings; /* of type GtkSettingsValue* */
48 GValue *property_values;
50 GtkRcContext *rc_context;
52 struct _GtkSettingsClass
54 GObjectClass parent_class;
57 struct _GtkSettingsValue
59 /* origin should be something like "filename:linenumber" for rc files,
60 * or e.g. "XProperty" for other sources
64 /* valid types are LONG, DOUBLE and STRING corresponding to the token parsed,
65 * or a GSTRING holding an unparsed statement
71 /* --- functions --- */
72 GType gtk_settings_get_type (void);
73 GtkSettings* gtk_settings_get_default (void);
74 void gtk_settings_install_property (GParamSpec *pspec);
75 void gtk_settings_install_property_parser (GParamSpec *pspec,
76 GtkRcPropertyParser parser);
78 /* --- precoded parsing functions --- */
79 gboolean gtk_rc_property_parse_color (const GParamSpec *pspec,
80 const GString *gstring,
81 GValue *property_value);
82 gboolean gtk_rc_property_parse_enum (const GParamSpec *pspec,
83 const GString *gstring,
84 GValue *property_value);
85 gboolean gtk_rc_property_parse_flags (const GParamSpec *pspec,
86 const GString *gstring,
87 GValue *property_value);
88 gboolean gtk_rc_property_parse_requisition (const GParamSpec *pspec,
89 const GString *gstring,
90 GValue *property_value);
91 gboolean gtk_rc_property_parse_border (const GParamSpec *pspec,
92 const GString *gstring,
93 GValue *property_value);
96 void gtk_settings_set_property_value (GtkSettings *settings,
98 const GtkSettingsValue *svalue);
99 void gtk_settings_set_string_property (GtkSettings *settings,
101 const gchar *v_string,
102 const gchar *origin);
103 void gtk_settings_set_long_property (GtkSettings *settings,
106 const gchar *origin);
107 void gtk_settings_set_double_property (GtkSettings *settings,
110 const gchar *origin);
113 /* implementation details */
114 void _gtk_settings_handle_event (GdkEventSetting *event);
115 GtkRcPropertyParser _gtk_rc_property_parser_from_type (GType type);
116 gboolean _gtk_settings_parse_convert (GtkRcPropertyParser parser,
117 const GValue *src_value,
124 #endif /* __cplusplus */
126 #endif /* __GTK_SETTINGS_H__ */