tizen 2.4 release
[apps/home/settings.git] / setting-common / include / setting-common-draw-widget.h
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 /**
22  *default group setting-common-draw-widget
23  *common UI code for reuse
24  */
25 #ifndef __SETTING_COMMON_DRAW_WIDGET_H__
26 #define __SETTING_COMMON_DRAW_WIDGET_H__
27 #include <setting-common-data-type.h>   /* including all the data structure */
28 #include <setting-common-general-func.h>        /* including one class of common functions */
29 #include <setting-common-data-slp-setting.h>    /* including another class of common functions */
30
31 #include <unicode/ucal.h>
32 #include <unicode/uloc.h>
33 #include <unicode/udat.h>
34 #include <unicode/ustring.h>
35 #include <unicode/udatpg.h>
36 #include <unicode/utmscale.h>
37 #include <unicode/ucol.h>
38
39
40
41 #define EXPORT_PUBLIC __attribute__ ((visibility ("default")))
42
43 #define SETTING_COMMON_DRAW_WIDGET_CONTROLBAR_ITEM_LEN 3
44 #define POPUP_INTERVAL 2.0
45
46 extern const Elm_Genlist_Item_Class itc_seperator;
47 extern const Elm_Genlist_Item_Class itc_bottom_seperator;
48 extern const Elm_Genlist_Item_Class itc_sep_line;
49
50 extern const Elm_Genlist_Item_Class itc_1text;
51 extern const Elm_Genlist_Item_Class itc_1text_1icon_2;
52 extern const Elm_Genlist_Item_Class itc_1text_1icon_2_tb;
53
54 extern const Elm_Genlist_Item_Class itc_1icon;
55 extern const Elm_Genlist_Item_Class itc_1icon_1text_sub;
56 extern const Elm_Genlist_Item_Class itc_1text_1icon;
57 extern const Elm_Genlist_Item_Class itc_1text_1icon_3;
58 extern const Elm_Genlist_Item_Class itc_1text_2icon;
59 extern const Elm_Genlist_Item_Class itc_1text_2icon_2;
60 extern const Elm_Genlist_Item_Class itc_1text_2icon_10;
61 extern const Elm_Genlist_Item_Class itc_1text_parent;
62
63 extern const Elm_Genlist_Item_Class itc_2text_2;
64 extern const Elm_Genlist_Item_Class itc_2text;
65 extern const Elm_Genlist_Item_Class itc_2text_1icon_3;
66 extern const Elm_Genlist_Item_Class itc_2text_1icon_2;
67
68 extern const Elm_Genlist_Item_Class itc_2text_3_parent;
69 extern const Elm_Genlist_Item_Class itc_2text_3;
70 extern const Elm_Genlist_Item_Class itc_2text_2icon_3;
71
72 extern const Elm_Genlist_Item_Class itc_multiline_text;
73 extern const Elm_Genlist_Item_Class itc_1text_1icon_3_tb;
74 extern const Elm_Genlist_Item_Class itc_cm_1text_1icon_2;
75 extern const Elm_Genlist_Item_Class itc_bg_1icon;
76 extern const Elm_Genlist_Item_Class itc_1icon_with_no_line;
77 extern const Elm_Genlist_Item_Class itc_1icon_with_no_padding;
78 extern const Elm_Genlist_Item_Class itc_group_item;
79 extern const Elm_Genlist_Item_Class itc_multiline_1text_1icon;
80 extern const Elm_Genlist_Item_Class itc_1text_2icon_divider;
81 extern const Elm_Genlist_Item_Class itc_no_group_1text_1icon_2;
82
83 extern const Elm_Genlist_Item_Class itc_editfield;
84 extern const Elm_Genlist_Item_Class itc_multiline_2text;
85 extern const Elm_Genlist_Item_Class itc_1text_1icon_divider;
86 extern const Elm_Genlist_Item_Class itc_normal_1text;
87 extern const Elm_Genlist_Item_Class itc_bottom_line;
88
89
90 #define ADD_GL_SEPARATOR(scroller) \
91         {\
92                 Elm_Object_Item *item = elm_genlist_item_append(scroller, &(itc_seperator), NULL, NULL,\
93                                                                 ELM_GENLIST_ITEM_NONE, NULL, NULL);\
94                 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);\
95         }
96
97 #define ADD_GL_LABLE(scroller, str) \
98         {\
99                 if (str) {\
100                         Elm_Object_Item *item = elm_genlist_item_append(scroller, &(itc_bottom_seperator), NULL, NULL,ELM_GENLIST_ITEM_NONE, NULL, NULL);\
101                         elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);\
102                         Setting_GenGroupItem_Data *item_data = setting_create_Gendial_field_def(scroller, &itc_multiline_text,\
103                                                                                                 NULL,\
104                                                                                                 NULL,\
105                                                                                                 SWALLOW_Type_LAYOUT_SPECIALIZTION,\
106                                                                                                 NULL, NULL, 0, str, NULL, NULL);\
107                         setting_retvm_if(NULL == item_data, NULL, "item_data is NULL");\
108                         elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);\
109                 }\
110         }
111
112 #define ADD_GL_HELP(scroller, str) \
113         {\
114                 if (str) {\
115                         Setting_GenGroupItem_Data *item_data = setting_create_Gendial_field_def(scroller, &itc_multiline_text,\
116                                                                                                 NULL,\
117                                                                                                 NULL,\
118                                                                                                 SWALLOW_Type_LAYOUT_SPECIALIZTION_X,\
119                                                                                                 NULL, NULL, 0, str, NULL, NULL);\
120                         setting_retvm_if(NULL == item_data, NULL, "item_data is NULL");\
121                         elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);\
122                 }\
123         }
124
125 #ifdef OLD_GENLIST_STYLE
126 #define ADD_GL_HELP_NO_SEP(scroller, str) \
127         {\
128                 if (str) {\
129                         Setting_GenGroupItem_Data *item_data = setting_create_Gendial_field_def(scroller, &itc_multiline_text,\
130                                                                                                 NULL,\
131                                                                                                 NULL,\
132                                                                                                 SWALLOW_Type_LAYOUT_SPECIALIZTION_X,\
133                                                                                                 NULL, NULL, 0, str, NULL, NULL);\
134                         setting_retvm_if(NULL == item_data, NULL, "item_data is NULL");\
135                         elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);\
136                 }\
137         }
138 #else
139 #define ADD_GL_HELP_NO_SEP(scroller, str) \
140         {\
141                 if (str) {\
142                         Setting_GenGroupItem_Data *item_data = setting_create_Gendial_field_def(scroller, &itc_multiline_text,\
143                                                                                                 NULL,\
144                                                                                                 NULL,\
145                                                                                                 SWALLOW_Type_LAYOUT_SPECIALIZTION_X,\
146                                                                                                 NULL, NULL, 0,  str, NULL, NULL);\
147                         setting_retvm_if(NULL == item_data, NULL, "item_data is NULL");\
148                         elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);\
149                 }\
150         }
151 #endif
152
153
154 #define ADD_GL_BUTTON(scroller, btn_str, btn_cb, cb_data) \
155         {\
156                 if (btn_str) {\
157                         Setting_GenGroupItem_Data *item_data = setting_create_Gendial_field_def(scroller, &(itc_1icon_with_no_line),\
158                                                                                                 NULL,cb_data, SWALLOW_Type_1BUTTON,\
159                                                                                                 NULL, NULL, 0, btn_str, NULL,\
160                                                                                                 btn_cb);\
161                         setting_retvm_if(NULL == item_data, NULL, "item_data is NULL");\
162                         item_data->userdata = cb_data;\
163                 }\
164         }
165
166 #define ADD_GL_GIF(scroller, png_list) \
167         {\
168                 if (png_list && *png_list) {\
169                         Setting_GenGroupItem_Data *item_data = setting_create_Gendial_field_def(scroller, &(itc_1icon_with_no_line),\
170                                                                                                 NULL,NULL, SWALLOW_Type_1GIF,\
171                                                                                                 NULL, NULL, 0, NULL, NULL,\
172                                                                                                 NULL);\
173                         setting_retvm_if(NULL == item_data, NULL, "item_data is NULL");\
174                         item_data->belongs_to = (int)png_list;\
175                         if (item_data)\
176                                 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);\
177                 }\
178         }
179 #define ADD_GL_GIF_2(scroller, png_array) \
180         {\
181                 Setting_GenGroupItem_Data *item_data = setting_create_Gendial_field_def(scroller, &(itc_1icon_with_no_line),\
182                                                                                         NULL,NULL, SWALLOW_Type_1GIF,\
183                                                                                         NULL, NULL, 0, NULL, NULL,\
184                                                                                         NULL);\
185                 item_data->belongs_to = (int)png_array;\
186                 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);\
187         }
188
189 #define ADD_GL_RADIO(scroller, rdg, radio_idx, keyStr, sel_cb, cb_data) \
190         {\
191                 if(!rdg)\
192                 {\
193                         rdg = elm_radio_add(scroller);\
194                         elm_radio_state_value_set(rdg, -1);\
195                 }\
196                 if (keyStr && rdg)\
197                 {\
198                         Setting_GenGroupItem_Data *item_data = setting_create_Gendial_field_1radio(scroller, &(itc_1text_1icon_2),\
199                                                                                                    sel_cb,\
200                                                                                                    cb_data,\
201                                                                                                    SWALLOW_Type_1RADIO,\
202                                                                                                    rdg, radio_idx,\
203                                                                                                    keyStr,\
204                                                                                                    NULL);\
205                         if (item_data) {\
206                                 item_data->userdata = cb_data;\
207                         }\
208                 }\
209         }
210
211 void __toogle_gl_sel(void *data, Evas_Object *obj, void *event_info);
212 void __toogle_chk_changed(void *data, Evas_Object *obj, void *event_info);
213
214 #define ADD_GL_TOOGLE(scroller, use_vconf, keyStr, isel_cb, cb_data, ichk_cb, item_data) \
215         {\
216                 if (keyStr)\
217                 {\
218                         int value = 1;\
219                         vconf_get_bool(use_vconf, &value);\
220                         setting_call_back_func sel_cb = isel_cb;\
221                         setting_call_back_func chk_cb = ichk_cb;\
222                         if (!sel_cb) sel_cb = __toogle_gl_sel;\
223                         if (!chk_cb) chk_cb = __toogle_chk_changed;\
224                         \
225                         item_data = setting_create_Gendial_field_def(scroller,\
226                                                                      &itc_1text_2icon,\
227                                                                      sel_cb,\
228                                                                      cb_data,\
229                                                                      SWALLOW_Type_1ICON_1RADIO,\
230                                                                      NULL, NULL,\
231                                                                      value,\
232                                                                      keyStr,\
233                                                                      NULL,\
234                                                                      chk_cb);\
235                         if (item_data) {\
236                                 item_data->userdata = cb_data;\
237                                 item_data->int_slp_setting_binded = (int)use_vconf;\
238                         }\
239                 }\
240         }
241
242 #define _P(pEvasObj) do { \
243                 evas_object_event_callback_add(pEvasObj, EVAS_CALLBACK_DEL, setting_protect_cb, &(pEvasObj));\
244         }while(0);
245
246 /**
247  * Do process when clicking radio in subitem of expandable item
248  */
249 extern void setting_sub_list_rd_change(void *data, Evas_Object *obj,
250                                        void *event_info);
251
252 /**
253  * Hide the input pannel
254  */
255 extern void setting_hide_input_pannel_cb(Evas_Object *entry);
256
257 /**
258  * Do process when clicking on subitem of expandable item
259  */
260 extern void setting_sub_list_sel_cb(void *data, Evas_Object *obj,
261                                     void *event_info);
262
263 /**
264  * Do process when clicking on a common genlist item
265  */
266 extern void setting_mouse_up_Gendial_list_radio_cb(void *data,
267                                                    Evas_Object *obj,
268                                                    void *event_info);
269
270 /**
271  * To intialize an Elm_Genlist_Item_Class, according to item style
272  */
273 extern bool setting_create_Gendial_itc(const char *item_style,
274                                        Elm_Genlist_Item_Class *itc);
275
276
277 /**
278  * Create separator style item with title
279  * @return a pointer to Setting_GenGroupItem_Data
280  */
281 extern Setting_GenGroupItem_Data *setting_create_Gendial_field_titleItem(
282     Evas_Object *genlist,
283     const Elm_Genlist_Item_Class *itc,
284     const char *keyStr,
285     setting_call_back_func gl_sel);
286
287 /**
288  * Create 1radion-1text style item
289  * @return a pointer to Setting_GenGroupItem_Data
290  */
291 extern Setting_GenGroupItem_Data *setting_create_Gendial_field_1radio(
292     Evas_Object *genlist,
293     const Elm_Genlist_Item_Class *itc,
294     setting_call_back_func gl_sel,
295     void *sel_data,
296     SWALLOW_Type swallow_type,
297     Evas_Object *rgd, int chk_status,
298     const char *keyStr,
299     setting_call_back_func chk_change_cb);
300
301 /**
302  * Create 1radio-1button style item
303  * @return a pointer to Setting_GenGroupItem_Data
304  */
305 extern Setting_GenGroupItem_Data *setting_create_Gendial_field_1radio_1button(
306     Evas_Object *genlist,
307     const Elm_Genlist_Item_Class *itc,
308     setting_call_back_func gl_sel,
309     void *sel_data,
310     SWALLOW_Type swallow_type,
311     char *button_style,
312     Evas_Object *rgd, int chk_status,
313     const char *keyStr,
314     setting_call_back_func chk_change_cb,
315     setting_call_back_func btn_clicked_cb);
316
317
318 #if 0
319 /**
320  * Create common style item with menu icon
321  * @return a pointer to Setting_GenGroupItem_Data
322  */
323 extern Setting_GenGroupItem_Data *setting_create_Gendial_field_groupitem(
324     Evas_Object *genlist,
325     const Elm_Genlist_Item_Class *itc,
326     Elm_Object_Item *parent,
327     setting_call_back_func gl_sel,
328     void *sel_data,
329     SWALLOW_Type swallow_type,
330     char *l_icon_path,
331     char *r_icon_path, int chk_status,
332     const char *keyStr, char *sub_desc,
333     setting_call_back_func
334     chk_change_cb);
335 #endif
336
337 extern Setting_GenGroupItem_Data *setting_create_Gendial_field_helpitem_without_bottom_separator(
338     Evas_Object *genlist,
339     const Elm_Genlist_Item_Class *itc,
340     SWALLOW_Type swallow_type,
341     const char *keyStr);
342
343 extern Setting_GenGroupItem_Data *setting_create_Gendial_field_insert_help_without_bottom_separator(
344     Evas_Object *genlist,
345     const Elm_Genlist_Item_Class *itc,
346     Elm_Object_Item *after_it,
347     SWALLOW_Type swallow_type,
348     const char *keyStr);
349
350 /**
351  * Common function to create a genlist item
352  * @return a pointer to Setting_GenGroupItem_Data
353  */
354 extern Setting_GenGroupItem_Data *setting_create_Gendial_field_def(Evas_Object *
355                                                                    genlist,
356                                                                    const Elm_Genlist_Item_Class *itc,
357                                                                    setting_call_back_func gl_sel,
358                                                                    void *sel_data,
359                                                                    SWALLOW_Type swallow_type,
360                                                                    char *l_icon_path,
361                                                                    char *r_icon_path,
362                                                                    int chk_status,
363                                                                    const char *keyStr,
364                                                                    char *sub_desc,
365                                                                    setting_call_back_func chk_change_cb);
366
367 extern Setting_GenGroupItem_Data *setting_create_Gendial_field_entry_with_return_key(Evas_Object *
368         genlist,
369         const Elm_Genlist_Item_Class *itc,
370         setting_call_back_func gl_sel,
371         void *sel_data,
372         SWALLOW_Type
373         swallow_type,
374         char *l_icon_path,
375         char *r_icon_path,
376         int chk_status,
377         const char *keyStr,
378         char *sub_desc,
379         setting_call_back_func chk_change_cb,
380         setting_call_back_func max_reach_cb,
381         Elm_Input_Panel_Layout input_type,
382         bool isPasswordFlag,
383         bool isFocusFlag,
384         int max_char_count,
385         int max_byte_count,
386         char *accepted,
387         char *rejected,
388         Elm_Input_Panel_Return_Key_Type return_key_type,
389         setting_call_back_func activated_cb,
390         setting_call_back_func x_callback_cb);
391
392 extern Setting_GenGroupItem_Data *setting_create_Gendial_field_editfield(Evas_Object *
393                                                                          genlist,
394                                                                          const Elm_Genlist_Item_Class *itc,
395                                                                          setting_call_back_func gl_sel,
396                                                                          void *sel_data,
397                                                                          SWALLOW_Type
398                                                                          swallow_type,
399                                                                          const char *keyStr,
400                                                                          char *sub_desc,
401                                                                          setting_call_back_func
402                                                                          chk_change_cb,
403                                                                          setting_call_back_func
404                                                                          focused_cb,
405                                                                          setting_call_back_func
406                                                                          unfocused_cb,
407                                                                          setting_call_back_func
408                                                                          activated_cb,
409                                                                          setting_call_back_func
410                                                                          max_reached_cb,
411                                                                          Elm_Input_Panel_Layout
412                                                                          input_type,
413                                                                          bool isPasswordFlag,
414                                                                          bool isFocusFlag,
415                                                                          int max_char_count,
416                                                                          int max_byte_count,
417                                                                          char *accepted,
418                                                                          char *rejected);
419
420 /**
421  * General function to create a subitem of expandable item
422  *
423  * @return a pointer to Setting_GenGroupItem_Data
424  */
425 extern Setting_GenGroupItem_Data *setting_create_Gendial_exp_sub_field(
426     Evas_Object *genlist,
427     const Elm_Genlist_Item_Class *itc,
428     setting_call_back_func gl_sel,
429     void *sel_data,
430     Elm_Object_Item *parent,
431     SWALLOW_Type swallow_type,
432     Evas_Object *rgd,
433         int chk_status,
434     const char *keyStr,
435     setting_call_back_func chk_change_cb);
436
437 /**
438  * General function to create a parent item of expandable item
439  *
440  * @return a pointer to Setting_GenGroupItem_Data
441  */
442 extern Setting_GenGroupItem_Data *setting_create_Gendial_exp_parent_field(
443     Evas_Object *genlist,
444     const Elm_Genlist_Item_Class *itc,
445     setting_call_back_func gl_sel,
446     void *sel_data,
447     SWALLOW_Type swallow_type,
448     const char *keyStr,
449     char *sub_desc);
450
451 /**
452  * To make genlist support expandable style item
453  */
454 extern void setting_enable_expandable_genlist(Evas_Object *genlist, void *data,
455                                               setting_call_back_func gl_exp_cb,
456                                               setting_call_back_func
457                                               gl_smart_cb);
458
459
460 /**
461  * To create slider object of a genlist item
462  * @return a slider container object
463  */
464 extern Evas_Object *setting_create_slider(Evas_Object *win_main, Evas *evas,
465                                           const char *l_swallow_path,
466                                           const char *r_swallow_path,
467                                           double value,
468                                           bool indicator,
469                                           double slider_min,
470                                           double slider_max,
471                                           setting_call_back_func
472                                           slider_change_cb,
473                                           setting_call_back_func
474                                           slider_start_change_cb,
475                                           setting_call_back_func
476                                           slider_stop_change_cb, void *cb_data);
477
478 /**
479  * To create slider object of a genlist item
480  * @return a slider container object
481  */
482 extern Evas_Object *setting_create_5step_slider(Evas_Object *win_main, Evas *evas,
483                                                 const char *l_swallow_path,
484                                                 const char *r_swallow_path,
485                                                 double value,
486                                                 bool indicator,
487                                                 double slider_min,
488                                                 double slider_max,
489                                                 setting_call_back_func
490                                                 slider_change_cb,
491                                                 setting_call_back_func
492                                                 slider_start_change_cb,
493                                                 setting_call_back_func
494                                                 slider_stop_change_cb, void *cb_data);
495
496 /**
497  * The main implement body of create a certain size icon
498  */
499 extern void create_image_box_add_ex(void *data, Evas_Object *win_main,
500                                     Evas *evas, char *img_path, int img_w,
501                                     int img_h,
502                                     Evas_Object_Event_Cb mouse_down_cb,
503                                     Evas_Object_Event_Cb mouse_up_cb,
504                                     Evas_Object **image_box,
505                                     Evas_Object **img);
506
507 /**
508  * To create a size fixed icon
509  * @return a image container object
510  */
511 extern Evas_Object *create_image_box_add(void *data, Evas_Object *win_main,
512                                          Evas *evas, char *img_path, int img_w,
513                                          int img_h,
514                                          Evas_Object_Event_Cb mouse_down_cb,
515                                          Evas_Object_Event_Cb mouse_up_cb);
516
517 /**
518 * @ To create a size specialized icon
519 * @return a image container object
520 */
521 extern Evas_Object *create_bgimage_box_add(void *data, Evas_Object *win_main,
522                                            Evas *evas, char *img_path,
523                                            int img_w, int img_h,
524                                            Evas_Object_Event_Cb mouse_down_cb,
525                                            Evas_Object_Event_Cb mouse_up_cb);
526
527 /**
528 * @ create a box container
529 *
530 * @param[in] win_main
531 *
532 * @return a box container
533 */
534 extern Evas_Object *setting_create_client_bx(Evas_Object *win_main);
535
536 /**
537 * The API to Create a lable
538 * @return a lable
539 */
540 extern Evas_Object *setting_create_lable(Evas_Object *parent, const char *text, const char *style, const char *align);
541
542 /**
543 * The API to Create an object to show an image
544 * @return an object to show an image
545 */
546 extern Evas_Object *setting_create_image(Evas_Object *parent, const char *img_path);
547
548 /**
549 * The API to Create an object to show an image with round corner
550 * @return an object to show an image
551 */
552 extern Evas_Object *setting_create_image_with_round_corner(Evas *evas, const char *img_path, int w, int h);
553
554 /**
555 * The API to Create an object to show anamition image
556 * @return an object to show anamition image
557 */
558 extern Evas_Object *setting_create_gif(Evas_Object *parent, const char **png_list);
559
560 /**
561 * Alternate the check object status and its binded vcof value via original vcofn value
562 */
563 extern int setting_draw_onoff_status(Evas_Object *obj,
564                                      setting_bool_slp_list key);
565
566 /**
567 * Set the vconf value via its binded check object.
568 * @return 0: sucess, other: failed
569 */
570 extern int setting_reset_slp_key_by_status(Evas_Object *obj,
571                                            setting_bool_slp_list key);
572
573 /**
574 * Set the status of check object via its binded vconf value.
575 * @return  0: sucess, other: failed
576 */
577 extern int setting_check_onoff_status(Evas_Object *obj,
578                                       setting_bool_slp_list key);
579
580 /**
581 * Set the status of radio group object via its binded vconf value.
582 * @return  0: sucess, other: failed
583 */
584 extern int setting_update_chk_status(Evas_Object *chk,
585                                      setting_int_slp_list type);
586
587 /**
588 * Create a size specilized rectangle object
589 * @return a size specilized rectangle object
590 */
591 extern Evas_Object *setting_create_blank_rect_customize(Evas_Object *layout,
592                                                         int w, int h);
593
594 /**
595 * Create a size fixed rectangle object
596 * @param[in] layout
597 * @return a size fixed rectangle object
598 */
599 extern Evas_Object *setting_create_blank_rect(Evas_Object *layout);
600
601 /**
602 * The API to Create an editfiled object
603 * @return an editfiled object
604 */
605 extern Evas_Object *setting_create_editfiled(Evas_Object *win_main,
606                                              char *title, char *def_str, char *guide_text);
607 /**
608 * The API to Create a standard layout
609 * @return a standard layout
610 */
611 extern Evas_Object *setting_create_win_layout(Evas_Object *win_obj);
612 /**
613 * The API to Create a naviframe
614 * @return a naviframe
615 */
616 extern Evas_Object *setting_create_navi_bar(Evas_Object *layout);
617
618 extern Elm_Object_Item *setting_create_guild_layout(Evas_Object *navi_bar,
619                                                     char *title_str,
620                                                     char *lbutton_str,
621                                                     char *rbutton_str,
622                                                     char *mbutton_str,
623                                                     setting_call_back_func lbutton_click_cb,
624                                                     setting_call_back_func rbutton_click_cb,
625                                                     setting_call_back_func mbutton_click_cb,
626                                                     char *content_str1,
627                                                     char **png_list,
628                                                     char *content_str2,
629                                                     char *content_button_str,
630                                                     setting_call_back_func content_button_click_cb,
631                                                     void *cb_data);
632 extern void setting_navi_items_update(Evas_Object *navigate_bar);
633
634 extern Elm_Object_Item *setting_create_guild_layout2(Evas_Object *navi_bar,
635                                                      char *title_str,
636                                                      char *lbutton_str,
637                                                      char *rbutton_str,
638                                                      char *mbutton_str,
639                                                      setting_call_back_func lbutton_click_cb,
640                                                      setting_call_back_func rbutton_click_cb,
641                                                      setting_call_back_func mbutton_click_cb,
642                                                      char *content_str1,
643                                                      Evas_Object **ug_layout,
644                                                      char *content_str2,
645                                                      char *content_button_str,
646                                                      setting_call_back_func content_button_click_cb,
647                                                      void *cb_data);
648 /**
649 * The API to Create a button
650 * @return a button
651 */
652 extern Evas_Object *setting_create_button(Evas_Object *parent, const char *btn_str,
653                                           const char *btn_style,
654                                           setting_call_back_func btn_click_cb,
655                                           void *cb_data);
656
657 extern void setting_nf_check_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
658 extern void setting_nf_check_change_cb(void *data, Evas_Object *obj, void *event_info);
659 extern void setting_nf_check_vconf_cb(keynode_t *key, void *data);
660 #define ADD_NAVIFRAME_CHECK(parent, navi_it, vconf) \
661         {\
662                 Evas_Object *check = elm_check_add(parent);\
663                 int value = 0;\
664                 vconf_get_bool(vconf, &value);\
665                 elm_check_state_set(check, value);\
666                 elm_object_style_set(check, "on&off");\
667                 elm_object_item_part_content_set(navi_it, "title_right_btn", check);\
668                 (void)vconf_notify_key_changed(vconf, setting_nf_check_vconf_cb, check);\
669                 evas_object_smart_callback_add(check, "changed", setting_nf_check_change_cb, vconf);\
670                 evas_object_event_callback_add(check, EVAS_CALLBACK_DEL, setting_nf_check_del_cb, vconf);\
671         }
672
673 /**
674 * The API to Create title buttons of naviframe
675 * if sip is shown,the buttons created by this API will be shown,it sip is hidden,they will be hiden too
676 * @return non
677 */
678 extern void setting_append_naviframe_title_buttons(Elm_Object_Item *navi_it,
679                                                    Evas_Object *navigate_bar,
680                                                    char *more_button_str,
681                                                    char *left_button_str,
682                                                    char *right_button_str,
683                                                    char *back_button_str,
684                                                    setting_call_back_func more_button_click_cb,
685                                                    setting_call_back_func left_button_click_cb,
686                                                    setting_call_back_func right_button_click_cb,
687                                                    setting_call_back_func back_button_click_cb,
688                                                    void *cb_data);
689 /**
690 * The API to Create top buttons onto naviframe
691 * @return a naviframe item
692 */
693 extern Elm_Object_Item *setting_create_navi_bar_top_buttons(char *title_str,
694                                                             char *lbutton_str,
695                                                             char *rbutton_str,
696                                                             char *mbutton_str,
697                                                             setting_call_back_func lbutton_click_cb,
698                                                             setting_call_back_func rbutton_click_cb,
699                                                             setting_call_back_func mbutton_click_cb,
700                                                             void *cb_data, Evas_Object *eo_view,/*any container obj */
701                                                             Evas_Object *navigate_bar);
702
703 /**
704 * Create buttons on the specialized navigation bar
705 * @param[in] eo_view    navigation bar's content
706 * @param[in] controlbar   title obj of navigation bar
707 */
708 extern void
709 setting_create_navi_bar_buttons(char *title_str,
710                                 char *lbutton_str,
711                                 setting_call_back_func lbutton_click_cb,
712                                 void *cb_data, Evas_Object *eo_view,
713                                 Evas_Object *navigate_bar,
714                                 Evas_Object *titleobj);
715
716 /**
717 * The general API to create a layout with navigation bar,
718 *   which contents any evas container object(@param[eo_view]) as its content
719 *
720 * @param[in] eo_view    navigation bar's content
721 * @param[out] titleobj   title obj of navigation bar
722 *
723 * return main layout of UG or App..
724 */
725
726 Evas_Object *setting_create_layout_navi_bar(Evas_Object *win_layout,
727                                             Evas_Object *win_obj,
728                                             char *title_str,
729                                             char *lbutton_str,
730                                             setting_call_back_func lbutton_click_cb,
731                                             void *cb_data,
732                                             Evas_Object *eo_view,
733                                             Evas_Object **navi_bar,
734                                             Evas_Object **titleobj);
735
736 /**
737 * The API to create a layout with navigation bar,
738 *   which contents a scroller object as its content
739 *
740 * @param[out] scroller   navigation bar's content
741 *
742 * @return a layout with a special navigation bar and at most 2 buttons
743 */
744 extern Evas_Object *setting_create_layout_navi_bar_scroller(Evas_Object *win_layout,
745                                                             Evas_Object *win_obj,
746                                                             char *title_str,
747                                                             char *lbutton_str,
748                                                             char *rbutton_str,
749                                                             setting_call_back_func lbutton_click_cb,
750                                                             setting_call_back_func rbutton_click_cb,
751                                                             void *cb_data,
752                                                             Evas_Object **scroller,
753                                                             Evas_Object **navi_bar);
754
755 /**
756 * The API to create a layout with navigation bar,
757 *       which contents a genlist object as its content
758 *
759 * @return a layout with a special navigation bar and at most 2 buttons
760 */
761 extern Evas_Object *setting_create_layout_navi_bar_genlist(Evas_Object *win_layout,
762                                                            Evas_Object *win_obj,
763                                                            char *title_str,
764                                                            char *lbutton_str,
765                                                            char *rbutton_str,
766                                                            setting_call_back_func lbutton_click_cb,
767                                                            setting_call_back_func rbutton_click_cb,
768                                                            void *cb_data,
769                                                            Evas_Object **genlist,
770                                                            Evas_Object **navi_bar);
771
772 /**
773 * The general API to push any evas object(@param[in][eo_view]) to the specialized navi_bar,
774 *   which contents at most 3 buttons
775 */
776 extern Elm_Object_Item *setting_push_layout_navi_bar(char *title_str,
777                                                      char *lbutton_str, char *rbutton_str,
778                                                      char *mbutton_str,
779                                                      setting_call_back_func lbutton_click_cb,
780                                                      setting_call_back_func rbutton_click_cb,
781                                                      setting_call_back_func mbutton_click_cb,
782                                                      void *cb_data,
783                                                      Evas_Object *eo_view,
784                                                      Evas_Object *navi_bar,
785                                                      Evas_Object **titleobj);
786
787 /**
788 * The API to push a scroller object(@param[in][scroller]) to the specialized navi_bar,
789 *   which contents at most 2 buttons
790 */
791 extern Elm_Object_Item *setting_push_layout_navi_bar_scroller(Evas_Object *win_main,
792                                                               char *title_str,
793                                                               char *lbutton_str,
794                                                               char *rbutton_str,
795                                                               setting_call_back_func lbutton_click_cb,
796                                                               setting_call_back_func rbutton_click_cb,
797                                                               void *cb_data,
798                                                               Evas_Object **scroller,
799                                                               Evas_Object *navi_bar);
800
801 /**
802 * The API to push a genlist object(@param[in][genlist]) to the specialized navi_bar,
803 *   which contents at most 2 buttons
804 */
805 extern Elm_Object_Item *
806 setting_push_layout_navi_bar_genlist(Evas_Object *win_layout,
807                                      Evas_Object *win_obj,
808                                      char *title_str,
809                                      char *lbutton_str,
810                                      char *rbutton_str,
811                                      setting_call_back_func lbutton_click_cb,
812                                      setting_call_back_func rbutton_click_cb,
813                                      void *cb_data,
814                                      Evas_Object **genlist,
815                                      Evas_Object *navi_bar);
816
817 /**
818 * Create a text box, which cannot be edited
819 * @return a text box, which cannot be edited
820 */
821 extern Evas_Object *setting_create_textbox(Evas_Object *parent,
822                                            const char *content);
823
824 /****done_list****/
825
826 /*The API is going to register a message to NOTIFICATION_STATUS_MESSAGE_KEY, and the message will be shown in indicator
827 * @ Quickpannel App save the value of var message, and it supply notification_status_monitor_message_cb_set,
828 * @ in which, Indicator can set process of vconf(NOTIFICATION_STATUS_MESSAGE_KEY) change event,in the call __message_callback,
829 * @ it will invoke indicator_part_text_emit_by_win(win,"message.text.compare", text); to show message you registered
830 */
831 extern void setting_create_indicator_notification(const char *message);
832
833 extern Evas_Object *setting_create_done_list_with_image(Setting_Done_List_Data *list_data, const char *title);
834
835 /**
836 * Get searchbar text and register redraw_cb by idler.
837 *
838 * @param[in] data
839 * @param[in] search_bar
840 * @param[in] search_text
841 * @param[in] search_idler
842 * @param[in] redraw_cb
843 */
844 extern int setting_searchbar_redraw(void *data,
845                                     Evas_Object *search_bar,
846                                     char *search_text,
847                                     Ecore_Idler **search_idler,
848                                     Ecore_Task_Cb redraw_cb);
849
850 /**
851 * Create searchar, register change cb and cancel cb.
852 *
853 * @param[in] data
854 * @param[in] parent
855 * @param[in] change_cb
856 * @param[in] cancel_cb
857 */
858 extern Evas_Object *setting_create_searchbar(void *data, Evas_Object *parent,
859                                              Evas_Smart_Cb change_cb,
860                                              Evas_Smart_Cb cancel_cb);
861
862 /**
863 * Make it no effect when clicking on a evas object, such as, layout, genlist
864 *
865 */
866 extern void setting_disable_evas_object(Evas_Object *obj);
867
868 /**
869 * Make it normal acting when clicking on a evas object, such as, layout, genlist
870 *
871 */
872 extern void setting_enable_evas_object(Evas_Object *obj);
873
874 /**
875 * To disable a specialized genlist item
876 *
877 */
878 extern void setting_disable_genlist_item(Elm_Object_Item *item);
879
880 /**
881 * To enable a specialized genlist item
882 *
883 */
884 extern void setting_enable_genlist_item(Elm_Object_Item *item);
885
886 extern void setting_genlist_item_disabled_set(Setting_GenGroupItem_Data *item_data, int disable);
887
888
889 /**
890 * To resize a evas object, such as, icon, button..
891 *
892 */
893 extern void setting_resize_object(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
894
895 /**
896 * To create a bg object
897 *
898 */
899 extern Evas_Object *setting_create_bg(Evas_Object *parent, Evas_Object *win, const char *bg_style);
900
901 /**
902 * To make an object which is operated by setting_dim_evas_object normal color
903 *
904 * @param[in] obj
905 * @param[in] b_transparenct:
906 *       1:the appearence of obj is made up of transparent backgroud color.
907 *       0:the appearence of obj is made up of non transparent color.
908 */
909 extern void setting_undo_dim_evas_object(Evas_Object *obj, bool b_transparenct);
910
911 /**
912 * To make an object dim color
913 *
914 * @param[in] obj
915 * @param[in] b_transparenct:
916 *       1:the appearence of obj is made up of transparent backgroud color.
917 *       0:the appearence of obj is made up of non transparent color.
918 */
919 extern void setting_dim_evas_object(Evas_Object *obj, bool b_transparenct);
920
921 /**
922 * To make an object looks clickable: if pressed, it is dim color;if unpressed, it is normal color;
923 *
924 * @param[in] obj
925 */
926 extern void setting_make_evas_object_clickable(Evas_Object *obj);
927 /**
928 * To create an icon which looks clickable(if pressed, it is dim color;if unpressed, it is normal color)
929 *
930 * @param[in] parent
931 * @param[in] img_path
932 * @param[in] up_cb
933 * @param[in] down_cb
934 * @param[in] move_cb
935 * @param[in] data
936 */
937 extern Evas_Object *setting_create_icon(Evas_Object *parent, const char *img_path,
938                                         Evas_Object_Event_Cb up_cb,
939                                         Evas_Object_Event_Cb down_cb,
940                                         Evas_Object_Event_Cb move_cb,
941                                         void *data);
942 /**
943 * to make sbu-obj the same size as parent-obj.Notice: subobj is the only sub-obj @parent wants to display
944 *
945 * @param[in] parent
946 * @param[in] subobj
947 */
948
949 /**
950 * To create a button which only has a image and looks clickable
951 * (if pressed, it is dim color;if unpressed, it is normal color)
952 * @param[in] parent
953 * @param[in] img_path
954 * @param[in] up_cb
955 * @param[in] down_cb
956 * @param[in] move_cb
957 * @param[in] data
958 */
959 extern Evas_Object *setting_create_image_button(Evas_Object *parent,
960                                                 const char *btn_img,
961                                                 setting_call_back_func clicked_cb,
962                                                 setting_call_back_func unpressed_cb,
963                                                 void *data);
964
965 /*
966 * set font_size, color or align(right, left, middle),if need, you
967 * can add </font_siz>, </color> or </align> to controll a segment words; or else
968 * the text will take the same effect until the end of text.
969 */
970 extern char *setting_customize_text(const char *input_str, const int font_size,
971                                     const char *color, const char *align);
972
973 extern void setting_go_to_top(Evas_Object *content);
974
975 /*
976 * To go to top of list in top view of navibar.
977 * @param[in] navibar
978 */
979 extern void setting_go_to_navibar_list_top(Evas_Object *navibar);
980
981 extern void setting_check_genlist_item_bottom_line(Elm_Object_Item *item);
982 extern void __gl_realized_cb(void *data, Evas_Object *obj, void *event_info);
983 extern void setting_entry_entry_set(Evas_Object *entry, const char *text, const int font_size);
984 extern void setting_update_gl_item_chk_status(Setting_GenGroupItem_Data *item_data, int status);
985 extern void setting_force_update_gl_item_chk_status(Setting_GenGroupItem_Data *item_data, int status);
986
987 extern void setting_conformant_keypad_state(Evas_Object *conform, bool enable);
988
989
990 extern Evas_Object *setting_create_navibar_title_text_btn(Evas_Object *parent, const char *text, Evas_Smart_Cb func, void *data);
991
992 extern void setting_tabbar_enable_swip_effect(Evas_Object *ly_main, Evas_Object *tabbar);
993 extern void setting_tabbar_disable_swip_effect(Evas_Object *ly_main, Evas_Object *tabbar);
994 extern void setting_decorate_image_RGBA(Evas_Object *obj, int r, int g, int b, int a);
995 extern void setting_protect_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
996
997 extern char *__setting_phone_lang_get_by_pattern(const char *locale, const char *skeleton);
998
999 ///////////////////////////////////////////////////////
1000 extern void setting_popup_del_cb(void *data, Evas_Object *obj, void *event_info);
1001 extern void setting_popup_event_set(Evas_Object *popup, void *data,
1002                               setting_call_back_func response_cb,
1003                               int timeout,/*to control the timeout time */
1004                               bool blocked_flag,/*to control whether to block the screen */
1005                               bool keygrab_flag/*to control whether to block the 'Home key' */
1006                              );
1007
1008 /*********************************************************
1009  * @brief The general API to create a default popup window
1010  *
1011  * @param data                  application context
1012  * @param parent                parent window
1013  * @param title                 popup title
1014  * @param text                  popup text
1015  * @param response_cb   called When btn was clicked
1016  * @param timeout               timeout sec
1017  * @param blocked_flag  to control whether to block the screen
1018  * @param keygrab_flag  to control whether to block key
1019  * @param btn_num               btn number
1020  * @param ...                   btn text
1021  *
1022  * @return a certain popup window
1023  **********************************************************/
1024 EXPORT_PUBLIC Evas_Object *setting_create_popup(void *data,
1025                                                                                                 Evas_Object *parent,
1026                                                                                                 char *title,
1027                                                                                                 char *text,
1028                                                                                                 setting_call_back_func response_cb,
1029                                                                                                 int timeout,
1030                                                                                                 bool blocked_flag,
1031                                                                                                 bool keygrab_flag,
1032                                                                                                 int btn_num, ...);
1033
1034
1035 /*********************************************************
1036  * @brief The general API to create a default popup window
1037  *
1038  * @param data                  application context
1039  * @param parent                parent window
1040  * @param title                 popup title
1041  * @param text                  popup text
1042  * @param response_cb   called When btn was clicked
1043  * @param back_cb               called When popup is closed without button touching
1044  * @param timeout               timeout sec
1045  * @param blocked_flag  to control whether to block the screen
1046  * @param keygrab_flag  to control whether to block key
1047  * @param btn_num               btn number
1048  * @param ...                   btn text
1049  *
1050  * @return a certain popup window
1051  **********************************************************/
1052 EXPORT_PUBLIC Evas_Object *setting_create_popup2(void *data,
1053                                                                                                 Evas_Object *parent,
1054                                                                                                 char *title,
1055                                                                                                 char *text,
1056                                                                                                 setting_call_back_func response_cb,
1057                                                                                                 setting_call_back_func back_cb,
1058                                                                                                 int timeout,
1059                                                                                                 bool blocked_flag,
1060                                                                                                 bool keygrab_flag,
1061                                                                                                 int btn_num, ...);
1062
1063
1064
1065 /******************************************************************
1066  * @brief The general API to create a popup window which contents a progressbar
1067  *
1068  * @param data                                  application context
1069  * @param parent                                parent window
1070  * @param progressbar_style             progressbar style(process_small/process_medium/process_large)
1071  * @param title                                 popup title
1072  * @param text                                  popup text
1073  * @param response_cb                   called When btn was clicked
1074  * @param timeout                               timeout sec
1075  * @param blocked_flag                  to control whether to block the screen
1076  * @param keygrab_flag                  to control whether to block key
1077  *
1078  * @return a popup window which contents a progressbar
1079  *******************************************************************/
1080 EXPORT_PUBLIC Evas_Object *setting_create_popup_with_progressbar(void *data,
1081                                                                                                                                  Evas_Object *parent,
1082                                                                                                                                  char *progressbar_style,
1083                                                                                                                                  char *title,
1084                                                                                                                                  char *text,
1085                                                                                                                                  setting_call_back_func response_cb,
1086                                                                                                                                  int timeout,
1087                                                                                                                                  bool blocked_flag,
1088                                                                                                                                  bool keygrab_flag,
1089                                                                                                                                  int btn_num, ...);
1090
1091 /******************************************************************
1092  * @brief The general API to create a popup window which contents a genlist
1093  *
1094  * @param genlist                       genlist
1095  * @param data                          application context
1096  * @param parent                        parent window
1097  * @param title                         popup title
1098  * @param response_cb           called When btn was clicked
1099  * @param timeout                       timeout sec
1100  * @param blocked_flag          to control whether to block the screen
1101  * @param keygrab_flag          to control whether to block key
1102  *
1103  * @return a popup window which contents a genlist
1104  *******************************************************************/
1105 EXPORT_PUBLIC Evas_Object *setting_create_popup_with_list(Evas_Object **genlist,
1106                                                                                                                   void *data,
1107                                                                                                                   Evas_Object *parent,
1108                                                                                                                   const char *title,
1109                                                                                                                   setting_call_back_func response_cb,
1110                                                                                                                   int timeout,
1111                                                                                                                   bool blocked_flag,
1112                                                                                                                   bool keygrab_flag,
1113                                                                                                                   int btn_num, ...);
1114
1115 #endif                          /* __SETTING_COMMON_DRAW_WIDGET_H__ */