alternative to assert
[gtkD.git] / src / gobject / Flags.d
blob4b06ff144f0c0565262c395b5aa1ff20015e59c7
1 /*
2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit 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
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile =
26 * outPack = gobject
27 * outFile = Flags
28 * strct = GFlagsValue
29 * realStrct=
30 * ctorStrct=
31 * clss = Flags
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - g_flags_
40 * omit structs:
41 * omit prefixes:
42 * - g_enum_
43 * omit code:
44 * imports:
45 * - glib.Str
46 * - gobject.Flags
47 * structWrap:
48 * - GFlagsValue* -> Flags
49 * local aliases:
52 module gobject.Flags;
54 private import gobject.gobjecttypes;
56 private import lib.gobject;
58 private import glib.Str;
59 private import gobject.Flags;
61 /**
62 * Description
63 * The GLib type system provides fundamental types for enumeration and flags types. (Flags types
64 * are like enumerations, but allow their values to be combined by bitwise or). A registered
65 * enumeration or flags type associates a name and a nickname with each allowed value, and
66 * the methods g_enum_get_value_by_name(), g_enum_get_value_by_nick(), g_flags_get_value_by_name()
67 * and g_flags_get_value_by_nick() can look up values by their name or nickname.
68 * When an enumeration or flags type is registered with the GLib type system, it can
69 * be used as value type for object properties, using g_param_spec_enum() or
70 * g_param_spec_flags().
71 * GObject ships with a utility called glib-mkenums that can
72 * construct suitable type registration functions from C enumeration definitions.
74 public class Flags
77 /** the main Gtk struct */
78 protected GFlagsValue* gFlagsValue;
81 public GFlagsValue* getFlagsStruct()
83 return gFlagsValue;
87 /** the main Gtk struct as a void* */
88 protected void* getStruct()
90 return cast(void*)gFlagsValue;
93 /**
94 * Sets our main struct and passes it to the parent class
96 public this (GFlagsValue* gFlagsValue)
98 this.gFlagsValue = gFlagsValue;
122 * Returns the first GFlagsValue which is set in value.
123 * flags_class:
124 * a GFlagsClass
125 * value:
126 * the value
127 * Returns:
128 * the first GFlagsValue which is set in value, or NULL if none is set
130 public static Flags getFirstValue(GFlagsClass* flagsClass, uint value)
132 // GFlagsValue* g_flags_get_first_value (GFlagsClass *flags_class, guint value);
133 return new Flags( g_flags_get_first_value(flagsClass, value) );
137 * Looks up a GFlagsValue by name.
138 * flags_class:
139 * a GFlagsClass
140 * name:
141 * the name to look up
142 * Returns:
143 * the GFlagsValue with name name, or NULL if there is no flag with
144 * that name
146 public static Flags getValueByName(GFlagsClass* flagsClass, char[] name)
148 // GFlagsValue* g_flags_get_value_by_name (GFlagsClass *flags_class, const gchar *name);
149 return new Flags( g_flags_get_value_by_name(flagsClass, Str.toStringz(name)) );
153 * Looks up a GFlagsValue by nickname.
154 * flags_class:
155 * a GFlagsClass
156 * nick:
157 * the nickname to look up
158 * Returns:
159 * the GFlagsValue with nickname nick, or NULL if there is no flag
160 * with that nickname
162 public static Flags getValueByNick(GFlagsClass* flagsClass, char[] nick)
164 // GFlagsValue* g_flags_get_value_by_nick (GFlagsClass *flags_class, const gchar *nick);
165 return new Flags( g_flags_get_value_by_nick(flagsClass, Str.toStringz(nick)) );
170 * Registers a new static flags type with the name name.
171 * It is normally more convenient to let glib-mkenums
172 * generate a my_flags_get_type() function from a usual C enumeration definition
173 * than to write one yourself using g_flags_register_static().
174 * name:
175 * A nul-terminated string used as the name of the new type.
176 * _static_values:
177 * Returns:
178 * The new type identifier.
180 public static GType registerStatic(char[] name, Flags _StaticValues)
182 // GType g_flags_register_static (const gchar *name, const GFlagsValue *const _static_values);
183 return g_flags_register_static(Str.toStringz(name), (_StaticValues is null) ? null : _StaticValues.getFlagsStruct());
188 * This function is meant to be called from the complete_type_info() function
189 * of a GTypePlugin implementation, see the example for
190 * g_enumeration_complete_type_info() above.
191 * g_flags_type:
192 * the type identifier of the type being completed
193 * info:
194 * the GTypeInfo struct to be filled in
195 * _values:
196 * See Also
197 * GParamSpecEnum, GParamSpecFlags, g_param_spec_enum(), g_param_spec_flags(),
198 * glib-mkenums
200 public static void completeTypeInfo(GType type, GTypeInfo* info, Flags _Values)
202 // void g_flags_complete_type_info (GType g_flags_type, GTypeInfo *info, const GFlagsValue *const _values);
203 g_flags_complete_type_info(type, info, (_Values is null) ? null : _Values.getFlagsStruct());