Support screen reader
[platform/core/uifw/inputdelegator.git] / src / w-input-selector.cpp
index 05afb39..51a15af 100755 (executable)
@@ -305,13 +305,22 @@ static Evas_Object * __ise_gl_2button_content_get(void *data, Evas_Object *obj,
                        if (!strcmp(first_input_type, "input_voice")) {
                                elm_object_style_set(btn, "ime_button_stt");
                                path_ic = path + "images/w_mode_stt_ic.png";
+                               evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        } else if (!strcmp(first_input_type, "input_emoticon")) {
                                elm_object_style_set(btn, "ime_button_emoticon");
                                path_ic = path + "images/Delta_w_mode_emoticon_ic.png";
+                               evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        } else if (!strcmp(first_input_type, "input_keyboard")) {
                                elm_object_style_set(btn, "ime_button_keyboard");
                                path_ic = path + "images/w_mode_keyboard_ic.png";
                                evas_object_propagate_events_set(btn, EINA_FALSE);
+                               evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        }
                        elm_image_file_set(ic, path_ic.c_str(), NULL);
                        elm_object_content_set(btn, ic);
@@ -321,13 +330,22 @@ static Evas_Object * __ise_gl_2button_content_get(void *data, Evas_Object *obj,
                        if (!strcmp(second_input_type, "input_voice")) {
                                elm_object_style_set(btn, "ime_button_stt");
                                path_ic = path + "images/w_mode_stt_ic.png";
+                               evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        } else if (!strcmp(second_input_type, "input_emoticon")) {
                                elm_object_style_set(btn, "ime_button_emoticon");
                                path_ic = path + "images/Delta_w_mode_emoticon_ic.png";
+                               evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        } else if (!strcmp(second_input_type, "input_keyboard")) {
                                elm_object_style_set(btn, "ime_button_keyboard");
                                path_ic = path + "images/w_mode_keyboard_ic.png";
                                evas_object_propagate_events_set(btn, EINA_FALSE);
+                               evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        }
                        elm_image_file_set(ic, path_ic.c_str(), NULL);
                        elm_object_content_set(btn, ic);
@@ -344,21 +362,33 @@ static Evas_Object * __ise_gl_2button_content_get(void *data, Evas_Object *obj,
                        evas_object_layer_set(btn, 32000);
                        if (!strcmp(first_input_type, "input_voice")) {
                                evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        } else if (!strcmp(first_input_type, "input_emoticon")) {
                                evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        } else if (!strcmp(first_input_type, "input_keyboard")) {
                                evas_object_propagate_events_set(btn, EINA_FALSE);
                                evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        }
                } else if (!strcmp(part, "elm.icon.2.touch_area")){
                        evas_object_layer_set(btn, 32000);
                        if (!strcmp(second_input_type, "input_voice")) {
                                evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        } else if (!strcmp(second_input_type, "input_emoticon")) {
                                evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        } else if (!strcmp(second_input_type, "input_keyboard")) {
                                evas_object_propagate_events_set(btn, EINA_FALSE);
                                evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
+                               elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
+                               elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                        }
                }
                return btn;
@@ -392,6 +422,9 @@ static Evas_Object * __ise_gl_3button_content_get(void *data, Evas_Object *obj,
                        elm_image_file_set(ic, path_ic.c_str(), NULL);
                        elm_object_content_set(btn, ic);
                        evas_object_layer_set(btn, 32000);
+                       evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
+                       elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
+                       elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
 
                } else if (!strcmp(part, "elm.icon.2")){
                        elm_object_style_set(btn, "ime_button_emoticon");
@@ -399,6 +432,9 @@ static Evas_Object * __ise_gl_3button_content_get(void *data, Evas_Object *obj,
                        elm_image_file_set(ic, path_ic.c_str(), NULL);
                        elm_object_content_set(btn, ic);
                        evas_object_layer_set(btn, 32000);
+                       evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
+                       elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
+                       elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
 
                } else if (!strcmp(part, "elm.icon.3")){
                        elm_object_style_set(btn, "ime_button_keyboard");
@@ -407,6 +443,9 @@ static Evas_Object * __ise_gl_3button_content_get(void *data, Evas_Object *obj,
                        elm_object_content_set(btn, ic);
                        evas_object_layer_set(btn, 32000);
                        evas_object_propagate_events_set(btn, EINA_FALSE);
+                       evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
+                       elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
+                       elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                }
 
                return btn;
@@ -419,14 +458,20 @@ static Evas_Object * __ise_gl_3button_content_get(void *data, Evas_Object *obj,
                if (!strcmp(part, "elm.icon.1.touch_area")) {
                        evas_object_layer_set(btn, 32000);
                        evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
+                       elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
+                       elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
 
                } else if (!strcmp(part, "elm.icon.2.touch_area")){
                        evas_object_layer_set(btn, 32000);
                        evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
+                       elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
+                       elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                } else if (!strcmp(part, "elm.icon.3.touch_area")) {
                        evas_object_layer_set(btn, 32000);
                        evas_object_propagate_events_set(btn, EINA_FALSE);
                        evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
+                       elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
+                       elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
                }
 
                return btn;
@@ -462,6 +507,39 @@ static void __ise_gl_lang_changed(void *data, Evas_Object *obj, void *event_info
        elm_genlist_realized_items_update(obj);
 }
 
+static char * __ise_drawing_text_get(void *data, Evas_Object *obj, const char *part)
+{
+       if(!strcmp(part, "elm.text")) {
+               return(strdup(gettext("WDS_IME_MBODY_DRAWING_M_EMOTICON_ABB")));
+       }
+       return NULL;
+}
+
+static Evas_Object * __ise_drawing_content_get(void *data, Evas_Object *obj, const char *part)
+{
+       if (!strcmp(part, "elm.icon")) {
+               Evas_Object* btn = elm_button_add(obj);
+               evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+               evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+               Evas_Object* ic = elm_image_add(btn);
+               elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE);
+               string path = get_resource_path();
+               if (_WEARABLE)
+                       path = path + "wearable/";
+               else if (_TV)
+                       path = path + "tv/";
+               else
+                       path = path + "mobile/";
+               elm_object_style_set(btn, "ime_button_drawing");
+               string path_ic = path + "images/wi_drawing_icon.png";
+               elm_image_file_set(ic, path_ic.c_str(), NULL);
+               elm_object_content_set(btn, ic);
+               evas_object_layer_set(btn, 32000);
+               return btn;
+       }
+       return NULL;
+}
+
 void set_source_caller_app_id(app_control_h app_control)
 {
        if (!app_control){
@@ -710,15 +788,6 @@ static void _item_position_changed_cb(void *data, Evas_Object *obj, void *event_
        }
 }
 
-static char *
-_main_menu_title_text_get(void *data, Evas_Object *obj, const char *part)
-{
-       char buf[1024];
-
-       snprintf(buf, 1023, "%s", "Select method");
-       return strdup(buf);
-}
-
 void _create_genlist_items(void* user_data)
 {
        App_Data* app_data = (App_Data*) user_data;
@@ -732,8 +801,8 @@ void _create_genlist_items(void* user_data)
        elm_genlist_clear(app_data->genlist);
 
        Elm_Genlist_Item_Class * itc0 = elm_genlist_item_class_new();
-       itc0->item_style = "title";
-       itc0->func.text_get = _main_menu_title_text_get;
+       itc0->item_style = NULL;
+       itc0->func.text_get = NULL;
        itc0->func.content_get = NULL;
        itc0->func.state_get = NULL;
        itc0->func.del = NULL;
@@ -894,7 +963,7 @@ unsigned int _update_smartreply_items(void *user_data)
                        reply = input_smartreply_get_nth_item(i, &type);
                        if (reply == NULL)
                                continue;
-                       PRINTFUNC(DLOG_DEBUG, "SmartReply = [%d]%s", i, reply);
+                       SECURE_LOGD("SmartReply = [%d]%s", i, reply);
 
                        for (j = 0; j < template_list.size(); j++) {
                                const char *template_str;
@@ -930,6 +999,15 @@ unsigned int _update_smartreply_items(void *user_data)
        return item_size;
 }
 
+static void _drawing_item_clicked_cb(void *data, Evas_Object * obj, void *event_info)
+{
+       PRINTFUNC(DLOG_DEBUG, "%s", __func__);
+       App_Data* ad = (App_Data*) data;
+       if (!ad)
+               return;
+
+       launch_drawing_app(ad);
+}
 
 unsigned int _update_template_items(void *user_data)
 {
@@ -998,6 +1076,42 @@ unsigned int _update_template_items(void *user_data)
                        item_size++;
                }
                elm_genlist_item_class_free(itc);
+
+               // drawing button (+)
+               if (app_data->mime_type == MIME_TYPE_ALL) {
+                       Elm_Genlist_Item_Class *itc;
+                       itc = elm_genlist_item_class_new();
+
+                       itc->item_style = "1text.1icon";
+                       itc->func.text_get = __ise_drawing_text_get;;
+                       itc->func.content_get = __ise_drawing_content_get;
+                       itc->func.state_get = NULL;
+                       itc->func.del = NULL;
+
+                       elm_genlist_item_append(app_data->genlist,
+                                       itc,
+                                       NULL,
+                                       NULL,
+                                       ELM_GENLIST_ITEM_NONE,
+                                       _drawing_item_clicked_cb,
+                                       app_data);
+
+                       elm_genlist_item_class_free(itc);
+               }
+
+               // dummy item for empty space
+               Elm_Genlist_Item_Class * itc0 = elm_genlist_item_class_new();
+               itc0->item_style = "title";
+               itc0->func.text_get = NULL;
+               itc0->func.content_get = NULL;
+               itc0->func.state_get = NULL;
+               itc0->func.del = NULL;
+
+               it_empty = elm_genlist_item_append(app_data->genlist, itc0,
+                               NULL, NULL,
+                               ELM_GENLIST_ITEM_NONE,
+                               NULL, NULL);
+               elm_genlist_item_class_free(itc0);
        }
 
        return item_size;