urg managed to forget this last time ;(
[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   GType         param_type;
193 };
194 struct _GParamSpecPointer
195 {
196   GParamSpec    parent_instance;
197 };
198 struct _GParamSpecCCallback
199 {
200   GParamSpec    parent_instance;
201 };
202 struct _GParamSpecBoxed
203 {
204   GParamSpec    parent_instance;
205   
206   GType         boxed_type;
207 };
208 struct _GParamSpecObject
209 {
210   GParamSpec    parent_instance;
211   
212   GType         object_type;
213 };
214
215
216 /* --- GParamSpec prototypes --- */
217 GParamSpec*     g_param_spec_char       (const gchar    *name,
218                                          const gchar    *nick,
219                                          const gchar    *blurb,
220                                          gint8           minimum,
221                                          gint8           maximum,
222                                          gint8           default_value,
223                                          GParamFlags     flags);
224 GParamSpec*     g_param_spec_uchar      (const gchar    *name,
225                                          const gchar    *nick,
226                                          const gchar    *blurb,
227                                          guint8          minimum,
228                                          guint8          maximum,
229                                          guint8          default_value,
230                                          GParamFlags     flags);
231 GParamSpec*     g_param_spec_boolean    (const gchar    *name,
232                                          const gchar    *nick,
233                                          const gchar    *blurb,
234                                          gboolean        default_value,
235                                          GParamFlags     flags);
236 GParamSpec*     g_param_spec_int        (const gchar    *name,
237                                          const gchar    *nick,
238                                          const gchar    *blurb,
239                                          gint            minimum,
240                                          gint            maximum,
241                                          gint            default_value,
242                                          GParamFlags     flags);
243 GParamSpec*     g_param_spec_uint       (const gchar    *name,
244                                          const gchar    *nick,
245                                          const gchar    *blurb,
246                                          guint           minimum,
247                                          guint           maximum,
248                                          guint           default_value,
249                                          GParamFlags     flags);
250 GParamSpec*     g_param_spec_long       (const gchar    *name,
251                                          const gchar    *nick,
252                                          const gchar    *blurb,
253                                          glong           minimum,
254                                          glong           maximum,
255                                          glong           default_value,
256                                          GParamFlags     flags);
257 GParamSpec*     g_param_spec_ulong      (const gchar    *name,
258                                          const gchar    *nick,
259                                          const gchar    *blurb,
260                                          gulong          minimum,
261                                          gulong          maximum,
262                                          gulong          default_value,
263                                          GParamFlags     flags);
264 GParamSpec*     g_param_spec_enum       (const gchar    *name,
265                                          const gchar    *nick,
266                                          const gchar    *blurb,
267                                          GType           enum_type,
268                                          gint            default_value,
269                                          GParamFlags     flags);
270 GParamSpec*     g_param_spec_flags      (const gchar    *name,
271                                          const gchar    *nick,
272                                          const gchar    *blurb,
273                                          GType           flags_type,
274                                          guint           default_value,
275                                          GParamFlags     flags);
276 GParamSpec*     g_param_spec_float      (const gchar    *name,
277                                          const gchar    *nick,
278                                          const gchar    *blurb,
279                                          gfloat          minimum,
280                                          gfloat          maximum,
281                                          gfloat          default_value,
282                                          GParamFlags     flags);
283 GParamSpec*     g_param_spec_double     (const gchar    *name,
284                                          const gchar    *nick,
285                                          const gchar    *blurb,
286                                          gdouble         minimum,
287                                          gdouble         maximum,
288                                          gdouble         default_value,
289                                          GParamFlags     flags);
290 GParamSpec*     g_param_spec_string     (const gchar    *name,
291                                          const gchar    *nick,
292                                          const gchar    *blurb,
293                                          const gchar    *default_value,
294                                          GParamFlags     flags);
295 GParamSpec*     g_param_spec_string_c   (const gchar    *name,
296                                          const gchar    *nick,
297                                          const gchar    *blurb,
298                                          const gchar    *default_value,
299                                          GParamFlags     flags);
300 GParamSpec*     g_param_spec_param      (const gchar    *name,
301                                          const gchar    *nick,
302                                          const gchar    *blurb,
303                                          GType           param_type,
304                                          GParamFlags     flags);
305 GParamSpec*     g_param_spec_pointer    (const gchar    *name,
306                                          const gchar    *nick,
307                                          const gchar    *blurb,
308                                          GParamFlags     flags);
309 GParamSpec*     g_param_spec_ccallback  (const gchar    *name,
310                                          const gchar    *nick,
311                                          const gchar    *blurb,
312                                          GParamFlags     flags);
313 GParamSpec*     g_param_spec_boxed      (const gchar    *name,
314                                          const gchar    *nick,
315                                          const gchar    *blurb,
316                                          GType           boxed_type,
317                                          GParamFlags     flags);
318 GParamSpec*     g_param_spec_object     (const gchar    *name,
319                                          const gchar    *nick,
320                                          const gchar    *blurb,
321                                          GType           object_type,
322                                          GParamFlags     flags);
323
324
325 #ifdef __cplusplus
326 }
327 #endif /* __cplusplus */
328
329 #endif /* __G_PARAMSPECS_H__ */