Evas textblock: cursor_geometry_get now also returns the direction of the cursor...
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 8 Sep 2010 07:28:16 +0000 (07:28 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 8 Sep 2010 07:28:16 +0000 (07:28 +0000)
Fixed documentation a bit.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@51979 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/Evas.h
src/lib/canvas/evas_object_textblock.c

index a840fd8..fb81b69 100644 (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
index 78436f5..4f5804e 100644 (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;
 }