/** * Selects the word at the provided character index */ EAPI void e_editable_select_word(Evas_Object *editable, int index) { E_Editable_Smart_Data *sd; int spos = 0, epos = -1, i = 0, pos = 0; if (evas_object_smart_smart_get(editable) != _e_editable_smart) SMARTERRNR(); if ((!editable) || (!(sd = evas_object_smart_data_get(editable)))) return; if ((index < 0) || (index >= sd->unicode_length)) return; while (i < sd->char_length) { if (sd->text[i] == ' ') { if (pos < index) spos = pos + 1; else if (pos > index) { epos = pos; break; } } i = evas_string_char_next_get(sd->text, i, NULL); pos++; } if (epos == -1) epos = pos; e_editable_selection_pos_set(editable, spos); e_editable_cursor_pos_set(editable, epos); }
/** * Focuses the entry object. It will receives keyboard events and the user could * then type some text (the entry should also be enabled. The cursor and the * selection will be shown * * @param entry the entry to focus */ EAPI void e_entry_focus(Evas_Object *entry) { E_Entry_Smart_Data *sd; if (evas_object_smart_smart_get(entry) != _e_entry_smart) SMARTERRNR(); if ((!entry) || (!(sd = evas_object_smart_data_get(entry)))) return; if (sd->focused) return; evas_object_focus_set(entry, 1); edje_object_signal_emit(sd->entry_object, "e,state,focused", "e"); if (!sd->selection_dragging) { _e_entry_imf_context_reset(entry); e_editable_cursor_move_to_end(sd->editable_object); _e_entry_imf_cursor_info_set(entry); e_editable_selection_move_to_end(sd->editable_object); } if (sd->enabled) e_editable_cursor_show(sd->editable_object); e_editable_selection_show(sd->editable_object); #ifdef HAVE_ECORE_IMF if (sd->imf_context) ecore_imf_context_focus_in(sd->imf_context); #endif sd->focused = 1; }
/** * Sets the text of the editable object * * @param editable an editable object * @param text the text to set */ EAPI void e_editable_text_set(Evas_Object *editable, const char *text) { E_Editable_Smart_Data *sd; if (evas_object_smart_smart_get(editable) != _e_editable_smart) SMARTERRNR(); if ((!editable) || (!(sd = evas_object_smart_data_get(editable)))) return; if (sd->password_mode) memset(sd->text, 0, sd->char_length); free(sd->text); sd->text = NULL; sd->char_length = 0; sd->unicode_length = 0; sd->allocated_length = -1; if (_e_editable_text_insert(editable, 0, text) <= 0) { sd->text = malloc((E_EDITABLE_BLOCK_SIZE + 1) * sizeof(char)); sd->text[0] = '\0'; sd->char_length = 0; sd->unicode_length = 0; sd->allocated_length = E_EDITABLE_BLOCK_SIZE; _e_editable_text_update(editable); } sd->cursor_pos = sd->unicode_length; sd->selection_pos = sd->unicode_length; _e_editable_cursor_update(editable); }
/** * Selects all the text of the editable object. The selection bound will be * moved to the start of the editable object and the cursor will be moved to * the end * * @param editable an editable object */ EAPI void e_editable_select_all(Evas_Object *editable) { if (evas_object_smart_smart_get(editable) != _e_editable_smart) SMARTERRNR(); e_editable_selection_move_to_start(editable); e_editable_cursor_move_to_end(editable); }
/** * Moves the selection bound to the start of the editable object * * @param editable an editable object */ EAPI void e_editable_selection_move_to_start(Evas_Object *editable) { if (evas_object_smart_smart_get(editable) != _e_editable_smart) SMARTERRNR(); if (!editable) return; e_editable_selection_pos_set(editable, 0); }
EAPI void e_icon_preload_set(Evas_Object *obj, Eina_Bool preload) { E_Smart_Data *sd; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR(); if (!(sd = evas_object_smart_data_get(obj))) return; sd->preload = preload; }
/** * Unselects all the text of the editable object. The selection bound will be * moved to the cursor position * * @param editable an editable object */ EAPI void e_editable_unselect_all(Evas_Object *editable) { E_Editable_Smart_Data *sd; if (evas_object_smart_smart_get(editable) != _e_editable_smart) SMARTERRNR(); if ((!editable) || (!(sd = evas_object_smart_data_get(editable)))) return; e_editable_selection_pos_set(editable, sd->cursor_pos); }
EAPI void e_icon_alpha_set(Evas_Object *obj, Eina_Bool alpha) { E_Smart_Data *sd; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR(); if (!(sd = evas_object_smart_data_get(obj))) return; if (sd->edje) return; evas_object_image_alpha_set(sd->obj, alpha); }
/** * Moves the cursor backward by one character offset * * @param editable an editable object */ EAPI void e_editable_cursor_move_left(Evas_Object *editable) { E_Editable_Smart_Data *sd; if (evas_object_smart_smart_get(editable) != _e_editable_smart) SMARTERRNR(); if ((!editable) || (!(sd = evas_object_smart_data_get(editable)))) return; e_editable_cursor_pos_set(editable, sd->cursor_pos - 1); }
EAPI void e_table_align_get(Evas_Object *obj, double *ax, double *ay) { E_Smart_Data *sd; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR(); sd = evas_object_smart_data_get(obj); if (ax) *ax = sd->align.x; if (ay) *ay = sd->align.y; }
EAPI void e_layout_virtual_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) { E_Smart_Data *sd; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR(); sd = evas_object_smart_data_get(obj); if (w) *w = sd->vw; if (h) *h = sd->vh; }
/** * Moves the selection bound forward by one character offset * * @param editable an editable object */ EAPI void e_editable_selection_move_right(Evas_Object *editable) { E_Editable_Smart_Data *sd; if (evas_object_smart_smart_get(editable) != _e_editable_smart) SMARTERRNR(); if ((!editable) || (!(sd = evas_object_smart_data_get(editable)))) return; e_editable_selection_pos_set(editable, sd->selection_pos + 1); }
EAPI void e_table_size_max_get(Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh) { E_Smart_Data *sd; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR(); sd = evas_object_smart_data_get(obj); if (sd->changed) _e_table_smart_extents_calcuate(sd); if (maxw) *maxw = sd->max.w; if (maxh) *maxh = sd->max.h; }
EAPI void e_icon_data_set(Evas_Object *obj, void *data, int w, int h) { E_Smart_Data *sd; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR(); if (!(sd = evas_object_smart_data_get(obj))) return; if (sd->edje) return; evas_object_image_size_set(sd->obj, w, h); evas_object_image_data_copy_set(sd->obj, data); }
EAPI void e_table_col_row_size_get(Evas_Object *obj, int *cols, int *rows) { E_Smart_Data *sd; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR(); sd = evas_object_smart_data_get(obj); if (sd->changed) _e_table_smart_extents_calcuate(sd); if (cols) *cols = sd->size.cols; if (rows) *rows = sd->size.rows; }
EAPI void e_layout_coord_virtual_to_canvas(Evas_Object *obj, Evas_Coord vx, Evas_Coord vy, Evas_Coord *cx, Evas_Coord *cy) { E_Smart_Data *sd; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR(); sd = evas_object_smart_data_get(obj); if (cx) *cx = vx * ((double)(sd->w) / sd->vw) + sd->x; if (cy) *cy = vy * ((double)(sd->h) / sd->vh) + sd->y; }
EAPI void e_layout_coord_canvas_to_virtual(Evas_Object *obj, Evas_Coord cx, Evas_Coord cy, Evas_Coord *vx, Evas_Coord *vy) { E_Smart_Data *sd; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR(); sd = evas_object_smart_data_get(obj); if (vx) *vx = (cx - sd->x) * ((double)(sd->vw) / sd->w); if (vy) *vy = (cy - sd->y) * ((double)(sd->vh) / sd->h); }
EAPI void e_icon_scale_size_set(Evas_Object *obj, int size) { E_Smart_Data *sd; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR(); if (!(sd = evas_object_smart_data_get(obj))) return; sd->size = size; if (sd->edje) return; evas_object_image_load_size_set(sd->obj, sd->size, sd->size); }
EAPI void e_editable_disable(Evas_Object *editable) { E_Editable_Smart_Data *sd; if (evas_object_smart_smart_get(editable) != _e_editable_smart) SMARTERRNR(); if ((!editable) || (!(sd = evas_object_smart_data_get(editable)))) return; edje_object_signal_emit(sd->text_object, "e,state,disabled", "e"); }
/** * Gets the geometry of the cursor of the editable object * * @param editable an editable object * @param cx the x of the cursor * @param cy the y of the cursor * @param cw the width of the cursor * @param ch the height of the cursor */ EAPI void e_editable_cursor_geometry_get(Evas_Object *editable, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) { E_Editable_Smart_Data *sd; if (evas_object_smart_smart_get(editable) != _e_editable_smart) SMARTERRNR(); if ((!editable) || (!(sd = evas_object_smart_data_get(editable)))) return; evas_object_geometry_get(sd->cursor_object, cx, cy, cw, ch); }
/** * Sets the text of the entry object * * @param entry an entry object * @param text the text to set */ EAPI void e_entry_text_set(Evas_Object *entry, const char *text) { E_Entry_Smart_Data *sd; if (evas_object_smart_smart_get(entry) != _e_entry_smart) SMARTERRNR(); if ((!entry) || (!(sd = evas_object_smart_data_get(entry)))) return; e_editable_text_set(sd->editable_object, text); evas_object_smart_callback_call(entry, "changed", NULL); }
/** * Hides the selection of the editable object * * @param editable an editable object */ EAPI void e_editable_selection_hide(Evas_Object *editable) { E_Editable_Smart_Data *sd; if (evas_object_smart_smart_get(editable) != _e_editable_smart) SMARTERRNR(); if ((!editable) || (!(sd = evas_object_smart_data_get(editable)))) return; if (!sd->selection_visible) return; sd->selection_visible = 0; evas_object_hide(sd->selection_object); }
EAPI void e_icon_fill_inside_set(Evas_Object *obj, Eina_Bool fill_inside) { E_Smart_Data *sd; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR(); if (!(sd = evas_object_smart_data_get(obj))) return; fill_inside = !!fill_inside; if (sd->fill_inside == fill_inside) return; sd->fill_inside = fill_inside; _e_icon_smart_reconfigure(sd); }
EAPI void e_icon_scale_up_set(Evas_Object *obj, Eina_Bool scale_up) { E_Smart_Data *sd; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR(); if (!(sd = evas_object_smart_data_get(obj))) return; scale_up = !!scale_up; if (sd->scale_up == scale_up) return; sd->scale_up = scale_up; _e_icon_smart_reconfigure(sd); }
/** * Gets the minimum size of the entry object * * @param entry an entry object * @param minw the location where to store the minimun width of the entry * @param minh the location where to store the minimun height of the entry */ EAPI void e_entry_size_min_get(Evas_Object *entry, Evas_Coord *minw, Evas_Coord *minh) { E_Entry_Smart_Data *sd; if (evas_object_smart_smart_get(entry) != _e_entry_smart) SMARTERRNR(); if ((!entry) || (!(sd = evas_object_smart_data_get(entry)))) return; if (minw) *minw = sd->min_width; if (minh) *minh = sd->height; }
EAPI void e_table_homogenous_set(Evas_Object *obj, int homogenous) { E_Smart_Data *sd; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR(); sd = evas_object_smart_data_get(obj); if (sd->homogenous == homogenous) return; sd->homogenous = homogenous; sd->changed = 1; if (sd->frozen <= 0) _e_table_smart_reconfigure(sd); }
EAPI void e_icon_selected_set(const Evas_Object *obj, Eina_Bool selected) { E_Smart_Data *sd; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR(); if (!(sd = evas_object_smart_data_get(obj))) return; if (!sd->edje) return; if (selected) edje_object_signal_emit(sd->obj, "e,state,selected", "e"); else edje_object_signal_emit(sd->obj, "e,state,unselected", "e"); }
EAPI void e_layout_pack(Evas_Object *obj, Evas_Object *child) { E_Smart_Data *sd; E_Layout_Item *li; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR(); sd = evas_object_smart_data_get(obj); _e_layout_smart_adopt(sd, child); sd->items = eina_list_append(sd->items, child); li = evas_object_data_get(child, "e_layout_data"); _e_layout_smart_move_resize_item(li); }
EAPI void e_table_align_set(Evas_Object *obj, double ax, double ay) { E_Smart_Data *sd; if (evas_object_smart_smart_get(obj) != _e_smart) SMARTERRNR(); sd = evas_object_smart_data_get(obj); if ((sd->align.x == ax) && (sd->align.y == ay)) return; sd->align.x = ax; sd->align.y = ay; sd->changed = 1; if (sd->frozen <= 0) _e_table_smart_reconfigure(sd); }
/** * Shows the selection of the editable object * * @param editable an editable object */ EAPI void e_editable_selection_show(Evas_Object *editable) { E_Editable_Smart_Data *sd; if (evas_object_smart_smart_get(editable) != _e_editable_smart) SMARTERRNR(); if ((!editable) || (!(sd = evas_object_smart_data_get(editable)))) return; if (sd->selection_visible) return; sd->selection_visible = 1; if ((evas_object_visible_get(editable)) && (sd->cursor_pos != sd->selection_pos)) evas_object_show(sd->selection_object); }