Add elm_entry_input_hint_set/get API

Sets or get the input hint which allows input methods to fine-tune their behavior.
This commit is contained in:
Jihoon Kim 2014-09-01 19:04:05 +09:00
parent 6c7619b0ea
commit cdec9a9e85
4 changed files with 59 additions and 0 deletions

View File

@ -736,6 +736,8 @@ _elm_entry_elm_widget_theme_apply(Eo *obj, Elm_Entry_Data *sd)
(sd->entry_edje, "elm.text", (Edje_Text_Autocapital_Type)sd->autocapital_type);
edje_object_part_text_prediction_allow_set
(sd->entry_edje, "elm.text", sd->prediction_allow);
edje_object_part_text_input_hint_set
(sd->entry_edje, "elm.text", sd->input_hints);
edje_object_part_text_input_panel_enabled_set
(sd->entry_edje, "elm.text", sd->input_panel_enable);
edje_object_part_text_input_panel_imdata_set
@ -3447,6 +3449,7 @@ _elm_entry_evas_object_smart_add(Eo *obj, Elm_Entry_Data *priv)
elm_entry_input_panel_layout_set(obj, ELM_INPUT_PANEL_LAYOUT_NORMAL);
elm_entry_input_panel_enabled_set(obj, EINA_TRUE);
elm_entry_prediction_allow_set(obj, EINA_TRUE);
elm_entry_input_hint_set(obj, ELM_INPUT_HINT_AUTO_COMPLETE);
priv->autocapital_type = (Elm_Autocapital_Type)edje_object_part_text_autocapital_type_get
(priv->entry_edje, "elm.text");
@ -3738,6 +3741,7 @@ _elm_entry_password_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool password)
{
sd->single_line = EINA_TRUE;
sd->line_wrap = ELM_WRAP_NONE;
elm_entry_input_hint_set(obj, ((sd->input_hints & ~ELM_INPUT_HINT_AUTO_COMPLETE) | ELM_INPUT_HINT_SENSITIVE_DATA));
_entry_selection_callbacks_unregister(obj);
}
else
@ -3749,6 +3753,7 @@ _elm_entry_password_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool password)
NULL, NULL,
_drag_drop_cb, NULL);
elm_entry_input_hint_set(obj, ((sd->input_hints | ELM_INPUT_HINT_AUTO_COMPLETE) & ~ELM_INPUT_HINT_SENSITIVE_DATA));
_entry_selection_callbacks_register(obj);
}
@ -4733,6 +4738,11 @@ _elm_entry_input_panel_layout_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Elm_I
edje_object_part_text_input_panel_layout_set
(sd->entry_edje, "elm.text", (Edje_Input_Panel_Layout)layout);
if (layout == ELM_INPUT_PANEL_LAYOUT_PASSWORD)
elm_entry_input_hint_set(obj, ((sd->input_hints & ~ELM_INPUT_HINT_AUTO_COMPLETE) | ELM_INPUT_HINT_SENSITIVE_DATA));
else if (layout == ELM_INPUT_PANEL_LAYOUT_TERMINAL)
elm_entry_input_hint_set(obj, (sd->input_hints & ~ELM_INPUT_HINT_AUTO_COMPLETE));
}
EOLIAN static Elm_Input_Panel_Layout
@ -4784,6 +4794,21 @@ _elm_entry_prediction_allow_get(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
return sd->prediction_allow;
}
EOLIAN static void
_elm_entry_input_hint_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Elm_Input_Hints hints)
{
sd->input_hints = hints;
edje_object_part_text_input_hint_set
(sd->entry_edje, "elm.text", hints);
}
EOLIAN static Elm_Input_Hints
_elm_entry_input_hint_get(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
{
return sd->input_hints;
}
EOLIAN static void
_elm_entry_imf_context_reset(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
{

View File

@ -414,6 +414,27 @@ class Elm_Entry (Elm_Layout, Elm_Interface_Scrollable, Evas.Clickable_Interface,
bool prediction; /*@ Whether the entry should allow to use the text prediction. */
}
}
input_hint {
set {
/*@
Sets the input hint which allows input methods to fine-tune their behavior.
@ingroup Entry */
}
get {
/*@
Gets the value of input hint.
@return the value of input hint.
@see elm_entry_input_hint_set
@ingroup Entry */
}
values {
Elm_Input_Hints hints; /*@ input hint. */
}
}
input_panel_layout {
set {
/*@

View File

@ -108,6 +108,18 @@ typedef enum
ELM_INPUT_PANEL_RETURN_KEY_TYPE_SIGNIN /**< Sign-in @since 1.8 */
} Elm_Input_Panel_Return_Key_Type;
/**
* @typedef Elm_Input_Hints
* @brief Enumeration that defines the types of Input Hints.
* @since 1.12
*/
typedef enum
{
ELM_INPUT_HINT_NONE = 0, /**< No active hints @since 1.12 */
ELM_INPUT_HINT_AUTO_COMPLETE = 1 << 0, /**< suggest word auto completion @since 1.12 */
ELM_INPUT_HINT_SENSITIVE_DATA = 1 << 1, /**< typed text should not be stored. @since 1.12 */
} Elm_Input_Hints;
/**
* @typedef Elm_Entry_Anchor_Info
*

View File

@ -67,6 +67,7 @@ struct _Elm_Entry_Data
Elm_Autocapital_Type autocapital_type;
Elm_Input_Panel_Lang input_panel_lang;
Elm_Input_Panel_Return_Key_Type input_panel_return_key_type;
Elm_Input_Hints input_hints;
Edje_Cursor sel_handler_cursor;
void *input_panel_imdata;
int input_panel_imdata_len;