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)
{
}
/**
- * 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().
*
}
/**
- * 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);
+ 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 */
+ widget_type = elm_widget_type_get(entry);
+ if (!strcmp(widget_type, "entry"))
+ text_get = elm_entry_entry_get;
+ else /* huh? */
+ return;
+
+ current = elm_entry_markup_to_utf8(text_get(entry));
+
+ if (lim->max_char_count > 0)
+ {
+ len = evas_string_char_len_get(current);
+ if (len >= lim->max_char_count)
+ {
+ evas_object_smart_callback_call(entry, "maxlength,reached", NULL);
+ free(*text);
+ free(current);
+ *text = NULL;
+ return;
+ }
+ newlen = evas_string_char_len_get(elm_entry_markup_to_utf8(*text));
+ if ((len + newlen) > lim->max_char_count)
+ _add_chars_till_limit(entry, text, (lim->max_char_count - len), LENGTH_UNIT_CHAR);
+ }
+ else if (lim->max_byte_count > 0)
+ {
+ len = strlen(current);
+ if (len >= lim->max_byte_count)
+ {
+ evas_object_smart_callback_call(entry, "maxlength,reached", NULL);
+ free(*text);
+ free(current);
+ *text = NULL;
+ return;
+ }
+ newlen = strlen(elm_entry_markup_to_utf8(*text));
+ if ((len + newlen) > lim->max_byte_count)
+ _add_chars_till_limit(entry, text, (lim->max_byte_count - len), LENGTH_UNIT_BYTE);
+ }
+ free(current);
}
/**
- * Set whether entry should support auto capitalization
- *
- * @param obj The entry object
- * @param on If true, entry suports auto capitalization.
+ * Filter inserted text based on accepted or rejected sets of characters
*
- * @ingroup Entry
+ * 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_autocapitalization_set(Evas_Object *obj, Eina_Bool autocap)
+elm_entry_filter_accept_set(void *data, Evas_Object *entry __UNUSED__, char **text)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
+ Elm_Entry_Filter_Accept_Set *as = data;
+ const char *set;
+ char *insert;
+ Eina_Bool goes_in;
+ int read_idx, last_read_idx = 0, read_char;
- if (wd->password)
- wd->autocapital = EINA_FALSE;
+ EINA_SAFETY_ON_NULL_RETURN(data);
+ EINA_SAFETY_ON_NULL_RETURN(text);
+
+ if ((!as->accepted) && (!as->rejected))
+ return;
+
+ if (as->accepted)
+ {
+ set = as->accepted;
+ goes_in = EINA_TRUE;
+ }
else
- wd->autocapital = autocap;
+ {
+ set = as->rejected;
+ goes_in = EINA_FALSE;
+ }
- if (wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_URL ||
- wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_EMAIL)
- wd->autocapital = EINA_FALSE;
+ insert = *text;
+ read_idx = evas_string_char_next_get(*text, 0, &read_char);
+ while (read_char)
+ {
+ int cmp_idx, cmp_char;
+ Eina_Bool in_set = EINA_FALSE;
- edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", wd->autocapital);
+ cmp_idx = evas_string_char_next_get(set, 0, &cmp_char);
+ while (cmp_char)
+ {
+ if (read_char == cmp_char)
+ {
+ in_set = EINA_TRUE;
+ break;
+ }
+ cmp_idx = evas_string_char_next_get(set, cmp_idx, &cmp_char);
+ }
+ if (in_set == goes_in)
+ {
+ int size = read_idx - last_read_idx;
+ const char *src = (*text) + last_read_idx;
+ if (src != insert)
+ memcpy(insert, *text + last_read_idx, size);
+ insert += size;
+ }
+ last_read_idx = read_idx;
+ read_idx = evas_string_char_next_get(*text, read_idx, &read_char);
+ }
+ *insert = 0;
}
/**
- * Set whether entry should support auto period
+ * 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 on If true, entry suports auto period.
+ * @param file The path to the file to load and save
+ * @param format The file format
*
* @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);
-
- /* hack. I don't want to copy the entire function to work with
- * scrolled_entry */
- widget_type = elm_widget_type_get(entry);
- if (!strcmp(widget_type, "entry"))
- text_get = elm_entry_entry_get;
- else /* huh? */
- return;
-
- current = elm_entry_markup_to_utf8(text_get(entry));
-
- if (lim->max_char_count > 0)
- {
- len = evas_string_char_len_get(current);
- if (len >= lim->max_char_count)
- {
- evas_object_smart_callback_call(entry, "maxlength,reached", NULL);
- free(*text);
- free(current);
- *text = NULL;
- return;
- }
- newlen = evas_string_char_len_get(elm_entry_markup_to_utf8(*text));
- if ((len + newlen) > lim->max_char_count)
- _add_chars_till_limit(entry, text, (lim->max_char_count - len), LENGTH_UNIT_CHAR);
- }
- else if (lim->max_byte_count > 0)
- {
- len = strlen(current);
- if (len >= lim->max_byte_count)
- {
- evas_object_smart_callback_call(entry, "maxlength,reached", NULL);
- free(*text);
- free(current);
- *text = NULL;
- return;
- }
- newlen = strlen(elm_entry_markup_to_utf8(*text));
- if ((len + newlen) > lim->max_byte_count)
- _add_chars_till_limit(entry, text, (lim->max_byte_count - len), LENGTH_UNIT_BYTE);
- }
- 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)
-{
- Elm_Entry_Filter_Accept_Set *as = data;
- const char *set;
- char *insert;
- Eina_Bool goes_in;
- int read_idx, last_read_idx = 0, read_char;
-
- EINA_SAFETY_ON_NULL_RETURN(data);
- EINA_SAFETY_ON_NULL_RETURN(text);
-
- if ((!as->accepted) && (!as->rejected))
- return;
-
- if (as->accepted)
- {
- set = as->accepted;
- goes_in = EINA_TRUE;
- }
- else
- {
- set = as->rejected;
- goes_in = EINA_FALSE;
- }
-
- insert = *text;
- read_idx = evas_string_char_next_get(*text, 0, &read_char);
- while (read_char)
- {
- int cmp_idx, cmp_char;
- Eina_Bool in_set = EINA_FALSE;
-
- cmp_idx = evas_string_char_next_get(set, 0, &cmp_char);
- while (cmp_char)
- {
- if (read_char == cmp_char)
- {
- in_set = EINA_TRUE;
- break;
- }
- cmp_idx = evas_string_char_next_get(set, cmp_idx, &cmp_char);
- }
- if (in_set == goes_in)
- {
- int size = read_idx - last_read_idx;
- const char *src = (*text) + last_read_idx;
- if (src != insert)
- memcpy(insert, *text + last_read_idx, size);
- insert += size;
- }
- last_read_idx = read_idx;
- read_idx = evas_string_char_next_get(*text, read_idx, &read_char);
- }
- *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)
+elm_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(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
+ * @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)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return NULL;
+ 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)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ Evas_Object *ret = NULL;
+ if (!wd) return NULL;
+ if (wd->end)
+ {
+ Evas_Object *edje = elm_smart_scroller_edje_object_get(wd->scroller);
+ if (!edje) return NULL;
+ ret = wd->end;
+ edje_object_part_unswallow(edje, wd->end);
+ edje_object_signal_emit(edje, "elm,action,hide,end", "elm");
+ wd->end = NULL;
+ _sizing_eval(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)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if ((!wd) || (!wd->end)) return;
+ if (setting)
+ evas_object_hide(wd->end);
+ else
+ evas_object_show(wd->end);
+ _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)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ const Elm_Scroller_Policy map[3] =
+ {
+ ELM_SMART_SCROLLER_POLICY_AUTO,
+ ELM_SMART_SCROLLER_POLICY_ON,
+ ELM_SMART_SCROLLER_POLICY_OFF
+ };
+ if (!wd) return;
+ wd->policy_h = h;
+ wd->policy_v = v;
+ elm_smart_scroller_policy_set(wd->scroller,
+ map[wd->policy_h],
+ 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_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ 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_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ 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.
+ *
+ * @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 Evas_Object *
-elm_entry_end_get(const Evas_Object *obj)
+EAPI void
+elm_entry_input_panel_enabled_set(Evas_Object *obj, Eina_Bool enabled)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->end;
+ if (!wd) return;
+
+ wd->input_panel_enable = enabled;
+ edje_object_part_text_input_panel_enabled_set(wd->ent, "elm.text", enabled);
}
/**
- * 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.
+ * Set the input panel layout of the entry
*
- * @see elm_entry_icon_set()
+ * @param obj The entry object
+ * @param layout the layout to set
*
* @ingroup Entry
*/
-EAPI Evas_Object *
-elm_entry_end_unset(Evas_Object *obj)
+EAPI void
+elm_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout)
{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+ ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Object *ret = NULL;
- if (!wd) return NULL;
- if (wd->end)
- {
- Evas_Object *edje = elm_smart_scroller_edje_object_get(wd->scroller);
- if (!edje) return NULL;
- ret = wd->end;
- edje_object_part_unswallow(edje, wd->end);
- edje_object_signal_emit(edje, "elm,action,hide,end", "elm");
- wd->end = NULL;
- _sizing_eval(obj);
- }
- return ret;
+ if (!wd) return;
+
+ Ecore_IMF_Context *ic = elm_entry_imf_context_get(obj);
+ if (!ic) return;
+
+ wd->input_panel_layout = layout;
+
+ ecore_imf_context_input_panel_layout_set(ic, (Ecore_IMF_Input_Panel_Layout)layout);
}
/**
- * Sets the visibility of the end widget of the scrolled entry, set by
- * @elm_entry_end_set().
+ * Get the input method context in the entry widget
*
- * @param obj The scrolled entry object
- * @param setting EINA_TRUE if the object should be displayed,
- * EINA_FALSE if not.
+ * @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_end_visible_set(Evas_Object *obj, Eina_Bool setting)
+elm_entry_matchlist_set(Evas_Object *obj, Eina_List *match_list, Eina_Bool case_sensitive)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
- if ((!wd) || (!wd->end)) return;
- if (setting)
- evas_object_hide(wd->end);
+ 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
- evas_object_show(wd->end);
- _sizing_eval(obj);
+ {
+ if (wd->hover)
+ evas_object_del(wd->hover);
+
+ wd->match_list = NULL;
+ }
+
+ wd->matchlist_case_sensitive = case_sensitive;
}
/**
- * This sets the scrolled entry's scrollbar policy (ie. enabling/disabling them).
+ * Set the magnifier style of the entry
*
- * @param obj The scrolled entry object
- * @param h The horizontal scrollbar policy to apply
- * @param v The vertical scrollbar policy to apply
+ * @param obj The entry object
+ * @param type the magnifier style to set
*
* @ingroup Entry
*/
EAPI void
-elm_entry_scrollbar_policy_set(Evas_Object *obj, Elm_Scroller_Policy h, Elm_Scroller_Policy v)
+elm_entry_magnifier_type_set(Evas_Object *obj, int type)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
- const Elm_Scroller_Policy map[3] =
- {
- ELM_SMART_SCROLLER_POLICY_AUTO,
- ELM_SMART_SCROLLER_POLICY_ON,
- ELM_SMART_SCROLLER_POLICY_OFF
- };
if (!wd) return;
- wd->policy_h = h;
- wd->policy_v = v;
- elm_smart_scroller_policy_set(wd->scroller,
- map[wd->policy_h],
- map[wd->policy_v]);
+
+ wd->mgf_type = type;
+ _magnifier_create(obj);
}
/**
- * 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
+ * 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_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
+elm_entry_wrap_width_set(Evas_Object *obj, Evas_Coord w)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_smart_scroller_bounce_allow_set(wd->scroller, h_bounce, v_bounce);
+ if (wd->wrap_w == w) return;
+ wd->wrap_w = w;
+ _sizing_eval(obj);
}
/**
- * Get the bounce mode
- *
- * @param obj The Entry object
- * @param h_bounce Allow bounce horizontally
- * @param v_bounce Allow bounce vertically
+ * 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 void
-elm_entry_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
+EAPI Evas_Coord
+elm_entry_wrap_width_get(const Evas_Object *obj)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_smart_scroller_bounce_allow_get(wd->scroller, h_bounce, v_bounce);
+ return wd->wrap_w;
}
/**
- * This sets the attribute to show the input panel automatically.
+ * Set the font size on the entry object
*
* @param obj The entry object
- * @param enabled If true, the input panel is appeared when entry is clicked or has a focus
+ * @param size font size
*
* @ingroup Entry
*/
EAPI void
-elm_entry_input_panel_enabled_set(Evas_Object *obj, Eina_Bool enabled)
+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);
- wd->input_panel_enable = enabled;
- edje_object_part_text_input_panel_enabled_set(wd->ent, "elm.text", enabled);
+ 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 input panel layout of the entry
+ * Set the text color on the entry object
*
* @param obj The entry object
- * @param layout the layout to set
+ * @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_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout)
+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);
- if (!wd) return;
-
- Ecore_IMF_Context *ic = elm_entry_imf_context_get(obj);
- if (!ic) return;
+ Eina_Strbuf *colorbuf = NULL;
+ const char *t;
+ int len;
- wd->input_panel_layout = layout;
+ 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);
- ecore_imf_context_input_panel_layout_set(ic, (Ecore_IMF_Input_Panel_Layout)layout);
+ 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 magnifier style of the entry
+ * Set the text align on the entry object
*
* @param obj The entry object
- * @param type the magnifier style to set
+ * @param align align mode
*
* @ingroup Entry
*/
EAPI void
-elm_entry_magnifier_type_set(Evas_Object *obj, int type)
+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;
- wd->mgf_type = type;
- _magnifier_create(obj);
-}
+ if (_stringshare_key_value_replace(&t, "align", alignmode, 0) == 0)
+ elm_entry_entry_set(obj, t);
-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);
+ wd->changed = 1;
+ _sizing_eval(obj);
+ eina_stringshare_del(t);
}