+2001-06-12 Brian Cameron <brian.cameron@sun.com>
+
+ * atk/atkeditabletext.[ch], atk/atktext.[ch], atk/atkobject.h
+ Updated atkeditabletext and atktext interfaces so they
+ now properly define the get/set attribute methods and now
+ get_offset_at_point and get_character_extents can request
+ x,y coords by either widget or screen coords.
+
Sat Jun 9 15:17:00 2001 Owen Taylor <otaylor@redhat.com>
* configure.in (DEP_CFLAGS): Only include gthread-2.0 in
}
/**
- * atk_editable_text_set_attributes:
- * @text: an #AtkEditableText
- * @start_pos: start position
- * @end_pos: end position
- * @attributes: a #PangoAttrList to set for text between @start_pos and @end_pos
+ *atk_editable_text_set_run_attributes:
+ *@text: an #AtkEditableText
+ *@attrib_set: an #AtkAttributeSet
+ *@start_offset: start of range in which to set attributes
+ *@end_offset: end of range in which to set attributes
*
- * Set attributes for text between @start_pos and @end_pos. The characters
- * whose attributes are set are those characters at positions from @start_pos
- * up to, but not including @end_pos. If @end_pos is negative, then the
- * characters selected will be those characters from start_pos to
- * the end of the text.
+ *Sets the attributes for a specified range
+ *
+ *Returns: %TRUE if attributes successfully set for the specified
+ *range, otherwise %FALSE
**/
-void
-atk_editable_text_set_attributes (AtkEditableText *text,
- gint start_pos,
- gint end_pos,
- PangoAttrList *attributes)
+gboolean
+atk_editable_text_set_run_attributes (AtkEditableText *text,
+ AtkAttributeSet *attrib_set,
+ gint start_offset,
+ gint end_offset)
{
AtkEditableTextIface *iface;
- g_return_if_fail (text != NULL);
- g_return_if_fail (ATK_IS_EDITABLE_TEXT (text));
+ g_return_val_if_fail (text != NULL, FALSE);
+ g_return_val_if_fail (ATK_IS_EDITABLE_TEXT (text), FALSE);
iface = ATK_EDITABLE_TEXT_GET_IFACE (text);
- if (iface->set_attributes)
- (*(iface->set_attributes)) (text, start_pos, end_pos, attributes);
+ if (iface->set_run_attributes)
+ {
+ return (*(iface->set_run_attributes)) (text, attrib_set, start_offset, end_offset);
+ }
+ else
+ {
+ return FALSE;
+ }
}
+
/**
* atk_editable_text_set_text_contents:
* @text: an #AtkEditableText
{
GTypeInterface parent_interface;
- void (* set_attributes) (AtkEditableText *text,
- gint start_pos,
- gint end_pos,
- PangoAttrList *attributes);
+ gboolean (* set_run_attributes) (AtkEditableText *text,
+ AtkAttributeSet *attrib_set,
+ gint start_offset,
+ gint end_offset);
void (* set_text_contents) (AtkEditableText *text,
const gchar *string);
void (* insert_text) (AtkEditableText *text,
};
GType atk_editable_text_get_type (void);
-void atk_editable_text_set_attributes (AtkEditableText *text,
- gint start_pos,
- gint end_pos,
- PangoAttrList *attributes);
+
+gboolean atk_editable_text_set_run_attributes (AtkEditableText *text,
+ AtkAttributeSet *attrib_set,
+ gint start_offset,
+ gint end_offset);
void atk_editable_text_set_text_contents (AtkEditableText *text,
const gchar *string);
void atk_editable_text_insert_text (AtkEditableText *text,
* of the following interfaces:
*/
+/* AtkAttributeSet & AtkAttribute are needed by atktext and atkeditable text */
+/* so I am putting them here until a better place for them to be defined is */
+/* decided */
+typedef GSList AtkAttributeSet;
+
+typedef struct _AtkAttribute {
+ gchar* name;
+ gchar* value;
+}AtkAttribute;
+
/**
*AtkRole:
*@ATK_ROLE_INVALID: Invalid role
}
/**
- * atk_text_get_character_extents
+ * atk_text_get_character_extents:
* @text: an #AtkText
* @offset: position
* @x: x-position of character
* @y: y-position of character
* @length: length of character
* @width: width of character
+ * @coords: specify whether coordinates are relative to the screen or widget window
*
* Given an @offset, the @x, @y, @length, and @width values are filled
- * appropriately.
+ * appropriately.
**/
void
atk_text_get_character_extents (AtkText *text,
gint *x,
gint *y,
gint *length,
- gint *width)
+ gint *width,
+ AtkXYCoords coords)
{
AtkTextIface *iface;
iface = ATK_TEXT_GET_IFACE (text);
if (iface->get_character_extents)
- (*(iface->get_character_extents)) (text, offset, x, y, length, width);
+ (*(iface->get_character_extents)) (text, offset, x, y, length, width, coords);
else
{
*x = 0;
}
/**
- * atk_text_get_offset_at_point
+ * atk_text_get_offset_at_point:
* @text: an #AtkText
* @x: screen x-position of character
* @y: screen y-position of character
+ * @coords: specify whether coordinates are relative to the screen or widget window
*
- * Gets the x,y screen coordinates of the specified character.
+ * Gets the offset of the character located at coordinates @x and @y. @x and @y are
+ * interpreted as being relative to the screen or this widget's window depending
+ * on @coords.
*
* Returns: the offset to the character which is located at
* the specified @x and @y coordinates.
gint
atk_text_get_offset_at_point (AtkText *text,
gint x,
- gint y)
+ gint y,
+ AtkXYCoords coords)
{
AtkTextIface *iface;
iface = ATK_TEXT_GET_IFACE (text);
if (iface->get_offset_at_point)
- return (*(iface->get_offset_at_point)) (text, x, y);
+ return (*(iface->get_offset_at_point)) (text, x, y, coords);
else
return -1;
}
}
/**
- *atk_text_set_run_attributes:
- *@text: an #AtkText
- *@attrib: an #AtkAttributeSet
- *@start_offset: start of range in which to set attributes
- *@end_offset: end of range in which to set attributes
- *
- *Sets the attributes for a specified range
- *
- *Returns: %TRUE if attributes successfully set for the specified
- *range, otherwise %FALSE
- **/
-gboolean
-atk_text_set_run_attributes (AtkText *text,
- AtkAttributeSet *attrib,
- gint start_offset,
- gint end_offset)
-{
- AtkTextIface *iface;
-
- g_return_val_if_fail (text != NULL, FALSE);
- g_return_val_if_fail (ATK_IS_TEXT (text), FALSE);
-
- iface = ATK_TEXT_GET_IFACE (text);
-
- if (iface->set_run_attributes)
- {
- return (*(iface->set_run_attributes)) (text, attrib, start_offset, end_offset);
- }
- else
- {
- return FALSE;
- }
-}
-
-/**
* atk_text_set_caret_offset
* @text: an #AtkText
* @offset: position
#endif
typedef struct _AtkTextIface AtkTextIface;
-typedef GList AtkAttributeSet;
-typedef struct _AtkAttribute {
- gchar* name;
- gchar* value;
-}AtkAttribute;
+/**
+ *AtkXYCoords:
+ *@ATK_XY_SCREEN: specifies xy coordinates relative to the screen
+ *@ATK_XY_WIDGET: specifies xy coordinates relative to the widgets window
+ *
+ *Specifies what type of coordinates are to be returned for functions that
+ *return position coordinates
+ **/
+typedef enum {
+ ATK_XY_SCREEN,
+ ATK_XY_WIDGET
+}AtkXYCoords;
/**
*AtkTextBoundary:
gint *x,
gint *y,
gint *length,
- gint *width);
+ gint *width,
+ AtkXYCoords coords);
gint (* get_character_count) (AtkText *text);
gint (* get_offset_at_point) (AtkText *text,
gint x,
- gint y);
+ gint y,
+ AtkXYCoords coords);
gint (* get_n_selections) (AtkText *text);
gchar* (* get_selection) (AtkText *text,
gint selection_num,
gint end_offset);
gboolean (* set_caret_offset) (AtkText *text,
gint offset);
- gboolean (* set_run_attributes) (AtkText *text,
- AtkAttributeSet *attrib,
- gint start_offset,
- gint end_offset);
void (* text_changed) (AtkText *text);
void (* caret_changed) (AtkText *text,
gint location);
gint *x,
gint *y,
gint *length,
- gint *width);
+ gint *width,
+ AtkXYCoords coords);
AtkAttributeSet* atk_text_ref_run_attributes (AtkText *text,
gint offset,
gint *start_offset,
gint atk_text_get_character_count (AtkText *text);
gint atk_text_get_offset_at_point (AtkText *text,
gint x,
- gint y);
+ gint y,
+ AtkXYCoords coords);
gint atk_text_get_n_selections (AtkText *text);
gchar* atk_text_get_selection (AtkText *text,
gint selection_num,
gint end_offset);
gboolean atk_text_set_caret_offset (AtkText *text,
gint offset);
-gboolean atk_text_set_run_attributes (AtkText *text,
- AtkAttributeSet *attrib,
- gint start_offset,
- gint end_offset);
#ifdef __cplusplus
}