2 * This file is part of gtkD.
4 * gtkD 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 * gtkD 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 gtkD; 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
57 import tango
.io
.Stdout
; // use the tango loging?
61 private import gtkc
.gobjecttypes
;
63 private import gtkc
.gobject
;
66 private import glib
.Str
;
73 * The GLib type system provides fundamental types for enumeration and flags types. (Flags types
74 * are like enumerations, but allow their values to be combined by bitwise or). A registered
75 * enumeration or flags type associates a name and a nickname with each allowed value, and
76 * the methods g_enum_get_value_by_name(), g_enum_get_value_by_nick(), g_flags_get_value_by_name()
77 * and g_flags_get_value_by_nick() can look up values by their name or nickname.
78 * When an enumeration or flags type is registered with the GLib type system, it can
79 * be used as value type for object properties, using g_param_spec_enum() or
80 * g_param_spec_flags().
81 * GObject ships with a utility called glib-mkenums that can
82 * construct suitable type registration functions from C enumeration definitions.
87 /** the main Gtk struct */
88 protected GEnumValue
* gEnumValue
;
91 public GEnumValue
* getEnumsStruct()
97 /** the main Gtk struct as a void* */
98 protected void* getStruct()
100 return cast(void*)gEnumValue
;
104 * Sets our main struct and passes it to the parent class
106 public this (GEnumValue
* gEnumValue
)
110 if ( gEnumValue
is null )
115 Stdout("struct gEnumValue is null on constructor").newline
;
119 printf("struct gEnumValue is null on constructor");
126 assert(gEnumValue
!is null, "struct gEnumValue is null on constructor");
128 this.gEnumValue
= gEnumValue
;
149 * Returns the GEnumValue for a value.
153 * the value to look up
155 * the GEnumValue for value, or NULL if value is not
156 * a member of the enumeration
158 public static GEnumValue
* getValue(GEnumClass
* enumClass
, int value
)
160 // GEnumValue* g_enum_get_value (GEnumClass *enum_class, gint value);
161 return g_enum_get_value(enumClass
, value
);
165 * Looks up a GEnumValue by name.
169 * the name to look up
171 * the GEnumValue with name name, or NULL if the enumeration doesn'
172 * t have a member with that name
174 public static GEnumValue
* getValueByName(GEnumClass
* enumClass
, char[] name
)
176 // GEnumValue* g_enum_get_value_by_name (GEnumClass *enum_class, const gchar *name);
177 return g_enum_get_value_by_name(enumClass
, Str
.toStringz(name
));
181 * Looks up a GEnumValue by nickname.
185 * the nickname to look up
187 * the GEnumValue with nickname nick, or NULL if the enumeration doesn'
188 * t have a member with that nickname
190 public static GEnumValue
* getValueByNick(GEnumClass
* enumClass
, char[] nick
)
192 // GEnumValue* g_enum_get_value_by_nick (GEnumClass *enum_class, const gchar *nick);
193 return g_enum_get_value_by_nick(enumClass
, Str
.toStringz(nick
));
200 * Registers a new static enumeration type with the name name.
201 * It is normally more convenient to let glib-mkenums
202 * generate a my_enum_get_type() function from a usual C enumeration definition
203 * than to write one yourself using g_enum_register_static().
205 * A nul-terminated string used as the name of the new type.
208 * The new type identifier.
210 public static GType
registerStatic(char[] name
, GEnumValue
* _StaticValues
)
212 // GType g_enum_register_static (const gchar *name, const GEnumValue *const _static_values);
213 return g_enum_register_static(Str
.toStringz(name
), _StaticValues
);
218 * This function is meant to be called from the complete_type_info() function
219 * of a GTypePlugin implementation, as in the following example:
221 * my_enum_complete_type_info (GTypePlugin *plugin,
224 * GTypeValueTable *value_table)
226 * static const GEnumValue values[] = {
227 * { MY_ENUM_FOO, "MY_ENUM_FOO", "foo" },
228 * { MY_ENUM_BAR, "MY_ENUM_BAR", "bar" },
231 * g_enum_complete_type_info (type, info, values);
234 * the type identifier of the type being completed
236 * the GTypeInfo struct to be filled in
239 public static void completeTypeInfo(GType type
, GTypeInfo
* info
, GEnumValue
* _Values
)
241 // void g_enum_complete_type_info (GType g_enum_type, GTypeInfo *info, const GEnumValue *const _values);
242 g_enum_complete_type_info(type
, info
, _Values
);