Ui text: add cursor_new method
authorDaniel Hirt <daniel.hirt@samsung.com>
Wed, 22 Jun 2016 12:05:47 +0000 (12:05 +0000)
committerDaniel Hirt <daniel.hirt@samsung.com>
Mon, 27 Jun 2016 15:18:08 +0000 (15:18 +0000)
The cursor object is meant to be instantiated in the following manner:
   eo_add(EFL_CANVAS_TEXT_CURSOR_CLASS, text_obj,
      efl_canvas_text_cursor_text_object_set(eo_self, text_obj));

This can't be done directly on the Ui Text object, so it has to be with an
method call, sadly.

@feature

src/lib/elementary/efl_ui_text.c
src/lib/elementary/efl_ui_text.eo

index f47c49f..c4249f1 100644 (file)
@@ -5428,6 +5428,14 @@ _efl_ui_text_elm_interface_atspi_accessible_name_get(Eo *obj, Efl_Ui_Text_Data *
    return ret ? strdup(ret) : NULL;
 }
 
+EOLIAN static Efl_Canvas_Text_Cursor *
+_efl_ui_text_cursor_new(Eo *obj, Efl_Ui_Text_Data *sd EINA_UNUSED)
+{
+   Eo *text_obj = edje_object_part_swallow_get(sd->entry_edje, "elm.text");
+   return eo_add(EFL_CANVAS_TEXT_CURSOR_CLASS, (Eo *) obj,
+         efl_canvas_text_cursor_text_object_set(eo_self, text_obj));
+}
+
 static inline Eo *
 _decoration_create(Efl_Ui_Text_Data *sd, const char *file,
       const char *source, Eina_Bool above)
index f12ed08..d04c370 100644 (file)
@@ -361,6 +361,10 @@ class Efl.Ui.Text (Elm.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
             @in data: const(void_ptr) @optional; [[The data to associate with the item for related functions.]]
          }
       }
+      cursor_new {
+         [[Creates and returns a new cursor for the text.]]
+         return: Efl.Canvas.Text.Cursor;
+      }
    }
    implements {
       class.constructor;