1 /* GObject - GLib Type, Object, Parameter and Signal Library
2 * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
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.
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.
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.
19 * gparamspecs.h: GLib default param specs
21 #ifndef __G_PARAMSPECS_H__
22 #define __G_PARAMSPECS_H__
25 #include <gobject/gvalue.h>
26 #include <gobject/genums.h>
27 #include <gobject/gboxed.h>
28 #include <gobject/gobject.h>
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_UNICHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UNICHAR, GParamSpecUnichar))
47 #define G_IS_PARAM_SPEC_UNICHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UNICHAR))
48 #define G_PARAM_SPEC_ULONG(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ULONG, GParamSpecULong))
49 #define G_IS_PARAM_SPEC_ENUM(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ENUM))
50 #define G_PARAM_SPEC_ENUM(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ENUM, GParamSpecEnum))
51 #define G_IS_PARAM_SPEC_FLAGS(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLAGS))
52 #define G_PARAM_SPEC_FLAGS(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLAGS, GParamSpecFlags))
53 #define G_IS_PARAM_SPEC_FLOAT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLOAT))
54 #define G_PARAM_SPEC_FLOAT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLOAT, GParamSpecFloat))
55 #define G_IS_PARAM_SPEC_DOUBLE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_DOUBLE))
56 #define G_PARAM_SPEC_DOUBLE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_DOUBLE, GParamSpecDouble))
57 #define G_IS_PARAM_SPEC_STRING(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_STRING))
58 #define G_PARAM_SPEC_STRING(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_STRING, GParamSpecString))
59 #define G_IS_PARAM_SPEC_PARAM(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_PARAM))
60 #define G_PARAM_SPEC_PARAM(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_PARAM, GParamSpecParam))
61 #define G_IS_PARAM_SPEC_BOXED(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOXED))
62 #define G_PARAM_SPEC_BOXED(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOXED, GParamSpecBoxed))
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_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_VALUE_ARRAY))
66 #define G_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_VALUE_ARRAY, GParamSpecValueArray))
67 #define G_IS_PARAM_SPEC_CLOSURE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_CLOSURE))
68 #define G_PARAM_SPEC_CLOSURE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_CLOSURE, GParamSpecClosure))
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))
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 _GParamSpecUnichar GParamSpecUnichar;
82 typedef struct _GParamSpecEnum GParamSpecEnum;
83 typedef struct _GParamSpecFlags GParamSpecFlags;
84 typedef struct _GParamSpecFloat GParamSpecFloat;
85 typedef struct _GParamSpecDouble GParamSpecDouble;
86 typedef struct _GParamSpecString GParamSpecString;
87 typedef struct _GParamSpecParam GParamSpecParam;
88 typedef struct _GParamSpecBoxed GParamSpecBoxed;
89 typedef struct _GParamSpecPointer GParamSpecPointer;
90 typedef struct _GParamSpecValueArray GParamSpecValueArray;
91 typedef struct _GParamSpecClosure GParamSpecClosure;
92 typedef struct _GParamSpecObject GParamSpecObject;
94 typedef struct _GParamSpecInt64 GParamSpecInt64;
95 typedef struct _GParamSpecUInt64 GParamSpecUInt64;
96 #endif /* G_HAVE_GINT64 */
98 struct _GParamSpecChar
100 GParamSpec parent_instance;
106 struct _GParamSpecUChar
108 GParamSpec parent_instance;
112 guint8 default_value;
114 struct _GParamSpecBoolean
116 GParamSpec parent_instance;
118 gboolean default_value;
120 struct _GParamSpecInt
122 GParamSpec parent_instance;
128 struct _GParamSpecUInt
130 GParamSpec parent_instance;
136 struct _GParamSpecLong
138 GParamSpec parent_instance;
144 struct _GParamSpecULong
146 GParamSpec parent_instance;
150 gulong default_value;
152 struct _GParamSpecUnichar
154 GParamSpec parent_instance;
156 gunichar default_value;
158 struct _GParamSpecEnum
160 GParamSpec parent_instance;
162 GEnumClass *enum_class;
165 struct _GParamSpecFlags
167 GParamSpec parent_instance;
169 GFlagsClass *flags_class;
172 struct _GParamSpecFloat
174 GParamSpec parent_instance;
178 gfloat default_value;
181 struct _GParamSpecDouble
183 GParamSpec parent_instance;
187 gdouble default_value;
190 struct _GParamSpecString
192 GParamSpec parent_instance;
194 gchar *default_value;
198 guint null_fold_if_empty : 1;
199 guint ensure_non_null : 1;
201 struct _GParamSpecParam
203 GParamSpec parent_instance;
205 struct _GParamSpecBoxed
207 GParamSpec parent_instance;
209 struct _GParamSpecPointer
211 GParamSpec parent_instance;
213 struct _GParamSpecValueArray
215 GParamSpec parent_instance;
216 GParamSpec *element_spec;
217 guint fixed_n_elements;
219 struct _GParamSpecClosure
221 GParamSpec parent_instance;
223 struct _GParamSpecObject
225 GParamSpec parent_instance;
228 struct _GParamSpecInt64
230 GParamSpec parent_instance;
234 gint64 default_value;
236 struct _GParamSpecUInt64
238 GParamSpec parent_instance;
242 guint64 default_value;
244 #endif /* G_HAVE_GINT64 */
246 /* --- GParamSpec prototypes --- */
247 GParamSpec* g_param_spec_char (const gchar *name,
254 GParamSpec* g_param_spec_uchar (const gchar *name,
259 guint8 default_value,
261 GParamSpec* g_param_spec_boolean (const gchar *name,
264 gboolean default_value,
266 GParamSpec* g_param_spec_int (const gchar *name,
273 GParamSpec* g_param_spec_uint (const gchar *name,
280 GParamSpec* g_param_spec_long (const gchar *name,
287 GParamSpec* g_param_spec_ulong (const gchar *name,
292 gulong default_value,
294 GParamSpec* g_param_spec_unichar (const gchar *name,
297 gunichar default_value,
299 GParamSpec* g_param_spec_enum (const gchar *name,
305 GParamSpec* g_param_spec_flags (const gchar *name,
311 GParamSpec* g_param_spec_float (const gchar *name,
316 gfloat default_value,
318 GParamSpec* g_param_spec_double (const gchar *name,
323 gdouble default_value,
325 GParamSpec* g_param_spec_string (const gchar *name,
328 const gchar *default_value,
330 GParamSpec* g_param_spec_param (const gchar *name,
335 GParamSpec* g_param_spec_boxed (const gchar *name,
340 GParamSpec* g_param_spec_pointer (const gchar *name,
344 GParamSpec* g_param_spec_value_array (const gchar *name,
347 GParamSpec *element_spec,
349 GParamSpec* g_param_spec_closure (const gchar *name,
353 GParamSpec* g_param_spec_object (const gchar *name,
358 GParamSpec* g_param_spec_int64 (const gchar *name,
363 gint64 default_value,
365 GParamSpec* g_param_spec_uint64 (const gchar *name,
370 guint64 default_value,
376 #endif /* __G_PARAMSPECS_H__ */