Пример #1
0
static void
gail_notebook_page_get_extents (AtkComponent *component,
                                gint         *x,
                                gint         *y,
                                gint         *width,
                                gint         *height,
                                AtkCoordType coord_type)
{
  AtkObject *atk_label;

  g_return_if_fail (GAIL_IS_NOTEBOOK_PAGE (component));

  atk_label = _gail_notebook_page_get_tab_label (GAIL_NOTEBOOK_PAGE (component));

  if (!atk_label)
    {
      AtkObject *child;

      *width = 0;
      *height = 0;

      child = atk_object_ref_accessible_child (ATK_OBJECT (component), 0);
      gail_return_if_fail (child);

      atk_component_get_position (ATK_COMPONENT (child), x, y, coord_type);
      g_object_unref (child);
    }
  else
    {
      atk_component_get_extents (ATK_COMPONENT (atk_label), 
                                 x, y, width, height, coord_type);
    }
  return; 
}
double AccessibilityUIElement::clickPointY()
{
    if (!ATK_IS_COMPONENT(m_element.get()))
        return 0;

    int x, y;
    atk_component_get_position(ATK_COMPONENT(m_element.get()), &x, &y, ATK_XY_WINDOW);

    int width, height;
    atk_component_get_size(ATK_COMPONENT(m_element.get()), &width, &height);

    return y + height / 2.0;
}
Пример #3
0
/* AtkObject.h */
static void
nux_area_accessible_initialize(AtkObject* accessible,
                               gpointer data)
{
  nux::Object* nux_object = NULL;
  nux::Area* area = NULL;

  ATK_OBJECT_CLASS(nux_area_accessible_parent_class)->initialize(accessible, data);

  accessible->role = ATK_ROLE_UNKNOWN;

  nux_object = nux_object_accessible_get_object(NUX_OBJECT_ACCESSIBLE(accessible));
  area = dynamic_cast<nux::Area*>(nux_object);

  /* focus support based on Focusable, used on the Dash */
  area->key_nav_focus_change.connect(sigc::bind(sigc::ptr_fun(on_focus_changed_cb), accessible));

  atk_component_add_focus_handler(ATK_COMPONENT(accessible),
                                  nux_area_accessible_focus_handler);

  /* NOTE: we can't search for the parent window on initialization as a
     general rule, or we could enter an infinite loop. At area this
     is done on the focus event. On the Switcher this is done on their
     initialization itself */
}
G_MODULE_EXPORT void
test_init (gchar *path)
{
  int i;

  if (path == NULL)
     g_error("No test data path provided");
  tdata_path = path;

  g_type_init();
  for(i = 0; i < sizeof(comps) / sizeof(comps[0]); i++)
    {
      MyAtkComponent *mycomp = MY_ATK_COMPONENT(g_object_new(MY_TYPE_ATK_COMPONENT, NULL));
        
      mycomp->extent = extents[i];
      mycomp->is_extent_may_changed = extent_may_changed[i];
      mycomp->layer = layers[i];
      mycomp->zorder = zorders[i];
      
      comps[i] = ATK_COMPONENT(mycomp);
    }
    
  my_atk_object_add_child(MY_ATK_OBJECT(comps[2]), MY_ATK_OBJECT(comps[0]));
  my_atk_object_add_child(MY_ATK_OBJECT(comps[2]), MY_ATK_OBJECT(comps[1]));
}
Пример #5
0
static void
component_interface_get_extents (AtkComponent *component,
                                 gint *x,
                                 gint *y,
                                 gint *width,
                                 gint *height,
                                 AtkCoordType coord_type)
{
	GObject *g_obj;
	AtkObject *ea_canvas;
	EDayViewMainItem *main_item;
	EDayView *day_view;

	*x = *y = *width = *height = 0;

	g_return_if_fail (EA_IS_DAY_VIEW_MAIN_ITEM (component));

	g_obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (component));
	if (!g_obj)
		/* defunct object*/
		return;
	main_item = E_DAY_VIEW_MAIN_ITEM (g_obj);
	day_view = e_day_view_main_item_get_day_view (main_item);

	ea_canvas = gtk_widget_get_accessible (day_view->main_canvas);
	atk_component_get_extents (
		ATK_COMPONENT (ea_canvas), x, y,
		width, height, coord_type);
}
Пример #6
0
static void
eti_get_extents (AtkComponent *component,
                 gint *x,
                 gint *y,
                 gint *width,
                 gint *height,
                 AtkCoordType coord_type)
{
	ETableItem *item;
	AtkObject *parent;

	item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (component)));
	if (!item)
		return;

	parent = ATK_OBJECT (component)->accessible_parent;
	if (parent && ATK_IS_COMPONENT (parent))
		atk_component_get_extents (
			ATK_COMPONENT (parent),
			x, y,
			width, height,
			coord_type);

	if (parent && GAL_A11Y_IS_E_TABLE_CLICK_TO_ADD (parent)) {
		ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (
			atk_gobject_accessible_get_object (
			ATK_GOBJECT_ACCESSIBLE (parent)));
		if (etcta) {
			*width = etcta->width;
			*height = etcta->height;
		}
	}
}
Пример #7
0
static gboolean
gal_a11y_e_cell_grab_focus (AtkComponent *component)
{
	GalA11yECell *a11y;
	gint index;
	GtkWidget *toplevel;
	GalA11yETableItem *a11yTableItem;

	a11y = GAL_A11Y_E_CELL (component);

	/* for e_cell_vbox's children, we just grab the e_cell_vbox */
	if (GAL_A11Y_IS_E_CELL_VBOX (a11y->parent)) {
		return atk_component_grab_focus (ATK_COMPONENT (a11y->parent));
	}

	a11yTableItem = GAL_A11Y_E_TABLE_ITEM (a11y->parent);
	index = atk_object_get_index_in_parent (ATK_OBJECT (a11y));

	atk_selection_clear_selection (ATK_SELECTION (a11yTableItem));
	atk_selection_add_selection (ATK_SELECTION (a11yTableItem), index);

	gtk_widget_grab_focus (
		GTK_WIDGET (GNOME_CANVAS_ITEM (a11y->item)->canvas));
	toplevel = gtk_widget_get_toplevel (
		GTK_WIDGET (GNOME_CANVAS_ITEM (a11y->item)->canvas));
	if (toplevel && gtk_widget_is_toplevel (toplevel))
		gtk_window_present (GTK_WINDOW (toplevel));

	return TRUE;
}
Пример #8
0
static DBusMessage *
impl_Embedded (DBusConnection *bus,
                    DBusMessage *message,
                    void *user_data)
{
  AtkObject *object = (AtkObject *) user_data;
  char *path;
  gchar *id;

  if (!dbus_message_get_args (message, NULL, DBUS_TYPE_STRING, &path, DBUS_TYPE_INVALID))
    {
      return droute_invalid_arguments_error (message);
    }
  id = g_strconcat (dbus_message_get_sender (message), ":", path, NULL);
  g_object_set_data_full (G_OBJECT (object), "dbus-plug-parent", id, (GDestroyNotify)g_free);

  if (ATK_IS_COMPONENT (object))
    {
      AtkComponent *component = ATK_COMPONENT (object);
      AtkComponentIface *iface = ATK_COMPONENT_GET_IFACE (component);
      iface->get_extents = atspi_plug_component_get_extents;
      iface->get_size = atspi_plug_component_get_size;
      iface->get_position = atspi_plug_component_get_position;
    }

  /* Retrieve some info about the children, if they exist, when
     embedding the plug to ensure the a11y subtree is generated.
     https://bugzilla.gnome.org/show_bug.cgi?id=663876 */
  atk_object_get_n_accessible_children (object);

  return dbus_message_new_method_return (message);
}
Пример #9
0
static void
gail_button_get_image_position (AtkImage     *image,
                                gint	     *x,
                                gint	     *y,
                                AtkCoordType coord_type)
{
  GtkWidget *widget;
  GtkImage  *button_image;
  AtkObject *obj;

  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image));

  if (widget == NULL)
    {
    /*
     * State is defunct
     */
      *x = G_MININT;
      *y = G_MININT;
      return;
    }

  button_image = get_image_from_button (widget);

  if (button_image != NULL)
    {
      obj = gtk_widget_get_accessible (GTK_WIDGET (button_image));
      atk_component_get_position (ATK_COMPONENT (obj), x, y, coord_type); 
    }
  else
    {
      *x = G_MININT;
      *y = G_MININT;
    }
}
AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int x, int y)
{
    if (!m_element)
        return 0;

    return AccessibilityUIElement(atk_component_ref_accessible_at_point(ATK_COMPONENT(m_element), x, y, ATK_XY_WINDOW));
}
Пример #11
0
static void
gtk_icon_view_item_accessible_get_image_position (AtkImage    *image,
                                                  gint        *x,
                                                  gint        *y,
                                                  AtkCoordType coord_type)
{
  GtkIconViewItemAccessible *item;
  GdkRectangle box;

  item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (image);

  if (!GTK_IS_ICON_VIEW (item->widget))
    return;

  if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
    return;

  atk_component_get_position (ATK_COMPONENT (image), x, y, coord_type);

  if (get_pixbuf_box (GTK_ICON_VIEW (item->widget), item->item, &box))
    {
      *x+= box.x - item->item->cell_area.x;
      *y+= box.y - item->item->cell_area.y;
    }

}
Пример #12
0
static void
gail_pixmap_get_image_position (AtkImage       *obj,
                                gint           *x,
                                gint           *y,
                                AtkCoordType   coord_type)
{
  atk_component_get_position (ATK_COMPONENT (obj), x, y, coord_type);
}
double AccessibilityUIElement::height()
{
    int width, height;

    atk_component_get_size(ATK_COMPONENT(m_element), &width, &height);

    return height;
}
Пример #14
0
static void
gail_image_cell_get_image_position (AtkImage     *image,
                                    gint         *x,
                                    gint         *y,
                                    AtkCoordType coord_type)
{
  atk_component_get_position (ATK_COMPONENT (image), x, y, coord_type);
}
double AccessibilityUIElement::y()
{
    int x, y;

    atk_component_get_position(ATK_COMPONENT(m_element), &x, &y, ATK_XY_SCREEN);

    return y;
}
Пример #16
0
double AccessibilityUIElement::height()
{
    if (!m_element || !ATK_IS_OBJECT(m_element.get()))
        return 0.0f;

    int width, height;
    atk_component_get_size(ATK_COMPONENT(m_element.get()), &width, &height);
    return height;
}
Пример #17
0
double AccessibilityUIElement::y()
{
    if (!m_element || !ATK_IS_OBJECT(m_element.get()))
        return 0.0f;

    int x, y;
    atk_component_get_position(ATK_COMPONENT(m_element.get()), &x, &y, ATK_XY_SCREEN);
    return y;
}
double AccessibilityUIElement::width()
{
    if (!ATK_IS_COMPONENT(m_element.get()))
        return 0;

    int width, height;
    atk_component_get_size(ATK_COMPONENT(m_element.get()), &width, &height);
    return width;
}
double AccessibilityUIElement::x()
{
    if (!ATK_IS_COMPONENT(m_element.get()))
        return 0;

    int x, y;
    atk_component_get_position(ATK_COMPONENT(m_element.get()), &x, &y, ATK_XY_SCREEN);
    return x;
}
Пример #20
0
static void
wnck_workspace_accessible_get_extents (AtkComponent *component,
                                       int          *x,
                                       int          *y,
                                       int          *width,
                                       int          *height,
                                       AtkCoordType  coords)
{
  AtkGObjectAccessible *atk_gobj;
  WnckPager *pager;
  GdkRectangle rect;
  GtkWidget *widget;
  AtkObject *parent;
  GObject *g_obj;
  int px, py;

  g_return_if_fail (WNCK_IS_WORKSPACE_ACCESSIBLE (component));

  atk_gobj = ATK_GOBJECT_ACCESSIBLE (component);
  g_obj = atk_gobject_accessible_get_object (atk_gobj);
  if (g_obj == NULL)
    return;

  g_return_if_fail (WNCK_IS_WORKSPACE (g_obj));

  parent = atk_object_get_parent (ATK_OBJECT(component));
#if GTK_CHECK_VERSION(2,21,0)
  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (parent));
