[TC-editifield, entry] fix fails
[framework/uifw/elementary.git] / src / lib / elm_entry.c
index 335bf67..0e114ea 100644 (file)
@@ -125,7 +125,6 @@ struct _Widget_Data
    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;
@@ -135,6 +134,7 @@ struct _Widget_Data
    /* 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;
@@ -146,11 +146,13 @@ struct _Widget_Data
    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;
    Eina_Bool changed : 1;
    Eina_Bool single_line : 1;
    Eina_Bool password : 1;
@@ -174,11 +176,9 @@ struct _Widget_Data
    Eina_Bool autoreturnkey : 1;
    Eina_Bool input_panel_enable : 1;
    Eina_Bool autocapital : 1;
-   Elm_Input_Panel_Layout input_panel_layout;
    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
@@ -589,6 +589,7 @@ _del_hook(Evas_Object *obj)
 #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)
@@ -599,7 +600,6 @@ _del_hook(Evas_Object *obj)
         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);
@@ -919,7 +919,6 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
    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);
@@ -928,7 +927,7 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
         if (top) 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
      {
@@ -1157,12 +1156,47 @@ _store_selection(Elm_Sel_Type seltype, Evas_Object *obj)
 {
    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
@@ -1187,15 +1221,13 @@ _copy(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
    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
@@ -1475,19 +1507,13 @@ _magnifier_create(void *data)
 }
 
 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);
@@ -1495,7 +1521,6 @@ _long_press(void *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;
 }
@@ -1511,11 +1536,6 @@ _mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void
    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
@@ -1530,25 +1550,13 @@ _mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *
         if (!wd->double_clicked)
           {
              if ((wd->api) && (wd->api->obj_mouseup))
-               {
-                  wd->api->obj_mouseup(data);
-               }
+               wd->api->obj_mouseup(data);
           }
-
-        if (wd->longpress_timer)
-          {
-             ecore_timer_del(wd->longpress_timer);
-             wd->longpress_timer = NULL;
-          }
-
         _magnifier_hide(data);
         elm_object_scroll_freeze_pop(data);
 
         if (wd->long_pressed)
-          {
-             _menu_press(data);
-          }
-
+          _menu_press(data);
      }
    else if (ev->button == 3)
      {
@@ -1564,49 +1572,6 @@ _mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void
    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)
      {
@@ -1689,6 +1654,27 @@ _entry_length_get(Evas_Object *obj)
    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)
 {
@@ -1733,7 +1719,11 @@ _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)
                {
@@ -1800,55 +1790,6 @@ static void _matchlist_list_clicked( void *data, Evas_Object *obj, void *event_i
    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)
 {
@@ -1873,6 +1814,8 @@ _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)
@@ -1882,10 +1825,10 @@ _entry_changed_common_handling(void *data, const char *event)
      }
 
    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->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);
 }
@@ -1893,26 +1836,37 @@ _entry_changed_common_handling(void *data, const char *event)
 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);
+
+   if ((wd->api) && (wd->api->obj_hidemenu))
+     wd->api->obj_hidemenu(data);
 }
 
 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);
-}
 
+   if ((wd->api) && (wd->api->obj_hidemenu))
+     wd->api->obj_hidemenu(data);
+}
 
 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);
@@ -1923,6 +1877,8 @@ static void
 _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)
@@ -1939,6 +1895,39 @@ _signal_handler_moving(void *data, Evas_Object *obj __UNUSED__, const char *emis
    _magnifier_show(data);
 }
 
+static Evas_Object *
+_viewport_obj_get(Evas_Object *data)
+{
+   Widget_Data *wd = elm_widget_data_get(data);
+   if (!wd) return NULL;
+
+   if(!data || !strlen(elm_widget_type_get(data)))
+     return NULL;
+
+   Evas_Coord x, y, w, h;
+   x = y = w = h = -1;
+
+   if (wd->scroll)
+     {
+        //evas_object_geometry_get(wd->scroller, &x, &y, &w, &h);
+        //printf(">>> wd->scroller (%d, %d, %d, %d) \n", x, y, w, h);
+        return wd->scroller;
+     }
+
+   Evas_Object *parent_obj = data;
+
+   while(parent_obj = elm_widget_parent_get(parent_obj))
+     {
+        //evas_object_geometry_get(parent_obj, &x, &y, &w, &h);
+        //printf(">>> %s (%d, %d, %d, %d) \n", elm_widget_type_get(parent_obj), x, y, w, h);
+        if (!strcmp(elm_widget_type_get(parent_obj), "scroller") ||
+            !strcmp(elm_widget_type_get(parent_obj), "genlist"))
+          return parent_obj;
+     }
+
+   return NULL;
+}
+
 static void
 _signal_selection_end(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
 {
@@ -1971,6 +1960,9 @@ _signal_selection_start(void *data, Evas_Object *obj __UNUSED__, const char *emi
           elm_selection_set(ELM_SEL_PRIMARY, data, ELM_SEL_FORMAT_MARKUP, txt);
      }
 #endif
+
+   if (!_elm_config->desktop_entry)
+     edje_object_part_text_viewport_object_set(wd->ent, "elm.text", _viewport_obj_get(data));
 }
 
 static void
@@ -2221,9 +2213,7 @@ _signal_mouse_down(void *data, Evas_Object *obj __UNUSED__, const char *emission
    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
@@ -2232,6 +2222,9 @@ _signal_mouse_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emiss
    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
@@ -2534,16 +2527,51 @@ _text_append_idler(void *data)
    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
      {
@@ -2651,6 +2679,8 @@ _elm_entry_text_set(Evas_Object *obj, const char *item, const char *entry)
    if (!entry) entry = "";
    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 */
