1/* GTK - The GIMP Toolkit
2 * Copyright (C) 2000 Red Hat, Inc.
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, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __GTK_SETTINGS_H__
19#define __GTK_SETTINGS_H__
20
21#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
22#error "Only <gtk/gtk.h> can be included directly."
23#endif
24
25#include <gdk/gdk.h>
26#include <gtk/gtktypes.h>
27
28G_BEGIN_DECLS
29
30
31/* -- type macros --- */
32#define GTK_TYPE_SETTINGS (gtk_settings_get_type ())
33#define GTK_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SETTINGS, GtkSettings))
34#define GTK_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SETTINGS, GtkSettingsClass))
35#define GTK_IS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SETTINGS))
36#define GTK_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SETTINGS))
37#define GTK_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SETTINGS, GtkSettingsClass))
38
39
40/* --- typedefs --- */
41typedef struct _GtkSettingsPrivate GtkSettingsPrivate;
42typedef struct _GtkSettingsClass GtkSettingsClass;
43typedef struct _GtkSettingsValue GtkSettingsValue;
44
45
46/* --- structures --- */
47struct _GtkSettings
48{
49 GObject parent_instance;
50
51 /*< private >*/
52 GtkSettingsPrivate *priv;
53};
54
55struct _GtkSettingsClass
56{
57 GObjectClass parent_class;
58
59 /* Padding for future expansion */
60 void (*_gtk_reserved1) (void);
61 void (*_gtk_reserved2) (void);
62 void (*_gtk_reserved3) (void);
63 void (*_gtk_reserved4) (void);
64};
65
66/**
67 * GtkSettingsValue:
68 * @origin: Origin should be something like “filename:linenumber” for
69 * rc files, or e.g. “XProperty” for other sources.
70 * @value: Valid types are LONG, DOUBLE and STRING corresponding to
71 * the token parsed, or a GSTRING holding an unparsed statement
72 */
73struct _GtkSettingsValue
74{
75 /* origin should be something like "filename:linenumber" for rc files,
76 * or e.g. "XProperty" for other sources
77 */
78 gchar *origin;
79
80 /* valid types are LONG, DOUBLE and STRING corresponding to the token parsed,
81 * or a GSTRING holding an unparsed statement
82 */
83 GValue value;
84};
85
86
87/* --- functions --- */
88GDK_AVAILABLE_IN_ALL
89GType gtk_settings_get_type (void) G_GNUC_CONST;
90GDK_AVAILABLE_IN_ALL
91GtkSettings* gtk_settings_get_default (void);
92GDK_AVAILABLE_IN_ALL
93GtkSettings* gtk_settings_get_for_screen (GdkScreen *screen);
94
95GDK_DEPRECATED_IN_3_16
96void gtk_settings_install_property (GParamSpec *pspec);
97GDK_DEPRECATED_IN_3_16
98void gtk_settings_install_property_parser (GParamSpec *pspec,
99 GtkRcPropertyParser parser);
100
101/* --- precoded parsing functions --- */
102GDK_AVAILABLE_IN_ALL
103gboolean gtk_rc_property_parse_color (const GParamSpec *pspec,
104 const GString *gstring,
105 GValue *property_value);
106GDK_AVAILABLE_IN_ALL
107gboolean gtk_rc_property_parse_enum (const GParamSpec *pspec,
108 const GString *gstring,
109 GValue *property_value);
110GDK_AVAILABLE_IN_ALL
111gboolean gtk_rc_property_parse_flags (const GParamSpec *pspec,
112 const GString *gstring,
113 GValue *property_value);
114GDK_AVAILABLE_IN_ALL
115gboolean gtk_rc_property_parse_requisition (const GParamSpec *pspec,
116 const GString *gstring,
117 GValue *property_value);
118GDK_AVAILABLE_IN_ALL
119gboolean gtk_rc_property_parse_border (const GParamSpec *pspec,
120 const GString *gstring,
121 GValue *property_value);
122
123GDK_DEPRECATED_IN_3_16
124void gtk_settings_set_property_value (GtkSettings *settings,
125 const gchar *name,
126 const GtkSettingsValue *svalue);
127GDK_DEPRECATED_IN_3_16
128void gtk_settings_set_string_property (GtkSettings *settings,
129 const gchar *name,
130 const gchar *v_string,
131 const gchar *origin);
132GDK_DEPRECATED_IN_3_16
133void gtk_settings_set_long_property (GtkSettings *settings,
134 const gchar *name,
135 glong v_long,
136 const gchar *origin);
137GDK_DEPRECATED_IN_3_16
138void gtk_settings_set_double_property (GtkSettings *settings,
139 const gchar *name,
140 gdouble v_double,
141 const gchar *origin);
142
143GDK_AVAILABLE_IN_3_20
144void gtk_settings_reset_property (GtkSettings *settings,
145 const gchar *name);
146
147G_END_DECLS
148
149#endif /* __GTK_SETTINGS_H__ */
150