2000-09-06 06:32:45 +02:00
|
|
|
<!-- ##### SECTION Title ##### -->
|
2001-09-10 20:03:31 +02:00
|
|
|
Enums and Flags
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
<!-- ##### SECTION Short_Description ##### -->
|
2002-11-23 23:57:35 +01:00
|
|
|
Enumeration and flags types
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
<!-- ##### SECTION Long_Description ##### -->
|
|
|
|
<para>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### SECTION See_Also ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### STRUCT GEnumClass ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2003-03-10 17:38:58 +01:00
|
|
|
@g_type_class:
|
|
|
|
@minimum:
|
|
|
|
@maximum:
|
|
|
|
@n_values:
|
|
|
|
@values:
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
<!-- ##### STRUCT GFlagsClass ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
2003-03-10 17:38:58 +01:00
|
|
|
@g_type_class:
|
|
|
|
@mask:
|
|
|
|
@n_values:
|
|
|
|
@values:
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
<!-- ##### MACRO G_ENUM_CLASS_TYPE ##### -->
|
|
|
|
<para>
|
2002-12-10 00:26:17 +01:00
|
|
|
Returns the type identifier from a given #GEnumClass structure.
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2002-12-10 00:26:17 +01:00
|
|
|
@class: a #GEnumClass
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_ENUM_CLASS_TYPE_NAME ##### -->
|
|
|
|
<para>
|
2002-12-10 00:26:17 +01:00
|
|
|
Returns the static type name from a given #GEnumClass structure.
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2002-12-10 00:26:17 +01:00
|
|
|
@class: a #GEnumClass
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_TYPE_IS_ENUM ##### -->
|
|
|
|
<para>
|
2002-12-09 00:16:50 +01:00
|
|
|
Returns whether @type "is a" %G_TYPE_ENUM.
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2002-12-09 00:16:50 +01:00
|
|
|
@type: a #GType ID.
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_ENUM_CLASS ##### -->
|
|
|
|
<para>
|
2002-12-09 20:47:10 +01:00
|
|
|
Casts a derived #GEnumClass structure into a #GEnumClass structure.
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2002-12-09 20:47:10 +01:00
|
|
|
@class: a valid #GEnumClass
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_IS_ENUM_CLASS ##### -->
|
|
|
|
<para>
|
2002-12-09 20:47:10 +01:00
|
|
|
Checks whether @class "is a" valid #GEnumClass structure of type %G_TYPE_ENUM
|
|
|
|
or derived.
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2002-12-09 20:47:10 +01:00
|
|
|
@class: a #GEnumClass
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_TYPE_IS_FLAGS ##### -->
|
|
|
|
<para>
|
2002-12-09 00:16:50 +01:00
|
|
|
Returns whether @type "is a" %G_TYPE_FLAGS.
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2002-12-09 00:16:50 +01:00
|
|
|
@type: a #GType ID.
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_FLAGS_CLASS ##### -->
|
|
|
|
<para>
|
2002-12-09 20:47:10 +01:00
|
|
|
Casts a derived #GFlagsClass structure into a #GFlagsClass structure.
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2002-12-09 20:47:10 +01:00
|
|
|
@class: a valid #GFlagsClass
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_IS_FLAGS_CLASS ##### -->
|
|
|
|
<para>
|
2002-12-09 20:47:10 +01:00
|
|
|
Checks whether @class "is a" valid #GFlagsClass structure of type %G_TYPE_FLAGS
|
|
|
|
or derived.
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2002-12-09 20:47:10 +01:00
|
|
|
@class: a #GFlagsClass
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_FLAGS_CLASS_TYPE ##### -->
|
|
|
|
<para>
|
2002-12-10 00:26:17 +01:00
|
|
|
Returns the type identifier from a given #GFlagsClass structure.
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2002-12-10 00:26:17 +01:00
|
|
|
@class: a #GFlagsClass
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_FLAGS_CLASS_TYPE_NAME ##### -->
|
|
|
|
<para>
|
2002-12-10 00:26:17 +01:00
|
|
|
Returns the static type name from a given #GFlagsClass structure.
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2002-12-10 00:26:17 +01:00
|
|
|
@class: a #GFlagsClass
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### STRUCT GEnumValue ##### -->
|
|
|
|
<para>
|
2003-04-07 02:08:19 +02:00
|
|
|
A structure which contains a single enum value, its name, and it's
|
|
|
|
nickname.
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
|
|
|
@value:
|
|
|
|
@value_name:
|
|
|
|
@value_nick:
|
|
|
|
|
|
|
|
<!-- ##### STRUCT GFlagsValue ##### -->
|
|
|
|
<para>
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
|
@value:
|
|
|
|
@value_name:
|
|
|
|
@value_nick:
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_enum_get_value ##### -->
|
|
|
|
<para>
|
2003-04-07 02:08:19 +02:00
|
|
|
Returns the #GEnumValue for a value.
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2003-04-07 02:08:19 +02:00
|
|
|
@enum_class: a #GEnumClass
|
|
|
|
@value: the value to look up
|
|
|
|
@Returns: the #GEnumValue for @value, or %NULL if @value is not
|
|
|
|
a member of the enumeration
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_enum_get_value_by_name ##### -->
|
|
|
|
<para>
|
2003-04-07 02:08:19 +02:00
|
|
|
Looks up a #GEnumValue by name.
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2003-04-07 02:08:19 +02:00
|
|
|
@enum_class: a #GEnumClass
|
|
|
|
@name: the name to look up
|
|
|
|
@Returns: the #GEnumValue with name @name, or %NULL if the enumeration doesn'
|
2003-09-02 19:57:22 +02:00
|
|
|
t have a member with that name
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_enum_get_value_by_nick ##### -->
|
|
|
|
<para>
|
2003-04-07 02:08:19 +02:00
|
|
|
Looks up a #GEnumValue by nickname.
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2003-04-07 02:08:19 +02:00
|
|
|
@enum_class: a #GEnumClass
|
|
|
|
@nick: the nickname to look up
|
|
|
|
@Returns: the #GEnumValue with nickname @nick, or %NULL if the enumeration doesn'
|
2003-09-02 19:57:22 +02:00
|
|
|
t have a member with that nickname
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_flags_get_first_value ##### -->
|
|
|
|
<para>
|
2003-04-07 02:08:19 +02:00
|
|
|
Returns the first #GFlagsValue which is set in @value.
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2003-04-07 02:08:19 +02:00
|
|
|
@flags_class: a #GFlagsClass
|
2003-09-02 19:57:22 +02:00
|
|
|
@value: the value
|
2003-04-07 02:08:19 +02:00
|
|
|
@Returns: the first #GFlagsValue which is set in @value, or %NULL if none is set
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_flags_get_value_by_name ##### -->
|
|
|
|
<para>
|
2003-04-07 02:08:19 +02:00
|
|
|
Looks up a #GFlagsValue by name.
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2003-04-07 02:08:19 +02:00
|
|
|
@flags_class: a #GFlagsClass
|
|
|
|
@name: the name to look up
|
|
|
|
@Returns: the #GFlagsValue with name @name, or %NULL if there is no flag with
|
2003-09-02 19:57:22 +02:00
|
|
|
that name
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_flags_get_value_by_nick ##### -->
|
|
|
|
<para>
|
2003-04-07 02:08:19 +02:00
|
|
|
Looks up a #GFlagsValue by nickname.
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2003-04-07 02:08:19 +02:00
|
|
|
@flags_class: a #GFlagsClass
|
|
|
|
@nick: the nickname to look up
|
|
|
|
@Returns: the #GFlagsValue with nickname @nick, or %NULL if there is no flag
|
2003-09-02 19:57:22 +02:00
|
|
|
with that nickname
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_enum_register_static ##### -->
|
|
|
|
<para>
|
2003-10-18 01:33:03 +02:00
|
|
|
Registers a new static enumeration type with the name @name.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
It is normally more convenient to let
|
|
|
|
<link linkend="glib-mkenums">glib-mkenums</link> generate a
|
|
|
|
my_enum_get_type() function from a usual C enumeration definition
|
|
|
|
than to write one yourself using g_enum_register_static().
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2003-10-18 01:33:03 +02:00
|
|
|
@name: A nul-terminated string used as the name of the new type.
|
|
|
|
@const_static_values: An array of #GEnumValue structs for the possible
|
|
|
|
enumeration values. The array is terminated by a struct with all
|
|
|
|
members being 0.
|
|
|
|
@Returns: The new type identifier.
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_flags_register_static ##### -->
|
|
|
|
<para>
|
2003-10-18 01:33:03 +02:00
|
|
|
Registers a new static flags type with the name @name.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
It is normally more convenient to let
|
|
|
|
<link linkend="glib-mkenums">glib-mkenums</link> generate a
|
|
|
|
my_flags_get_type() function from a usual C enumeration definition
|
|
|
|
than to write one yourself using g_flags_register_static().
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2003-10-18 01:33:03 +02:00
|
|
|
@name: A nul-terminated string used as the name of the new type.
|
|
|
|
@const_static_values: An array of #GFlagsValue structs for the possible
|
|
|
|
flags values. The array is terminated by a struct with all members being 0.
|
|
|
|
@Returns: The new type identifier.
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_enum_complete_type_info ##### -->
|
|
|
|
<para>
|
2003-10-18 01:33:03 +02:00
|
|
|
This function is meant to be called from the complete_type_info() function
|
|
|
|
of a #GTypePlugin implementation, as in the following example:
|
|
|
|
<informalexample>
|
|
|
|
<programlisting>
|
|
|
|
static void
|
|
|
|
my_enum_complete_type_info (GTypePlugin *plugin,
|
|
|
|
GType g_type,
|
|
|
|
GTypeInfo *info,
|
|
|
|
GTypeValueTable *value_table)
|
|
|
|
{
|
|
|
|
static const GEnumValue values[] = {
|
|
|
|
{ MY_ENUM_FOO, "MY_ENUM_FOO", "foo" },
|
|
|
|
{ MY_ENUM_BAR, "MY_ENUM_BAR", "bar" }
|
|
|
|
};
|
|
|
|
|
|
|
|
g_enum_complete_type_info (type, info, values);
|
|
|
|
}
|
|
|
|
</programlisting>
|
|
|
|
</informalexample>
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2003-10-18 01:33:03 +02:00
|
|
|
@g_enum_type: the type identifier of the type being completed
|
|
|
|
@info: the #GTypeInfo struct to be filled in
|
|
|
|
@const_values: An array of #GEnumValue structs for the possible
|
|
|
|
enumeration values. The array is terminated by a struct with all
|
|
|
|
members being 0.
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
<!-- ##### FUNCTION g_flags_complete_type_info ##### -->
|
|
|
|
<para>
|
2003-10-18 01:33:03 +02:00
|
|
|
This function is meant to be called from the complete_type_info() function
|
|
|
|
of a #GTypePlugin implementation, see the example for
|
|
|
|
g_enumeration_complete_type_info() above.
|
2000-09-06 06:32:45 +02:00
|
|
|
</para>
|
|
|
|
|
2003-10-18 01:33:03 +02:00
|
|
|
@g_flags_type: the type identifier of the type being completed
|
|
|
|
@info: the #GTypeInfo struct to be filled in
|
|
|
|
@const_values: An array of #GFlagsValue structs for the possible
|
|
|
|
enumeration values. The array is terminated by a struct with all
|
|
|
|
members being 0.
|
2000-09-06 06:32:45 +02:00
|
|
|
|
|
|
|
|