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

src/lib/edje/Edje_Common.h
src/lib/edje/edje_entry.c
src/lib/edje/edje_object.eo
src/lib/edje/edje_private.h
src/lib/edje/edje_util.c

index 13269b0..53e0130 100644 (file)
@@ -1007,6 +1007,13 @@ typedef enum _Edje_Input_Panel_Layout
    EDJE_INPUT_PANEL_LAYOUT_EMOTICON         /**< Emoticon layout @since 1.10 */
 } Edje_Input_Panel_Layout;
 
+typedef enum
+{
+   EDJE_INPUT_HINT_NONE                = 0,        /**< No active hints @since 1.12 */
+   EDJE_INPUT_HINT_AUTO_COMPLETE       = 1 << 0,   /**< Suggest word auto completion @since 1.12 */
+   EDJE_INPUT_HINT_SENSITIVE_DATA      = 1 << 1,   /**< Typed text should not be stored. @since 1.12 */
+} Edje_Input_Hints;
+
 enum
 {
    EDJE_INPUT_PANEL_LAYOUT_NUMBERONLY_VARIATION_NORMAL,
index da7ae5c..438e6d5 100644 (file)
@@ -3192,6 +3192,40 @@ _edje_entry_prediction_allow_get(Edje_Real_Part *rp)
 }
 
 void
+_edje_entry_input_hint_set(Edje_Real_Part *rp, Edje_Input_Hints input_hints)
+{
+   Entry *en;
+
+   if ((rp->type != EDJE_RP_TYPE_TEXT) ||
+       (!rp->typedata.text)) return;
+   en = rp->typedata.text->entry_data;
+   if (!en) return;
+#ifdef HAVE_ECORE_IMF
+   if (en->imf_context)
+     ecore_imf_context_input_hint_set(en->imf_context, input_hints);
+#else
+   (void) input_hints;
+#endif
+}
+
+Edje_Input_Hints
+_edje_entry_input_hint_get(const Edje_Real_Part *rp)
+{
+   Entry *en;
+
+   if ((rp->type != EDJE_RP_TYPE_TEXT) ||
+       (!rp->typedata.text)) return EDJE_INPUT_HINT_NONE;
+   en = rp->typedata.text->entry_data;
+   if (!en) return EDJE_INPUT_HINT_NONE;
+#ifdef HAVE_ECORE_IMF
+   if (en->imf_context)
+     return ecore_imf_context_input_hint_get(en->imf_context);
+#endif
+
+   return EDJE_INPUT_HINT_NONE;
+}
+
+void
 _edje_entry_input_panel_enabled_set(Edje_Real_Part *rp, Eina_Bool enabled)
 {
    Entry *en;
index cdb7ba8..8d2fa3d 100644 (file)
@@ -2013,6 +2013,28 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File)
             @in const(char)* part; /*@ The part name */
          }
       }
+      part_text_input_hint_set {
+         /*@
+         Sets the input hint which allows input methods to fine-tune their behavior.
+
+         @since 1.12.0 */
+
+         params {
+            @in const(char)* part; /*@ The part name */
+            @in Edje_Input_Hints input_hints; /*@ input hints */
+         }
+      }
+      part_text_input_hint_get @const {
+         /*@
+         Gets the value of input hint
+
+         @return The value of input hint
+         @since 1.12.0 */
+         return: Edje_Input_Hints;
+         params {
+            @in const(char)* part; /*@ The part name */
+         }
+      }
       part_text_selection_get @const {
          /*@
          @brief Return the selection text of the object part.
index 3cf3beb..4148abf 100644 (file)
@@ -2358,6 +2358,8 @@ void _edje_entry_autocapital_type_set(Edje_Real_Part *rp, Edje_Text_Autocapital_
 Edje_Text_Autocapital_Type _edje_entry_autocapital_type_get(Edje_Real_Part *rp);
 void _edje_entry_prediction_allow_set(Edje_Real_Part *rp, Eina_Bool prediction);
 Eina_Bool _edje_entry_prediction_allow_get(Edje_Real_Part *rp);
+void _edje_entry_input_hint_set(Edje_Real_Part *rp, Edje_Input_Hints input_hints);
+Edje_Input_Hints _edje_entry_input_hint_get(const Edje_Real_Part *rp);
 void _edje_entry_input_panel_enabled_set(Edje_Real_Part *rp, Eina_Bool enabled);
 Eina_Bool _edje_entry_input_panel_enabled_get(Edje_Real_Part *rp);
 void _edje_entry_input_panel_show(Edje_Real_Part *rp);
index 72e0bec..829890f 100644 (file)
@@ -2131,6 +2131,35 @@ _edje_object_part_text_prediction_allow_get(Eo *obj EINA_UNUSED, Edje *ed, const
 }
 
 EOLIAN void
+_edje_object_part_text_input_hint_set(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Edje_Input_Hints input_hints)
+{
+   Edje_Real_Part *rp;
+
+   if ((!ed) || (!part)) return;
+   rp = _edje_real_part_recursive_get(&ed, part);
+   if (!rp) return;
+   if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
+     {
+        _edje_entry_input_hint_set(rp, input_hints);
+     }
+}
+
+EOLIAN Edje_Input_Hints
+_edje_object_part_text_input_hint_get(const Eo *obj EINA_UNUSED, Edje *ed, const char *part)
+{
+   Edje_Real_Part *rp;
+
+   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_input_hint_get(rp);
+     }
+   return EINA_FALSE;
+}
+
+EOLIAN void
 _edje_object_part_text_input_panel_enabled_set(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Eina_Bool enabled)
 {
    Edje_Real_Part *rp;