📄 atkobject.c
字号:
if (klass->ref_relation_set) return (klass->ref_relation_set) (accessible); else return NULL;}/** * atk_role_register: * @name: a character string describing the new role. * * Registers the role specified by @name. * * Returns: an #AtkRole for the new role. **/AtkRoleatk_role_register (const gchar *name){ if (!extra_roles) extra_roles = g_ptr_array_new (); g_ptr_array_add (extra_roles, g_strdup (name)); return extra_roles->len + ATK_ROLE_LAST_DEFINED;}/** * atk_object_get_role: * @accessible: an #AtkObject * * Gets the role of the accessible. * * Returns: an #AtkRole which is the role of the accessible **/AtkRoleatk_object_get_role (AtkObject *accessible) { AtkObjectClass *klass; g_return_val_if_fail (ATK_IS_OBJECT (accessible), ATK_ROLE_UNKNOWN); klass = ATK_OBJECT_GET_CLASS (accessible); if (klass->get_role) return (klass->get_role) (accessible); else return ATK_ROLE_UNKNOWN;}/** * atk_object_get_layer: * @accessible: an #AtkObject * * Gets the layer of the accessible. * * Deprecated: Use atk_component_get_layer instead. * * Returns: an #AtkLayer which is the layer of the accessible **/AtkLayeratk_object_get_layer (AtkObject *accessible) { AtkObjectClass *klass; g_return_val_if_fail (ATK_IS_OBJECT (accessible), ATK_LAYER_INVALID); klass = ATK_OBJECT_GET_CLASS (accessible); if (klass->get_layer) return (klass->get_layer) (accessible); else return ATK_LAYER_INVALID;}/** * atk_object_get_mdi_zorder: * @accessible: an #AtkObject * * Gets the zorder of the accessible. The value G_MININT will be returned * if the layer of the accessible is not ATK_LAYER_MDI. * * Deprecated: Use atk_component_get_mdi_zorder instead. * * Returns: a gint which is the zorder of the accessible, i.e. the depth at * which the component is shown in relation to other components in the same * container. * **/gintatk_object_get_mdi_zorder (AtkObject *accessible) { AtkObjectClass *klass; g_return_val_if_fail (ATK_IS_OBJECT (accessible), G_MININT); klass = ATK_OBJECT_GET_CLASS (accessible); if (klass->get_mdi_zorder) return (klass->get_mdi_zorder) (accessible); else return G_MININT;}/** * atk_object_ref_state_set: * @accessible: an #AtkObject * * Gets a reference to the state set of the accessible; the caller must * unreference it when it is no longer needed. * * Returns: a reference to an #AtkStateSet which is the state * set of the accessible **/AtkStateSet*atk_object_ref_state_set (AtkObject *accessible) { AtkObjectClass *klass; g_return_val_if_fail (ATK_IS_OBJECT (accessible), NULL); klass = ATK_OBJECT_GET_CLASS (accessible); if (klass->ref_state_set) return (klass->ref_state_set) (accessible); else return NULL;}/** * atk_object_get_index_in_parent: * @accessible: an #AtkObject * * Gets the 0-based index of this accessible in its parent; returns -1 if the * accessible does not have an accessible parent. * * Returns: an integer which is the index of the accessible in its parent **/gintatk_object_get_index_in_parent (AtkObject *accessible){ AtkObjectClass *klass; g_return_val_if_fail (ATK_OBJECT (accessible), -1); klass = ATK_OBJECT_GET_CLASS (accessible); if (klass->get_index_in_parent) return (klass->get_index_in_parent) (accessible); else return -1;}/** * atk_object_set_name: * @accessible: an #AtkObject * @name: a character string to be set as the accessible name * * Sets the accessible name of the accessible. **/voidatk_object_set_name (AtkObject *accessible, const gchar *name){ AtkObjectClass *klass; g_return_if_fail (ATK_IS_OBJECT (accessible)); g_return_if_fail (name != NULL); klass = ATK_OBJECT_GET_CLASS (accessible); if (klass->set_name) { (klass->set_name) (accessible, name); g_object_notify (G_OBJECT (accessible), atk_object_name_property_name); }}/** * atk_object_set_description: * @accessible: an #AtkObject * @description : a character string to be set as the accessible description * * Sets the accessible description of the accessible. **/voidatk_object_set_description (AtkObject *accessible, const gchar *description){ AtkObjectClass *klass; g_return_if_fail (ATK_IS_OBJECT (accessible)); g_return_if_fail (description != NULL); klass = ATK_OBJECT_GET_CLASS (accessible); if (klass->set_description) { (klass->set_description) (accessible, description); g_object_notify (G_OBJECT (accessible), atk_object_name_property_description); }}/** * atk_object_set_parent: * @accessible: an #AtkObject * @parent : an #AtkObject to be set as the accessible parent * * Sets the accessible parent of the accessible. **/voidatk_object_set_parent (AtkObject *accessible, AtkObject *parent){ AtkObjectClass *klass; g_return_if_fail (ATK_IS_OBJECT (accessible)); klass = ATK_OBJECT_GET_CLASS (accessible); if (klass->set_parent) { (klass->set_parent) (accessible, parent); g_object_notify (G_OBJECT (accessible), atk_object_name_property_parent); }}/** * atk_object_set_role: * @accessible: an #AtkObject * @role : an #AtkRole to be set as the role * * Sets the role of the accessible. **/voidatk_object_set_role (AtkObject *accessible, AtkRole role){ AtkObjectClass *klass; AtkRole old_role; g_return_if_fail (ATK_IS_OBJECT (accessible)); klass = ATK_OBJECT_GET_CLASS (accessible); if (klass->set_role) { old_role = atk_object_get_role (accessible); if (old_role != role) { (klass->set_role) (accessible, role); if (old_role != ATK_ROLE_UNKNOWN) /* Do not notify for initial role setting */ g_object_notify (G_OBJECT (accessible), atk_object_name_property_role); } }}/** * atk_object_connect_property_change_handler: * @accessible: an #AtkObject * @handler : a function to be called when a property changes its value * * Specifies a function to be called when a property changes value. * * Returns: a #guint which is the handler id used in * atk_object_remove_property_change_handler() **/guintatk_object_connect_property_change_handler (AtkObject *accessible, AtkPropertyChangeHandler *handler){ AtkObjectClass *klass; g_return_val_if_fail (ATK_IS_OBJECT (accessible), 0); g_return_val_if_fail ((handler != NULL), 0); klass = ATK_OBJECT_GET_CLASS (accessible); if (klass->connect_property_change_handler) return (klass->connect_property_change_handler) (accessible, handler); else return 0;}/** * atk_object_remove_property_change_handler: * @accessible: an #AtkObject * @handler_id : a guint which identifies the handler to be removed. * * Removes a property change handler. **/voidatk_object_remove_property_change_handler (AtkObject *accessible, guint handler_id){ AtkObjectClass *klass; g_return_if_fail (ATK_IS_OBJECT (accessible)); klass = ATK_OBJECT_GET_CLASS (accessible); if (klass->remove_property_change_handler) (klass->remove_property_change_handler) (accessible, handler_id);}/** * atk_object_notify_state_change: * @accessible: an #AtkObject * @state: an #AtkState whose state is changed * @value : a gboolean which indicates whether the state is being set on or off * * Emits a state-change signal for the specified state. **/voidatk_object_notify_state_change (AtkObject *accessible, AtkState state, gboolean value){ G_CONST_RETURN gchar* name; g_return_if_fail (ATK_IS_OBJECT (accessible)); name = atk_state_type_get_name (state); g_signal_emit (accessible, atk_object_signals[STATE_CHANGE], g_quark_from_string (name), name, value, NULL);}/** * atk_implementor_ref_accessible: * @implementor: The #GObject instance which should implement #AtkImplementorIface * if a non-null return value is required. * * Gets a reference to an object's #AtkObject implementation, if * the object implements #AtkObjectIface * * Returns: a reference to an object's #AtkObject implementation */AtkObject *atk_implementor_ref_accessible (AtkImplementor *implementor){ AtkImplementorIface *iface; AtkObject *accessible = NULL; g_return_val_if_fail (ATK_IS_IMPLEMENTOR (implementor), NULL); iface = ATK_IMPLEMENTOR_GET_IFACE (implementor); if (iface != NULL) accessible = iface->ref_accessible (implementor); g_return_val_if_fail ((accessible != NULL), NULL); return accessible;} /** * atk_object_get_attributes: * @accessible: An #AtkObject. * * Get a list of properties applied to this object as a whole, as an #AtkAttributeSet consisting of * name-value pairs. As such these attributes may be considered weakly-typed properties or annotations, * as distinct from strongly-typed object data available via other get/set methods. * Not all objects have explicit "name-value pair" #AtkAttributeSet properties. * * Since: ATK 1.12 * * Returns: an #AtkAttributeSet consisting of all explicit properties/annotations applied to * the object, or an empty set if the object has no name-value pair attributes assigned to it. */AtkAttributeSet *atk_object_get_attributes (AtkObject *accessible){ AtkObjectClass *klass; g_return_val_if_fail (ATK_IS_OBJECT (accessible), NULL); klass = ATK_OBJECT_GET_CLASS (accessible); if (klass->get_attributes) return (klass->get_attributes) (accessible); else return NULL; }static AtkRelationSet*atk_object_real_ref_relation_set (AtkObject *accessible){ g_return_val_if_fail (accessible->relation_set, NULL); g_object_ref (accessible->relation_set); return accessible->relation_set;}static voidatk_object_real_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec){ AtkObject *accessible; accessible = ATK_OBJECT (object); switch (prop_id) { case PROP_NAME: atk_object_set_name (accessible, g_value_get_string (value)); break; case PROP_DESCRIPTION: atk_object_set_description (accessible, g_value_get_string (value)); break; case PROP_ROLE: atk_object_set_role (accessible, g_value_get_int (value)); break; case PROP_PARENT: atk_object_set_parent (accessible, g_value_get_object (value)); break; case PROP_VALUE: if (ATK_IS_VALUE (accessible)) atk_value_set_current_value (ATK_VALUE (accessible), value); break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -