⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 atkcomponent.c

📁 linux下图形库开发包atk-1.4.0.tar.gz
💻 C
📖 第 1 页 / 共 2 页
字号:
/* 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 "atkcomponent.h"static void       atk_component_base_init (AtkComponentIface *class);static gboolean   atk_component_real_contains                (AtkComponent *component,                                                              gint         x,                                                              gint         y,                                                              AtkCoordType coord_type);static AtkObject* atk_component_real_ref_accessible_at_point (AtkComponent *component,                                                              gint         x,                                                              gint         y,                                                              AtkCoordType coord_type);static void      atk_component_real_get_position             (AtkComponent *component,                                                              gint         *x,                                                              gint         *y,                                                              AtkCoordType coord_type);static void      atk_component_real_get_size                 (AtkComponent *component,                                                              gint         *width,                                                              gint         *height);GTypeatk_component_get_type (void){  static GType type = 0;  if (!type) {    static const GTypeInfo tinfo =    {      sizeof (AtkComponentIface),      (GBaseInitFunc) atk_component_base_init,      (GBaseFinalizeFunc) NULL,    };    type = g_type_register_static (G_TYPE_INTERFACE, "AtkComponent", &tinfo, 0);  }  return type;}static voidatk_component_base_init (AtkComponentIface *class){  static gboolean initialized = FALSE;  if (! initialized)    {      class->ref_accessible_at_point = atk_component_real_ref_accessible_at_point;      class->contains = atk_component_real_contains;      class->get_position = atk_component_real_get_position;      class->get_size = atk_component_real_get_size;    }}/** * atk_component_add_focus_handler: * @component: The #AtkComponent to attach the @handler to * @handler: The #AtkFocusHandler to be attached to @component * * Add the specified handler to the set of functions to be called  * when this object receives focus events (in or out). If the handler is * already added it is not added again * * Returns: a handler id which can be used in atk_component_remove_focus_handler * or zero if the handler was already added. **/guintatk_component_add_focus_handler (AtkComponent    *component,                                 AtkFocusHandler handler){  AtkComponentIface *iface = NULL;  g_return_val_if_fail (ATK_IS_COMPONENT (component), 0);  iface = ATK_COMPONENT_GET_IFACE (component);  if (iface->add_focus_handler)    return (iface->add_focus_handler) (component, handler);  else    return 0;}/** * atk_component_remove_focus_handler: * @component: the #AtkComponent to remove the focus handler from * @handler_id: the handler id of the focus handler to be removed * from @component * * Remove the handler specified by @handler_id from the list of * functions to be executed when this object receives focus events  * (in or out). **/voidatk_component_remove_focus_handler (AtkComponent    *component,                                    guint           handler_id){  AtkComponentIface *iface = NULL;  g_return_if_fail (ATK_IS_COMPONENT (component));  iface = ATK_COMPONENT_GET_IFACE (component);  if (iface->remove_focus_handler)    (iface->remove_focus_handler) (component, handler_id);}/** * atk_component_contains: * @component: the #AtkComponent * @x: x coordinate * @y: y coordinate * @coord_type: specifies whether the coordinates are relative to the screen * or to the components top level window * * Checks whether the specified point is within the extent of the @component. * * Returns: %TRUE or %FALSE indicating whether the specified point is within * the extent of the @component or not **/gbooleanatk_component_contains (AtkComponent    *component,                        gint            x,                        gint            y,                        AtkCoordType    coord_type){  AtkComponentIface *iface = NULL;  g_return_val_if_fail (ATK_IS_COMPONENT (component), FALSE);  iface = ATK_COMPONENT_GET_IFACE (component);  if (iface->contains)    return (iface->contains) (component, x, y, coord_type);  else    return FALSE;}/** * atk_component_ref_accessible_at_point: * @component: the #AtkComponent * @x: x coordinate * @y: y coordinate * @coord_type: specifies whether the coordinates are relative to the screen * or to the components top level window * * Gets a reference to the accessible child, if one exists, at the * coordinate point specified by @x and @y. * * Returns: a reference to the accessible child, if one exists **/AtkObject*atk_component_ref_accessible_at_point (AtkComponent    *component,                                       gint            x,                                       gint            y,                                       AtkCoordType    coord_type){  AtkComponentIface *iface = NULL;  g_return_val_if_fail (ATK_IS_COMPONENT (component), NULL);  iface = ATK_COMPONENT_GET_IFACE (component);  if (iface->ref_accessible_at_point)    return (iface->ref_accessible_at_point) (component, x, y, coord_type);  else    return NULL;}/** * atk_component_get_extents: * @component: an #AtkComponent * @x: address of #gint to put x coordinate * @y: address of #gint to put y coordinate * @width: address of #gint to put width * @height: address of #gint to put height * @coord_type: specifies whether the coordinates are relative to the screen * or to the components top level window * * Gets the rectangle which gives the extent of the @component. * **/voidatk_component_get_extents    (AtkComponent    *component,                              gint            *x,                              gint            *y,                              gint            *width,                              gint            *height,                              AtkCoordType    coord_type){  AtkComponentIface *iface = NULL;  gint local_x, local_y, local_width, local_height;  gint *real_x, *real_y, *real_width, *real_height;  g_return_if_fail (ATK_IS_COMPONENT (component));  if (x)    real_x = x;  else    real_x = &local_x;  if (y)    real_y = y;  else    real_y = &local_y;  if (width)    real_width = width;  else    real_width = &local_width;  if (height)    real_height = height;  else    real_height = &local_height;  iface = ATK_COMPONENT_GET_IFACE (component);  if (iface->get_extents)    (iface->get_extents) (component, real_x, real_y, real_width, real_height, coord_type);}/** * atk_component_get_position: * @component: an #AtkComponent * @x: address of #gint to put x coordinate position * @y: address of #gint to put y coordinate position * @coord_type: specifies whether the coordinates are relative to the screen * or to the components top level window * * Gets the position of @component in the form of  * a point specifying @component's top-left corner. **/voidatk_component_get_position   (AtkComponent    *component,                              gint            *x,                              gint            *y,                              AtkCoordType    coord_type){  AtkComponentIface *iface = NULL;  gint local_x, local_y;  gint *real_x, *real_y;  g_return_if_fail (ATK_IS_COMPONENT (component));  if (x)    real_x = x;  else    real_x = &local_x;  if (y)    real_y = y;  else    real_y = &local_y;  iface = ATK_COMPONENT_GET_IFACE (component);  if (iface->get_position)    (iface->get_position) (component, real_x, real_y, coord_type);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -