#include <Elementary_Cursor.h>
#include "elm_priv.h"
#include "elm_module_priv.h"
+#include "els_scroller.h"
-/**
- * @defgroup Entry Entry
- *
- * An entry is a convenience widget which shows
- * a box that the user can enter text into. Unlike a
- * @ref Scrolled_Entry widget, entries DO NOT scroll with user
- * input. Entry widgets are capable of expanding past the
- * boundaries of the window, thus resizing the window to its
- * own length.
- *
- * You can also insert "items" in the entry with:
- *
- * \<item size=16x16 vsize=full href=emoticon/haha\>\</item\>
- *
- * for example. sizing can be set bu size=WxH, relsize=WxH or absize=WxH with
- * vsize=ascent or vsize=full. the href=NAME sets the item name. Entry
- * supports a list of emoticon names by default. These are:
- *
- * - emoticon/angry
- * - emoticon/angry-shout
- * - emoticon/crazy-laugh
- * - emoticon/evil-laugh
- * - emoticon/evil
- * - emoticon/goggle-smile
- * - emoticon/grumpy
- * - emoticon/grumpy-smile
- * - emoticon/guilty
- * - emoticon/guilty-smile
- * - emoticon/haha
- * - emoticon/half-smile
- * - emoticon/happy-panting
- * - emoticon/happy
- * - emoticon/indifferent
- * - emoticon/kiss
- * - emoticon/knowing-grin
- * - emoticon/laugh
- * - emoticon/little-bit-sorry
- * - emoticon/love-lots
- * - emoticon/love
- * - emoticon/minimal-smile
- * - emoticon/not-happy
- * - emoticon/not-impressed
- * - emoticon/omg
- * - emoticon/opensmile
- * - emoticon/smile
- * - emoticon/sorry
- * - emoticon/squint-laugh
- * - emoticon/surprised
- * - emoticon/suspicious
- * - emoticon/tongue-dangling
- * - emoticon/tongue-poke
- * - emoticon/uh
- * - emoticon/unhappy
- * - emoticon/very-sorry
- * - emoticon/what
- * - emoticon/wink
- * - emoticon/worried
- * - emoticon/wtf
- *
- * These are built-in currently, but you can add your own item provieer that
- * can create inlined objects in the text and fill the space allocated to the
- * item with a custom object of your own.
- *
- * See the entry test for some more examples of use of this.
- *
- * Entries have functions to load a text file, display it,
- * allowing editing of it and saving of changes back to the file loaded.
- * Changes are written back to the original file after a short delay.
- * The file to load and save to is specified by elm_entry_file_set().
- *
- * Signals that you can add callbacks for are:
- *
- * "changed" - The text within the entry was changed
- * "activated" - The entry has had editing finished and changes are to be committed
- (generally when enter key is pressed)
- * "press" - The entry has been clicked
- * "longpressed" - The entry has been clicked for a couple seconds
- * "clicked" - The entry has been clicked
- * "clicked,double" - The entry has been double clicked
- * "focused" - The entry has received focus
- * "unfocused" - The entry has lost focus
- * "selection,paste" - A paste action has occurred
- * "selection,copy" - A copy action has occurred
- * "selection,cut" - A cut action has occurred
- * "selection,start" - A selection has begun
- * "selection,changed" - The selection has changed
- * "selection,cleared" - The selection has been cleared
- * "cursor,changed" - The cursor has changed
- * "anchor,clicked" - The anchor has been clicked
- * "preedit,changed" - The preedit string has changed
- */
/* Maximum chunk size to be inserted to the entry at once
* FIXME: This size is arbitrary, should probably choose a better size.
Ecore_Job *deferred_recalc_job;
Ecore_Event_Handler *sel_notify_handler;
Ecore_Event_Handler *sel_clear_handler;
- Ecore_Timer *longpress_timer;
Ecore_Timer *delay_write;
/* for deferred appending */
Ecore_Idler *append_text_idler;
/* Only for clipboard */
const char *cut_sel;
const char *text;
+ const char *password_text;
Evas_Coord wrap_w;
const char *file;
Elm_Text_Format format;
Eina_List *text_filters;
Eina_List *match_list;
Ecore_Job *matchlist_job;
+ int matchlist_threshold;
Ecore_Job *hovdeljob;
Mod_Api *api; // module api if supplied
int cursor_pos;
Elm_Scroller_Policy policy_h, policy_v;
Elm_Wrap_Type linewrap;
+ Elm_Input_Panel_Layout input_panel_layout;
+ Elm_Autocapital_Type autocapital_type;
Eina_Bool changed : 1;
Eina_Bool single_line : 1;
Eina_Bool password : 1;
Eina_Bool textonly : 1;
Eina_Bool usedown : 1;
Eina_Bool scroll : 1;
- Eina_Bool autoreturnkey : 1;
Eina_Bool input_panel_enable : 1;
- Eina_Bool autocapital : 1;
- Elm_Input_Panel_Layout input_panel_layout;
+ Eina_Bool autoreturnkey : 1;
Eina_Bool autoperiod : 1;
Eina_Bool matchlist_list_clicked : 1;
Eina_Bool matchlist_case_sensitive : 1;
- int matchlist_threshold;
};
struct _Elm_Entry_Context_Menu_Item
static void _disable_hook(Evas_Object *obj);
static void _sizing_eval(Evas_Object *obj);
static void _on_focus_hook(void *data, Evas_Object *obj);
+static void _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content);
+static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part);
+static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *part);
static void _resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
static const char *_getbase(Evas_Object *obj);
static void _signal_entry_changed(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _magnifier_show(void *data);
static void _magnifier_hide(void *data);
static void _magnifier_move(void *data);
+static Evas_Coord_Rectangle _layout_region_get(Evas_Object *data);
+static Evas_Coord_Rectangle _viewport_region_get(Evas_Object *data);
static const char SIG_CHANGED[] = "changed";
static const char SIG_ACTIVATED[] = "activated";
static const char SIG_MATCHLIST_CLICKED[] = "matchlist,clicked";
static const char SIG_PREEDIT_CHANGED[] = "preedit,changed";
static const Evas_Smart_Cb_Description _signals[] = {
- {SIG_CHANGED, ""},
- {SIG_ACTIVATED, ""},
- {SIG_PRESS, ""},
- {SIG_LONGPRESSED, ""},
- {SIG_CLICKED, ""},
- {SIG_CLICKED_DOUBLE, ""},
- {SIG_FOCUSED, ""},
- {SIG_UNFOCUSED, ""},
- {SIG_SELECTION_PASTE, ""},
- {SIG_SELECTION_COPY, ""},
- {SIG_SELECTION_CUT, ""},
- {SIG_SELECTION_START, ""},
- {SIG_SELECTION_CHANGED, ""},
- {SIG_SELECTION_CLEARED, ""},
- {SIG_CURSOR_CHANGED, ""},
- {SIG_ANCHOR_CLICKED, ""},
- {SIG_PREEDIT_CHANGED, ""},
- {SIG_MATCHLIST_CLICKED, ""},
- {NULL, NULL}
+ {SIG_CHANGED, ""},
+ {SIG_ACTIVATED, ""},
+ {SIG_PRESS, ""},
+ {SIG_LONGPRESSED, ""},
+ {SIG_CLICKED, ""},
+ {SIG_CLICKED_DOUBLE, ""},
+ {SIG_FOCUSED, ""},
+ {SIG_UNFOCUSED, ""},
+ {SIG_SELECTION_PASTE, ""},
+ {SIG_SELECTION_COPY, ""},
+ {SIG_SELECTION_CUT, ""},
+ {SIG_SELECTION_START, ""},
+ {SIG_SELECTION_CHANGED, ""},
+ {SIG_SELECTION_CLEARED, ""},
+ {SIG_CURSOR_CHANGED, ""},
+ {SIG_ANCHOR_CLICKED, ""},
+ {SIG_PREEDIT_CHANGED, ""},
+ {SIG_MATCHLIST_CLICKED, ""},
+ {NULL, NULL}
};
typedef enum _Elm_Entry_Magnifier_Type
#endif
if (wd->cut_sel) eina_stringshare_del(wd->cut_sel);
if (wd->text) eina_stringshare_del(wd->text);
+ if (wd->password_text) eina_stringshare_del(wd->password_text);
if (wd->bg) evas_object_del(wd->bg);
if (wd->deferred_recalc_job) ecore_job_del(wd->deferred_recalc_job);
if (wd->append_text_idler)
wd->append_text_idler = NULL;
}
if (wd->matchlist_job) ecore_job_del(wd->matchlist_job);
- if (wd->longpress_timer) ecore_timer_del(wd->longpress_timer);
if (wd->mgf_proxy) evas_object_del(wd->mgf_proxy);
if (wd->mgf_bg) evas_object_del(wd->mgf_bg);
if (wd->mgf_clip) evas_object_del(wd->mgf_clip);
{
_filter_free(tf);
}
+ if (wd->delay_write) ecore_timer_del(wd->delay_write);
free(wd);
}
{
Widget_Data *wd = elm_widget_data_get(obj);
const char *t;
- Ecore_IMF_Context *ic;
_elm_widget_mirrored_reload(obj);
_mirrored_set(obj, elm_widget_mirrored_get(obj));
eina_stringshare_del(t);
if (elm_widget_disabled_get(obj))
edje_object_signal_emit(wd->ent, "elm,state,disabled", "elm");
+ edje_object_part_text_input_panel_layout_set(wd->ent, "elm.text", wd->input_panel_layout);
+ edje_object_part_text_autocapital_type_set(wd->ent, "elm.text", wd->autocapital_type);
edje_object_part_text_input_panel_enabled_set(wd->ent, "elm.text", wd->input_panel_enable);
elm_entry_cursor_pos_set(obj, wd->cursor_pos);
if (elm_widget_focus_get(obj))
edj = elm_smart_scroller_edje_object_get(wd->scroller);
str = edje_object_data_get(edj, "focus_highlight");
if ((str) && (!strcmp(str, "on")))
- elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
+ elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
else
- elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
- }
-
- if (wd->password)
- {
- edje_object_part_text_autoperiod_set(wd->ent, "elm.text", EINA_FALSE);
- edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", EINA_FALSE);
- }
- else
- {
- edje_object_part_text_autoperiod_set(wd->ent, "elm.text", wd->autoperiod);
- edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", wd->autocapital);
- }
-
- ic = edje_object_part_text_imf_context_get(wd->ent, "elm.text");
- if (ic)
- {
- ecore_imf_context_input_panel_layout_set(ic, (Ecore_IMF_Input_Panel_Layout)wd->input_panel_layout);
+ elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
}
-
_sizing_eval(obj);
}
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
evas_object_smart_callback_call(obj, SIG_CURSOR_CHANGED, NULL);
+ if (!elm_object_focus_get(obj)) return;
if (!wd->deferred_recalc_job)
{
Evas_Coord cx, cy, cw, ch;
edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text",
- &cx, &cy, &cw, &ch);
+ &cx, &cy, &cw, &ch);
if (wd->cur_changed)
{
elm_widget_show_region_set(obj, cx, cy, cw, ch, EINA_FALSE);
}
}
else
- wd->deferred_cur = EINA_TRUE;
+ wd->deferred_cur = EINA_TRUE;
}
static void
_elm_win_recalc_job(void *data)
{
Widget_Data *wd = elm_widget_data_get(data);
- Evas_Coord minh = -1, resw = -1, minw = -1;
+ Evas_Coord minh = -1, resw = -1, minw = -1, fw = 0, fh = 0;
if (!wd) return;
wd->deferred_recalc_job = NULL;
evas_object_geometry_get(wd->ent, NULL, NULL, &resw, NULL);
edje_object_size_min_restricted_calc(wd->ent, &minw, &minh, resw, 0);
- elm_coords_finger_size_adjust(1, &minw, 1, &minh);
- wd->entmw = minw;
+ edje_object_size_min_restricted_calc(wd->ent, &fw, &fh, 0, 0);
+ elm_coords_finger_size_adjust(1, &fw, 1, &minh);
+ wd->entmw = fw;
wd->entmh = minh;
/* This is a hack to workaround the way min size hints are treated.
* If the minimum width is smaller than the restricted width, it means
evas_object_size_hint_min_get(data, &ominw, NULL);
minw = ominw;
}
- evas_object_size_hint_min_set(data, minw, minh);
- if (wd->single_line)
- evas_object_size_hint_max_set(data, -1, minh);
+
+ elm_coords_finger_size_adjust(1, &fw, 1, &fh);
+ if (wd->scroll)
+ {
+ Evas_Coord vmw = 0, vmh = 0;
+
+ edje_object_size_min_calc
+ (elm_smart_scroller_edje_object_get(wd->scroller),
+ &vmw, &vmh);
+ if (wd->single_line)
+ {
+ evas_object_size_hint_min_set(data, vmw, minh + vmh);
+ evas_object_size_hint_max_set(data, -1, minh + vmh);
+ }
+ else
+ {
+ evas_object_size_hint_min_set(data, vmw, vmh);
+ evas_object_size_hint_max_set(data, -1, -1);
+ }
+ }
else
- evas_object_size_hint_max_set(data, -1, -1);
+ {
+ if (wd->single_line)
+ {
+ evas_object_size_hint_min_set(data, minw, minh);
+ evas_object_size_hint_max_set(data, -1, minh);
+ }
+ else
+ {
+ evas_object_size_hint_min_set(data, fw, minh);
+ evas_object_size_hint_max_set(data, -1, -1);
+ }
+ }
- if (wd->deferred_cur)
+ if ((wd->deferred_cur) && (elm_object_focus_get(data)))
{
Evas_Coord cx, cy, cw, ch;
edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text",
evas_object_resize(wd->scroller, resw, resh);
edje_object_size_min_calc
(elm_smart_scroller_edje_object_get(wd->scroller),
- &vmw, &vmh);
+ &vmw, &vmh);
elm_smart_scroller_child_viewport_size_get(wd->scroller, &vw, &vh);
edje_object_size_min_restricted_calc(wd->ent, &minw, &minh, vw, 0);
wd->entmw = minw;
evas_object_size_hint_min_get(obj, &w, NULL);
evas_object_size_hint_min_set(obj, w, h);
if (wd->single_line)
- evas_object_size_hint_max_set(obj, -1, h);
+ evas_object_size_hint_max_set(obj, -1, h);
else
- evas_object_size_hint_max_set(obj, -1, -1);
+ evas_object_size_hint_max_set(obj, -1, -1);
}
else
{
evas_object_resize(wd->ent, vw, vh);
edje_object_size_min_calc
(elm_smart_scroller_edje_object_get(wd->scroller),
- &vmw, &vmh);
+ &vmw, &vmh);
if (wd->single_line) h = vmh + minh;
else h = vmh;
evas_object_size_hint_min_get(obj, &w, NULL);
evas_object_size_hint_min_set(obj, w, h);
if (wd->single_line)
- evas_object_size_hint_max_set(obj, -1, h);
+ evas_object_size_hint_max_set(obj, -1, h);
else
- evas_object_size_hint_max_set(obj, -1, -1);
+ evas_object_size_hint_max_set(obj, -1, -1);
}
else
{
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
evas_object_size_hint_min_set(obj, minw, minh);
if (wd->single_line)
- evas_object_size_hint_max_set(obj, -1, minh);
+ evas_object_size_hint_max_set(obj, -1, minh);
else
- evas_object_size_hint_max_set(obj, -1, -1);
+ evas_object_size_hint_max_set(obj, -1, -1);
}
}
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Object *top = elm_widget_top_get(obj);
if (!wd) return;
- if (!wd->editable) return;
if (elm_widget_focus_get(obj))
{
printf("[Elm_entry::Focused] obj : %p\n", obj);
evas_object_focus_set(wd->ent, EINA_TRUE);
edje_object_signal_emit(wd->ent, "elm,action,focus", "elm");
- if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON);
+ if (top && wd->input_panel_enable)
+ elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON);
evas_object_smart_callback_call(obj, SIG_FOCUSED, NULL);
_check_enable_returnkey(obj);
- wd->mgf_type = _ENTRY_MAGNIFIER_FILLWIDTH;
+ wd->mgf_type = _ENTRY_MAGNIFIER_FIXEDSIZE;
}
else
{
printf("[Elm_entry::Unfocused] obj : %p\n", obj);
edje_object_signal_emit(wd->ent, "elm,action,unfocus", "elm");
evas_object_focus_set(wd->ent, EINA_FALSE);
- if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF);
+ if (top && wd->input_panel_enable)
+ elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF);
evas_object_smart_callback_call(obj, SIG_UNFOCUSED, NULL);
if ((wd->api) && (wd->api->obj_hidemenu))
}
}
+
+static void
+_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Evas_Object *edje;
+ if ((!wd) || (!content)) return;
+
+ if (wd->scroll)
+ {
+ edje = elm_smart_scroller_edje_object_get(wd->scroller);
+ if (!strcmp(part, "elm.swallow.icon"))
+ {
+ if (wd->icon)
+ evas_object_del(wd->icon);
+ wd->icon = content;
+ edje_object_signal_emit(edje, "elm,action,show,icon", "elm");
+ }
+ else if (!strcmp(part, "elm.swallow.end"))
+ {
+ if (wd->end)
+ evas_object_del(wd->end);
+ wd->end = content;
+ edje_object_signal_emit(edje, "elm,action,show,end", "elm");
+ }
+ }
+ else
+ edje = wd->ent;
+ evas_event_freeze(evas_object_evas_get(obj));
+ elm_widget_sub_object_add(obj, content);
+ edje_object_part_swallow(edje, part, content);
+ _sizing_eval(obj);
+ evas_event_thaw(evas_object_evas_get(obj));
+ evas_event_thaw_eval(evas_object_evas_get(obj));
+}
+
+static Evas_Object *
+_content_unset_hook(Evas_Object *obj, const char *part)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Evas_Object *content, *edje;
+ if (!wd) return NULL;
+
+ if (wd->scroll)
+ {
+ edje = elm_smart_scroller_edje_object_get(wd->scroller);
+ if (!strcmp(part, "elm.swallow.icon"))
+ {
+ wd->icon = NULL;
+ edje_object_signal_emit(edje, "elm,action,hide,icon", "elm");
+ }
+ else if (!strcmp(part, "elm.swallow.end"))
+ {
+ wd->end = NULL;
+ edje_object_signal_emit(edje, "elm,action,hide,end", "elm");
+ }
+ }
+ else
+ edje = wd->ent;
+
+ content = edje_object_part_swallow_get(edje, part);
+ edje_object_part_swallow(edje, part, NULL);
+ if (!content) return NULL;
+ evas_event_freeze(evas_object_evas_get(obj));
+ elm_widget_sub_object_del(obj, content);
+ edje_object_part_unswallow(wd->ent, content);
+ _sizing_eval(obj);
+ evas_event_thaw(evas_object_evas_get(obj));
+ evas_event_thaw_eval(evas_object_evas_get(obj));
+
+ return content;
+}
+
+static Evas_Object *
+_content_get_hook(const Evas_Object *obj, const char *part)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Evas_Object *content = NULL, *edje;
+ if (!wd) return NULL;
+
+ if (wd->scroll)
+ {
+ if (!strcmp(part, "elm.swallow.icon"))
+ return wd->icon;
+ if (!strcmp(part, "elm.swallow.end"))
+ return wd->end;
+
+ edje = elm_smart_scroller_edje_object_get(wd->scroller);
+ }
+ else
+ edje = wd->ent;
+
+ if (edje)
+ content = edje_object_part_swallow_get(edje, part);
+ return content;
+}
+
+static void
+_translate_hook(Evas_Object *obj)
+{
+ evas_object_smart_callback_call(obj, "language,changed", NULL);
+}
+
static void
_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
{
if (!wd) return;
edje_object_signal_callback_add(wd->ent, emission, source, func_cb, data);
if (wd->scroller)
- edje_object_signal_callback_add(elm_smart_scroller_edje_object_get(wd->scroller),
- emission, source, func_cb, data);
+ edje_object_signal_callback_add(elm_smart_scroller_edje_object_get(wd->scroller),
+ emission, source, func_cb, data);
}
static void
edje_object_signal_callback_del_full(wd->ent, emission, source, func_cb,
data);
if (wd->scroller)
- edje_object_signal_callback_del_full(elm_smart_scroller_edje_object_get(wd->scroller),
- emission, source, func_cb, data);
+ edje_object_signal_callback_del_full(elm_smart_scroller_edje_object_get(wd->scroller),
+ emission, source, func_cb, data);
}
static void
{
Widget_Data *wd = elm_widget_data_get(obj);
if (wd->scroll)
- elm_smart_scroller_child_region_show(wd->scroller, x, y, w, h);
+ elm_smart_scroller_child_region_show(wd->scroller, x, y, w, h);
}
static void
}
static void
+_sub_del(void *data, Evas_Object *obj, void *event_info)
+{
+ Widget_Data *wd = data;
+ Evas_Object *sub = event_info;
+ Evas_Object *edje;
+
+ edje = elm_smart_scroller_edje_object_get(wd->scroller);
+ if (sub == wd->icon)
+ {
+ wd->icon = NULL;
+ if (edje)
+ edje_object_signal_emit(edje, "elm,action,hide,icon", "elm");
+ }
+ else if (sub == wd->end)
+ {
+ wd->end = NULL;
+ if (edje)
+ edje_object_signal_emit(edje, "elm,action,hide,end", "elm");
+ }
+ _sizing_eval(obj);
+}
+
+static void
_hoversel_position(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
Widget_Data *wd = elm_widget_data_get(data);
if (wd->hoversel) _hoversel_position(data);
+
+ if (!_elm_config->desktop_entry)
+ edje_object_part_text_viewport_region_set(wd->ent, "elm.text", _viewport_region_get(data));
+
+ if (!_elm_config->desktop_entry)
+ edje_object_part_text_layout_region_set(wd->ent, "elm.text", _layout_region_get(data));
}
static void
{
Widget_Data *wd = elm_widget_data_get(obj);
const char *sel;
+ char *sel_str;
if (!wd) return;
sel = edje_object_part_text_selection_get(wd->ent, "elm.text");
- elm_selection_set(seltype, obj, ELM_SEL_FORMAT_MARKUP, sel);
+ sel_str = strdup(sel);
+ if (!sel_str)
+ return;
+ if (wd->textonly)
+ {
+ while (EINA_TRUE)
+ {
+ char *startTag = NULL;
+ char *endTag = NULL;
+
+ startTag = strstr(sel_str, "<item");
+ if (!startTag)
+ startTag = strstr(sel_str, "</item");
+ if (startTag)
+ endTag = strstr(startTag, ">");
+ else
+ break;
+ if (!endTag || startTag > endTag)
+ break;
+
+ size_t sindex = startTag - sel_str;
+ size_t eindex = endTag - sel_str + 1;
+
+ Eina_Strbuf *buf = eina_strbuf_new();
+ if (buf)
+ {
+ eina_strbuf_append(buf, sel_str);
+ eina_strbuf_remove(buf, sindex, eindex);
+ sel_str = eina_strbuf_string_steal(buf);
+ eina_strbuf_free(buf);
+ }
+ }
+ }
+ elm_selection_set(seltype, obj, ELM_SEL_FORMAT_MARKUP, sel_str);
if (seltype == ELM_SEL_CLIPBOARD)
- eina_stringshare_replace(&wd->cut_sel, sel);
+ eina_stringshare_replace(&wd->cut_sel, sel_str);
+ free(sel_str);
}
static void
{
Widget_Data *wd = elm_widget_data_get(data);
if (!wd) return;
- wd->selmode = EINA_FALSE;
+ wd->selmode = EINA_TRUE;
if (!_elm_config->desktop_entry)
{
- edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
elm_widget_scroll_hold_pop(data);
}
_store_selection(ELM_SEL_CLIPBOARD, data);
- // edje_object_part_text_select_none(wd->ent, "elm.text");
}
static void
Widget_Data *wd = elm_widget_data_get(data);
if (!wd) return;
- Evas_Coord x, y, w, h, fs;
+ Evas_Coord x, y, w, h;
Evas_Coord cx, cy, cw, ch, ox, oy;
edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", &cx, &cy, &cw, &ch);
evas_object_geometry_get(data, &x, &y, &w, &h);
ox = oy = 0;
- fs = elm_finger_size_get();
- if ((cy + y) - wd->mgf_height - fs < 0)
- oy = -1 * ((cy + y) - wd->mgf_height - fs);
+ if ((cy + y) - wd->mgf_height < 0)
+ oy = -1 * ((cy + y) - wd->mgf_height);
if (wd->mgf_type == _ENTRY_MAGNIFIER_FIXEDSIZE)
- evas_object_move(wd->mgf_bg, (cx + x + cw/2) + ox, (cy + y) - wd->mgf_height - fs + oy);
+ evas_object_move(wd->mgf_bg, (cx + x + cw/2) + ox, (cy + y) - wd->mgf_height + oy);
else if (wd->mgf_type == _ENTRY_MAGNIFIER_FILLWIDTH)
- evas_object_move(wd->mgf_bg, x, (cy + y) - wd->mgf_height - fs + oy);
+ evas_object_move(wd->mgf_bg, x, (cy + y) - wd->mgf_height + oy);
else
return;
- evas_object_move(wd->mgf_proxy, (1 - wd->mgf_scale) * cx + x + ox, (1 - wd->mgf_scale) * cy + y - wd->mgf_height/2 - ch/2 - fs + oy);
+ evas_object_move(wd->mgf_proxy, (1 - wd->mgf_scale) * cx + x + ox, (1 - wd->mgf_scale) * cy + y - wd->mgf_height/2 - ch/2 + oy);
}
static void
Widget_Data *wd = elm_widget_data_get(data);
Evas_Coord x, y, w, h, mw, mh;
const char* key_data = NULL;
+ double elm_scale;
if (!wd) return;
evas_object_geometry_get(data, &x, &y, &w, &h);
if ((w <= 0) || (h <= 0))
- return;
+ return;
wd->mgf_bg = edje_object_add(evas_object_evas_get(data));
key_data = edje_object_data_get(wd->mgf_bg, "scale");
if (key_data) wd->mgf_scale = atof(key_data);
+ elm_scale = elm_scale_get();
+ wd->mgf_height = (int)((float)wd->mgf_height * elm_scale);
+
if (wd->mgf_type == _ENTRY_MAGNIFIER_FILLWIDTH)
evas_object_resize(wd->mgf_bg, w, wd->mgf_height);
mw = (Evas_Coord)((float)w * wd->mgf_scale);
mh = (Evas_Coord)((float)h * wd->mgf_scale);
if ((mw <= 0) || (mh <= 0))
- return;
+ return;
evas_object_resize(wd->mgf_proxy, mw, mh);
evas_object_image_fill_set(wd->mgf_proxy, 0, 0, mw, mh);
}
static Eina_Bool
-_long_press(void *data)
+_signal_long_pressed(void *data)
{
Widget_Data *wd = elm_widget_data_get(data);
if (!wd) return ECORE_CALLBACK_CANCEL;
wd->long_pressed = EINA_TRUE;
- if (wd->longpress_timer)
- {
- ecore_timer_del(wd->longpress_timer);
- wd->longpress_timer = NULL;
- }
-
_cancel(data, NULL, NULL);
_magnifier_create(data);
_magnifier_show(data);
elm_object_scroll_freeze_push(data);
- wd->longpress_timer = NULL;
evas_object_smart_callback_call(data, SIG_LONGPRESSED, NULL);
return ECORE_CALLBACK_CANCEL;
}
wd->downx = ev->canvas.x;
wd->downy = ev->canvas.y;
wd->long_pressed = EINA_FALSE;
- if (ev->button == 1)
- {
- if (wd->longpress_timer) ecore_timer_del(wd->longpress_timer);
- wd->longpress_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press, data);
- }
}
static void
if (!wd->double_clicked)
{
if ((wd->api) && (wd->api->obj_mouseup))
- {
- wd->api->obj_mouseup(data);
- }
- }
-
- if (wd->longpress_timer)
- {
- ecore_timer_del(wd->longpress_timer);
- wd->longpress_timer = NULL;
+ wd->api->obj_mouseup(data);
}
-
_magnifier_hide(data);
elm_object_scroll_freeze_pop(data);
if (wd->long_pressed)
- {
- _menu_press(data);
- }
-
+ _menu_press(data);
}
else if (ev->button == 3)
{
Evas_Event_Mouse_Move *ev = event_info;
if (!wd) return;
if (wd->disabled) return;
- if (!wd->selmode)
- {
- if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
- {
- if (wd->longpress_timer)
- {
- ecore_timer_del(wd->longpress_timer);
- wd->longpress_timer = NULL;
- }
- }
- else if (wd->longpress_timer)
- {
- Evas_Coord dx, dy;
-
- dx = wd->downx - ev->cur.canvas.x;
- dx *= dx;
- dy = wd->downy - ev->cur.canvas.y;
- dy *= dy;
- if ((dx + dy) >
- ((_elm_config->finger_size / 2) *
- (_elm_config->finger_size / 2)))
- {
- ecore_timer_del(wd->longpress_timer);
- wd->longpress_timer = NULL;
- }
- }
- }
- else if (wd->longpress_timer)
- {
- Evas_Coord dx, dy;
-
- dx = wd->downx - ev->cur.canvas.x;
- dx *= dx;
- dy = wd->downy - ev->cur.canvas.y;
- dy *= dy;
- if ((dx + dy) >
- ((_elm_config->finger_size / 2) *
- (_elm_config->finger_size / 2)))
- {
- ecore_timer_del(wd->longpress_timer);
- wd->longpress_timer = NULL;
- }
- }
if (ev->buttons == 1)
{
return len;
}
+#ifndef HAVE_STRCASESTR
+char* _strcasestr(const char *s, const char *find)
+{
+ char c, sc;
+ size_t len;
+
+ if ((c = *find++) != 0) {
+ c = tolower((unsigned char) c);
+ len = strlen(find);
+ do {
+ do {
+ if( (sc = *s++) == 0)
+ return NULL;
+ } while ((char)tolower((unsigned char)sc) != c);
+ } while (strncasecmp(s, find, len) != 0);
+ s--;
+ }
+ return ((char*) s);
+}
+#endif
+
static void
_matchlist_show(void *data)
{
if (wd->matchlist_case_sensitive)
str_result = strstr(str_list, text);
else
- str_result = strcasestr(str_list, text);
+#ifdef HAVE_STRCASESTR
+ str_result = strcasestr(str_list, text);
+#else
+ str_result = _strcasestr(str_list, text);
+#endif
if (str_result)
{
textlen = strlen(str_list) - strlen(str_result);
str_front = malloc(textlen + 1);
- if (str_front == NULL) return;
+ if (str_front == NULL)
+ {
+ free(str_mkup);
+ return;
+ }
memset(str_front, 0, textlen + 1);
strncpy(str_front, str_list, textlen);
textlen = strlen(text);
str_mid = malloc(textlen + 1);
- if (str_mid == NULL) return;
+ if (str_mid == NULL)
+ {
+ free(str_mkup);
+ free(str_front);
+ return;
+ }
memset(str_mid, 0, textlen + 1);
strncpy(str_mid, str_list + strlen(str_front), textlen);
if ((it == NULL) || (wd == NULL))
return;
+ const char *str = NULL;
const char *text = elm_list_item_label_get(it);
evas_object_smart_callback_call((Evas_Object *)data, "selected", (void *)text);
if (wd->match_list)
{
if (text != NULL)
{
- elm_entry_entry_set(data, elm_entry_markup_to_utf8(text));
+ str = elm_entry_markup_to_utf8(text);
+ elm_entry_entry_set(data, str);
elm_entry_cursor_end_set(data);
wd->matchlist_list_clicked = EINA_TRUE;
evas_object_smart_callback_call(data, SIG_MATCHLIST_CLICKED, elm_entry_markup_to_utf8(text));
+ free(str);
}
}
elm_widget_focus_set(data, EINA_TRUE);
}
-EAPI void
-elm_entry_matchlist_set(Evas_Object *obj, Eina_List *match_list, Eina_Bool case_sensitive)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- if (match_list)
- {
- Evas_Coord max_w = 9999, max_h = 9999;
- const char* key_data = NULL;
-
- wd->matchlist_threshold = 1;
- wd->hover = elm_hover_add(elm_widget_parent_get(obj));
- elm_hover_parent_set(wd->hover, elm_widget_parent_get(obj));
- elm_hover_target_set(wd->hover, obj);
- elm_object_style_set(wd->hover, "matchlist");
-
- wd->layout = elm_layout_add(wd->hover);
- elm_layout_theme_set(wd->layout, "entry", "matchlist", "default");
- wd->list = elm_list_add(wd->layout);
- evas_object_size_hint_weight_set(wd->list, EVAS_HINT_EXPAND, 0.0);
- evas_object_size_hint_align_set(wd->list, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_list_mode_set(wd->list, ELM_LIST_EXPAND);
- elm_object_style_set(wd->list, "matchlist");
-
- key_data = edje_object_data_get(elm_layout_edje_get(wd->layout), "max_width");
- if (key_data) max_w = atoi(key_data);
- key_data = edje_object_data_get(elm_layout_edje_get(wd->layout), "max_height");
- if (key_data) max_h = atoi(key_data);
-
- elm_list_go(wd->list);
- evas_object_size_hint_max_set(wd->list, max_w, max_h);
- evas_object_smart_callback_add(wd->list, "selected", _matchlist_list_clicked, obj);
- elm_layout_content_set(wd->layout, "elm.swallow.content", wd->list);
- elm_hover_content_set(wd->hover, "bottom", wd->layout);
-
- wd->match_list = match_list;
- }
- else
- {
- if (wd->hover)
- evas_object_del(wd->hover);
-
- wd->match_list = NULL;
- }
-
- wd->matchlist_case_sensitive = case_sensitive;
-}
-
static void
_entry_changed_common_handling(void *data, const char *event)
{
_sizing_eval(data);
if (wd->text) eina_stringshare_del(wd->text);
wd->text = NULL;
+ if (wd->password_text) eina_stringshare_del(wd->password_text);
+ wd->password_text = NULL;
_check_enable_returnkey(data);
- evas_object_smart_callback_call(data, event, NULL);
if (wd->delay_write)
{
ecore_timer_del(wd->delay_write);
}
if ((wd->single_line) && (wd->match_list))
- {
- if (wd->matchlist_job) ecore_job_del(wd->matchlist_job);
- wd->matchlist_job = ecore_job_add(_matchlist_show, data);
- }
- if ((!wd->autosave) || (!wd->file)) return;
- wd->delay_write = ecore_timer_add(2.0, _delay_write, data);
+ {
+ if (wd->matchlist_job) ecore_job_del(wd->matchlist_job);
+ wd->matchlist_job = ecore_job_add(_matchlist_show, data);
+ }
+
+ if ((wd->api) && (wd->api->obj_hidemenu))
+ wd->api->obj_hidemenu(data);
+
+ if ((wd->autosave) && (wd->file))
+ wd->delay_write = ecore_timer_add(2.0, _delay_write, data);
+ /* callback - this could call callbacks that delete the entry... thus...
+ * any access to wd after this could be invalid */
+ evas_object_smart_callback_call(data, event, NULL);
}
static void
_signal_entry_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
+ Widget_Data *wd = elm_widget_data_get(data);
+ if (!wd) return;
+
_entry_changed_common_handling(data, SIG_CHANGED);
}
static void
_signal_preedit_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
+ Widget_Data *wd = elm_widget_data_get(data);
+ if (!wd) return;
+
_entry_changed_common_handling(data, SIG_PREEDIT_CHANGED);
}
-
static void
_signal_handler_move_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(data);
+ if (!wd) return;
+
elm_object_scroll_freeze_push(data);
if ((wd->api) && (wd->api->obj_hidemenu))
- {
- wd->api->obj_hidemenu(data);
- }
+ wd->api->obj_hidemenu(data);
_magnifier_create(data);
_magnifier_move(data);
_signal_handler_move_end(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(data);
+ if (!wd) return;
+
elm_object_scroll_freeze_pop(data);
if (wd->have_selection)
_magnifier_show(data);
}
-static void
-_signal_selection_end(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+static Evas_Coord_Rectangle
+_layout_region_get(Evas_Object *data)
{
- _magnifier_hide(data);
- _menu_press(data);
-}
+ Evas_Coord_Rectangle geometry;
+ geometry.x = geometry.y = geometry.w = geometry.h = -1;
-static void
-_signal_selection_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
-{
Widget_Data *wd = elm_widget_data_get(data);
- const Eina_List *l;
- Evas_Object *entry;
- if (!wd) return;
- EINA_LIST_FOREACH(entries, l, entry)
+ if (!wd) return geometry;
+
+ if (!data || !strlen(elm_widget_type_get(data)))
+ return geometry;
+
+ Evas_Object *child_obj = data;
+ Evas_Object *parent_obj;
+
+ while (parent_obj = elm_widget_parent_get(child_obj))
{
- if (entry != data) elm_entry_select_none(entry);
+ if (!strcmp(elm_widget_type_get(parent_obj), "conformant"))
+ {
+ evas_object_geometry_get(child_obj, &geometry.x, &geometry.y, &geometry.w, &geometry.h);
+ return geometry;
+ }
+ child_obj = parent_obj;
}
- wd->have_selection = EINA_TRUE;
+
+ return geometry;
+}
+
+static Evas_Coord_Rectangle
+_viewport_region_get(Evas_Object *data)
+{
+ Evas_Coord_Rectangle geometry;
+ geometry.x = geometry.y = geometry.w = geometry.h = -1;
+
+ Widget_Data *wd = elm_widget_data_get(data);
+ if (!wd) return geometry;
+
+ if (!data || !strlen(elm_widget_type_get(data)))
+ return geometry;
+
+ if (wd->scroll)
+ {
+ evas_object_geometry_get(wd->scroller, &geometry.x, &geometry.y, NULL, NULL);
+ elm_smart_scroller_child_viewport_size_get(wd->scroller, &geometry.w, &geometry.h);
+
+ return geometry;
+ }
+
+ Evas_Object *parent_obj = data;
+
+ while (parent_obj = elm_widget_parent_get(parent_obj))
+ {
+ if (!strcmp(elm_widget_type_get(parent_obj), "scroller") ||
+ !strcmp(elm_widget_type_get(parent_obj), "genlist"))
+ {
+ evas_object_geometry_get(parent_obj, &geometry.x, &geometry.y, &geometry.w, &geometry.h);
+ return geometry;
+ }
+ }
+
+ return geometry;
+}
+
+static void
+_signal_selection_end(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+ _magnifier_hide(data);
+ _menu_press(data);
+}
+
+static void
+_signal_selection_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+ Widget_Data *wd = elm_widget_data_get(data);
+ const Eina_List *l;
+ Evas_Object *entry;
+ if (!wd) return;
+ EINA_LIST_FOREACH(entries, l, entry)
+ {
+ if (entry != data) elm_entry_select_none(entry);
+ }
+ wd->have_selection = EINA_TRUE;
wd->selmode = EINA_TRUE;
evas_object_smart_callback_call(data, SIG_SELECTION_START, NULL);
#ifdef HAVE_ELEMENTARY_X
elm_selection_set(ELM_SEL_PRIMARY, data, ELM_SEL_FORMAT_MARKUP, txt);
}
#endif
+
}
static void
edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", &cx, &cy, &cw, &ch);
if (!wd->deferred_recalc_job)
- elm_widget_show_region_set(data, cx, cy, cw, ch, EINA_FALSE);
+ elm_widget_show_region_set(data, cx, cy, cw, ch, EINA_FALSE);
else
{
wd->deferred_cur = EINA_TRUE;
wd->cx = cx;
wd->cy = cy;
wd->cw = cw;
- wd->ch = ch + elm_finger_size_get();
+ wd->ch = ch;
}
}
edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", &cx, &cy, &cw, &ch);
if (!wd->deferred_recalc_job)
- elm_widget_show_region_set(data, cx, cy, cw, ch + elm_finger_size_get(), EINA_FALSE);
+ elm_widget_show_region_set(data, cx, cy, cw, ch, EINA_FALSE);
else
{
wd->deferred_cur = EINA_TRUE;
wd->cx = cx;
wd->cy = cy;
wd->cw = cw;
- wd->ch = ch + elm_finger_size_get();
+ wd->ch = ch;
}
}
evas_object_smart_callback_call(data, SIG_PRESS, NULL);
if ((wd->api) && (wd->api->obj_hidemenu))
- {
- wd->api->obj_hidemenu(data);
- }
+ wd->api->obj_hidemenu(data);
}
static void
Widget_Data *wd = elm_widget_data_get(data);
if (!wd) return;
evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
+
+ if (!_elm_config->desktop_entry && !wd->double_clicked)
+ _cancel(data, NULL, NULL);
}
static void
static Eina_Bool
_event_selection_clear(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
-/*
+#if 0
Widget_Data *wd = elm_widget_data_get(data);
Ecore_X_Event_Selection_Clear *ev = event;
if (!wd) return ECORE_CALLBACK_PASS_ON;
{
elm_entry_select_none(data);
}
- return 1; */
+#else
// start for cbhm
Evas_Object *top = elm_widget_top_get(data);
if (cnpwidgetdata == data)
{
+ evas_object_smart_callback_call(data, SIG_SELECTION_PASTE, NULL);
elm_selection_get(ELM_SEL_SECONDARY,ELM_SEL_FORMAT_MARKUP,data,NULL,NULL);
}
// end for cbhm
+#endif
return ECORE_CALLBACK_PASS_ON;
}
{
const char *srcstring = NULL;
Eina_Strbuf *repbuf = NULL, *diffbuf = NULL;
- char *curlocater, *replocater;
+ char *curlocater = NULL, *replocater;
char *starttag, *endtag;
int tagtxtlen = 0, insertflag = 0;
srcstring = eina_strbuf_string_get(srcbuf);
- curlocater = strstr(srcstring, key);
-
+ if (srcstring)
+ curlocater = strstr(srcstring, key);
if (!curlocater || !srcstring)
{
- insertflag = 1;
+ insertflag = 1;
}
else
{
Widget_Data *wd = elm_widget_data_get(obj);
if (wd->text) eina_stringshare_del(wd->text);
wd->text = NULL;
+ if (wd->password_text) eina_stringshare_del(wd->password_text);
+ wd->password_text = NULL;
wd->changed = EINA_TRUE;
start = wd->append_text_position;
- if(start + _CHUNK_SIZE < wd->append_text_len)
+ if (start + _CHUNK_SIZE < wd->append_text_len)
{
- wd->append_text_position = (start + _CHUNK_SIZE);
- /* Go to the start of the nearest codepoint, because we don't want
- * to cut it in the middle */
- eina_unicode_utf8_get_prev(wd->append_text_left,
- &wd->append_text_position);
+ int pos = start;
+ int tag_start, esc_start;
+
+ tag_start = esc_start = -1;
+ /* Find proper markup cut place */
+ while (pos - start < _CHUNK_SIZE)
+ {
+ int prev_pos = pos;
+ Eina_Unicode tmp =
+ eina_unicode_utf8_get_next(wd->append_text_left, &pos);
+ if (esc_start == -1)
+ {
+ if (tmp == '<')
+ tag_start = prev_pos;
+ else if (tmp == '>')
+ tag_start = -1;
+ }
+ else if (tag_start == -1)
+ {
+ if (tmp == '&')
+ esc_start = prev_pos;
+ else if (tmp == ';')
+ esc_start = -1;
+ }
+ }
+
+ if (tag_start >= 0)
+ {
+ wd->append_text_position = tag_start;
+ }
+ else if (esc_start >= 0)
+ {
+ wd->append_text_position = esc_start;
+ }
+ else
+ {
+ wd->append_text_position = pos;
+ }
}
else
{
wd->append_text_left[wd->append_text_position] = '\0';
edje_object_part_text_append(wd->ent, "elm.text",
- wd->append_text_left + start);
+ wd->append_text_left + start);
wd->append_text_left[wd->append_text_position] = backup;
}
else
{
- int index = 0;
+ int idx = 0;
if (*new_text == '&')
{
- while (*(new_text + index) != ';')
+ while (*(new_text + idx) != ';')
{
- index++;
- if (!*(new_text + index)) break;
+ idx++;
+ if (!*(new_text + idx)) break;
}
}
char *markup;
- index = evas_string_char_next_get(new_text, index, NULL);
- markup = malloc(index + 1);
- strncpy(markup, new_text, index);
- markup[index] = 0;
+ idx = evas_string_char_next_get(new_text, idx, NULL);
+ markup = malloc(idx + 1);
+ strncpy(markup, new_text, idx);
+ markup[idx] = 0;
if (unit == LENGTH_UNIT_BYTE)
unit_size = strlen(elm_entry_markup_to_utf8(markup));
else if (unit == LENGTH_UNIT_CHAR)
return;
}
can_add = 0;
- strncpy(new_text, new_text + index, current_len - ((new_text + index) - *text));
- current_len -= index;
+ strncpy(new_text, new_text + idx, current_len - ((new_text + idx) - *text));
+ current_len -= idx;
(*text)[current_len] = 0;
}
else
{
- new_text += index;
+ new_text += idx;
can_add -= unit_size;
}
i++;
{
int len = 0;
ELM_CHECK_WIDTYPE(obj, widtype);
- if (item && strcmp(item, "default")) return;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (!entry) entry = "";
+ if (item && strcmp(item, "default"))
+ {
+ edje_object_part_text_set(wd->ent, item, entry);
+ return;
+ }
+
if (wd->text) eina_stringshare_del(wd->text);
wd->text = NULL;
+ if (wd->password_text) eina_stringshare_del(wd->password_text);
+ wd->password_text = NULL;
wd->changed = EINA_TRUE;
/* Clear currently pending job if there is one */
if (item && strcmp(item, "default")) return NULL;
const char *text;
if (!wd) return NULL;
- if (wd->text)
+ if (wd->password)
{
- if (wd->password)
- return elm_entry_markup_to_utf8(wd->text);
- else
- return wd->text;
+ if(wd->password_text) return wd->password_text;
+ }
+ else if (wd->text)
+ {
+ return wd->text;
}
text = edje_object_part_text_get(wd->ent, "elm.text");
if (!text)
return NULL;
}
eina_stringshare_replace(&wd->text, text);
- if (wd->password) return elm_entry_markup_to_utf8(wd->text);
+ if (wd->password)
+ {
+ const char *pw_text;
+ pw_text = elm_entry_markup_to_utf8(wd->text);
+ if (pw_text)
+ {
+ eina_stringshare_replace(&wd->password_text, pw_text);
+ free(pw_text);
+ return wd->password_text;
+ }
+ }
return wd->text;
}
-/**
- * This adds an entry to @p parent object.
- *
- * @param parent The parent object
- * @return The new object or NULL if it cannot be created
- *
- * @ingroup Entry
- */
EAPI Evas_Object *
elm_entry_add(Evas_Object *parent)
{
elm_widget_highlight_ignore_set(obj, EINA_TRUE);
elm_widget_text_set_hook_set(obj, _elm_entry_text_set);
elm_widget_text_get_hook_set(obj, _elm_entry_text_get);
+ elm_widget_content_set_hook_set(obj, _content_set_hook);
+ elm_widget_content_unset_hook_set(obj, _content_unset_hook);
+ elm_widget_content_get_hook_set(obj, _content_get_hook);
+ elm_widget_translate_hook_set(obj, _translate_hook);
+
+ evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, wd);
wd->scroller = elm_smart_scroller_add(e);
elm_widget_sub_object_add(obj, wd->scroller);
_signal_selection_start, obj);
edje_object_signal_callback_add(wd->ent, "selection,end", "elm.text",
_signal_selection_end, obj);
+ edje_object_signal_callback_add(wd->ent, "long,pressed", "elm.text",
+ _signal_long_pressed, obj);
edje_object_signal_callback_add(wd->ent, "magnifier,changed", "elm.text",
_signal_magnifier_changed, obj);
edje_object_signal_callback_add(wd->ent, "selection,changed", "elm.text",
elm_widget_resize_object_set(obj, wd->ent);
_sizing_eval(obj);
+ elm_entry_input_panel_layout_set(obj, ELM_INPUT_PANEL_LAYOUT_NORMAL);
+
wd->input_panel_enable = edje_object_part_text_input_panel_enabled_get(wd->ent, "elm.text");
+ wd->autocapital_type = edje_object_part_text_autocapital_type_get(wd->ent, "elm.text");
#ifdef HAVE_ELEMENTARY_X
top = elm_widget_top_get(obj);
ext_mod->selectall = _selectall;
ext_mod->ent = wd->ent;
ext_mod->items = wd->items;
- ext_mod->longpress_timer = wd->longpress_timer;
ext_mod->editable = wd->editable;
ext_mod->have_selection = wd->have_selection;
ext_mod->password = wd->password;
ext_mod->textonly = wd->textonly;
}
-/**
- * This sets the entry object not to line wrap. All input will
- * be on a single line, and the entry box will extend with user input.
- *
- * @param obj The entry object
- * @param single_line If true, the text in the entry
- * will be on a single line.
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_single_line_set(Evas_Object *obj, Eina_Bool single_line)
{
}
}
-/**
- * This returns true if the entry has been set to single line mode.
- * See also elm_entry_single_line_set().
- *
- * @param obj The entry object
- * @return single_line If true, the text in the entry is set to display
- * on a single line.
- *
- * @ingroup Entry
- */
EAPI Eina_Bool
elm_entry_single_line_get(const Evas_Object *obj)
{
return wd->single_line;
}
-/**
- * This sets the entry object to password mode. All text entered
- * and/or displayed within the widget will be replaced with asterisks (*).
- *
- * @param obj The entry object
- * @param password If true, password mode is enabled.
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_password_set(Evas_Object *obj, Eina_Bool password)
{
_theme_hook(obj);
}
-/**
- * This returns whether password mode is enabled.
- * See also elm_entry_password_set().
- *
- * @param obj The entry object
- * @return If true, the entry is set to display all characters
- * as asterisks (*).
- *
- * @ingroup Entry
- */
EAPI Eina_Bool
elm_entry_password_get(const Evas_Object *obj)
{
return wd->password;
}
-/**
- * This sets the text displayed within the entry to @p entry.
- *
- * @param obj The entry object
- * @param entry The text to be displayed
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_entry_set(Evas_Object *obj, const char *entry)
{
_elm_entry_text_set(obj, NULL, entry);
}
-/**
- * This appends @p entry to the text of the entry.
- *
- * @param obj The entry object
- * @param entry The text to be displayed
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_entry_append(Evas_Object *obj, const char *entry)
{
}
}
-/**
- * This returns the text currently shown in object @p entry.
- * See also elm_entry_entry_set().
- *
- * @param obj The entry object
- * @return The currently displayed text or NULL on failure
- *
- * @ingroup Entry
- */
EAPI const char *
elm_entry_entry_get(const Evas_Object *obj)
{
return _elm_entry_text_get(obj, NULL);
}
-/**
- * This returns EINA_TRUE if the entry is empty/there was an error
- * and EINA_FALSE if it is not empty.
- *
- * @param obj The entry object
- * @return If the entry is empty or not.
- *
- * @ingroup Entry
- */
EAPI Eina_Bool
elm_entry_is_empty(const Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(obj, widtype) EINA_TRUE;
Widget_Data *wd = elm_widget_data_get(obj);
const Evas_Object *tb;
- //Evas_Textblock_Cursor *cur;
+ Evas_Textblock_Cursor *cur;
Eina_Bool ret;
if (!wd) return EINA_TRUE;
-#if 0
+if (0) {
/* It's a hack until we get the support suggested above.
* We just create a cursor, point it to the begining, and then
* try to advance it, if it can advance, the tb is not empty,
evas_textblock_cursor_free(cur);
return !ret;
-#endif
+}
char *str = elm_entry_markup_to_utf8(elm_entry_entry_get(obj));
if (!str) return EINA_TRUE;
ret = (strlen(str) == 0);
+ free(str);
return ret;
}
-/**
- * This returns all selected text within the entry.
- *
- * @param obj The entry object
- * @return The selected text within the entry or NULL on failure
- *
- * @ingroup Entry
- */
EAPI const char *
elm_entry_selection_get(const Evas_Object *obj)
{
return edje_object_part_text_selection_get(wd->ent, "elm.text");
}
-/**
- * This inserts text in @p entry where the current cursor position.
- *
- * This inserts text at the cursor position is as if it was typed
- * by the user (note this also allows markup which a user
- * can't just "type" as it would be converted to escaped text, so this
- * call can be used to insert things like emoticon items or bold push/pop
- * tags, other font and color change tags etc.)
- *
- * @param obj The entry object
- * @param entry The text to insert
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_entry_insert(Evas_Object *obj, const char *entry)
{
_sizing_eval(obj);
}
-/**
- * This enables word line wrapping in the entry object. It is the opposite
- * of elm_entry_single_line_set(). Additionally, setting this disables
- * character line wrapping.
- *
- * @param obj The entry object
- * @param wrap If true, the entry will be wrapped once it reaches the end
- * of the object. Wrapping will occur at the end of the word before the end of the
- * object.
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_line_wrap_set(Evas_Object *obj, Elm_Wrap_Type wrap)
{
_theme_hook(obj);
}
-/**
- * Set wrap width of the entry
- *
- * @param obj The entry object
- * @param w The wrap width in pixels at a minimum where words need to wrap
- * @ingroup Entry
- */
-EAPI void
-elm_entry_wrap_width_set(Evas_Object *obj, Evas_Coord w)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (wd->wrap_w == w) return;
- wd->wrap_w = w;
- _sizing_eval(obj);
-}
-
-/**
- * get wrap width of the entry
- *
- * @param obj The entry object
- * @return The wrap width in pixels at a minimum where words need to wrap
- * @ingroup Entry
- */
-EAPI Evas_Coord
-elm_entry_wrap_width_get(const Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- return wd->wrap_w;
-}
-
-/**
- * Get the wrapping behavior of the entry.
- * See also elm_entry_line_wrap_set().
- *
- * @param obj The entry object
- * @return Wrap type
- *
- * @ingroup Entry
- */
EAPI Elm_Wrap_Type
elm_entry_line_wrap_get(const Evas_Object *obj)
{
return wd->linewrap;
}
-/**
- * This sets the editable attribute of the entry.
- *
- * @param obj The entry object
- * @param editable If true, the entry will be editable by the user.
- * If false, it will be set to the disabled state.
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_editable_set(Evas_Object *obj, Eina_Bool editable)
{
#endif
}
-/**
- * This gets the editable attribute of the entry.
- * See also elm_entry_editable_set().
- *
- * @param obj The entry object
- * @return If true, the entry is editable by the user.
- * If false, it is not editable by the user
- *
- * @ingroup Entry
- */
EAPI Eina_Bool
elm_entry_editable_get(const Evas_Object *obj)
{
return wd->editable;
}
-/**
- * This drops any existing text selection within the entry.
- *
- * @param obj The entry object
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_select_none(Evas_Object *obj)
{
edje_object_part_text_select_none(wd->ent, "elm.text");
}
-/**
- * This selects all text within the entry.
- *
- * @param obj The entry object
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_select_all(Evas_Object *obj)
{
edje_object_part_text_select_all(wd->ent, "elm.text");
}
-/**
- * This function returns the geometry of the cursor.
- *
- * It's useful if you want to draw something on the cursor (or where it is),
- * or for example in the case of scrolled entry where you want to show the
- * cursor.
- *
- * @param obj The entry object
- * @param x returned geometry
- * @param y returned geometry
- * @param w returned geometry
- * @param h returned geometry
- * @return EINA_TRUE upon success, EINA_FALSE upon failure
- *
- * @ingroup Entry
- */
EAPI Eina_Bool
elm_entry_cursor_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
{
return EINA_TRUE;
}
-/**
- * This moves the cursor one place to the right within the entry.
- *
- * @param obj The entry object
- * @return EINA_TRUE upon success, EINA_FALSE upon failure
- *
- * @ingroup Entry
- */
EAPI Eina_Bool
elm_entry_cursor_next(Evas_Object *obj)
{
return edje_object_part_text_cursor_next(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
}
-/**
- * This moves the cursor one place to the left within the entry.
- *
- * @param obj The entry object
- * @return EINA_TRUE upon success, EINA_FALSE upon failure
- *
- * @ingroup Entry
- */
EAPI Eina_Bool
elm_entry_cursor_prev(Evas_Object *obj)
{
return edje_object_part_text_cursor_prev(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
}
-/**
- * This moves the cursor one line up within the entry.
- *
- * @param obj The entry object
- * @return EINA_TRUE upon success, EINA_FALSE upon failure
- *
- * @ingroup Entry
- */
EAPI Eina_Bool
elm_entry_cursor_up(Evas_Object *obj)
{
return edje_object_part_text_cursor_up(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
}
-/**
- * This moves the cursor one line down within the entry.
- *
- * @param obj The entry object
- * @return EINA_TRUE upon success, EINA_FALSE upon failure
- *
- * @ingroup Entry
- */
EAPI Eina_Bool
elm_entry_cursor_down(Evas_Object *obj)
{
return edje_object_part_text_cursor_down(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
}
-/**
- * This moves the cursor to the beginning of the entry.
- *
- * @param obj The entry object
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_cursor_begin_set(Evas_Object *obj)
{
edje_object_part_text_cursor_begin_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
}
-/**
- * This moves the cursor to the end of the entry.
- *
- * @param obj The entry object
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_cursor_end_set(Evas_Object *obj)
{
}
}
-/**
- * This moves the cursor to the beginning of the current line.
- *
- * @param obj The entry object
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_cursor_line_begin_set(Evas_Object *obj)
{
edje_object_part_text_cursor_line_begin_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
}
-/**
- * This moves the cursor to the end of the current line.
- *
- * @param obj The entry object
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_cursor_line_end_set(Evas_Object *obj)
{
edje_object_part_text_cursor_line_end_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
}
-/**
- * This begins a selection within the entry as though
- * the user were holding down the mouse button to make a selection.
- *
- * @param obj The entry object
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_cursor_selection_begin(Evas_Object *obj)
{
edje_object_part_text_select_begin(wd->ent, "elm.text");
}
-/**
- * This ends a selection within the entry as though
- * the user had just released the mouse button while making a selection.
- *
- * @param obj The entry object
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_cursor_selection_end(Evas_Object *obj)
{
edje_object_part_text_select_extend(wd->ent, "elm.text");
}
-/**
- * TODO: fill this in
- *
- * @param obj The entry object
- * @return TODO: fill this in
- *
- * @ingroup Entry
- */
EAPI Eina_Bool
elm_entry_cursor_is_format_get(const Evas_Object *obj)
{
return edje_object_part_text_cursor_is_format_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
}
-/**
- * This returns whether the cursor is visible.
- *
- * @param obj The entry object
- * @return If true, the cursor is visible.
- *
- * @ingroup Entry
- */
EAPI Eina_Bool
elm_entry_cursor_is_visible_format_get(const Evas_Object *obj)
{
return edje_object_part_text_cursor_is_visible_format_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
}
-/**
- * TODO: fill this in
- *
- * @param obj The entry object
- * @return TODO: fill this in
- *
- * @ingroup Entry
- */
EAPI const char *
elm_entry_cursor_content_get(const Evas_Object *obj)
{
return edje_object_part_text_cursor_content_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
}
-/**
- * Sets the cursor position in the entry to the given value
- *
- * @param obj The entry object
- * @param pos The position of the cursor
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_cursor_pos_set(Evas_Object *obj, int pos)
{
edje_object_message_signal_process(wd->ent);
}
-/**
- * Retrieves the current position of the cursor in the entry
- *
- * @param obj The entry object
- * @return The cursor position
- *
- * @ingroup Entry
- */
EAPI int
elm_entry_cursor_pos_get(const Evas_Object *obj)
{
return edje_object_part_text_cursor_pos_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
}
-/**
- * This executes a "cut" action on the selected text in the entry.
- *
- * @param obj The entry object
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_selection_cut(Evas_Object *obj)
{
_cut(obj, NULL, NULL);
}
-/**
- * This executes a "copy" action on the selected text in the entry.
- *
- * @param obj The entry object
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_selection_copy(Evas_Object *obj)
{
_copy(obj, NULL, NULL);
}
-/**
- * This executes a "paste" action in the entry.
- *
- * @param obj The entry object
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_selection_paste(Evas_Object *obj)
{
_paste(obj, NULL, NULL);
}
-/**
- * This clears and frees the items in a entry's contextual (right click) menu.
- *
- * @param obj The entry object
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_context_menu_clear(Evas_Object *obj)
{
}
}
-/**
- * This adds an item to the entry's contextual menu.
- *
- * @param obj The entry object
- * @param label The item's text label
- * @param icon_file The item's icon file
- * @param icon_type The item's icon type
- * @param func The callback to execute when the item is clicked
- * @param data The data to associate with the item for related functions
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_context_menu_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data)
{
it->data = (void *)data;
}
-/**
- * This disables the entry's contextual (right click) menu.
- *
- * @param obj The entry object
- * @param disabled If true, the menu is disabled
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_context_menu_disabled_set(Evas_Object *obj, Eina_Bool disabled)
{
wd->context_menu = !disabled;
}
-/**
- * This returns whether the entry's contextual (right click) menu is disabled.
- *
- * @param obj The entry object
- * @return If true, the menu is disabled
- *
- * @ingroup Entry
- */
EAPI Eina_Bool
elm_entry_context_menu_disabled_get(const Evas_Object *obj)
{
return !wd->context_menu;
}
-/**
- * This appends a custom item provider to the list for that entry
- *
- * This appends the given callback. The list is walked from beginning to end
- * with each function called given the item href string in the text. If the
- * function returns an object handle other than NULL (it should create an
- * and object to do this), then this object is used to replace that item. If
- * not the next provider is called until one provides an item object, or the
- * default provider in entry does.
- *
- * @param obj The entry object
- * @param func The function called to provide the item object
- * @param data The data passed to @p func
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_item_provider_append(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
{
wd->item_providers = eina_list_append(wd->item_providers, ip);
}
-/**
- * This prepends a custom item provider to the list for that entry
- *
- * This prepends the given callback. See elm_entry_item_provider_append() for
- * more information
- *
- * @param obj The entry object
- * @param func The function called to provide the item object
- * @param data The data passed to @p func
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_item_provider_prepend(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
{
wd->item_providers = eina_list_prepend(wd->item_providers, ip);
}
-/**
- * This removes a custom item provider to the list for that entry
- *
- * This removes the given callback. See elm_entry_item_provider_append() for
- * more information
- *
- * @param obj The entry object
- * @param func The function called to provide the item object
- * @param data The data passed to @p func
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
{
}
}
-/**
- * Append a filter function for text inserted in the entry
- *
- * Append the given callback to the list. This functions will be called
- * whenever any text is inserted into the entry, with the text to be inserted
- * as a parameter. The callback function is free to alter the text in any way
- * it wants, but it must remember to free the given pointer and update it.
- * If the new text is to be discarded, the function can free it and set it text
- * parameter to NULL. This will also prevent any following filters from being
- * called.
- *
- * @param obj The entry object
- * @param func The function to use as text filter
- * @param data User data to pass to @p func
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_text_filter_append(Evas_Object *obj, void (*func) (void *data, Evas_Object *entry, char **text), void *data)
{
wd->text_filters = eina_list_append(wd->text_filters, tf);
}
-/**
- * Prepend a filter function for text insdrted in the entry
- *
- * Prepend the given callback to the list. See elm_entry_text_filter_append()
- * for more information
- *
- * @param obj The entry object
- * @param func The function to use as text filter
- * @param data User data to pass to @p func
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_text_filter_prepend(Evas_Object *obj, void (*func) (void *data, Evas_Object *entry, char **text), void *data)
{
wd->text_filters = eina_list_prepend(wd->text_filters, tf);
}
-/**
- * Remove a filter from the list
- *
- * Removes the given callback from the filter list. See elm_entry_text_filter_append()
- * for more information.
- *
- * @param obj The entry object
- * @param func The filter function to remove
- * @param data The user data passed when adding the function
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_text_filter_remove(Evas_Object *obj, void (*func) (void *data, Evas_Object *entry, char **text), void *data)
{
}
}
-/**
- * This converts a markup (HTML-like) string into UTF-8.
- * Returning string is obtained with malloc.
- * After use the returned string, it should be freed.
- *
- * @param s The string (in markup) to be converted
- * @return The converted string (in UTF-8). It should be freed.
- *
- * @ingroup Entry
- */
EAPI char *
elm_entry_markup_to_utf8(const char *s)
{
return ss;
}
-/**
- * This converts a UTF-8 string into markup (HTML-like).
- * Returning string is obtained with malloc.
- * After use the returned string, it should be freed.
- *
- * @param s The string (in UTF-8) to be converted
- * @return The converted string (in markup). It should be freed.
- *
- * @ingroup Entry
- */
EAPI char *
elm_entry_utf8_to_markup(const char *s)
{
return ss;
}
-/**
- * Get the input method context in the entry widget
- *
- * @param obj The entry object
- * @return The input method context
- *
- * @ingroup Entry
- */
-EAPI Ecore_IMF_Context *elm_entry_imf_context_get(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd || !wd->ent) return NULL;
-
- return edje_object_part_text_imf_context_get(wd->ent, "elm.text");
-}
-
-/**
- * Set whether entry should enable the return key on soft keyboard automatically
- *
- * @param obj The entry object
- * @param on If true, entry enables the return key on soft keyboard automatically.
- *
- * @ingroup Entry
- */
-EAPI void
-elm_entry_autoenable_returnkey_set(Evas_Object *obj, Eina_Bool on)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- wd->autoreturnkey = on;
- _check_enable_returnkey(obj);
-}
-
-/**
- * Set whether entry should support auto capitalization
- *
- * @param obj The entry object
- * @param on If true, entry suports auto capitalization.
- *
- * @ingroup Entry
- */
-EAPI void
-elm_entry_autocapitalization_set(Evas_Object *obj, Eina_Bool autocap)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- if (wd->password)
- wd->autocapital = EINA_FALSE;
- else
- wd->autocapital = autocap;
-
- if (wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_URL ||
- wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_EMAIL)
- wd->autocapital = EINA_FALSE;
-
- edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", wd->autocapital);
-}
-
-/**
- * Set whether entry should support auto period
- *
- * @param obj The entry object
- * @param on If true, entry suports auto period.
- *
- * @ingroup Entry
- */
-EAPI void
-elm_entry_autoperiod_set(Evas_Object *obj, Eina_Bool autoperiod)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- if (wd->password)
- wd->autoperiod = EINA_FALSE;
- else
- wd->autoperiod = autoperiod;
-
- if (wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_URL ||
- wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_EMAIL)
- wd->autoperiod = EINA_FALSE;
-
- edje_object_part_text_autoperiod_set(wd->ent, "elm.text", wd->autoperiod);
-}
-
-/**
- * Set the font size on the entry object
- *
- * @param obj The entry object
- * @param size font size
- *
- * @ingroup Entry
- */
-EAPI void
-elm_entry_fontsize_set(Evas_Object *obj, int fontsize)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- Eina_Strbuf *fontbuf = NULL;
- int removeflag = 0;
- const char *t;
-
- if (!wd) return;
- t = eina_stringshare_add(elm_entry_entry_get(obj));
- fontbuf = eina_strbuf_new();
- eina_strbuf_append_printf(fontbuf, "%d", fontsize);
-
- if (fontsize == 0) removeflag = 1; // remove fontsize tag
-
- if (_stringshare_key_value_replace(&t, "font_size", eina_strbuf_string_get(fontbuf), removeflag) == 0)
- {
- elm_entry_entry_set(obj, t);
- wd->changed = 1;
- _sizing_eval(obj);
- }
- eina_strbuf_free(fontbuf);
- eina_stringshare_del(t);
-}
-
-/**
- * Set the text align on the entry object
- *
- * @param obj The entry object
- * @param align align mode
- *
- * @ingroup Entry
- */
-EAPI void
-elm_entry_text_align_set(Evas_Object *obj, const char *alignmode)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- int len;
- const char *t;
-
- if (!wd) return;
- t = eina_stringshare_add(elm_entry_entry_get(obj));
- len = strlen(t);
- if (len <= 0) return;
-
- if (_stringshare_key_value_replace(&t, "align", alignmode, 0) == 0)
- elm_entry_entry_set(obj, t);
-
- wd->changed = 1;
- _sizing_eval(obj);
- eina_stringshare_del(t);
-}
-
-/**
- * Set the text color on the entry object
- *
- * @param obj The entry object
- * @param r Red property background color of The entry object
- * @param g Green property background color of The entry object
- * @param b Blue property background color of The entry object
- * @param a Alpha property background alpha of The entry object
- *
- * @ingroup Entry
- */
-EAPI void
-elm_entry_text_color_set(Evas_Object *obj, unsigned int r, unsigned int g, unsigned int b, unsigned int a)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- Eina_Strbuf *colorbuf = NULL;
- const char *t;
- int len;
-
- if (!wd) return;
- t = eina_stringshare_add(elm_entry_entry_get(obj));
- len = strlen(t);
- if (len <= 0) return;
- colorbuf = eina_strbuf_new();
- eina_strbuf_append_printf(colorbuf, "#%02X%02X%02X%02X", r, g, b, a);
-
- if (_stringshare_key_value_replace(&t, "color", eina_strbuf_string_get(colorbuf), 0) == 0)
- {
- elm_entry_entry_set(obj, t);
- wd->changed = 1;
- _sizing_eval(obj);
- }
- eina_strbuf_free(colorbuf);
- eina_stringshare_del(t);
-}
-
-/**
- * Set background color of the entry
- *
- * @param obj The entry object
- * @param r Red property background color of The entry object
- * @param g Green property background color of The entry object
- * @param b Blue property background color of The entry object
- * @param a Alpha property background alpha of The entry object
- * @ingroup Entry
- */
-EAPI void
-elm_entry_background_color_set(Evas_Object *obj, unsigned int r, unsigned int g, unsigned int b, unsigned int a)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- evas_object_color_set(wd->bg, r, g, b, a);
-
- if (wd->bgcolor == EINA_FALSE)
- {
- wd->bgcolor = 1;
- edje_object_part_swallow(wd->ent, "entry.swallow.background", wd->bg);
- }
-}
-
-/**
- * Filter inserted text based on user defined character and byte limits
- *
- * Add this filter to an entry to limit the characters that it will accept
- * based the the contents of the provided Elm_Entry_Filter_Limit_Size.
- * The funtion works on the UTF-8 representation of the string, converting
- * it from the set markup, thus not accounting for any format in it.
- *
- * The user must create an Elm_Entry_Filter_Limit_Size structure and pass
- * it as data when setting the filter. In it it's possible to set limits
- * by character count or bytes (any of them is disabled if 0), and both can
- * be set at the same time. In that case, it first checks for characters,
- * then bytes.
- *
- * The function will cut the inserted text in order to allow only the first
- * number of characters that are still allowed. The cut is made in
- * characters, even when limiting by bytes, in order to always contain
- * valid ones and avoid half unicode characters making it in.
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_filter_limit_size(void *data, Evas_Object *entry, char **text)
{
free(current);
}
-/**
- * Filter inserted text based on accepted or rejected sets of characters
- *
- * Add this filter to an entry to restrict the set of accepted characters
- * based on the sets in the provided Elm_Entry_Filter_Accept_Set.
- * This structure contains both accepted and rejected sets, but they are
- * mutually exclusive. If accepted is set, it will be used, otherwise it
- * goes on to the rejected set.
- */
EAPI void
elm_entry_filter_accept_set(void *data, Evas_Object *entry __UNUSED__, char **text)
{
*insert = 0;
}
-/**
- * This sets the file (and implicitly loads it) for the text to display and
- * then edit. All changes are written back to the file after a short delay if
- * the entry object is set to autosave.
- *
- * @param obj The entry object
- * @param file The path to the file to load and save
- * @param format The file format
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format)
{
_load(obj);
}
-/**
- * Gets the file to load and save and the file format
- *
- * @param obj The entry object
- * @param file The path to the file to load and save
- * @param format The file format
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_file_get(const Evas_Object *obj, const char **file, Elm_Text_Format *format)
{
if (format) *format = wd->format;
}
-/**
- * This function writes any changes made to the file set with
- * elm_entry_file_set()
- *
- * @param obj The entry object
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_file_save(Evas_Object *obj)
{
wd->delay_write = ecore_timer_add(2.0, _delay_write, obj);
}
-/**
- * This sets the entry object to 'autosave' the loaded text file or not.
- *
- * @param obj The entry object
- * @param autosave Autosave the loaded file or not
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_autosave_set(Evas_Object *obj, Eina_Bool autosave)
{
wd->autosave = !!autosave;
}
-/**
- * This gets the entry object's 'autosave' status.
- *
- * @param obj The entry object
- * @return Autosave the loaded file or not
- *
- * @ingroup Entry
- */
EAPI Eina_Bool
elm_entry_autosave_get(const Evas_Object *obj)
{
return wd->autosave;
}
-/**
- * Control pasting of text and images for the widget.
- *
- * Normally the entry allows both text and images to be pasted. By setting
- * textonly to be true, this prevents images from being pasted.
- *
- * Note this only changes the behaviour of text.
- *
- * @param obj The entry object
- * @param textonly paste mode - EINA_TRUE is text only, EINA_FALSE is text+image+other.
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_cnp_textonly_set(Evas_Object *obj, Eina_Bool textonly)
{
#endif
}
-/**
- * Getting elm_entry text paste/drop mode.
- *
- * In textonly mode, only text may be pasted or dropped into the widget.
- *
- * @param obj The entry object
- * @return If the widget only accepts text from pastes.
- *
- * @ingroup Entry
- */
EAPI Eina_Bool
elm_entry_cnp_textonly_get(const Evas_Object *obj)
{
return wd->textonly;
}
-/**
- * Enable or disable scrolling in entry
- *
- * Normally the entry is not scrollable unless you enable it with this call.
- *
- * @param obj The entry object
- * @param scroll EINA_TRUE if it is to be scrollable, EINA_FALSE otherwise
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_scrollable_set(Evas_Object *obj, Eina_Bool scroll)
{
_theme_hook(obj);
}
-/**
- * Get the scrollable state of the entry
- *
- * Normally the entry is not scrollable. This gets the scrollable state
- * of the entry. See elm_entry_scrollable_set() for more information.
- *
- * @param obj The entry object
- * @return The scrollable state
- *
- * @ingroup Entry
- */
EAPI Eina_Bool
elm_entry_scrollable_get(const Evas_Object *obj)
{
return wd->scroll;
}
-/**
- * This sets a widget to be displayed to the left of a scrolled entry.
- *
- * @param obj The scrolled entry object
- * @param icon The widget to display on the left side of the scrolled
- * entry.
- *
- * @note A previously set widget will be destroyed.
- * @note If the object being set does not have minimum size hints set,
- * it won't get properly displayed.
- *
- * @ingroup Entry
- * @see elm_entry_end_set
- */
EAPI void
elm_entry_icon_set(Evas_Object *obj, Evas_Object *icon)
{
_sizing_eval(obj);
}
-/**
- * Gets the leftmost widget of the scrolled entry. This object is
- * owned by the scrolled entry and should not be modified.
- *
- * @param obj The scrolled entry object
- * @return the left widget inside the scroller
- *
- * @ingroup Entry
- */
EAPI Evas_Object *
elm_entry_icon_get(const Evas_Object *obj)
{
return wd->icon;
}
-/**
- * Unset the leftmost widget of the scrolled entry, unparenting and
- * returning it.
- *
- * @param obj The scrolled entry object
- * @return the previously set icon sub-object of this entry, on
- * success.
- *
- * @see elm_entry_icon_set()
- *
- * @ingroup Entry
- */
EAPI Evas_Object *
elm_entry_icon_unset(Evas_Object *obj)
{
return ret;
}
-/**
- * Sets the visibility of the left-side widget of the scrolled entry,
- * set by @elm_entry_icon_set().
- *
- * @param obj The scrolled entry object
- * @param setting EINA_TRUE if the object should be displayed,
- * EINA_FALSE if not.
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_icon_visible_set(Evas_Object *obj, Eina_Bool setting)
{
_sizing_eval(obj);
}
-/**
- * This sets a widget to be displayed to the end of a scrolled entry.
- *
- * @param obj The scrolled entry object
- * @param end The widget to display on the right side of the scrolled
- * entry.
- *
- * @note A previously set widget will be destroyed.
- * @note If the object being set does not have minimum size hints set,
- * it won't get properly displayed.
- *
- * @ingroup Entry
- * @see elm_entry_icon_set
- */
EAPI void
elm_entry_end_set(Evas_Object *obj, Evas_Object *end)
{
_sizing_eval(obj);
}
-/**
- * Gets the endmost widget of the scrolled entry. This object is owned
- * by the scrolled entry and should not be modified.
- *
- * @param obj The scrolled entry object
- * @return the right widget inside the scroller
- *
- * @ingroup Entry
- */
EAPI Evas_Object *
elm_entry_end_get(const Evas_Object *obj)
{
return wd->end;
}
-/**
- * Unset the endmost widget of the scrolled entry, unparenting and
- * returning it.
- *
- * @param obj The scrolled entry object
- * @return the previously set icon sub-object of this entry, on
- * success.
- *
- * @see elm_entry_icon_set()
- *
- * @ingroup Entry
- */
EAPI Evas_Object *
elm_entry_end_unset(Evas_Object *obj)
{
return ret;
}
-/**
- * Sets the visibility of the end widget of the scrolled entry, set by
- * @elm_entry_end_set().
- *
- * @param obj The scrolled entry object
- * @param setting EINA_TRUE if the object should be displayed,
- * EINA_FALSE if not.
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_end_visible_set(Evas_Object *obj, Eina_Bool setting)
{
_sizing_eval(obj);
}
-/**
- * This sets the scrolled entry's scrollbar policy (ie. enabling/disabling them).
- *
- * @param obj The scrolled entry object
- * @param h The horizontal scrollbar policy to apply
- * @param v The vertical scrollbar policy to apply
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_scrollbar_policy_set(Evas_Object *obj, Elm_Scroller_Policy h, Elm_Scroller_Policy v)
{
map[wd->policy_v]);
}
-/**
- * This enables/disables bouncing within the entry.
- *
- * @param obj The scrolled entry object
- * @param h The horizontal bounce state
- * @param v The vertical bounce state
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
{
elm_smart_scroller_bounce_allow_set(wd->scroller, h_bounce, v_bounce);
}
-/**
- * Get the bounce mode
- *
- * @param obj The Entry object
- * @param h_bounce Allow bounce horizontally
- * @param v_bounce Allow bounce vertically
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
{
elm_smart_scroller_bounce_allow_get(wd->scroller, h_bounce, v_bounce);
}
-/**
- * This sets the attribute to show the input panel automatically.
- *
- * @param obj The entry object
- * @param enabled If true, the input panel is appeared when entry is clicked or has a focus
- *
- * @ingroup Entry
- */
+EAPI void
+elm_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ wd->input_panel_layout = layout;
+
+ edje_object_part_text_input_panel_layout_set(wd->ent, "elm.text", layout);
+}
+
+EAPI Elm_Input_Panel_Layout
+elm_entry_input_panel_layout_get(Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) ELM_INPUT_PANEL_LAYOUT_INVALID;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return ELM_INPUT_PANEL_LAYOUT_INVALID;
+
+ return wd->input_panel_layout;
+}
+
+EAPI void
+elm_entry_autocapital_type_set(Evas_Object *obj, Elm_Autocapital_Type autocapital_type)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ wd->autocapital_type = autocapital_type;
+ edje_object_part_text_autocapital_type_set(wd->ent, "elm.text", autocapital_type);
+}
+
+EAPI Elm_Autocapital_Type
+elm_entry_autocapital_type_get(Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) ELM_AUTOCAPITAL_TYPE_NONE;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return ELM_AUTOCAPITAL_TYPE_NONE;
+
+ return wd->autocapital_type;
+}
+
EAPI void
elm_entry_input_panel_enabled_set(Evas_Object *obj, Eina_Bool enabled)
{
edje_object_part_text_input_panel_enabled_set(wd->ent, "elm.text", enabled);
}
-/**
- * Set the input panel layout of the entry
- *
- * @param obj The entry object
- * @param layout the layout to set
- *
- * @ingroup Entry
- */
+EINA_DEPRECATED EAPI void
+elm_entry_line_char_wrap_set(Evas_Object *obj, Eina_Bool wrap)
+{
+ if (wrap) elm_entry_line_wrap_set(obj, ELM_WRAP_CHAR);
+}
+
EAPI void
-elm_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout)
+elm_entry_background_color_set(Evas_Object *obj, unsigned int r, unsigned int g, unsigned int b, unsigned int a)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ evas_object_color_set(wd->bg, r, g, b, a);
+
+ if (wd->bgcolor == EINA_FALSE)
+ {
+ wd->bgcolor = 1;
+ edje_object_part_swallow(wd->ent, "entry.swallow.background", wd->bg);
+ }
+}
+
+EAPI void
+elm_entry_autocapitalization_set(Evas_Object *obj, Eina_Bool autocap)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- Ecore_IMF_Context *ic = elm_entry_imf_context_get(obj);
- if (!ic) return;
+ if (autocap)
+ wd->autocapital_type = ELM_AUTOCAPITAL_TYPE_SENTENCE;
+ else
+ wd->autocapital_type = ELM_AUTOCAPITAL_TYPE_NONE;
- wd->input_panel_layout = layout;
+ if (wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_URL ||
+ wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_EMAIL)
+ wd->autocapital_type = ELM_AUTOCAPITAL_TYPE_NONE;
+
+ edje_object_part_text_autocapital_type_set(wd->ent, "elm.text", wd->autocapital_type);
+}
+
+EAPI void
+elm_entry_autoperiod_set(Evas_Object *obj, Eina_Bool autoperiod)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ if (wd->password)
+ wd->autoperiod = EINA_FALSE;
+ else
+ wd->autoperiod = autoperiod;
+
+ if (wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_URL ||
+ wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_EMAIL)
+ wd->autoperiod = EINA_FALSE;
+
+ edje_object_part_text_autoperiod_set(wd->ent, "elm.text", wd->autoperiod);
+}
+
+EAPI void
+elm_entry_autoenable_returnkey_set(Evas_Object *obj, Eina_Bool on)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ wd->autoreturnkey = on;
+ _check_enable_returnkey(obj);
+}
+
+EAPI Ecore_IMF_Context *elm_entry_imf_context_get(Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd || !wd->ent) return NULL;
+
+ return edje_object_part_text_imf_context_get(wd->ent, "elm.text");
+}
+
+EAPI void
+elm_entry_matchlist_set(Evas_Object *obj, Eina_List *match_list, Eina_Bool case_sensitive)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ if (match_list)
+ {
+ Evas_Coord max_w = 9999, max_h = 9999;
+ const char* key_data = NULL;
+
+ wd->matchlist_threshold = 1;
+ wd->hover = elm_hover_add(elm_widget_parent_get(obj));
+ elm_hover_parent_set(wd->hover, elm_widget_parent_get(obj));
+ elm_hover_target_set(wd->hover, obj);
+ elm_object_style_set(wd->hover, "matchlist");
+
+ wd->layout = elm_layout_add(wd->hover);
+ elm_layout_theme_set(wd->layout, "entry", "matchlist", "default");
+ wd->list = elm_list_add(wd->layout);
+ evas_object_size_hint_weight_set(wd->list, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(wd->list, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_list_mode_set(wd->list, ELM_LIST_EXPAND);
+ elm_object_style_set(wd->list, "matchlist");
+
+ key_data = edje_object_data_get(elm_layout_edje_get(wd->layout), "max_width");
+ if (key_data) max_w = atoi(key_data);
+ key_data = edje_object_data_get(elm_layout_edje_get(wd->layout), "max_height");
+ if (key_data) max_h = atoi(key_data);
+
+ elm_list_go(wd->list);
+ evas_object_size_hint_max_set(wd->list, max_w, max_h);
+ evas_object_smart_callback_add(wd->list, "selected", _matchlist_list_clicked, obj);
+ elm_layout_content_set(wd->layout, "elm.swallow.content", wd->list);
+ elm_hover_content_set(wd->hover, "bottom", wd->layout);
+
+ wd->match_list = match_list;
+ }
+ else
+ {
+ if (wd->hover)
+ evas_object_del(wd->hover);
- ecore_imf_context_input_panel_layout_set(ic, (Ecore_IMF_Input_Panel_Layout)layout);
+ wd->match_list = NULL;
+ }
+
+ wd->matchlist_case_sensitive = case_sensitive;
}
-/**
- * Set the magnifier style of the entry
- *
- * @param obj The entry object
- * @param type the magnifier style to set
- *
- * @ingroup Entry
- */
EAPI void
elm_entry_magnifier_type_set(Evas_Object *obj, int type)
{
_magnifier_create(obj);
}
-EINA_DEPRECATED EAPI void
-elm_entry_line_char_wrap_set(Evas_Object *obj, Eina_Bool wrap)
+EAPI void
+elm_entry_wrap_width_set(Evas_Object *obj, Evas_Coord w)
{
- if (wrap) elm_entry_line_wrap_set(obj, ELM_WRAP_CHAR);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->wrap_w == w) return;
+ wd->wrap_w = w;
+ _sizing_eval(obj);
+}
+
+EAPI Evas_Coord
+elm_entry_wrap_width_get(const Evas_Object *obj)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return 0;
+ return wd->wrap_w;
+}
+
+EAPI void
+elm_entry_fontsize_set(Evas_Object *obj, int fontsize)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Eina_Strbuf *fontbuf = NULL;
+ int removeflag = 0;
+ const char *t;
+
+ if (!wd) return;
+ t = eina_stringshare_add(elm_entry_entry_get(obj));
+ fontbuf = eina_strbuf_new();
+ eina_strbuf_append_printf(fontbuf, "%d", fontsize);
+
+ if (fontsize == 0) removeflag = 1; // remove fontsize tag
+
+ if (_stringshare_key_value_replace(&t, "font_size", eina_strbuf_string_get(fontbuf), removeflag) == 0)
+ {
+ elm_entry_entry_set(obj, t);
+ wd->changed = 1;
+ _sizing_eval(obj);
+ }
+ eina_strbuf_free(fontbuf);
+ eina_stringshare_del(t);
+}
+
+EAPI void
+elm_entry_text_color_set(Evas_Object *obj, unsigned int r, unsigned int g, unsigned int b, unsigned int a)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Eina_Strbuf *colorbuf = NULL;
+ const char *t;
+ int len;
+
+ if (!wd) return;
+ t = eina_stringshare_add(elm_entry_entry_get(obj));
+ len = strlen(t);
+ if (len <= 0) return;
+ colorbuf = eina_strbuf_new();
+ eina_strbuf_append_printf(colorbuf, "#%02X%02X%02X%02X", r, g, b, a);
+
+ if (_stringshare_key_value_replace(&t, "color", eina_strbuf_string_get(colorbuf), 0) == 0)
+ {
+ elm_entry_entry_set(obj, t);
+ wd->changed = 1;
+ _sizing_eval(obj);
+ }
+ eina_strbuf_free(colorbuf);
+ eina_stringshare_del(t);
+}
+
+EAPI void
+elm_entry_text_align_set(Evas_Object *obj, const char *alignmode)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ int len;
+ const char *t;
+
+ if (!wd) return;
+ t = eina_stringshare_add(elm_entry_entry_get(obj));
+ len = strlen(t);
+ if (len <= 0) return;
+
+ if (_stringshare_key_value_replace(&t, "align", alignmode, 0) == 0)
+ elm_entry_entry_set(obj, t);
+
+ wd->changed = 1;
+ _sizing_eval(obj);
+ eina_stringshare_del(t);
}