I've no idea here...
[gtkD.git] / src / gobject / Enums.d
blob9dc53d3c7a89eab830b42091226cb39d10338d00
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 = gobject-Enumeration-and-Flag-Types.html
26 * outPack = gobject
27 * outFile = Enums
28 * strct = GEnumValue
29 * realStrct=
30 * ctorStrct=
31 * clss = Enums
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - g_enum_
40 * omit structs:
41 * omit prefixes:
42 * - g_flags_
43 * omit code:
44 * imports:
45 * - glib.Str
46 * structWrap:
47 * local aliases:
50 module gobject.Enums;
52 private import gobject.gobjecttypes;
54 private import lib.gobject;
56 private import glib.Str;
58 /**
59 * Description
60 * The GLib type system provides fundamental types for enumeration and flags types. (Flags types
61 * are like enumerations, but allow their values to be combined by bitwise or). A registered
62 * enumeration or flags type associates a name and a nickname with each allowed value, and
63 * the methods g_enum_get_value_by_name(), g_enum_get_value_by_nick(), g_flags_get_value_by_name()
64 * and g_flags_get_value_by_nick() can look up values by their name or nickname.
65 * When an enumeration or flags type is registered with the GLib type system, it can
66 * be used as value type for object properties, using g_param_spec_enum() or
67 * g_param_spec_flags().
68 * GObject ships with a utility called glib-mkenums that can
69 * construct suitable type registration functions from C enumeration definitions.
71 public class Enums
74 /** the main Gtk struct */
75 protected GEnumValue* gEnumValue;
78 public GEnumValue* getEnumsStruct()
80 return gEnumValue;
84 /** the main Gtk struct as a void* */
85 protected void* getStruct()
87 return cast(void*)gEnumValue;
90 /**
91 * Sets our main struct and passes it to the parent class
93 public this (GEnumValue* gEnumValue)
95 this.gEnumValue = gEnumValue;
98 /**
116 * Returns the GEnumValue for a value.
117 * enum_class:
118 * a GEnumClass
119 * value:
120 * the value to look up
121 * Returns:
122 * the GEnumValue for value, or NULL if value is not
123 * a member of the enumeration
125 public static GEnumValue* getValue(GEnumClass* enumClass, int value)
127 // GEnumValue* g_enum_get_value (GEnumClass *enum_class, gint value);
128 return g_enum_get_value(enumClass, value);
132 * Looks up a GEnumValue by name.
133 * enum_class:
134 * a GEnumClass
135 * name:
136 * the name to look up
137 * Returns:
138 * the GEnumValue with name name, or NULL if the enumeration doesn'
139 * t have a member with that name
141 public static GEnumValue* getValueByName(GEnumClass* enumClass, char[] name)
143 // GEnumValue* g_enum_get_value_by_name (GEnumClass *enum_class, const gchar *name);
144 return g_enum_get_value_by_name(enumClass, Str.toStringz(name));
148 * Looks up a GEnumValue by nickname.
149 * enum_class:
150 * a GEnumClass
151 * nick:
152 * the nickname to look up
153 * Returns:
154 * the GEnumValue with nickname nick, or NULL if the enumeration doesn'
155 * t have a member with that nickname
157 public static GEnumValue* getValueByNick(GEnumClass* enumClass, char[] nick)
159 // GEnumValue* g_enum_get_value_by_nick (GEnumClass *enum_class, const gchar *nick);
160 return g_enum_get_value_by_nick(enumClass, Str.toStringz(nick));
167 * Registers a new static enumeration type with the name name.
168 * It is normally more convenient to let glib-mkenums
169 * generate a my_enum_get_type() function from a usual C enumeration definition
170 * than to write one yourself using g_enum_register_static().
171 * name:
172 * A nul-terminated string used as the name of the new type.
173 * _static_values:
174 * Returns:
175 * The new type identifier.
177 public static GType registerStatic(char[] name, GEnumValue* _StaticValues)
179 // GType g_enum_register_static (const gchar *name, const GEnumValue *const _static_values);
180 return g_enum_register_static(Str.toStringz(name), _StaticValues);
185 * This function is meant to be called from the complete_type_info() function
186 * of a GTypePlugin implementation, as in the following example:
187 * static void
188 * my_enum_complete_type_info (GTypePlugin *plugin,
189 * GType g_type,
190 * GTypeInfo *info,
191 * GTypeValueTable *value_table)
193 * static const GEnumValue values[] = {
194 * { MY_ENUM_FOO, "MY_ENUM_FOO", "foo" },
195 * { MY_ENUM_BAR, "MY_ENUM_BAR", "bar" },
196 * { 0, NULL, NULL }
197 * };
198 * g_enum_complete_type_info (type, info, values);
200 * g_enum_type:
201 * the type identifier of the type being completed
202 * info:
203 * the GTypeInfo struct to be filled in
204 * _values:
206 public static void completeTypeInfo(GType type, GTypeInfo* info, GEnumValue* _Values)
208 // void g_enum_complete_type_info (GType g_enum_type, GTypeInfo *info, const GEnumValue *const _values);
209 g_enum_complete_type_info(type, info, _Values);