/* Updates the position of the cursor * It also updates automatically the text position and the selection */ static void _e_editable_cursor_update(Evas_Object *editable) { E_Editable_Smart_Data *sd; const Evas_Object *text_obj; Evas_Coord tx, ty; Evas_Coord cx, cy, ch; if ((!editable) || (!(sd = evas_object_smart_data_get(editable)))) return; if (!(text_obj = edje_object_part_object_get(sd->text_object, "e.text.text"))) return; evas_object_geometry_get(text_obj, &tx, &ty, NULL, NULL); _e_editable_char_geometry_get_from_pos(editable, sd->cursor_pos, &cx, &cy, NULL, &ch); evas_object_move(sd->cursor_object, tx + cx, ty + cy); evas_object_resize(sd->cursor_object, sd->cursor_width, ch); if (sd->cursor_visible && evas_object_visible_get(editable)) { evas_object_show(sd->cursor_object); edje_object_signal_emit(sd->cursor_object, "e,action,show,cursor", "e"); } _e_editable_selection_update(editable); _e_editable_text_position_update(editable, -1); }
/** * Moves the selection bound of the editable object to the given position * * @param editable an editable object * @param pos the position where to move the selection bound */ EAPI void e_editable_selection_pos_set(Evas_Object *editable, int pos) { E_Editable_Smart_Data *sd; if ((!editable) || (!(sd = evas_object_smart_data_get(editable)))) return; pos = E_CLAMP(pos, 0, sd->unicode_length); if (sd->selection_pos == pos) return; sd->selection_pos = pos; _e_editable_selection_update(editable); }