#else
  widget = GTK_ACCESSIBLE (parent)->widget;
#endif

  if (widget == NULL)
    {
      /*
       *State is defunct
       */
      return;
    }

  g_return_if_fail (WNCK_IS_PAGER (widget));
  pager = WNCK_PAGER (widget);

  g_return_if_fail (WNCK_IS_PAGER (pager));

  atk_component_get_position (ATK_COMPONENT (parent), &px,&py, coords);

  _wnck_pager_get_workspace_rect (pager, WNCK_WORKSPACE_ACCESSIBLE (component)->index, &rect);

  *x = rect.x + px;
  *y = rect.y + py;
  *height = rect.height;
  *width = rect.width;
}
Пример #21
0
static gint
gtk_icon_view_item_accessible_get_offset_at_point (AtkText      *text,
                                                   gint          x,
                                                   gint          y,
                                                   AtkCoordType coord_type)
{
  GtkIconViewItemAccessible *item;
  gint offset = 0;
#if 0
  GtkIconView *icon_view;
  const gchar *item_text;
  gint index;
  gint l_x, l_y;
#endif

  item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (text);

  if (!GTK_IS_ICON_VIEW (item->widget))
    return -1;

  if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
    return -1;

#if 0
  icon_view = GTK_ICON_VIEW (item->widget);
      /* FIXME we probably have to use GailTextCell to salvage this */
  gtk_icon_view_update_item_text (icon_view, item->item);
  atk_component_get_position (ATK_COMPONENT (text), &l_x, &l_y, coord_type);
  x -= l_x + item->item->layout_x - item->item->x;
  x +=  ((item->item->width - item->item->layout_width) / 2) + (MAX (item->item->pixbuf_width, icon_view->priv->item_width) - item->item->width) / 2,
  y -= l_y + item->item->layout_y - item->item->y;
  item_text = pango_layout_get_text (icon_view->priv->layout);
  if (!pango_layout_xy_to_index (icon_view->priv->layout, 
                                x * PANGO_SCALE,
                                y * PANGO_SCALE,
                                &index, NULL))
    {
      if (x < 0 || y < 0)
        index = 0;
      else
        index = -1;
    } 
  if (index == -1)
    offset = g_utf8_strlen (item_text, -1);
  else
    offset = g_utf8_pointer_to_offset (item_text, item_text + index);
#endif
  return offset;
}
static void
gucharmap_chartable_cell_accessible_get_extents (AtkComponent *component,
                                 gint         *x,
                                 gint         *y,
                                 gint         *width,
                                 gint         *height,
                                 AtkCoordType coord_type)
{
  GucharmapChartableCellAccessible *cell;
  AtkObject *cell_parent;
  GucharmapChartable *chartable;
  GucharmapChartablePrivate *chartable_priv;
  gint real_x, real_y, real_width, real_height;
  gint row, column;

  cell = GUCHARMAP_CHARTABLE_CELL_ACCESSIBLE (component);

  cell_parent = atk_object_get_parent (ATK_OBJECT (cell));

  /*
   * Is the cell visible on the screen
   */
  chartable = GUCHARMAP_CHARTABLE (cell->widget);
  chartable_priv = chartable->priv;

  if (cell->index >= chartable_priv->page_first_cell && cell->index < chartable_priv->page_first_cell + chartable_priv->rows * chartable_priv->cols)
    {
      atk_component_get_extents (ATK_COMPONENT (cell_parent), 
                                 &real_x, &real_y, &real_width, &real_height, 
                                 coord_type);
      row = (cell->index - chartable_priv->page_first_cell)/ chartable_priv->cols;
      column = _gucharmap_chartable_cell_column (chartable, cell->index);
      *x = real_x + _gucharmap_chartable_x_offset (chartable, column);
      *y = real_y + _gucharmap_chartable_y_offset (chartable, row);
      *width = _gucharmap_chartable_column_width (chartable, column);
      *height = _gucharmap_chartable_row_height (chartable, row);
    }
  else
    {
      *x = G_MININT;
      *y = G_MININT;
    }
}
Пример #23
0
static void
gtk_icon_view_item_accessible_get_character_extents (AtkText      *text,
                                                     gint         offset,
                                                     gint         *x,
                                                     gint         *y,
                                                     gint         *width,
                                                     gint         *height,
                                                     AtkCoordType coord_type)
{
  GtkIconViewItemAccessible *item;
#if 0
  GtkIconView *icon_view;
  PangoRectangle char_rect;
  const gchar *item_text;
  gint index;
#endif

  item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (text);

  if (!GTK_IS_ICON_VIEW (item->widget))
    return;

  if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
    return;

#if 0
  icon_view = GTK_ICON_VIEW (item->widget);
      /* FIXME we probably have to use GailTextCell to salvage this */
  gtk_icon_view_update_item_text (icon_view, item->item);
  item_text = pango_layout_get_text (icon_view->priv->layout);
  index = g_utf8_offset_to_pointer (item_text, offset) - item_text;
  pango_layout_index_to_pos (icon_view->priv->layout, index, &char_rect);

  atk_component_get_position (ATK_COMPONENT (text), x, y, coord_type);
  *x += item->item->layout_x - item->item->x + char_rect.x / PANGO_SCALE;
  /* Look at gtk_icon_view_paint_item() to see where the text is. */
  *x -=  ((item->item->width - item->item->layout_width) / 2) + (MAX (item->item->pixbuf_width, icon_view->priv->item_width) - item->item->width) / 2,
  *y += item->item->layout_y - item->item->y + char_rect.y / PANGO_SCALE;
  *width = char_rect.width / PANGO_SCALE;
  *height = char_rect.height / PANGO_SCALE;
#endif
}
Пример #24
0
/* Component IFace */
static void
gal_a11y_e_cell_get_extents (AtkComponent *component,
                             gint *x,
                             gint *y,
                             gint *width,
                             gint *height,
                             AtkCoordType coord_type)
{
	GalA11yECell *a11y = GAL_A11Y_E_CELL (component);
	GtkWidget *tableOrTree;
	gint row;
	gint col;
	gint xval;
	gint yval;

	row = a11y->row;
	col = a11y->view_col;

	tableOrTree = gtk_widget_get_parent (GTK_WIDGET (a11y->item->parent.canvas));
	if (E_IS_TREE (tableOrTree)) {
		e_tree_get_cell_geometry (
			E_TREE (tableOrTree),
			row, col, &xval, &yval,
			width, height);
	} else {
		e_table_get_cell_geometry (
			E_TABLE (tableOrTree),
			row, col, &xval, &yval,
			width, height);
	}

	atk_component_get_extents (
		ATK_COMPONENT (a11y->parent),
		x, y, NULL, NULL, coord_type);
	if (x && *x != G_MININT)
		*x += xval;
	if (y && *y != G_MININT)
		*y += yval;
}
Пример #25
0
static gint
table_interface_get_row_extent_at (AtkTable *table,
                                   gint row,
                                   gint column)
{
	gint index;
	gint width = 0, height = 0;
	AtkObject *child;
	EaDayViewMainItem * ea_main_item = EA_DAY_VIEW_MAIN_ITEM (table);

	index = ea_day_view_main_item_get_child_index_at (
		ea_main_item,
		row, column);
	child = atk_object_ref_accessible_child (
		ATK_OBJECT (ea_main_item),
		index);
	if (child)
		atk_component_get_size (
			ATK_COMPONENT (child), &width, &height);

	return height;
}
Пример #26
0
static void
_test_focus_on_entry(AtkObject *obj)
{
   AtkObject *focused_obj = NULL;
   gboolean success = FALSE;

   _printf("Testing focus....\n");

   /* changing focus */
   g_assert(ATK_IS_COMPONENT(obj));
   success = atk_component_grab_focus(ATK_COMPONENT(obj));
   g_assert(success);

   /* now focus should point to our button*/
   focused_obj = atk_get_focus_object();
   g_assert(focused_obj);

   g_assert(focused_obj == obj);

   _printf("DONE. All focus test passed successfully \n");
   eail_test_code_called = TRUE;
}
Пример #27
0
static void
gtk_icon_view_item_accessible_get_extents (AtkComponent *component,
                                           gint         *x,
                                           gint         *y,
                                           gint         *width,
                                           gint         *height,
                                           AtkCoordType  coord_type)
{
  GtkIconViewItemAccessible *item;
  AtkObject *parent_obj;
  gint l_x, l_y;

  g_return_if_fail (GTK_IS_ICON_VIEW_ITEM_ACCESSIBLE (component));

  item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (component);
  if (!GTK_IS_WIDGET (item->widget))
    return;

  if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
    return;

  *width = item->item->cell_area.width;
  *height = item->item->cell_area.height;
  if (gtk_icon_view_item_accessible_is_showing (item))
    {
      parent_obj = gtk_widget_get_accessible (item->widget);
      atk_component_get_position (ATK_COMPONENT (parent_obj), &l_x, &l_y, coord_type);
      *x = l_x + item->item->cell_area.x;
      *y = l_y + item->item->cell_area.y;
    }
  else
    {
      *x = G_MININT;
      *y = G_MININT;
    }
}
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::elementAtPoint(int x, int y)
{
    if (!ATK_IS_COMPONENT(m_element.get()))
        return nullptr;

    GRefPtr<AtkObject> objectAtPoint = adoptGRef(atk_component_ref_accessible_at_point(ATK_COMPONENT(m_element.get()), x, y, ATK_XY_WINDOW));
    return AccessibilityUIElement::create(objectAtPoint ? objectAtPoint.get() : m_element.get());
}
G_MODULE_EXPORT AtkObject *
test_get_root (void)
{
  return ATK_COMPONENT(comps[2]);
}