📄 atkobject.c
字号:
/* ATK - Accessibility Toolkit * Copyright 2001 Sun Microsystems Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */#include <string.h>#include <glib-object.h>#ifdef G_OS_WIN32#define STRICT#include <windows.h>#undef STRICT#undef FOCUS_EVENT /* <windows.h> pollutes the namespace * like a six hundred pound gorilla */#endif#include "atk.h"#include "atkmarshal.h"#include "atk-enum-types.h"#include "atkintl.h"GPtrArray *extra_roles = NULL;enum{ PROP_0, /* gobject convention */ PROP_NAME, PROP_DESCRIPTION, PROP_PARENT, /* ancestry has changed */ PROP_VALUE, PROP_ROLE, PROP_LAYER, PROP_MDI_ZORDER, PROP_TABLE_CAPTION, PROP_TABLE_COLUMN_DESCRIPTION, PROP_TABLE_COLUMN_HEADER, PROP_TABLE_ROW_DESCRIPTION, PROP_TABLE_ROW_HEADER, PROP_TABLE_SUMMARY, PROP_TABLE_CAPTION_OBJECT, PROP_LAST /* gobject convention */};enum { CHILDREN_CHANGED, FOCUS_EVENT, PROPERTY_CHANGE, STATE_CHANGE, VISIBLE_DATA_CHANGED, ACTIVE_DESCENDANT_CHANGED, LAST_SIGNAL};static void atk_object_class_init (AtkObjectClass *klass);static void atk_object_init (AtkObject *accessible, AtkObjectClass *klass);static AtkRelationSet* atk_object_real_ref_relation_set (AtkObject *accessible);static void atk_object_real_initialize (AtkObject *accessible, gpointer data);static void atk_object_real_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);static void atk_object_real_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);static void atk_object_finalize (GObject *object);static G_CONST_RETURN gchar* atk_object_real_get_name (AtkObject *object);static G_CONST_RETURN gchar* atk_object_real_get_description (AtkObject *object);static AtkObject* atk_object_real_get_parent (AtkObject *object);static AtkRole atk_object_real_get_role (AtkObject *object);static AtkLayer atk_object_real_get_layer (AtkObject *object);static AtkStateSet* atk_object_real_ref_state_set (AtkObject *object);static void atk_object_real_set_name (AtkObject *object, const gchar *name);static void atk_object_real_set_description (AtkObject *object, const gchar *description);static void atk_object_real_set_parent (AtkObject *object, AtkObject *parent);static void atk_object_real_set_role (AtkObject *object, AtkRole role);static guint atk_object_real_connect_property_change_handler (AtkObject *obj, AtkPropertyChangeHandler *handler);static void atk_object_real_remove_property_change_handler (AtkObject *obj, guint handler_id);static void atk_object_notify (GObject *obj, GParamSpec *pspec);static guint atk_object_signals[LAST_SIGNAL] = { 0, };static gpointer parent_class = NULL;static const gchar* atk_object_name_property_name = "accessible-name";static const gchar* atk_object_name_property_description = "accessible-description";static const gchar* atk_object_name_property_parent = "accessible-parent";static const gchar* atk_object_name_property_value = "accessible-value";static const gchar* atk_object_name_property_role = "accessible-role";static const gchar* atk_object_name_property_component_layer = "accessible-component-layer";static const gchar* atk_object_name_property_component_mdi_zorder = "accessible-component-mdi-zorder";static const gchar* atk_object_name_property_table_caption = "accessible-table-caption";static const gchar* atk_object_name_property_table_column_description = "accessible-table-column-description";static const gchar* atk_object_name_property_table_column_header = "accessible-table-column-header";static const gchar* atk_object_name_property_table_row_description = "accessible-table-row-description";static const gchar* atk_object_name_property_table_row_header = "accessible-table-row-header";static const gchar* atk_object_name_property_table_summary = "accessible-table-summary";static const gchar* atk_object_name_property_table_caption_object = "accessible-table-caption-object";GTypeatk_object_get_type (void){ static GType type = 0; if (!type) { static const GTypeInfo typeInfo = { sizeof (AtkObjectClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) atk_object_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AtkObject), 0, (GInstanceInitFunc) atk_object_init, } ; type = g_type_register_static (G_TYPE_OBJECT, "AtkObject", &typeInfo, 0) ; } return type;}static voidatk_object_class_init (AtkObjectClass *klass){ GObjectClass *gobject_class = G_OBJECT_CLASS (klass); parent_class = g_type_class_peek_parent (klass); gobject_class->set_property = atk_object_real_set_property; gobject_class->get_property = atk_object_real_get_property; gobject_class->finalize = atk_object_finalize; gobject_class->notify = atk_object_notify; klass->get_name = atk_object_real_get_name; klass->get_description = atk_object_real_get_description; klass->get_parent = atk_object_real_get_parent; klass->get_n_children = NULL; klass->ref_child = NULL; klass->get_index_in_parent = NULL; klass->ref_relation_set = atk_object_real_ref_relation_set; klass->get_role = atk_object_real_get_role; klass->get_layer = atk_object_real_get_layer; klass->get_mdi_zorder = NULL; klass->initialize = atk_object_real_initialize; klass->ref_state_set = atk_object_real_ref_state_set; klass->set_name = atk_object_real_set_name; klass->set_description = atk_object_real_set_description; klass->set_parent = atk_object_real_set_parent; klass->set_role = atk_object_real_set_role; klass->connect_property_change_handler = atk_object_real_connect_property_change_handler; klass->remove_property_change_handler = atk_object_real_remove_property_change_handler; /* * We do not define default signal handlers here */ klass->children_changed = NULL; klass->focus_event = NULL; klass->property_change = NULL; klass->visible_data_changed = NULL; klass->active_descendant_changed = NULL; g_object_class_install_property (gobject_class, PROP_NAME, g_param_spec_string (atk_object_name_property_name, "Accessible Name", "Object instance\'s name formatted for " "assistive technology access", NULL, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_DESCRIPTION, g_param_spec_string (atk_object_name_property_description, "Accessible Description", "Description of an object, formatted for " "assistive technology access", NULL, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_PARENT, g_param_spec_object (atk_object_name_property_parent, "Accessible Parent", "Is used to notify that the parent has changed ", ATK_TYPE_OBJECT, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_VALUE, g_param_spec_double (atk_object_name_property_value, "Accessible Value", "Is used to notify that the value has changed ", 0.0, G_MAXDOUBLE, 0.0, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_ROLE, g_param_spec_int (atk_object_name_property_role, "Accessible Role", "The accessible role of this object ", 0, G_MAXINT, 0, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_LAYER, g_param_spec_int (atk_object_name_property_component_layer, "Accessible Layer", "The accessible layer of this object ", 0, G_MAXINT, 0, G_PARAM_READABLE)); g_object_class_install_property (gobject_class, PROP_MDI_ZORDER, g_param_spec_int (atk_object_name_property_component_mdi_zorder, "Accessible MDI Value", "The accessible MDI value of this object ", G_MININT, G_MAXINT, G_MININT, G_PARAM_READABLE)); g_object_class_install_property (gobject_class, PROP_TABLE_CAPTION, g_param_spec_string (atk_object_name_property_table_caption, "Accessible Table Caption", "Is used to notify that the table caption has changed; this property should not be used. accessible-table-caption-object should be used instead", NULL, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_TABLE_COLUMN_HEADER, g_param_spec_object (atk_object_name_property_table_column_header, "Accessible Table Column Header", "Is used to notify that the table column header has changed ", ATK_TYPE_OBJECT, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_TABLE_COLUMN_DESCRIPTION, g_param_spec_string (atk_object_name_property_table_column_description, "Accessible Table Column Description", "Is used to notify that the table columnscription has changed ", NULL, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_TABLE_ROW_HEADER, g_param_spec_object (atk_object_name_property_table_row_header, "Accessible Table Row Header", "Is used to notify that the table row header has changed ", ATK_TYPE_OBJECT, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_TABLE_ROW_DESCRIPTION, g_param_spec_string (atk_object_name_property_table_row_description, "Accessible Table Row Description", "Is used to notify that the table row description has changed ", NULL, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_TABLE_SUMMARY, g_param_spec_object (atk_object_name_property_table_summary, "Accessible Table Summary", "Is used to notify that the table summary has changed ", ATK_TYPE_OBJECT, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_TABLE_CAPTION_OBJECT, g_param_spec_object (atk_object_name_property_table_caption_object, "Accessible Table Caption Object", "Is used to notify that the table caption has changed ", ATK_TYPE_OBJECT, G_PARAM_READWRITE)); /* * The signal "children_changed" supports two details: * "add" and "remove" */ atk_object_signals[CHILDREN_CHANGED] = g_signal_new ("children_changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, G_STRUCT_OFFSET (AtkObjectClass, children_changed), NULL, NULL, g_cclosure_marshal_VOID__UINT_POINTER, G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_POINTER); atk_object_signals[FOCUS_EVENT] = g_signal_new ("focus_event", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (AtkObjectClass, focus_event), NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); atk_object_signals[PROPERTY_CHANGE] = g_signal_new ("property_change", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, G_STRUCT_OFFSET (AtkObjectClass, property_change), (GSignalAccumulator) NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); /* * The "state_change" signal supports details, one for each accessible * state type * (see atkstate.c). */ atk_object_signals[STATE_CHANGE] = g_signal_new ("state_change", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, G_STRUCT_OFFSET (AtkObjectClass, state_change), (GSignalAccumulator) NULL, NULL, atk_marshal_VOID__STRING_BOOLEAN, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_BOOLEAN); atk_object_signals[VISIBLE_DATA_CHANGED] = g_signal_new ("visible_data_changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (AtkObjectClass, visible_data_changed), (GSignalAccumulator) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); atk_object_signals[ACTIVE_DESCENDANT_CHANGED] = g_signal_new ("active_descendant_changed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, G_STRUCT_OFFSET (AtkObjectClass, active_descendant_changed), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER);}static voidatk_object_init (AtkObject *accessible, AtkObjectClass *klass){ accessible->name = NULL; accessible->description = NULL; accessible->accessible_parent = NULL; accessible->relation_set = atk_relation_set_new(); accessible->role = ATK_ROLE_UNKNOWN;}GTypeatk_implementor_get_type (void){ static GType type = 0; if (!type) { static const GTypeInfo typeInfo = { sizeof (AtkImplementorIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, } ; type = g_type_register_static (G_TYPE_INTERFACE, "AtkImplementorIface", &typeInfo, 0) ; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -