summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rwxr-xr-xatk/atkcomponent.c139
-rwxr-xr-xatk/atkcomponent.h85
-rwxr-xr-xatk/atkimage.c36
-rwxr-xr-xatk/atkimage.h11
-rwxr-xr-xatk/atktext.c4
-rwxr-xr-xatk/atktext.h23
-rwxr-xr-xatk/atkutil.h13
8 files changed, 192 insertions, 126 deletions
diff --git a/ChangeLog b/ChangeLog
index c1e5ea8..ae00f63 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,11 @@
2001-06-28 Brian Cameron <brian.cameron@sun.com>
+ * atk/atkcomponent.c atk/atkcomponent.h atk/atkimage.c
+ atk/atkimage.h atk/atktext.c atk/atktext.h atk/atkutil.h
+ Updated so that functions that take screen coords as
+ input/output also take an enum specifying whether
+ the coords are screen or top-level window based.
+
+2001-06-28 Brian Cameron <brian.cameron@sun.com>
*atk/atkaction.c atk/atkcomponent.c atk/atkeditabletext.c
atk/atkhyperlink.c atk/atkobject.c atk/atkregistry.c
atk/atkstate.c atk/atkstateset.c atk/atkstreamablecontent.c
diff --git a/atk/atkcomponent.c b/atk/atkcomponent.c
index b0f06f2..019dcc2 100755
--- a/atk/atkcomponent.c
+++ b/atk/atkcomponent.c
@@ -22,7 +22,8 @@
static AtkObject* atk_component_real_get_accessible_at_point (AtkComponent *component,
gint x,
- gint y);
+ gint y,
+ AtkCoordType coord_type);
GType
atk_component_get_type ()
@@ -97,12 +98,12 @@ atk_component_remove_focus_handler (AtkComponent *component,
/**
* atk_component_contains:
* @component: the #AtkComponent
- * @x: x coordinate relative to the coordinate system of @component
- * @y: y coordinate relative to the coordinate system of @component
+ * @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,
- * the x and y coordinates are defined to be relative to the
- * coordinate system of the @component.
+ * 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
@@ -110,7 +111,8 @@ atk_component_remove_focus_handler (AtkComponent *component,
gboolean
atk_component_contains (AtkComponent *component,
gint x,
- gint y)
+ gint y,
+ AtkCoordType coord_type)
{
AtkComponentIface *iface = NULL;
g_return_val_if_fail (component != NULL, FALSE);
@@ -119,7 +121,7 @@ atk_component_contains (AtkComponent *component,
iface = ATK_COMPONENT_GET_IFACE (component);
if (iface->contains)
- return (iface->contains) (component, x, y);
+ return (iface->contains) (component, x, y, coord_type);
else
return FALSE;
}
@@ -127,10 +129,12 @@ atk_component_contains (AtkComponent *component,
/**
* atk_component_get_accessible_at_point:
* @component: the #AtkComponent
- * @x: local x coordinate
- * @y: local y coordinate
+ * @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 the accessible child, if one exists, contained at the local
+ * Gets the accessible child, if one exists, contained at the
* coordinate point specified by @x and @y.
*
* Returns: the accessible child, if one exists
@@ -138,7 +142,8 @@ atk_component_contains (AtkComponent *component,
AtkObject*
atk_component_get_accessible_at_point (AtkComponent *component,
gint x,
- gint y)
+ gint y,
+ AtkCoordType coord_type)
{
AtkComponentIface *iface = NULL;
g_return_val_if_fail (component != NULL, NULL);
@@ -147,13 +152,13 @@ atk_component_get_accessible_at_point (AtkComponent *component,
iface = ATK_COMPONENT_GET_IFACE (component);
if (iface->get_accessible_at_point)
- return (iface->get_accessible_at_point) (component, x, y);
+ return (iface->get_accessible_at_point) (component, x, y, coord_type);
else
{
/*
* if this method is not overridden use the default implementation.
*/
- return atk_component_real_get_accessible_at_point (component, x, y);
+ return atk_component_real_get_accessible_at_point (component, x, y, coord_type);
}
}
@@ -164,15 +169,19 @@ atk_component_get_accessible_at_point (AtkComponent *component,
* @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.
+ *
**/
void
atk_component_get_extents (AtkComponent *component,
gint *x,
gint *y,
gint *width,
- gint *height)
+ gint *height,
+ AtkCoordType coord_type)
{
AtkComponentIface *iface = NULL;
g_return_if_fail (component != NULL);
@@ -181,7 +190,7 @@ atk_component_get_extents (AtkComponent *component,
iface = ATK_COMPONENT_GET_IFACE (component);
if (iface->get_extents)
- (iface->get_extents) (component, x, y, width, height);
+ (iface->get_extents) (component, x, y, width, height, coord_type);
}
/**
@@ -189,15 +198,17 @@ atk_component_get_extents (AtkComponent *component,
* @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 relative to the parent in the form of
- * a point specifying @component's top-left corner in the screen's
- * coordinate space.
+ * Gets the position of @component in the form of
+ * a point specifying @component's top-left corner.
**/
void
atk_component_get_position (AtkComponent *component,
gint *x,
- gint *y)
+ gint *y,
+ AtkCoordType coord_type)
{
AtkComponentIface *iface = NULL;
g_return_if_fail (component != NULL);
@@ -206,30 +217,7 @@ atk_component_get_position (AtkComponent *component,
iface = ATK_COMPONENT_GET_IFACE (component);
if (iface->get_position)
- (iface->get_position) (component, x, y);
-}
-
-/**
- * atk_component_get_position_on_screen:
- * @component: an #AtkComponent
- * @x: address of #gint to put x coordinate position
- * @y: address of #gint to put y coordinate position
- *
- * Gets the position of the @component on the screen.
- **/
-void
-atk_component_get_position_on_screen (AtkComponent *component,
- gint *x,
- gint *y)
-{
- AtkComponentIface *iface = NULL;
- g_return_if_fail (component != NULL);
- g_return_if_fail (ATK_IS_COMPONENT (component));
-
- iface = ATK_COMPONENT_GET_IFACE (component);
-
- if (iface->get_position_on_screen)
- (iface->get_position_on_screen) (component, x, y);
+ (iface->get_position) (component, x, y, coord_type);
}
/**
@@ -261,17 +249,19 @@ atk_component_get_size (AtkComponent *component,
*
* Grabs focus for this @component.
**/
-void
+gboolean
atk_component_grab_focus (AtkComponent *component)
{
AtkComponentIface *iface = NULL;
- g_return_if_fail (component != NULL);
- g_return_if_fail (ATK_IS_COMPONENT (component));
+ g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (ATK_IS_COMPONENT (component), FALSE);
iface = ATK_COMPONENT_GET_IFACE (component);
if (iface->grab_focus)
- (iface->grab_focus) (component);
+ return (iface->grab_focus) (component);
+ else
+ return FALSE;
}
/**
@@ -281,24 +271,31 @@ atk_component_grab_focus (AtkComponent *component)
* @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
**/
-void
+gboolean
atk_component_set_extents (AtkComponent *component,
gint x,
gint y,
gint width,
- gint height)
+ gint height,
+ AtkCoordType coord_type)
{
AtkComponentIface *iface = NULL;
- g_return_if_fail (component != NULL);
- g_return_if_fail (ATK_IS_COMPONENT (component));
+ g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (ATK_IS_COMPONENT (component), FALSE);
iface = ATK_COMPONENT_GET_IFACE (component);
if (iface->set_extents)
- (iface->set_extents) (component, x, y, width, height);
+ return (iface->set_extents) (component, x, y, width, height, coord_type);
+ else
+ return FALSE;
}
/**
@@ -306,22 +303,29 @@ atk_component_set_extents (AtkComponent *component,
* @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 position of @component.
+ * Sets the postition of @component.
+ *
+ * Returns: %TRUE or %FALSE whether or not the position was set or not
**/
-void
+gboolean
atk_component_set_position (AtkComponent *component,
gint x,
- gint y)
+ gint y,
+ AtkCoordType coord_type)
{
AtkComponentIface *iface = NULL;
- g_return_if_fail (component != NULL);
- g_return_if_fail (ATK_IS_COMPONENT (component));
+ g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (ATK_IS_COMPONENT (component), FALSE);
iface = ATK_COMPONENT_GET_IFACE (component);
if (iface->set_position)
- (iface->set_position) (component, x, y);
+ return (iface->set_position) (component, x, y, coord_type);
+ else
+ return FALSE;
}
/**
@@ -331,26 +335,31 @@ atk_component_set_position (AtkComponent *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
**/
-void
+gboolean
atk_component_set_size (AtkComponent *component,
gint x,
gint y)
{
AtkComponentIface *iface = NULL;
- g_return_if_fail (component != NULL);
- g_return_if_fail (ATK_IS_COMPONENT (component));
+ g_return_val_if_fail (component != NULL, FALSE);
+ g_return_val_if_fail (ATK_IS_COMPONENT (component), FALSE);
iface = ATK_COMPONENT_GET_IFACE (component);
if (iface->set_size)
- (iface->set_size) (component, x, y);
+ return (iface->set_size) (component, x, y);
+ else
+ return FALSE;
}
static AtkObject*
atk_component_real_get_accessible_at_point (AtkComponent *component,
gint x,
- gint y)
+ gint y,
+ AtkCoordType coord_type)
{
gint count, i;
@@ -366,7 +375,7 @@ atk_component_real_get_accessible_at_point (AtkComponent *component,
if (obj != NULL)
{
- if (atk_component_contains (ATK_COMPONENT (obj), x, y))
+ if (atk_component_contains (ATK_COMPONENT (obj), x, y, coord_type))
{
g_object_unref (obj);
return obj;
diff --git a/atk/atkcomponent.h b/atk/atkcomponent.h
index abde0ee..fb3e493 100755
--- a/atk/atkcomponent.h
+++ b/atk/atkcomponent.h
@@ -21,6 +21,7 @@
#define __ATK_COMPONENT_H__
#include <atk/atkobject.h>
+#include <atk/atkutil.h>
#ifdef __cplusplus
extern "C" {
@@ -55,39 +56,42 @@ struct _AtkComponentIface
AtkFocusHandler handler);
gboolean (* contains) (AtkComponent *component,
gint x,
- gint y);
+ gint y,
+ AtkCoordType coord_type);
AtkObject* (* get_accessible_at_point) (AtkComponent *component,
gint x,
- gint y);
+ gint y,
+ AtkCoordType coord_type);
void (* get_extents) (AtkComponent *component,
gint *x,
gint *y,
gint *width,
- gint *height);
- void (* get_position) (AtkComponent *component,
- gint *x,
- gint *y);
- void (* get_position_on_screen) (AtkComponent *component,
- gint *root_x,
- gint *root_y);
- void (* get_size) (AtkComponent *component,
- gint *width,
- gint *height);
- void (* grab_focus) (AtkComponent *component);
- void (* remove_focus_handler) (AtkComponent *component,
- guint handler_id);
- void (* set_extents) (AtkComponent *component,
- gint x,
- gint y,
- gint width,
- gint height);
- void (* set_position) (AtkComponent *component,
- gint x,
- gint y);
- void (* set_size) (AtkComponent *component,
- gint width,
- gint height);
+ gint *height,
+ AtkCoordType coord_type);
+ void (* get_position) (AtkComponent *component,
+ gint *x,
+ gint *y,
+ AtkCoordType coord_type);
+ void (* get_size) (AtkComponent *component,
+ gint *width,
+ gint *height);
+ gboolean (* grab_focus) (AtkComponent *component);
+ void (* remove_focus_handler) (AtkComponent *component,
+ guint handler_id);
+ gboolean (* set_extents) (AtkComponent *component,
+ gint x,
+ gint y,
+ gint width,
+ gint height,
+ AtkCoordType coord_type);
+ gboolean (* set_position) (AtkComponent *component,
+ gint x,
+ gint y,
+ AtkCoordType coord_type);
+ gboolean (* set_size) (AtkComponent *component,
+ gint width,
+ gint height);
};
GType atk_component_get_type ();
@@ -98,36 +102,39 @@ guint atk_component_add_focus_handler (AtkComponent *comp
AtkFocusHandler handler);
gboolean atk_component_contains (AtkComponent *component,
gint x,
- gint y);
+ gint y,
+ AtkCoordType coord_type);
AtkObject* atk_component_get_accessible_at_point(AtkComponent *component,
gint x,
- gint y);
+ gint y,
+ AtkCoordType coord_type);
void atk_component_get_extents (AtkComponent *component,
gint *x,
gint *y,
gint *width,
- gint *height);
+ gint *height,
+ AtkCoordType coord_type);
void atk_component_get_position (AtkComponent *component,
gint *x,
- gint *y);
-void atk_component_get_position_on_screen (AtkComponent *component,
- gint *x,
- gint *y);
+ gint *y,
+ AtkCoordType coord_type);
void atk_component_get_size (AtkComponent *component,
gint *width,
gint *height);
-void atk_component_grab_focus (AtkComponent *component);
+gboolean atk_component_grab_focus (AtkComponent *component);
void atk_component_remove_focus_handler (AtkComponent *component,
guint handler_id);
-void atk_component_set_extents (AtkComponent *component,
+gboolean atk_component_set_extents (AtkComponent *component,
gint x,
gint y,
gint width,
- gint height);
-void atk_component_set_position (AtkComponent *component,
+ gint height,
+ AtkCoordType coord_type);
+gboolean atk_component_set_position (AtkComponent *component,
gint x,
- gint y);
-void atk_component_set_size (AtkComponent *component,
+ gint y,
+ AtkCoordType coord_type);
+gboolean atk_component_set_size (AtkComponent *component,
gint width,
gint height);
diff --git a/atk/atkimage.c b/atk/atkimage.c
index 619303d..9cc7675 100755
--- a/atk/atkimage.c
+++ b/atk/atkimage.c
@@ -74,6 +74,8 @@ atk_image_get_image_description (AtkImage *obj)
* @width: filled with the image width
*
* Get the height, in pixels/screen coords, of this image.
+ *
+ * Returns: an integer representing the image height in pixel coords
**/
void
atk_image_get_image_size (AtkImage *obj, int *height, int *width)
@@ -125,3 +127,37 @@ atk_image_set_image_description (AtkImage *obj,
return FALSE;
}
}
+
+/**
+ * atk_image_get_position:
+ * @image: a #GObject instance that implements AtkImageIface
+ * @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 the image in the form of a point specifying the
+ * images top-left corner
+ **/
+void
+atk_image_get_position (AtkImage *image,
+ gint *x,
+ gint *y,
+ AtkCoordType coord_type)
+{
+ AtkImageIface *iface;
+
+ g_return_if_fail (image != NULL);
+ g_return_if_fail (ATK_IS_IMAGE (image));
+
+ iface = ATK_IMAGE_GET_IFACE (image);
+
+ if (iface->get_position)
+ (iface->get_position) (image, x, y, coord_type);
+}
+
+
+
+
+
+
diff --git a/atk/atkimage.h b/atk/atkimage.h
index 3ac715b..132c34c 100755
--- a/atk/atkimage.h
+++ b/atk/atkimage.h
@@ -21,6 +21,7 @@
#define __ATK_IMAGE_H__
#include <atk/atkobject.h>
+#include <atk/atkutil.h>
#ifdef __cplusplus
extern "C" {
@@ -46,7 +47,10 @@ typedef struct _AtkImageIface AtkImageIface;
struct _AtkImageIface
{
GTypeInterface parent;
-
+ void ( *get_position) (AtkImage *image,
+ gint *x,
+ gint *y,
+ AtkCoordType coord_type);
G_CONST_RETURN gchar* ( *get_image_description) (AtkImage *image);
void ( *get_image_size) (AtkImage *image,
gint *height,
@@ -65,7 +69,10 @@ void atk_image_get_image_size (AtkImage *image,
gboolean atk_image_set_image_description (AtkImage *image,
const gchar *description);
-
+void atk_image_get_position (AtkImage *image,
+ gint *x,
+ gint *y,
+ AtkCoordType coord_type);
#ifdef __cplusplus
}
diff --git a/atk/atktext.c b/atk/atktext.c
index 1102621..1f769a4 100755
--- a/atk/atktext.c
+++ b/atk/atktext.c
@@ -310,7 +310,7 @@ atk_text_get_character_extents (AtkText *text,
gint *y,
gint *length,
gint *width,
- AtkXYCoords coords)
+ AtkCoordType coords)
{
AtkTextIface *iface;
@@ -406,7 +406,7 @@ gint
atk_text_get_offset_at_point (AtkText *text,
gint x,
gint y,
- AtkXYCoords coords)
+ AtkCoordType coords)
{
AtkTextIface *iface;
diff --git a/atk/atktext.h b/atk/atktext.h
index 51671be..89f3737 100755
--- a/atk/atktext.h
+++ b/atk/atktext.h
@@ -24,6 +24,7 @@
#include <pango/pango.h>
#include <glib-object.h>
#include <atk/atkobject.h>
+#include <atk/atkutil.h>
#ifdef __cplusplus
extern "C" {
@@ -47,20 +48,6 @@ typedef struct _AtkText AtkText;
#endif
typedef struct _AtkTextIface AtkTextIface;
-
-/**
- *AtkXYCoords:
- *@ATK_XY_SCREEN: specifies xy coordinates relative to the screen
- *@ATK_XY_WINDOW: specifies xy coordinates relative to the widgets
- * top-level window
- *
- *Specifies how xy coordinates are to be interpreted
- **/
-typedef enum {
- ATK_XY_SCREEN,
- ATK_XY_WINDOW
-}AtkXYCoords;
-
/**
*AtkTextBoundary:
*@ATK_TEXT_BOUNDARY_CHAR:
@@ -118,12 +105,12 @@ struct _AtkTextIface
gint *y,
gint *length,
gint *width,
- AtkXYCoords coords);
+ AtkCoordType coords);
gint (* get_character_count) (AtkText *text);
gint (* get_offset_at_point) (AtkText *text,
gint x,
gint y,
- AtkXYCoords coords);
+ AtkCoordType coords);
gint (* get_n_selections) (AtkText *text);
gchar* (* get_selection) (AtkText *text,
gint selection_num,
@@ -186,7 +173,7 @@ void atk_text_get_character_extents (AtkText *tex
gint *y,
gint *length,
gint *width,
- AtkXYCoords coords);
+ AtkCoordType coords);
AtkAttributeSet* atk_text_ref_run_attributes (AtkText *text,
gint offset,
gint *start_offset,
@@ -195,7 +182,7 @@ gint atk_text_get_character_count (AtkText *tex
gint atk_text_get_offset_at_point (AtkText *text,
gint x,
gint y,
- AtkXYCoords coords);
+ AtkCoordType coords);
gint atk_text_get_n_selections (AtkText *text);
gchar* atk_text_get_selection (AtkText *text,
gint selection_num,
diff --git a/atk/atkutil.h b/atk/atkutil.h
index 716a545..4b47b4a 100755
--- a/atk/atkutil.h
+++ b/atk/atkutil.h
@@ -26,6 +26,19 @@
extern "C" {
#endif /* __cplusplus */
+/**
+ *AtkCoordType:
+ *@ATK_XY_SCREEN: specifies xy coordinates relative to the screen
+ *@ATK_XY_WINDOW: specifies xy coordinates relative to the widgets
+ * top-level window
+ *
+ *Specifies how xy coordinates are to be interpreted
+ **/
+typedef enum {
+ ATK_XY_SCREEN,
+ ATK_XY_WINDOW
+}AtkCoordType;
+
/*
* A focus tracker is a function which is called when an object
* receives focus.