Evas textblock: cursor_geometry_get now also returns the direction of the cursor: rtl/ltr/whatever.

Fixed documentation a bit.

SVN revision: 51979
This commit is contained in:
Tom Hacohen 2010-09-08 07:28:16 +00:00
parent 85815e306c
commit 4c716af06a
2 changed files with 29 additions and 7 deletions

View File

@ -57,6 +57,13 @@ extern "C" {
* @todo finish api documentation
*/
/* BiDi exposed stuff */
/*FIXME: document */
typedef enum _Evas_BiDi_Direction {
EVAS_BIDI_DIRECTION_NATURAL,
EVAS_BIDI_DIRECTION_LTR,
EVAS_BIDI_DIRECTION_RTL
} Evas_BiDi_Direction;
/**
* Identifier of callbacks to be used with object or canvas.
@ -1415,7 +1422,7 @@ typedef void (*Evas_Object_Image_Pixels_Get_Cb) (void *data, Evas_Object *o);
EAPI char *evas_textblock_cursor_range_text_get(const Evas_Textblock_Cursor *cur1, const Evas_Textblock_Cursor *cur2, Evas_Textblock_Text_Type format) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2) EINA_PURE;
EAPI char *evas_textblock_cursor_content_get(const Evas_Textblock_Cursor *cur) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC;
EAPI int evas_textblock_cursor_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_Textblock_Cursor_Type ctype) EINA_ARG_NONNULL(1);
EAPI int evas_textblock_cursor_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_BiDi_Direction *dir, Evas_Textblock_Cursor_Type ctype) EINA_ARG_NONNULL(1);
EAPI int evas_textblock_cursor_char_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) EINA_ARG_NONNULL(1);
EAPI int evas_textblock_cursor_line_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) EINA_ARG_NONNULL(1);
EAPI Eina_Bool evas_textblock_cursor_char_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord x, Evas_Coord y) EINA_ARG_NONNULL(1);
@ -2193,7 +2200,8 @@ struct _Evas_Smart_Cb_Description
EAPI Eina_Bool evas_object_key_grab (Evas_Object *obj, const char *keyname, Evas_Modifier_Mask modifiers, Evas_Modifier_Mask not_modifiers, Eina_Bool exclusive) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2);
EAPI void evas_object_key_ungrab (Evas_Object *obj, const char *keyname, Evas_Modifier_Mask modifiers, Evas_Modifier_Mask not_modifiers) EINA_ARG_NONNULL(1, 2);
#ifdef __cplusplus
}
#endif

View File

@ -6487,14 +6487,17 @@ evas_textblock_cursor_format_is_visible_get(const Evas_Textblock_Cursor *cur)
* @param cy the y of the cursor
* @param cw the w of the cursor
* @param ch the h of the cursor
* @param dir the direction of the cursor, can be NULL.
* @param ctype the type of the cursor.
* @return line number of the char on success, -1 on error.
*/
EAPI int
evas_textblock_cursor_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_Textblock_Cursor_Type ctype)
evas_textblock_cursor_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_BiDi_Direction *dir, Evas_Textblock_Cursor_Type ctype)
{
int ret = -1;
if (ctype == EVAS_TEXTBLOCK_CURSOR_UNDER)
{
return evas_textblock_cursor_char_geometry_get(cur, cx, cy, cw, ch);
ret = evas_textblock_cursor_char_geometry_get(cur, cx, cy, cw, ch);
}
else if (ctype == EVAS_TEXTBLOCK_CURSOR_BEFORE)
{
@ -6503,7 +6506,6 @@ evas_textblock_cursor_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord
* of just after the previous char (which in bidi text may not be
* just before the current char). */
Evas_Coord x, y, h, w;
int ret;
if (cur->pos > 0)
{
@ -6525,10 +6527,22 @@ evas_textblock_cursor_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord
if (cw) *cw = 0;
if (ch) *ch = 0;
}
return ret;
}
return -1;
if (dir && cur && cur->node)
{
#ifdef BIDI_SUPPORT
Evas_BiDi_Props props;
props.props = cur->node->bidi_props;
props.start = 0;
*dir = (evas_bidi_is_rtl_char(&props, cur->pos)) ?
EVAS_BIDI_DIRECTION_RTL : EVAS_BIDI_DIRECTION_LTR;
#else
*dir = EVAS_BIDI_DIRECTION_LTR;
#endif
}
return ret;
}