Hi, EFL developers.
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.
Thank you.
Index: src/lib/edje_private.h
===================================================================
--- src/lib/edje_private.h (revision 62732)
+++ src/lib/edje_private.h (working copy)
@@ -1834,7 +1834,9 @@ Eina_Bool _edje_entry_cursor_is_visible_format_get
const char *_edje_entry_cursor_content_get(Edje_Real_Part *rp, Edje_Cursor
cur);
void _edje_entry_cursor_pos_set(Edje_Real_Part *rp, Edje_Cursor cur, int pos);
int _edje_entry_cursor_pos_get(Edje_Real_Part *rp, Edje_Cursor cur);
-
+void _edje_entry_input_panel_layout_set(Edje_Real_Part *rp,
Edje_Input_Panel_Layout layout);
+Edje_Input_Panel_Layout _edje_entry_input_panel_layout_get(Edje_Real_Part *rp);
+
void _edje_external_init();
void _edje_external_shutdown();
Evas_Object *_edje_external_type_add(const char *type_name, Evas *evas,
Evas_Object *parent, const Eina_List *params, const char *part_name);
Index: src/lib/edje_util.c
===================================================================
--- src/lib/edje_util.c (revision 62732)
+++ src/lib/edje_util.c (working copy)
@@ -1724,6 +1724,39 @@ edje_object_part_text_cursor_pos_get(const Evas_Ob
}
EAPI void
+edje_object_part_text_input_panel_layout_set(const Evas_Object *obj, const
char *part, Edje_Input_Panel_Layout layout)
+{
+ Edje *ed;
+ Edje_Real_Part *rp;
+
+ ed = _edje_fetch(obj);
+ 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)
+ {
+ return _edje_entry_input_panel_layout_set(rp, layout);
+ }
+}
+
+EAPI Edje_Input_Panel_Layout
+edje_object_part_text_input_panel_layout_get(const Evas_Object *obj, const
char *part)
+{
+ Edje *ed;
+ Edje_Real_Part *rp;
+
+ ed = _edje_fetch(obj);
+ if ((!ed) || (!part)) return EDJE_INPUT_PANEL_LAYOUT_INVALID;
+ 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_panel_layout_get(rp);
+ }
+ return EDJE_INPUT_PANEL_LAYOUT_INVALID;
+}
+
+EAPI void
edje_object_text_insert_filter_callback_add(Evas_Object *obj, const char
*part, Edje_Text_Filter_Cb func, void *data)
{
Edje *ed;
Index: src/lib/Edje.h
===================================================================
--- src/lib/Edje.h (revision 62732)
+++ src/lib/Edje.h (working copy)
@@ -775,6 +775,18 @@ typedef enum _Edje_External_Param_Flags
EDJE_EXTERNAL_PARAM_FLAGS_STATE)
/**< Convenience flag that sets property as GET, SET and STATE. */
} Edje_External_Param_Flags;
+typedef enum
+{
+ EDJE_INPUT_PANEL_LAYOUT_NORMAL, /**< Default layout */
+ EDJE_INPUT_PANEL_LAYOUT_NUMBER, /**< Number layout */
+ EDJE_INPUT_PANEL_LAYOUT_EMAIL, /**< Email layout */
+ EDJE_INPUT_PANEL_LAYOUT_URL, /**< URL layout */
+ EDJE_INPUT_PANEL_LAYOUT_PHONENUMBER, /**< Phone Number layout */
+ EDJE_INPUT_PANEL_LAYOUT_IP, /**< IP layout */
+ EDJE_INPUT_PANEL_LAYOUT_MONTH, /**< Month layout */
+ EDJE_INPUT_PANEL_LAYOUT_NUMBERONLY, /**< Number Only layout */
+ EDJE_INPUT_PANEL_LAYOUT_INVALID
+} Edje_Input_Panel_Layout;
/**
* @brief Converts type identifier to string nicer representation.
@@ -2742,6 +2754,27 @@ EAPI void edje_object_part_text_cursor
EAPI int edje_object_part_text_cursor_pos_get (const
Evas_Object *obj, const char *part, Edje_Cursor cur);
/**
+ * @brief Set the layout of the input panel.
+ *
+ * @param obj A valid Evas_Object handle
+ * @param part The part name
+ * @param layout layout type
+ */
+EAPI void edje_object_part_text_input_panel_layout_set (const
Evas_Object *obj, const char *part, Edje_Input_Panel_Layout layout);
+
+/**
+ * @brief Get the layout of the input panel.
+ *
+ * @param obj A valid Evas_Object handle
+ * @param part The part name
+ *
+ * @return Layout type of the input panel
+ *
+ * @see edje_object_part_text_input_panel_layout_set
+ */
+EAPI Edje_Input_Panel_Layout edje_object_part_text_input_panel_layout_get
(const Evas_Object *obj, const char *part);
+
+/**
* Add a filter function for newly inserted text.
*
* Whenever text is inserted (not the same as set) into the given @p part,
Index: src/lib/edje_entry.c
===================================================================
--- src/lib/edje_entry.c (revision 62732)
+++ src/lib/edje_entry.c (working copy)
@@ -2646,6 +2646,30 @@ _edje_entry_cursor_pos_get(Edje_Real_Part *rp, Edj
return evas_textblock_cursor_pos_get(c);
}
+void
+_edje_entry_input_panel_layout_set(Edje_Real_Part *rp, Edje_Input_Panel_Layout
layout)
+{
+ Entry *en = rp->entry_data;
+ if (!en) return;
+#ifdef HAVE_ECORE_IMF
+ if (en->imf_context)
+ ecore_imf_context_input_panel_layout_set(en->imf_context, layout);
+#endif
+}
+
+Edje_Input_Panel_Layout
+_edje_entry_input_panel_layout_get(Edje_Real_Part *rp)
+{
+ Entry *en = rp->entry_data;
+ if ((!en) || (!en->imf_context)) return EDJE_INPUT_PANEL_LAYOUT_INVALID;
+#ifdef HAVE_ECORE_IMF
+ if (en->imf_context)
+ return ecore_imf_context_input_panel_layout_get(en->imf_context);
+#endif
+
+ return EDJE_INPUT_PANEL_LAYOUT_INVALID;
+}
+
static void
_edje_entry_imf_context_reset(Entry *en)
{
Index: Elementary.h.in
===================================================================
--- Elementary.h.in (revision 62732)
+++ Elementary.h.in (working copy)
@@ -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.
@@ -11250,6 +11263,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: elm_entry.c
===================================================================
--- elm_entry.c (revision 62732)
+++ elm_entry.c (working copy)
@@ -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_
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;
+}
------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management
Up to 160% more powerful than alternatives and 25% more efficient.
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel