add an instance member value_type so the default value of the pspec class
[platform/upstream/glib.git] / gobject / gparamspecs.h
1 /* GObject - GLib Type, Object, Parameter and Signal Library
2  * Copyright (C) 1997, 1998, 1999, 2000 Tim Janik and 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
15  * Public 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  * gparamspecs.h: GLib default param specs
20  */
21 #ifndef __G_PARAMSPECS_H__
22 #define __G_PARAMSPECS_H__
23
24
25 #include        <gobject/gvalue.h>
26 #include        <gobject/genums.h>
27 #include        <gobject/gboxed.h>
28 #include        <gobject/gobject.h>
29
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif /* __cplusplus */
34
35
36 /* --- type macros --- */
37 #define G_IS_PARAM_SPEC_CHAR(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_CHAR))
38 #define G_PARAM_SPEC_CHAR(pspec)         (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_CHAR, GParamSpecChar))
39 #define G_IS_PARAM_SPEC_UCHAR(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UCHAR))
40 #define G_PARAM_SPEC_UCHAR(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UCHAR, GParamSpecUChar))
41 #define G_IS_PARAM_SPEC_BOOLEAN(pspec)   (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOOLEAN))
42 #define G_PARAM_SPEC_BOOLEAN(pspec)      (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOOLEAN, GParamSpecBoolean))
43 #define G_IS_PARAM_SPEC_INT(pspec)       (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT))
44 #define G_PARAM_SPEC_INT(pspec)          (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT, GParamSpecInt))
45 #define G_IS_PARAM_SPEC_UINT(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT))
46 #define G_PARAM_SPEC_UINT(pspec)         (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT, GParamSpecUInt))
47 #define G_IS_PARAM_SPEC_LONG(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_LONG))
48 #define G_PARAM_SPEC_LONG(pspec)         (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_LONG, GParamSpecLong))
49 #define G_IS_PARAM_SPEC_ULONG(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ULONG))
50 #define G_PARAM_SPEC_ULONG(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ULONG, GParamSpecULong))
51 #define G_IS_PARAM_SPEC_ENUM(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ENUM))
52 #define G_PARAM_SPEC_ENUM(pspec)         (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ENUM, GParamSpecEnum))
53 #define G_IS_PARAM_SPEC_FLAGS(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLAGS))
54 #define G_PARAM_SPEC_FLAGS(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLAGS, GParamSpecFlags))
55 #define G_IS_PARAM_SPEC_FLOAT(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLOAT))
56 #define G_PARAM_SPEC_FLOAT(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLOAT, GParamSpecFloat))
57 #define G_IS_PARAM_SPEC_DOUBLE(pspec)    (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_DOUBLE))
58 #define G_PARAM_SPEC_DOUBLE(pspec)       (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_DOUBLE, GParamSpecDouble))
59 #define G_IS_PARAM_SPEC_STRING(pspec)    (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_STRING))
60 #define G_PARAM_SPEC_STRING(pspec)       (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_STRING, GParamSpecString))
61 #define G_IS_PARAM_SPEC_PARAM(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_PARAM))
62 #define G_PARAM_SPEC_PARAM(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_PARAM, GParamSpecParam))
63 #define G_IS_PARAM_SPEC_POINTER(pspec)   (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_POINTER))
64 #define G_PARAM_SPEC_POINTER(pspec)      (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_POINTER, GParamSpecPointer))
65 #define G_IS_PARAM_SPEC_CCALLBACK(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_CCALLBACK))
66 #define G_PARAM_SPEC_CCALLBACK(pspec)    (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_CCALLBACK, GParamSpecCCallback))
67 #define G_IS_PARAM_SPEC_BOXED(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOXED))
68 #define G_PARAM_SPEC_BOXED(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOXED, GParamSpecBoxed))
69 #define G_IS_PARAM_SPEC_OBJECT(pspec)    (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_OBJECT))
70 #define G_PARAM_SPEC_OBJECT(pspec)       (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_OBJECT, GParamSpecObject))
71
72
73 /* --- typedefs & structures --- */
74 typedef struct _GParamSpecChar      GParamSpecChar;
75 typedef struct _GParamSpecUChar     GParamSpecUChar;
76 typedef struct _GParamSpecBoolean   GParamSpecBoolean;
77 typedef struct _GParamSpecInt       GParamSpecInt;
78 typedef struct _GParamSpecUInt      GParamSpecUInt;
79 typedef struct _GParamSpecLong      GParamSpecLong;
80 typedef struct _GParamSpecULong     GParamSpecULong;
81 typedef struct _GParamSpecEnum      GParamSpecEnum;
82 typedef struct _GParamSpecFlags     GParamSpecFlags;
83 typedef struct _GParamSpecFloat     GParamSpecFloat;
84 typedef struct _GParamSpecDouble    GParamSpecDouble;
85 typedef struct _GParamSpecString    GParamSpecString;
86 typedef struct _GParamSpecParam     GParamSpecParam;
87 typedef struct _GParamSpecPointer   GParamSpecPointer;
88 typedef struct _GParamSpecCCallback GParamSpecCCallback;
89 typedef struct _GParamSpecBoxed     GParamSpecBoxed;
90 typedef struct _GParamSpecObject    GParamSpecObject;
91 struct _GParamSpecChar
92 {
93   GParamSpec    parent_instance;
94   
95   gint8         minimum;
96   gint8         maximum;
97   gint8         default_value;
98 };
99 struct _GParamSpecUChar
100 {
101   GParamSpec    parent_instance;
102   
103   guint8        minimum;
104   guint8        maximum;
105   guint8        default_value;
106 };
107 struct _GParamSpecBoolean
108 {
109   GParamSpec    parent_instance;
110   
111   gboolean      default_value;
112 };
113 struct _GParamSpecInt
114 {
115   GParamSpec    parent_instance;
116   
117   gint          minimum;
118   gint          maximum;
119   gint          default_value;
120 };
121 struct _GParamSpecUInt
122 {
123   GParamSpec    parent_instance;
124   
125   guint         minimum;
126   guint         maximum;
127   guint         default_value;
128 };
129 struct _GParamSpecLong
130 {
131   GParamSpec    parent_instance;
132   
133   glong         minimum;
134   glong         maximum;
135   glong         default_value;
136 };
137 struct _GParamSpecULong
138 {
139   GParamSpec    parent_instance;
140   
141   gulong        minimum;
142   gulong        maximum;
143   gulong        default_value;
144 };
145 struct _GParamSpecEnum
146 {
147   GParamSpec    parent_instance;
148   
149   GEnumClass   *enum_class;
150   glong         default_value;
151 };
152 struct _GParamSpecFlags
153 {
154   GParamSpec    parent_instance;
155   
156   GFlagsClass  *flags_class;
157   gulong        default_value;
158 };
159 struct _GParamSpecFloat
160 {
161   GParamSpec    parent_instance;
162   
163   gfloat        minimum;
164   gfloat        maximum;
165   gfloat        default_value;
166   gfloat        epsilon;
167 };
168 struct _GParamSpecDouble
169 {
170   GParamSpec    parent_instance;
171   
172   gdouble       minimum;
173   gdouble       maximum;
174   gdouble       default_value;
175   gdouble       epsilon;
176 };
177 struct _GParamSpecString
178 {
179   GParamSpec    parent_instance;
180   
181   gchar        *default_value;
182   gchar        *cset_first;
183   gchar        *cset_nth;
184   gchar         substitutor;
185   guint         null_fold_if_empty : 1;
186   guint         ensure_non_null : 1;
187 };
188 struct _GParamSpecParam
189 {
190   GParamSpec    parent_instance;
191 };
192 struct _GParamSpecPointer
193 {
194   GParamSpec    parent_instance;
195 };
196 struct _GParamSpecCCallback
197 {
198   GParamSpec    parent_instance;
199 };
200 struct _GParamSpecBoxed
201 {
202   GParamSpec    parent_instance;
203 };
204 struct _GParamSpecObject
205 {
206   GParamSpec    parent_instance;
207 };
208
209
210 /* --- GParamSpec prototypes --- */
211 GParamSpec*     g_param_spec_char       (const gchar    *name,
212                                          const gchar    *nick,
213                                          const gchar    *blurb,
214                                          gint8           minimum,
215                                          gint8           maximum,
216                                          gint8           default_value,
217                                          GParamFlags     flags);
218 GParamSpec*     g_param_spec_uchar      (const gchar    *name,
219                                          const gchar    *nick,
220                                          const gchar    *blurb,
221                                          guint8          minimum,
222                                          guint8          maximum,
223                                          guint8          default_value,
224                                          GParamFlags     flags);
225 GParamSpec*     g_param_spec_boolean    (const gchar    *name,
226                                          const gchar    *nick,
227                                          const gchar    *blurb,
228                                          gboolean        default_value,
229                                          GParamFlags     flags);
230 GParamSpec*     g_param_spec_int        (const gchar    *name,
231                                          const gchar    *nick,
232                                          const gchar    *blurb,
233                                          gint            minimum,
234                                          gint            maximum,
235                                          gint            default_value,
236                                          GParamFlags     flags);
237 GParamSpec*     g_param_spec_uint       (const gchar    *name,
238                                          const gchar    *nick,
239                                          const gchar    *blurb,
240                                          guint           minimum,
241                                          guint           maximum,
242                                          guint           default_value,
243                                          GParamFlags     flags);
244 GParamSpec*     g_param_spec_long       (const gchar    *name,
245                                          const gchar    *nick,
246                                          const gchar    *blurb,
247                                          glong           minimum,
248                                          glong           maximum,
249                                          glong           default_value,
250                                          GParamFlags     flags);
251 GParamSpec*     g_param_spec_ulong      (const gchar    *name,
252                                          const gchar    *nick,
253                                          const gchar    *blurb,
254                                          gulong          minimum,
255                                          gulong          maximum,
256                                          gulong          default_value,
257                                          GParamFlags     flags);
258 GParamSpec*     g_param_spec_enum       (const gchar    *name,
259                                          const gchar    *nick,
260                                          const gchar    *blurb,
261                                          GType           enum_type,
262                                          gint            default_value,
263                                          GParamFlags     flags);
264 GParamSpec*     g_param_spec_flags      (const gchar    *name,
265                                          const gchar    *nick,
266                                          const gchar    *blurb,
267                                          GType           flags_type,
268                                          guint           default_value,
269                                          GParamFlags     flags);
270 GParamSpec*     g_param_spec_float      (const gchar    *name,
271                                          const gchar    *nick,
272                                          const gchar    *blurb,
273                                          gfloat          minimum,
274                                          gfloat          maximum,
275                                          gfloat          default_value,
276                                          GParamFlags     flags);
277 GParamSpec*     g_param_spec_double     (const gchar    *name,
278                                          const gchar    *nick,
279                                          const gchar    *blurb,
280                                          gdouble         minimum,
281                                          gdouble         maximum,
282                                          gdouble         default_value,
283                                          GParamFlags     flags);
284 GParamSpec*     g_param_spec_string     (const gchar    *name,
285                                          const gchar    *nick,
286                                          const gchar    *blurb,
287                                          const gchar    *default_value,
288                                          GParamFlags     flags);
289 GParamSpec*     g_param_spec_string_c   (const gchar    *name,
290                                          const gchar    *nick,
291                                          const gchar    *blurb,
292                                          const gchar    *default_value,
293                                          GParamFlags     flags);
294 GParamSpec*     g_param_spec_param      (const gchar    *name,
295                                          const gchar    *nick,
296                                          const gchar    *blurb,
297                                          GType           param_type,
298                                          GParamFlags     flags);
299 GParamSpec*     g_param_spec_pointer    (const gchar    *name,
300                                          const gchar    *nick,
301                                          const gchar    *blurb,
302                                          GParamFlags     flags);
303 GParamSpec*     g_param_spec_ccallback  (const gchar    *name,
304                                          const gchar    *nick,
305                                          const gchar    *blurb,
306                                          GParamFlags     flags);
307 GParamSpec*     g_param_spec_boxed      (const gchar    *name,
308                                          const gchar    *nick,
309                                          const gchar    *blurb,
310                                          GType           boxed_type,
311                                          GParamFlags     flags);
312 GParamSpec*     g_param_spec_object     (const gchar    *name,
313                                          const gchar    *nick,
314                                          const gchar    *blurb,
315                                          GType           object_type,
316                                          GParamFlags     flags);
317
318
319 #ifdef __cplusplus
320 }
321 #endif /* __cplusplus */
322
323 #endif /* __G_PARAMSPECS_H__ */