From: jihoon Date: Wed, 15 Feb 2012 08:42:46 +0000 (+0000) Subject: elm_entry: X-Git-Tag: REL_F_I9500_20120313_1~56 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=46b555e2b1331dab19e19fa58b9f99221eec2f33;p=framework%2Fuifw%2Felementary.git elm_entry: add elm_entry_input_panel_language_set/get add elm_entry_input_panel_imdata_set/get add elm_entry_input_panel_return_key_type_set/get add elm_entry_input_panel_return_key_disabled_set/get Change-Id: Ic59a7375510a303e4361849d7facbd101c7382d8 git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@67967 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c index d21d6b8..a40539a 100644 --- a/src/lib/elm_entry.c +++ b/src/lib/elm_entry.c @@ -48,6 +48,10 @@ struct _Widget_Data Elm_Wrap_Type linewrap; Elm_Input_Panel_Layout input_panel_layout; Elm_Autocapital_Type autocapital_type; + Elm_Input_Panel_Lang input_panel_lang; + Elm_Input_Panel_Return_Key_Type input_panel_return_key_type; + void *input_panel_imdata; + int input_panel_imdata_len; Eina_Bool changed : 1; Eina_Bool single_line : 1; Eina_Bool password : 1; @@ -68,6 +72,8 @@ struct _Widget_Data Eina_Bool h_bounce : 1; Eina_Bool v_bounce : 1; Eina_Bool input_panel_enable : 1; + Eina_Bool prediction_allow : 1; + Eina_Bool input_panel_return_key_disabled : 1; //// TIZEN ONLY Evas_Object *hoversel; Evas_Object *hover; @@ -561,6 +567,7 @@ _del_hook(Evas_Object *obj) _filter_free(tf); } if (wd->delay_write) ecore_timer_del(wd->delay_write); + if (wd->input_panel_imdata) free(wd->input_panel_imdata); free(wd); evas_event_thaw(evas_object_evas_get(obj)); @@ -595,6 +602,10 @@ _theme_hook(Evas_Object *obj) edje_object_part_text_input_panel_layout_set(wd->ent, "elm.text", wd->input_panel_layout); edje_object_part_text_autocapital_type_set(wd->ent, "elm.text", wd->autocapital_type); edje_object_part_text_input_panel_enabled_set(wd->ent, "elm.text", wd->input_panel_enable); + edje_object_part_text_input_panel_imdata_set(wd->ent, "elm.text", wd->input_panel_imdata, wd->input_panel_imdata_len); + edje_object_part_text_input_panel_return_key_type_set(wd->ent, "elm.text", wd->input_panel_return_key_type); + edje_object_part_text_input_panel_return_key_disabled_set(wd->ent, "elm.text", wd->input_panel_return_key_disabled); + if (wd->cursor_pos != 0) elm_entry_cursor_pos_set(obj, wd->cursor_pos); if (elm_widget_focus_get(obj)) @@ -3064,6 +3075,7 @@ elm_entry_add(Evas_Object *parent) wd->autosave = EINA_TRUE; wd->textonly = EINA_FALSE; wd->scroll = EINA_FALSE; + wd->input_panel_imdata = NULL; //TIZEN ONLY wd->cnp_mode = ELM_CNP_MODE_MARKUP; wd->magnifier_enabled = EINA_TRUE; @@ -4440,6 +4452,98 @@ elm_entry_input_panel_hide(Evas_Object *obj) edje_object_part_text_input_panel_hide(wd->ent, "elm.text"); } +EAPI void +elm_entry_input_panel_language_set(Evas_Object *obj, Elm_Input_Panel_Lang lang) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->input_panel_lang = lang; + edje_object_part_text_input_panel_language_set(wd->ent, "elm.text", lang); +} + +EAPI Elm_Input_Panel_Lang +elm_entry_input_panel_language_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_INPUT_PANEL_LANG_AUTOMATIC; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_INPUT_PANEL_LANG_AUTOMATIC; + + return wd->input_panel_lang; +} + +EAPI void +elm_entry_input_panel_imdata_set(Evas_Object *obj, const void *data, int len) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->input_panel_imdata) + free(wd->input_panel_imdata); + + wd->input_panel_imdata = calloc(1, len); + wd->input_panel_imdata_len = len; + memcpy(wd->input_panel_imdata, data, len); + + edje_object_part_text_input_panel_imdata_set(wd->ent, "elm.text", wd->input_panel_imdata, wd->input_panel_imdata_len); +} + +EAPI void +elm_entry_input_panel_imdata_get(const Evas_Object *obj, void *data, int *len) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + edje_object_part_text_input_panel_imdata_get(wd->ent, "elm.text", data, len); +} + +EAPI void +elm_text_input_panel_return_key_type_set(Evas_Object *obj, Elm_Input_Panel_Return_Key_Type return_key_type) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->input_panel_return_key_type = return_key_type; + + edje_object_part_text_input_panel_return_key_type_set(wd->ent, "elm.text", return_key_type); +} + +EAPI Elm_Input_Panel_Return_Key_Type +elm_entry_input_panel_return_key_type_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT; + + return wd->input_panel_return_key_type; +} + +EAPI void +elm_entry_input_panel_return_key_disabled_set(Evas_Object *obj, Eina_Bool disabled) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + wd->input_panel_return_key_disabled = disabled; + + edje_object_part_text_input_panel_return_key_disabled_set(wd->ent, "elm.text", disabled); +} + +EAPI Eina_Bool +elm_entry_input_panel_return_key_disabled_get(const Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + + return wd->input_panel_return_key_disabled; +} + EINA_DEPRECATED EAPI void elm_entry_autoperiod_set(Evas_Object *obj __UNUSED__, Eina_Bool autoperiod __UNUSED__) { diff --git a/src/lib/elm_entry.h b/src/lib/elm_entry.h index adb64f7..6eb677e 100644 --- a/src/lib/elm_entry.h +++ b/src/lib/elm_entry.h @@ -34,12 +34,30 @@ typedef enum typedef enum { + ELM_INPUT_PANEL_LANG_AUTOMATIC, /**< Automatic */ + ELM_INPUT_PANEL_LANG_ALPHABET /**< Alphabet */ +} Elm_Input_Panel_Lang; + +typedef enum +{ ELM_AUTOCAPITAL_TYPE_NONE, /**< No auto-capitalization when typing */ ELM_AUTOCAPITAL_TYPE_WORD, /**< Autocapitalize each word typed */ ELM_AUTOCAPITAL_TYPE_SENTENCE, /**< Autocapitalize the start of each sentence */ ELM_AUTOCAPITAL_TYPE_ALLCHARACTER, /**< Autocapitalize all letters */ } Elm_Autocapital_Type; /**< Choose method of auto-capitalization */ +typedef enum +{ + ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT, + ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE, + ELM_INPUT_PANEL_RETURN_KEY_TYPE_GO, + ELM_INPUT_PANEL_RETURN_KEY_TYPE_JOIN, + ELM_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN, + ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT, + ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH, + ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEND +} Elm_Input_Panel_Return_Key_Type; + /** * @enum _Elm_CNP_Mode * @typedef Elm_CNP_Mode @@ -1202,6 +1220,87 @@ EAPI void elm_entry_input_panel_show(Evas_Object *obj); EAPI void elm_entry_input_panel_hide(Evas_Object *obj); /** + * Set the language mode of the input panel. + * + * This API can be used if you want to show the alphabet keyboard mode. + * + * @param obj The entry object + * @param lang language to be set to the input panel. + */ +EAPI void elm_entry_input_panel_language_set(Evas_Object *obj, Elm_Input_Panel_Lang lang); + +/** + * Get the language mode of the input panel. + * + * See @ref elm_entry_input_panel_language_set for more details. + * + * @param obj The entry object + * @return input panel language type + */ +EAPI Elm_Input_Panel_Lang elm_entry_input_panel_language_get(const Evas_Object *obj); + +/** + * Set the input panel-specific data to deliver to the input panel. + * + * This API is used by applications to deliver specific data to the input panel. + * The data format MUST be negotiated by both application and the input panel. + * The size and format of data are defined by the input panel. + * + * @param obj The entry object + * @param data The specific data to be set to the input panel. + * @param len the length of data, in bytes, to send to the input panel + */ +EAPI void elm_entry_input_panel_imdata_set(Evas_Object *obj, const void *data, int len); + +/** + * Get the specific data of the current input panel. + * + * See @ref elm_entry_input_panel_imdata_set for more details. + * + * @param obj The entry object + * @param data The specific data to be got from the input panel + * @param len The length of data + */ +EAPI void elm_entry_input_panel_imdata_get(const Evas_Object *obj, void *data, int *len); + +/** + * Set the "return" key type. This type is used to set string or icon on the "return" key of the input panel. + * + * An input panel displays the string or icon associated with this type + * + * @param obj The entry object + * @param return_key_type The type of "return" key on the input panel + */ +EAPI void elm_text_input_panel_return_key_type_set(Evas_Object *obj, Elm_Input_Panel_Return_Key_Type return_key_type); + +/** + * Get the "return" key type. + * + * @see elm_entry_input_panel_return_key_type_set() for more details + * + * @param obj The entry object + * @return The type of "return" key on the input panel + */ +EAPI Elm_Input_Panel_Return_Key_Type elm_entry_input_panel_return_key_type_get(const Evas_Object *obj); + +/** + * Set the return key on the input panel to be disabled. + * + * @param obj The entry object + * @param disabled The state to put in in: @c EINA_TRUE for + * disabled, @c EINA_FALSE for enabled + */ +EAPI void elm_entry_input_panel_return_key_disabled_set(Evas_Object *obj, Eina_Bool disabled); + +/** + * Get whether the return key on the input panel should be disabled or not. + * + * @param obj The entry object + * @return EINA_TRUE if it should be disabled + */ +EAPI Eina_Bool elm_entry_input_panel_return_key_disabled_get(const Evas_Object *obj); + +/** * Reset the input method context of the entry if needed. * * This can be necessary in the case where modifying the buffer would confuse on-going input method behavior