/*
* setting
- * Copyright (c) 2012 Samsung Electronics Co., Ltd.
*
- * Licensed under the Flora License, Version 1.1 (the License);
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
+ *
+ * Contact: MyoungJune Park <mj2004.park@samsung.com>
+ *
+ * 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://floralicense.org/license/
+ * 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,
+ * 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 <setting-common-draw-widget.h>
#include <glib.h>
#include <utilX.h>
#include <Ecore_X.h>
-
#include <efl_assist.h>
+#if SUPPORT_HELPUI
+#include <libhelpui.h>
+#endif
/**
* Hide the input pannel
*
* @param[in] entry
*/
+EXPORT_PUBLIC
void setting_hide_input_pannel_cb(Evas_Object *entry)
{
ret_if(entry == NULL);
}
}
+EXPORT_PUBLIC
Evas_Object *setting_create_button(Evas_Object *parent, const char *btn_str,
const char *btn_style,
setting_call_back_func btn_click_cb,
void *cb_data)
{
+ LAUNCH_SETTING_IN();
retv_if(!parent || !btn_str, NULL);
if ('\0' == btn_str[0]) {//Empty rectangle
return setting_create_blank_rect_customize(parent,
elm_object_style_set(button, btn_style);
}
- if (0 != safeStrCmp(NAVI_BACK_BUTTON_STYLE, btn_style)) {//not '<-' button
- elm_object_text_set(button, btn_str);
+ if (0 != safeStrCmp("naviframe/end_btn/default", btn_style)) {//not '<-' button
+ elm_object_text_set(button, _(btn_str));
evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(button,EVAS_HINT_FILL, 0.5);
btn_click_cb, cb_data);
}
evas_object_show(button);
+ LAUNCH_SETTING_OUT();
return button;
}
+static double _step_size_calculate(Evas_Object *obj, double min, double max)
+{
+ double step = 0.0;
+ int steps = 0;
+
+ steps = max - min;
+ if(steps)
+ step = (1.0/steps);
+
+ return step;
+}
+
/**
* To create slider object of a genlist item
*
*@return a slider container object
*/
-Evas_Object *setting_create_slider(Evas_Object *parent, Evas *evas,
+EXPORT_PUBLIC Evas_Object *setting_create_slider(Evas_Object *parent, Evas *evas,
const char *l_swallow_path,
const char *r_swallow_path, double value,
bool indicator, double slider_min, double slider_max,
if(indicator)
{
elm_slider_indicator_format_set(slider, "%1.0f");
- }
- else
- {
+ elm_slider_indicator_show_set(slider, 1);
+ } else {
/* for brightness slider */
- elm_slider_indicator_show_set(slider, EINA_FALSE);
-#if DISABLED_CODE
- elm_object_style_set(slider, "ebook");
-#endif
+ elm_slider_indicator_show_set(slider, 0);
+ elm_object_style_set(slider,"tap_to_drag");
}
evas_object_size_hint_weight_set(slider, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(slider, EVAS_HINT_FILL, 0.5);
+ double step = _step_size_calculate(slider, slider_min, slider_max);
+ elm_slider_step_set(slider, step);
+
+ SETTING_TRACE("slider_change_cb:%p", slider_change_cb);
if (slider_change_cb)
evas_object_smart_callback_add(slider, "changed", slider_change_cb, cb_data);
if(slider_start_change_cb)
evas_object_smart_callback_add(slider, "slider,drag,start", slider_start_change_cb, cb_data);
- Evas_Object *icon1 = elm_icon_add(slider);
- elm_icon_file_set(icon1, l_swallow_path, NULL);
- evas_object_size_hint_aspect_set(icon1, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
-
- Evas_Object *icon2 = elm_icon_add(slider);
- elm_icon_file_set(icon2, r_swallow_path, NULL);
- evas_object_size_hint_aspect_set(icon2, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ if(l_swallow_path)
+ {
+ Evas_Object *icon1 = elm_icon_add(slider);
+ elm_image_file_set(icon1, l_swallow_path, NULL);
+ evas_object_size_hint_aspect_set(icon1, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ elm_object_content_set(slider, icon1);
+ }
- elm_object_content_set(slider, icon1);
- elm_object_part_content_set(slider, "end", icon2);
+ if(r_swallow_path)
+ {
+ Evas_Object *icon2 = elm_icon_add(slider);
+ elm_image_file_set(icon2, r_swallow_path, NULL);
+ evas_object_size_hint_aspect_set(icon2, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ elm_object_part_content_set(slider, "end", icon2);
+ }
elm_slider_min_max_set(slider, slider_min, slider_max);
elm_slider_value_set(slider, value);
/**
* The main implement body of create a certain size icon
*/
+EXPORT_PUBLIC
void create_image_box_add_ex(void *data, Evas_Object *win_main, Evas *evas,
char *img_path, int img_w, int img_h,
Evas_Object_Event_Cb mouse_down_cb,
evas_object_image_load_size_set(*img, temp_w, temp_h);
evas_object_image_fill_set(*img, 0, 0, temp_w, temp_h);
- evas_object_size_hint_min_set(*img, temp_w, temp_h);
+ evas_object_size_hint_min_set(*img, ELM_SCALE_SIZE(temp_w), ELM_SCALE_SIZE(temp_h));
evas_object_show(*img);
evas_object_event_callback_add(*img, EVAS_CALLBACK_MOUSE_DOWN,
* @return a image container object
*/
+EXPORT_PUBLIC
Evas_Object *create_image_box_add(void *data, Evas_Object *win_main,
Evas *evas, char *img_path, int img_w,
int img_h, Evas_Object_Event_Cb mouse_down_cb,
* @return a image container object
*/
+EXPORT_PUBLIC
Evas_Object *create_bgimage_box_add(void *data, Evas_Object *win_main, Evas *evas, char *img_path, int img_w, int img_h, /* if img_w<0 or img_h <0, load the image as it's own size */
Evas_Object_Event_Cb mouse_down_cb,
Evas_Object_Event_Cb mouse_up_cb)
*
* @return a box container
*/
+EXPORT_PUBLIC
Evas_Object *setting_create_client_bx(Evas_Object *win_main)
{
Evas_Object *client_bx = NULL;
}
+EXPORT_PUBLIC
Evas_Object *setting_create_lable(Evas_Object *parent, const char *text,
const char *style, const char *align)
{
return label;
}
-#define DEMO_STEP 0.4
+#define DEMO_STEP 0.8
typedef struct _setting_gif_data{
Ecore_Timer *update_timer;
const char **png_list;
Evas_Object *gif = data;
setting_gif_data *gif_data = evas_object_data_get(gif, "gif_data");
retv_if(!gif_data, FALSE);
- SETTING_TRACE_BEGIN;
+ //SETTING_TRACE_BEGIN;
gif_data->cur_png_idx++;
if (NULL == gif_data->png_list[gif_data->cur_png_idx]) { //the last element of current array.
return TRUE;
}
+EXPORT_PUBLIC
Evas_Object *setting_create_image(Evas_Object *parent, const char *img_path)
{
Evas_Object *image = elm_image_add(parent);
return image;
}
+EXPORT_PUBLIC
+Evas_Object *setting_create_image_with_round_corner(Evas *evas, const char *img_path, int w, int h)
+{
+ Evas_Object *image = evas_object_image_add(evas);
+ evas_object_size_hint_weight_set(image, 0.0, EVAS_HINT_EXPAND);
+ evas_object_image_load_size_set(image, w, h);
+ evas_object_image_file_set(image, img_path, NULL);
+
+ evas_object_image_fill_set(image, 0, 0, w, h);
+
+ /*Set the dimensions for an image object's border, a region which @b
+ * @param obj The given image object.
+ * @param l The border's left width.
+ * @param r The border's right width.
+ * @param t The border's top width.
+ * @param b The border's bottom width.
+ */
+ evas_object_image_border_set(image, 16, 16, 16, 16); //for round corner
+ evas_object_image_filled_set(image, 1); //to full fill
+ evas_object_size_hint_min_set(image, ELM_SCALE_SIZE(w), ELM_SCALE_SIZE(h));
+ evas_object_size_hint_max_set(image, w, h);
+ return image;
+}
+
/* @png_list is an array end with 'NULL'. like ,
const char *png_list[] = {
SETTING_ICON_PATH_CFG"motions/motion_overturn_01.png",
NULL //must end with 'NULL'
};
*/
+EXPORT_PUBLIC
Evas_Object *setting_create_gif(Evas_Object *parent, const char **png_list)
{
retv_if(!png_list, NULL);
}
gif_data->update_timer = ecore_timer_add(DEMO_STEP, (Ecore_Task_Cb)__gif_updater, gif);
+ setting_decorate_image(gif, "W011");//W011:bg, T051:text
return gif;
}
* @return 0: sucess, other: failed
*/
+EXPORT_PUBLIC
int setting_reset_slp_key_by_status(Evas_Object *obj,
setting_bool_slp_list key)
{
/**
* Alternate the check object status and its binded vcof value via original vcofn value
*/
+EXPORT_PUBLIC
int setting_draw_onoff_status(Evas_Object *obj, setting_bool_slp_list key)
{
int value;
* Set the status of check object via its binded vconf value.
* @return 0: sucess, other: failed
*/
+EXPORT_PUBLIC
int setting_check_onoff_status(Evas_Object *obj, setting_bool_slp_list key)
{
int value = 0;
* Set the status of radio group object via its binded vconf value.
* @return 0: sucess, other: failed
*/
+EXPORT_PUBLIC
int setting_update_chk_status(Evas_Object *chk, setting_int_slp_list type)
{
SETTING_TRACE_BEGIN;
* Create a size specilized rectangle object
* @return a size specilized rectangle object
*/
+EXPORT_PUBLIC
Evas_Object *setting_create_blank_rect_customize(Evas_Object *layout, int w,
int h)
{
Evas_Object *rect;
rect = evas_object_rectangle_add(evas_object_evas_get(layout));
- evas_object_size_hint_min_set(rect, w, h);
+ evas_object_size_hint_min_set(rect, ELM_SCALE_SIZE(w), ELM_SCALE_SIZE(h));
evas_object_size_hint_weight_set(rect, EVAS_HINT_EXPAND, 0);
- evas_object_color_set(rect, 0, 0, 0, 0);
+ //evas_object_color_set(rect, 0, 0, 0, 0);
+ evas_object_color_set(rect, 8, 8, 8, 8);
return rect;
}
*
* @return a size fixed rectangle object
*/
+EXPORT_PUBLIC
Evas_Object *setting_create_blank_rect(Evas_Object *layout)
{
return setting_create_blank_rect_customize(layout,
* The API to Create an editfiled object
* @return an editfiled object
*/
+EXPORT_PUBLIC
Evas_Object * /* multi-line is default, use elm_editfield_entry_single_line_set(ef, EINA_TRUE) to set single-line */
-setting_create_editfiled(Evas_Object *win_main, char *title, char *def_str)
+setting_create_editfiled(Evas_Object *win_main, char *title, char *def_str, char *guide_text)
{
Evas_Object *layout = NULL;
Evas_Object *entry = NULL;
if (def_str && safeStrLen(def_str) > 0) {
elm_entry_entry_set(entry, def_str);
} else {
- elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
+ if (guide_text) {
+ elm_object_part_text_set(layout, "elm.guidetext", _(guide_text));
+ } else {
+ elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
+ }
}
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, 0);
*
* @return a text box, which cannot be edited
*/
+EXPORT_PUBLIC
Evas_Object *setting_create_textbox(Evas_Object *parent, const char *content)
{
Evas_Object *obj = NULL;
*
* @param[in] obj
*/
+EXPORT_PUBLIC
void setting_disable_evas_object(Evas_Object *obj)
{ /* layout\genlist\scroller\elm_entry etc.. */
if (obj) {
*
* @param[in] obj
*/
+EXPORT_PUBLIC
void setting_enable_evas_object(Evas_Object *obj)
{
if (obj) {
* @param[in] w
* @param[in] h
*/
+EXPORT_PUBLIC
void setting_resize_object(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{
if (obj) {
- evas_object_size_hint_min_set(obj, w, h);
+ evas_object_size_hint_min_set(obj, ELM_SCALE_SIZE(w), ELM_SCALE_SIZE(h));
evas_object_size_hint_max_set(obj, w, h);
evas_object_resize(obj, w, h);
}
* @param[in] bg_style
* @return bg object
*/
+EXPORT_PUBLIC
Evas_Object *setting_create_bg(Evas_Object *parent,Evas_Object *win, const char *bg_style)
{
retv_if(!parent, NULL);
Evas_Object *bg = elm_bg_add(parent);
retv_if(!bg, NULL);
- elm_object_style_set(bg, bg_style);
+ if (bg_style) elm_object_style_set(bg, bg_style);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
//elm_win_resize_object_add(win, bg);
* 1:the appearence of obj is made up of transparent backgroud color.
* 0:the appearence of obj is made up of non transparent color.
*/
+EXPORT_PUBLIC
void setting_undo_dim_evas_object(Evas_Object *obj, bool b_transparenct)
{
if (obj) {
* 1:the appearence of obj is made up of transparent backgroud color.
* 0:the appearence of obj is made up of non transparent color.
*/
+EXPORT_PUBLIC
void setting_dim_evas_object(Evas_Object *obj, bool b_transparenct)
{
if (obj) {
static void __btn_select_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
+ //SETTING_TRACE_BEGIN;
setting_dim_evas_object(obj, FALSE);
+ retm_if(event_info == NULL, "Invalid argument: event info is NULL");
+ retm_if(data == NULL, "Invalid argument: data is NULL");
+ Evas_Event_Mouse_Down *ev = (Evas_Event_Mouse_Down *)event_info;
+ Evas_Point *point_down = data;
+ point_down->x = ev->output.x;
+ point_down->y = ev->output.y;
}
static void __btn_release_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
+ //SETTING_TRACE_BEGIN;
+ setting_undo_dim_evas_object(obj, FALSE);
+}
+
+static void __btn_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ //SETTING_TRACE_BEGIN;
+ retm_if(event_info == NULL, "Invalid argument: event info is NULL");
+ retm_if(data == NULL, "Invalid argument: data is NULL");
+ Evas_Point *point_down = data;
+ Evas_Event_Mouse_Move*ev = (Evas_Event_Mouse_Move*)event_info;
+ int x_offset = ev->cur.output.x - point_down->x;
+ int y_offset = ev->cur.output.y - point_down->y;
+ if(x_offset < 0) x_offset = -x_offset;
+ if(y_offset < 0) y_offset = -y_offset;
+ if (x_offset <= MIN_MOVE_DISTANCE && y_offset <= MIN_MOVE_DISTANCE)
+ {
+ return;
+ }
setting_undo_dim_evas_object(obj, FALSE);
}
+static void __btn_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ //SETTING_TRACE_BEGIN;
+ ret_if(!data);
+ Evas_Point *point_down = data;
+ FREE(point_down);//delete the date.
+}
/**
* To make an object looks clickable: if pressed, it is dim color;if unpressed, it is normal color;
*
* @param[in] obj
*/
+EXPORT_PUBLIC
void setting_make_evas_object_clickable(Evas_Object *obj)
{
if (obj) {
- evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN, __btn_select_cb, NULL);
+ Evas_Point *point_down = calloc(1,sizeof(Evas_Point));
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN, __btn_select_cb, point_down);
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_UP, __btn_release_cb, NULL);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_MOVE, __btn_mouse_move_cb, point_down);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, __btn_del_cb, point_down);
}
}
* @param[in] move_cb
* @param[in] data
*/
+EXPORT_PUBLIC
Evas_Object *setting_create_icon(Evas_Object *parent, const char *img_path,
Evas_Object_Event_Cb up_cb,
Evas_Object_Event_Cb down_cb,
retv_if(!parent || !img_path, NULL);
Evas_Object *icon = elm_icon_add(parent);
retvm_if(!icon, NULL, "Failed Create icon!");
- elm_icon_file_set(icon, img_path, NULL);
+ elm_image_file_set(icon, img_path, NULL);
setting_make_evas_object_clickable(icon);
if (up_cb) {
* @param[in] move_cb
* @param[in] data
*/
+EXPORT_PUBLIC
Evas_Object *setting_create_image_button(Evas_Object *parent,
const char *btn_img,
setting_call_back_func clicked_cb,
if (btn_img) {
Evas_Object *icon = elm_icon_add(parent);
retvm_if(!icon, NULL, "Failed Create icon!");
- elm_icon_file_set(icon, btn_img, NULL);
+ elm_image_file_set(icon, btn_img, NULL);
elm_object_part_content_set(btn, "elm.swallow.content", icon);
setting_make_evas_object_clickable(btn);
}
return btn;
}
+EXPORT_PUBLIC void setting_entry_entry_set(Evas_Object *entry, const char *text, const int font_size)
+{
+ if(isEmptyStr(text)) return;
+ if(entry){
+ char buf[200];
+ if (font_size > 0){
+ snprintf(buf, sizeof(buf), "DEFAULT='font_size=%d'",font_size);
+ }
+ elm_entry_text_style_user_push(entry, buf);
+ elm_entry_entry_set(entry,text);
+ }
+}
/*
* @param[in] color
* @param[in] align :may be right, left, middle/center
*/
+EXPORT_PUBLIC
char *setting_customize_text(const char *input_str, const int font_size,
const char *color, const char *align)
{
- SETTING_TRACE_BEGIN;
+ //SETTING_TRACE_BEGIN;
retv_if(isEmptyStr(input_str), NULL);
- SETTING_TRACE("input_str:%s, color:%s", input_str, color);
+ //SETTING_TRACE("input_str:%s, color:%s", input_str, color);
char speciliztion[MAX_SPECIALIZITION_LEN] = { 0, };
//<font_size=%d><align=middle><color=#9C9C9C>bbb</color></align></font_size>
if (font_size > 0)
g_strlcat(speciliztion, "</font_size>", MAX_SPECIALIZITION_LEN);
}
- SETTING_TRACE("Exit %s, return :%s", __FUNCTION__, speciliztion);
+ //SETTING_TRACE("Exit %s, return :%s", __FUNCTION__, speciliztion);
return (char *)strdup(speciliztion);;
}
+//if pass traits=" ",means make tts omit the traits-reading
+EXPORT_PUBLIC
+void setting_set_tts_info(Evas_Object* obj, const char* label,
+ const char* traits, const char *state,
+ const char* guide)
+{
+ //ret_if(!obj);
+ if (!obj)
+ {
+ return;
+ }
+ //SETTING_TRACE("label:%s,traits:%s,state:%s,guide:%s", label, traits,state,guide);
+ if (label)
+ elm_access_info_set(obj, ELM_ACCESS_INFO, label);
+
+ if (traits)// && isEmptyStr(elm_access_info_get(obj, ELM_ACCESS_TYPE)))
+ elm_access_info_set(obj, ELM_ACCESS_TYPE, traits);
+
+ if (state)
+ elm_access_info_set(obj, ELM_ACCESS_STATE, state);
+ if (guide)
+ {
+ elm_access_info_set(obj, ELM_ACCESS_CONTEXT_INFO, NULL);
+ elm_access_info_set(obj, ELM_ACCESS_CONTEXT_INFO, guide);
+ }
+}
+
+EXPORT_PUBLIC
+void __toogle_gl_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ /* SETTING_TRACE_BEGIN; */
+ retm_if(event_info == NULL, "Invalid argument: event info is NULL");
+ Elm_Object_Item *item = (Elm_Object_Item *) event_info;
+ elm_genlist_item_selected_set(item, 0);
+ Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
+ ret_if(!list_item);
+
+ /* new status */
+ setting_update_gl_item_chk_status(list_item, !(list_item->chk_status));
+ //int err = 0;
+ //int ret = setting_set_bool_slp_key(list_item->int_slp_setting_binded, list_item->chk_status, &err);
+ const char *use_vconf = (char *)(list_item->int_slp_setting_binded);
+ int ret = vconf_set_bool(use_vconf, list_item->chk_status);
+
+ setting_retm_if(0 != ret, "Failed to set vconf [%s]", list_item->int_slp_setting_binded);
+}
+
+
+EXPORT_PUBLIC
+void __toogle_chk_changed(void *data, Evas_Object *obj, void *event_info)
+{
+ retm_if(data == NULL, "Data parameter is NULL");
+ Setting_GenGroupItem_Data *list_item =
+ (Setting_GenGroupItem_Data *) data;
+ list_item->chk_status = elm_check_state_get(obj); /* for update */
+
+ //int err = 0;
+ //int ret = setting_set_bool_slp_key(list_item->int_slp_setting_binded, list_item->chk_status, &err);
+ const char *use_vconf = (char *)(list_item->int_slp_setting_binded);
+ int ret = vconf_set_bool(use_vconf, list_item->chk_status);
+ if (0 != ret) //rollback
+ {
+ setting_update_gl_item_chk_status(list_item, !(list_item->chk_status));
+ return;
+ }
+}
+
+EXPORT_PUBLIC void setting_conformant_keypad_state(Evas_Object *win_main, bool enable)
+{
+ Evas_Object *conform = evas_object_data_get(win_main, "conformant");
+ if (conform) {
+ SETTING_TRACE("conformant keypad %d", enable);
+ if(enable) {
+ elm_object_signal_emit(conform, "elm,state,virtualkeypad,enable", "");
+ elm_object_signal_emit(conform, "elm,state,clipboard,enable", "");
+ }
+ else {
+ elm_object_signal_emit(conform, "elm,state,virtualkeypad,disable", "");
+ elm_object_signal_emit(conform, "elm,state,clipboard,disable", "");
+ }
+ }
+}
+
+static void __title_btn_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+
+{
+ SETTING_TRACE_BEGIN;
+ ret_if(!obj);
+ evas_object_data_set(obj, "text", NULL);
+}
+
+EXPORT_PUBLIC Evas_Object *setting_create_navibar_title_text_btn(Evas_Object *parent, const char *text, Evas_Smart_Cb func, void *data)
+{
+ Evas_Object *btn = elm_button_add(parent);
+ if (!btn){
+ return NULL;
+ }
+ elm_object_style_set(btn, "naviframe/title_text");
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_DEL, __title_btn_del_cb, NULL);
+ if(text){
+ elm_object_text_set(btn, _(text));
+ evas_object_data_set(btn, "text", text);
+ }
+ if(func){
+ evas_object_smart_callback_add(btn, "clicked", func, data);
+ }
+ return btn;
+}
+
+#if SUPPORT_HELPUI
+EXPORT_PUBLIC void setting_help_popup_circle_block_create(Evas_Object *win, Evas_Object * parent, Evas_Object ** circle,
+ Evas_Object ** popup, char *string_id, int x, int y, Evas_Coord_Rectangle * rect)
+{
+ helpui_set_block_win(win);
+ setting_help_popup_circle_unblock_create(parent, circle, popup, string_id, x, y);
+ helpui_set_unblock_rect(win, rect);
+}
+
+EXPORT_PUBLIC void setting_help_popup_circle_block_move(Evas_Object *win, Evas_Object * circle, Evas_Object * popup, int x,
+ int y, Evas_Coord_Rectangle * rect)
+{
+ helpui_set_unblock_win(win);
+ helpui_set_block_win(win);
+ evas_object_move(circle, x, y);
+ evas_object_move(popup, x, y + 10);
+ helpui_set_unblock_rect(win, rect);
+}
+
+static void __help_popup_language_change_cb(void *data, Evas_Object * obj, void *source)
+{
+ char *string_id = (char *)data;
+ char *message = _(string_id);
+ helpui_set_popup_text(obj, message);
+}
+
+EXPORT_PUBLIC void setting_help_popup_circle_unblock_create(Evas_Object * parent, Evas_Object ** circle,
+ Evas_Object ** popup, char *string_id, int x, int y)
+{
+ *circle = helpui_add_circle(parent, HELP_CIRCLE_BIG);
+ evas_object_move(*circle, x, y);
+ char *message = _(string_id);
+ *popup = helpui_add_popup(parent, message, HELP_POPUP_WITH_ARROW, NULL, NULL);
+ helpui_set_popup_language_changed_cb(*popup, __help_popup_language_change_cb,
+ string_id);
+ evas_object_move(*popup, x, y + 8);
+}
+
+EXPORT_PUBLIC void setting_help_popup_circle_block_delete(Evas_Object *win, Evas_Object ** circle, Evas_Object ** popup)
+{
+ helpui_set_unblock_win(win);
+ if (*circle) {
+ evas_object_del(*circle);
+ *circle = NULL;
+ }
+ if (*popup) {
+ evas_object_del(*popup);
+ *popup = NULL;
+ }
+}
+
+EXPORT_PUBLIC void setting_help_popup_block_create(Evas_Object *win, Evas_Object * parent,
+ Evas_Object ** popup, char *string_id, int x, int y, Evas_Coord_Rectangle * rect)
+{
+ helpui_set_block_win(win);
+ setting_help_popup_unblock_create(parent, popup, string_id, x, y);
+ if (rect != NULL) {
+ helpui_set_unblock_rect(win, rect);
+ }
+}
+
+EXPORT_PUBLIC void setting_help_popup_block_move(Evas_Object *win, Evas_Object * popup, int x, int y,
+ Evas_Coord_Rectangle * rect)
+{
+ helpui_set_unblock_win(win);
+ helpui_set_block_win(win);
+ evas_object_move(popup, x, y);
+ if (rect != NULL) {
+ helpui_set_unblock_rect(win, rect);
+ }
+}
+
+EXPORT_PUBLIC void setting_help_popup_unblock_create(Evas_Object * parent,
+ Evas_Object ** popup, char *string_id, int x, int y)
+{
+ char *message = _(string_id);
+ *popup = helpui_add_popup(parent, message, HELP_POPUP_WITHOUT_ARROW, NULL, NULL);
+ helpui_set_popup_language_changed_cb(*popup, __help_popup_language_change_cb,
+ string_id);
+ evas_object_move(*popup, x, y);
+}
+#endif
+
+#define MIN_SWIP_DISTANCE_X 300
+#define MIN_SWIP_DISTANCE_Y 75
+
+static void __tabbar_mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ //SETTING_TRACE_BEGIN;
+ retm_if(event_info == NULL, "Invalid argument: event info is NULL");
+ retm_if(data == NULL, "Invalid argument: data is NULL");
+ Evas_Event_Mouse_Down *ev = (Evas_Event_Mouse_Down *)event_info;
+ Evas_Point *point_down = data;
+ point_down->x = ev->output.x;
+ point_down->y = ev->output.y;
+}
+
+static void __tabbar_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ //SETTING_TRACE_BEGIN;
+ retm_if(event_info == NULL, "Invalid argument: event info is NULL");
+ retm_if(data == NULL, "Invalid argument: data is NULL");
+ Evas_Point *point_down = data;
+ Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up*)event_info;
+
+ int x_offset = ev->output.x - point_down->x;
+ int y_offset = ev->output.y - point_down->y;
+
+ bool skip = TRUE;
+
+ Evas_Object *navi = NULL;
+ Elm_Object_Item *top_item = NULL;
+ Evas_Object *eo_view = NULL;
+ Evas_Object *tabbar = NULL;
+ //char *tabbar_t = NULL;
+ if ((navi = elm_object_part_content_get(obj, "elm.swallow.content"))
+ && (top_item = elm_naviframe_top_item_get(navi)))
+ {
+ //SETTING_TRACE("top_item:%p", top_item);
+ if ((eo_view = elm_object_item_content_get(top_item))
+ && (tabbar = elm_object_part_content_get(eo_view, "elm.swallow.tabbar"))
+ && 0 == safeStrCmp(evas_object_type_get(tabbar), "elm_toolbar"))
+ {
+ //SETTING_TRACE("Skip Case 1");
+ skip = FALSE;
+ }
+
+ if (skip && (tabbar = elm_object_item_part_content_get(top_item, "tabbar"))
+ && 0 == safeStrCmp(evas_object_type_get(tabbar), "elm_toolbar"))
+ {
+ //SETTING_TRACE("Skip case 2");
+ skip = FALSE;
+ }
+ }
+ if(skip)
+ return;
+ //SETTING_TRACE("tabbar:%p", tabbar);
+
+ //SETTING_TRACE("SWIPE VALUE : x=(%d) : y=(%d)", x_offset, y_offset);
+ if(-x_offset > MIN_SWIP_DISTANCE_X && abs(y_offset) < MIN_SWIP_DISTANCE_Y )
+ {
+
+ //SETTING_TRACE("swipe to right : %d : %d", x_offset, y_offset);
+ //swip right
+ //if(swip_data->cb)
+ // swip_data->cb(cb_data, SETTING_SWIP_RIGHT);
+ Elm_Object_Item *cur_item = elm_toolbar_selected_item_get(tabbar);
+ //SETTING_TRACE("cur_item:%p", cur_item);
+ if(cur_item)
+ {
+ Elm_Object_Item *dest_item = elm_toolbar_item_next_get(cur_item);
+ //SETTING_TRACE("dest_item:%p", dest_item);
+ //if (!dest_item)
+ // dest_item = elm_toolbar_first_item_get(tabbar);
+ //SETTING_TRACE("dest_item:%p", dest_item);
+ elm_toolbar_item_selected_set(dest_item, EINA_TRUE);
+ }
+
+ }
+ else if(x_offset > MIN_SWIP_DISTANCE_X && abs(y_offset) < MIN_SWIP_DISTANCE_Y )
+ {
+ //swip left
+ //if(swip_data->cb)
+ // swip_data->cb(cb_data, SETTING_SWIP_LEFT);
+ //SETTING_TRACE("swipe to left : %d : %d", -x_offset, y_offset);
+ Elm_Object_Item *cur_item = elm_toolbar_selected_item_get(tabbar);
+ //SETTING_TRACE("cur_item:%p", cur_item);
+ if(cur_item)
+ {
+ Elm_Object_Item *dest_item = elm_toolbar_item_prev_get(cur_item);
+ //SETTING_TRACE("dest_item:%p", dest_item);
+ //if (!dest_item)
+ // dest_item = elm_toolbar_last_item_get(tabbar);
+ //SETTING_TRACE("dest_item:%p", dest_item);
+ elm_toolbar_item_selected_set(dest_item, EINA_TRUE);
+ }
+
+ }
+
+}
+static void __tabbar_btn_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ //SETTING_TRACE_BEGIN;
+ ret_if(!data);
+ Evas_Point *point_down = data;
+ FREE(point_down);//delete the date.
+ evas_object_data_set(obj, "tabbar", NULL);
+}
+
+static void __tabbar_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ //SETTING_TRACE_BEGIN;
+}
+
+EXPORT_PUBLIC void setting_tabbar_enable_swip_effect(Evas_Object *ly_main, Evas_Object *tabbar)
+{
+ SETTING_TRACE_BEGIN;
+ if(ly_main)
+ {
+ evas_object_data_set(ly_main, "tabbar", tabbar);
+ Evas_Point *point_down = calloc(1,sizeof(Evas_Point));
+ evas_object_event_callback_add(ly_main, EVAS_CALLBACK_MOUSE_DOWN, __tabbar_mouse_down_cb, point_down);
+ evas_object_event_callback_add(ly_main, EVAS_CALLBACK_MOUSE_UP, __tabbar_mouse_up_cb, point_down);
+ evas_object_event_callback_add(ly_main, EVAS_CALLBACK_MOUSE_MOVE, __tabbar_mouse_move_cb, point_down);
+ evas_object_event_callback_add(ly_main, EVAS_CALLBACK_DEL, __tabbar_btn_del_cb, point_down);
+ }
+}
+
+EXPORT_PUBLIC void setting_tabbar_disable_swip_effect(Evas_Object *ly_main, Evas_Object *tabbar)
+{
+ SETTING_TRACE_BEGIN;
+ if(ly_main)
+ {
+ evas_object_data_set(ly_main, "tabbar", tabbar);
+ //Evas_Point *point_down = calloc(1,sizeof(Evas_Point));
+ evas_object_event_callback_del(ly_main, EVAS_CALLBACK_MOUSE_DOWN, __tabbar_mouse_down_cb);
+ evas_object_event_callback_del(ly_main, EVAS_CALLBACK_MOUSE_UP, __tabbar_mouse_up_cb);
+ evas_object_event_callback_del(ly_main, EVAS_CALLBACK_MOUSE_MOVE, __tabbar_mouse_move_cb);
+ evas_object_event_callback_del(ly_main, EVAS_CALLBACK_DEL, __tabbar_btn_del_cb);
+ // evas_object_event_callback_del(Evas_Object *obj, Evas_Callback_Type type, Evas_Object_Event_Cb func)
+ }
+}
+
+static void __obj_listen_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+
+{
+ ret_if(!obj);
+ const char *vconf = (const char *)evas_object_data_get(obj, "vconf");
+ vconf_callback_fn cb = (vconf_callback_fn)evas_object_data_get(obj, "cb");
+ (void)vconf_ignore_key_changed(vconf, cb);
+
+ evas_object_data_set(obj, "vconf", NULL);
+ evas_object_data_set(obj, "cb", NULL);
+ evas_object_data_set(obj, "data", NULL);
+}
+
+EXPORT_PUBLIC void
+setting_obj_listen_on(Evas_Object *obj, const char *vconf, vconf_callback_fn cb, void *data)
+{
+ //Bind the life of obj and vconf listen
+ evas_object_data_set(obj, "vconf", vconf);\
+ evas_object_data_set(obj, "cb", cb);\
+ evas_object_data_set(obj, "data", data);\
+ vconf_notify_key_changed(vconf, cb, data);
+ evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, __obj_listen_del_cb, NULL);
+}
+
+EXPORT_PUBLIC void
+setting_decorate_image(Evas_Object *obj, const char *code_style)
+{
+ if(obj)
+ ea_theme_object_color_set(obj, code_style);
+}
+
+