add API for chaining: g_signal_chain_from_overridden() and
[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_INT64(pspec)        (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT64))
48 #define G_PARAM_SPEC_INT64(pspec)           (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT64, GParamSpecInt64))
49 #define G_IS_PARAM_SPEC_UINT64(pspec)       (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT64))
50 #define G_PARAM_SPEC_UINT64(pspec)          (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT64, GParamSpecUInt64))
51 #define G_PARAM_SPEC_UNICHAR(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UNICHAR, GParamSpecUnichar))
52 #define G_IS_PARAM_SPEC_UNICHAR(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UNICHAR))
53 #define G_IS_PARAM_SPEC_ENUM(pspec)        (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ENUM))
54 #define G_PARAM_SPEC_ENUM(pspec)           (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ENUM, GParamSpecEnum))
55 #define G_IS_PARAM_SPEC_FLAGS(pspec)       (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLAGS))
56 #define G_PARAM_SPEC_FLAGS(pspec)          (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLAGS, GParamSpecFlags))
57 #define G_IS_PARAM_SPEC_FLOAT(pspec)       (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLOAT))
58 #define G_PARAM_SPEC_FLOAT(pspec)          (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLOAT, GParamSpecFloat))
59 #define G_IS_PARAM_SPEC_DOUBLE(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_DOUBLE))
60 #define G_PARAM_SPEC_DOUBLE(pspec)         (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_DOUBLE, GParamSpecDouble))
61 #define G_IS_PARAM_SPEC_STRING(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_STRING))
62 #define G_PARAM_SPEC_STRING(pspec)         (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_STRING, GParamSpecString))
63 #define G_IS_PARAM_SPEC_PARAM(pspec)       (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_PARAM))
64 #define G_PARAM_SPEC_PARAM(pspec)          (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_PARAM, GParamSpecParam))
65 #define G_IS_PARAM_SPEC_BOXED(pspec)       (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOXED))
66 #define G_PARAM_SPEC_BOXED(pspec)          (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOXED, GParamSpecBoxed))
67 #define G_IS_PARAM_SPEC_POINTER(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_POINTER))
68 #define G_PARAM_SPEC_POINTER(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_POINTER, GParamSpecPointer))
69 #define G_IS_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_VALUE_ARRAY))
70 #define G_PARAM_SPEC_VALUE_ARRAY(pspec)    (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_VALUE_ARRAY, GParamSpecValueArray))
71 #define G_IS_PARAM_SPEC_OBJECT(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_OBJECT))
72 #define G_PARAM_SPEC_OBJECT(pspec)         (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_OBJECT, GParamSpecObject))
73
74
75 /* --- typedefs & structures --- */
76 typedef struct _GParamSpecChar       GParamSpecChar;
77 typedef struct _GParamSpecUChar      GParamSpecUChar;
78 typedef struct _GParamSpecBoolean    GParamSpecBoolean;
79 typedef struct _GParamSpecInt        GParamSpecInt;
80 typedef struct _GParamSpecUInt       GParamSpecUInt;
81 typedef struct _GParamSpecLong       GParamSpecLong;
82 typedef struct _GParamSpecULong      GParamSpecULong;
83 typedef struct _GParamSpecInt64      GParamSpecInt64;
84 typedef struct _GParamSpecUInt64     GParamSpecUInt64;
85 typedef struct _GParamSpecUnichar    GParamSpecUnichar;
86 typedef struct _GParamSpecEnum       GParamSpecEnum;
87 typedef struct _GParamSpecFlags      GParamSpecFlags;
88 typedef struct _GParamSpecFloat      GParamSpecFloat;
89 typedef struct _GParamSpecDouble     GParamSpecDouble;
90 typedef struct _GParamSpecString     GParamSpecString;
91 typedef struct _GParamSpecParam      GParamSpecParam;
92 typedef struct _GParamSpecBoxed      GParamSpecBoxed;
93 typedef struct _GParamSpecPointer    GParamSpecPointer;
94 typedef struct _GParamSpecValueArray GParamSpecValueArray;
95 typedef struct _GParamSpecObject     GParamSpecObject;
96
97 struct _GParamSpecChar
98 {
99   GParamSpec    parent_instance;
100   
101   gint8         minimum;
102   gint8         maximum;
103   gint8         default_value;
104 };
105 struct _GParamSpecUChar
106 {
107   GParamSpec    parent_instance;
108   
109   guint8        minimum;
110   guint8        maximum;
111   guint8        default_value;
112 };
113 struct _GParamSpecBoolean
114 {
115   GParamSpec    parent_instance;
116   
117   gboolean      default_value;
118 };
119 struct _GParamSpecInt
120 {
121   GParamSpec    parent_instance;
122   
123   gint          minimum;
124   gint          maximum;
125   gint          default_value;
126 };
127 struct _GParamSpecUInt
128 {
129   GParamSpec    parent_instance;
130   
131   guint         minimum;
132   guint         maximum;
133   guint         default_value;
134 };
135 struct _GParamSpecLong
136 {
137   GParamSpec    parent_instance;
138   
139   glong         minimum;
140   glong         maximum;
141   glong         default_value;
142 };
143 struct _GParamSpecULong
144 {
145   GParamSpec    parent_instance;
146   
147   gulong        minimum;
148   gulong        maximum;
149   gulong        default_value;
150 };
151 struct _GParamSpecInt64
152 {
153   GParamSpec    parent_instance;
154   
155   gint64        minimum;
156   gint64        maximum;
157   gint64        default_value;
158 };
159 struct _GParamSpecUInt64
160 {
161   GParamSpec    parent_instance;
162   
163   guint64       minimum;
164   guint64       maximum;
165   guint64       default_value;
166 };
167 struct _GParamSpecUnichar
168 {
169   GParamSpec    parent_instance;
170   
171   gunichar      default_value;
172 };
173 struct _GParamSpecEnum
174 {
175   GParamSpec    parent_instance;
176   
177   GEnumClass   *enum_class;
178   gint          default_value;
179 };
180 struct _GParamSpecFlags
181 {
182   GParamSpec    parent_instance;
183   
184   GFlagsClass  *flags_class;
185   guint         default_value;
186 };
187 struct _GParamSpecFloat
188 {
189   GParamSpec    parent_instance;
190   
191   gfloat        minimum;
192   gfloat        maximum;
193   gfloat        default_value;
194   gfloat        epsilon;
195 };
196 struct _GParamSpecDouble
197 {
198   GParamSpec    parent_instance;
199   
200   gdouble       minimum;
201   gdouble       maximum;
202   gdouble       default_value;
203   gdouble       epsilon;
204 };
205 struct _GParamSpecString
206 {
207   GParamSpec    parent_instance;
208   
209   gchar        *default_value;
210   gchar        *cset_first;
211   gchar        *cset_nth;
212   gchar         substitutor;
213   guint         null_fold_if_empty : 1;
214   guint         ensure_non_null : 1;
215 };
216 struct _GParamSpecParam
217 {
218   GParamSpec    parent_instance;
219 };
220 struct _GParamSpecBoxed
221 {
222   GParamSpec    parent_instance;
223 };
224 struct _GParamSpecPointer
225 {
226   GParamSpec    parent_instance;
227 };
228 struct _GParamSpecValueArray
229 {
230   GParamSpec    parent_instance;
231   GParamSpec   *element_spec;
232   guint         fixed_n_elements;
233 };
234 struct _GParamSpecObject
235 {
236   GParamSpec    parent_instance;
237 };
238
239 /* --- GParamSpec prototypes --- */
240 GParamSpec*     g_param_spec_char        (const gchar    *name,
241                                           const gchar    *nick,
242                                           const gchar    *blurb,
243                                           gint8           minimum,
244                                           gint8           maximum,
245                                           gint8           default_value,
246                                           GParamFlags     flags);
247 GParamSpec*     g_param_spec_uchar       (const gchar    *name,
248                                           const gchar    *nick,
249                                           const gchar    *blurb,
250                                           guint8          minimum,
251                                           guint8          maximum,
252                                           guint8          default_value,
253                                           GParamFlags     flags);
254 GParamSpec*     g_param_spec_boolean     (const gchar    *name,
255                                           const gchar    *nick,
256                                           const gchar    *blurb,
257                                           gboolean        default_value,
258                                           GParamFlags     flags);
259 GParamSpec*     g_param_spec_int         (const gchar    *name,
260                                           const gchar    *nick,
261                                           const gchar    *blurb,
262                                           gint            minimum,
263                                           gint            maximum,
264                                           gint            default_value,
265                                           GParamFlags     flags);
266 GParamSpec*     g_param_spec_uint        (const gchar    *name,
267                                           const gchar    *nick,
268                                           const gchar    *blurb,
269                                           guint           minimum,
270                                           guint           maximum,
271                                           guint           default_value,
272                                           GParamFlags     flags);
273 GParamSpec*     g_param_spec_long        (const gchar    *name,
274                                           const gchar    *nick,
275                                           const gchar    *blurb,
276                                           glong           minimum,
277                                           glong           maximum,
278                                           glong           default_value,
279                                           GParamFlags     flags);
280 GParamSpec*     g_param_spec_ulong       (const gchar    *name,
281                                           const gchar    *nick,
282                                           const gchar    *blurb,
283                                           gulong          minimum,
284                                           gulong          maximum,
285                                           gulong          default_value,
286                                           GParamFlags     flags);
287 GParamSpec*     g_param_spec_int64       (const gchar    *name,
288                                           const gchar    *nick,
289                                           const gchar    *blurb,
290                                           gint64          minimum,
291                                           gint64          maximum,
292                                           gint64          default_value,
293                                           GParamFlags     flags);
294 GParamSpec*     g_param_spec_uint64      (const gchar    *name,
295                                           const gchar    *nick,
296                                           const gchar    *blurb,
297                                           guint64         minimum,
298                                           guint64         maximum,
299                                           guint64         default_value,
300                                           GParamFlags     flags);
301 GParamSpec*    g_param_spec_unichar      (const gchar    *name,
302                                           const gchar    *nick,
303                                           const gchar    *blurb,
304                                           gunichar        default_value,
305                                           GParamFlags     flags);
306 GParamSpec*     g_param_spec_enum        (const gchar    *name,
307                                           const gchar    *nick,
308                                           const gchar    *blurb,
309                                           GType           enum_type,
310                                           gint            default_value,
311                                           GParamFlags     flags);
312 GParamSpec*     g_param_spec_flags       (const gchar    *name,
313                                           const gchar    *nick,
314                                           const gchar    *blurb,
315                                           GType           flags_type,
316                                           guint           default_value,
317                                           GParamFlags     flags);
318 GParamSpec*     g_param_spec_float       (const gchar    *name,
319                                           const gchar    *nick,
320                                           const gchar    *blurb,
321                                           gfloat          minimum,
322                                           gfloat          maximum,
323                                           gfloat          default_value,
324                                           GParamFlags     flags);
325 GParamSpec*     g_param_spec_double      (const gchar    *name,
326                                           const gchar    *nick,
327                                           const gchar    *blurb,
328                                           gdouble         minimum,
329                                           gdouble         maximum,
330                                           gdouble         default_value,
331                                           GParamFlags     flags);
332 GParamSpec*     g_param_spec_string      (const gchar    *name,
333                                           const gchar    *nick,
334                                           const gchar    *blurb,
335                                           const gchar    *default_value,
336                                           GParamFlags     flags);
337 GParamSpec*     g_param_spec_param       (const gchar    *name,
338                                           const gchar    *nick,
339                                           const gchar    *blurb,
340                                           GType           param_type,
341                                           GParamFlags     flags);
342 GParamSpec*     g_param_spec_boxed       (const gchar    *name,
343                                           const gchar    *nick,
344                                           const gchar    *blurb,
345                                           GType           boxed_type,
346                                           GParamFlags     flags);
347 GParamSpec*     g_param_spec_pointer     (const gchar    *name,
348                                           const gchar    *nick,
349                                           const gchar    *blurb,
350                                           GParamFlags     flags);
351 GParamSpec*     g_param_spec_value_array (const gchar    *name,
352                                           const gchar    *nick,
353                                           const gchar    *blurb,
354                                           GParamSpec     *element_spec,
355                                           GParamFlags     flags);
356 GParamSpec*     g_param_spec_object      (const gchar    *name,
357                                           const gchar    *nick,
358                                           const gchar    *blurb,
359                                           GType           object_type,
360                                           GParamFlags     flags);
361
362 G_END_DECLS
363
364 #endif /* __G_PARAMSPECS_H__ */