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