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 #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
22 #error "Only <glib-object.h> can be included directly."
25 #ifndef __G_PARAMSPECS_H__
26 #define __G_PARAMSPECS_H__
28 #include <gobject/gvalue.h>
29 #include <gobject/genums.h>
30 #include <gobject/gboxed.h>
31 #include <gobject/gobject.h>
35 /* --- type macros --- */
36 #define G_TYPE_PARAM_CHAR (g_param_spec_types[0])
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_TYPE_PARAM_UCHAR (g_param_spec_types[1])
40 #define G_IS_PARAM_SPEC_UCHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UCHAR))
41 #define G_PARAM_SPEC_UCHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UCHAR, GParamSpecUChar))
42 #define G_TYPE_PARAM_BOOLEAN (g_param_spec_types[2])
43 #define G_IS_PARAM_SPEC_BOOLEAN(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOOLEAN))
44 #define G_PARAM_SPEC_BOOLEAN(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOOLEAN, GParamSpecBoolean))
45 #define G_TYPE_PARAM_INT (g_param_spec_types[3])
46 #define G_IS_PARAM_SPEC_INT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT))
47 #define G_PARAM_SPEC_INT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT, GParamSpecInt))
48 #define G_TYPE_PARAM_UINT (g_param_spec_types[4])
49 #define G_IS_PARAM_SPEC_UINT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT))
50 #define G_PARAM_SPEC_UINT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT, GParamSpecUInt))
51 #define G_TYPE_PARAM_LONG (g_param_spec_types[5])
52 #define G_IS_PARAM_SPEC_LONG(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_LONG))
53 #define G_PARAM_SPEC_LONG(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_LONG, GParamSpecLong))
54 #define G_TYPE_PARAM_ULONG (g_param_spec_types[6])
55 #define G_IS_PARAM_SPEC_ULONG(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ULONG))
56 #define G_PARAM_SPEC_ULONG(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ULONG, GParamSpecULong))
57 #define G_TYPE_PARAM_INT64 (g_param_spec_types[7])
58 #define G_IS_PARAM_SPEC_INT64(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT64))
59 #define G_PARAM_SPEC_INT64(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT64, GParamSpecInt64))
60 #define G_TYPE_PARAM_UINT64 (g_param_spec_types[8])
61 #define G_IS_PARAM_SPEC_UINT64(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT64))
62 #define G_PARAM_SPEC_UINT64(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT64, GParamSpecUInt64))
63 #define G_TYPE_PARAM_UNICHAR (g_param_spec_types[9])
64 #define G_PARAM_SPEC_UNICHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UNICHAR, GParamSpecUnichar))
65 #define G_IS_PARAM_SPEC_UNICHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UNICHAR))
66 #define G_TYPE_PARAM_ENUM (g_param_spec_types[10])
67 #define G_IS_PARAM_SPEC_ENUM(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ENUM))
68 #define G_PARAM_SPEC_ENUM(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ENUM, GParamSpecEnum))
69 #define G_TYPE_PARAM_FLAGS (g_param_spec_types[11])
70 #define G_IS_PARAM_SPEC_FLAGS(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLAGS))
71 #define G_PARAM_SPEC_FLAGS(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLAGS, GParamSpecFlags))
72 #define G_TYPE_PARAM_FLOAT (g_param_spec_types[12])
73 #define G_IS_PARAM_SPEC_FLOAT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLOAT))
74 #define G_PARAM_SPEC_FLOAT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLOAT, GParamSpecFloat))
75 #define G_TYPE_PARAM_DOUBLE (g_param_spec_types[13])
76 #define G_IS_PARAM_SPEC_DOUBLE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_DOUBLE))
77 #define G_PARAM_SPEC_DOUBLE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_DOUBLE, GParamSpecDouble))
78 #define G_TYPE_PARAM_STRING (g_param_spec_types[14])
79 #define G_IS_PARAM_SPEC_STRING(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_STRING))
80 #define G_PARAM_SPEC_STRING(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_STRING, GParamSpecString))
81 #define G_TYPE_PARAM_PARAM (g_param_spec_types[15])
82 #define G_IS_PARAM_SPEC_PARAM(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_PARAM))
83 #define G_PARAM_SPEC_PARAM(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_PARAM, GParamSpecParam))
84 #define G_TYPE_PARAM_BOXED (g_param_spec_types[16])
85 #define G_IS_PARAM_SPEC_BOXED(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOXED))
86 #define G_PARAM_SPEC_BOXED(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOXED, GParamSpecBoxed))
87 #define G_TYPE_PARAM_POINTER (g_param_spec_types[17])
88 #define G_IS_PARAM_SPEC_POINTER(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_POINTER))
89 #define G_PARAM_SPEC_POINTER(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_POINTER, GParamSpecPointer))
90 #define G_TYPE_PARAM_VALUE_ARRAY (g_param_spec_types[18])
91 #define G_IS_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_VALUE_ARRAY))
92 #define G_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_VALUE_ARRAY, GParamSpecValueArray))
93 #define G_TYPE_PARAM_OBJECT (g_param_spec_types[19])
94 #define G_IS_PARAM_SPEC_OBJECT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_OBJECT))
95 #define G_PARAM_SPEC_OBJECT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_OBJECT, GParamSpecObject))
96 #define G_TYPE_PARAM_OVERRIDE (g_param_spec_types[20])
97 #define G_IS_PARAM_SPEC_OVERRIDE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_OVERRIDE))
98 #define G_PARAM_SPEC_OVERRIDE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_OVERRIDE, GParamSpecOverride))
99 #define G_TYPE_PARAM_GTYPE (g_param_spec_types[21])
100 #define G_IS_PARAM_SPEC_GTYPE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_GTYPE))
101 #define G_PARAM_SPEC_GTYPE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_GTYPE, GParamSpecGType))
104 /* --- typedefs & structures --- */
105 typedef struct _GParamSpecChar GParamSpecChar;
106 typedef struct _GParamSpecUChar GParamSpecUChar;
107 typedef struct _GParamSpecBoolean GParamSpecBoolean;
108 typedef struct _GParamSpecInt GParamSpecInt;
109 typedef struct _GParamSpecUInt GParamSpecUInt;
110 typedef struct _GParamSpecLong GParamSpecLong;
111 typedef struct _GParamSpecULong GParamSpecULong;
112 typedef struct _GParamSpecInt64 GParamSpecInt64;
113 typedef struct _GParamSpecUInt64 GParamSpecUInt64;
114 typedef struct _GParamSpecUnichar GParamSpecUnichar;
115 typedef struct _GParamSpecEnum GParamSpecEnum;
116 typedef struct _GParamSpecFlags GParamSpecFlags;
117 typedef struct _GParamSpecFloat GParamSpecFloat;
118 typedef struct _GParamSpecDouble GParamSpecDouble;
119 typedef struct _GParamSpecString GParamSpecString;
120 typedef struct _GParamSpecParam GParamSpecParam;
121 typedef struct _GParamSpecBoxed GParamSpecBoxed;
122 typedef struct _GParamSpecPointer GParamSpecPointer;
123 typedef struct _GParamSpecValueArray GParamSpecValueArray;
124 typedef struct _GParamSpecObject GParamSpecObject;
125 typedef struct _GParamSpecOverride GParamSpecOverride;
126 typedef struct _GParamSpecGType GParamSpecGType;
128 struct _GParamSpecChar
130 GParamSpec parent_instance;
136 struct _GParamSpecUChar
138 GParamSpec parent_instance;
142 guint8 default_value;
144 struct _GParamSpecBoolean
146 GParamSpec parent_instance;
148 gboolean default_value;
150 struct _GParamSpecInt
152 GParamSpec parent_instance;
158 struct _GParamSpecUInt
160 GParamSpec parent_instance;
166 struct _GParamSpecLong
168 GParamSpec parent_instance;
174 struct _GParamSpecULong
176 GParamSpec parent_instance;
180 gulong default_value;
182 struct _GParamSpecInt64
184 GParamSpec parent_instance;
188 gint64 default_value;
190 struct _GParamSpecUInt64
192 GParamSpec parent_instance;
196 guint64 default_value;
198 struct _GParamSpecUnichar
200 GParamSpec parent_instance;
202 gunichar default_value;
204 struct _GParamSpecEnum
206 GParamSpec parent_instance;
208 GEnumClass *enum_class;
211 struct _GParamSpecFlags
213 GParamSpec parent_instance;
215 GFlagsClass *flags_class;
218 struct _GParamSpecFloat
220 GParamSpec parent_instance;
224 gfloat default_value;
227 struct _GParamSpecDouble
229 GParamSpec parent_instance;
233 gdouble default_value;
236 struct _GParamSpecString
238 GParamSpec parent_instance;
240 gchar *default_value;
244 guint null_fold_if_empty : 1;
245 guint ensure_non_null : 1;
247 struct _GParamSpecParam
249 GParamSpec parent_instance;
251 struct _GParamSpecBoxed
253 GParamSpec parent_instance;
255 struct _GParamSpecPointer
257 GParamSpec parent_instance;
259 struct _GParamSpecValueArray
261 GParamSpec parent_instance;
262 GParamSpec *element_spec;
263 guint fixed_n_elements;
265 struct _GParamSpecObject
267 GParamSpec parent_instance;
269 struct _GParamSpecOverride
272 GParamSpec parent_instance;
273 GParamSpec *overridden;
275 struct _GParamSpecGType
277 GParamSpec parent_instance;
281 /* --- GParamSpec prototypes --- */
282 GParamSpec* g_param_spec_char (const gchar *name,
289 GParamSpec* g_param_spec_uchar (const gchar *name,
294 guint8 default_value,
296 GParamSpec* g_param_spec_boolean (const gchar *name,
299 gboolean default_value,
301 GParamSpec* g_param_spec_int (const gchar *name,
308 GParamSpec* g_param_spec_uint (const gchar *name,
315 GParamSpec* g_param_spec_long (const gchar *name,
322 GParamSpec* g_param_spec_ulong (const gchar *name,
327 gulong default_value,
329 GParamSpec* g_param_spec_int64 (const gchar *name,
334 gint64 default_value,
336 GParamSpec* g_param_spec_uint64 (const gchar *name,
341 guint64 default_value,
343 GParamSpec* g_param_spec_unichar (const gchar *name,
346 gunichar default_value,
348 GParamSpec* g_param_spec_enum (const gchar *name,
354 GParamSpec* g_param_spec_flags (const gchar *name,
360 GParamSpec* g_param_spec_float (const gchar *name,
365 gfloat default_value,
367 GParamSpec* g_param_spec_double (const gchar *name,
372 gdouble default_value,
374 GParamSpec* g_param_spec_string (const gchar *name,
377 const gchar *default_value,
379 GParamSpec* g_param_spec_param (const gchar *name,
384 GParamSpec* g_param_spec_boxed (const gchar *name,
389 GParamSpec* g_param_spec_pointer (const gchar *name,
393 GParamSpec* g_param_spec_value_array (const gchar *name,
396 GParamSpec *element_spec,
398 GParamSpec* g_param_spec_object (const gchar *name,
403 GParamSpec* g_param_spec_override (const gchar *name,
404 GParamSpec *overridden);
405 GParamSpec* g_param_spec_gtype (const gchar *name,
411 /* --- internal --- */
412 /* We prefix variable declarations so they can
413 * properly get exported in windows dlls.
416 # ifdef G_PLATFORM_WIN32
417 # ifdef GOBJECT_STATIC_COMPILATION
418 # define GOBJECT_VAR extern
419 # else /* !GOBJECT_STATIC_COMPILATION */
420 # ifdef GOBJECT_COMPILATION
422 # define GOBJECT_VAR __declspec(dllexport)
423 # else /* !DLL_EXPORT */
424 # define GOBJECT_VAR extern
425 # endif /* !DLL_EXPORT */
426 # else /* !GOBJECT_COMPILATION */
427 # define GOBJECT_VAR extern __declspec(dllimport)
428 # endif /* !GOBJECT_COMPILATION */
429 # endif /* !GOBJECT_STATIC_COMPILATION */
430 # else /* !G_PLATFORM_WIN32 */
431 # define GOBJECT_VAR extern
432 # endif /* !G_PLATFORM_WIN32 */
433 #endif /* GOBJECT_VAR */
435 GOBJECT_VAR GType *g_param_spec_types;
439 #endif /* __G_PARAMSPECS_H__ */