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))
98 /* --- typedefs & structures --- */
99 typedef struct _GParamSpecChar GParamSpecChar;
100 typedef struct _GParamSpecUChar GParamSpecUChar;
101 typedef struct _GParamSpecBoolean GParamSpecBoolean;
102 typedef struct _GParamSpecInt GParamSpecInt;
103 typedef struct _GParamSpecUInt GParamSpecUInt;
104 typedef struct _GParamSpecLong GParamSpecLong;
105 typedef struct _GParamSpecULong GParamSpecULong;
106 typedef struct _GParamSpecInt64 GParamSpecInt64;
107 typedef struct _GParamSpecUInt64 GParamSpecUInt64;
108 typedef struct _GParamSpecUnichar GParamSpecUnichar;
109 typedef struct _GParamSpecEnum GParamSpecEnum;
110 typedef struct _GParamSpecFlags GParamSpecFlags;
111 typedef struct _GParamSpecFloat GParamSpecFloat;
112 typedef struct _GParamSpecDouble GParamSpecDouble;
113 typedef struct _GParamSpecString GParamSpecString;
114 typedef struct _GParamSpecParam GParamSpecParam;
115 typedef struct _GParamSpecBoxed GParamSpecBoxed;
116 typedef struct _GParamSpecPointer GParamSpecPointer;
117 typedef struct _GParamSpecValueArray GParamSpecValueArray;
118 typedef struct _GParamSpecObject GParamSpecObject;
120 struct _GParamSpecChar
122 GParamSpec parent_instance;
128 struct _GParamSpecUChar
130 GParamSpec parent_instance;
134 guint8 default_value;
136 struct _GParamSpecBoolean
138 GParamSpec parent_instance;
140 gboolean default_value;
142 struct _GParamSpecInt
144 GParamSpec parent_instance;
150 struct _GParamSpecUInt
152 GParamSpec parent_instance;
158 struct _GParamSpecLong
160 GParamSpec parent_instance;
166 struct _GParamSpecULong
168 GParamSpec parent_instance;
172 gulong default_value;
174 struct _GParamSpecInt64
176 GParamSpec parent_instance;
180 gint64 default_value;
182 struct _GParamSpecUInt64
184 GParamSpec parent_instance;
188 guint64 default_value;
190 struct _GParamSpecUnichar
192 GParamSpec parent_instance;
194 gunichar default_value;
196 struct _GParamSpecEnum
198 GParamSpec parent_instance;
200 GEnumClass *enum_class;
203 struct _GParamSpecFlags
205 GParamSpec parent_instance;
207 GFlagsClass *flags_class;
210 struct _GParamSpecFloat
212 GParamSpec parent_instance;
216 gfloat default_value;
219 struct _GParamSpecDouble
221 GParamSpec parent_instance;
225 gdouble default_value;
228 struct _GParamSpecString
230 GParamSpec parent_instance;
232 gchar *default_value;
236 guint null_fold_if_empty : 1;
237 guint ensure_non_null : 1;
239 struct _GParamSpecParam
241 GParamSpec parent_instance;
243 struct _GParamSpecBoxed
245 GParamSpec parent_instance;
247 struct _GParamSpecPointer
249 GParamSpec parent_instance;
251 struct _GParamSpecValueArray
253 GParamSpec parent_instance;
254 GParamSpec *element_spec;
255 guint fixed_n_elements;
257 struct _GParamSpecObject
259 GParamSpec parent_instance;
262 /* --- GParamSpec prototypes --- */
263 GParamSpec* g_param_spec_char (const gchar *name,
270 GParamSpec* g_param_spec_uchar (const gchar *name,
275 guint8 default_value,
277 GParamSpec* g_param_spec_boolean (const gchar *name,
280 gboolean default_value,
282 GParamSpec* g_param_spec_int (const gchar *name,
289 GParamSpec* g_param_spec_uint (const gchar *name,
296 GParamSpec* g_param_spec_long (const gchar *name,
303 GParamSpec* g_param_spec_ulong (const gchar *name,
308 gulong default_value,
310 GParamSpec* g_param_spec_int64 (const gchar *name,
315 gint64 default_value,
317 GParamSpec* g_param_spec_uint64 (const gchar *name,
322 guint64 default_value,
324 GParamSpec* g_param_spec_unichar (const gchar *name,
327 gunichar default_value,
329 GParamSpec* g_param_spec_enum (const gchar *name,
335 GParamSpec* g_param_spec_flags (const gchar *name,
341 GParamSpec* g_param_spec_float (const gchar *name,
346 gfloat default_value,
348 GParamSpec* g_param_spec_double (const gchar *name,
353 gdouble default_value,
355 GParamSpec* g_param_spec_string (const gchar *name,
358 const gchar *default_value,
360 GParamSpec* g_param_spec_param (const gchar *name,
365 GParamSpec* g_param_spec_boxed (const gchar *name,
370 GParamSpec* g_param_spec_pointer (const gchar *name,
374 GParamSpec* g_param_spec_value_array (const gchar *name,
377 GParamSpec *element_spec,
379 GParamSpec* g_param_spec_object (const gchar *name,
386 /* --- internal --- */
387 /* We prefix variable declarations so they can
388 * properly get exported in windows dlls.
391 # ifdef G_PLATFORM_WIN32
392 # ifdef GOBJECT_STATIC_COMPILATION
393 # define GOBJECT_VAR extern
394 # else /* !GOBJECT_STATIC_COMPILATION */
395 # ifdef GOBJECT_COMPILATION
397 # define GOBJECT_VAR __declspec(dllexport)
398 # else /* !DLL_EXPORT */
399 # define GOBJECT_VAR extern
400 # endif /* !DLL_EXPORT */
401 # else /* !GOBJECT_COMPILATION */
402 # define GOBJECT_VAR extern __declspec(dllimport)
403 # endif /* !GOBJECT_COMPILATION */
404 # endif /* !GOBJECT_STATIC_COMPILATION */
405 # else /* !G_PLATFORM_WIN32 */
406 # define GOBJECT_VAR extern
407 # endif /* !G_PLATFORM_WIN32 */
408 #endif /* GOBJECT_VAR */
410 GOBJECT_VAR GType *g_param_spec_types;
414 #endif /* __G_PARAMSPECS_H__ */