4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
6 * Contact: MyoungJune Park <mj2004.park@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include <setting-common-draw-widget.h>
25 #include <system_settings.h>
27 #define EXCEED_LIMITATION_STR "Name is too long."
29 static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj, const char *part);
30 static char *_gl_Gendial_text_get(void *data, Evas_Object *obj, const char *part);
31 static void _gl_Gendial_del(void *data, Evas_Object *obj);
32 const Elm_Genlist_Item_Class itc_seperator = {
33 .item_style = "dialogue/separator/21/with_line",
34 .func.text_get = NULL,
35 .func.content_get = NULL,
36 .func.state_get = NULL,
40 const Elm_Genlist_Item_Class itc_bottom_seperator = {
41 .item_style = "dialogue/separator/20",
42 .func.text_get = NULL,
43 .func.content_get = NULL,
44 .func.state_get = NULL,
48 const Elm_Genlist_Item_Class itc_sep_line = {
49 .item_style = "dialogue/separator/1/with_line",
50 .func.text_get = _gl_Gendial_text_get,
51 .func.content_get = NULL,
52 .func.state_get = NULL,
56 #define DEFINE_ITC1(style, name) \
57 const Elm_Genlist_Item_Class name = {\
59 .func.text_get = _gl_Gendial_text_get,\
60 .func.content_get = _gl_Gendial_content_get,\
61 .func.state_get = NULL,\
62 .func.del = _gl_Gendial_del,\
65 DEFINE_ITC1("dialogue/1text", itc_1text);
66 DEFINE_ITC1("dialogue/1text.1icon.2", itc_1text_1icon_2);
68 DEFINE_ITC1("dialogue/1icon", itc_1icon);
69 DEFINE_ITC1("dialogue/1text.1icon/expandable2", itc_1icon_1text_sub);
70 DEFINE_ITC1("dialogue/1text.1icon", itc_1text_1icon);
71 DEFINE_ITC1("dialogue/1text.2icon", itc_1text_2icon);
72 DEFINE_ITC1("dialogue/1text.2icon.2", itc_1text_2icon_2);
74 DEFINE_ITC1("dialogue/2text.2", itc_2text_2);
75 DEFINE_ITC1("dialogue/2text", itc_2text);
76 DEFINE_ITC1("multiline/2text.1icon", itc_multiline_2text_1icon);
77 DEFINE_ITC1("dialogue/2text.1icon.3", itc_2text_1icon_3);
78 DEFINE_ITC1("dialogue/2text.1icon.6", itc_2text_1icon_6);
79 DEFINE_ITC1("dialogue/2text.1icon.7", itc_2text_1icon_7);
81 DEFINE_ITC1("dialogue/2text.3/expandable", itc_2text_3_parent);
82 DEFINE_ITC1("dialogue/2text.3", itc_2text_3);
83 DEFINE_ITC1("dialogue/2text.2icon.3", itc_2text_2icon_3);
85 DEFINE_ITC1("multiline/1text", itc_multiline_text);
86 DEFINE_ITC1("1text.1icon.2", itc_cm_1text_1icon_2);
87 DEFINE_ITC1("select_all", itc_sel_all);
88 DEFINE_ITC1("dialogue/bg/1icon", itc_bg_1icon);
89 DEFINE_ITC1("dialogue/title", itc_group_item);
92 * Do process when clicking on a common genlist item
94 void setting_mouse_up_Gendial_list_radio_cb(void *data, Evas_Object *obj,
98 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
99 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
100 elm_genlist_item_selected_set(item, 0);
101 Setting_GenGroupItem_Data *list_item =
102 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
104 setting_retm_if(data == NULL, "Data parameter is NULL");
105 Evas_Object *radio = data;
106 elm_radio_value_set(radio, list_item->chk_status);
109 static void __radio_changed(void *data, Evas_Object *obj, void *event_info)
111 retm_if(data == NULL, "Data parameter is NULL");
112 Setting_GenGroupItem_Data *list_item =
113 (Setting_GenGroupItem_Data *) data;
114 list_item->chk_status = elm_radio_value_get(obj); /* for update */
117 static void __entry_changed(void *data, Evas_Object *obj, void *event_info)
119 retm_if(data == NULL, "Data parameter is NULL");
121 Setting_GenGroupItem_Data *list_item =
122 (Setting_GenGroupItem_Data *) data;
123 list_item->sub_desc = (char *)g_strdup(elm_entry_entry_get(obj));
124 Evas_Object *entry_container = elm_object_parent_widget_get(obj);
127 if (elm_entry_is_empty(obj))
129 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
130 elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
134 if (elm_object_focus_get(obj)) //only do when entry is focused
136 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
137 elm_object_signal_emit(entry_container, "elm,state,eraser,show", "elm");
143 static void __entry_unfocused(void *data, Evas_Object *obj, void *event_info) // Unfocused callback will show guidetext and hide X marked button.
147 Evas_Object *entry_container = data;
148 //whe entry unfocused, its guidetext will becomes "Input here"
149 elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
150 if (elm_entry_is_empty(obj))
151 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
152 elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
154 static void __entry_focused(void *data, Evas_Object *obj, void *event_info) // Focused callback will show X marked button and hide guidetext.
158 Evas_Object *entry_container = data;
159 //whe entry focused, its guidetext will becomes "Input here"
160 elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
161 if (!elm_entry_is_empty(obj))
162 elm_object_signal_emit(entry_container, "elm,state,eraser,show", "elm");
163 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
165 static void __eraser_clicked(void *data, Evas_Object *obj, const char *emission, const char *source) // When X marked button is clicked, empty entry's contents.
168 Evas_Object *entry = data;
169 elm_entry_entry_set(entry, "");
170 elm_object_focus_set(entry, EINA_TRUE);
173 static void __chk_changed(void *data, Evas_Object *obj, void *event_info)
175 retm_if(data == NULL, "Data parameter is NULL");
176 Setting_GenGroupItem_Data *list_item =
177 (Setting_GenGroupItem_Data *) data;
178 list_item->chk_status = elm_check_state_get(obj); /* for update */
181 static void __error_popup_response_cb(void *data, Evas_Object *obj,
185 retm_if(data == NULL, "Data parameter is NULL");
186 Setting_GenGroupItem_Data *list_item = data;
187 if (list_item->notify) {
188 evas_object_del(list_item->notify);
189 list_item->notify = NULL;
193 static void __max_len_reached(void *data, Evas_Object *obj, void *event_info)
196 retm_if(data == NULL, "Data parameter is NULL");
197 retm_if(!elm_object_focus_get(obj), "Entry is not focused");//notify only when entry is being focused on.
199 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
200 if (!list_item->notify)
202 list_item->notify = setting_create_popup_without_btn(list_item, list_item->win_main,
203 NULL, _(EXCEED_LIMITATION_STR),
204 __error_popup_response_cb,
205 POPUP_INTERVAL, FALSE, FALSE);
206 elm_object_focus_set(list_item->eo_check, EINA_FALSE);
208 //postpone 2 seconds again
209 elm_popup_timeout_set(list_item->notify, POPUP_INTERVAL);
213 static void __entry_keydown(void *data, Evas *e, Evas_Object *obj, void *event_info)
215 ret_if(event_info == NULL);
216 Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event_info;
217 if(safeStrCmp(ev->key, "Return") == 0) //to disable the 'Enter' orginal function
219 SETTING_TRACE("ENTER %s ev->key:%s", __FUNCTION__, ev->key);
220 //hide the eraser button
221 //format like:xx<br/>
222 const char *entry_str = remove_first_substring(elm_entry_entry_get(obj), "<br/>");
223 elm_entry_entry_set(obj, entry_str);
225 elm_entry_cursor_end_set(obj);
226 setting_hide_input_pannel_cb(obj);
228 Evas_Object *entry_container = elm_object_parent_widget_get(obj);
229 if(safeStrLen(elm_entry_entry_get(obj)) > 0) {
230 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
232 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
239 * Do process when clicking radio in subitem of expandable item
241 void setting_sub_list_rd_change(void *data, Evas_Object *obj, void *event_info)
244 retm_if(data == NULL, "Data parameter is NULL");
245 Setting_GenGroupItem_Data *list_item =
246 (Setting_GenGroupItem_Data *) data;
247 list_item->chk_status = elm_radio_value_get(obj); /* for update */
249 Elm_Object_Item *subItem = list_item->item;
250 Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subItem);
252 Setting_GenGroupItem_Data *data_subItem = elm_object_item_data_get(subItem); /* subItem data */
253 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
255 ret_if(NULL == data_subItem || NULL == data_parentItem);
257 setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
258 list_item->chk_status, &err);
260 data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
261 elm_object_item_data_set(data_parentItem->item, data_parentItem);
262 elm_genlist_item_update(data_parentItem->item);
266 * Do process when clicking on subitem of expandable item
268 void setting_sub_list_sel_cb(void *data, Evas_Object *obj, void *event_info)
272 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
273 Elm_Object_Item *subitem = (Elm_Object_Item *) event_info;
274 Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subitem);
275 elm_genlist_item_selected_set(subitem, 0);
276 Setting_GenGroupItem_Data *data_subItem =
277 elm_object_item_data_get(subitem);
278 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
279 ret_if(NULL == data_subItem || NULL == data_parentItem);
281 elm_radio_value_set(data_subItem->rgd, data_subItem->chk_status);
283 setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
284 data_subItem->chk_status, &err);
285 setting_retm_if(0 != err, "Set vconf error[%d]",data_parentItem->int_slp_setting_binded);
287 data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
288 elm_object_item_data_set(data_parentItem->item, data_parentItem);
289 elm_genlist_item_update(data_parentItem->item);
292 static void __exp_list_smart_cb(void *data, Evas_Object *obj, void *event_info)
294 ret_if(data == NULL || event_info == NULL);
295 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
296 char *cb_type = data;
298 if (0 == safeStrCmp(cb_type, "drag")
299 || 0 == safeStrCmp(cb_type, "longpressed")) {
300 //Evas_Object *base_view = (Evas_Object *) elm_genlist_item_object_get(item);
301 //edje_object_signal_emit(base_view, "mouse,out", "touch_arrow");
302 } else if (0 == safeStrCmp(cb_type, "contracted")) {
303 elm_genlist_item_subitems_clear(item);
307 static void _gl_Gendial_sel(void *data, Evas_Object *obj, void *event_info)
309 /* SETTING_TRACE_BEGIN; */
310 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
311 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
312 elm_genlist_item_selected_set(item, 0);
315 static void _gl_Gendial_sel_expand(void *data, Evas_Object *obj,
318 /* SETTING_TRACE_BEGIN; */
319 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
320 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
321 elm_genlist_item_selected_set(item, 0);
322 bool status = !elm_genlist_item_expanded_get(item);
323 elm_genlist_item_expanded_set(item, status);
326 static char *_gl_Gendial_text_get(void *data, Evas_Object *obj,
329 /* SETTING_TRACE_BEGIN; */
330 Setting_GenGroupItem_Data *item_data =
331 (Setting_GenGroupItem_Data *) data;
332 /* SETTING_TRACE("part:%s", part); */
333 if (SWALLOW_Type_LAYOUT_ENTRY == item_data->swallow_type) { /* no need to create 'text' part */
337 /* for font size view */
338 if (SWALLOW_Type_1RADIO_1LABLE == item_data->swallow_type) {
339 char speciliztion[MAX_SPECIALIZITION_LEN] = {0,};
341 SETTING_TRACE("item_data->chk_status:%d", item_data->chk_status);
342 if (SYSTEM_SETTINGS_FONT_SIZE_SMALL == item_data->chk_status) {
343 font_size = LABEL_FONT_SIZE_SMALL;
344 } else if (SYSTEM_SETTINGS_FONT_SIZE_LARGE == item_data->chk_status) {
345 font_size = LABEL_FONT_SIZE_LARGE;
346 } else if (SYSTEM_SETTINGS_FONT_SIZE_HUGE == item_data->chk_status) {
347 font_size = LABEL_FONT_SIZE_HUGE;
348 } else if (SYSTEM_SETTINGS_FONT_SIZE_GIANT == item_data->chk_status) {
349 font_size = LABEL_FONT_SIZE_GIANT;
351 font_size = LABEL_FONT_SIZE_NORMAL;
353 SETTING_TRACE("font_size:%d", font_size);
354 snprintf(speciliztion, sizeof(speciliztion), "<font_size=%d>%s</font_size>",
355 font_size, _(item_data->keyStr));
356 return (char *)g_strdup(speciliztion);
359 if (!safeStrCmp(part, "elm.text") || !safeStrCmp(part, "elm.text.1")) { /* title */
360 if (item_data->keyStr) {
361 return (char *)g_strdup(_(item_data->keyStr)); /* use item_data->keyStr */
364 } else if (!safeStrCmp(part, "elm.text.2")) { /* bottom or right */
365 if (item_data->sub_desc) {
366 return (char *)g_strdup(item_data->sub_desc);
373 static Evas_Object *__add_check(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
375 retv_if(!item_data || !parent, NULL);
376 Evas_Object *check = elm_check_add(parent);
377 elm_check_state_set(check, item_data->chk_status);
378 evas_object_show(check);
379 evas_object_pass_events_set(check, 1);
380 evas_object_propagate_events_set(check, 0);
382 item_data->eo_check = check;
384 if (item_data->chk_change_cb) {
385 evas_object_smart_callback_add(check,"changed",item_data->chk_change_cb,item_data);
387 evas_object_smart_callback_add(check,"changed", __chk_changed, item_data);
391 static Evas_Object *__add_check_icon(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
393 retv_if(!item_data || !parent, NULL);
394 Evas_Object *check = __add_check(item_data, parent);
396 Evas_Object *thumb = NULL;
397 if (item_data->r_swallow_path) {
398 thumb = elm_icon_add(parent);
399 elm_icon_file_set(thumb,
400 item_data->r_swallow_path,
402 evas_object_size_hint_aspect_set(thumb,
403 EVAS_ASPECT_CONTROL_VERTICAL,
407 Evas_Object *layout = elm_layout_add(parent);
408 elm_layout_file_set(layout, SETTING_THEME_EDJ_NAME,
410 evas_object_size_hint_weight_set(layout,
413 elm_object_part_content_set(layout, "checkbox", check);
414 elm_object_part_content_set(layout, "thumbnail", thumb);
415 evas_object_show(layout);
418 static Evas_Object *__add_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
420 retv_if(!item_data || !parent, NULL);
421 Evas_Object *check = __add_check(item_data, parent);
422 elm_object_style_set(check, "on&off");
425 static Evas_Object *__add_multiline_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
427 retv_if(!item_data || !parent, NULL);
428 Evas_Object *chk = __add_toggle(item_data, parent);
429 elm_object_style_set(chk, "on&off");
433 static Evas_Object *__add_radio(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
435 retv_if(!item_data || !parent, NULL);
436 if (!item_data->rgd) { /* exceptional handling */
437 item_data->rgd = elm_radio_add(parent);
438 elm_radio_state_value_set(item_data->rgd, -1);
440 Evas_Object *radio = elm_radio_add(parent);
441 elm_radio_state_value_set(radio,
442 item_data->chk_status);
443 elm_radio_group_add(radio, item_data->rgd);
444 evas_object_show(radio);
445 item_data->eo_check = radio;
446 if (item_data->chk_change_cb) {
447 evas_object_smart_callback_add(radio,
449 item_data->chk_change_cb,
452 evas_object_smart_callback_add(radio,
459 static Evas_Object *__add_button(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
461 retv_if(!item_data || !parent, NULL);
462 Evas_Object *btn = elm_button_add(parent);
463 evas_object_show(btn);
464 if (item_data->r_swallow_path)
466 elm_object_style_set(btn, item_data->r_swallow_path);
468 if (item_data->keyStr)
470 elm_object_text_set(btn, _(item_data->keyStr));
472 evas_object_propagate_events_set(btn, EINA_FALSE);
473 if (item_data->chk_change_cb)
474 evas_object_smart_callback_add(btn,
476 item_data->chk_change_cb,
480 static Evas_Object *__add_entry(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
482 retv_if(!item_data || !parent, NULL);
483 elm_genlist_mode_set(parent, ELM_LIST_COMPRESS); /* resolve abnormal height issue */
484 Evas_Object *ed_name =
485 setting_create_editfiled(parent, _(item_data->keyStr),
486 item_data->sub_desc);
487 Evas_Object *entry = elm_object_part_content_get(ed_name, "elm.swallow.content");
488 item_data->eo_check = entry;
489 elm_entry_input_panel_layout_set(entry,
490 item_data->input_type);
492 if (item_data->isSinglelineFlag) {
493 elm_entry_single_line_set(entry, EINA_TRUE);
496 if (item_data->isPasswordFlag) {
497 elm_entry_single_line_set(entry, EINA_TRUE);
498 elm_entry_password_set(entry, EINA_TRUE);
501 if (item_data->limit_filter_data) {
502 elm_entry_markup_filter_append
504 elm_entry_filter_limit_size,
505 item_data->limit_filter_data);
507 evas_object_smart_callback_add(entry,
513 if (item_data->stop_change_cb) {//invoked when stop focusing on
514 evas_object_smart_callback_add(entry,
516 item_data->stop_change_cb,
521 evas_object_smart_callback_add(entry,
526 if (item_data->digits_filter_data) {
527 elm_entry_markup_filter_append
529 elm_entry_filter_accept_set,
530 item_data->digits_filter_data);
533 /* for Setting App, All the entrys's context popup shouldn't be able */
534 /* to insert images, text is the only one can be inserted. */
535 elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
537 if (item_data->chk_change_cb) {
538 evas_object_smart_callback_add
540 "changed", item_data->chk_change_cb,
544 evas_object_smart_callback_add(entry, "changed", __entry_changed, item_data);
545 evas_object_smart_callback_add(entry, "focused", __entry_focused, ed_name);
546 elm_object_signal_callback_add(ed_name, "elm,eraser,clicked", "elm", __eraser_clicked, entry);
548 if (item_data->start_change_cb) {
549 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, (Evas_Object_Event_Cb)(item_data->start_change_cb), item_data->userdata);
551 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, __entry_keydown, item_data);
553 if (item_data->input_panel_disable_flag) {
554 elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
558 static Evas_Object *__add_slider(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
560 retv_if(!item_data || !parent, NULL);
561 Evas_Object *li_slider =
562 setting_create_slider(parent, item_data->evas,
563 item_data->l_swallow_path,
564 item_data->r_swallow_path,
565 item_data->chk_status,
566 item_data->isIndicatorVisible,
567 item_data->slider_min,
568 item_data->slider_max,
569 item_data->chk_change_cb,
570 item_data->start_change_cb,
571 item_data->stop_change_cb,
573 evas_object_pass_events_set(li_slider, 1);
574 evas_object_propagate_events_set(li_slider, 0);
575 item_data->eo_check = li_slider;
579 static Evas_Object *__add_datefield(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
581 retv_if(!item_data || !parent, NULL);
582 /* **********create time/date field */
583 Evas_Object *datetimefield = item_data->eo_check = elm_datetime_add(parent);
584 evas_object_size_hint_weight_set(datetimefield, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
585 evas_object_size_hint_align_set(datetimefield, EVAS_HINT_FILL, 0.5);
586 evas_object_show(datetimefield);
588 char date_format[MAX_DATETIME_FORMAT_LEN + 1] = {0, };
589 const char *time_format = NULL;
590 if (item_data->chk_status)//12 hours
592 time_format = "%I : %M %p";
594 time_format = "%H : %M";
597 #if SUPPORT_DATEFIELD_DATE_FORMAT_AUTOSET //Get date-format from datefiled itself, if elm_datetime_add() supports set date-format via ICU.
598 char *old_format = elm_datetime_format_get(datetimefield);
599 snprintf(date_format, MAX_DATE_FORMAT_LEN + 1, //add one space " "
601 safeStrNCat(date_format, time_format, MAX_DATETIME_FORMAT_LEN);
603 SETTING_TRACE("datefield_format:%s", date_format);
605 snprintf(date_format, MAX_DATETIME_FORMAT_LEN,
606 "%s %s", item_data->sub_desc, time_format);
608 elm_datetime_format_set(datetimefield, date_format);
610 // min : 1970 1, 01, Thursday 00:00:00
611 // max : 2038 1, 19, Thursday 03:14:07
613 memset(&ts_ret, 0, sizeof(struct tm));
614 ts_ret.tm_year = 138;
617 elm_datetime_value_max_set(datetimefield, &ts_ret);
622 elm_datetime_value_min_set(datetimefield, &ts_ret);
625 time_t ctime = time(NULL);
627 struct tm *ts = localtime_r(&ctime, &ts_ret);
630 elm_datetime_value_set(datetimefield, &ts_ret);
632 if (item_data->chk_change_cb) {
633 evas_object_smart_callback_add(datetimefield,
635 item_data->chk_change_cb,
639 if (item_data->isItemDisableFlag) {
640 setting_disable_evas_object(datetimefield);
642 return datetimefield;
644 static Evas_Object *__add_radio_search(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
646 retv_if(!item_data || !parent, NULL);
647 Evas_Object *box = elm_box_add(parent);
648 elm_box_horizontal_set(box, 1);
651 Evas_Object *radio = __add_radio(item_data, parent);
652 setting_disable_evas_object(radio);
653 elm_box_pack_end(box, radio);
656 Evas_Object *separator =
657 setting_create_blank_rect_customize(box,
658 SETTING_HALF_SCREEN_WIDTH,
659 SETTING_PADDING_HEIGHT);
660 elm_box_pack_end(box, separator);
663 Evas_Object *progressbar = elm_progressbar_add(parent);
664 elm_object_style_set(progressbar, "list_process");
665 evas_object_size_hint_align_set(progressbar,
666 EVAS_HINT_FILL, 0.5);
667 evas_object_size_hint_weight_set(progressbar,
670 elm_progressbar_pulse(progressbar, EINA_TRUE);
671 evas_object_show(progressbar);
672 elm_box_pack_end(box, progressbar);
674 evas_object_show(box);
677 static Evas_Object *__add_search(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
679 retv_if(!item_data || !parent, NULL);
680 // added by JTS: CQ H0100135171
681 Evas_Object *box = elm_box_add(parent);
682 elm_box_horizontal_set(box, 1);
685 Evas_Object *separator =
686 setting_create_blank_rect_customize(box,
687 SETTING_HALF_SCREEN_WIDTH, SETTING_PADDING_HEIGHT);
688 elm_box_pack_end(box, separator);
691 Evas_Object *progressbar = elm_progressbar_add(parent);
692 elm_object_style_set(progressbar, "list_process");
693 evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5);
694 evas_object_size_hint_weight_set(progressbar,
695 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
696 elm_progressbar_pulse(progressbar, EINA_TRUE);
697 evas_object_show(progressbar);
698 elm_box_pack_end(box, progressbar);
700 evas_object_show(box);
704 static Evas_Object *__add_process(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
706 retv_if(!item_data || !parent, NULL);
707 Evas_Object *progressbar = elm_progressbar_add(parent);
708 elm_object_style_set(progressbar, "list_process");
709 evas_object_size_hint_align_set(progressbar,
710 EVAS_HINT_FILL, 0.5);
711 evas_object_size_hint_weight_set(progressbar,
714 elm_progressbar_pulse(progressbar, EINA_TRUE);
715 evas_object_show(progressbar);
719 static Evas_Object *__add_radio_lable(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
721 retv_if(!item_data || !parent, NULL);
724 Evas_Object *radio = __add_radio(item_data, parent);
729 static Evas_Object *__add_left_default(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
731 retv_if(!item_data || !parent || !item_data->l_swallow_path, NULL);
732 Evas_Object *icon = elm_icon_add(parent);
733 elm_icon_file_set(icon, item_data->l_swallow_path,NULL);
734 evas_object_size_hint_aspect_set(icon,EVAS_ASPECT_CONTROL_VERTICAL,1, 1);
737 static Evas_Object *__add_right_default(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
739 retv_if(!item_data || !parent || !item_data->r_swallow_path, NULL);
740 Evas_Object *icon = elm_icon_add(parent);
741 elm_icon_file_set(icon, item_data->r_swallow_path,NULL);
742 evas_object_size_hint_aspect_set(icon,EVAS_ASPECT_CONTROL_VERTICAL,1, 1);
747 typedef Evas_Object * (*__drawer_fp)(Setting_GenGroupItem_Data *item_data, Evas_Object *parent);
750 SWALLOW_Type type; // ui type
753 static __Content_Drawer __cd_left[SWALLOW_Type_MAX] = {
755 {SWALLOW_Type_1CHECK, __add_check},
756 {SWALLOW_Type_1TOGGLE, __add_toggle},
757 {SWALLOW_Type_1RADIO, __add_radio},
758 {SWALLOW_Type_1BUTTON, __add_button},
760 //base objects in an layout
761 {SWALLOW_Type_LAYOUT_ENTRY, __add_entry},
762 {SWALLOW_Type_LAYOUT_SLIDER, __add_slider},
763 {SWALLOW_Type_LAYOUT_DATEFIELD, __add_datefield},
765 //other compelx objects
766 {SWALLOW_Type_1SEARCH, __add_search},
767 {SWALLOW_Type_1PROCESS, __add_process},
768 {SWALLOW_Type_MULTILINE_1TOGGLE, __add_multiline_toggle},
769 {SWALLOW_Type_1CHECKICON, __add_check_icon},
770 {SWALLOW_Type_1RADIO_1SEARCH, __add_radio_search},
771 {SWALLOW_Type_1RADIO_1LABLE, __add_radio_lable},
773 //left part object of the type
774 {SWALLOW_Type_1ICON_1RADIO, __add_left_default},
775 {SWALLOW_Type_1RADIO_1PROCESS, __add_radio},
777 static __Content_Drawer __cd_right[SWALLOW_Type_MAX] = {
778 //right part object of the type
779 {SWALLOW_Type_1ICON_1RADIO, __add_toggle},
780 {SWALLOW_Type_1RADIO_1PROCESS, __add_process},
783 static __Content_Drawer __cd_end[SWALLOW_Type_MAX] = {
784 //end part object of the type
785 {SWALLOW_Type_1RADIO, __add_radio},
787 /*static __Part_Drawer __pd[__MAX_PART_NUM] = {
788 {"elm.icon", __cd_left},
789 {"elm.icon.1", __cd_left},
790 {"elm.icon.2", __cd_right},
791 {"elm.swallow.end", __cd_end},
794 static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj,
797 retv_if(!data, NULL);
798 Setting_GenGroupItem_Data *item_data = data;
799 retv_if(!data, NULL);
800 __Content_Drawer *cd_list = NULL;
801 __drawer_fp fp = NULL;
802 if (!safeStrCmp(part, "elm.icon") || !safeStrCmp(part, "elm.icon.1"))
804 fp = __add_left_default; //hold default drawer
807 else if (!safeStrCmp(part, "elm.icon.2"))
809 fp = __add_right_default; //hold default drawer
810 cd_list = __cd_right;
812 else if (!safeStrCmp(part, "elm.swallow.end"))
814 //the default value of fp is NULL here
817 if (!cd_list) return NULL;//invalid part
820 for (; idx < SWALLOW_Type_MAX; idx++)
822 if (item_data->swallow_type == cd_list[idx].type)//match using swallow type
824 fp = cd_list[idx].draw;
828 return fp ? fp(item_data, obj) : NULL;
831 static void _gl_Gendial_del(void *data, Evas_Object *obj)
833 /* SETTING_TRACE_BEGIN; */
834 Setting_GenGroupItem_Data *item_data =
835 (Setting_GenGroupItem_Data *) data;
837 G_FREE(item_data->keyStr);
838 G_FREE(item_data->sub_desc);
839 G_FREE((item_data->l_swallow_path));
840 G_FREE((item_data->r_swallow_path));
841 G_FREE(item_data->item_style);
844 if (item_data->digits_filter_data)
846 G_FREE(item_data->digits_filter_data->accepted);
847 G_FREE(item_data->digits_filter_data->rejected);
848 FREE(item_data->digits_filter_data);
852 if (item_data->notify) {
853 evas_object_del(item_data->notify);
854 item_data->notify = NULL;
857 FREE(item_data->limit_filter_data);
858 __BACK_POINTER_UNSET(item_data);
861 /* SETTING_TRACE_END; */
865 * To intialize an Elm_Genlist_Item_Class, according to item style
867 * @param[in] item_style
870 bool setting_create_Gendial_itc(const char *item_style,
871 Elm_Genlist_Item_Class *itc)
873 itc->item_style = item_style;
874 itc->func.text_get = _gl_Gendial_text_get;
875 itc->func.content_get = _gl_Gendial_content_get;
876 itc->func.state_get = NULL;
877 itc->func.del = _gl_Gendial_del; /* _gl_Gendial_del; */
882 * Create group style item
884 * @return a pointer to Setting_GenGroupItem_Data
886 Setting_GenGroupItem_Data *setting_create_Gendial_field_group_titleItem(Evas_Object *genlist,
887 const Elm_Genlist_Item_Class *itc,
888 Elm_Object_Item *parent,
889 Elm_Genlist_Item_Type flag, /* ELM_GENLIST_ITEM_GROUP or ELM_GENLIST_ITEM_NONE */
891 setting_call_back_func gl_sel)
893 /* SETTING_TRACE_BEGIN; */
894 Setting_GenGroupItem_Data *item_data =
895 (Setting_GenGroupItem_Data *) calloc(1,
897 (Setting_GenGroupItem_Data));
898 setting_retvm_if(!item_data, NULL, "calloc failed");
899 item_data->keyStr = (char *)g_strdup(keyStr);
902 elm_genlist_item_append(genlist, itc, item_data, parent,
906 elm_genlist_item_append(genlist, itc, item_data, parent,
907 flag, _gl_Gendial_sel, NULL);
913 * Create separator style item with title
915 * @return a pointer to Setting_GenGroupItem_Data
917 Setting_GenGroupItem_Data *setting_create_Gendial_field_titleItem(
918 Evas_Object *genlist,
919 const Elm_Genlist_Item_Class *itc,
921 setting_call_back_func gl_sel)
923 /* SETTING_TRACE_BEGIN; */
924 Setting_GenGroupItem_Data *item_data =
925 (Setting_GenGroupItem_Data *) calloc(1,
927 (Setting_GenGroupItem_Data));
928 setting_retvm_if(!item_data, NULL, "calloc failed");
929 item_data->keyStr = (char *)g_strdup(keyStr);
932 elm_genlist_item_append(genlist, itc, item_data, NULL,
933 ELM_GENLIST_ITEM_NONE, gl_sel,
937 elm_genlist_item_append(genlist, itc, item_data, NULL,
938 ELM_GENLIST_ITEM_NONE,
939 _gl_Gendial_sel, NULL);
945 * Create 1radio-1text style item
947 * @return a pointer to Setting_GenGroupItem_Data
950 Setting_GenGroupItem_Data *setting_create_Gendial_field_1radio(
951 Evas_Object *genlist,
952 const Elm_Genlist_Item_Class *itc,
953 setting_call_back_func gl_sel,
955 SWALLOW_Type swallow_type,
956 Evas_Object *rgd, int chk_status,
958 setting_call_back_func chk_change_cb)
960 /* SETTING_TRACE_BEGIN; */
961 Setting_GenGroupItem_Data *item_data =
962 (Setting_GenGroupItem_Data *) calloc(1,
964 (Setting_GenGroupItem_Data));
965 setting_retvm_if(!item_data, NULL, "calloc failed");
966 item_data->keyStr = (char *)g_strdup(keyStr);
967 item_data->swallow_type = swallow_type;
968 item_data->chk_status = chk_status;
969 item_data->chk_change_cb = chk_change_cb;
970 item_data->rgd = rgd;
974 elm_genlist_item_append(genlist, itc, item_data, NULL,
975 ELM_GENLIST_ITEM_NONE, gl_sel,
979 elm_genlist_item_append(genlist, itc, item_data, NULL,
980 ELM_GENLIST_ITEM_NONE,
981 _gl_Gendial_sel, sel_data);
986 Setting_GenGroupItem_Data *setting_create_Gendial_field_2radio(
987 Evas_Object *genlist,
988 const Elm_Genlist_Item_Class *itc,
989 setting_call_back_func gl_sel,
991 SWALLOW_Type swallow_type,
992 Evas_Object *rgd, int chk_status,
994 const char *sub_desc,
995 setting_call_back_func chk_change_cb)
997 /* SETTING_TRACE_BEGIN; */
998 Setting_GenGroupItem_Data *item_data =
999 (Setting_GenGroupItem_Data *) calloc(1,
1001 (Setting_GenGroupItem_Data));
1002 setting_retvm_if(!item_data, NULL, "calloc failed");
1003 item_data->keyStr = (char *)g_strdup(keyStr);
1004 item_data->sub_desc = (char *)g_strdup(sub_desc);
1005 item_data->swallow_type = swallow_type;
1006 item_data->chk_status = chk_status;
1007 item_data->chk_change_cb = chk_change_cb;
1008 item_data->rgd = rgd;
1012 elm_genlist_item_append(genlist, itc, item_data, NULL,
1013 ELM_GENLIST_ITEM_NONE, gl_sel,
1017 elm_genlist_item_append(genlist, itc, item_data, NULL,
1018 ELM_GENLIST_ITEM_NONE,
1019 _gl_Gendial_sel, sel_data);
1025 * Create common style item with menu icon
1027 * @return a pointer to Setting_GenGroupItem_Data
1029 Setting_GenGroupItem_Data *setting_create_Gendial_field_groupitem(
1030 Evas_Object *genlist,
1031 const Elm_Genlist_Item_Class *itc,
1032 Elm_Object_Item *parent,
1033 setting_call_back_func gl_sel,
1035 SWALLOW_Type swallow_type,
1037 char *r_icon_path, int chk_status,
1038 const char *keyStr, char *sub_desc,
1039 setting_call_back_func
1042 // SETTING_TRACE_BEGIN;
1043 Setting_GenGroupItem_Data *item_data = (
1044 Setting_GenGroupItem_Data *) calloc(1, sizeof(Setting_GenGroupItem_Data));
1045 setting_retvm_if(!item_data, NULL, "calloc failed");
1047 /* to do formatting customizition in one place */
1048 if (SWALLOW_Type_LAYOUT_SPECIALIZTION == swallow_type
1049 || SWALLOW_Type_LAYOUT_SPECIALIZTION_X == swallow_type) {
1050 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
1052 char speciliztion[MAX_SPECIALIZITION_LEN] = { 0, };
1053 char* temp1 = (char *)keyStr;
1054 char*temp2 = strchr(temp1, '&');
1057 while (NULL != temp2) {
1058 if (0 == safeStrNCmp(temp2, "&", strlen("&")) ||//'&'
1059 0 == safeStrNCmp(temp2, "<", strlen("<")) ||//'<'
1060 0 == safeStrNCmp(temp2, ">", strlen(">")) ||//'>'
1061 0 == safeStrNCmp(temp2, """, strlen(""")) ||//double quotes
1062 0 == safeStrNCmp(temp2, "'", strlen("'")) ||//single quotes
1063 0 == safeStrNCmp(temp2, " ", strlen(" ")) ||//space character
1064 0 == safeStrNCmp(temp2, "©", strlen("©")) ||//copyright character
1065 0 == safeStrNCmp(temp2, "®", strlen("®"))//registeration character
1066 ) {//escape character,do nothing
1068 if ('\0' == temp[0]) break;
1069 temp2 = strchr(temp, '&');
1073 g_strlcat(speciliztion, temp1, temp2 - temp1 +1);
1074 g_strlcat(speciliztion, "&", MAX_SPECIALIZITION_LEN);
1076 if ('\0' == temp1[0]) break;
1077 temp2 = strchr(temp1, '&');
1080 if ('\0' != temp1[0]) {
1081 g_strlcat(speciliztion, temp1, MAX_SPECIALIZITION_LEN);
1085 item_data->keyStr = (char *)g_strdup(speciliztion);
1087 item_data->keyStr = (char *)g_strdup(keyStr);
1090 item_data->sub_desc = (char *)g_strdup(sub_desc);
1091 item_data->swallow_type = swallow_type;
1092 item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1093 item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1094 item_data->chk_status = chk_status;
1095 item_data->chk_change_cb = chk_change_cb;
1099 elm_genlist_item_append(genlist, itc, item_data, parent,
1100 ELM_GENLIST_ITEM_NONE, gl_sel,
1104 elm_genlist_item_append(genlist, itc, item_data, parent,
1105 ELM_GENLIST_ITEM_NONE,
1106 _gl_Gendial_sel, sel_data);
1108 if (SWALLOW_Type_LAYOUT_SPECIALIZTION == swallow_type) {
1109 Elm_Object_Item *item = elm_genlist_item_append(genlist,
1112 ELM_GENLIST_ITEM_NONE,
1114 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1115 //Fix the separator line disappear issue when clicking "SPECIALIZTION" words in new HD theme
1116 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1123 * Common function to create a genlist item
1124 * @return a pointer to Setting_GenGroupItem_Data
1126 Setting_GenGroupItem_Data *setting_create_Gendial_field_def(Evas_Object *
1128 const Elm_Genlist_Item_Class *itc,
1129 setting_call_back_func
1139 setting_call_back_func chk_change_cb)
1141 return setting_create_Gendial_field_groupitem(genlist, itc, NULL,
1143 swallow_type, l_icon_path,
1144 r_icon_path, chk_status,
1150 * Create 1entry style item
1151 * @return a pointer to Setting_GenGroupItem_Data
1153 Setting_GenGroupItem_Data *setting_create_Gendial_field_entry(Evas_Object *
1155 const Elm_Genlist_Item_Class *itc,
1156 setting_call_back_func gl_sel,
1165 setting_call_back_func
1167 Elm_Input_Panel_Layout
1169 bool isPasswordFlag,
1176 /* SETTING_TRACE_BEGIN; */
1177 Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *) calloc(1,
1178 sizeof (Setting_GenGroupItem_Data));
1179 setting_retvm_if(!item_data, NULL, "calloc failed");
1180 item_data->keyStr = (char *)g_strdup(keyStr);
1181 item_data->sub_desc = (char *)g_strdup(sub_desc);
1182 item_data->swallow_type = swallow_type;
1183 item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1184 item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1185 item_data->chk_status = chk_status;
1186 item_data->chk_change_cb = chk_change_cb;
1188 item_data->input_type = input_type;
1189 item_data->isPasswordFlag = isPasswordFlag;
1190 item_data->isFocusFlag = isFocusFlag;
1192 Elm_Entry_Filter_Accept_Set *digits_filter_data =
1193 (Elm_Entry_Filter_Accept_Set *) calloc(1, sizeof (Elm_Entry_Filter_Accept_Set));
1194 if(!digits_filter_data) {
1195 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Accept_Set failed");
1196 // free allocated data
1197 G_FREE(item_data->keyStr);
1198 G_FREE(item_data->sub_desc);
1199 G_FREE(item_data->l_swallow_path);
1200 G_FREE(item_data->r_swallow_path);
1206 Elm_Entry_Filter_Limit_Size *limit_filter_data =
1207 (Elm_Entry_Filter_Limit_Size *) calloc(1, sizeof (Elm_Entry_Filter_Limit_Size));
1208 if(!limit_filter_data) {
1209 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Limit_Size failed");
1211 // free allocated data
1212 G_FREE(item_data->keyStr);
1213 G_FREE(item_data->sub_desc);
1214 G_FREE(item_data->l_swallow_path);
1215 G_FREE(item_data->r_swallow_path);
1217 FREE(digits_filter_data);
1221 limit_filter_data->max_char_count = max_char_count;
1222 limit_filter_data->max_byte_count = max_byte_count;
1223 digits_filter_data->accepted = (char *)g_strdup(accepted);
1224 digits_filter_data->rejected = (char *)g_strdup(rejected);
1226 item_data->digits_filter_data = digits_filter_data;
1227 item_data->limit_filter_data = limit_filter_data;
1228 item_data->userdata = sel_data;
1232 elm_genlist_item_append(genlist, itc, item_data, NULL,
1233 ELM_GENLIST_ITEM_NONE, gl_sel,
1237 elm_genlist_item_append(genlist, itc, item_data, NULL,
1238 ELM_GENLIST_ITEM_NONE,
1239 _gl_Gendial_sel, sel_data);
1245 * General function to create a parent item of expandable item
1247 * @return a pointer to Setting_GenGroupItem_Data
1249 Setting_GenGroupItem_Data *setting_create_Gendial_exp_parent_field(
1250 Evas_Object *genlist,
1251 const Elm_Genlist_Item_Class *itc,
1252 setting_call_back_func gl_sel,
1254 SWALLOW_Type swallow_type,
1258 /* SETTING_TRACE_BEGIN; */
1259 Setting_GenGroupItem_Data *item_data =
1260 (Setting_GenGroupItem_Data *) calloc(1,
1262 (Setting_GenGroupItem_Data));
1263 setting_retvm_if(!item_data, NULL, "calloc failed");
1264 item_data->keyStr = (char *)g_strdup(keyStr);
1265 item_data->sub_desc = (char *)g_strdup(sub_desc);
1266 item_data->swallow_type = swallow_type;
1270 elm_genlist_item_append(genlist, itc, item_data, NULL,
1271 ELM_GENLIST_ITEM_TREE, gl_sel,
1275 elm_genlist_item_append(genlist, itc, item_data, NULL,
1276 ELM_GENLIST_ITEM_TREE,
1277 _gl_Gendial_sel_expand, sel_data);
1283 * General function to create a subitem of expandable item
1285 * @return a pointer to Setting_GenGroupItem_Data
1287 Setting_GenGroupItem_Data *setting_create_Gendial_exp_sub_field(
1288 Evas_Object *genlist,
1289 const Elm_Genlist_Item_Class *itc,
1290 setting_call_back_func gl_sel,
1292 Elm_Object_Item *parent,
1293 SWALLOW_Type swallow_type,
1294 Evas_Object *rgd, int chk_status,
1296 setting_call_back_func
1299 /* SETTING_TRACE_BEGIN; */
1300 Setting_GenGroupItem_Data *item_data =
1301 (Setting_GenGroupItem_Data *) calloc(1,
1303 (Setting_GenGroupItem_Data));
1304 setting_retvm_if(!item_data, NULL, "calloc failed");
1305 item_data->keyStr = (char *)g_strdup(keyStr);
1306 item_data->swallow_type = swallow_type;
1307 item_data->chk_status = chk_status;
1308 item_data->rgd = rgd;
1311 gl_sel = setting_sub_list_sel_cb;
1313 if (!chk_change_cb) {
1314 chk_change_cb = setting_sub_list_rd_change;
1317 item_data->chk_change_cb = chk_change_cb;
1319 elm_genlist_item_append(genlist, itc, item_data, parent,
1320 ELM_GENLIST_ITEM_NONE, gl_sel, sel_data);
1325 * To make genlist support expandable style item
1327 void setting_enable_expandable_genlist(Evas_Object *genlist, void *data,
1328 setting_call_back_func gl_exp_cb,
1329 setting_call_back_func gl_smart_cb)
1331 ret_if(NULL == genlist);
1332 elm_genlist_tree_effect_enabled_set(genlist, TRUE);
1334 gl_smart_cb = __exp_list_smart_cb;
1338 evas_object_smart_callback_add(genlist, "expanded", gl_exp_cb, data);
1339 evas_object_smart_callback_add(genlist, "contracted", gl_smart_cb, "contracted");
1341 evas_object_smart_callback_add(genlist, "drag", gl_smart_cb, "drag");
1342 evas_object_smart_callback_add(genlist, "longpressed", gl_smart_cb, "longpressed");
1348 setting_create_Gendial_itc("dialogue/1text.2icon.2",
1349 &(networkUG->itc_1text_2icon));
1351 1. create a process genlist item : [intial state is 'PROCESS']
1352 ad->data_searching_net = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_2icon),
1353 setting_network_select_network_mouse_up_Gendial_list_radio_cb, ad,
1354 SWALLOW_Type_1RADIO_1PROCESS,
1355 ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL,
1356 "Searching..", NULL);
1357 or [intial state is 'UNPROCESS']
1358 ad->data_searching_net = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_2icon),
1359 setting_network_select_network_mouse_up_Gendial_list_radio_cb, ad,
1360 SWALLOW_Type_1RADIO,
1361 ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL,
1362 "Searching..", NULL);
1364 2. to set the PROCESS state at any place as you like:
1365 setting_begin_progress_genlist_item(ad->data_searching_net); -- change from UNPROCESS->PROCESS
1366 setting_finish_progress_genlist_item(ad->data_searching_net);--change from PROCESS->UNPROCESS
1368 void setting_begin_progress_genlist_item(Setting_GenGroupItem_Data *data_item)
1371 if (SWALLOW_Type_1RADIO != data_item->swallow_type) {
1375 data_item->swallow_type = SWALLOW_Type_1RADIO_1PROCESS;
1376 elm_object_item_data_set(data_item->item, data_item);
1377 elm_genlist_item_update(data_item->item);
1381 void setting_finish_progress_genlist_item(Setting_GenGroupItem_Data *data_item)
1384 if (SWALLOW_Type_1RADIO_1PROCESS != data_item->swallow_type) {
1387 data_item->swallow_type = SWALLOW_Type_1RADIO;
1388 elm_object_item_data_set(data_item->item, data_item);
1389 elm_genlist_item_update(data_item->item);
1394 * Check if some item is selected in done-list
1397 bool setting_done_list_is_some_item_selected(Setting_Done_List_Data *list_data)
1399 SETTING_TRACE_BEGIN;
1400 bool isFound = FALSE; /* wether can found some item checked */
1403 for (; idx < list_data->cur_item_num; idx++) {
1405 elm_check_state_get(list_data->chk_items[idx].
1406 data_GenItem->eo_check);
1415 static void __setting_done_list_item_sel(void *data)
1417 SETTING_TRACE_BEGIN;
1418 retm_if(data == NULL, "data == NULL");
1419 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1424 setting_create_sel_info_popup(list_data->ly_parent,
1425 &(list_data->selInfoPop_layout),
1426 &(list_data->selInfoPop));
1428 /* else for other checks, do rotinue checking */
1429 bool isFound = FALSE; /* wether found the item not checked */
1430 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1431 if (!list_data->chk_items[idx].data_GenItem->chk_status) {
1432 /* SETTING_TRACE("%s not select", _(list_data->chk_items[idx].item_name)); */
1436 /* SETTING_TRACE("%s select", _(list_data->chk_items[idx].item_name)); */
1441 if (isFound) { /* reset state of chk_sel_all */
1442 list_data->select_all_checked = 0;
1443 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1445 list_data->select_all_checked = 1;
1446 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1449 /* SETTING_TRACE("sel_num:%d", sel_num); */
1451 evas_object_hide(list_data->selInfoPop);
1454 char text[MAX_DISPLAY_NAME_LEN_ON_UI +1] = {0, };
1455 snprintf(text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s(%d)", _("IDS_ST_OPT_SELECTED"), sel_num);
1457 /* text set and timeout set */
1458 edje_object_part_text_set(_EDJ(list_data->selInfoPop_layout), "elm.text", text);
1463 * Do process when clicking the check object in the done-list item
1465 void setting_done_list_Gendial_chk_btn_cb(void *data, Evas_Object *obj,
1468 SETTING_TRACE_BEGIN;
1470 retm_if(data == NULL, "Data parameter is NULL");
1471 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1474 list_item->chk_status = elm_check_state_get(list_item->eo_check);
1476 Setting_Done_List_Data *list_data = list_item->userdata;
1477 __setting_done_list_item_sel(list_data);
1480 static void setting_done_list_Gendial_mouse_up_cb(void *data, Evas_Object *obj,
1484 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1485 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1486 elm_genlist_item_selected_set(item, 0);
1487 Setting_GenGroupItem_Data *list_item =
1488 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
1490 int old_status = elm_check_state_get(list_item->eo_check);
1492 list_item->chk_status = !old_status;
1493 elm_check_state_set(list_item->eo_check, list_item->chk_status);
1495 /* other process.. */
1496 Setting_Done_List_Data *list_data = list_item->userdata;
1497 __setting_done_list_item_sel(list_data);
1500 static void __setting_select_all_done(void *data)
1502 SETTING_TRACE_BEGIN;
1503 retm_if(data == NULL, "data == NULL");
1504 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1509 setting_create_sel_info_popup(list_data->ly_parent,
1510 &(list_data->selInfoPop_layout),
1511 &(list_data->selInfoPop));
1513 if (list_data->select_all_checked) {
1514 /* set all other checks state to be 1 */
1515 SETTING_TRACE_DEBUG("Select All checked");
1516 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1517 list_data->chk_items[idx].data_GenItem->chk_status = 1;
1518 elm_object_item_data_set(list_data->chk_items[idx].data_GenItem->item, list_data->chk_items [idx].data_GenItem);
1519 elm_genlist_item_update(list_data->chk_items [idx].data_GenItem->item);
1521 sel_num = list_data->cur_item_num;
1523 SETTING_TRACE_DEBUG("Select All unchecked");
1524 /* set all other checks state to be 0 */
1525 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1526 list_data->chk_items[idx].data_GenItem->chk_status = 0;
1527 elm_object_item_data_set(list_data->chk_items[idx].data_GenItem->item, list_data->chk_items[idx].data_GenItem);
1528 elm_genlist_item_update(list_data->chk_items[idx].data_GenItem->item);
1533 /* SETTING_TRACE("sel_num:%d", sel_num); */
1535 evas_object_hide(list_data->selInfoPop);
1538 char text[MAX_DISPLAY_NAME_LEN_ON_UI +1] = {0, };
1539 snprintf(text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s(%d)", _("IDS_ST_OPT_SELECTED"), sel_num);
1541 /* text set and timeout set */
1542 edje_object_part_text_set(_EDJ(list_data->selInfoPop_layout), "elm.text", text);
1546 static void __setting_select_all_layout_mouse_down_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1548 SETTING_TRACE_BEGIN;
1549 retm_if(data == NULL, "data == NULL");
1550 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1552 list_data->select_all_checked = !list_data->select_all_checked;
1553 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1555 __setting_select_all_done(list_data);
1558 static void __setting_select_all_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
1560 SETTING_TRACE_BEGIN;
1561 retm_if(data == NULL, "data == NULL");
1562 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1564 list_data->select_all_checked = elm_check_state_get(list_data->select_all_checkbox);
1565 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1566 __setting_select_all_done(data);
1570 * The API to create done-list.
1572 * @param[in] list_data
1573 * @return a done-list
1575 Evas_Object *setting_create_done_list(Setting_Done_List_Data *list_data)
1577 SETTING_TRACE_BEGIN;
1578 retvm_if(list_data == NULL, NULL, "list_data == NULL");
1579 Evas_Object *sub_layout = elm_layout_add(list_data->win_main);
1580 elm_layout_file_set(sub_layout, SETTING_THEME_EDJ_NAME, "search_layout");
1581 evas_object_size_hint_weight_set(sub_layout, EVAS_HINT_EXPAND, 0.0);
1582 evas_object_show(sub_layout);
1584 setting_create_Gendial_itc("1text.1icon.2", &(list_data->itc_1text_1icon));
1586 Evas_Object *select_all_layout = elm_layout_add(sub_layout);
1587 retvm_if(select_all_layout == NULL, NULL, "select_all_layout == NULL");
1588 elm_layout_theme_set(select_all_layout, "genlist", "item", "select_all/default");
1589 evas_object_size_hint_weight_set(select_all_layout, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
1590 evas_object_size_hint_align_set(select_all_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
1591 evas_object_event_callback_add(select_all_layout, EVAS_CALLBACK_MOUSE_DOWN, __setting_select_all_layout_mouse_down_cb, list_data);
1593 Eina_Bool select_all_checked = list_data->select_all_checked;
1594 Evas_Object *select_all_checkbox = elm_check_add(select_all_layout);
1595 elm_check_state_pointer_set(select_all_checkbox, &select_all_checked);
1596 evas_object_smart_callback_add(select_all_checkbox, "changed", __setting_select_all_check_changed_cb, list_data);
1597 evas_object_propagate_events_set(select_all_checkbox, EINA_FALSE);
1598 elm_object_part_content_set(select_all_layout, "elm.icon", select_all_checkbox);
1600 list_data->select_all_checkbox = select_all_checkbox;
1601 elm_object_part_text_set(select_all_layout, "elm.text", _(KeyStr_Select_All));
1603 Evas_Object *scroller = elm_genlist_add(list_data->win_main);
1604 retvm_if(scroller == NULL, NULL, "scroller == NULL");
1605 elm_genlist_clear(scroller); /* first to clear list */
1607 elm_object_part_content_set(sub_layout, "search_list", scroller);
1608 elm_object_part_content_set(sub_layout, "search_bar", select_all_layout);
1611 for (; index < list_data->cur_item_num; index++) {
1612 list_data->chk_items[index].data_GenItem =
1613 setting_create_Gendial_field_def(scroller,
1614 &(list_data->itc_1text_1icon),
1615 setting_done_list_Gendial_mouse_up_cb,
1617 SWALLOW_Type_1CHECK, NULL,
1619 list_data->chk_items
1620 [index].item_name, NULL,
1621 setting_done_list_Gendial_chk_btn_cb);
1622 if (list_data->chk_items[index].data_GenItem) {
1623 list_data->chk_items[index].data_GenItem->userdata = list_data;
1625 SETTING_TRACE_ERROR("list_data->chk_items[index].data_GenItem is NULL");
1634 * To disable a specialized genlist item
1638 void setting_disable_genlist_item(Elm_Object_Item *item)
1641 elm_object_item_disabled_set(item, EINA_TRUE); /* make it be dim displayed */
1646 * To enable a specialized genlist item
1650 void setting_enable_genlist_item(Elm_Object_Item *item)
1653 elm_object_item_disabled_set(item, EINA_FALSE); /* make it be normally displayed */