uninstall-ms-lib:
endif
+atk_built_headers = atk-enum-types.h
+atk_built_cfiles = atk-enum-types.c
+
+$(OBJECTS): $(atk_built_headers)
+
libatk_la_SOURCES = \
atkaction.c \
atkcomponent.c \
atktable.c \
atktext.c \
atkutil.c \
- atkvalue.c
+ atkvalue.c \
+ $(atk_built_cfiles)
EXTRA_DIST += atkmarshal.list
MAINTAINERCLEANFILES += \
libatkincludedir=$(includedir)/atk-1.0/atk
-libatkinclude_HEADERS = \
+atk_headers = \
atk.h \
atkaction.h \
atkcomponent.h \
atkutil.h \
atkvalue.h
+libatkinclude_HEADERS = \
+ $(atk_headers) \
+ $(atk_built_headers)
+
$(libatk_la_OBJECTS): atkmarshal.c atkmarshal.h
atkmarshal.h: @REBUILD@ stamp-atkmarshal.h
&& rm -f xgen-gmc xgen-gmc~ \
&& echo timestamp > $(@F)
+atk-enum-types.h: s-enum-types-h
+ @true
+
+s-enum-types-h: @REBUILD@ $(atk_headers) Makefile
+ ( cd $(srcdir) && glib-mkenums \
+ --fhead "#ifndef __ATK_ENUM_TYPES_H__\n#define __ATK_ENUM_TYPES_H__\n" \
+ --fprod "/* enumerations from \"@filename@\" */\n" \
+ --vhead "GType @enum_name@_get_type (void);\n#define ATK_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
+ --ftail "#endif /* __ATK_ENUM_TYPES_H__ */" \
+ $(atk_headers) ) > tmp-atk-enum-types.h \
+ && (cmp -s tmp-atk-enum-types.h $(srcdir)/atk-enum-types.h || cp tmp-atk-enum-types.h $(srcdir)/atk-enum-types.h ) \
+ && rm -f tmp-atk-enum-types.h \
+ && echo timestamp > $(@F)
+
+atk-enum-types.c: s-enum-types-c
+ @true
+
+s-enum-types-c: @REBUILD@ $(atk_headers) Makefile
+ ( cd $(srcdir) && glib-mkenums \
+ --fhead "#include <atk.h>" \
+ --fprod "\n/* enumerations from \"@filename@\" */" \
+ --vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \
+ --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+ --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \
+ $(atk_headers) ) > tmp-atk-enum-types.c \
+ && (cmp -s tmp-atk-enum-types.c $(srcdir)/atk-enum-types.c || cp tmp-atk-enum-types.c $(srcdir)/atk-enum-types.c ) \
+ && rm -f tmp-atk-enum-types.c \
+ && echo timestamp > $(@F)
+
+
atk.lib: libatk.la atk.def
lib -name:libatk-@LT_CURRENT_MINUS_AGE@.dll -def:atk.def -out:$@
#include "atk.h"
#include "atkmarshal.h"
-
-static gchar *role_names[ATK_ROLE_LAST_DEFINED] = {
- "invalid",
- "accel_label",
- "alert",
- "animation",
- "arrow",
- "calendar",
- "canvas",
- "check_box",
- "check_menu_item",
- "color_chooser",
- "column_header",
- "combo_box",
- "date_editor",
- "desktop_icon",
- "desktop_frame",
- "dial",
- "dialog",
- "directory_pane",
- "drawing_area",
- "file_chooser",
- "filler",
- "font_chooser",
- "frame",
- "glass_pane",
- "html_container",
- "icon",
- "image",
- "internal_frame",
- "label",
- "layered_pane",
- "list",
- "list_item",
- "menu",
- "menu_bar",
- "menu_item",
- "option_pane",
- "page_tab",
- "page_tab_list",
- "panel",
- "password_text",
- "popup_menu",
- "progress_bar",
- "push_button",
- "radio_button",
- "radio_menu_item",
- "root_pane",
- "row_header",
- "scroll_bar",
- "scroll_pane",
- "separator",
- "slider",
- "split_pane",
- "spin_button",
- "statusbar",
- "table",
- "table_cell",
- "table_column_header",
- "table_row_header",
- "tear_off_menu_item",
- "terminal",
- "text",
- "toggle_button",
- "tool_bar",
- "tool_tip",
- "tree",
- "tree_table",
- "unknown",
- "viewport",
- "window"
-};
+#include "atk-enum-types.h"
enum
{
G_CONST_RETURN gchar*
atk_role_get_name (AtkRole role)
{
- gint n;
+ GTypeClass *type_class;
+ GEnumValue *value;
+ gchar *name;
- n = role;
+ type_class = g_type_class_ref (ATK_TYPE_ROLE);
+ g_return_val_if_fail (G_IS_ENUM_CLASS (type_class), NULL);
- if ((n >= 0) && (n < ATK_ROLE_LAST_DEFINED))
- return role_names[n];
+ value = g_enum_get_value (G_ENUM_CLASS (type_class), role);
- return role_names[ATK_ROLE_INVALID];
+ if (value)
+ {
+ name = value->value_name;
+ }
+ else
+ {
+ value = g_enum_get_value (G_ENUM_CLASS (type_class), ATK_ROLE_INVALID);
+ name = value->value_name;
+ }
+ g_type_class_unref (type_class);
+ return name;
}
/**
AtkRole
atk_role_for_name (const gchar *name)
{
- gint i;
+ GTypeClass *type_class;
+ GEnumValue *value;
+ AtkRole role;
g_return_val_if_fail (name, ATK_ROLE_INVALID);
- for (i = 0; i < ATK_ROLE_LAST_DEFINED; i++)
+ type_class = g_type_class_ref (ATK_TYPE_ROLE);
+ g_return_val_if_fail (G_IS_ENUM_CLASS (type_class), ATK_ROLE_INVALID);
+
+ value = g_enum_get_value_by_name (G_ENUM_CLASS (type_class), name);
+
+ if (value)
+ {
+ role = value->value;
+ }
+ else
{
- if (strcmp (name, role_names[i]) == 0)
- return i;
+ role = ATK_ROLE_INVALID;
}
- return ATK_ROLE_INVALID;
+ g_type_class_unref (type_class);
+
+ return role;
}