src/ise-emoticon-mode.cpp
src/cbhm.cpp
src/modeindicator.cpp
+ src/eflutil.cpp
)
SET(ISE_PACKAGE ${PROJECT_NAME})
--- /dev/null
+/*
+ * Copyright (c) 2012 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <Elementary.h>
+
+Evas_Object * create_genlist(Evas_Object *parent)
+{
+ Evas_Object *genlist = elm_genlist_add(parent);
+ evas_object_paragraph_direction_set(genlist, EVAS_BIDI_DIRECTION_NEUTRAL);
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+ evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_genlist_tree_effect_enabled_set(genlist, EINA_FALSE);
+
+ return genlist;
+}
+
+Evas_Object * naviframe_item_push(Evas_Object *naviframe, const char *title, Evas_Object *content, Elm_Naviframe_Item_Pop_Cb pop_cb, void *pop_cb_data, Evas_Smart_Cb back_cb, void *back_cb_data)
+{
+ Evas_Object *back_button = elm_button_add(naviframe);
+ elm_object_style_set(back_button, "naviframe/back_btn/default");
+ if (back_cb)
+ evas_object_smart_callback_add(back_button, "clicked", back_cb, back_cb_data);
+
+ Elm_Object_Item *navi_it = elm_naviframe_item_push(naviframe, title, back_button, NULL, content, NULL);
+#ifdef _WEARABLE
+ elm_naviframe_item_title_enabled_set(navi_it, EINA_FALSE, EINA_FALSE);
+#endif
+ if (pop_cb)
+ elm_naviframe_item_pop_cb_set(navi_it, pop_cb, pop_cb_data);
+
+ return back_button;
+}
+
+static void
+gl_realized_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *it = (Elm_Object_Item *)event_info;
+ if (it == elm_genlist_first_item_get(obj)) {
+ elm_object_item_signal_emit(it, "elm,action,title,slide,start", "elm");
+ }
+}
+
+static char *_title_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ const char *title = (const char *)data;
+ if (!title) return NULL;
+
+ if (!strcmp(part, "elm.text")) {
+ return strdup(title);
+ }
+
+ return NULL;
+}
+
+void add_scrollable_title_area(Evas_Object *genlist, const char *title, Eina_Bool autoscroll)
+{
+ /* Add scrollable title area in wearable profile */
+ Elm_Object_Item *it;
+ Elm_Genlist_Item_Class *ttc = elm_genlist_item_class_new();
+ ttc->item_style = "title";
+ ttc->func.text_get = title ? _title_text_get : NULL;
+ it = elm_genlist_item_append(genlist, ttc, title, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_NONE);
+ elm_genlist_item_class_free(ttc);
+
+ if (autoscroll)
+ evas_object_smart_callback_add(genlist, "realized", gl_realized_cb, NULL);
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2012 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#ifndef __EFL_UTIL_H__
+#define __EFL_UTIL_H__
+
+#include <Elementary.h>
+
+Evas_Object * create_genlist(Evas_Object *parent);
+Evas_Object * naviframe_item_push(Evas_Object *naviframe, const char *title, Evas_Object *content, Elm_Naviframe_Item_Pop_Cb pop_cb, void *pop_cb_data, Evas_Smart_Cb back_cb, void *back_cb_data);
+void add_scrollable_title_area(Evas_Object *genlist, const char *title, Eina_Bool autoscroll);
+
+#endif //__EFL_UTIL_H__
#include "ise.h"
#include "ise-stt-option.h"
#include "ise-stt-mode.h"
+#include "eflutil.h"
#define item_append(obj, style, index, cb, udata) \
elm_genlist_item_append(obj, &(style), (void *)index, NULL, ELM_GENLIST_ITEM_NONE, cb, udata)
extern stt_h g_stt;
static Evas_Object *radio_gp = NULL;
-Evas_Object *g_setting_naviframe = NULL;
-Evas_Object *g_setting_window = NULL;
+static Evas_Object *g_setting_naviframe = NULL;
+static Evas_Object *g_setting_window = NULL;
-#ifdef _WEARABLE
-static Elm_Genlist_Item_Class itc_title;
-#endif
static Elm_Genlist_Item_Class itc_1text;
static Elm_Genlist_Item_Class itc_2text;
-const char* get_lang_label(char lang[]);
+static const char* get_lang_label(char lang[]);
static int get_language_value();
static void set_language_value(int type);
-#ifdef _WEARABLE
-static char *__get_genlist_title_label(void *data, Evas_Object *obj, const char *part);
-#endif
-char *__get_genlist_item_label(void *data, Evas_Object *obj, const char *part);
+static char *__get_genlist_item_label(void *data, Evas_Object *obj, const char *part);
static Evas_Object *__get_genlist_item_content(void *data, Evas_Object *obj, const char *part);
static void language_set_genlist_radio_cb(void *data, Evas_Object *obj, void *event_info);
static Eina_Bool close_setting_window_idler_cb(void *data);
STT_VOICE_N66_KO_KR
} STT_VOICE_LANGUAGE_N66_I;
-const char* get_lang_label(char lang[])
+static const char* get_lang_label(char lang[])
{
const char *str = NULL;
LOGD("stt language (%s)", my_voicedata->kbd_lang);
}
-#ifdef _WEARABLE
-static char *__get_genlist_title_label(void *data, Evas_Object *obj, const char *part)
-{
- return strdup(_("IDS_VOICE_OPT_LANGUAGE_ABB"));
-}
-#endif
-
-char *__get_genlist_item_label(void *data, Evas_Object *obj, const char *part)
+static char *__get_genlist_item_label(void *data, Evas_Object *obj, const char *part)
{
char text[128] = {0, };
int index = 0;
- Elm_Object_Item * item = (Elm_Object_Item *) event_info;
+ Elm_Object_Item * item = (Elm_Object_Item *)event_info;
if (item) {
elm_genlist_item_selected_set(item, 0);
index = (intptr_t)elm_object_item_data_get(item);
{
if (!parent) return NULL;
- Evas_Object *genlist = elm_genlist_add(parent);
+ Evas_Object *genlist = create_genlist(parent);
if (!genlist) return NULL;
- elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
- elm_genlist_homogeneous_set(genlist, EINA_TRUE);
- evas_object_paragraph_direction_set(genlist, EVAS_BIDI_DIRECTION_NEUTRAL);
#ifdef _CIRCLE
Evas_Object *circle_language_genlist = eext_circle_object_genlist_add(genlist, NULL);
eext_circle_object_genlist_scroller_policy_set(circle_language_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
int lang_val = 0;
Elm_Object_Item * item = NULL;
- evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
radio_gp = elm_radio_add(genlist);
elm_radio_state_value_set(radio_gp, -1);
lang_val = get_language_value();
#ifdef _WEARABLE
- //Title
- itc_title.item_style = "title";
- itc_title.func.text_get = __get_genlist_title_label;
- itc_title.func.content_get = NULL;
-
- elm_genlist_item_append(genlist, &itc_title, (void *)-1, NULL, ELM_GENLIST_ITEM_GROUP, NULL, genlist);
+ add_scrollable_title_area(genlist, _("IDS_VOICE_OPT_LANGUAGE_ABB"), EINA_FALSE);
#endif
// 2 line text
itc_2text.func.text_get = __get_genlist_item_label;
itc_2text.func.content_get = __get_genlist_item_content;
-
item = item_append(genlist, itc_2text, (void *)0, language_set_genlist_radio_cb, genlist); // AUTO
if (lang_val == i) {
elm_genlist_item_show(item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
}
- if ( item == NULL ) {
+ if (item == NULL) {
LOGD("elm_genlist_item_append was failed");
}
break;
}
}
- Elm_Object_Item *dummy;
- Elm_Genlist_Item_Class *itc_dummy = elm_genlist_item_class_new();
- if (itc_dummy) {
- itc_dummy->item_style = "title";
- itc_dummy->func.text_get = NULL;
- itc_dummy->func.content_get = NULL;
- }
- dummy = elm_genlist_item_append(genlist, itc_dummy, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
- elm_genlist_item_select_mode_set(dummy, ELM_OBJECT_SELECT_MODE_NONE);
+
+#ifdef _CIRCLE
+ add_scrollable_title_area(genlist, NULL, EINA_FALSE);
+#endif
LOGD("before elm_radio_value_set > lang_val = %d", lang_val);
radio_gp = elm_radio_add(genlist);
genlist = create_language_list(naviframe);
- /* Add a back button to naviframe */
- Evas_Object *back_button = NULL;
char *title = NULL;
- const char *item_style = NULL;
-
#ifdef _MOBILE
- back_button = elm_button_add(naviframe);
- elm_object_style_set(back_button, "naviframe/back_btn/default");
- evas_object_smart_callback_add(back_button, "clicked", _naviframe_back_cb, naviframe);
title = _("IDS_VOICE_OPT_LANGUAGE_ABB");
-#else
- item_style = "empty";
#endif
- elm_naviframe_item_push(naviframe, title, back_button, NULL, genlist, item_style);
+ naviframe_item_push(naviframe, title, genlist, NULL, NULL, _naviframe_back_cb, naviframe);
elm_object_content_set(conformant, naviframe);
#include "utils.h"
#include "option.h"
#include "languages.h"
+#include "eflutil.h"
#undef LOG_TAG
#define LOG_TAG "ISE_DEFAULT"
return NULL;
}
-#ifdef _WEARABLE
-static char *_title_text_get(void *data, Evas_Object *obj, const char *part)
-{
- const char *title = (const char *)data;
- if (!title) return NULL;
-
- if (!strcmp(part, "elm.text")) {
- return strdup(title);
- }
-
- return NULL;
-}
-
-static void
-gl_realized_cb(void *data, Evas_Object *obj, void *event_info)
-{
- Elm_Object_Item *it = (Elm_Object_Item *)event_info;
- if (it == elm_genlist_first_item_get(obj)) {
- elm_object_item_signal_emit(it, "elm,action,title,slide,start", "elm");
- }
-}
-
-static void add_scrollable_title_area(Evas_Object *genlist, const char *title, Eina_Bool autoscroll)
-{
- /* Add scrollable title area in wearable profile */
- Elm_Genlist_Item_Class *ttc = elm_genlist_item_class_new();
- ttc->item_style = "title";
- ttc->func.text_get = _title_text_get;
- elm_genlist_item_append(genlist, ttc, title, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
- elm_genlist_item_class_free(ttc);
-
- if (autoscroll)
- evas_object_smart_callback_add(genlist, "realized", gl_realized_cb, NULL);
-}
-#endif
-
static Eina_Bool _update_check_button_state(Elm_Object_Item *item, Evas_Object *obj)
{
Eina_Bool state = EINA_FALSE;
if (CHECK_ARRAY_INDEX(type, OPTION_WINDOW_TYPE_MAX)) {
create_genlist_item_classes(type);
- genlist = elm_genlist_add(naviframe);
- evas_object_paragraph_direction_set(genlist, EVAS_BIDI_DIRECTION_NEUTRAL);
+ genlist = create_genlist(naviframe);
option_elements[type].genlist = genlist;
#ifdef _CIRCLE
option_elements[type].circle_genlist = circle_genlist;
#endif
- elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
- evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_genlist_tree_effect_enabled_set(genlist, EINA_FALSE);
-
#ifdef _WEARABLE
add_scrollable_title_area(genlist, OPTIONS, EINA_TRUE);
#endif
static Evas_Object* create_option_language_view(Evas_Object *naviframe)
{
- Evas_Object *genlist = elm_genlist_add(naviframe);
- elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
- elm_genlist_homogeneous_set(genlist, EINA_TRUE);
- evas_object_paragraph_direction_set(genlist, EVAS_BIDI_DIRECTION_NEUTRAL);
+ Evas_Object *genlist = create_genlist(naviframe);
SCLOptionWindowType type = find_option_window_type(naviframe);
evas_object_show(genlist);
- Evas_Object *back_button = elm_button_add(naviframe);
- elm_object_style_set(back_button, "naviframe/back_btn/default");
- evas_object_smart_callback_add(back_button, "clicked", language_selection_finished_cb, naviframe);
- Elm_Object_Item *navi_it = elm_naviframe_item_push(naviframe, LANGUAGE, back_button, NULL, genlist, NULL);
-#ifdef _WEARABLE
- elm_naviframe_item_title_enabled_set(navi_it, EINA_FALSE, EINA_FALSE);
-#endif
- elm_naviframe_item_pop_cb_set(navi_it, _pop_cb, naviframe);
+ naviframe_item_push(naviframe, LANGUAGE, genlist, _pop_cb, naviframe, language_selection_finished_cb, naviframe);
return genlist;
}
#ifdef _WEARABLE
static Evas_Object* create_smart_typing_view(Evas_Object *naviframe)
{
- Evas_Object *genlist = elm_genlist_add(naviframe);
- elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
- elm_genlist_homogeneous_set(genlist, EINA_TRUE);
- evas_object_paragraph_direction_set(genlist, EVAS_BIDI_DIRECTION_NEUTRAL);
-
+ Evas_Object *genlist = create_genlist(naviframe);
SCLOptionWindowType type = find_option_window_type(naviframe);
if (CHECK_ARRAY_INDEX(type, OPTION_WINDOW_TYPE_MAX)) {
evas_object_show(genlist);
- Evas_Object *back_button = elm_button_add(naviframe);
- elm_object_style_set(back_button, "naviframe/back_btn/default");
- Elm_Object_Item *navi_it = elm_naviframe_item_push(naviframe, LANGUAGE, back_button, NULL, genlist, NULL);
-#ifdef _WEARABLE
- elm_naviframe_item_title_enabled_set(navi_it, EINA_FALSE, EINA_FALSE);
-#endif
- elm_naviframe_item_pop_cb_set(navi_it, _pop_cb, naviframe);
+ naviframe_item_push(naviframe, LANGUAGE, genlist, _pop_cb, naviframe, NULL, NULL);
return genlist;
}
static Evas_Object* create_feedback_view(Evas_Object *naviframe)
{
- Evas_Object *genlist = elm_genlist_add(naviframe);
- elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
- elm_genlist_homogeneous_set(genlist, EINA_TRUE);
- evas_object_paragraph_direction_set(genlist, EVAS_BIDI_DIRECTION_NEUTRAL);
-
+ Evas_Object *genlist = create_genlist(naviframe);
SCLOptionWindowType type = find_option_window_type(naviframe);
if (CHECK_ARRAY_INDEX(type, OPTION_WINDOW_TYPE_MAX)) {
evas_object_show(genlist);
- Evas_Object *back_button = elm_button_add(naviframe);
- elm_object_style_set(back_button, "naviframe/back_btn/default");
- Elm_Object_Item *navi_it = elm_naviframe_item_push(naviframe, LANGUAGE, back_button, NULL, genlist, NULL);
-#ifdef _WEARABLE
- elm_naviframe_item_title_enabled_set(navi_it, EINA_FALSE, EINA_FALSE);
-#endif
- elm_naviframe_item_pop_cb_set(navi_it, _pop_cb, naviframe);
+ naviframe_item_push(naviframe, LANGUAGE, genlist, _pop_cb, naviframe, NULL, NULL);
return genlist;
}
evas_object_size_hint_align_set(naviframe, EVAS_HINT_FILL, EVAS_HINT_FILL);
Evas_Object *list = create_option_main_view(conformant, naviframe, type);
-
- /* Add a back button to naviframe */
- Evas_Object *back_button = elm_button_add(naviframe);
- option_elements[type].back_button = back_button;
-
- elm_object_style_set(back_button, "naviframe/back_btn/default");
- evas_object_smart_callback_add(back_button, "clicked", navi_back_cb, NULL);
-#ifdef _WEARABLE
- Elm_Object_Item *navi_it = elm_naviframe_item_push(naviframe, OPTIONS, back_button, NULL, list, NULL);
- elm_naviframe_item_title_enabled_set(navi_it, EINA_FALSE, EINA_FALSE);
-#else
- elm_naviframe_item_push(naviframe, OPTIONS, back_button, NULL, list, NULL);
-#endif
+ option_elements[type].back_button = naviframe_item_push(naviframe, OPTIONS, list, NULL, NULL, navi_back_cb, NULL);
elm_object_content_set(conformant, naviframe);