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
52 private import gobject
.gobjecttypes
;
54 private import lib
.gobject
;
56 private import glib
.Str
;
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.
74 /** the main Gtk struct */
75 protected GEnumValue
* gEnumValue
;
78 public GEnumValue
* getEnumsStruct()
84 /** the main Gtk struct as a void* */
85 protected void* getStruct()
87 return cast(void*)gEnumValue
;
91 * Sets our main struct and passes it to the parent class
93 public this (GEnumValue
* gEnumValue
)
95 this.gEnumValue
= gEnumValue
;
116 * Returns the GEnumValue for a value.
120 * the value to look up
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.
136 * the name to look up
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.
152 * the nickname to look up
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().
172 * A nul-terminated string used as the name of the new type.
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:
188 * my_enum_complete_type_info (GTypePlugin *plugin,
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" },
198 * g_enum_complete_type_info (type, info, values);
201 * the type identifier of the type being completed
203 * the GTypeInfo struct to be filled in
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
);