From: Jihoon Kim Date: Fri, 6 Dec 2024 08:33:40 +0000 (+0900) Subject: Support a variety of return key types X-Git-Tag: accepted/tizen/unified/20250113.094335~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be0dcad7312ce9b2591cbe79bd7d9a6f1f345b57;p=platform%2Fcore%2Fuifw%2Finputdelegator.git Support a variety of return key types Change-Id: I662ebdc8d1fc509f81626be047faec4db141ca3b Signed-off-by: Jihoon Kim --- diff --git a/inc/w-input-selector.h b/inc/w-input-selector.h index 1c5e79e..346ccdc 100644 --- a/inc/w-input-selector.h +++ b/inc/w-input-selector.h @@ -119,7 +119,7 @@ struct _InputKeyboardData { string guide_text; string default_text; - string return_key_type; + Elm_Input_Panel_Return_Key_Type return_key_type; int max_text_length; int cursor_position_set; Elm_Input_Panel_Layout input_panel_layout; diff --git a/src/w-input-keyboard.cpp b/src/w-input-keyboard.cpp index d050cbc..837b0a7 100644 --- a/src/w-input-keyboard.cpp +++ b/src/w-input-keyboard.cpp @@ -34,6 +34,11 @@ struct _input_panel_layout_item { Elm_Input_Panel_Layout input_panel_layout; }; +struct _returnkey_type_item { + const char *returnkey_string; + Elm_Input_Panel_Return_Key_Type return_key_type; +}; + static struct _input_panel_layout_item _input_panel_layout_items[] = { { "Normal", ELM_INPUT_PANEL_LAYOUT_NORMAL }, { "Number", ELM_INPUT_PANEL_LAYOUT_NUMBER }, @@ -48,6 +53,19 @@ static struct _input_panel_layout_item _input_panel_layout_items[] = { { NULL, ELM_INPUT_PANEL_LAYOUT_NORMAL } }; +static struct _returnkey_type_item _return_key_items[] = { + { "Default", ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT }, + { "Done", ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE }, + { "Go", ELM_INPUT_PANEL_RETURN_KEY_TYPE_GO }, + { "Join", ELM_INPUT_PANEL_RETURN_KEY_TYPE_JOIN }, + { "Login", ELM_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN }, + { "Next", ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT }, + { "Search", ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH }, + { "Send", ELM_INPUT_PANEL_RETURN_KEY_TYPE_SEND }, + { "Signin", ELM_INPUT_PANEL_RETURN_KEY_TYPE_SIGNIN }, + { NULL, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT } +}; + static Elm_Input_Panel_Layout convert_string_to_input_panel_layout(const char *input_panel_layout) { Elm_Input_Panel_Layout layout = ELM_INPUT_PANEL_LAYOUT_NORMAL; @@ -65,6 +83,24 @@ static Elm_Input_Panel_Layout convert_string_to_input_panel_layout(const char *i return layout; } +static Elm_Input_Panel_Return_Key_Type convert_string_to_return_key_type(const char *returnkey) +{ + Elm_Input_Panel_Return_Key_Type return_key_type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT; + + unsigned int idx = 0; + + while (_return_key_items[idx].returnkey_string != NULL) { + if (strcasecmp(_return_key_items[idx].returnkey_string, returnkey) == 0) { + return_key_type = _return_key_items[idx].return_key_type; + break; + } + idx++; + } + + return return_key_type; + +} + bool input_keyboard_init(app_control_h app_control) { int ret = -1; @@ -104,7 +140,7 @@ bool input_keyboard_init(app_control_h app_control) ret = app_control_get_extra_data(app_control, APP_CONTROL_DATA_INPUT_RETURNKEY_TYPE, &return_key_type); if (ret == APP_CONTROL_ERROR_NONE) { if (return_key_type) { - g_input_keyboard_data.return_key_type = string(return_key_type); + g_input_keyboard_data.return_key_type = convert_string_to_return_key_type(return_key_type); } } @@ -149,7 +185,7 @@ bool input_keyboard_init(app_control_h app_control) void input_keyboard_deinit(void) { - g_input_keyboard_data.return_key_type = string(_("IDS_AMEMO_BUTTON_SEND")); + g_input_keyboard_data.return_key_type = ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT; g_input_keyboard_data.max_text_length = KEYBOARD_EDITOR_CHAR_COUNT_MAX; g_input_keyboard_data.cursor_position_set = 0; @@ -244,8 +280,8 @@ void create_fullscreen_editor(void *data) elm_entry_cursor_end_set(entry); evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL); - if (g_input_keyboard_data.return_key_type == string("DONE")) { - elm_entry_input_panel_return_key_type_set(entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE); + elm_entry_input_panel_return_key_type_set(entry, g_input_keyboard_data.return_key_type); + if (g_input_keyboard_data.return_key_type == ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE) { evas_object_smart_callback_add(entry, "activated", enter_keydown_cb, ad); } if (g_input_keyboard_data.cursor_position_set != 0) { @@ -258,7 +294,6 @@ void create_fullscreen_editor(void *data) elm_box_pack_end(box, entry); Evas_Object *btn = elm_button_add(box); - elm_object_text_set(btn, g_input_keyboard_data.return_key_type.c_str()); evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.5); evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_smart_callback_add(btn, "clicked", btn_clicked_cb, NULL); @@ -313,8 +348,9 @@ static Evas_Object *create_multiline_editfield_layout(Evas_Object *parent, void elm_entry_cursor_end_set(entry); evas_object_smart_callback_add(entry, "focused", editfield_focused_cb, editfield); evas_object_smart_callback_add(entry, "unfocused", editfield_unfocused_cb, editfield); - if (g_input_keyboard_data.return_key_type == string("DONE")) { - elm_entry_input_panel_return_key_type_set(entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE); + elm_entry_input_panel_return_key_type_set(entry, g_input_keyboard_data.return_key_type); + + if (g_input_keyboard_data.return_key_type == ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE) { evas_object_smart_callback_add(entry, "activated", enter_keydown_cb, ad); } if (g_input_keyboard_data.cursor_position_set != 0) {