/**
 * AccessibleImage_getImageExtents:
 * @obj: a pointer to the #AccessibleImage implementor to query.
 * @x: a pointer to a #long into which the minimum x coordinate will be returned.
 * @y: a pointer to a #long into which the minimum y coordinate will be returned.
 * @width: a pointer to a #long into which the image x extent will be returned.
 * @height: a pointer to a #long into which the image y extent will be returned.
 * @ctype: the desired coordinate system into which to return the results,
 *         (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN).
 *
 * Get the bounding box of the image displayed in a
 *         specified #AccessibleImage implementor.
 **/
void
AccessibleImage_getImageExtents (AccessibleImage *obj,
				 long *x,
				 long *y,
				 long *width,
				 long *height,
				 AccessibleCoordType ctype)
{
  Accessibility_BoundingBox bbox;

  cspi_return_if_fail (obj != NULL);

  cspi_dbus_call (obj, spi_interface_image, "getImageExtents", NULL, "=>(iiii)", &bbox);

  if (!cspi_check_ev ("getImageExtents"))
    {
      *x = *y = *width = *height = 0;
    }
  else
    {
      *x = bbox.x;
      *y = bbox.y;
      *width = bbox.width;
      *height = bbox.height;
    }
}
示例#2
0
文件: spi_table.c 项目: GNOME/at-spi
static long
cspi_long_seq_to_array (Accessibility_LongSeq *seq, long int **array)
{
  long *j;
  long length, i;

  if (!cspi_check_ev ("getSelectionItems"))
    {
      *array = NULL;
      return 0;
    }

  length = seq->_length;

  j = *array = malloc (sizeof (long) * length);

  for (i = 0; i < length; i++)
    {
      j[i] = seq->_buffer [i];
    }

  CORBA_free (seq);

  return length;
}
示例#3
0
文件: spi_main.c 项目: GNOME/at-spi
/*
 *   This method swallows the corba_object BonoboUnknown
 * reference, and returns an Accessible associated with it.
 * If the reference is loaned, it means it is only valid
 * between a borrow / return pair.
 */
static Accessible *
cspi_object_get_ref (CORBA_Object corba_object, gboolean on_loan)
{
  Accessible *ref;

  if (corba_object == CORBA_OBJECT_NIL)
    {
      ref = NULL;
    }
  else if (!cspi_check_ev ("pre method check: add"))
    {
      ref = NULL;
    }
  else
    {
      if ((ref = g_hash_table_lookup (cspi_get_live_refs (), corba_object)))
        {
          g_return_val_if_fail (ref->ref_count > 0, NULL);
	  ref->ref_count++;
	  if (!on_loan)
	    {
	      if (ref->on_loan) /* Convert to a permanant ref */
		{
                  ref->on_loan = FALSE;
		}
	      else
	        {
		  cspi_release_unref (corba_object);
		}
	    }
#ifdef DEBUG_OBJECTS
          g_print ("returning cached %p => %p\n", ref, ref->objref);
#endif
	}
      else
        {
	  ref = malloc (sizeof (Accessible));
	  ref->objref = corba_object;
	  ref->ref_count = 1;
	  ref->on_loan = on_loan;
#ifdef DEBUG_OBJECTS
          g_print ("allocated %p => %p\n", ref, corba_object);
#endif
          g_hash_table_insert (cspi_get_live_refs (), ref->objref, ref);
	}
    }

  return ref;
}
/**
 * AccessibleImage_getImageSize:
 * @obj: a pointer to the #AccessibleImage to query.
 * @width: a pointer to a #long into which the x extents (width) will be returned.
 * @height: a pointer to a #long into which the y extents (height) will be returned.
 *
 * Get the size of the image displayed in a specified #AccessibleImage object.
 **/
