summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Hirt <daniel.hirt@samsung.com>2016-06-28 12:24:35 +0000
committerDaniel Hirt <daniel.hirt@samsung.com>2016-07-03 17:07:29 +0000
commit391fdc5cac66328cccd8cab3b87f868f06581161 (patch)
tree79ca01ea12ff4a6770c42471987f535c7aa86f86 /src
parent06fd1566eaa01b236fbaabd2ce3536606890805e (diff)
Ui text: send signals to cursors explicitly
The edje code used to register the cursor objects as "edje sub-objects" of the edje entry object. This is not edje API, so will send these signals explicitly to the objects.
Diffstat (limited to 'src')
-rw-r--r--src/lib/elementary/efl_ui_text.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/lib/elementary/efl_ui_text.c b/src/lib/elementary/efl_ui_text.c
index dbf4bda..407728f 100644
--- a/src/lib/elementary/efl_ui_text.c
+++ b/src/lib/elementary/efl_ui_text.c
@@ -266,6 +266,7 @@ static void _efl_ui_text_select_all(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd);
266static void _efl_ui_text_anchor_hover_end(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd); 266static void _efl_ui_text_anchor_hover_end(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd);
267static void _efl_ui_text_anchor_hover_parent_set(Eo *obj, Efl_Ui_Text_Data *sd, Evas_Object *parent); 267static void _efl_ui_text_anchor_hover_parent_set(Eo *obj, Efl_Ui_Text_Data *sd, Evas_Object *parent);
268static const char* _efl_ui_text_selection_get(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd); 268static const char* _efl_ui_text_selection_get(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd);
269static void _edje_signal_emit(Efl_Ui_Text_Data *obj, const char *sig, const char *src);
269 270
270static Mod_Api * 271static Mod_Api *
271_module_find(Evas_Object *obj EINA_UNUSED) 272_module_find(Evas_Object *obj EINA_UNUSED)
@@ -1363,7 +1364,7 @@ _efl_ui_text_elm_widget_on_focus(Eo *obj, Efl_Ui_Text_Data *sd, Elm_Object_Item
1363 evas_object_focus_set(sw, EINA_TRUE); 1364 evas_object_focus_set(sw, EINA_TRUE);
1364 1365
1365#endif 1366#endif
1366 edje_object_signal_emit(sd->entry_edje, "elm,action,focus", "elm"); 1367 _edje_signal_emit(sd, "elm,action,focus", "elm");
1367 if (sd->scroll) 1368 if (sd->scroll)
1368 edje_object_signal_emit(sd->scr_edje, "elm,action,focus", "elm"); 1369 edje_object_signal_emit(sd->scr_edje, "elm,action,focus", "elm");
1369 1370
@@ -1378,7 +1379,7 @@ _efl_ui_text_elm_widget_on_focus(Eo *obj, Efl_Ui_Text_Data *sd, Elm_Object_Item
1378 } 1379 }
1379 else 1380 else
1380 { 1381 {
1381 edje_object_signal_emit(sd->entry_edje, "elm,action,unfocus", "elm"); 1382 _edje_signal_emit(sd, "elm,action,unfocus", "elm");
1382 if (sd->scroll) 1383 if (sd->scroll)
1383 edje_object_signal_emit(sd->scr_edje, "elm,action,unfocus", "elm"); 1384 edje_object_signal_emit(sd->scr_edje, "elm,action,unfocus", "elm");
1384#if 0 1385#if 0
@@ -5480,6 +5481,14 @@ _efl_ui_text_cursor_new(Eo *obj, Efl_Ui_Text_Data *sd EINA_UNUSED)
5480 efl_canvas_text_cursor_text_object_set(eo_self, text_obj)); 5481 efl_canvas_text_cursor_text_object_set(eo_self, text_obj));
5481} 5482}
5482 5483
5484static void
5485_edje_signal_emit(Efl_Ui_Text_Data *sd, const char *sig, const char *src)
5486{
5487 edje_object_signal_emit(sd->entry_edje, sig, src);
5488 edje_object_signal_emit(sd->cursor, sig, src);
5489 edje_object_signal_emit(sd->cursor_bidi, sig, src);
5490}
5491
5483static inline Eo * 5492static inline Eo *
5484_decoration_create(Efl_Ui_Text_Data *sd, const char *file, 5493_decoration_create(Efl_Ui_Text_Data *sd, const char *file,
5485 const char *source, Eina_Bool above) 5494 const char *source, Eina_Bool above)
@@ -5995,7 +6004,29 @@ _efl_ui_text_cursor_changed_cb(void *data, const Eo_Event *event EINA_UNUSED)
5995static void 6004static void
5996_efl_ui_text_selection_changed_cb(void *data, const Eo_Event *event EINA_UNUSED) 6005_efl_ui_text_selection_changed_cb(void *data, const Eo_Event *event EINA_UNUSED)
5997{ 6006{
5998 EFL_UI_TEXT_DATA_GET(data, sd); 6007 Eo *obj = data;
6008 Eo *start, *end;
6009 char *text;
6010 EFL_UI_TEXT_DATA_GET(obj, sd);
6011
6012 efl_ui_text_interactive_selection_cursors_get(obj, &start, &end);
6013
6014 text = efl_canvas_text_range_text_get(obj, start, end);
6015 if (!text || (text[0] == '\0'))
6016 {
6017 _edje_signal_emit(sd, "selection,cleared", "elm.text");
6018 sd->have_selection = EINA_FALSE;
6019 }
6020 else
6021 {
6022 if (!sd->have_selection)
6023 {
6024 _edje_signal_emit(sd, "selection,start", "elm.text");
6025 }
6026 _edje_signal_emit(sd, "selection,changed", "elm.text");
6027 sd->have_selection = EINA_TRUE;
6028 free(text);
6029 }
5999 sd->deferred_decoration_selection = EINA_TRUE; 6030 sd->deferred_decoration_selection = EINA_TRUE;
6000 _decoration_defer(data); 6031 _decoration_defer(data);
6001} 6032}