@@ -2693,12 +2723,13 @@ _elm_entry_text_get(const Evas_Object *obj, const char *item)
    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)
@@ -2707,7 +2738,17 @@ _elm_entry_text_get(const Evas_Object *obj, const char *item)
         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;
 }
 
@@ -2794,6 +2835,8 @@ elm_entry_add(Evas_Object *parent)
                                    _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",
@@ -2878,8 +2921,8 @@ EAPI void elm_entry_extension_module_data_get(Evas_Object *obj,Elm_Entry_Extensi
    ext_mod->select = _select;
    ext_mod->selectall = _selectall;
    ext_mod->ent = wd->ent;
+   ext_mod->viewport_obj = _viewport_obj_get(obj);
    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;
@@ -3182,36 +3225,6 @@ elm_entry_line_wrap_set(Evas_Object *obj, Elm_Wrap_Type wrap)
 }
 
 /**
- * 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().
  *
@@ -3966,252 +3979,38 @@ elm_entry_utf8_to_markup(const char *s)
 }
 
 /**
- * Get the input method context in the entry widget
+ * Filter inserted text based on user defined character and byte limits
  *
- * @param obj The entry object
- * @return The input method context
+ * 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.
  *
- * @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
+ * 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.
  *
- * @param obj The entry object
- * @param on If true, entry enables the return key on soft keyboard automatically.
+ * 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_autoenable_returnkey_set(Evas_Object *obj, Eina_Bool on)
+elm_entry_filter_limit_size(void *data, Evas_Object *entry, char **text)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype);
-   Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd) return;
+   Elm_Entry_Filter_Limit_Size *lim = data;
+   char *current;
+   int len, newlen;
+   const char *(*text_get)(const Evas_Object *);
+   const char *widget_type;
 
-   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)
-{
-   Elm_Entry_Filter_Limit_Size *lim = data;
-   char *current;
-   int len, newlen;
-   const char *(*text_get)(const Evas_Object *);
-   const char *widget_type;
-
-   EINA_SAFETY_ON_NULL_RETURN(data);
-   EINA_SAFETY_ON_NULL_RETURN(entry);
-   EINA_SAFETY_ON_NULL_RETURN(text);
+   EINA_SAFETY_ON_NULL_RETURN(data);
+   EINA_SAFETY_ON_NULL_RETURN(entry);
+   EINA_SAFETY_ON_NULL_RETURN(text);
 
    /* hack. I don't want to copy the entire function to work with
     * scrolled_entry */
@@ -4830,6 +4629,109 @@ elm_entry_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_b
    elm_smart_scroller_bounce_allow_get(wd->scroller, h_bounce, v_bounce);
 }
 
+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);
+}
+
+/**
+ * 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);
+     }
+}
+
+/**
+ * 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 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);
+}
+
 /**
  * This sets the attribute to show the input panel automatically.
  *
@@ -4873,6 +4775,72 @@ elm_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout
 }
 
 /**
+ * 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");
+}
+
+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;
+}
+
+/**
  * Set the magnifier style of the entry
  *
  * @param obj The entry object
@@ -4891,8 +4859,134 @@ 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)
+/**
+ * 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)
 {
-   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);
+}
+
+/**
+ * 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);
+   if (!wd) return;
+   return wd->wrap_w;
+}
+
+/**
+ * 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 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 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);
 }