elm_entry: add elm_entry_prediction_hint_hash_set/del API

elm_entry_prediction_hint_hash_set API sets the prediction hint data at the specified key, and
elm_entry_prediction_hint_hash_del API is for deleting the prediction hint data identified by a key.

@feature

Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
This commit is contained in:
Jihoon Kim 2018-05-23 11:26:30 +09:00
parent 249ae8e5f0
commit 379ee0d0db
6 changed files with 143 additions and 0 deletions

View File

@ -2732,6 +2732,35 @@ EAPI Eina_Bool edje_object_part_text_input_panel_show_on_demand_get(const Evas_O
*/
EAPI void edje_object_part_text_prediction_hint_set(Evas_Object *obj, const char *part, const char *prediction_hint);
/**
* @brief Sets the prediction hint data at the specified key.
*
* @param[in] part The part name
* @param[in] key The key of the prediction hint
* @param[in] value The data to replace
*
* @return @c true on success, @c false otherwise
*
* @since 1.21.0
*
* @ingroup Edje_Object
*/
EAPI Eina_Bool edje_object_part_text_prediction_hint_hash_set(Evas_Object *obj, const char *part, const char *key, const char *value);
/**
* @brief Removes the prediction hint data identified by a key
*
* @param[in] part The part name
* @param[in] key The key of the prediction hint
*
* @return @c true on success, @c false otherwise
*
* @since 1.21.0
*
* @ingroup Edje_Object
*/
EAPI Eina_Bool edje_object_part_text_prediction_hint_hash_del(Evas_Object *obj, const char *part, const char *key);
/**
* @brief Starts selecting at current cursor position
*

View File

@ -4584,6 +4584,45 @@ _edje_entry_prediction_hint_set(Edje_Real_Part *rp, const char *prediction_hint)
#endif
}
Eina_Bool
_edje_entry_prediction_hint_hash_set(Edje_Real_Part *rp, const char *key, const char *value)
{
Entry *en;
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
(!rp->typedata.text)) return EINA_FALSE;
en = rp->typedata.text->entry_data;
if (!en) return EINA_FALSE;
#ifdef HAVE_ECORE_IMF
if (en->imf_context)
return ecore_imf_context_prediction_hint_hash_set(en->imf_context, key, value);
#else
(void)key;
(void)value;
#endif
return EINA_FALSE;
}
Eina_Bool
_edje_entry_prediction_hint_hash_del(Edje_Real_Part *rp, const char *key)
{
Entry *en;
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
(!rp->typedata.text)) return EINA_FALSE;
en = rp->typedata.text->entry_data;
if (!en) return EINA_FALSE;
#ifdef HAVE_ECORE_IMF
if (en->imf_context)
return ecore_imf_context_prediction_hint_hash_del(en->imf_context, key);
#else
(void)key;
#endif
return EINA_FALSE;
}
#ifdef HAVE_ECORE_IMF
static Edje_Real_Part *

View File

@ -2882,6 +2882,8 @@ Eina_Bool _edje_entry_input_panel_return_key_disabled_get(Edje_Real_Part *rp);
void _edje_entry_input_panel_show_on_demand_set(Edje_Real_Part *rp, Eina_Bool ondemand);
Eina_Bool _edje_entry_input_panel_show_on_demand_get(Edje_Real_Part *rp);
void _edje_entry_prediction_hint_set(Edje_Real_Part *rp, const char *prediction_hint);
Eina_Bool _edje_entry_prediction_hint_hash_set(Edje_Real_Part *rp, const char *key, const char *value);
Eina_Bool _edje_entry_prediction_hint_hash_del(Edje_Real_Part *rp, const char *key);
Eina_Bool _edje_entry_hide_visible_password(Edje *edje, Edje_Real_Part *rp);
void _edje_external_init(void);

View File

@ -3085,6 +3085,44 @@ _edje_box_layout_part_external_find(const char *name)
NULL);
}
EAPI Eina_Bool
edje_object_part_text_prediction_hint_hash_set(Eo *obj, const char *part, const char *key, const char *value)
{
Edje_Real_Part *rp;
Edje *ed;
ed = _edje_fetch(obj);
if ((!ed) || (!part)) return EINA_FALSE;
rp = _edje_real_part_recursive_get(&ed, part);
if (!rp) return EINA_FALSE;
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
{
return _edje_entry_prediction_hint_hash_set(rp, key, value);
}
else
return EINA_FALSE;
}
EAPI Eina_Bool
edje_object_part_text_prediction_hint_hash_del(Eo *obj, const char *part, const char *key)
{
Edje_Real_Part *rp;
Edje *ed;
ed = _edje_fetch(obj);
if ((!ed) || (!part)) return EINA_FALSE;
rp = _edje_real_part_recursive_get(&ed, part);
if (!rp) return EINA_FALSE;
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
{
return _edje_entry_prediction_hint_hash_del(rp, key);
}
else
return EINA_FALSE;
}
Eina_Bool
_edje_box_layout_find(const char *name, Evas_Object_Box_Layout *cb, void **data, void(**free_data) (void *data))
{

View File

@ -5314,6 +5314,20 @@ _elm_entry_prediction_hint_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const ch
(sd->entry_edje, "elm.text", prediction_hint);
}
EOLIAN static Eina_Bool
_elm_entry_prediction_hint_hash_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *key, const char *value)
{
return edje_object_part_text_prediction_hint_hash_set
(sd->entry_edje, "elm.text", key, value);
}
EOLIAN static Eina_Bool
_elm_entry_prediction_hint_hash_del(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *key)
{
return edje_object_part_text_prediction_hint_hash_del
(sd->entry_edje, "elm.text", key);
}
EOLIAN static void
_elm_entry_imf_context_reset(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
{

View File

@ -830,6 +830,27 @@ class Elm.Entry (Efl.Ui.Layout.Object, Elm.Interface_Scrollable, Efl.Ui.Clickabl
prediction_hint: string; [[The prediction hint text.]]
}
}
prediction_hint_hash_set {
[[Sets the prediction hint data at the specified key.
@since 1.21
]]
return: bool; [[$true on success, $false otherwise]]
params {
key: string; [[The key of the prediction hint.]]
value: string; [[The data to replace.]]
}
}
prediction_hint_hash_del {
[[Removes the prediction hint data identified by a key.
@since 1.21
]]
return: bool; [[$true on success, $false otherwise]]
params {
key: string; [[The key of the prediction hint.]]
}
}
}
implements {
class.constructor;