add a new param spec to handle interfaces.
[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 #define G_IS_PARAM_SPEC_INTERFACE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INTERFACE))
72 #define G_PARAM_SPEC_INTERFACE(pspec)    (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INTERFACE, GParamSpecInterface))
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 _GParamSpecEnum      GParamSpecEnum;
84 typedef struct _GParamSpecFlags     GParamSpecFlags;
85 typedef struct _GParamSpecFloat     GParamSpecFloat;
86 typedef struct _GParamSpecDouble    GParamSpecDouble;
87 typedef struct _GParamSpecString    GParamSpecString;
88 typedef struct _GParamSpecParam     GParamSpecParam;
89 typedef struct _GParamSpecPointer   GParamSpecPointer;
90 typedef struct _GParamSpecCCallback GParamSpecCCallback;
91 typedef struct _GParamSpecBoxed     GParamSpecBoxed;
92 typedef struct _GParamSpecObject    GParamSpecObject;
93 typedef struct _GParamSpecInterface GParamSpecInterface;
94 struct _GParamSpecChar
95 {
96   GParamSpec    parent_instance;
97   
98   gint8         minimum;
99   gint8         maximum;
100   gint8         default_value;
101 };
102 struct _GParamSpecUChar
103 {
104   GParamSpec    parent_instance;
105   
106   guint8        minimum;
107   guint8        maximum;
108   guint8        default_value;
109 };
110 struct _GParamSpecBoolean
111 {
112   GParamSpec    parent_instance;
113   
114   gboolean      default_value;
115 };
116 struct _GParamSpecInt
117 {
118   GParamSpec    parent_instance;
119   
120   gint          minimum;
121   gint          maximum;
122   gint          default_value;
123 };
124 struct _GParamSpecUInt
125 {
126   GParamSpec    parent_instance;
127   
128   guint         minimum;
129   guint         maximum;
130   guint         default_value;
131 };
132 struct _GParamSpecLong
133 {
134   GParamSpec    parent_instance;
135   
136   glong         minimum;
137   glong         maximum;
138   glong         default_value;
139 };
140 struct _GParamSpecULong
141 {
142   GParamSpec    parent_instance;
143   
144   gulong        minimum;
145   gulong        maximum;
146   gulong        default_value;
147 };
148 struct _GParamSpecEnum
149 {
150   GParamSpec    parent_instance;
151   
152   GEnumClass   *enum_class;
153   glong         default_value;
154 };
155 struct _GParamSpecFlags
156 {
157   GParamSpec    parent_instance;
158   
159   GFlagsClass  *flags_class;
160   gulong        default_value;
161 };
162 struct _GParamSpecFloat
163 {
164   GParamSpec    parent_instance;
165   
166   gfloat        minimum;
167   gfloat        maximum;
168   gfloat        default_value;
169   gfloat        epsilon;
170 };
171 struct _GParamSpecDouble
172 {
173   GParamSpec    parent_instance;
174   
175   gdouble       minimum;
176   gdouble       maximum;
177   gdouble       default_value;
178   gdouble       epsilon;
179 };
180 struct _GParamSpecString
181 {
182   GParamSpec    parent_instance;
183   
184   gchar        *default_value;
185   gchar        *cset_first;
186   gchar        *cset_nth;
187   gchar         substitutor;
188   guint         null_fold_if_empty : 1;
189   guint         ensure_non_null : 1;
190 };
191 struct _GParamSpecParam
192 {
193   GParamSpec    parent_instance;
194 };
195 struct _GParamSpecPointer
196 {
197   GParamSpec    parent_instance;
198 };
199 struct _GParamSpecCCallback
200 {
201   GParamSpec    parent_instance;
202 };
203 struct _GParamSpecBoxed
204 {
205   GParamSpec    parent_instance;
206 };
207 struct _GParamSpecObject
208 {
209   GParamSpec    parent_instance;
210 };
211 struct _GParamSpecInterface
212 {
213   GParamSpec    parent_instance;
214 };
215
216
217 /* --- GParamSpec prototypes --- */
218 GParamSpec*     g_param_spec_char       (const gchar    *name,
219                                          const gchar    *nick,
220                                          const gchar    *blurb,
221                                          gint8           minimum,
222                                          gint8           maximum,
223                                          gint8           default_value,
224                                          GParamFlags     flags);
225 GParamSpec*     g_param_spec_uchar      (const gchar    *name,
226                                          const gchar    *nick,
227                                          const gchar    *blurb,
228                                          guint8          minimum,
229                                          guint8          maximum,
230                                          guint8          default_value,
231                                          GParamFlags     flags);
232 GParamSpec*     g_param_spec_boolean    (const gchar    *name,
233                                          const gchar    *nick,
234                                          const gchar    *blurb,
235                                          gboolean        default_value,
236                                          GParamFlags     flags);
237 GParamSpec*     g_param_spec_int        (const gchar    *name,
238                                          const gchar    *nick,
239                                          const gchar    *blurb,
240                                          gint            minimum,
241                                          gint            maximum,
242                                          gint            default_value,
243                                          GParamFlags     flags);
244 GParamSpec*     g_param_spec_uint       (const gchar    *name,
245                                          const gchar    *nick,
246                                          const gchar    *blurb,
247                                          guint           minimum,
248                                          guint           maximum,
249                                          guint           default_value,
250                                          GParamFlags     flags);
251 GParamSpec*     g_param_spec_long       (const gchar    *name,
252                                          const gchar    *nick,
253                                          const gchar    *blurb,
254                                          glong           minimum,
255                                          glong           maximum,
256                                          glong           default_value,
257                                          GParamFlags     flags);
258 GParamSpec*     g_param_spec_ulong      (const gchar    *name,
259                                          const gchar    *nick,
260                                          const gchar    *blurb,
261                                          gulong          minimum,
262                                          gulong          maximum,
263                                          gulong          default_value,
264                                          GParamFlags     flags);
265 GParamSpec*     g_param_spec_enum       (const gchar    *name,
266                                          const gchar    *nick,
267                                          const gchar    *blurb,
268                                          GType           enum_type,
269                                          gint            default_value,
270                                          GParamFlags     flags);
271 GParamSpec*     g_param_spec_flags      (const gchar    *name,
272                                          const gchar    *nick,
273                                          const gchar    *blurb,
274                                          GType           flags_type,
275                                          guint           default_value,
276                                          GParamFlags     flags);
277 GParamSpec*     g_param_spec_float      (const gchar    *name,
278                                          const gchar    *nick,
279                                          const gchar    *blurb,
280                                          gfloat          minimum,
281                                          gfloat          maximum,
282                                          gfloat          default_value,
283                                          GParamFlags     flags);
284 GParamSpec*     g_param_spec_double     (const gchar    *name,
285                                          const gchar    *nick,
286                                          const gchar    *blurb,
287                                          gdouble         minimum,
288                                          gdouble         maximum,
289                                          gdouble         default_value,
290                                          GParamFlags     flags);
291 GParamSpec*     g_param_spec_string     (const gchar    *name,
292                                          const gchar    *nick,
293                                          const gchar    *blurb,
294                                          const gchar    *default_value,
295                                          GParamFlags     flags);
296 GParamSpec*     g_param_spec_string_c   (const gchar    *name,
297                                          const gchar    *nick,
298                                          const gchar    *blurb,
299                                          const gchar    *default_value,
300                                          GParamFlags     flags);
301 GParamSpec*     g_param_spec_param      (const gchar    *name,
302                                          const gchar    *nick,
303                                          const gchar    *blurb,
304                                          GType           param_type,
305                                          GParamFlags     flags);
306 GParamSpec*     g_param_spec_pointer    (const gchar    *name,
307                                          const gchar    *nick,
308                                          const gchar    *blurb,
309                                          GParamFlags     flags);
310 GParamSpec*     g_param_spec_ccallback  (const gchar    *name,
311                                          const gchar    *nick,
312                                          const gchar    *blurb,
313                                          GParamFlags     flags);
314 GParamSpec*     g_param_spec_boxed      (const gchar    *name,
315                                          const gchar    *nick,
316                                          const gchar    *blurb,
317                                          GType           boxed_type,
318                                          GParamFlags     flags);
319 GParamSpec*     g_param_spec_object     (const gchar    *name,
320                                          const gchar    *nick,
321                                          const gchar    *blurb,
322                                          GType           object_type,
323                                          GParamFlags     flags);
324 GParamSpec*     g_param_spec_interface  (const gchar    *name,
325                                          const gchar    *nick,
326                                          const gchar    *blurb,
327                                          GType           object_type,
328                                          GParamFlags     flags);
329
330
331 #ifdef __cplusplus
332 }
333 #endif /* __cplusplus */
334
335 #endif /* __G_PARAMSPECS_H__ */