fix for applying wayland (removing X)
[apps/home/settings.git] / setting-common / src / setting-common-draw-widget.c
1 /*
2  * setting
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
5  *
6  * Contact: MyoungJune Park <mj2004.park@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 #include <setting-common-draw-widget.h>
22 #include <glib.h>
23 #include <efl_assist.h>
24
25 #if SUPPORT_HELPUI
26 #include <libhelpui.h>
27 #endif
28 /**
29  * Hide the input pannel
30  *
31  * @param[in] entry
32  */
33 EXPORT_PUBLIC
34 void setting_hide_input_pannel_cb(Evas_Object *entry)
35 {
36         ret_if(entry == NULL);
37         Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(entry);
38         if (imf_context) {
39                 ecore_imf_context_input_panel_hide(imf_context);
40         }
41
42         elm_object_focus_set(entry, EINA_FALSE);
43         Evas_Object *entry_container = elm_object_parent_widget_get(entry);
44         if (entry_container) {
45                 if (elm_entry_is_empty(entry))
46                         elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
47                 elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
48         }
49 }
50
51 EXPORT_PUBLIC
52 Evas_Object *setting_create_button(Evas_Object *parent, const char *btn_str,
53                                    const char *btn_style,
54                                    setting_call_back_func btn_click_cb,
55                                    void *cb_data)
56 {
57         LAUNCH_SETTING_IN();
58         retv_if(!parent || !btn_str, NULL);
59         if ('\0' == btn_str[0]) {/*Empty rectangle */
60                 return setting_create_blank_rect_customize(parent,
61                                                            SETTING_PADDING_WIDTH,
62                                                            SETTING_PADDING_WIDTH);
63         }
64
65         Evas_Object *button = elm_button_add(parent);
66         if (btn_style) {
67                 elm_object_style_set(button, btn_style);
68         }
69
70         if (0 != safeStrCmp("naviframe/end_btn/default", btn_style)) {/*not '<-' button */
71                 elm_object_text_set(button, _(btn_str));
72
73                 evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
74                 evas_object_size_hint_align_set(button, EVAS_HINT_FILL, 0.5);
75         }
76
77         if (btn_click_cb) {
78                 evas_object_smart_callback_add(button, "clicked",
79                                                btn_click_cb, cb_data);
80         }
81         evas_object_show(button);
82         LAUNCH_SETTING_OUT();
83         return button;
84 }
85
86 static double _step_size_calculate(Evas_Object *obj, double min, double max)
87 {
88         double step = 0.0;
89         int steps = 0;
90
91         steps = max - min;
92         if (steps)
93                 step = (1.0 / steps);
94
95         return step;
96 }
97
98 /**
99  * To create slider object of a genlist item
100  *
101  *@return a slider container object
102  */
103 EXPORT_PUBLIC Evas_Object *setting_create_5step_slider(Evas_Object *parent, Evas *evas,
104                                                        const char *l_swallow_path,
105                                                        const char *r_swallow_path, double value,
106                                                        bool indicator, double slider_min, double slider_max,
107                                                        setting_call_back_func slider_change_cb,
108                                                        setting_call_back_func slider_start_change_cb,
109                                                        setting_call_back_func slider_stop_change_cb,
110                                                        void *cb_data)
111 {
112
113         Evas_Object *layout = elm_layout_add(parent);
114         int r = elm_layout_file_set(layout, SETTING_5STEP_SLIDER_EDJ_NAME, "elm/slider/horizontal/music/soundalive");
115         if (!r) {
116                 SETTING_TRACE_ERROR("elm_layout_add failed : %s", "elm/slider/horizontal/music/soundalive");
117                 evas_object_del(layout);
118                 return NULL;
119         }
120
121         Evas_Object *slider = elm_slider_add(layout);   /*  "elm/slider/horizontal/default" */
122         retv_if(slider == NULL, NULL);
123         elm_object_style_set(slider, "music/soundalive");
124
125         elm_slider_indicator_format_set(slider, "%1.0f");
126         elm_slider_indicator_show_set(slider, 5);
127
128         evas_object_size_hint_weight_set(slider, EVAS_HINT_EXPAND, 0.0);
129         evas_object_size_hint_align_set(slider, EVAS_HINT_FILL, 0.5);
130
131         double step = _step_size_calculate(slider, slider_min, slider_max);
132         elm_slider_step_set(slider, step);
133
134         SETTING_TRACE("slider_change_cb:%p", slider_change_cb);
135
136         if (slider_change_cb) evas_object_smart_callback_add(slider, "changed", slider_change_cb, cb_data);
137         if (slider_stop_change_cb) evas_object_smart_callback_add(slider, "slider,drag,stop", slider_stop_change_cb, cb_data);
138         if (slider_start_change_cb) evas_object_smart_callback_add(slider, "slider,drag,start", slider_start_change_cb, cb_data);
139
140         if (l_swallow_path) {
141                 Evas_Object *icon1 = elm_icon_add(slider);
142                 elm_image_file_set(icon1, l_swallow_path, NULL);
143                 evas_object_size_hint_aspect_set(icon1, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
144                 elm_object_content_set(slider, icon1);
145         }
146
147         if (r_swallow_path) {
148                 Evas_Object *icon2 = elm_icon_add(slider);
149                 elm_image_file_set(icon2, r_swallow_path, NULL);
150                 evas_object_size_hint_aspect_set(icon2, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
151                 elm_object_part_content_set(slider, "end", icon2);
152         }
153
154         elm_slider_min_max_set(slider, slider_min, slider_max);
155         elm_slider_value_set(slider, value);
156         return slider;
157 }
158
159 /**
160  * To create slider object of a genlist item
161  *
162  *@return a slider container object
163  */
164 EXPORT_PUBLIC Evas_Object *setting_create_slider(Evas_Object *parent, Evas *evas,
165                                                  const char *l_swallow_path,
166                                                  const char *r_swallow_path, double value,
167                                                  bool indicator, double slider_min, double slider_max,
168                                                  setting_call_back_func slider_change_cb,
169                                                  setting_call_back_func slider_start_change_cb,
170                                                  setting_call_back_func slider_stop_change_cb,
171                                                  void *cb_data)
172 {
173         Evas_Object *slider = elm_slider_add(parent);   /*  "elm/slider/horizontal/default" */
174         retv_if(slider == NULL, NULL);
175
176         if (indicator) {
177                 elm_slider_indicator_format_set(slider, "%1.0f");
178                 elm_slider_indicator_show_set(slider, 1);
179         } else {
180                 /* for brightness slider */
181                 elm_slider_indicator_show_set(slider, 0);
182                 elm_object_style_set(slider, "tap_to_drag");
183         }
184
185         evas_object_size_hint_weight_set(slider, EVAS_HINT_EXPAND, 0.0);
186         evas_object_size_hint_align_set(slider, EVAS_HINT_FILL, 0.5);
187
188         double step = _step_size_calculate(slider, slider_min, slider_max);
189         elm_slider_step_set(slider, step);
190
191         SETTING_TRACE("slider_change_cb:%p", slider_change_cb);
192         if (slider_change_cb)
193                 evas_object_smart_callback_add(slider, "changed", slider_change_cb, cb_data);
194
195         if (slider_stop_change_cb)
196                 evas_object_smart_callback_add(slider, "slider,drag,stop", slider_stop_change_cb, cb_data);
197
198         if (slider_start_change_cb)
199                 evas_object_smart_callback_add(slider, "slider,drag,start", slider_start_change_cb, cb_data);
200
201         if (l_swallow_path) {
202                 Evas_Object *icon1 = elm_icon_add(slider);
203                 elm_image_file_set(icon1, l_swallow_path, NULL);
204                 evas_object_size_hint_aspect_set(icon1, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
205                 elm_object_content_set(slider, icon1);
206         }
207
208         if (r_swallow_path) {
209                 Evas_Object *icon2 = elm_icon_add(slider);
210                 elm_image_file_set(icon2, r_swallow_path, NULL);
211                 evas_object_size_hint_aspect_set(icon2, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
212                 elm_object_part_content_set(slider, "end", icon2);
213         }
214
215         elm_slider_min_max_set(slider, slider_min, slider_max);
216         elm_slider_value_set(slider, value);
217         return slider;
218 }
219
220 /**
221  * The main implement body of create a certain size icon
222  */
223 EXPORT_PUBLIC
224 void create_image_box_add_ex(void *data, Evas_Object *win_main, Evas *evas,
225                              char *img_path, int img_w, int img_h,
226                              Evas_Object_Event_Cb mouse_down_cb,
227                              Evas_Object_Event_Cb mouse_up_cb,
228                              Evas_Object **image_box, Evas_Object **img)
229 {
230         /* SETTING_TRACE_BEGIN; */
231         *image_box = elm_box_add(win_main);
232         retm_if(*image_box == NULL, "Cannot get box");
233         elm_box_horizontal_set(*image_box, 1);
234         evas_object_size_hint_align_set(*image_box, 0.0, EVAS_HINT_FILL);       /* */
235         evas_object_show(*image_box);
236
237         *img = evas_object_image_add(evas);
238         evas_object_size_hint_weight_set(*img, 0.0, EVAS_HINT_EXPAND);
239
240         int temp_h = img_h;
241         int temp_w = img_w;
242
243         evas_object_image_file_set(*img, img_path, NULL);
244         if (img_h <= 0 || temp_w <= 0) {        /*error handling. load the image as it's own size */
245                 evas_object_image_size_get(*img, &temp_w, &temp_h);
246         }
247
248         evas_object_image_load_size_set(*img, temp_w, temp_h);
249         evas_object_image_fill_set(*img, 0, 0, temp_w, temp_h);
250
251         evas_object_size_hint_min_set(*img, ELM_SCALE_SIZE(temp_w), ELM_SCALE_SIZE(temp_h));
252         evas_object_show(*img);
253
254         evas_object_event_callback_add(*img, EVAS_CALLBACK_MOUSE_DOWN,
255                                        mouse_down_cb, data);
256         evas_object_event_callback_add(*img, EVAS_CALLBACK_MOUSE_UP,
257                                        mouse_up_cb, data);
258
259         elm_box_pack_end(*image_box, *img);
260 }
261
262 /**
263  * To create a size fixed icon
264  * @return a image container object
265  */
266
267 EXPORT_PUBLIC
268 Evas_Object *create_image_box_add(void *data, Evas_Object *win_main,
269                                   Evas *evas, char *img_path, int img_w,
270                                   int img_h, Evas_Object_Event_Cb mouse_down_cb,
271                                   Evas_Object_Event_Cb mouse_up_cb)
272 {
273         /* SETTING_TRACE_BEGIN; */
274         Evas_Object *image_box = NULL;
275         Evas_Object *img = NULL;
276         create_image_box_add_ex(data, win_main, evas, img_path,
277                                 img_w * WIDGET_SCALE_FACTOR,
278                                 img_h * WIDGET_SCALE_FACTOR, mouse_down_cb,
279                                 mouse_up_cb, &image_box, &img);
280         return image_box;
281
282 }
283
284 /**
285 * To create a size specialized icon
286 *
287 * @return a image container object
288 */
289
290 EXPORT_PUBLIC
291 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 */
292                                     Evas_Object_Event_Cb mouse_down_cb,
293                                     Evas_Object_Event_Cb mouse_up_cb)
294 {
295         Evas_Object *image_box = NULL;
296         Evas_Object *img = NULL;
297         create_image_box_add_ex(data, win_main, evas, img_path, img_w, img_h,
298                                 mouse_down_cb, mouse_up_cb, &image_box, &img);
299         return image_box;
300 }
301
302 /**
303 * @ create a box container
304 *
305 * @param[in] win_main
306 *
307 * @return a box container
308 */
309 EXPORT_PUBLIC
310 Evas_Object *setting_create_client_bx(Evas_Object *win_main)
311 {
312         Evas_Object *client_bx = NULL;
313
314         client_bx = elm_box_add(win_main);
315         retvm_if(client_bx == NULL, NULL, "Cannot create client box object");
316
317         elm_box_horizontal_set(client_bx, 0);
318         evas_object_size_hint_weight_set(client_bx, EVAS_HINT_EXPAND, 0.0);
319         evas_object_size_hint_align_set(client_bx, EVAS_HINT_FILL, 0.0);
320
321         return client_bx;
322 }
323
324
325 EXPORT_PUBLIC
326 Evas_Object *setting_create_lable(Evas_Object *parent, const char *text,
327                                   const char *style, const char *align)
328 {
329         retvm_if(!parent || !text, NULL, "Cannot create client box object");
330         Evas_Object *label = NULL;
331         if (0 == safeStrCmp(style, "entry")) {
332                 SETTING_TRACE("style:%s", style);
333                 label = elm_entry_add(parent);
334                 elm_entry_editable_set(label, EINA_FALSE);
335         } else {
336                 label = elm_label_add(parent);
337                 elm_object_style_set(label, style);
338                 elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
339         }
340         const char *str = setting_customize_text(text, 0, NULL, align);
341         elm_object_text_set(label, str);
342         FREE(str);
343         evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
344         evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
345         evas_object_show(label);
346         return label;
347 }
348
349 #define DEMO_STEP 0.8
350 typedef struct _setting_gif_data {
351         Ecore_Timer *update_timer;
352         const char  **png_list;
353         int         cur_png_idx;
354 } setting_gif_data;
355
356 static void __gif_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
357 {
358         SETTING_TRACE_BEGIN;
359         ret_if(!data);
360         setting_gif_data *gif_data = data;
361         if (gif_data->update_timer) {/*first delete the timer */
362                 ecore_timer_del(gif_data->update_timer);
363                 gif_data->update_timer = NULL;
364         }
365         FREE(gif_data);/*delete the date. */
366         evas_object_data_set(obj, "gif_data", NULL);
367 }
368
369 Eina_Bool __gif_updater(void *data)
370 {
371         retv_if(!data, FALSE);
372         Evas_Object *gif =  data;
373         setting_gif_data *gif_data = evas_object_data_get(gif, "gif_data");
374         retv_if(!gif_data, FALSE);
375         /*SETTING_TRACE_BEGIN; */
376
377         gif_data->cur_png_idx++;
378         if (NULL == gif_data->png_list[gif_data->cur_png_idx]) { /*the last element of current array. */
379                 gif_data->cur_png_idx = 0;
380         }
381         elm_image_file_set(gif, gif_data->png_list[gif_data->cur_png_idx], NULL);
382         int w = 0;
383         int h = 0;
384         elm_image_object_size_get(gif, &w, &h);
385         setting_resize_object(gif, w, h);
386
387         return TRUE;
388 }
389
390 EXPORT_PUBLIC
391 Evas_Object *setting_create_image(Evas_Object *parent, const char *img_path)
392 {
393         Evas_Object *image = elm_image_add(parent);
394         /*SETTING_TRACE("icon_path:%s", icon_path); */
395         elm_image_file_set(image, img_path, NULL);
396         elm_image_resizable_set(image, EINA_TRUE, EINA_TRUE);
397
398         int w = 0;
399         int h = 0;
400         elm_image_object_size_get(image, &w, &h);
401         setting_resize_object(image, w, h);
402         evas_object_show(image);
403         return image;
404 }
405
406 EXPORT_PUBLIC
407 Evas_Object *setting_create_image_with_round_corner(Evas *evas, const char *img_path, int w, int h)
408 {
409         Evas_Object *image = evas_object_image_add(evas);
410         evas_object_size_hint_weight_set(image, 0.0, EVAS_HINT_EXPAND);
411         evas_object_image_load_size_set(image, w, h);
412         evas_object_image_file_set(image, img_path, NULL);
413
414         evas_object_image_fill_set(image, 0, 0, w, h);
415
416         /*Set the dimensions for an image object's border, a region which @b
417         * @param obj The given image object.
418         * @param l The border's left width.
419         * @param r The border's right width.
420         * @param t The border's top width.
421         * @param b The border's bottom width.
422         */
423         evas_object_image_border_set(image, 16, 16, 16, 16); /*for round corner */
424         evas_object_image_filled_set(image, 1); /*to full fill */
425         evas_object_size_hint_min_set(image, ELM_SCALE_SIZE(w), ELM_SCALE_SIZE(h));
426         evas_object_size_hint_max_set(image, w, h);
427         return image;
428 }
429
430 /* @png_list is an array end with 'NULL'. like ,
431                 const char *png_list[] = {
432                         SETTING_ICON_PATH_CFG"motions/motion_overturn_01.png",
433                         SETTING_ICON_PATH_CFG"motions/motion_overturn_02.png",
434                         SETTING_ICON_PATH_CFG"motions/motion_overturn_03.png",
435                         SETTING_ICON_PATH_CFG"motions/motion_overturn_04.png",
436                         SETTING_ICON_PATH_CFG"motions/motion_overturn_05.png",
437                         NULL //must end with 'NULL'
438                 };
439 */
440 EXPORT_PUBLIC
441 Evas_Object *setting_create_gif(Evas_Object *parent, const char **png_list)
442 {
443         retv_if(!png_list, NULL);
444         setting_gif_data *gif_data = calloc(1, sizeof(setting_gif_data));
445         setting_retvm_if(!gif_data, NULL, "calloc failed");
446         gif_data->cur_png_idx = 0;
447         gif_data->png_list = png_list;
448
449         SETTING_TRACE_BEGIN;
450
451         Evas_Object *gif = setting_create_image(parent, *png_list);/*the first element */
452         /*bind object data */
453         evas_object_data_set(gif, "gif_data", gif_data);
454         evas_object_event_callback_add(gif, EVAS_CALLBACK_DEL, __gif_del_cb, gif_data);
455
456         if (gif_data->update_timer) {
457                 ecore_timer_del(gif_data->update_timer);
458                 gif_data->update_timer = NULL;
459         }
460         gif_data->update_timer = ecore_timer_add(DEMO_STEP, (Ecore_Task_Cb)__gif_updater, gif);
461
462         setting_decorate_image_RGBA(gif, 14, 41, 73, 255);/*W011:bg, T051:text */
463         return gif;
464 }
465
466 /**
467 * Alternate the check object status and its binded vcof value via original vcofn value
468 */
469 EXPORT_PUBLIC
470 int setting_draw_onoff_status(Evas_Object *obj, setting_bool_slp_list key)
471 {
472         int value;
473         int err;
474         int ret;
475
476         setting_get_bool_slp_key(key, &value, &err);
477
478         elm_check_state_set(obj, !value);
479         ret = setting_set_bool_slp_key(key, !value, &err);
480         return ret;
481 }
482
483 /**
484 * Set the status of check object via its binded vconf value.
485 * @return  0: sucess, other: failed
486 */
487 EXPORT_PUBLIC
488 int setting_check_onoff_status(Evas_Object *obj, setting_bool_slp_list key)
489 {
490         int value = 0;
491         int err = 0;
492         int ret = 0;
493
494         ret = setting_get_bool_slp_key(key, &value, &err);
495         elm_check_state_set(obj, value);
496         return ret;
497 }
498
499 /**
500 * Set the status of radio group object via its binded vconf value.
501 * @return  0: sucess, other: failed
502 */
503 EXPORT_PUBLIC
504 int setting_update_chk_status(Evas_Object *chk, setting_int_slp_list type)
505 {
506         SETTING_TRACE_BEGIN;
507         /* error check */
508         if (chk == NULL) {
509                 return SETTING_GENERAL_ERR_NULL_DATA_PARAMETER;
510         }
511
512         SETTING_TRACE_BEGIN;
513
514         int ret = SETTING_RETURN_FAIL;
515         int value;
516         int err;
517
518         /* value set */
519         ret = setting_get_int_slp_key(type, &value, &err);
520         SETTING_TRACE("binded: %d, checked: %d, err: %d", type, value, err);
521
522         elm_radio_value_set(chk, value);
523
524         return ret;
525 }
526
527 /**
528 * Create a size specilized rectangle object
529 * @return a size specilized rectangle object
530 */
531 EXPORT_PUBLIC
532 Evas_Object *setting_create_blank_rect_customize(Evas_Object *layout, int w,
533                                                  int h)
534 {
535         Evas_Object *rect;
536
537         rect = evas_object_rectangle_add(evas_object_evas_get(layout));
538         evas_object_size_hint_min_set(rect, ELM_SCALE_SIZE(w), ELM_SCALE_SIZE(h));
539         evas_object_size_hint_weight_set(rect, EVAS_HINT_EXPAND, 0);
540         /*evas_object_color_set(rect, 0, 0, 0, 0); */
541         evas_object_color_set(rect, 8, 8, 8, 8);
542
543         return rect;
544 }
545
546 /**
547 * Create a size fixed rectangle object
548 *
549 * @param[in] layout
550 *
551 * @return a size fixed rectangle object
552 */
553 EXPORT_PUBLIC
554 Evas_Object *setting_create_blank_rect(Evas_Object *layout)
555 {
556         return setting_create_blank_rect_customize(layout,
557                                                    SETTING_PADDING_WIDTH, 80);
558 }
559
560 /**
561 * The API to Create an editfiled object
562 * @return an editfiled object
563 */
564 EXPORT_PUBLIC
565 Evas_Object *                   /* multi-line is default, use elm_editfield_entry_single_line_set(ef, EINA_TRUE) to set single-line */
566 setting_create_editfiled(Evas_Object *win_main, char *title, char *def_str, char *guide_text)
567 {
568         Evas_Object *layout = NULL;
569         Evas_Object *entry = NULL;
570         layout = elm_layout_add(win_main);
571
572         if (title) {
573                 elm_layout_theme_set(layout, "layout", "editfield", "title");
574                 elm_object_part_text_set(layout, "elm.text", title);
575         } else {
576                 elm_layout_theme_set(layout, "layout", "editfield", "default");
577         }
578         entry = elm_entry_add(win_main);
579         elm_object_part_content_set(layout, "elm.swallow.content", entry);
580         /*elm_entry_context_menu_disabled_set(entry, TRUE); */
581         /*elm_entry_magnifier_disabled_set(entry, TRUE); */
582         elm_entry_prediction_allow_set(entry, FALSE);
583
584         if (def_str && safeStrLen(def_str) > 0) {
585                 elm_entry_entry_set(entry, def_str);
586         } else {
587                 if (guide_text) {
588                         elm_object_part_text_set(layout, "elm.guidetext", _(guide_text));
589                 } else {
590                         elm_object_part_text_set(layout, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
591                 }
592         }
593
594         evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, 0);
595         evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, 0);
596
597         evas_object_show(layout);
598         return layout;
599 }
600
601 /**
602 * Create a text box, which cannot be edited, just to show a specilization segment.
603 *
604 * @return a text box, which cannot be edited
605 */
606 EXPORT_PUBLIC
607 Evas_Object *setting_create_textbox(Evas_Object *parent, const char *content)
608 {
609         Evas_Object *obj = NULL;
610
611         obj = elm_entry_add(parent);
612         evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, 0.0);
613         evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, 0.5);
614         elm_entry_single_line_set(obj, 0);
615         /* elm_entry_line_wrap_set(obj, 1); */
616         elm_entry_editable_set(obj, 0);
617         elm_entry_context_menu_disabled_set(obj, 1);
618
619         /* setting_disable_evas_object(obj); ***disable any events on entry */
620
621         elm_entry_entry_set(obj, content);
622         evas_object_show(obj);
623         return obj;
624 }
625
626 /**
627 * Make it no effect when clicking on a evas object and its sub-objects, such as, layout, genlist
628 *
629 * @param[in] obj
630 */
631 EXPORT_PUBLIC
632 void setting_disable_evas_object(Evas_Object *obj)
633 {
634         /* layout\genlist\scroller\elm_entry  etc.. */
635         if (obj) {
636                 evas_object_pass_events_set(obj, EINA_TRUE);
637         }
638 }
639
640 /**
641 * Make it normal acting when clicking on a evas object, such as, layout, genlist
642 *
643 * @param[in] obj
644 */
645 EXPORT_PUBLIC
646 void setting_enable_evas_object(Evas_Object *obj)
647 {
648         if (obj) {
649                 evas_object_pass_events_set(obj, EINA_FALSE);
650         }
651 }
652
653 /**
654 * To resize a evas object, such as, icon, button..
655 *
656 * @param[in] obj
657 * @param[in] w
658 * @param[in] h
659 */
660 EXPORT_PUBLIC
661 void setting_resize_object(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
662 {
663         if (obj) {
664                 evas_object_size_hint_min_set(obj, ELM_SCALE_SIZE(w), ELM_SCALE_SIZE(h));
665                 evas_object_size_hint_max_set(obj, w, h);
666                 evas_object_resize(obj, w, h);
667         }
668 }
669
670 /**
671 * To create a bg object
672 *
673 * @param[in] parent
674 * @param[in] bg_style
675 * @return bg object
676 */
677 EXPORT_PUBLIC
678 Evas_Object *setting_create_bg(Evas_Object *parent, Evas_Object *win, const char *bg_style)
679 {
680         retv_if(!parent, NULL);
681         Evas_Object *bg = elm_bg_add(parent);
682         retv_if(!bg, NULL);
683         if (bg_style) elm_object_style_set(bg, bg_style);
684         evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND,
685                                          EVAS_HINT_EXPAND);
686         /*elm_win_resize_object_add(win, bg); */
687         evas_object_show(bg);
688         return bg;
689 }
690
691
692 #define DIFF_TIMES      2
693 /**
694 * To make an object which is operated by setting_dim_evas_object normal color
695 *
696 * @param[in] obj
697 * @param[in] b_transparency_set:
698 *       1:the appearence of obj is made up of transparent backgroud color.
699 *       0:the appearence of obj is made up of non transparent color.
700 */
701 EXPORT_PUBLIC
702 void setting_undo_dim_evas_object(Evas_Object *obj, bool b_transparenct)
703 {
704         if (obj) {
705                 int r;
706                 int g;
707                 int b;
708                 int a;
709                 evas_object_color_get(obj, &r, &g, &b, &a);
710                 if (b_transparenct) {/*the appearence of obj is made up of transparent backgroud color. */
711                         a *= DIFF_TIMES;
712                 }
713                 evas_object_color_set(obj, r * DIFF_TIMES, g * DIFF_TIMES, b * DIFF_TIMES, a);
714         }
715 }
716
717 /**
718 * To make an object dim color
719 *
720 * @param[in] obj
721 * @param[in] b_transparency_set:
722 *       1:the appearence of obj is made up of transparent backgroud color.
723 *       0:the appearence of obj is made up of non transparent color.
724 */
725 EXPORT_PUBLIC
726 void setting_dim_evas_object(Evas_Object *obj, bool b_transparenct)
727 {
728         if (obj) {
729                 int r;
730                 int g;
731                 int b;
732                 int a;
733                 evas_object_color_get(obj, &r, &g, &b, &a);
734                 if (b_transparenct) {/*the appearence of obj is made up of transparent backgroud color. */
735                         a /= DIFF_TIMES;
736                 }
737                 evas_object_color_set(obj, r / DIFF_TIMES, g / DIFF_TIMES, b / DIFF_TIMES, a);
738         }
739 }
740
741 static void __btn_select_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
742 {
743         /*SETTING_TRACE_BEGIN; */
744         setting_dim_evas_object(obj, FALSE);
745         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
746         retm_if(data == NULL, "Invalid argument: data is NULL");
747         Evas_Event_Mouse_Down *ev = (Evas_Event_Mouse_Down *)event_info;
748         Evas_Point *point_down = data;
749         point_down->x = ev->output.x;
750         point_down->y = ev->output.y;
751 }
752
753 static void __btn_release_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
754 {
755         /*SETTING_TRACE_BEGIN; */
756         setting_undo_dim_evas_object(obj, FALSE);
757 }
758
759 static void __btn_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
760 {
761         /*SETTING_TRACE_BEGIN; */
762         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
763         retm_if(data == NULL, "Invalid argument: data is NULL");
764         Evas_Point *point_down = data;
765         Evas_Event_Mouse_Move *ev = (Evas_Event_Mouse_Move *)event_info;
766         int x_offset = ev->cur.output.x - point_down->x;
767         int y_offset = ev->cur.output.y - point_down->y;
768         if (x_offset < 0) x_offset = -x_offset;
769         if (y_offset < 0) y_offset = -y_offset;
770         if (x_offset <= MIN_MOVE_DISTANCE && y_offset <= MIN_MOVE_DISTANCE) {
771                 return;
772         }
773         setting_undo_dim_evas_object(obj, FALSE);
774 }
775 static void __btn_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
776 {
777         /*SETTING_TRACE_BEGIN; */
778         ret_if(!data);
779         Evas_Point *point_down = data;
780         FREE(point_down);/*delete the date. */
781 }
782
783 /**
784 * To make an object looks clickable: if pressed, it is dim color;if unpressed, it is normal color;
785 *
786 * @param[in] obj
787 */
788 EXPORT_PUBLIC
789 void setting_make_evas_object_clickable(Evas_Object *obj)
790 {
791         if (obj) {
792                 Evas_Point *point_down = calloc(1, sizeof(Evas_Point));
793                 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN, __btn_select_cb, point_down);
794                 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_UP, __btn_release_cb, NULL);
795                 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_MOVE, __btn_mouse_move_cb, point_down);
796                 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, __btn_del_cb, point_down);
797         }
798 }
799
800 /**
801 * To create an icon which looks clickable(if pressed, it is dim color;if unpressed, it is normal color)
802 *
803 * @param[in] parent
804 * @param[in] img_path
805 * @param[in] up_cb
806 * @param[in] down_cb
807 * @param[in] move_cb
808 * @param[in] data
809 */
810 EXPORT_PUBLIC
811 Evas_Object *setting_create_icon(Evas_Object *parent, const char *img_path,
812                                  Evas_Object_Event_Cb up_cb,
813                                  Evas_Object_Event_Cb down_cb,
814                                  Evas_Object_Event_Cb move_cb,
815                                  void *data)
816 {
817         SETTING_TRACE_BEGIN;
818         retv_if(!parent || !img_path, NULL);
819         Evas_Object *icon = elm_icon_add(parent);
820         retvm_if(!icon, NULL, "Failed Create icon!");
821         elm_image_file_set(icon, img_path, NULL);
822         setting_make_evas_object_clickable(icon);
823
824         if (up_cb) {
825                 evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_UP,
826                                                up_cb, data);
827         }
828         if (down_cb) {
829                 evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_DOWN,
830                                                down_cb, data);
831         }
832         if (move_cb) {
833                 evas_object_event_callback_add(icon, EVAS_CALLBACK_MOUSE_MOVE,
834                                                move_cb, data);
835         }
836
837         return icon;
838 }
839
840 /**
841 * To create a button which only has a image and looks clickable
842 * (if pressed, it is dim color;if unpressed, it is normal color)
843 * @param[in] parent
844 * @param[in] img_path
845 * @param[in] up_cb
846 * @param[in] down_cb
847 * @param[in] move_cb
848 * @param[in] data
849 */
850 EXPORT_PUBLIC
851 Evas_Object *setting_create_image_button(Evas_Object *parent,
852                                          const char *btn_img,
853                                          setting_call_back_func clicked_cb,
854                                          setting_call_back_func unpressed_cb,
855                                          void *data)
856 {
857         SETTING_TRACE_BEGIN;
858         retv_if(!parent, NULL);
859         Evas_Object *btn = elm_button_add(parent);
860         retvm_if(!btn, NULL, "Failed Create button!");
861         if (clicked_cb) {
862                 evas_object_smart_callback_add(btn, "clicked", clicked_cb, data);
863         }
864
865         if (unpressed_cb) {
866                 evas_object_smart_callback_add(btn, "unpressed", unpressed_cb, data);
867         }
868
869         if (btn_img) {
870                 Evas_Object *icon = elm_icon_add(parent);
871                 retvm_if(!icon, NULL, "Failed Create icon!");
872                 elm_image_file_set(icon, btn_img, NULL);
873                 elm_object_part_content_set(btn, "elm.swallow.content", icon);
874                 setting_make_evas_object_clickable(btn);
875         }
876
877         return btn;
878 }
879
880 EXPORT_PUBLIC void setting_entry_entry_set(Evas_Object *entry, const char *text, const int font_size)
881 {
882         if (isEmptyStr(text)) return;
883         if (entry) {
884                 char buf[200];
885                 if (font_size > 0) {
886                         snprintf(buf, sizeof(buf), "DEFAULT='font_size=%d'", font_size);
887                 }
888                 elm_entry_text_style_user_push(entry, buf);
889                 elm_entry_entry_set(entry, text);
890         }
891 }
892
893
894 /*
895 * set font_size, color or align(right, left, middle),if need, you
896 * can add </font_siz>, </color> or </align> to controll a segment words; or else
897 * the text will take the same effect until the end of text.
898 * @param[in] input_str
899 * @param[in] font_size
900 * @param[in] color
901 * @param[in] align :may be right, left, middle/center
902 */
903 EXPORT_PUBLIC
904 char *setting_customize_text(const char *input_str, const int font_size,
905                              const char *color, const char *align)
906 {
907         /*SETTING_TRACE_BEGIN; */
908         retv_if(isEmptyStr(input_str), NULL);
909         /*SETTING_TRACE("input_str:%s, color:%s", input_str, color); */
910         char speciliztion[MAX_SPECIALIZITION_LEN] = { 0, };
911         /*<font_size=%d><align=middle><color=#9C9C9C>bbb</color></align></font_size> */
912         if (font_size > 0) {
913                 snprintf(speciliztion, sizeof(speciliztion),
914                          "<font_size=%d>", font_size);
915         }
916
917         if (align) {
918                 g_strlcat(speciliztion, "<align=", MAX_SPECIALIZITION_LEN);
919                 g_strlcat(speciliztion, align, MAX_SPECIALIZITION_LEN);
920                 g_strlcat(speciliztion, ">", MAX_SPECIALIZITION_LEN);
921         }
922
923         if (color) {
924                 char input_str1[MAX_SPECIALIZITION_LEN] = { 0, };
925                 safeCopyStr(input_str1, input_str, MAX_SPECIALIZITION_LEN);
926                 char *p = strstr(input_str1, "<color=");
927                 if (p) { /*already has customed color,to replace color sub_string */
928                         p += strlen("<color=");
929                         /*memcpy(p, color, strlen(color)); */
930                         char *q = (char *)color;
931                         while ('\0' != p[0] && '\0' != q[0]) {
932                                 *p = *q;
933                                 p++;
934                                 q++;
935                         }
936                         if ('>' != p[0]) { /*invalid format */
937                                 g_strlcat(speciliztion, "<color=", MAX_SPECIALIZITION_LEN);
938                                 g_strlcat(speciliztion, color, MAX_SPECIALIZITION_LEN);
939                                 g_strlcat(speciliztion, ">", MAX_SPECIALIZITION_LEN);
940                                 g_strlcat(speciliztion, input_str, MAX_SPECIALIZITION_LEN);
941                                 g_strlcat(speciliztion, "</color>", MAX_SPECIALIZITION_LEN);
942                         } else
943                                 g_strlcat(speciliztion, input_str1, MAX_SPECIALIZITION_LEN);
944                 } else {
945                         g_strlcat(speciliztion, "<color=", MAX_SPECIALIZITION_LEN);
946                         g_strlcat(speciliztion, color, MAX_SPECIALIZITION_LEN);
947                         g_strlcat(speciliztion, ">", MAX_SPECIALIZITION_LEN);
948                         g_strlcat(speciliztion, input_str, MAX_SPECIALIZITION_LEN);
949                         g_strlcat(speciliztion, "</color>", MAX_SPECIALIZITION_LEN);
950                 }
951         } else {
952                 g_strlcat(speciliztion, input_str, MAX_SPECIALIZITION_LEN);
953         }
954         if (align) {
955                 g_strlcat(speciliztion, "</align>", MAX_SPECIALIZITION_LEN);
956         }
957         if (font_size > 0) {
958                 g_strlcat(speciliztion, "</font_size>", MAX_SPECIALIZITION_LEN);
959         }
960
961         /*SETTING_TRACE("Exit %s, return :%s", __FUNCTION__, speciliztion); */
962         return (char *)strdup(speciliztion);;
963 }
964
965 /*if pass traits=" ",means make tts omit the traits-reading */
966 EXPORT_PUBLIC
967 void setting_set_tts_info(Evas_Object *obj, const char *label,
968                           const char *traits, const char *state,
969                           const char *guide)
970 {
971         /*ret_if(!obj); */
972         if (!obj) {
973                 return;
974         }
975         /*SETTING_TRACE("label:%s,traits:%s,state:%s,guide:%s", label, traits,state,guide); */
976         if (label)
977                 elm_access_info_set(obj, ELM_ACCESS_INFO, label);
978
979         if (traits)/* && isEmptyStr(elm_access_info_get(obj, ELM_ACCESS_TYPE))) */
980                 elm_access_info_set(obj, ELM_ACCESS_TYPE, traits);
981
982         if (state)
983                 elm_access_info_set(obj, ELM_ACCESS_STATE, state);
984         if (guide) {
985                 elm_access_info_set(obj, ELM_ACCESS_CONTEXT_INFO, NULL);
986                 elm_access_info_set(obj, ELM_ACCESS_CONTEXT_INFO, guide);
987         }
988 }
989
990 EXPORT_PUBLIC
991 void __toogle_gl_sel(void *data, Evas_Object *obj, void *event_info)
992 {
993         /* SETTING_TRACE_BEGIN; */
994         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
995         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
996         elm_genlist_item_selected_set(item, 0);
997         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
998         ret_if(!list_item);
999
1000         /* new status */
1001         setting_update_gl_item_chk_status(list_item, !(list_item->chk_status));
1002         /*int err = 0; */
1003         /*int ret = setting_set_bool_slp_key(list_item->int_slp_setting_binded, list_item->chk_status, &err); */
1004         const char *use_vconf = (char *)(list_item->int_slp_setting_binded);
1005         int ret = vconf_set_bool(use_vconf, list_item->chk_status);
1006
1007         setting_retm_if(0 != ret, "Failed to set vconf [%s]", list_item->int_slp_setting_binded);
1008 }
1009
1010
1011 EXPORT_PUBLIC
1012 void __toogle_chk_changed(void *data, Evas_Object *obj, void *event_info)
1013 {
1014         retm_if(data == NULL, "Data parameter is NULL");
1015         Setting_GenGroupItem_Data *list_item =
1016             (Setting_GenGroupItem_Data *) data;
1017         list_item->chk_status = elm_check_state_get(obj);       /*  for update */
1018
1019         /*int err = 0; */
1020         /*int ret = setting_set_bool_slp_key(list_item->int_slp_setting_binded, list_item->chk_status, &err); */
1021         const char *use_vconf = (char *)(list_item->int_slp_setting_binded);
1022         int ret = vconf_set_bool(use_vconf, list_item->chk_status);
1023         if (0 != ret) { /*rollback */
1024                 setting_update_gl_item_chk_status(list_item, !(list_item->chk_status));
1025                 return;
1026         }
1027 }
1028
1029 EXPORT_PUBLIC void setting_conformant_keypad_state(Evas_Object *win_main, bool enable)
1030 {
1031         Evas_Object *conform = evas_object_data_get(win_main, "conformant");
1032         if (conform) {
1033                 SETTING_TRACE("conformant keypad %d", enable);
1034                 if (enable) {
1035                         elm_object_signal_emit(conform, "elm,state,virtualkeypad,enable", "");
1036                         elm_object_signal_emit(conform, "elm,state,clipboard,enable", "");
1037                 } else {
1038                         elm_object_signal_emit(conform, "elm,state,virtualkeypad,disable", "");
1039                         elm_object_signal_emit(conform, "elm,state,clipboard,disable", "");
1040                 }
1041         }
1042 }
1043
1044 static void __title_btn_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
1045
1046 {
1047         SETTING_TRACE_BEGIN;
1048         ret_if(!obj);
1049         evas_object_data_set(obj, "text", NULL);
1050 }
1051
1052 EXPORT_PUBLIC Evas_Object *setting_create_navibar_title_text_btn(Evas_Object *parent, const char *text, Evas_Smart_Cb func, void *data)
1053 {
1054         Evas_Object *btn = elm_button_add(parent);
1055         if (!btn) {
1056                 return NULL;
1057         }
1058         elm_object_style_set(btn, "naviframe/title_text");
1059         evas_object_event_callback_add(btn, EVAS_CALLBACK_DEL, __title_btn_del_cb, NULL);
1060         if (text) {
1061                 elm_object_text_set(btn, _(text));
1062                 evas_object_data_set(btn, "text", text);
1063         }
1064         if (func) {
1065                 evas_object_smart_callback_add(btn, "clicked", func, data);
1066         }
1067         return btn;
1068 }
1069
1070 #if SUPPORT_HELPUI
1071 EXPORT_PUBLIC void setting_help_popup_circle_block_create(Evas_Object *win, Evas_Object *parent, Evas_Object **circle,
1072                                                           Evas_Object **popup, char *string_id, int x, int y, Evas_Coord_Rectangle *rect)
1073 {
1074         helpui_set_block_win(win);
1075         setting_help_popup_circle_unblock_create(parent, circle, popup, string_id, x, y);
1076         helpui_set_unblock_rect(win, rect);
1077 }
1078
1079 EXPORT_PUBLIC void setting_help_popup_circle_block_move(Evas_Object *win, Evas_Object *circle, Evas_Object *popup, int x,
1080                                                         int y, Evas_Coord_Rectangle *rect)
1081 {
1082         helpui_set_unblock_win(win);
1083         helpui_set_block_win(win);
1084         evas_object_move(circle, x, y);
1085         evas_object_move(popup, x, y + 10);
1086         helpui_set_unblock_rect(win, rect);
1087 }
1088
1089 static void __help_popup_language_change_cb(void *data, Evas_Object *obj, void *source)
1090 {
1091         char *string_id = (char *)data;
1092         char *message = _(string_id);
1093         helpui_set_popup_text(obj, message);
1094 }
1095
1096 EXPORT_PUBLIC void setting_help_popup_circle_unblock_create(Evas_Object *parent, Evas_Object **circle,
1097                                                             Evas_Object **popup, char *string_id, int x, int y)
1098 {
1099         *circle = helpui_add_circle(parent, HELP_CIRCLE_BIG);
1100         evas_object_move(*circle, x, y);
1101         char *message = _(string_id);
1102         *popup = helpui_add_popup(parent, message, HELP_POPUP_WITH_ARROW, NULL, NULL);
1103         helpui_set_popup_language_changed_cb(*popup, __help_popup_language_change_cb,
1104                                              string_id);
1105         evas_object_move(*popup, x, y + 8);
1106 }
1107
1108 EXPORT_PUBLIC void setting_help_popup_circle_block_delete(Evas_Object *win, Evas_Object **circle, Evas_Object **popup)
1109 {
1110         helpui_set_unblock_win(win);
1111         if (*circle) {
1112                 evas_object_del(*circle);
1113                 *circle = NULL;
1114         }
1115         if (*popup) {
1116                 evas_object_del(*popup);
1117                 *popup = NULL;
1118         }
1119 }
1120
1121 EXPORT_PUBLIC void setting_help_popup_block_create(Evas_Object *win, Evas_Object *parent,
1122                                                    Evas_Object **popup, char *string_id, int x, int y, Evas_Coord_Rectangle *rect)
1123 {
1124         helpui_set_block_win(win);
1125         setting_help_popup_unblock_create(parent, popup, string_id, x, y);
1126         if (rect != NULL) {
1127                 helpui_set_unblock_rect(win, rect);
1128         }
1129 }
1130
1131 EXPORT_PUBLIC void setting_help_popup_block_move(Evas_Object *win, Evas_Object *popup, int x, int y,
1132                                                  Evas_Coord_Rectangle *rect)
1133 {
1134         helpui_set_unblock_win(win);
1135         helpui_set_block_win(win);
1136         evas_object_move(popup, x, y);
1137         if (rect != NULL) {
1138                 helpui_set_unblock_rect(win, rect);
1139         }
1140 }
1141
1142 EXPORT_PUBLIC void setting_help_popup_unblock_create(Evas_Object *parent,
1143                                                      Evas_Object **popup, char *string_id, int x, int y)
1144 {
1145         char *message = _(string_id);
1146         *popup = helpui_add_popup(parent, message, HELP_POPUP_WITHOUT_ARROW, NULL, NULL);
1147         helpui_set_popup_language_changed_cb(*popup, __help_popup_language_change_cb,
1148                                              string_id);
1149         evas_object_move(*popup, x, y);
1150 }
1151 #endif
1152
1153 #define MIN_SWIP_DISTANCE_X 300
1154 #define MIN_SWIP_DISTANCE_Y 75
1155
1156 static void __tabbar_mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
1157 {
1158         /*SETTING_TRACE_BEGIN; */
1159         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1160         retm_if(data == NULL, "Invalid argument: data is NULL");
1161         Evas_Event_Mouse_Down *ev = (Evas_Event_Mouse_Down *)event_info;
1162         Evas_Point *point_down = data;
1163         point_down->x = ev->output.x;
1164         point_down->y = ev->output.y;
1165 }
1166
1167 static void __tabbar_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
1168 {
1169         /*SETTING_TRACE_BEGIN; */
1170         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1171         retm_if(data == NULL, "Invalid argument: data is NULL");
1172         Evas_Point *point_down = data;
1173         Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up *)event_info;
1174
1175         int x_offset = ev->output.x - point_down->x;
1176         int y_offset = ev->output.y - point_down->y;
1177
1178         bool skip = TRUE;
1179
1180         Evas_Object *navi = NULL;
1181         Elm_Object_Item *top_item = NULL;
1182         Evas_Object *eo_view = NULL;
1183         Evas_Object *tabbar = NULL;
1184         /*char *tabbar_t = NULL; */
1185         if ((navi = elm_object_part_content_get(obj, "elm.swallow.content"))
1186             && (top_item = elm_naviframe_top_item_get(navi))) {
1187                 /*SETTING_TRACE("top_item:%p", top_item); */
1188                 if ((eo_view = elm_object_item_content_get(top_item))
1189                     && (tabbar = elm_object_part_content_get(eo_view, "elm.swallow.tabbar"))
1190                     && 0 == safeStrCmp(evas_object_type_get(tabbar), "elm_toolbar")) {
1191                         /*SETTING_TRACE("Skip Case 1"); */
1192                         skip = FALSE;
1193                 }
1194
1195                 if (skip && (tabbar = elm_object_item_part_content_get(top_item, "tabbar"))
1196                     && 0 == safeStrCmp(evas_object_type_get(tabbar), "elm_toolbar")) {
1197                         /*SETTING_TRACE("Skip case 2"); */
1198                         skip = FALSE;
1199                 }
1200         }
1201         if (skip)
1202                 return;
1203         /*SETTING_TRACE("tabbar:%p", tabbar); */
1204         /*SETTING_TRACE("SWIPE VALUE : x=(%d) : y=(%d)", x_offset, y_offset); */
1205         if (-x_offset > MIN_SWIP_DISTANCE_X && abs(y_offset) < MIN_SWIP_DISTANCE_Y) {
1206
1207                 Elm_Object_Item *cur_item = elm_toolbar_selected_item_get(tabbar);
1208                 if (cur_item) {
1209                         Elm_Object_Item *dest_item = elm_toolbar_item_next_get(cur_item);
1210                         elm_toolbar_item_selected_set(dest_item, EINA_TRUE);
1211                 }
1212
1213         } else if (x_offset > MIN_SWIP_DISTANCE_X && abs(y_offset) < MIN_SWIP_DISTANCE_Y) {
1214                 Elm_Object_Item *cur_item = elm_toolbar_selected_item_get(tabbar);
1215                 if (cur_item) {
1216                         Elm_Object_Item *dest_item = elm_toolbar_item_prev_get(cur_item);
1217                         elm_toolbar_item_selected_set(dest_item, EINA_TRUE);
1218                 }
1219
1220         }
1221
1222 }
1223 static void __tabbar_btn_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
1224 {
1225         /*SETTING_TRACE_BEGIN; */
1226         ret_if(!data);
1227         Evas_Point *point_down = data;
1228         FREE(point_down);/*delete the date. */
1229         evas_object_data_set(obj, "tabbar", NULL);
1230 }
1231
1232 static void __tabbar_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
1233 {
1234         /*SETTING_TRACE_BEGIN; */
1235 }
1236
1237 EXPORT_PUBLIC void setting_tabbar_enable_swip_effect(Evas_Object *ly_main, Evas_Object *tabbar)
1238 {
1239         SETTING_TRACE_BEGIN;
1240         if (ly_main) {
1241                 evas_object_data_set(ly_main, "tabbar", tabbar);
1242                 Evas_Point *point_down = calloc(1, sizeof(Evas_Point));
1243                 evas_object_event_callback_add(ly_main, EVAS_CALLBACK_MOUSE_DOWN, __tabbar_mouse_down_cb, point_down);
1244                 evas_object_event_callback_add(ly_main, EVAS_CALLBACK_MOUSE_UP, __tabbar_mouse_up_cb, point_down);
1245                 evas_object_event_callback_add(ly_main, EVAS_CALLBACK_MOUSE_MOVE, __tabbar_mouse_move_cb, point_down);
1246                 evas_object_event_callback_add(ly_main, EVAS_CALLBACK_DEL, __tabbar_btn_del_cb, point_down);
1247         }
1248 }
1249
1250 EXPORT_PUBLIC void setting_tabbar_disable_swip_effect(Evas_Object *ly_main, Evas_Object *tabbar)
1251 {
1252         SETTING_TRACE_BEGIN;
1253         if (ly_main) {
1254                 evas_object_data_set(ly_main, "tabbar", tabbar);
1255                 /*Evas_Point *point_down = calloc(1,sizeof(Evas_Point)); */
1256                 evas_object_event_callback_del(ly_main, EVAS_CALLBACK_MOUSE_DOWN, __tabbar_mouse_down_cb);
1257                 evas_object_event_callback_del(ly_main, EVAS_CALLBACK_MOUSE_UP, __tabbar_mouse_up_cb);
1258                 evas_object_event_callback_del(ly_main, EVAS_CALLBACK_MOUSE_MOVE, __tabbar_mouse_move_cb);
1259                 evas_object_event_callback_del(ly_main, EVAS_CALLBACK_DEL, __tabbar_btn_del_cb);
1260                 /* evas_object_event_callback_del(Evas_Object *obj, Evas_Callback_Type type, Evas_Object_Event_Cb func) */
1261         }
1262 }
1263
1264 static void __obj_listen_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
1265
1266 {
1267         ret_if(!obj);
1268         const char *vconf = (const char *)evas_object_data_get(obj, "vconf");
1269         vconf_callback_fn cb = (vconf_callback_fn)evas_object_data_get(obj, "cb");
1270         (void)vconf_ignore_key_changed(vconf, cb);
1271
1272         evas_object_data_set(obj, "vconf", NULL);
1273         evas_object_data_set(obj, "cb", NULL);
1274         evas_object_data_set(obj, "data", NULL);
1275 }
1276
1277 EXPORT_PUBLIC void
1278 setting_obj_listen_on(Evas_Object *obj, const char *vconf, vconf_callback_fn cb, void *data)
1279 {
1280         /*Bind the life of obj and vconf listen */
1281         evas_object_data_set(obj, "vconf", vconf);
1282         \
1283         evas_object_data_set(obj, "cb", cb);
1284         \
1285         evas_object_data_set(obj, "data", data);
1286         \
1287         vconf_notify_key_changed(vconf, cb, data);
1288         evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, __obj_listen_del_cb, NULL);
1289 }
1290
1291 EXPORT_PUBLIC void
1292 setting_decorate_image_RGBA(Evas_Object *obj, int r, int g, int b, int a)
1293 {
1294         if (obj)
1295                 evas_object_color_set(obj, r, g, b, a);
1296 }
1297
1298
1299
1300 EXPORT_PUBLIC void
1301 setting_protect_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
1302 {
1303         /*SETTING_TRACE("data:%p", data); */
1304         if (NULL != data) *((void **)data) = NULL;
1305 }
1306