2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <Elementary.h>
22 #include "w-input-selector.h"
24 #define EMOTICON_CNT 27
33 Emoticon emoticon_info[EMOTICON_CNT] = {
34 {0x1f44c, "IDS_IME_BODY_OK_HAND_SIGN_M_EMOTICON_NAME_TTS"},
35 {0x1f44d, "IDS_IME_BODY_THUMBS_UP_SIGN_M_EMOTICON_NAME"},
36 {0x1f44e, "IDS_IME_BODY_THUMBS_DOWN_SIGN_M_EMOTICON_NAME"},
37 {0x1f604, "IDS_IME_BODY_SMILING_FACE_WITH_OPEN_MOUTH_AND_SMILING_EYES_M_EMOTICON_NAME"},
38 {0x1f606, "IDS_IME_BODY_SMILING_FACE_WITH_OPEN_MOUTH_AND_TIGHTLY_CLOSED_EYES_M_EMOTICON_NAME"},
39 {0x1f60a, "IDS_IME_BODY_SMILING_FACE_WITH_SMILING_EYES_M_EMOTICON_NAME"},
40 {0x1f60d, "IDS_IME_BODY_SMILING_FACE_WITH_HEART_SHAPED_EYES_M_EMOTICON_NAME"},
41 {0x1f61a, "IDS_IME_BODY_KISSING_FACE_WITH_CLOSED_EYES_M_EMOTICON_NAME"},
42 {0x1f61c, "IDS_IME_BODY_FACE_WITH_STUCK_OUT_TONGUE_AND_WINKING_EYE_M_EMOTICON_NAME"},
43 {0x1f620, "IDS_IME_BODY_ANGRY_FACE_M_EMOTICON_NAME"},
44 {0x1f621, "IDS_IME_BODY_POUTING_FACE_M_EMOTICON_NAME"},
45 {0x1f622, "IDS_IME_BODY_CRYING_FACE_M_EMOTICON_NAME"},
46 {0x1f624, "IDS_IME_BODY_FACE_WITH_LOOK_OF_TRIUMPH_M_EMOTICON_NAME"},
47 {0x1f625, "IDS_IME_BODY_DISAPPOINTED_BUT_RELIEVED_FACE_M_EMOTICON_NAME"},
48 {0x1f62a, "IDS_IME_BODY_SLEEPY_FACE_M_EMOTICON_NAME"},
49 {0x1f62b, "IDS_IME_BODY_TIRED_FACE_M_EMOTICON_NAME"},
50 {0x1f631, "IDS_IME_BODY_FACE_SCREAMING_IN_FEAR_M_EMOTICON_NAME"},
51 {0x1f632, "IDS_IME_BODY_ASTONISHED_FACE_M_EMOTICON_NAME"},
52 {0x1f637, "IDS_IME_BODY_FACE_WITH_MEDICAL_MASK_M_EMOTICON_NAME"},
53 {0x1f495, "IDS_IME_BODY_TWO_HEARTS_M_EMOTICON_NAME"},
54 {0x1f43d, "IDS_IME_BODY_PIG_NOSE_M_EMOTICON_NAME"},
55 {0x1f415, "IDS_IME_BODY_DOG_M_EMOTICON_NAME"},
56 {0x1f408, "IDS_IME_BODY_CAT_M_EMOTICON_NAME"},
57 {0x1f414, "IDS_IME_BODY_CHICKEN_M_EMOTICON_NAME"},
58 {0x1f433, "IDS_IME_BODY_SPOUTING_WHALE_M_EMOTICON_NAME"},
59 {0x1f43c, "IDS_IME_BODY_PANDA_FACE_M_EMOTICON_NAME"},
60 {0x1f42f, "IDS_IME_BODY_TIGER_FACE_M_EMOTICON_NAME"},
63 const char * get_emoticon_file_name(int index)
65 static string path = get_resource_path() + string("images/u00000.png");
67 int ipos = path.size()-9;
68 char str_emoticon_code[10] = {0};
69 snprintf(str_emoticon_code, sizeof(str_emoticon_code), "%x", emoticon_info[index].code);
71 path.insert(ipos, str_emoticon_code);
75 static Eina_Bool _custom_back_cb(void *data, Elm_Object_Item *it)
77 _back_to_genlist_for_selector();
82 _rotary_selector_rotary_cb(void *data, Evas_Object *obj, Eext_Rotary_Event_Info *info)
84 PRINTFUNC(DLOG_DEBUG, "%s", __func__);
86 if (info->direction == EEXT_ROTARY_DIRECTION_CLOCKWISE){
87 evas_object_smart_callback_call(obj, "item,selected", (void*)data);
88 eext_rotary_object_event_callback_del(obj, _rotary_selector_rotary_cb);
91 return ECORE_CALLBACK_PASS_ON;
94 static void _rotary_selector_item_clicked(void *data, Evas_Object *obj, void *event_info)
96 PRINTFUNC(DLOG_DEBUG, "%s", __func__);
97 App_Data* ad = (App_Data*) data;
101 Eext_Object_Item *selected_item = (Eext_Object_Item *)event_info;
102 Eina_List *rotary_selector_list = (Eina_List *)eext_rotary_selector_items_get(obj);
105 Eina_List *l = rotary_selector_list;
106 Eext_Object_Item *item = (Eext_Object_Item *)eina_list_data_get(l);
108 for (i = 0; l != NULL; i++) {
109 if (selected_item == item)
112 l = eina_list_next(l);
113 item = (Eext_Object_Item *)eina_list_data_get(l);
117 const Eina_Unicode unicode_event[2] = { (unsigned int)emoticon_info[i].code, 0 };
118 char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length);
120 reply_to_sender_by_callback((const char*)utf_8, "emoticon");
122 PRINTFUNC(SECURE_DEBUG, "[%d]%s", i, utf_8);
126 if(ad->reply_type == REPLY_APP_NORMAL)
130 static void _rotary_selector_item_selected(void *data, Evas_Object *obj, void *event_info)
132 PRINTFUNC(DLOG_DEBUG, "%s", __func__);
135 void ise_show_emoticon_popup_rotary(void *data)
137 PRINTFUNC(DLOG_DEBUG, "%s", __func__);
138 App_Data* ad = (App_Data*) data;
143 Evas_Object *rotary_selector = eext_rotary_selector_add(ad->naviframe);
144 // uxt_theme_object_replace_color(rotary_selector, "B01153", "AO0117");
145 PRINTFUNC(DLOG_DEBUG, "replace color");
146 for (int i = 0; i < EMOTICON_CNT; ++i)
148 Evas_Object *img = NULL;
149 Eext_Object_Item *item = eext_rotary_selector_item_append(rotary_selector);
151 img = elm_image_add(rotary_selector);
152 elm_image_file_set(img, get_emoticon_file_name(i), NULL);
153 eext_rotary_selector_item_part_content_set(item, "item,bg_image", EEXT_ROTARY_SELECTOR_ITEM_STATE_NORMAL, img);
155 img = elm_image_add(rotary_selector);
156 elm_image_file_set(img, get_emoticon_file_name(i), NULL);
157 eext_rotary_selector_item_part_content_set(item, "selector,icon", EEXT_ROTARY_SELECTOR_ITEM_STATE_NORMAL, img);
160 evas_object_smart_callback_add(rotary_selector, "item,selected", _rotary_selector_item_selected, rotary_selector);
161 evas_object_smart_callback_add(rotary_selector, "item,clicked", _rotary_selector_item_clicked, (void*)ad);
163 Elm_Object_Item *nf_item = elm_naviframe_item_push(ad->naviframe, NULL, NULL, NULL, rotary_selector, "empty");
164 elm_naviframe_item_pop_cb_set(nf_item, _custom_back_cb, NULL);
165 eext_rotary_object_event_activated_set(rotary_selector, EINA_TRUE);
167 PRINTFUNC(DLOG_DEBUG, "%s", __func__);