edje: Edje_Edit - add edje_edit_part_cursor_mode functions.
authorVorobiov Vitalii <vi.vorobiov@samsung.com>
Thu, 5 Jun 2014 17:43:49 +0000 (19:43 +0200)
committerCedric BAIL <c.bail@partner.samsung.com>
Thu, 5 Jun 2014 17:43:52 +0000 (19:43 +0200)
Summary:
Add two main functions
- edje_edit_part_cursor_mode_get
- edje_edit_part_cursor_mode_set
Also support cursor_mode into part's source code generation.

@feature

Reviewers: seoz, Hermet, cedric, raster

CC: reutskiy.v.v, cedric
Differential Revision: https://phab.enlightenment.org/D952

Signed-off-by: Cedric BAIL <c.bail@partner.samsung.com>
src/lib/edje/Edje_Edit.h
src/lib/edje/edje_edit.c

index d058c31..4210d77 100644 (file)
@@ -1315,6 +1315,37 @@ EAPI Evas_Object_Pointer_Mode edje_edit_part_pointer_mode_get(Evas_Object *obj,
  */
 EAPI Eina_Bool edje_edit_part_pointer_mode_set(Evas_Object *obj, const char *part, Evas_Object_Pointer_Mode pointer_mode);
 
+/** Get cursor_mode of a part.
+ *
+ * Note that Cursor Mode can be:
+ * 0 - UNDER cursor mode means the cursor will draw below the character pointed
+ *     at. That's the default.
+ * 1 - BEFORE cursor mode means the cursor is drawn as a vertical line before
+ *     the current character, just like many other GUI toolkits handle it.
+ *
+ * @param obj Object being edited.
+ * @param part Part name to get it's cursor_mode.
+ *
+ * @return Ponter Mode of the part.
+ */
+EAPI unsigned char edje_edit_part_cursor_mode_get(Evas_Object *obj, const char *part);
+
+/** Get pointer_mode of a part.
+ *
+ * Note that Cursor Mode can be:
+ * 0 - UNDER cursor mode means the cursor will draw below the character pointed
+ *     at. That's the default.
+ * 1 - BEFORE cursor mode means the cursor is drawn as a vertical line before
+ *     the current character, just like many other GUI toolkits handle it.
+ *
+ * @param obj Object being edited.
+ * @param part Part name to get it's pointer_mode.
+ * @param pointer_mode Pointer Mode.
+ *
+ * @return EINA_TRUE if successful, EINA_FALSE otherwise.
+ */
+EAPI Eina_Bool edje_edit_part_cursor_mode_set(Evas_Object *obj, const char *part, unsigned char cursor_mode);
+
 /** Set scale property for the part.
  *
  * This property tells Edje that the given part should be scaled by the
index a46cb01..e13ff6f 100644 (file)
@@ -3014,6 +3014,32 @@ edje_edit_part_pointer_mode_set(Evas_Object *obj, const char *part, Evas_Object_
    return EINA_TRUE;
 }
 
+EAPI unsigned char
+edje_edit_part_cursor_mode_get(Evas_Object *obj, const char *part)
+{
+   GET_RP_OR_RETURN(0);
+
+   if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
+       (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
+     return 0;
+
+   return rp->part->cursor_mode;
+}
+
+EAPI Eina_Bool
+edje_edit_part_cursor_mode_set(Evas_Object *obj, const char *part, unsigned char cursor_mode)
+{
+   GET_RP_OR_RETURN(EINA_FALSE);
+
+   if ((!rp->object) ||
+       ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
+        (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)))
+     return EINA_FALSE;
+
+   rp->part->cursor_mode = cursor_mode;
+   return EINA_TRUE;
+}
+
 EAPI Eina_Bool
 edje_edit_part_scale_set(Evas_Object *obj, const char *part, Eina_Bool scale)
 {
@@ -8190,6 +8216,8 @@ _edje_generate_source_of_part(Evas_Object *obj, Edje_Part *ep, Eina_Strbuf *buf)
    //TODO Support ignore_flags
    if (edje_edit_part_pointer_mode_get(obj, part) == EVAS_OBJECT_POINTER_MODE_NOGRAB)
      BUF_APPEND(I4"pointer_mode: NOGRAB;\n");
+   if (edje_edit_part_cursor_mode_get(obj, part) == 1)
+     BUF_APPEND(I4"cursor_mode: BEFORE;\n");
    if (edje_edit_part_precise_is_inside_get(obj, part))
      BUF_APPEND(I4"precise_is_inside: 1;\n");
    if (edje_edit_part_access_get(obj, part))