00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
00021 #error "Only <glib-object.h> can be included directly."
00022 #endif
00023
00024 #ifndef __G_ENUMS_H__
00025 #define __G_ENUMS_H__
00026
00027 #include <_ansi.h>
00028 #include <gobject/gtype.h>
00029
00030 G_BEGIN_DECLS
00031
00032
00033 #define G_TYPE_IS_ENUM(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_ENUM)
00034 #define G_ENUM_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_ENUM, GEnumClass))
00035 #define G_IS_ENUM_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_ENUM))
00036 #define G_ENUM_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class))
00037 #define G_ENUM_CLASS_TYPE_NAME(class) (g_type_name (G_ENUM_CLASS_TYPE (class)))
00038 #define G_TYPE_IS_FLAGS(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_FLAGS)
00039 #define G_FLAGS_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_FLAGS, GFlagsClass))
00040 #define G_IS_FLAGS_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_FLAGS))
00041 #define G_FLAGS_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class))
00042 #define G_FLAGS_CLASS_TYPE_NAME(class) (g_type_name (G_FLAGS_CLASS_TYPE (class)))
00043 #define G_VALUE_HOLDS_ENUM(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_ENUM))
00044 #define G_VALUE_HOLDS_FLAGS(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_FLAGS))
00045
00046
00047
00048 typedef struct _GEnumClass GEnumClass;
00049 typedef struct _GFlagsClass GFlagsClass;
00050 typedef struct _GEnumValue GEnumValue;
00051 typedef struct _GFlagsValue GFlagsValue;
00052 struct _GEnumClass
00053 {
00054 GTypeClass g_type_class;
00055
00056
00057 gint minimum;
00058 gint maximum;
00059 guint n_values;
00060 GEnumValue *values;
00061 };
00062 struct _GFlagsClass
00063 {
00064 GTypeClass g_type_class;
00065
00066
00067 guint mask;
00068 guint n_values;
00069 GFlagsValue *values;
00070 };
00071 struct _GEnumValue
00072 {
00073 gint value;
00074 gchar *value_name;
00075 gchar *value_nick;
00076 };
00077 struct _GFlagsValue
00078 {
00079 guint value;
00080 gchar *value_name;
00081 gchar *value_nick;
00082 };
00083
00084
00085
00086 IMPORT_C GEnumValue* g_enum_get_value (GEnumClass *enum_class,
00087 gint value);
00088 IMPORT_C GEnumValue* g_enum_get_value_by_name (GEnumClass *enum_class,
00089 const gchar *name);
00090 IMPORT_C GEnumValue* g_enum_get_value_by_nick (GEnumClass *enum_class,
00091 const gchar *nick);
00092 IMPORT_C GFlagsValue* g_flags_get_first_value (GFlagsClass *flags_class,
00093 guint value);
00094 IMPORT_C GFlagsValue* g_flags_get_value_by_name (GFlagsClass *flags_class,
00095 const gchar *name);
00096 IMPORT_C GFlagsValue* g_flags_get_value_by_nick (GFlagsClass *flags_class,
00097 const gchar *nick);
00098 IMPORT_C void g_value_set_enum (GValue *value,
00099 gint v_enum);
00100 IMPORT_C gint g_value_get_enum (const GValue *value);
00101 IMPORT_C void g_value_set_flags (GValue *value,
00102 guint v_flags);
00103 IMPORT_C guint g_value_get_flags (const GValue *value);
00104
00105
00106
00107
00108
00109
00110
00111 IMPORT_C GType g_enum_register_static (const gchar *name,
00112 const GEnumValue *const_static_values);
00113 IMPORT_C GType g_flags_register_static (const gchar *name,
00114 const GFlagsValue *const_static_values);
00115
00116
00117
00118 IMPORT_C void g_enum_complete_type_info (GType g_enum_type,
00119 GTypeInfo *info,
00120 const GEnumValue *const_values);
00121 IMPORT_C void g_flags_complete_type_info (GType g_flags_type,
00122 GTypeInfo *info,
00123 const GFlagsValue *const_values);
00124
00125 G_END_DECLS
00126
00127 #endif