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");
120 Setting_GenGroupItem_Data *list_item =
121 (Setting_GenGroupItem_Data *) data;
122 list_item->sub_desc = (char *)g_strdup(elm_entry_entry_get(obj));
123 Evas_Object *entry_container = elm_object_parent_widget_get(obj);
126 if (elm_entry_is_empty(obj))
128 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
129 elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
133 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
134 elm_object_signal_emit(entry_container, "elm,state,eraser,show", "elm");
139 static void __entry_unfocused(void *data, Evas_Object *obj, void *event_info) // Unfocused callback will show guidetext and hide X marked button.
142 Evas_Object *entry_container = data;
143 //whe entry unfocused, its guidetext will becomes "Input here"
144 elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
145 if (elm_entry_is_empty(obj))
146 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
147 elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
149 static void __entry_focused(void *data, Evas_Object *obj, void *event_info) // Focused callback will show X marked button and hide guidetext.
152 Evas_Object *entry_container = data;
153 //whe entry focused, its guidetext will becomes "Input here"
154 elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
155 if (!elm_entry_is_empty(obj))
156 elm_object_signal_emit(entry_container, "elm,state,eraser,show", "elm");
157 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
159 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.
162 Evas_Object *entry = data;
163 elm_entry_entry_set(entry, "");
164 elm_object_focus_set(entry, EINA_TRUE);
167 static void __chk_changed(void *data, Evas_Object *obj, void *event_info)
169 retm_if(data == NULL, "Data parameter is NULL");
170 Setting_GenGroupItem_Data *list_item =
171 (Setting_GenGroupItem_Data *) data;
172 list_item->chk_status = elm_check_state_get(obj); /* for update */
175 static void __error_popup_response_cb(void *data, Evas_Object *obj,
179 retm_if(data == NULL, "Data parameter is NULL");
180 Setting_GenGroupItem_Data *list_item = data;
181 if (list_item->notify) {
182 evas_object_del(list_item->notify);
183 list_item->notify = NULL;
187 static void __max_len_reached(void *data, Evas_Object *obj, void *event_info)
190 retm_if(data == NULL, "Data parameter is NULL");
191 retm_if(!elm_object_focus_get(obj), "Entry is not focused");//notify only when entry is being focused on.
193 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
194 if (!list_item->notify)
196 list_item->notify = setting_create_popup_without_btn(list_item, list_item->win_main,
197 NULL, _(EXCEED_LIMITATION_STR),
198 __error_popup_response_cb,
199 POPUP_INTERVAL, FALSE, FALSE);
200 elm_object_focus_set(list_item->eo_check, EINA_FALSE);
202 //postpone 2 seconds again
203 elm_popup_timeout_set(list_item->notify, POPUP_INTERVAL);
207 static void __entry_keydown(void *data, Evas *e, Evas_Object *obj, void *event_info)
209 ret_if(event_info == NULL);
210 Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event_info;
211 SETTING_TRACE_DEBUG("ev->key : %s", ev->key);
212 SETTING_TRACE("obj:%p, %s", obj, elm_entry_entry_get(obj));
214 Evas_Object *entry_container = elm_object_parent_widget_get(obj);
215 if(safeStrLen(elm_entry_entry_get(obj)) > 0) {
216 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
218 //elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
219 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
224 * Do process when clicking radio in subitem of expandable item
226 void setting_sub_list_rd_change(void *data, Evas_Object *obj, void *event_info)
229 retm_if(data == NULL, "Data parameter is NULL");
230 Setting_GenGroupItem_Data *list_item =
231 (Setting_GenGroupItem_Data *) data;
232 list_item->chk_status = elm_radio_value_get(obj); /* for update */
234 Elm_Object_Item *subItem = list_item->item;
235 Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subItem);
237 Setting_GenGroupItem_Data *data_subItem = elm_object_item_data_get(subItem); /* subItem data */
238 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
240 ret_if(NULL == data_subItem || NULL == data_parentItem);
242 setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
243 list_item->chk_status, &err);
245 data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
246 elm_object_item_data_set(data_parentItem->item, data_parentItem);
247 elm_genlist_item_update(data_parentItem->item);
251 * Do process when clicking on subitem of expandable item
253 void setting_sub_list_sel_cb(void *data, Evas_Object *obj, void *event_info)
257 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
258 Elm_Object_Item *subitem = (Elm_Object_Item *) event_info;
259 Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subitem);
260 elm_genlist_item_selected_set(subitem, 0);
261 Setting_GenGroupItem_Data *data_subItem =
262 elm_object_item_data_get(subitem);
263 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
264 ret_if(NULL == data_subItem || NULL == data_parentItem);
266 elm_radio_value_set(data_subItem->rgd, data_subItem->chk_status);
268 setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
269 data_subItem->chk_status, &err);
270 setting_retm_if(0 != err, "Set vconf error[%d]",data_parentItem->int_slp_setting_binded);
272 data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
273 elm_object_item_data_set(data_parentItem->item, data_parentItem);
274 elm_genlist_item_update(data_parentItem->item);
277 static void __exp_list_smart_cb(void *data, Evas_Object *obj, void *event_info)
279 ret_if(data == NULL || event_info == NULL);
280 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
281 char *cb_type = data;
283 if (0 == safeStrCmp(cb_type, "drag")
284 || 0 == safeStrCmp(cb_type, "longpressed")) {
285 //Evas_Object *base_view = (Evas_Object *) elm_genlist_item_object_get(item);
286 //edje_object_signal_emit(base_view, "mouse,out", "touch_arrow");
287 } else if (0 == safeStrCmp(cb_type, "contracted")) {
288 elm_genlist_item_subitems_clear(item);
292 static void _gl_Gendial_sel(void *data, Evas_Object *obj, void *event_info)
294 /* SETTING_TRACE_BEGIN; */
295 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
296 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
297 elm_genlist_item_selected_set(item, 0);
300 static void _gl_Gendial_sel_expand(void *data, Evas_Object *obj,
303 /* SETTING_TRACE_BEGIN; */
304 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
305 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
306 elm_genlist_item_selected_set(item, 0);
307 bool status = !elm_genlist_item_expanded_get(item);
308 elm_genlist_item_expanded_set(item, status);
311 static char *_gl_Gendial_text_get(void *data, Evas_Object *obj,
314 /* SETTING_TRACE_BEGIN; */
315 Setting_GenGroupItem_Data *item_data =
316 (Setting_GenGroupItem_Data *) data;
317 /* SETTING_TRACE("part:%s", part); */
318 if (SWALLOW_Type_LAYOUT_ENTRY == item_data->swallow_type) { /* no need to create 'text' part */
322 /* for font size view */
323 if (SWALLOW_Type_1RADIO_1LABLE == item_data->swallow_type) {
324 char speciliztion[MAX_SPECIALIZITION_LEN] = {0,};
326 SETTING_TRACE("item_data->chk_status:%d", item_data->chk_status);
327 if (SYSTEM_SETTINGS_FONT_SIZE_SMALL == item_data->chk_status) {
328 font_size = LABEL_FONT_SIZE_SMALL;
329 } else if (SYSTEM_SETTINGS_FONT_SIZE_LARGE == item_data->chk_status) {
330 font_size = LABEL_FONT_SIZE_LARGE;
331 } else if (SYSTEM_SETTINGS_FONT_SIZE_HUGE == item_data->chk_status) {
332 font_size = LABEL_FONT_SIZE_HUGE;
333 } else if (SYSTEM_SETTINGS_FONT_SIZE_GIANT == item_data->chk_status) {
334 font_size = LABEL_FONT_SIZE_GIANT;
336 font_size = LABEL_FONT_SIZE_NORMAL;
338 SETTING_TRACE("font_size:%d", font_size);
339 snprintf(speciliztion, sizeof(speciliztion), "<font_size=%d>%s</font_size>",
340 font_size, _(item_data->keyStr));
341 return (char *)g_strdup(speciliztion);
344 if (!safeStrCmp(part, "elm.text") || !safeStrCmp(part, "elm.text.1")) { /* title */
345 if (item_data->keyStr) {
346 return (char *)g_strdup(_(item_data->keyStr)); /* use item_data->keyStr */
349 } else if (!safeStrCmp(part, "elm.text.2")) { /* bottom or right */
350 if (item_data->sub_desc) {
351 return (char *)g_strdup(item_data->sub_desc);
358 static Evas_Object *__add_check(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
360 retv_if(!item_data || !parent, NULL);
361 Evas_Object *check = elm_check_add(parent);
362 elm_check_state_set(check, item_data->chk_status);
363 evas_object_show(check);
364 evas_object_pass_events_set(check, 1);
365 evas_object_propagate_events_set(check, 0);
367 item_data->eo_check = check;
369 if (item_data->chk_change_cb) {
370 evas_object_smart_callback_add(check,"changed",item_data->chk_change_cb,item_data);
372 evas_object_smart_callback_add(check,"changed", __chk_changed, item_data);
376 static Evas_Object *__add_check_icon(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
378 retv_if(!item_data || !parent, NULL);
379 Evas_Object *check = __add_check(item_data, parent);
381 Evas_Object *thumb = NULL;
382 if (item_data->r_swallow_path) {
383 thumb = elm_icon_add(parent);
384 elm_icon_file_set(thumb,
385 item_data->r_swallow_path,
387 evas_object_size_hint_aspect_set(thumb,
388 EVAS_ASPECT_CONTROL_VERTICAL,
392 Evas_Object *layout = elm_layout_add(parent);
393 elm_layout_file_set(layout, SETTING_THEME_EDJ_NAME,
395 evas_object_size_hint_weight_set(layout,
398 elm_object_part_content_set(layout, "checkbox", check);
399 elm_object_part_content_set(layout, "thumbnail", thumb);
400 evas_object_show(layout);
403 static Evas_Object *__add_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
405 retv_if(!item_data || !parent, NULL);
406 Evas_Object *check = __add_check(item_data, parent);
407 elm_object_style_set(check, "on&off");
410 static Evas_Object *__add_multiline_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
412 retv_if(!item_data || !parent, NULL);
413 Evas_Object *chk = __add_toggle(item_data, parent);
414 elm_object_style_set(chk, "on&off");
418 static Evas_Object *__add_radio(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
420 retv_if(!item_data || !parent, NULL);
421 if (!item_data->rgd) { /* exceptional handling */
422 item_data->rgd = elm_radio_add(parent);
423 elm_radio_state_value_set(item_data->rgd, -1);
425 Evas_Object *radio = elm_radio_add(parent);
426 elm_radio_state_value_set(radio,
427 item_data->chk_status);
428 elm_radio_group_add(radio, item_data->rgd);
429 evas_object_show(radio);
430 item_data->eo_check = radio;
431 if (item_data->chk_change_cb) {
432 evas_object_smart_callback_add(radio,
434 item_data->chk_change_cb,
437 evas_object_smart_callback_add(radio,
444 static Evas_Object *__add_button(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
446 retv_if(!item_data || !parent, NULL);
447 Evas_Object *btn = elm_button_add(parent);
448 evas_object_show(btn);
449 if (item_data->r_swallow_path)
451 elm_object_style_set(btn, item_data->r_swallow_path);
453 if (item_data->keyStr)
455 elm_object_text_set(btn, _(item_data->keyStr));
457 evas_object_propagate_events_set(btn, EINA_FALSE);
458 if (item_data->chk_change_cb)
459 evas_object_smart_callback_add(btn,
461 item_data->chk_change_cb,
465 static Evas_Object *__add_entry(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
467 retv_if(!item_data || !parent, NULL);
468 elm_genlist_mode_set(parent, ELM_LIST_COMPRESS); /* resolve abnormal height issue */
469 Evas_Object *ed_name =
470 setting_create_editfiled(parent, _(item_data->keyStr),
471 item_data->sub_desc);
472 Evas_Object *entry = elm_object_part_content_get(ed_name, "elm.swallow.content");
473 item_data->eo_check = entry;
474 elm_entry_input_panel_layout_set(entry,
475 item_data->input_type);
477 if (item_data->isSinglelineFlag) {
478 elm_entry_single_line_set(entry, EINA_TRUE);
481 if (item_data->isPasswordFlag) {
482 elm_entry_single_line_set(entry, EINA_TRUE);
483 elm_entry_password_set(entry, EINA_TRUE);
486 if (item_data->limit_filter_data) {
487 elm_entry_markup_filter_append
489 elm_entry_filter_limit_size,
490 item_data->limit_filter_data);
492 evas_object_smart_callback_add(entry,
498 if (item_data->stop_change_cb) {//invoked when stop focusing on
499 evas_object_smart_callback_add(entry,
501 item_data->stop_change_cb,
506 evas_object_smart_callback_add(entry,
511 if (item_data->digits_filter_data) {
512 elm_entry_markup_filter_append
514 elm_entry_filter_accept_set,
515 item_data->digits_filter_data);
518 /* for Setting App, All the entrys's context popup shouldn't be able */
519 /* to insert images, text is the only one can be inserted. */
520 elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
522 if (item_data->chk_change_cb) {
523 evas_object_smart_callback_add
525 "changed", item_data->chk_change_cb,
529 evas_object_smart_callback_add(entry, "changed", __entry_changed, item_data);
530 evas_object_smart_callback_add(entry, "focused", __entry_focused, ed_name);
531 elm_object_signal_callback_add(ed_name, "elm,eraser,clicked", "elm", __eraser_clicked, entry);
533 Evas_Object_Event_Cb key_down_cb = __entry_keydown;
534 if (item_data->start_change_cb) {
535 key_down_cb = (Evas_Object_Event_Cb)(item_data->start_change_cb);
537 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, key_down_cb, item_data->userdata);
539 if (item_data->input_panel_disable_flag) {
540 elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
544 static Evas_Object *__add_slider(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
546 retv_if(!item_data || !parent, NULL);
547 Evas_Object *li_slider =
548 setting_create_slider(parent, item_data->evas,
549 item_data->l_swallow_path,
550 item_data->r_swallow_path,
551 item_data->chk_status,
552 item_data->isIndicatorVisible,
553 item_data->slider_min,
554 item_data->slider_max,
555 item_data->chk_change_cb,
556 item_data->start_change_cb,
557 item_data->stop_change_cb,
559 evas_object_pass_events_set(li_slider, 1);
560 evas_object_propagate_events_set(li_slider, 0);
561 item_data->eo_check = li_slider;
565 static Evas_Object *__add_datefield(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
567 retv_if(!item_data || !parent, NULL);
568 /* **********create time/date field */
569 Evas_Object *datetimefield = item_data->eo_check = elm_datetime_add(parent);
570 evas_object_size_hint_weight_set(datetimefield, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
571 evas_object_size_hint_align_set(datetimefield, EVAS_HINT_FILL, 0.5);
572 evas_object_show(datetimefield);
574 char date_format[MAX_DATETIME_FORMAT_LEN + 1] = {0, };
575 const char *time_format = NULL;
576 if (item_data->chk_status)//12 hours
578 time_format = "%I : %M %p";
580 time_format = "%H : %M";
583 #if SUPPORT_DATEFIELD_DATE_FORMAT_AUTOSET //Get date-format from datefiled itself, if elm_datetime_add() supports set date-format via ICU.
584 char *old_format = elm_datetime_format_get(datetimefield);
585 snprintf(date_format, MAX_DATE_FORMAT_LEN + 1, //add one space " "
587 safeStrNCat(date_format, time_format, MAX_DATETIME_FORMAT_LEN);
589 SETTING_TRACE("datefield_format:%s", date_format);
591 snprintf(date_format, MAX_DATETIME_FORMAT_LEN,
592 "%s %s", item_data->sub_desc, time_format);
594 elm_datetime_format_set(datetimefield, date_format);
596 // min : 1970 1, 01, Thursday 00:00:00
597 // max : 2038 1, 19, Thursday 03:14:07
599 memset(&ts_ret, 0, sizeof(struct tm));
600 ts_ret.tm_year = 138;
603 elm_datetime_value_max_set(datetimefield, &ts_ret);
608 elm_datetime_value_min_set(datetimefield, &ts_ret);
611 time_t ctime = time(NULL);
613 struct tm *ts = localtime_r(&ctime, &ts_ret);
616 elm_datetime_value_set(datetimefield, &ts_ret);
618 if (item_data->chk_change_cb) {
619 evas_object_smart_callback_add(datetimefield,
621 item_data->chk_change_cb,
625 if (item_data->isItemDisableFlag) {
626 setting_disable_evas_object(datetimefield);
628 return datetimefield;
630 static Evas_Object *__add_radio_search(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
632 retv_if(!item_data || !parent, NULL);
633 Evas_Object *box = elm_box_add(parent);
634 elm_box_horizontal_set(box, 1);
637 Evas_Object *radio = __add_radio(item_data, parent);
638 setting_disable_evas_object(radio);
639 elm_box_pack_end(box, radio);
642 Evas_Object *separator =
643 setting_create_blank_rect_customize(box,
644 SETTING_HALF_SCREEN_WIDTH,
645 SETTING_PADDING_HEIGHT);
646 elm_box_pack_end(box, separator);
649 Evas_Object *progressbar = elm_progressbar_add(parent);
650 elm_object_style_set(progressbar, "list_process");
651 evas_object_size_hint_align_set(progressbar,
652 EVAS_HINT_FILL, 0.5);
653 evas_object_size_hint_weight_set(progressbar,
656 elm_progressbar_pulse(progressbar, EINA_TRUE);
657 evas_object_show(progressbar);
658 elm_box_pack_end(box, progressbar);
660 evas_object_show(box);
663 static Evas_Object *__add_search(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
665 retv_if(!item_data || !parent, NULL);
666 // added by JTS: CQ H0100135171
667 Evas_Object *box = elm_box_add(parent);
668 elm_box_horizontal_set(box, 1);
671 Evas_Object *separator =
672 setting_create_blank_rect_customize(box,
673 SETTING_HALF_SCREEN_WIDTH, SETTING_PADDING_HEIGHT);
674 elm_box_pack_end(box, separator);
677 Evas_Object *progressbar = elm_progressbar_add(parent);
678 elm_object_style_set(progressbar, "list_process");
679 evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5);
680 evas_object_size_hint_weight_set(progressbar,
681 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
682 elm_progressbar_pulse(progressbar, EINA_TRUE);
683 evas_object_show(progressbar);
684 elm_box_pack_end(box, progressbar);
686 evas_object_show(box);
690 static Evas_Object *__add_process(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
692 retv_if(!item_data || !parent, NULL);
693 Evas_Object *progressbar = elm_progressbar_add(parent);
694 elm_object_style_set(progressbar, "list_process");
695 evas_object_size_hint_align_set(progressbar,
696 EVAS_HINT_FILL, 0.5);
697 evas_object_size_hint_weight_set(progressbar,
700 elm_progressbar_pulse(progressbar, EINA_TRUE);
701 evas_object_show(progressbar);
705 static Evas_Object *__add_radio_lable(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
707 retv_if(!item_data || !parent, NULL);
710 Evas_Object *radio = __add_radio(item_data, parent);
715 static Evas_Object *__add_left_default(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
717 retv_if(!item_data || !parent || !item_data->l_swallow_path, NULL);
718 Evas_Object *icon = elm_icon_add(parent);
719 elm_icon_file_set(icon, item_data->l_swallow_path,NULL);
720 evas_object_size_hint_aspect_set(icon,EVAS_ASPECT_CONTROL_VERTICAL,1, 1);
723 static Evas_Object *__add_right_default(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
725 retv_if(!item_data || !parent || !item_data->r_swallow_path, NULL);
726 Evas_Object *icon = elm_icon_add(parent);
727 elm_icon_file_set(icon, item_data->r_swallow_path,NULL);
728 evas_object_size_hint_aspect_set(icon,EVAS_ASPECT_CONTROL_VERTICAL,1, 1);
733 typedef Evas_Object * (*__drawer_fp)(Setting_GenGroupItem_Data *item_data, Evas_Object *parent);
736 SWALLOW_Type type; // ui type
739 static __Content_Drawer __cd_left[SWALLOW_Type_MAX] = {
741 {SWALLOW_Type_1CHECK, __add_check},
742 {SWALLOW_Type_1TOGGLE, __add_toggle},
743 {SWALLOW_Type_1RADIO, __add_radio},
744 {SWALLOW_Type_1BUTTON, __add_button},
746 //base objects in an layout
747 {SWALLOW_Type_LAYOUT_ENTRY, __add_entry},
748 {SWALLOW_Type_LAYOUT_SLIDER, __add_slider},
749 {SWALLOW_Type_LAYOUT_DATEFIELD, __add_datefield},
751 //other compelx objects
752 {SWALLOW_Type_1SEARCH, __add_search},
753 {SWALLOW_Type_1PROCESS, __add_process},
754 {SWALLOW_Type_MULTILINE_1TOGGLE, __add_multiline_toggle},
755 {SWALLOW_Type_1CHECKICON, __add_check_icon},
756 {SWALLOW_Type_1RADIO_1SEARCH, __add_radio_search},
757 {SWALLOW_Type_1RADIO_1LABLE, __add_radio_lable},
759 //left part object of the type
760 {SWALLOW_Type_1ICON_1RADIO, __add_left_default},
761 {SWALLOW_Type_1RADIO_1PROCESS, __add_radio},
763 static __Content_Drawer __cd_right[SWALLOW_Type_MAX] = {
764 //right part object of the type
765 {SWALLOW_Type_1ICON_1RADIO, __add_toggle},
766 {SWALLOW_Type_1RADIO_1PROCESS, __add_process},
769 static __Content_Drawer __cd_end[SWALLOW_Type_MAX] = {
770 //end part object of the type
771 {SWALLOW_Type_1RADIO, __add_radio},
773 /*static __Part_Drawer __pd[__MAX_PART_NUM] = {
774 {"elm.icon", __cd_left},
775 {"elm.icon.1", __cd_left},
776 {"elm.icon.2", __cd_right},
777 {"elm.swallow.end", __cd_end},
780 static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj,
783 retv_if(!data, NULL);
784 Setting_GenGroupItem_Data *item_data = data;
785 retv_if(!data, NULL);
786 __Content_Drawer *cd_list = NULL;
787 __drawer_fp fp = NULL;
788 if (!safeStrCmp(part, "elm.icon") || !safeStrCmp(part, "elm.icon.1"))
790 fp = __add_left_default; //hold default drawer
793 else if (!safeStrCmp(part, "elm.icon.2"))
795 fp = __add_right_default; //hold default drawer
796 cd_list = __cd_right;
798 else if (!safeStrCmp(part, "elm.swallow.end"))
800 //the default value of fp is NULL here
803 if (!cd_list) return NULL;//invalid part
806 for (; idx < SWALLOW_Type_MAX; idx++)
808 if (item_data->swallow_type == cd_list[idx].type)//match using swallow type
810 fp = cd_list[idx].draw;
814 return fp ? fp(item_data, obj) : NULL;
817 static void _gl_Gendial_del(void *data, Evas_Object *obj)
819 /* SETTING_TRACE_BEGIN; */
820 Setting_GenGroupItem_Data *item_data =
821 (Setting_GenGroupItem_Data *) data;
823 G_FREE(item_data->keyStr);
824 G_FREE(item_data->sub_desc);
825 G_FREE((item_data->l_swallow_path));
826 G_FREE((item_data->r_swallow_path));
827 G_FREE(item_data->item_style);
830 if (item_data->digits_filter_data)
832 G_FREE(item_data->digits_filter_data->accepted);
833 G_FREE(item_data->digits_filter_data->rejected);
834 FREE(item_data->digits_filter_data);
838 if (item_data->notify) {
839 evas_object_del(item_data->notify);
840 item_data->notify = NULL;
843 FREE(item_data->limit_filter_data);
844 __BACK_POINTER_UNSET(item_data);
847 /* SETTING_TRACE_END; */
851 * To intialize an Elm_Genlist_Item_Class, according to item style
853 * @param[in] item_style
856 bool setting_create_Gendial_itc(const char *item_style,
857 Elm_Genlist_Item_Class *itc)
859 itc->item_style = item_style;
860 itc->func.text_get = _gl_Gendial_text_get;
861 itc->func.content_get = _gl_Gendial_content_get;
862 itc->func.state_get = NULL;
863 itc->func.del = _gl_Gendial_del; /* _gl_Gendial_del; */
868 * Create group style item
870 * @return a pointer to Setting_GenGroupItem_Data
872 Setting_GenGroupItem_Data *setting_create_Gendial_field_group_titleItem(Evas_Object *genlist,
873 const Elm_Genlist_Item_Class *itc,
874 Elm_Object_Item *parent,
875 Elm_Genlist_Item_Type flag, /* ELM_GENLIST_ITEM_GROUP or ELM_GENLIST_ITEM_NONE */
877 setting_call_back_func gl_sel)
879 /* SETTING_TRACE_BEGIN; */
880 Setting_GenGroupItem_Data *item_data =
881 (Setting_GenGroupItem_Data *) calloc(1,
883 (Setting_GenGroupItem_Data));
884 setting_retvm_if(!item_data, NULL, "calloc failed");
885 item_data->keyStr = (char *)g_strdup(keyStr);
888 elm_genlist_item_append(genlist, itc, item_data, parent,
892 elm_genlist_item_append(genlist, itc, item_data, parent,
893 flag, _gl_Gendial_sel, NULL);
899 * Create separator style item with title
901 * @return a pointer to Setting_GenGroupItem_Data
903 Setting_GenGroupItem_Data *setting_create_Gendial_field_titleItem(
904 Evas_Object *genlist,
905 const Elm_Genlist_Item_Class *itc,
907 setting_call_back_func gl_sel)
909 /* SETTING_TRACE_BEGIN; */
910 Setting_GenGroupItem_Data *item_data =
911 (Setting_GenGroupItem_Data *) calloc(1,
913 (Setting_GenGroupItem_Data));
914 setting_retvm_if(!item_data, NULL, "calloc failed");
915 item_data->keyStr = (char *)g_strdup(keyStr);
918 elm_genlist_item_append(genlist, itc, item_data, NULL,
919 ELM_GENLIST_ITEM_NONE, gl_sel,
923 elm_genlist_item_append(genlist, itc, item_data, NULL,
924 ELM_GENLIST_ITEM_NONE,
925 _gl_Gendial_sel, NULL);
931 * Create 1radio-1text style item
933 * @return a pointer to Setting_GenGroupItem_Data
936 Setting_GenGroupItem_Data *setting_create_Gendial_field_1radio(
937 Evas_Object *genlist,
938 const Elm_Genlist_Item_Class *itc,
939 setting_call_back_func gl_sel,
941 SWALLOW_Type swallow_type,
942 Evas_Object *rgd, int chk_status,
944 setting_call_back_func chk_change_cb)
946 /* SETTING_TRACE_BEGIN; */
947 Setting_GenGroupItem_Data *item_data =
948 (Setting_GenGroupItem_Data *) calloc(1,
950 (Setting_GenGroupItem_Data));
951 setting_retvm_if(!item_data, NULL, "calloc failed");
952 item_data->keyStr = (char *)g_strdup(keyStr);
953 item_data->swallow_type = swallow_type;
954 item_data->chk_status = chk_status;
955 item_data->chk_change_cb = chk_change_cb;
956 item_data->rgd = rgd;
960 elm_genlist_item_append(genlist, itc, item_data, NULL,
961 ELM_GENLIST_ITEM_NONE, gl_sel,
965 elm_genlist_item_append(genlist, itc, item_data, NULL,
966 ELM_GENLIST_ITEM_NONE,
967 _gl_Gendial_sel, sel_data);
972 Setting_GenGroupItem_Data *setting_create_Gendial_field_2radio(
973 Evas_Object *genlist,
974 const Elm_Genlist_Item_Class *itc,
975 setting_call_back_func gl_sel,
977 SWALLOW_Type swallow_type,
978 Evas_Object *rgd, int chk_status,
980 const char *sub_desc,
981 setting_call_back_func chk_change_cb)
983 /* SETTING_TRACE_BEGIN; */
984 Setting_GenGroupItem_Data *item_data =
985 (Setting_GenGroupItem_Data *) calloc(1,
987 (Setting_GenGroupItem_Data));
988 setting_retvm_if(!item_data, NULL, "calloc failed");
989 item_data->keyStr = (char *)g_strdup(keyStr);
990 item_data->sub_desc = (char *)g_strdup(sub_desc);
991 item_data->swallow_type = swallow_type;
992 item_data->chk_status = chk_status;
993 item_data->chk_change_cb = chk_change_cb;
994 item_data->rgd = rgd;
998 elm_genlist_item_append(genlist, itc, item_data, NULL,
999 ELM_GENLIST_ITEM_NONE, gl_sel,
1003 elm_genlist_item_append(genlist, itc, item_data, NULL,
1004 ELM_GENLIST_ITEM_NONE,
1005 _gl_Gendial_sel, sel_data);
1011 * Create common style item with menu icon
1013 * @return a pointer to Setting_GenGroupItem_Data
1015 Setting_GenGroupItem_Data *setting_create_Gendial_field_groupitem(
1016 Evas_Object *genlist,
1017 const Elm_Genlist_Item_Class *itc,
1018 Elm_Object_Item *parent,
1019 setting_call_back_func gl_sel,
1021 SWALLOW_Type swallow_type,
1023 char *r_icon_path, int chk_status,
1024 const char *keyStr, char *sub_desc,
1025 setting_call_back_func
1028 // SETTING_TRACE_BEGIN;
1029 Setting_GenGroupItem_Data *item_data = (
1030 Setting_GenGroupItem_Data *) calloc(1, sizeof(Setting_GenGroupItem_Data));
1031 setting_retvm_if(!item_data, NULL, "calloc failed");
1033 /* to do formatting customizition in one place */
1034 if (SWALLOW_Type_LAYOUT_SPECIALIZTION == swallow_type
1035 || SWALLOW_Type_LAYOUT_SPECIALIZTION_X == swallow_type) {
1036 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
1038 char speciliztion[MAX_SPECIALIZITION_LEN] = { 0, };
1039 char* temp1 = (char *)keyStr;
1040 char*temp2 = strchr(temp1, '&');
1043 while (NULL != temp2) {
1044 if (0 == safeStrNCmp(temp2, "&", strlen("&")) ||//'&'
1045 0 == safeStrNCmp(temp2, "<", strlen("<")) ||//'<'
1046 0 == safeStrNCmp(temp2, ">", strlen(">")) ||//'>'
1047 0 == safeStrNCmp(temp2, """, strlen(""")) ||//double quotes
1048 0 == safeStrNCmp(temp2, "'", strlen("'")) ||//single quotes
1049 0 == safeStrNCmp(temp2, " ", strlen(" ")) ||//space character
1050 0 == safeStrNCmp(temp2, "©", strlen("©")) ||//copyright character
1051 0 == safeStrNCmp(temp2, "®", strlen("®"))//registeration character
1052 ) {//escape character,do nothing
1054 if ('\0' == temp[0]) break;
1055 temp2 = strchr(temp, '&');
1059 g_strlcat(speciliztion, temp1, temp2 - temp1 +1);
1060 g_strlcat(speciliztion, "&", MAX_SPECIALIZITION_LEN);
1062 if ('\0' == temp1[0]) break;
1063 temp2 = strchr(temp1, '&');
1066 if ('\0' != temp1[0]) {
1067 g_strlcat(speciliztion, temp1, MAX_SPECIALIZITION_LEN);
1071 item_data->keyStr = (char *)g_strdup(speciliztion);
1073 item_data->keyStr = (char *)g_strdup(keyStr);
1076 item_data->sub_desc = (char *)g_strdup(sub_desc);
1077 item_data->swallow_type = swallow_type;
1078 item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1079 item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1080 item_data->chk_status = chk_status;
1081 item_data->chk_change_cb = chk_change_cb;
1085 elm_genlist_item_append(genlist, itc, item_data, parent,
1086 ELM_GENLIST_ITEM_NONE, gl_sel,
1090 elm_genlist_item_append(genlist, itc, item_data, parent,
1091 ELM_GENLIST_ITEM_NONE,
1092 _gl_Gendial_sel, sel_data);
1094 if (SWALLOW_Type_LAYOUT_SPECIALIZTION == swallow_type) {
1095 Elm_Object_Item *item = elm_genlist_item_append(genlist,
1098 ELM_GENLIST_ITEM_NONE,
1100 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1101 //Fix the separator line disappear issue when clicking "SPECIALIZTION" words in new HD theme
1102 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1109 * Common function to create a genlist item
1110 * @return a pointer to Setting_GenGroupItem_Data
1112 Setting_GenGroupItem_Data *setting_create_Gendial_field_def(Evas_Object *
1114 const Elm_Genlist_Item_Class *itc,
1115 setting_call_back_func
1125 setting_call_back_func chk_change_cb)
1127 return setting_create_Gendial_field_groupitem(genlist, itc, NULL,
1129 swallow_type, l_icon_path,
1130 r_icon_path, chk_status,
1136 * Create 1entry style item
1137 * @return a pointer to Setting_GenGroupItem_Data
1139 Setting_GenGroupItem_Data *setting_create_Gendial_field_entry(Evas_Object *
1141 const Elm_Genlist_Item_Class *itc,
1142 setting_call_back_func gl_sel,
1151 setting_call_back_func
1153 Elm_Input_Panel_Layout
1155 bool isPasswordFlag,
1162 /* SETTING_TRACE_BEGIN; */
1163 Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *) calloc(1,
1164 sizeof (Setting_GenGroupItem_Data));
1165 setting_retvm_if(!item_data, NULL, "calloc failed");
1166 item_data->keyStr = (char *)g_strdup(keyStr);
1167 item_data->sub_desc = (char *)g_strdup(sub_desc);
1168 item_data->swallow_type = swallow_type;
1169 item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1170 item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1171 item_data->chk_status = chk_status;
1172 item_data->chk_change_cb = chk_change_cb;
1174 item_data->input_type = input_type;
1175 item_data->isPasswordFlag = isPasswordFlag;
1176 item_data->isFocusFlag = isFocusFlag;
1178 Elm_Entry_Filter_Accept_Set *digits_filter_data =
1179 (Elm_Entry_Filter_Accept_Set *) calloc(1, sizeof (Elm_Entry_Filter_Accept_Set));
1180 if(!digits_filter_data) {
1181 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Accept_Set failed");
1182 // free allocated data
1183 G_FREE(item_data->keyStr);
1184 G_FREE(item_data->sub_desc);
1185 G_FREE(item_data->l_swallow_path);
1186 G_FREE(item_data->r_swallow_path);
1192 Elm_Entry_Filter_Limit_Size *limit_filter_data =
1193 (Elm_Entry_Filter_Limit_Size *) calloc(1, sizeof (Elm_Entry_Filter_Limit_Size));
1194 if(!limit_filter_data) {
1195 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Limit_Size failed");
1197 // free allocated data
1198 G_FREE(item_data->keyStr);
1199 G_FREE(item_data->sub_desc);
1200 G_FREE(item_data->l_swallow_path);
1201 G_FREE(item_data->r_swallow_path);
1203 FREE(digits_filter_data);
1207 limit_filter_data->max_char_count = max_char_count;
1208 limit_filter_data->max_byte_count = max_byte_count;
1209 digits_filter_data->accepted = (char *)g_strdup(accepted);
1210 digits_filter_data->rejected = (char *)g_strdup(rejected);
1212 item_data->digits_filter_data = digits_filter_data;
1213 item_data->limit_filter_data = limit_filter_data;
1214 item_data->userdata = sel_data;
1218 elm_genlist_item_append(genlist, itc, item_data, NULL,
1219 ELM_GENLIST_ITEM_NONE, gl_sel,
1223 elm_genlist_item_append(genlist, itc, item_data, NULL,
1224 ELM_GENLIST_ITEM_NONE,
1225 _gl_Gendial_sel, sel_data);
1231 * General function to create a parent item of expandable item
1233 * @return a pointer to Setting_GenGroupItem_Data
1235 Setting_GenGroupItem_Data *setting_create_Gendial_exp_parent_field(
1236 Evas_Object *genlist,
1237 const Elm_Genlist_Item_Class *itc,
1238 setting_call_back_func gl_sel,
1240 SWALLOW_Type swallow_type,
1244 /* SETTING_TRACE_BEGIN; */
1245 Setting_GenGroupItem_Data *item_data =
1246 (Setting_GenGroupItem_Data *) calloc(1,
1248 (Setting_GenGroupItem_Data));
1249 setting_retvm_if(!item_data, NULL, "calloc failed");
1250 item_data->keyStr = (char *)g_strdup(keyStr);
1251 item_data->sub_desc = (char *)g_strdup(sub_desc);
1252 item_data->swallow_type = swallow_type;
1256 elm_genlist_item_append(genlist, itc, item_data, NULL,
1257 ELM_GENLIST_ITEM_TREE, gl_sel,
1261 elm_genlist_item_append(genlist, itc, item_data, NULL,
1262 ELM_GENLIST_ITEM_TREE,
1263 _gl_Gendial_sel_expand, sel_data);
1269 * General function to create a subitem of expandable item
1271 * @return a pointer to Setting_GenGroupItem_Data
1273 Setting_GenGroupItem_Data *setting_create_Gendial_exp_sub_field(
1274 Evas_Object *genlist,
1275 const Elm_Genlist_Item_Class *itc,
1276 setting_call_back_func gl_sel,
1278 Elm_Object_Item *parent,
1279 SWALLOW_Type swallow_type,
1280 Evas_Object *rgd, int chk_status,
1282 setting_call_back_func
1285 /* SETTING_TRACE_BEGIN; */
1286 Setting_GenGroupItem_Data *item_data =
1287 (Setting_GenGroupItem_Data *) calloc(1,
1289 (Setting_GenGroupItem_Data));
1290 setting_retvm_if(!item_data, NULL, "calloc failed");
1291 item_data->keyStr = (char *)g_strdup(keyStr);
1292 item_data->swallow_type = swallow_type;
1293 item_data->chk_status = chk_status;
1294 item_data->rgd = rgd;
1297 gl_sel = setting_sub_list_sel_cb;
1299 if (!chk_change_cb) {
1300 chk_change_cb = setting_sub_list_rd_change;
1303 item_data->chk_change_cb = chk_change_cb;
1305 elm_genlist_item_append(genlist, itc, item_data, parent,
1306 ELM_GENLIST_ITEM_NONE, gl_sel, sel_data);
1311 * To make genlist support expandable style item
1313 void setting_enable_expandable_genlist(Evas_Object *genlist, void *data,
1314 setting_call_back_func gl_exp_cb,
1315 setting_call_back_func gl_smart_cb)
1317 ret_if(NULL == genlist);
1318 elm_genlist_tree_effect_enabled_set(genlist, TRUE);
1320 gl_smart_cb = __exp_list_smart_cb;
1324 evas_object_smart_callback_add(genlist, "expanded", gl_exp_cb, data);
1325 evas_object_smart_callback_add(genlist, "contracted", gl_smart_cb, "contracted");
1327 evas_object_smart_callback_add(genlist, "drag", gl_smart_cb, "drag");
1328 evas_object_smart_callback_add(genlist, "longpressed", gl_smart_cb, "longpressed");
1334 setting_create_Gendial_itc("dialogue/1text.2icon.2",
1335 &(networkUG->itc_1text_2icon));
1337 1. create a process genlist item : [intial state is 'PROCESS']
1338 ad->data_searching_net = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_2icon),
1339 setting_network_select_network_mouse_up_Gendial_list_radio_cb, ad,
1340 SWALLOW_Type_1RADIO_1PROCESS,
1341 ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL,
1342 "Searching..", NULL);
1343 or [intial state is 'UNPROCESS']
1344 ad->data_searching_net = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_2icon),
1345 setting_network_select_network_mouse_up_Gendial_list_radio_cb, ad,
1346 SWALLOW_Type_1RADIO,
1347 ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL,
1348 "Searching..", NULL);
1350 2. to set the PROCESS state at any place as you like:
1351 setting_begin_progress_genlist_item(ad->data_searching_net); -- change from UNPROCESS->PROCESS
1352 setting_finish_progress_genlist_item(ad->data_searching_net);--change from PROCESS->UNPROCESS
1354 void setting_begin_progress_genlist_item(Setting_GenGroupItem_Data *data_item)
1357 if (SWALLOW_Type_1RADIO != data_item->swallow_type) {
1361 data_item->swallow_type = SWALLOW_Type_1RADIO_1PROCESS;
1362 elm_object_item_data_set(data_item->item, data_item);
1363 elm_genlist_item_update(data_item->item);
1367 void setting_finish_progress_genlist_item(Setting_GenGroupItem_Data *data_item)
1370 if (SWALLOW_Type_1RADIO_1PROCESS != data_item->swallow_type) {
1373 data_item->swallow_type = SWALLOW_Type_1RADIO;
1374 elm_object_item_data_set(data_item->item, data_item);
1375 elm_genlist_item_update(data_item->item);
1380 * Check if some item is selected in done-list
1383 bool setting_done_list_is_some_item_selected(Setting_Done_List_Data *list_data)
1385 SETTING_TRACE_BEGIN;
1386 bool isFound = FALSE; /* wether can found some item checked */
1389 for (; idx < list_data->cur_item_num; idx++) {
1391 elm_check_state_get(list_data->chk_items[idx].
1392 data_GenItem->eo_check);
1401 static void __setting_done_list_item_sel(void *data)
1403 SETTING_TRACE_BEGIN;
1404 retm_if(data == NULL, "data == NULL");
1405 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1410 setting_create_sel_info_popup(list_data->ly_parent,
1411 &(list_data->selInfoPop_layout),
1412 &(list_data->selInfoPop));
1414 /* else for other checks, do rotinue checking */
1415 bool isFound = FALSE; /* wether found the item not checked */
1416 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1417 if (!list_data->chk_items[idx].data_GenItem->chk_status) {
1418 /* SETTING_TRACE("%s not select", _(list_data->chk_items[idx].item_name)); */
1422 /* SETTING_TRACE("%s select", _(list_data->chk_items[idx].item_name)); */
1427 if (isFound) { /* reset state of chk_sel_all */
1428 list_data->select_all_checked = 0;
1429 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1431 list_data->select_all_checked = 1;
1432 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1435 /* SETTING_TRACE("sel_num:%d", sel_num); */
1437 evas_object_hide(list_data->selInfoPop);
1440 char text[MAX_DISPLAY_NAME_LEN_ON_UI +1] = {0, };
1441 snprintf(text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s(%d)", _("IDS_ST_OPT_SELECTED"), sel_num);
1443 /* text set and timeout set */
1444 edje_object_part_text_set(_EDJ(list_data->selInfoPop_layout), "elm.text", text);
1449 * Do process when clicking the check object in the done-list item
1451 void setting_done_list_Gendial_chk_btn_cb(void *data, Evas_Object *obj,
1454 SETTING_TRACE_BEGIN;
1456 retm_if(data == NULL, "Data parameter is NULL");
1457 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1460 list_item->chk_status = elm_check_state_get(list_item->eo_check);
1462 Setting_Done_List_Data *list_data = list_item->userdata;
1463 __setting_done_list_item_sel(list_data);
1466 static void setting_done_list_Gendial_mouse_up_cb(void *data, Evas_Object *obj,
1470 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1471 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1472 elm_genlist_item_selected_set(item, 0);
1473 Setting_GenGroupItem_Data *list_item =
1474 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
1476 int old_status = elm_check_state_get(list_item->eo_check);
1478 list_item->chk_status = !old_status;
1479 elm_check_state_set(list_item->eo_check, list_item->chk_status);
1481 /* other process.. */
1482 Setting_Done_List_Data *list_data = list_item->userdata;
1483 __setting_done_list_item_sel(list_data);
1486 static void __setting_select_all_done(void *data)
1488 SETTING_TRACE_BEGIN;
1489 retm_if(data == NULL, "data == NULL");
1490 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1495 setting_create_sel_info_popup(list_data->ly_parent,
1496 &(list_data->selInfoPop_layout),
1497 &(list_data->selInfoPop));
1499 if (list_data->select_all_checked) {
1500 /* set all other checks state to be 1 */
1501 SETTING_TRACE_DEBUG("Select All checked");
1502 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1503 list_data->chk_items[idx].data_GenItem->chk_status = 1;
1504 elm_object_item_data_set(list_data->chk_items[idx].data_GenItem->item, list_data->chk_items [idx].data_GenItem);
1505 elm_genlist_item_update(list_data->chk_items [idx].data_GenItem->item);
1507 sel_num = list_data->cur_item_num;
1509 SETTING_TRACE_DEBUG("Select All unchecked");
1510 /* set all other checks state to be 0 */
1511 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1512 list_data->chk_items[idx].data_GenItem->chk_status = 0;
1513 elm_object_item_data_set(list_data->chk_items[idx].data_GenItem->item, list_data->chk_items[idx].data_GenItem);
1514 elm_genlist_item_update(list_data->chk_items[idx].data_GenItem->item);
1519 /* SETTING_TRACE("sel_num:%d", sel_num); */
1521 evas_object_hide(list_data->selInfoPop);
1524 char text[MAX_DISPLAY_NAME_LEN_ON_UI +1] = {0, };
1525 snprintf(text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s(%d)", _("IDS_ST_OPT_SELECTED"), sel_num);
1527 /* text set and timeout set */
1528 edje_object_part_text_set(_EDJ(list_data->selInfoPop_layout), "elm.text", text);
1532 static void __setting_select_all_layout_mouse_down_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1534 SETTING_TRACE_BEGIN;
1535 retm_if(data == NULL, "data == NULL");
1536 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1538 list_data->select_all_checked = !list_data->select_all_checked;
1539 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1541 __setting_select_all_done(list_data);
1544 static void __setting_select_all_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
1546 SETTING_TRACE_BEGIN;
1547 retm_if(data == NULL, "data == NULL");
1548 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1550 list_data->select_all_checked = elm_check_state_get(list_data->select_all_checkbox);
1551 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1552 __setting_select_all_done(data);
1556 * The API to create done-list.
1558 * @param[in] list_data
1559 * @return a done-list
1561 Evas_Object *setting_create_done_list(Setting_Done_List_Data *list_data)
1563 SETTING_TRACE_BEGIN;
1564 retvm_if(list_data == NULL, NULL, "list_data == NULL");
1565 Evas_Object *sub_layout = elm_layout_add(list_data->win_main);
1566 elm_layout_file_set(sub_layout, SETTING_THEME_EDJ_NAME, "search_layout");
1567 evas_object_size_hint_weight_set(sub_layout, EVAS_HINT_EXPAND, 0.0);
1568 evas_object_show(sub_layout);
1570 setting_create_Gendial_itc("1text.1icon.2", &(list_data->itc_1text_1icon));
1572 Evas_Object *select_all_layout = elm_layout_add(sub_layout);
1573 retvm_if(select_all_layout == NULL, NULL, "select_all_layout == NULL");
1574 elm_layout_theme_set(select_all_layout, "genlist", "item", "select_all/default");
1575 evas_object_size_hint_weight_set(select_all_layout, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
1576 evas_object_size_hint_align_set(select_all_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
1577 evas_object_event_callback_add(select_all_layout, EVAS_CALLBACK_MOUSE_DOWN, __setting_select_all_layout_mouse_down_cb, list_data);
1579 Eina_Bool select_all_checked = list_data->select_all_checked;
1580 Evas_Object *select_all_checkbox = elm_check_add(select_all_layout);
1581 elm_check_state_pointer_set(select_all_checkbox, &select_all_checked);
1582 evas_object_smart_callback_add(select_all_checkbox, "changed", __setting_select_all_check_changed_cb, list_data);
1583 evas_object_propagate_events_set(select_all_checkbox, EINA_FALSE);
1584 elm_object_part_content_set(select_all_layout, "elm.icon", select_all_checkbox);
1586 list_data->select_all_checkbox = select_all_checkbox;
1587 elm_object_part_text_set(select_all_layout, "elm.text", _(KeyStr_Select_All));
1589 Evas_Object *scroller = elm_genlist_add(list_data->win_main);
1590 retvm_if(scroller == NULL, NULL, "scroller == NULL");
1591 elm_genlist_clear(scroller); /* first to clear list */
1593 elm_object_part_content_set(sub_layout, "search_list", scroller);
1594 elm_object_part_content_set(sub_layout, "search_bar", select_all_layout);
1597 for (; index < list_data->cur_item_num; index++) {
1598 list_data->chk_items[index].data_GenItem =
1599 setting_create_Gendial_field_def(scroller,
1600 &(list_data->itc_1text_1icon),
1601 setting_done_list_Gendial_mouse_up_cb,
1603 SWALLOW_Type_1CHECK, NULL,
1605 list_data->chk_items
1606 [index].item_name, NULL,
1607 setting_done_list_Gendial_chk_btn_cb);
1608 if (list_data->chk_items[index].data_GenItem) {
1609 list_data->chk_items[index].data_GenItem->userdata = list_data;
1611 SETTING_TRACE_ERROR("list_data->chk_items[index].data_GenItem is NULL");
1620 * To disable a specialized genlist item
1624 void setting_disable_genlist_item(Elm_Object_Item *item)
1627 elm_object_item_disabled_set(item, EINA_TRUE); /* make it be dim displayed */
1632 * To enable a specialized genlist item
1636 void setting_enable_genlist_item(Elm_Object_Item *item)
1639 elm_object_item_disabled_set(item, EINA_FALSE); /* make it be normally displayed */