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>
26 #define EXCEED_LIMITATION_STR "Name is too long."
28 static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj, const char *part);
29 static char *_gl_Gendial_text_get(void *data, Evas_Object *obj, const char *part);
30 static void _gl_Gendial_del(void *data, Evas_Object *obj);
31 const Elm_Genlist_Item_Class itc_seperator = {
32 .item_style = "dialogue/separator/21/with_line",
33 .func.text_get = NULL,
34 .func.content_get = NULL,
35 .func.state_get = NULL,
39 const Elm_Genlist_Item_Class itc_bottom_seperator = {
40 .item_style = "dialogue/separator/20",
41 .func.text_get = NULL,
42 .func.content_get = NULL,
43 .func.state_get = NULL,
47 const Elm_Genlist_Item_Class itc_sep_line = {
48 .item_style = "dialogue/separator/1/with_line",
49 .func.text_get = _gl_Gendial_text_get,
50 .func.content_get = NULL,
51 .func.state_get = NULL,
55 #define DEFINE_ITC1(style, name) \
56 const Elm_Genlist_Item_Class name = {\
58 .func.text_get = _gl_Gendial_text_get,\
59 .func.content_get = _gl_Gendial_content_get,\
60 .func.state_get = NULL,\
61 .func.del = _gl_Gendial_del,\
64 DEFINE_ITC1("dialogue/1text", itc_1text);
65 DEFINE_ITC1("dialogue/1text.1icon.2", itc_1text_1icon_2);
67 DEFINE_ITC1("dialogue/1icon", itc_1icon);
68 DEFINE_ITC1("dialogue/1text.1icon/expandable2", itc_1icon_1text_sub);
69 DEFINE_ITC1("dialogue/1text.1icon", itc_1text_1icon);
70 DEFINE_ITC1("dialogue/1text.2icon", itc_1text_2icon);
71 DEFINE_ITC1("dialogue/1text.2icon.2", itc_1text_2icon_2);
73 DEFINE_ITC1("dialogue/2text.2", itc_2text_2);
74 DEFINE_ITC1("dialogue/2text", itc_2text);
75 DEFINE_ITC1("multiline/2text.1icon", itc_multiline_2text_1icon);
76 DEFINE_ITC1("dialogue/2text.1icon.3", itc_2text_1icon_3);
77 DEFINE_ITC1("dialogue/2text.1icon.6", itc_2text_1icon_6);
78 DEFINE_ITC1("dialogue/2text.1icon.7", itc_2text_1icon_7);
80 DEFINE_ITC1("dialogue/2text.3/expandable", itc_2text_3_parent);
81 DEFINE_ITC1("dialogue/2text.3", itc_2text_3);
82 DEFINE_ITC1("dialogue/2text.2icon.3", itc_2text_2icon_3);
84 DEFINE_ITC1("multiline/1text", itc_multiline_text);
85 DEFINE_ITC1("1text.1icon.2", itc_cm_1text_1icon_2);
86 DEFINE_ITC1("select_all", itc_sel_all);
87 DEFINE_ITC1("dialogue/bg/1icon", itc_bg_1icon);
88 DEFINE_ITC1("dialogue/title", itc_group_item);
91 * Do process when clicking on a common genlist item
93 void setting_mouse_up_Gendial_list_radio_cb(void *data, Evas_Object *obj,
97 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
98 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
99 elm_genlist_item_selected_set(item, 0);
100 Setting_GenGroupItem_Data *list_item =
101 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
103 setting_retm_if(data == NULL, "Data parameter is NULL");
104 Evas_Object *radio = data;
105 elm_radio_value_set(radio, list_item->chk_status);
108 static void __radio_changed(void *data, Evas_Object *obj, void *event_info)
110 retm_if(data == NULL, "Data parameter is NULL");
111 Setting_GenGroupItem_Data *list_item =
112 (Setting_GenGroupItem_Data *) data;
113 list_item->chk_status = elm_radio_value_get(obj); /* for update */
116 static void __entry_changed(void *data, Evas_Object *obj, void *event_info)
118 retm_if(data == NULL, "Data parameter is NULL");
119 Setting_GenGroupItem_Data *list_item =
120 (Setting_GenGroupItem_Data *) data;
121 list_item->sub_desc = (char *)g_strdup(elm_entry_entry_get(obj));
122 Evas_Object *entry_container = elm_object_parent_widget_get(obj);
125 if (elm_entry_is_empty(obj))
127 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
128 elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
132 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
133 elm_object_signal_emit(entry_container, "elm,state,eraser,show", "elm");
138 static void __entry_unfocused(void *data, Evas_Object *obj, void *event_info) // Unfocused callback will show guidetext and hide X marked button.
141 Evas_Object *entry_container = data;
142 //whe entry unfocused, its guidetext will becomes "Input here"
143 elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
144 if (elm_entry_is_empty(obj))
145 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
146 elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
148 static void __entry_focused(void *data, Evas_Object *obj, void *event_info) // Focused callback will show X marked button and hide guidetext.
151 Evas_Object *entry_container = data;
152 //whe entry focused, its guidetext will becomes "Input here"
153 elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
154 if (!elm_entry_is_empty(obj))
155 elm_object_signal_emit(entry_container, "elm,state,eraser,show", "elm");
156 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
158 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.
161 Evas_Object *entry = data;
162 elm_entry_entry_set(entry, "");
163 elm_object_focus_set(entry, EINA_TRUE);
166 static void __chk_changed(void *data, Evas_Object *obj, void *event_info)
168 retm_if(data == NULL, "Data parameter is NULL");
169 Setting_GenGroupItem_Data *list_item =
170 (Setting_GenGroupItem_Data *) data;
171 list_item->chk_status = elm_check_state_get(obj); /* for update */
174 static void __error_popup_response_cb(void *data, Evas_Object *obj,
178 retm_if(data == NULL, "Data parameter is NULL");
179 Setting_GenGroupItem_Data *list_item = data;
180 if (list_item->notify) {
181 evas_object_del(list_item->notify);
182 list_item->notify = NULL;
186 static void __max_len_reached(void *data, Evas_Object *obj, void *event_info)
189 retm_if(data == NULL, "Data parameter is NULL");
190 retm_if(!elm_object_focus_get(obj), "Entry is not focused");//notify only when entry is being focused on.
192 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
193 if (!list_item->notify)
195 list_item->notify = setting_create_popup_without_btn(list_item, list_item->win_main,
196 NULL, _(EXCEED_LIMITATION_STR),
197 __error_popup_response_cb,
198 POPUP_INTERVAL, FALSE, FALSE);
199 elm_object_focus_set(list_item->eo_check, EINA_FALSE);
201 //postpone 2 seconds again
202 elm_popup_timeout_set(list_item->notify, POPUP_INTERVAL);
206 static void __entry_keydown(void *data, Evas *e, Evas_Object *obj, void *event_info)
208 ret_if(event_info == NULL);
209 Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event_info;
210 SETTING_TRACE_DEBUG("ev->key : %s", ev->key);
211 SETTING_TRACE("obj:%p, %s", obj, elm_entry_entry_get(obj));
213 Evas_Object *entry_container = elm_object_parent_widget_get(obj);
214 if(safeStrLen(elm_entry_entry_get(obj)) > 0) {
215 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
217 //elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
218 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
223 * Do process when clicking radio in subitem of expandable item
225 void setting_sub_list_rd_change(void *data, Evas_Object *obj, void *event_info)
228 retm_if(data == NULL, "Data parameter is NULL");
229 Setting_GenGroupItem_Data *list_item =
230 (Setting_GenGroupItem_Data *) data;
231 list_item->chk_status = elm_radio_value_get(obj); /* for update */
233 Elm_Object_Item *subItem = list_item->item;
234 Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subItem);
236 Setting_GenGroupItem_Data *data_subItem = elm_object_item_data_get(subItem); /* subItem data */
237 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
239 ret_if(NULL == data_subItem || NULL == data_parentItem);
241 setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
242 list_item->chk_status, &err);
244 data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
245 elm_object_item_data_set(data_parentItem->item, data_parentItem);
246 elm_genlist_item_update(data_parentItem->item);
250 * Do process when clicking on subitem of expandable item
252 void setting_sub_list_sel_cb(void *data, Evas_Object *obj, void *event_info)
256 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
257 Elm_Object_Item *subitem = (Elm_Object_Item *) event_info;
258 Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subitem);
259 elm_genlist_item_selected_set(subitem, 0);
260 Setting_GenGroupItem_Data *data_subItem =
261 elm_object_item_data_get(subitem);
262 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
263 ret_if(NULL == data_subItem || NULL == data_parentItem);
265 elm_radio_value_set(data_subItem->rgd, data_subItem->chk_status);
267 setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
268 data_subItem->chk_status, &err);
269 setting_retm_if(0 != err, "Set vconf error[%d]",data_parentItem->int_slp_setting_binded);
271 data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
272 elm_object_item_data_set(data_parentItem->item, data_parentItem);
273 elm_genlist_item_update(data_parentItem->item);
276 static void __exp_list_smart_cb(void *data, Evas_Object *obj, void *event_info)
278 ret_if(data == NULL || event_info == NULL);
279 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
280 char *cb_type = data;
282 if (0 == safeStrCmp(cb_type, "drag")
283 || 0 == safeStrCmp(cb_type, "longpressed")) {
284 //Evas_Object *base_view = (Evas_Object *) elm_genlist_item_object_get(item);
285 //edje_object_signal_emit(base_view, "mouse,out", "touch_arrow");
286 } else if (0 == safeStrCmp(cb_type, "contracted")) {
287 elm_genlist_item_subitems_clear(item);
291 static void _gl_Gendial_sel(void *data, Evas_Object *obj, void *event_info)
293 /* SETTING_TRACE_BEGIN; */
294 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
295 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
296 elm_genlist_item_selected_set(item, 0);
299 static void _gl_Gendial_sel_expand(void *data, Evas_Object *obj,
302 /* SETTING_TRACE_BEGIN; */
303 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
304 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
305 elm_genlist_item_selected_set(item, 0);
306 bool status = !elm_genlist_item_expanded_get(item);
307 elm_genlist_item_expanded_set(item, status);
310 static char *_gl_Gendial_text_get(void *data, Evas_Object *obj,
313 /* SETTING_TRACE_BEGIN; */
314 Setting_GenGroupItem_Data *item_data =
315 (Setting_GenGroupItem_Data *) data;
316 /* SETTING_TRACE("part:%s", part); */
317 if (SWALLOW_Type_LAYOUT_ENTRY == item_data->swallow_type) { /* no need to create 'text' part */
321 /* for font size view */
322 if (SWALLOW_Type_1RADIO_1LABLE == item_data->swallow_type) {
323 char speciliztion[MAX_SPECIALIZITION_LEN] = {0,};
325 SETTING_TRACE("item_data->chk_status:%d", item_data->chk_status);
326 if (SYSTEM_SETTINGS_FONT_SIZE_SMALL == item_data->chk_status) {
327 font_size = LABEL_FONT_SIZE_SMALL;
328 } else if (SYSTEM_SETTINGS_FONT_SIZE_LARGE == item_data->chk_status) {
329 font_size = LABEL_FONT_SIZE_LARGE;
330 } else if (SYSTEM_SETTINGS_FONT_SIZE_HUGE == item_data->chk_status) {
331 font_size = LABEL_FONT_SIZE_HUGE;
332 } else if (SYSTEM_SETTINGS_FONT_SIZE_GIANT == item_data->chk_status) {
333 font_size = LABEL_FONT_SIZE_GIANT;
335 font_size = LABEL_FONT_SIZE_NORMAL;
337 SETTING_TRACE("font_size:%d", font_size);
338 snprintf(speciliztion, sizeof(speciliztion), "<font_size=%d>%s</font_size>",
339 font_size, _(item_data->keyStr));
340 return (char *)g_strdup(speciliztion);
343 if (!safeStrCmp(part, "elm.text") || !safeStrCmp(part, "elm.text.1")) { /* title */
344 if (item_data->keyStr) {
345 return (char *)g_strdup(_(item_data->keyStr)); /* use item_data->keyStr */
348 } else if (!safeStrCmp(part, "elm.text.2")) { /* bottom or right */
349 if (item_data->sub_desc) {
350 return (char *)g_strdup(item_data->sub_desc);
357 static Evas_Object *__add_check(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
359 retv_if(!item_data || !parent, NULL);
360 Evas_Object *check = elm_check_add(parent);
361 elm_check_state_set(check, item_data->chk_status);
362 evas_object_show(check);
363 evas_object_pass_events_set(check, 1);
364 evas_object_propagate_events_set(check, 0);
366 item_data->eo_check = check;
368 if (item_data->chk_change_cb) {
369 evas_object_smart_callback_add(check,"changed",item_data->chk_change_cb,item_data);
371 evas_object_smart_callback_add(check,"changed", __chk_changed, item_data);
375 static Evas_Object *__add_check_icon(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
377 retv_if(!item_data || !parent, NULL);
378 Evas_Object *check = __add_check(item_data, parent);
380 Evas_Object *thumb = NULL;
381 if (item_data->r_swallow_path) {
382 thumb = elm_icon_add(parent);
383 elm_icon_file_set(thumb,
384 item_data->r_swallow_path,
386 evas_object_size_hint_aspect_set(thumb,
387 EVAS_ASPECT_CONTROL_VERTICAL,
391 Evas_Object *layout = elm_layout_add(parent);
392 elm_layout_file_set(layout, SETTING_THEME_EDJ_NAME,
394 evas_object_size_hint_weight_set(layout,
397 elm_object_part_content_set(layout, "checkbox", check);
398 elm_object_part_content_set(layout, "thumbnail", thumb);
399 evas_object_show(layout);
402 static Evas_Object *__add_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
404 retv_if(!item_data || !parent, NULL);
405 Evas_Object *check = __add_check(item_data, parent);
406 elm_object_style_set(check, "on&off");
409 static Evas_Object *__add_multiline_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
411 retv_if(!item_data || !parent, NULL);
412 Evas_Object *chk = __add_toggle(item_data, parent);
413 elm_object_style_set(chk, "on&off");
417 static Evas_Object *__add_radio(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
419 retv_if(!item_data || !parent, NULL);
420 if (!item_data->rgd) { /* exceptional handling */
421 item_data->rgd = elm_radio_add(parent);
422 elm_radio_state_value_set(item_data->rgd, -1);
424 Evas_Object *radio = elm_radio_add(parent);
425 elm_radio_state_value_set(radio,
426 item_data->chk_status);
427 elm_radio_group_add(radio, item_data->rgd);
428 evas_object_show(radio);
429 item_data->eo_check = radio;
430 if (item_data->chk_change_cb) {
431 evas_object_smart_callback_add(radio,
433 item_data->chk_change_cb,
436 evas_object_smart_callback_add(radio,
443 static Evas_Object *__add_button(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
445 retv_if(!item_data || !parent, NULL);
446 Evas_Object *btn = elm_button_add(parent);
447 evas_object_show(btn);
448 if (item_data->r_swallow_path)
450 elm_object_style_set(btn, item_data->r_swallow_path);
452 if (item_data->keyStr)
454 elm_object_text_set(btn, _(item_data->keyStr));
456 evas_object_propagate_events_set(btn, EINA_FALSE);
457 if (item_data->chk_change_cb)
458 evas_object_smart_callback_add(btn,
460 item_data->chk_change_cb,
464 static Evas_Object *__add_entry(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
466 retv_if(!item_data || !parent, NULL);
467 elm_genlist_mode_set(parent, ELM_LIST_COMPRESS); /* resolve abnormal height issue */
468 Evas_Object *ed_name =
469 setting_create_editfiled(parent, _(item_data->keyStr),
470 item_data->sub_desc);
471 Evas_Object *entry = elm_object_part_content_get(ed_name, "elm.swallow.content");
472 item_data->eo_check = entry;
473 elm_entry_input_panel_layout_set(entry,
474 item_data->input_type);
476 if (item_data->isSinglelineFlag) {
477 elm_entry_single_line_set(entry, EINA_TRUE);
480 if (item_data->isPasswordFlag) {
481 elm_entry_single_line_set(entry, EINA_TRUE);
482 elm_entry_password_set(entry, EINA_TRUE);
485 if (item_data->limit_filter_data) {
486 elm_entry_markup_filter_append
488 elm_entry_filter_limit_size,
489 item_data->limit_filter_data);
491 evas_object_smart_callback_add(entry,
497 if (item_data->stop_change_cb) {//invoked when stop focusing on
498 evas_object_smart_callback_add(entry,
500 item_data->stop_change_cb,
505 evas_object_smart_callback_add(entry,
510 if (item_data->digits_filter_data) {
511 elm_entry_markup_filter_append
513 elm_entry_filter_accept_set,
514 item_data->digits_filter_data);
517 /* for Setting App, All the entrys's context popup shouldn't be able */
518 /* to insert images, text is the only one can be inserted. */
519 elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
521 if (item_data->chk_change_cb) {
522 evas_object_smart_callback_add
524 "changed", item_data->chk_change_cb,
528 evas_object_smart_callback_add(entry, "changed", __entry_changed, item_data);
529 evas_object_smart_callback_add(entry, "focused", __entry_focused, ed_name);
530 elm_object_signal_callback_add(ed_name, "elm,eraser,clicked", "elm", __eraser_clicked, entry);
532 Evas_Object_Event_Cb key_down_cb = __entry_keydown;
533 if (item_data->start_change_cb) {
534 key_down_cb = (Evas_Object_Event_Cb)(item_data->start_change_cb);
536 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, key_down_cb, item_data->userdata);
538 if (item_data->input_panel_disable_flag) {
539 elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
543 static Evas_Object *__add_slider(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
545 retv_if(!item_data || !parent, NULL);
546 Evas_Object *li_slider =
547 setting_create_slider(parent, item_data->evas,
548 item_data->l_swallow_path,
549 item_data->r_swallow_path,
550 item_data->chk_status,
551 item_data->isIndicatorVisible,
552 item_data->slider_min,
553 item_data->slider_max,
554 item_data->chk_change_cb,
555 item_data->start_change_cb,
556 item_data->stop_change_cb,
558 evas_object_pass_events_set(li_slider, 1);
559 evas_object_propagate_events_set(li_slider, 0);
560 item_data->eo_check = li_slider;
564 static Evas_Object *__add_datefield(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
566 retv_if(!item_data || !parent, NULL);
567 /* **********create time/date field */
568 Evas_Object *datetimefield = item_data->eo_check = elm_datetime_add(parent);
569 evas_object_size_hint_weight_set(datetimefield, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
570 evas_object_size_hint_align_set(datetimefield, EVAS_HINT_FILL, 0.5);
571 evas_object_show(datetimefield);
573 char date_format[MAX_DATETIME_FORMAT_LEN + 1] = {0, };
574 const char *time_format = NULL;
575 if (item_data->chk_status)//12 hours
577 time_format = "%I : %M %p";
579 time_format = "%H : %M";
582 #if SUPPORT_DATEFIELD_DATE_FORMAT_AUTOSET //Get date-format from datefiled itself, if elm_datetime_add() supports set date-format via ICU.
583 char *old_format = elm_datetime_format_get(datetimefield);
584 snprintf(date_format, MAX_DATE_FORMAT_LEN + 1, //add one space " "
586 safeStrNCat(date_format, time_format, MAX_DATETIME_FORMAT_LEN);
588 SETTING_TRACE("datefield_format:%s", date_format);
590 snprintf(date_format, MAX_DATETIME_FORMAT_LEN,
591 "%s %s", item_data->sub_desc, time_format);
593 elm_datetime_format_set(datetimefield, date_format);
595 // min : 1970 1, 01, Thursday 00:00:00
596 // max : 2038 1, 19, Thursday 03:14:07
598 memset(&ts_ret, 0, sizeof(struct tm));
599 ts_ret.tm_year = 138;
602 elm_datetime_value_max_set(datetimefield, &ts_ret);
607 elm_datetime_value_min_set(datetimefield, &ts_ret);
610 time_t ctime = time(NULL);
612 struct tm *ts = localtime_r(&ctime, &ts_ret);
615 elm_datetime_value_set(datetimefield, &ts_ret);
617 if (item_data->chk_change_cb) {
618 evas_object_smart_callback_add(datetimefield,
620 item_data->chk_change_cb,
624 if (item_data->isItemDisableFlag) {
625 setting_disable_evas_object(datetimefield);
627 return datetimefield;
629 static Evas_Object *__add_radio_search(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
631 retv_if(!item_data || !parent, NULL);
632 Evas_Object *box = elm_box_add(parent);
633 elm_box_horizontal_set(box, 1);
636 Evas_Object *radio = __add_radio(item_data, parent);
637 setting_disable_evas_object(radio);
638 elm_box_pack_end(box, radio);
641 Evas_Object *separator =
642 setting_create_blank_rect_customize(box,
643 SETTING_HALF_SCREEN_WIDTH,
644 SETTING_PADDING_HEIGHT);
645 elm_box_pack_end(box, separator);
648 Evas_Object *progressbar = elm_progressbar_add(parent);
649 elm_object_style_set(progressbar, "list_process");
650 evas_object_size_hint_align_set(progressbar,
651 EVAS_HINT_FILL, 0.5);
652 evas_object_size_hint_weight_set(progressbar,
655 elm_progressbar_pulse(progressbar, EINA_TRUE);
656 evas_object_show(progressbar);
657 elm_box_pack_end(box, progressbar);
659 evas_object_show(box);
662 static Evas_Object *__add_search(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
664 retv_if(!item_data || !parent, NULL);
665 // added by JTS: CQ H0100135171
666 Evas_Object *box = elm_box_add(parent);
667 elm_box_horizontal_set(box, 1);
670 Evas_Object *separator =
671 setting_create_blank_rect_customize(box,
672 SETTING_HALF_SCREEN_WIDTH, SETTING_PADDING_HEIGHT);
673 elm_box_pack_end(box, separator);
676 Evas_Object *progressbar = elm_progressbar_add(parent);
677 elm_object_style_set(progressbar, "list_process");
678 evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5);
679 evas_object_size_hint_weight_set(progressbar,
680 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
681 elm_progressbar_pulse(progressbar, EINA_TRUE);
682 evas_object_show(progressbar);
683 elm_box_pack_end(box, progressbar);
685 evas_object_show(box);
689 static Evas_Object *__add_process(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
691 retv_if(!item_data || !parent, NULL);
692 Evas_Object *progressbar = elm_progressbar_add(parent);
693 elm_object_style_set(progressbar, "list_process");
694 evas_object_size_hint_align_set(progressbar,
695 EVAS_HINT_FILL, 0.5);
696 evas_object_size_hint_weight_set(progressbar,
699 elm_progressbar_pulse(progressbar, EINA_TRUE);
700 evas_object_show(progressbar);
704 static Evas_Object *__add_radio_lable(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
706 retv_if(!item_data || !parent, NULL);
709 Evas_Object *radio = __add_radio(item_data, parent);
714 static Evas_Object *__add_left_default(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
716 retv_if(!item_data || !parent || !item_data->l_swallow_path, NULL);
717 Evas_Object *icon = elm_icon_add(parent);
718 elm_icon_file_set(icon, item_data->l_swallow_path,NULL);
719 evas_object_size_hint_aspect_set(icon,EVAS_ASPECT_CONTROL_VERTICAL,1, 1);
722 static Evas_Object *__add_right_default(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
724 retv_if(!item_data || !parent || !item_data->r_swallow_path, NULL);
725 Evas_Object *icon = elm_icon_add(parent);
726 elm_icon_file_set(icon, item_data->r_swallow_path,NULL);
727 evas_object_size_hint_aspect_set(icon,EVAS_ASPECT_CONTROL_VERTICAL,1, 1);
732 typedef Evas_Object * (*__drawer_fp)(Setting_GenGroupItem_Data *item_data, Evas_Object *parent);
735 SWALLOW_Type type; // ui type
738 static __Content_Drawer __cd_left[SWALLOW_Type_MAX] = {
740 {SWALLOW_Type_1CHECK, __add_check},
741 {SWALLOW_Type_1TOGGLE, __add_toggle},
742 {SWALLOW_Type_1RADIO, __add_radio},
743 {SWALLOW_Type_1BUTTON, __add_button},
745 //base objects in an layout
746 {SWALLOW_Type_LAYOUT_ENTRY, __add_entry},
747 {SWALLOW_Type_LAYOUT_SLIDER, __add_slider},
748 {SWALLOW_Type_LAYOUT_DATEFIELD, __add_datefield},
750 //other compelx objects
751 {SWALLOW_Type_1SEARCH, __add_search},
752 {SWALLOW_Type_1PROCESS, __add_process},
753 {SWALLOW_Type_MULTILINE_1TOGGLE, __add_multiline_toggle},
754 {SWALLOW_Type_1CHECKICON, __add_check_icon},
755 {SWALLOW_Type_1RADIO_1SEARCH, __add_radio_search},
756 {SWALLOW_Type_1RADIO_1LABLE, __add_radio_lable},
758 //left part object of the type
759 {SWALLOW_Type_1ICON_1RADIO, __add_left_default},
760 {SWALLOW_Type_1RADIO_1PROCESS, __add_radio},
762 static __Content_Drawer __cd_right[SWALLOW_Type_MAX] = {
763 //right part object of the type
764 {SWALLOW_Type_1ICON_1RADIO, __add_toggle},
765 {SWALLOW_Type_1RADIO_1PROCESS, __add_process},
768 static __Content_Drawer __cd_end[SWALLOW_Type_MAX] = {
769 //end part object of the type
770 {SWALLOW_Type_1RADIO, __add_radio},
772 /*static __Part_Drawer __pd[__MAX_PART_NUM] = {
773 {"elm.icon", __cd_left},
774 {"elm.icon.1", __cd_left},
775 {"elm.icon.2", __cd_right},
776 {"elm.swallow.end", __cd_end},
779 static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj,
782 retv_if(!data, NULL);
783 Setting_GenGroupItem_Data *item_data = data;
784 retv_if(!data, NULL);
785 __Content_Drawer *cd_list = NULL;
786 __drawer_fp fp = NULL;
787 if (!safeStrCmp(part, "elm.icon") || !safeStrCmp(part, "elm.icon.1"))
789 fp = __add_left_default; //hold default drawer
792 else if (!safeStrCmp(part, "elm.icon.2"))
794 fp = __add_right_default; //hold default drawer
795 cd_list = __cd_right;
797 else if (!safeStrCmp(part, "elm.swallow.end"))
799 //the default value of fp is NULL here
802 if (!cd_list) return NULL;//invalid part
805 for (; idx < SWALLOW_Type_MAX; idx++)
807 if (item_data->swallow_type == cd_list[idx].type)//match using swallow type
809 fp = cd_list[idx].draw;
813 return fp ? fp(item_data, obj) : NULL;
816 static void _gl_Gendial_del(void *data, Evas_Object *obj)
818 /* SETTING_TRACE_BEGIN; */
819 Setting_GenGroupItem_Data *item_data =
820 (Setting_GenGroupItem_Data *) data;
822 G_FREE(item_data->keyStr);
823 G_FREE(item_data->sub_desc);
824 G_FREE((item_data->l_swallow_path));
825 G_FREE((item_data->r_swallow_path));
826 G_FREE(item_data->item_style);
829 if (item_data->digits_filter_data)
831 G_FREE(item_data->digits_filter_data->accepted);
832 G_FREE(item_data->digits_filter_data->rejected);
833 FREE(item_data->digits_filter_data);
837 if (item_data->notify) {
838 evas_object_del(item_data->notify);
839 item_data->notify = NULL;
842 FREE(item_data->limit_filter_data);
843 __BACK_POINTER_UNSET(item_data);
846 /* SETTING_TRACE_END; */
850 * To intialize an Elm_Genlist_Item_Class, according to item style
852 * @param[in] item_style
855 bool setting_create_Gendial_itc(const char *item_style,
856 Elm_Genlist_Item_Class *itc)
858 itc->item_style = item_style;
859 itc->func.text_get = _gl_Gendial_text_get;
860 itc->func.content_get = _gl_Gendial_content_get;
861 itc->func.state_get = NULL;
862 itc->func.del = _gl_Gendial_del; /* _gl_Gendial_del; */
867 * Create group style item
869 * @return a pointer to Setting_GenGroupItem_Data
871 Setting_GenGroupItem_Data *setting_create_Gendial_field_group_titleItem(Evas_Object *genlist,
872 const Elm_Genlist_Item_Class *itc,
873 Elm_Object_Item *parent,
874 Elm_Genlist_Item_Type flag, /* ELM_GENLIST_ITEM_GROUP or ELM_GENLIST_ITEM_NONE */
876 setting_call_back_func gl_sel)
878 /* SETTING_TRACE_BEGIN; */
879 Setting_GenGroupItem_Data *item_data =
880 (Setting_GenGroupItem_Data *) calloc(1,
882 (Setting_GenGroupItem_Data));
883 setting_retvm_if(!item_data, NULL, "calloc failed");
884 item_data->keyStr = (char *)g_strdup(keyStr);
887 elm_genlist_item_append(genlist, itc, item_data, parent,
891 elm_genlist_item_append(genlist, itc, item_data, parent,
892 flag, _gl_Gendial_sel, NULL);
898 * Create separator style item with title
900 * @return a pointer to Setting_GenGroupItem_Data
902 Setting_GenGroupItem_Data *setting_create_Gendial_field_titleItem(
903 Evas_Object *genlist,
904 const Elm_Genlist_Item_Class *itc,
906 setting_call_back_func gl_sel)
908 /* SETTING_TRACE_BEGIN; */
909 Setting_GenGroupItem_Data *item_data =
910 (Setting_GenGroupItem_Data *) calloc(1,
912 (Setting_GenGroupItem_Data));
913 setting_retvm_if(!item_data, NULL, "calloc failed");
914 item_data->keyStr = (char *)g_strdup(keyStr);
917 elm_genlist_item_append(genlist, itc, item_data, NULL,
918 ELM_GENLIST_ITEM_NONE, gl_sel,
922 elm_genlist_item_append(genlist, itc, item_data, NULL,
923 ELM_GENLIST_ITEM_NONE,
924 _gl_Gendial_sel, NULL);
930 * Create 1radio-1text style item
932 * @return a pointer to Setting_GenGroupItem_Data
935 Setting_GenGroupItem_Data *setting_create_Gendial_field_1radio(
936 Evas_Object *genlist,
937 const Elm_Genlist_Item_Class *itc,
938 setting_call_back_func gl_sel,
940 SWALLOW_Type swallow_type,
941 Evas_Object *rgd, int chk_status,
943 setting_call_back_func chk_change_cb)
945 /* SETTING_TRACE_BEGIN; */
946 Setting_GenGroupItem_Data *item_data =
947 (Setting_GenGroupItem_Data *) calloc(1,
949 (Setting_GenGroupItem_Data));
950 setting_retvm_if(!item_data, NULL, "calloc failed");
951 item_data->keyStr = (char *)g_strdup(keyStr);
952 item_data->swallow_type = swallow_type;
953 item_data->chk_status = chk_status;
954 item_data->chk_change_cb = chk_change_cb;
955 item_data->rgd = rgd;
959 elm_genlist_item_append(genlist, itc, item_data, NULL,
960 ELM_GENLIST_ITEM_NONE, gl_sel,
964 elm_genlist_item_append(genlist, itc, item_data, NULL,
965 ELM_GENLIST_ITEM_NONE,
966 _gl_Gendial_sel, sel_data);
971 Setting_GenGroupItem_Data *setting_create_Gendial_field_2radio(
972 Evas_Object *genlist,
973 const Elm_Genlist_Item_Class *itc,
974 setting_call_back_func gl_sel,
976 SWALLOW_Type swallow_type,
977 Evas_Object *rgd, int chk_status,
979 const char *sub_desc,
980 setting_call_back_func chk_change_cb)
982 /* SETTING_TRACE_BEGIN; */
983 Setting_GenGroupItem_Data *item_data =
984 (Setting_GenGroupItem_Data *) calloc(1,
986 (Setting_GenGroupItem_Data));
987 setting_retvm_if(!item_data, NULL, "calloc failed");
988 item_data->keyStr = (char *)g_strdup(keyStr);
989 item_data->sub_desc = (char *)g_strdup(sub_desc);
990 item_data->swallow_type = swallow_type;
991 item_data->chk_status = chk_status;
992 item_data->chk_change_cb = chk_change_cb;
993 item_data->rgd = rgd;
997 elm_genlist_item_append(genlist, itc, item_data, NULL,
998 ELM_GENLIST_ITEM_NONE, gl_sel,
1002 elm_genlist_item_append(genlist, itc, item_data, NULL,
1003 ELM_GENLIST_ITEM_NONE,
1004 _gl_Gendial_sel, sel_data);
1010 * Create common style item with menu icon
1012 * @return a pointer to Setting_GenGroupItem_Data
1014 Setting_GenGroupItem_Data *setting_create_Gendial_field_groupitem(
1015 Evas_Object *genlist,
1016 const Elm_Genlist_Item_Class *itc,
1017 Elm_Object_Item *parent,
1018 setting_call_back_func gl_sel,
1020 SWALLOW_Type swallow_type,
1022 char *r_icon_path, int chk_status,
1023 const char *keyStr, char *sub_desc,
1024 setting_call_back_func
1027 // SETTING_TRACE_BEGIN;
1028 Setting_GenGroupItem_Data *item_data = (
1029 Setting_GenGroupItem_Data *) calloc(1, sizeof(Setting_GenGroupItem_Data));
1030 setting_retvm_if(!item_data, NULL, "calloc failed");
1032 /* to do formatting customizition in one place */
1033 if (SWALLOW_Type_LAYOUT_SPECIALIZTION == swallow_type
1034 || SWALLOW_Type_LAYOUT_SPECIALIZTION_X == swallow_type) {
1035 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
1037 char speciliztion[MAX_SPECIALIZITION_LEN] = { 0, };
1038 //char *temp1 = setting_customize_text(keyStr, 0, "#9C9C9C", "left");
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, "%d %s", sel_num, KeyStr_Item_Sel);
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, "%d %s", sel_num, KeyStr_Item_Sel);
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 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1551 __setting_select_all_done(data);
1555 * The API to create done-list.
1557 * @param[in] list_data
1558 * @return a done-list
1560 Evas_Object *setting_create_done_list(Setting_Done_List_Data *list_data)
1562 SETTING_TRACE_BEGIN;
1563 retvm_if(list_data == NULL, NULL, "list_data == NULL");
1564 Evas_Object *sub_layout = elm_layout_add(list_data->win_main);
1565 elm_layout_file_set(sub_layout, SETTING_THEME_EDJ_NAME, "search_layout");
1566 evas_object_size_hint_weight_set(sub_layout, EVAS_HINT_EXPAND, 0.0);
1567 evas_object_show(sub_layout);
1569 setting_create_Gendial_itc("1text.1icon.2", &(list_data->itc_1text_1icon));
1571 Evas_Object *select_all_layout = elm_layout_add(sub_layout);
1572 retvm_if(select_all_layout == NULL, NULL, "select_all_layout == NULL");
1573 elm_layout_theme_set(select_all_layout, "genlist", "item", "select_all/default");
1574 evas_object_size_hint_weight_set(select_all_layout, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
1575 evas_object_size_hint_align_set(select_all_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
1576 evas_object_event_callback_add(select_all_layout, EVAS_CALLBACK_MOUSE_DOWN, __setting_select_all_layout_mouse_down_cb, list_data);
1578 Eina_Bool select_all_checked = list_data->select_all_checked;
1579 Evas_Object *select_all_checkbox = elm_check_add(select_all_layout);
1580 elm_check_state_pointer_set(select_all_checkbox, &select_all_checked);
1581 evas_object_smart_callback_add(select_all_checkbox, "changed", __setting_select_all_check_changed_cb, list_data);
1582 evas_object_propagate_events_set(select_all_checkbox, EINA_FALSE);
1583 elm_object_part_content_set(select_all_layout, "elm.icon", select_all_checkbox);
1585 list_data->select_all_checkbox = select_all_checkbox;
1586 elm_object_part_text_set(select_all_layout, "elm.text", _(KeyStr_Select_All));
1588 Evas_Object *scroller = elm_genlist_add(list_data->win_main);
1589 retvm_if(scroller == NULL, NULL, "scroller == NULL");
1590 elm_genlist_clear(scroller); /* first to clear list */
1592 elm_object_part_content_set(sub_layout, "search_list", scroller);
1593 elm_object_part_content_set(sub_layout, "search_bar", select_all_layout);
1596 for (; index < list_data->cur_item_num; index++) {
1597 list_data->chk_items[index].data_GenItem =
1598 setting_create_Gendial_field_def(scroller,
1599 &(list_data->itc_1text_1icon),
1600 setting_done_list_Gendial_mouse_up_cb,
1602 SWALLOW_Type_1CHECK, NULL,
1604 list_data->chk_items
1605 [index].item_name, NULL,
1606 setting_done_list_Gendial_chk_btn_cb);
1607 if (list_data->chk_items[index].data_GenItem) {
1608 list_data->chk_items[index].data_GenItem->userdata = list_data;
1610 SETTING_TRACE_ERROR("list_data->chk_items[index].data_GenItem is NULL");
1619 * To disable a specialized genlist item
1623 void setting_disable_genlist_item(Elm_Object_Item *item)
1626 elm_object_item_disabled_set(item, EINA_TRUE); /* make it be dim displayed */
1631 * To enable a specialized genlist item
1635 void setting_enable_genlist_item(Elm_Object_Item *item)
1638 elm_object_item_disabled_set(item, EINA_FALSE); /* make it be normally displayed */