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))
101 /* --- typedefs & structures --- */
102 typedef struct _GParamSpecChar GParamSpecChar;
103 typedef struct _GParamSpecUChar GParamSpecUChar;
104 typedef struct _GParamSpecBoolean GParamSpecBoolean;
105 typedef struct _GParamSpecInt GParamSpecInt;
106 typedef struct _GParamSpecUInt GParamSpecUInt;
107 typedef struct _GParamSpecLong GParamSpecLong;
108 typedef struct _GParamSpecULong GParamSpecULong;
109 typedef struct _GParamSpecInt64 GParamSpecInt64;
110 typedef struct _GParamSpecUInt64 GParamSpecUInt64;
111 typedef struct _GParamSpecUnichar GParamSpecUnichar;
112 typedef struct _GParamSpecEnum GParamSpecEnum;
113 typedef struct _GParamSpecFlags GParamSpecFlags;
114 typedef struct _GParamSpecFloat GParamSpecFloat;
115 typedef struct _GParamSpecDouble GParamSpecDouble;
116 typedef struct _GParamSpecString GParamSpecString;
117 typedef struct _GParamSpecParam GParamSpecParam;
118 typedef struct _GParamSpecBoxed GParamSpecBoxed;
119 typedef struct _GParamSpecPointer GParamSpecPointer;
120 typedef struct _GParamSpecValueArray GParamSpecValueArray;
121 typedef struct _GParamSpecObject GParamSpecObject;
122 typedef struct _GParamSpecOverride GParamSpecOverride;
124 struct _GParamSpecChar
126 GParamSpec parent_instance;
132 struct _GParamSpecUChar
134 GParamSpec parent_instance;
138 guint8 default_value;
140 struct _GParamSpecBoolean
142 GParamSpec parent_instance;
144 gboolean default_value;
146 struct _GParamSpecInt
148 GParamSpec parent_instance;
154 struct _GParamSpecUInt
156 GParamSpec parent_instance;
162 struct _GParamSpecLong
164 GParamSpec parent_instance;
170 struct _GParamSpecULong
172 GParamSpec parent_instance;
176 gulong default_value;
178 struct _GParamSpecInt64
180 GParamSpec parent_instance;
184 gint64 default_value;
186 struct _GParamSpecUInt64
188 GParamSpec parent_instance;
192 guint64 default_value;
194 struct _GParamSpecUnichar
196 GParamSpec parent_instance;
198 gunichar default_value;
200 struct _GParamSpecEnum
202 GParamSpec parent_instance;
204 GEnumClass *enum_class;
207 struct _GParamSpecFlags
209 GParamSpec parent_instance;
211 GFlagsClass *flags_class;
214 struct _GParamSpecFloat
216 GParamSpec parent_instance;
220 gfloat default_value;
223 struct _GParamSpecDouble
225 GParamSpec parent_instance;
229 gdouble default_value;
232 struct _GParamSpecString
234 GParamSpec parent_instance;
236 gchar *default_value;
240 guint null_fold_if_empty : 1;
241 guint ensure_non_null : 1;
243 struct _GParamSpecParam
245 GParamSpec parent_instance;
247 struct _GParamSpecBoxed
249 GParamSpec parent_instance;
251 struct _GParamSpecPointer
253 GParamSpec parent_instance;
255 struct _GParamSpecValueArray
257 GParamSpec parent_instance;
258 GParamSpec *element_spec;
259 guint fixed_n_elements;
261 struct _GParamSpecObject
263 GParamSpec parent_instance;
265 struct _GParamSpecOverride
268 GParamSpec parent_instance;
269 GParamSpec *overridden;
272 /* --- GParamSpec prototypes --- */
273 GParamSpec* g_param_spec_char (const gchar *name,
280 GParamSpec* g_param_spec_uchar (const gchar *name,
285 guint8 default_value,
287 GParamSpec* g_param_spec_boolean (const gchar *name,
290 gboolean default_value,
292 GParamSpec* g_param_spec_int (const gchar *name,
299 GParamSpec* g_param_spec_uint (const gchar *name,
306 GParamSpec* g_param_spec_long (const gchar *name,
313 GParamSpec* g_param_spec_ulong (const gchar *name,
318 gulong default_value,
320 GParamSpec* g_param_spec_int64 (const gchar *name,
325 gint64 default_value,
327 GParamSpec* g_param_spec_uint64 (const gchar *name,
332 guint64 default_value,
334 GParamSpec* g_param_spec_unichar (const gchar *name,
337 gunichar default_value,
339 GParamSpec* g_param_spec_enum (const gchar *name,
345 GParamSpec* g_param_spec_flags (const gchar *name,
351 GParamSpec* g_param_spec_float (const gchar *name,
356 gfloat default_value,
358 GParamSpec* g_param_spec_double (const gchar *name,
363 gdouble default_value,
365 GParamSpec* g_param_spec_string (const gchar *name,
368 const gchar *default_value,
370 GParamSpec* g_param_spec_param (const gchar *name,
375 GParamSpec* g_param_spec_boxed (const gchar *name,
380 GParamSpec* g_param_spec_pointer (const gchar *name,
384 GParamSpec* g_param_spec_value_array (const gchar *name,
387 GParamSpec *element_spec,
389 GParamSpec* g_param_spec_object (const gchar *name,
395 GParamSpec* g_param_spec_override (const gchar *name,
396 GParamSpec *overridden);
398 /* --- internal --- */
399 /* We prefix variable declarations so they can
400 * properly get exported in windows dlls.
403 # ifdef G_PLATFORM_WIN32
404 # ifdef GOBJECT_STATIC_COMPILATION
405 # define GOBJECT_VAR extern
406 # else /* !GOBJECT_STATIC_COMPILATION */
407 # ifdef GOBJECT_COMPILATION
409 # define GOBJECT_VAR __declspec(dllexport)
410 # else /* !DLL_EXPORT */
411 # define GOBJECT_VAR extern
412 # endif /* !DLL_EXPORT */
413 # else /* !GOBJECT_COMPILATION */
414 # define GOBJECT_VAR extern __declspec(dllimport)
415 # endif /* !GOBJECT_COMPILATION */
416 # endif /* !GOBJECT_STATIC_COMPILATION */
417 # else /* !G_PLATFORM_WIN32 */
418 # define GOBJECT_VAR extern
419 # endif /* !G_PLATFORM_WIN32 */
420 #endif /* GOBJECT_VAR */
422 GOBJECT_VAR GType *g_param_spec_types;
426 #endif /* __G_PARAMSPECS_H__ */