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

📄 atkcomponent.c

📁 linux下图形库开发包atk-1.4.0.tar.gz
💻 C
📖 第 1 页 / 共 2 页
字号:
/** * atk_component_get_size: * @component: an #AtkComponent * @width: address of #gint to put width of @component * @height: address of #gint to put height of @component * * Gets the size of the @component in terms of width and height. **/voidatk_component_get_size       (AtkComponent    *component,                              gint            *width,                              gint            *height){  AtkComponentIface *iface = NULL;  gint local_width, local_height;  gint *real_width, *real_height;  g_return_if_fail (ATK_IS_COMPONENT (component));  if (width)    real_width = width;  else    real_width = &local_width;  if (height)    real_height = height;  else    real_height = &local_height;  g_return_if_fail (ATK_IS_COMPONENT (component));  iface = ATK_COMPONENT_GET_IFACE (component);  if (iface->get_size)    (iface->get_size) (component, real_width, real_height);}/** * atk_component_get_layer: * @component: an #AtkComponent * * Gets the layer of the component. * * Returns: an #AtkLayer which is the layer of the component **/AtkLayeratk_component_get_layer (AtkComponent *component) {  AtkComponentIface *iface;  g_return_val_if_fail (ATK_IS_COMPONENT (component), ATK_LAYER_INVALID);  iface = ATK_COMPONENT_GET_IFACE (component);  if (iface->get_layer)    return (iface->get_layer) (component);  else    return ATK_LAYER_WIDGET;}/** * atk_component_get_mdi_zorder: * @component: an #AtkComponent * * Gets the zorder of the component. The value G_MININT will be returned  * if the layer of the component is not ATK_LAYER_MDI or ATK_LAYER_WINDOW. * * Returns: a gint which is the zorder of the component, i.e. the depth at  * which the component is shown in relation to other components in the same  * container. **/gintatk_component_get_mdi_zorder (AtkComponent *component) {  AtkComponentIface *iface;  g_return_val_if_fail (ATK_IS_COMPONENT (component), G_MININT);  iface = ATK_COMPONENT_GET_IFACE (component);  if (iface->get_mdi_zorder)    return (iface->get_mdi_zorder) (component);  else    return G_MININT;}/** * atk_component_grab_focus: * @component: an #AtkComponent * * Grabs focus for this @component. * * Returns: %TRUE if successful, %FALSE otherwise. **/gbooleanatk_component_grab_focus (AtkComponent    *component){  AtkComponentIface *iface = NULL;  g_return_val_if_fail (ATK_IS_COMPONENT (component), FALSE);  iface = ATK_COMPONENT_GET_IFACE (component);  if (iface->grab_focus)    return (iface->grab_focus) (component);  else    return FALSE;}/** * atk_component_set_extents: * @component: an #AtkComponent * @x: x coordinate * @y: y coordinate * @width: width to set for @component * @height: height to set for @component * @coord_type: specifies whether the coordinates are relative to the screen * or to the components top level window * * Sets the extents of @component. * * Returns: %TRUE or %FALSE whether the extents were set or not **/gbooleanatk_component_set_extents   (AtkComponent    *component,                             gint            x,                             gint            y,                             gint            width,                             gint            height,                             AtkCoordType    coord_type){  AtkComponentIface *iface = NULL;  g_return_val_if_fail (ATK_IS_COMPONENT (component), FALSE);  iface = ATK_COMPONENT_GET_IFACE (component);  if (iface->set_extents)    return (iface->set_extents) (component, x, y, width, height, coord_type);  else    return FALSE;}/** * atk_component_set_position: * @component: an #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 * * Sets the postition of @component. *  * Returns: %TRUE or %FALSE whether or not the position was set or not **/gbooleanatk_component_set_position   (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->set_position)    return (iface->set_position) (component, x, y, coord_type);  else    return FALSE;}/** * atk_component_set_size: * @component: an #AtkComponent * @width: width to set for @component * @height: height to set for @component * * Set the size of the @component in terms of width and height. * * Returns: %TRUE or %FALSE whether the size was set or not **/gbooleanatk_component_set_size       (AtkComponent    *component,                              gint            x,                              gint            y){  AtkComponentIface *iface = NULL;  g_return_val_if_fail (ATK_IS_COMPONENT (component), FALSE);  iface = ATK_COMPONENT_GET_IFACE (component);  if (iface->set_size)    return (iface->set_size) (component, x, y);  else    return FALSE;}static gbooleanatk_component_real_contains (AtkComponent *component,                             gint         x,                             gint         y,                             AtkCoordType coord_type){  gint real_x, real_y, width, height;  real_x = real_y = width = height = 0;  atk_component_get_extents (component, &real_x, &real_y, &width, &height, coord_type);  if ((x >= real_x) &&      (x < real_x + width) &&      (y >= real_y) &&      (y < real_y + height))    return TRUE;  else    return FALSE;}static AtkObject* atk_component_real_ref_accessible_at_point (AtkComponent *component,                                            gint         x,                                            gint         y,                                            AtkCoordType coord_type){  gint count, i;  count = atk_object_get_n_accessible_children (ATK_OBJECT (component));  for (i = 0; i < count; i++)  {    AtkObject *obj;    obj = atk_object_ref_accessible_child (ATK_OBJECT (component), i);    if (obj != NULL)    {      if (atk_component_contains (ATK_COMPONENT (obj), x, y, coord_type))      {        return obj;      }      else      {        g_object_unref (obj);      }    }  }  return NULL;}static voidatk_component_real_get_position (AtkComponent *component,                                 gint         *x,                                 gint         *y,                                 AtkCoordType coord_type){  gint width, height;  atk_component_get_extents (component, x, y, &width, &height, coord_type);}static voidatk_component_real_get_size (AtkComponent *component,                             gint         *width,                             gint         *height){  gint x, y;  AtkCoordType coord_type;  /*   * Pick one coordinate type; it does not matter for size   */  coord_type = ATK_XY_WINDOW;  atk_component_get_extents (component, &x, &y, width, height, coord_type);}

⌨️ 快捷键说明

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