From: Jihoon Kim <jihoon48.kim@samsung.com>
authorJihoon Kim <jihoon48.kim@samsung.com>
Thu, 25 Aug 2011 07:25:37 +0000 (07:25 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Thu, 25 Aug 2011 07:25:37 +0000 (07:25 +0000)
Subject: [E-devel] [PATCH] add elm_entry_input_panel_layout_set API

elm_entry_input_panel_layout_set API is high level API to call
ecore_imf_context_input_panel_layout_set (through edje).
This API will be used to set layout of input panel (such as URL, Email,
Number layout...) by application programmer.

Would you please review this patch?
Please let me know if I have to do more.

SVN revision: 62782

src/lib/Elementary.h.in
src/lib/elm_entry.c

index debe4d2..6f7d60d 100644 (file)
@@ -552,6 +552,19 @@ extern "C" {
         ELM_WRAP_LAST
      } Elm_Wrap_Type;
 
+   typedef enum
+     {
+        ELM_INPUT_PANEL_LAYOUT_NORMAL,          /**< Default layout */
+        ELM_INPUT_PANEL_LAYOUT_NUMBER,          /**< Number layout */
+        ELM_INPUT_PANEL_LAYOUT_EMAIL,           /**< Email layout */
+        ELM_INPUT_PANEL_LAYOUT_URL,             /**< URL layout */
+        ELM_INPUT_PANEL_LAYOUT_PHONENUMBER,     /**< Phone Number layout */
+        ELM_INPUT_PANEL_LAYOUT_IP,              /**< IP layout */
+        ELM_INPUT_PANEL_LAYOUT_MONTH,           /**< Month layout */
+        ELM_INPUT_PANEL_LAYOUT_NUMBERONLY,      /**< Number Only layout */
+        ELM_INPUT_PANEL_LAYOUT_INVALID
+     } Elm_Input_Panel_Layout;
+
    /**
     * @typedef Elm_Object_Item
     * An Elementary Object item handle.
@@ -11319,6 +11332,22 @@ extern "C" {
     */
    EAPI void         elm_entry_filter_accept_set(void *data, Evas_Object *entry, char **text) EINA_ARG_NONNULL(1, 3);
    /**
+    * Set the input panel layout of the entry
+    *
+    * @param obj The entry object
+    * @param layout layout type
+    */
+   EAPI void elm_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout) EINA_ARG_NONNULL(1);
+   /**
+    * Get the input panel layout of the entry
+    *
+    * @param obj The entry object
+    * @return layout type
+    *
+    * @see elm_entry_input_panel_layout_set
+    */
+   EAPI Elm_Input_Panel_Layout elm_entry_input_panel_layout_get(Evas_Object *obj) EINA_ARG_NONNULL(1);
+   /**
     * @}
     */
 
index ba09b1a..40c33e2 100644 (file)
@@ -45,6 +45,7 @@ struct _Widget_Data
    int cursor_pos;
    Elm_Scroller_Policy policy_h, policy_v;
    Elm_Wrap_Type linewrap;
+   Elm_Input_Panel_Layout input_panel_layout;
    Eina_Bool changed : 1;
    Eina_Bool single_line : 1;
    Eina_Bool password : 1;
@@ -508,6 +509,7 @@ _theme_hook(Evas_Object *obj)
    eina_stringshare_del(t);
    if (elm_widget_disabled_get(obj))
      edje_object_signal_emit(wd->ent, "elm,state,disabled", "elm");
+   edje_object_part_text_input_panel_layout_set(wd->ent, "elm.text", wd->input_panel_layout);
    elm_entry_cursor_pos_set(obj, wd->cursor_pos);
    if (elm_widget_focus_get(obj))
      edje_object_signal_emit(wd->ent, "elm,action,focus", "elm");
@@ -2156,6 +2158,8 @@ elm_entry_add(Evas_Object *parent)
    elm_widget_resize_object_set(obj, wd->ent);
    _sizing_eval(obj);
 
+   elm_entry_input_panel_layout_set(obj, ELM_INPUT_PANEL_LAYOUT_NORMAL);
+
 #ifdef HAVE_ELEMENTARY_X
    top = elm_widget_top_get(obj);
    if ((top) && (elm_win_xwindow_get(top)))
@@ -3170,3 +3174,25 @@ elm_entry_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_b
    if (!wd) return;
    elm_smart_scroller_bounce_allow_get(wd->scroller, h_bounce, v_bounce);
 }
+
+EAPI void
+elm_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+
+   wd->input_panel_layout = layout;
+
+   edje_object_part_text_input_panel_layout_set(wd->ent, "elm.text", layout);
+}
+
+EAPI Elm_Input_Panel_Layout
+elm_entry_input_panel_layout_get(Evas_Object *obj)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype) ELM_INPUT_PANEL_LAYOUT_INVALID;
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return ELM_INPUT_PANEL_LAYOUT_INVALID;
+
+   return wd->input_panel_layout;
+}