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