Add elm_entry_input_hint_set/get API
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 1 Sep 2014 10:04:05 +0000 (19:04 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 1 Sep 2014 10:04:05 +0000 (19:04 +0900)
Sets or get the input hint which allows input methods to fine-tune their behavior.

legacy/elementary/src/lib/elm_entry.c
legacy/elementary/src/lib/elm_entry.eo
legacy/elementary/src/lib/elm_entry_common.h
legacy/elementary/src/lib/elm_widget_entry.h

index b772e52..ed5c7fe 100644 (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
@@ -4785,6 +4795,21 @@ _elm_entry_prediction_allow_get(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
 }
 
 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)
 {
    edje_object_part_text_imf_context_reset(sd->entry_edje, "elm.text");
index 46bfed3..c28e955 100644 (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 {
             /*@
index 12a581b..f518745 100644 (file)
@@ -109,6 +109,18 @@ typedef enum
 } 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
  *
  * The info sent in the callback for the "anchor,clicked" signals emitted
index 06b4dda..c29275b 100644 (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;