Enums

The GLib type system provides fundamental types for enumeration and flags types. (Flags types are like enumerations, but allow their values to be combined by bitwise or). A registered enumeration or flags type associates a name and a nickname with each allowed value, and the methods g_enum_get_value_by_name(), g_enum_get_value_by_nick(), g_flags_get_value_by_name() and g_flags_get_value_by_nick() can look up values by their name or nickname. When an enumeration or flags type is registered with the GLib type system, it can be used as value type for object properties, using g_param_spec_enum() or g_param_spec_flags().

GObject ships with a utility called glib-mkenums that can construct suitable type registration functions from C enumeration definitions.

Constructors

this
this(GEnumValue* gEnumValue)

Sets our main struct and passes it to the parent class

Members

Functions

getEnumsStruct
GEnumValue* getEnumsStruct()

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

Static functions

completeTypeInfo
void completeTypeInfo(GType type, GTypeInfo info, Enums _Values)

This function is meant to be called from the complete_type_info function of a GTypePlugin implementation, as in the following

getValue
Enums getValue(GEnumClass* enumClass, int value)

Returns the GEnumValue for a value.

getValueByName
Enums getValueByName(GEnumClass* enumClass, string name)

Looks up a GEnumValue by name.

getValueByNick
Enums getValueByNick(GEnumClass* enumClass, string nick)

Looks up a GEnumValue by nickname.

registerStatic
GType registerStatic(string name, Enums _StaticValues)

Registers a new static enumeration type with the name name. It is normally more convenient to let glib-mkenums generate a my_enum_get_type() function from a usual C enumeration definition than to write one yourself using g_enum_register_static().

Variables

gEnumValue
GEnumValue* gEnumValue;

the main Gtk struct

Meta