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>
26 /* -- type macros --- */
27 #define GTK_TYPE_SETTINGS (gtk_settings_get_type ())
28 #define GTK_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SETTINGS, GtkSettings))
29 #define GTK_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SETTINGS, GtkSettingsClass))
30 #define GTK_IS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SETTINGS))
31 #define GTK_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SETTINGS))
32 #define GTK_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SETTINGS, GtkSettingsClass))
35 /* --- typedefs --- */
36 typedef struct _GtkSettingsClass GtkSettingsClass;
37 typedef struct _GtkSettingsValue GtkSettingsValue;
38 typedef struct _GtkSettingsPropertyValue GtkSettingsPropertyValue; /* Internal */
41 /* --- structures --- */
44 GObject parent_instance;
46 GData *queued_settings; /* of type GtkSettingsValue* */
47 GtkSettingsPropertyValue *property_values;
49 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) G_GNUC_CONST;
73 #ifndef GDK_MULTIHEAD_SAFE
74 GtkSettings* gtk_settings_get_default (void);
76 GtkSettings* gtk_settings_get_for_screen (GdkScreen *screen);
78 void gtk_settings_install_property (GParamSpec *pspec);
79 void gtk_settings_install_property_parser (GParamSpec *pspec,
80 GtkRcPropertyParser parser);
82 /* --- precoded parsing functions --- */
83 gboolean gtk_rc_property_parse_color (const GParamSpec *pspec,
84 const GString *gstring,
85 GValue *property_value);
86 gboolean gtk_rc_property_parse_enum (const GParamSpec *pspec,
87 const GString *gstring,
88 GValue *property_value);
89 gboolean gtk_rc_property_parse_flags (const GParamSpec *pspec,
90 const GString *gstring,
91 GValue *property_value);
92 gboolean gtk_rc_property_parse_requisition (const GParamSpec *pspec,
93 const GString *gstring,
94 GValue *property_value);
95 gboolean gtk_rc_property_parse_border (const GParamSpec *pspec,
96 const GString *gstring,
97 GValue *property_value);
100 void gtk_settings_set_property_value (GtkSettings *settings,
102 const GtkSettingsValue *svalue);
103 void gtk_settings_set_string_property (GtkSettings *settings,
105 const gchar *v_string,
106 const gchar *origin);
107 void gtk_settings_set_long_property (GtkSettings *settings,
110 const gchar *origin);
111 void gtk_settings_set_double_property (GtkSettings *settings,
114 const gchar *origin);
117 /* implementation details */
118 void _gtk_settings_set_property_value_from_rc (GtkSettings *settings,
120 const GtkSettingsValue *svalue);
121 void _gtk_settings_reset_rc_values (GtkSettings *settings);
123 void _gtk_settings_handle_event (GdkEventSetting *event);
124 GtkRcPropertyParser _gtk_rc_property_parser_from_type (GType type);
125 gboolean _gtk_settings_parse_convert (GtkRcPropertyParser parser,
126 const GValue *src_value,
133 #endif /* __GTK_SETTINGS_H__ */