void
AccessibleImage_getImageSize (AccessibleImage *obj,
                              long int *width,
                              long int *height)
{
  dbus_int32_t w, h;

  cspi_return_if_fail (obj != NULL);

  cspi_dbus_call (obj, spi_interface_image, "getImageSize", NULL, "=>ii", &w, &h);

  if (!cspi_check_ev ("getImageSize"))
    {
      *width = 0;
      *height = 0;
    }
  else
    {
      *width = w;
      *height = h;
    }
}
示例#5
0
文件: spi_table.c 项目: GNOME/at-spi
/**
 * AccessibleTable_getRowColumnExtentsAtIndex:
 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
 * @index: the index of the Table child whose row/column 
 * extents are requested.
 * @row: back-filled with the first table row associated with
 * the cell with child index \c index.
 * @col: back-filled with the first table column associated 
 * with the cell with child index \c index.
 * @row_extents: back-filled with the number of table rows 
 * across which child \c i extends.
 * @col_extents: back-filled with the number of table columns
 * across which child \c i extends.
 * @is_selected: a boolean which is back-filled with \c True
 * if the child at index \c i corresponds to a selected table cell,
 * \c False otherwise.
 *
 * Given a child index, determine the row and column indices and 
 * extents, and whether the cell is currently selected.  If
 * the child at \c index is not a cell (for instance, if it is 
 * a summary, caption, etc.), \c False is returned.
 *
 * Example:
 * If the Table child at index '6' extends across columns 5 and 6 of
 * row 2 of a Table instance, and is currently selected, then
 * 
 * retval = table::getRowColumnExtentsAtIndex (6, row, col, 
 *                                             row_extents,
 *                                             col_extents,
 *                                             is_selected);
 * 
 * will return True, and after the call
 * row, col, row_extents, col_extents,
 * and \c is_selected will contain 2, 5, 1, 2, and 
 * True, respectively.
 *
 * Returns: \c True if the index is associated with a valid table
 * cell, \c False if the index does not correspond to a cell.  If 
 * \c False is returned, the values of the out parameters are 
 * undefined.
 * 
 * Since AT-SPI 1.7.0
 **/
SPIBoolean
AccessibleTable_getRowColumnExtentsAtIndex (AccessibleTable *obj,
					    long int index, long int *row, long int *col, 
					    long int *row_extents, long int *col_extents, 
					    long int *is_selected){
  SPIBoolean retval;
  CORBA_long cRow,  cCol, cRow_extents, cCol_extents; 
  CORBA_boolean cIs_selected;

  cspi_return_val_if_fail (obj != NULL, FALSE);

  retval = Accessibility_Table_getRowColumnExtentsAtIndex (CSPI_OBJREF (obj),
							   index, &cRow, &cCol,
							   &cRow_extents, &cCol_extents,
							   &cIs_selected,
							   cspi_ev ());

  if (!cspi_check_ev ("getRowColumnExtentsAtIndex")){
    
    *row = 0;
    *col = 0;
    *row_extents = 0;
    *col_extents = 0;
    *is_selected = FALSE;
    retval = FALSE;
  }

  else {
    *row = cRow;
    *col = cCol;
    *row_extents = cRow_extents;;
    *col_extents = cCol_extents;
    *is_selected = cIs_selected;;
  }
  
  return retval;

}
/**
 * AccessibleImage_getImagePosition:
 * @obj: a pointer to the #AccessibleImage implementor to query.
 * @x: a pointer to a #long into which the minimum x coordinate will be returned.
 * @y: a pointer to a #long into which the minimum y coordinate will be returned.
 * @ctype: the desired coordinate system into which to return the results,
 *         (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN).
 *
 * Get the minimum x and y coordinates of the image displayed in a
 *         specified #AccessibleImage implementor.
 **/
void
AccessibleImage_getImagePosition (AccessibleImage *obj,
                                  long *x,
                                  long *y,
                                  AccessibleCoordType ctype)
{
  dbus_int32_t dx, dy;

  cspi_return_if_fail (obj != NULL);

  cspi_dbus_call (obj, spi_interface_image, "getImagePosition", NULL, "=>ii", &dx, &dy);

  if (!cspi_check_ev ("getImagePosition"))
    {
      *x = 0;
      *y = 0;
    }
  else
    {
      *x = dx;
      *y = dy;
    }
}