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 "The content is too long."
29 static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj, const char *part);
30 static char *_gl_Gendial_text_get(void *data, Evas_Object *obj, const char *part);
31 static void _gl_Gendial_del(void *data, Evas_Object *obj);
32 const Elm_Genlist_Item_Class itc_seperator = {
33 .item_style = "dialogue/separator/21/with_line",
34 .func.text_get = NULL,
35 .func.content_get = NULL,
36 .func.state_get = NULL,
40 const Elm_Genlist_Item_Class itc_bottom_seperator = {
41 .item_style = "dialogue/separator/20",
42 .func.text_get = NULL,
43 .func.content_get = NULL,
44 .func.state_get = NULL,
48 const Elm_Genlist_Item_Class itc_sep_line = {
49 .item_style = "dialogue/separator/1/with_line",
50 .func.text_get = _gl_Gendial_text_get,
51 .func.content_get = NULL,
52 .func.state_get = NULL,
56 #define DEFINE_ITC1(style, name) \
57 const Elm_Genlist_Item_Class name = {\
59 .func.text_get = _gl_Gendial_text_get,\
60 .func.content_get = _gl_Gendial_content_get,\
61 .func.state_get = NULL,\
62 .func.del = _gl_Gendial_del,\
65 DEFINE_ITC1("dialogue/1text", itc_1text);
66 DEFINE_ITC1("dialogue/1text.1icon.2", itc_1text_1icon_2);
68 DEFINE_ITC1("dialogue/1icon", itc_1icon);
69 DEFINE_ITC1("dialogue/1text.1icon/expandable2", itc_1icon_1text_sub);
70 DEFINE_ITC1("dialogue/1text.1icon", itc_1text_1icon);
71 DEFINE_ITC1("dialogue/1text.2icon", itc_1text_2icon);
72 DEFINE_ITC1("dialogue/1text.2icon.2", itc_1text_2icon_2);
74 DEFINE_ITC1("dialogue/2text.2", itc_2text_2);
75 DEFINE_ITC1("dialogue/2text", itc_2text);
76 DEFINE_ITC1("multiline/2text.1icon", itc_multiline_2text_1icon);
77 DEFINE_ITC1("dialogue/2text.1icon.3", itc_2text_1icon_3);
78 DEFINE_ITC1("dialogue/2text.1icon.6", itc_2text_1icon_6);
79 DEFINE_ITC1("dialogue/2text.1icon.7", itc_2text_1icon_7);
81 DEFINE_ITC1("dialogue/2text.3/expandable", itc_2text_3_parent);
82 DEFINE_ITC1("dialogue/2text.3", itc_2text_3);
83 DEFINE_ITC1("dialogue/2text.2icon.3", itc_2text_2icon_3);
85 DEFINE_ITC1("multiline/1text", itc_multiline_text);
86 DEFINE_ITC1("1text.1icon.2", itc_cm_1text_1icon_2);
87 DEFINE_ITC1("select_all", itc_sel_all);
88 DEFINE_ITC1("dialogue/bg/1icon", itc_bg_1icon);
89 DEFINE_ITC1("dialogue/title", itc_group_item);
92 * Do process when clicking on a common genlist item
94 void setting_mouse_up_Gendial_list_radio_cb(void *data, Evas_Object *obj,
98 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
99 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
100 elm_genlist_item_selected_set(item, 0);
101 Setting_GenGroupItem_Data *list_item =
102 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
104 setting_retm_if(data == NULL, "Data parameter is NULL");
105 Evas_Object *radio = data;
106 elm_radio_value_set(radio, list_item->chk_status);
109 static void __radio_changed(void *data, Evas_Object *obj, void *event_info)
111 retm_if(data == NULL, "Data parameter is NULL");
112 Setting_GenGroupItem_Data *list_item =
113 (Setting_GenGroupItem_Data *) data;
114 list_item->chk_status = elm_radio_value_get(obj); /* for update */
117 static void __entry_changed(void *data, Evas_Object *obj, void *event_info)
119 retm_if(data == NULL, "Data parameter is NULL");
121 Setting_GenGroupItem_Data *list_item =
122 (Setting_GenGroupItem_Data *) data;
123 list_item->sub_desc = (char *)g_strdup(elm_entry_entry_get(obj));
124 Evas_Object *entry_container = elm_object_parent_widget_get(obj);
127 if (elm_entry_is_empty(obj))
129 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
130 elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
134 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
135 if (elm_object_focus_get(obj)) //only do when entry is focused
137 elm_object_signal_emit(entry_container, "elm,state,eraser,show", "elm");
143 static void __entry_unfocused(void *data, Evas_Object *obj, void *event_info) // Unfocused callback will show guidetext and hide X marked button.
147 Evas_Object *entry_container = data;
148 //whe entry unfocused, its guidetext will becomes "Input here"
149 elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
150 if (elm_entry_is_empty(obj))
151 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
152 elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
154 static void __entry_focused(void *data, Evas_Object *obj, void *event_info) // Focused callback will show X marked button and hide guidetext.
158 Evas_Object *entry_container = data;
159 //whe entry focused, its guidetext will becomes "Input here"
160 elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
161 if (!elm_entry_is_empty(obj))
162 elm_object_signal_emit(entry_container, "elm,state,eraser,show", "elm");
163 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
165 Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(obj);
166 if (imf_context) ecore_imf_context_input_panel_show(imf_context);
168 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.
171 Evas_Object *entry = data;
172 elm_entry_entry_set(entry, "");
173 elm_object_focus_set(entry, EINA_TRUE);
176 static void __chk_changed(void *data, Evas_Object *obj, void *event_info)
178 retm_if(data == NULL, "Data parameter is NULL");
179 Setting_GenGroupItem_Data *list_item =
180 (Setting_GenGroupItem_Data *) data;
181 list_item->chk_status = elm_check_state_get(obj); /* for update */
184 static void __error_popup_response_cb(void *data, Evas_Object *obj,
188 retm_if(data == NULL, "Data parameter is NULL");
189 Setting_GenGroupItem_Data *list_item = data;
190 if (list_item->notify) {
191 evas_object_del(list_item->notify);
192 list_item->notify = NULL;
196 static void __max_len_reached(void *data, Evas_Object *obj, void *event_info)
199 retm_if(data == NULL, "Data parameter is NULL");
200 retm_if(!elm_object_focus_get(obj), "Entry is not focused");//notify only when entry is being focused on.
202 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
203 if (!list_item->notify)
205 list_item->notify = setting_create_popup_without_btn(list_item, list_item->win_main,
206 NULL, _(EXCEED_LIMITATION_STR),
207 __error_popup_response_cb,
208 POPUP_INTERVAL, FALSE, FALSE);
209 elm_object_focus_set(list_item->eo_check, EINA_FALSE);
211 //postpone 2 seconds again
212 elm_popup_timeout_set(list_item->notify, POPUP_INTERVAL);
216 static void __entry_keydown(void *data, Evas *e, Evas_Object *obj, void *event_info)
218 ret_if(event_info == NULL);
219 Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event_info;
220 if(safeStrCmp(ev->key, "KP_Enter") == 0 //it is for Japanese keyboard to fix N_SE-10719
221 || safeStrCmp(ev->key, "Return") == 0) //to disable the 'Enter' orginal function
223 SETTING_TRACE("ENTER %s ev->key:%s", __FUNCTION__, ev->key);
224 //hide the eraser button
225 //format like:xx<br/>
226 const char *entry_str = remove_first_substring(elm_entry_entry_get(obj), "<br/>");
227 elm_entry_entry_set(obj, entry_str);
229 elm_entry_cursor_end_set(obj);
230 setting_hide_input_pannel_cb(obj);
232 Evas_Object *entry_container = elm_object_parent_widget_get(obj);
233 if(safeStrLen(elm_entry_entry_get(obj)) > 0) {
234 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
236 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
243 * Do process when clicking radio in subitem of expandable item
245 void setting_sub_list_rd_change(void *data, Evas_Object *obj, void *event_info)
248 retm_if(data == NULL, "Data parameter is NULL");
249 Setting_GenGroupItem_Data *list_item =
250 (Setting_GenGroupItem_Data *) data;
251 list_item->chk_status = elm_radio_value_get(obj); /* for update */
253 Elm_Object_Item *subItem = list_item->item;
254 Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subItem);
256 Setting_GenGroupItem_Data *data_subItem = elm_object_item_data_get(subItem); /* subItem data */
257 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
259 ret_if(NULL == data_subItem || NULL == data_parentItem);
261 setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
262 list_item->chk_status, &err);
264 data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
265 elm_object_item_data_set(data_parentItem->item, data_parentItem);
266 elm_genlist_item_update(data_parentItem->item);
270 * Do process when clicking on subitem of expandable item
272 void setting_sub_list_sel_cb(void *data, Evas_Object *obj, void *event_info)
276 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
277 Elm_Object_Item *subitem = (Elm_Object_Item *) event_info;
278 Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subitem);
279 elm_genlist_item_selected_set(subitem, 0);
280 Setting_GenGroupItem_Data *data_subItem =
281 elm_object_item_data_get(subitem);
282 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
283 ret_if(NULL == data_subItem || NULL == data_parentItem);
285 elm_radio_value_set(data_subItem->rgd, data_subItem->chk_status);
287 setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
288 data_subItem->chk_status, &err);
289 setting_retm_if(0 != err, "Set vconf error[%d]",data_parentItem->int_slp_setting_binded);
291 data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
292 elm_object_item_data_set(data_parentItem->item, data_parentItem);
293 elm_genlist_item_update(data_parentItem->item);
296 static void __exp_list_smart_cb(void *data, Evas_Object *obj, void *event_info)
298 ret_if(data == NULL || event_info == NULL);
299 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
300 char *cb_type = data;
302 if (0 == safeStrCmp(cb_type, "drag")
303 || 0 == safeStrCmp(cb_type, "longpressed")) {
304 //Evas_Object *base_view = (Evas_Object *) elm_genlist_item_object_get(item);
305 //edje_object_signal_emit(base_view, "mouse,out", "touch_arrow");
306 } else if (0 == safeStrCmp(cb_type, "contracted")) {
307 elm_genlist_item_subitems_clear(item);
311 static void _gl_Gendial_sel(void *data, Evas_Object *obj, void *event_info)
313 /* SETTING_TRACE_BEGIN; */
314 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
315 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
316 elm_genlist_item_selected_set(item, 0);
319 static void _gl_Gendial_sel_expand(void *data, Evas_Object *obj,
322 /* SETTING_TRACE_BEGIN; */
323 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
324 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
325 elm_genlist_item_selected_set(item, 0);
326 bool status = !elm_genlist_item_expanded_get(item);
327 elm_genlist_item_expanded_set(item, status);
330 static char *_gl_Gendial_text_get(void *data, Evas_Object *obj,
333 /* SETTING_TRACE_BEGIN; */
334 Setting_GenGroupItem_Data *item_data =
335 (Setting_GenGroupItem_Data *) data;
336 /* SETTING_TRACE("part:%s", part); */
337 if (SWALLOW_Type_LAYOUT_ENTRY == item_data->swallow_type) { /* no need to create 'text' part */
341 /* for font size view */
342 if (SWALLOW_Type_1RADIO_1LABLE == item_data->swallow_type) {
343 char speciliztion[MAX_SPECIALIZITION_LEN] = {0,};
345 SETTING_TRACE("item_data->chk_status:%d", item_data->chk_status);
346 if (SYSTEM_SETTINGS_FONT_SIZE_SMALL == item_data->chk_status) {
347 font_size = LABEL_FONT_SIZE_SMALL;
348 } else if (SYSTEM_SETTINGS_FONT_SIZE_LARGE == item_data->chk_status) {
349 font_size = LABEL_FONT_SIZE_LARGE;
350 } else if (SYSTEM_SETTINGS_FONT_SIZE_HUGE == item_data->chk_status) {
351 font_size = LABEL_FONT_SIZE_HUGE;
352 } else if (SYSTEM_SETTINGS_FONT_SIZE_GIANT == item_data->chk_status) {
353 font_size = LABEL_FONT_SIZE_GIANT;
355 font_size = LABEL_FONT_SIZE_NORMAL;
357 SETTING_TRACE("font_size:%d", font_size);
358 snprintf(speciliztion, sizeof(speciliztion), "<font_size=%d>%s</font_size>",
359 font_size, _(item_data->keyStr));
360 return (char *)g_strdup(speciliztion);
363 if (!safeStrCmp(part, "elm.text") || !safeStrCmp(part, "elm.text.1")) { /* title */
364 if (item_data->keyStr) {
365 return (char *)g_strdup(_(item_data->keyStr)); /* use item_data->keyStr */
368 } else if (!safeStrCmp(part, "elm.text.2")) { /* bottom or right */
369 if (item_data->sub_desc) {
370 return (char *)g_strdup(item_data->sub_desc);
377 static Evas_Object *__add_check(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
379 retv_if(!item_data || !parent, NULL);
380 Evas_Object *check = elm_check_add(parent);
381 elm_check_state_set(check, item_data->chk_status);
382 evas_object_show(check);
383 evas_object_pass_events_set(check, 1);
384 evas_object_propagate_events_set(check, 0);
386 item_data->eo_check = check;
388 if (item_data->chk_change_cb) {
389 evas_object_smart_callback_add(check,"changed",item_data->chk_change_cb,item_data);
391 evas_object_smart_callback_add(check,"changed", __chk_changed, item_data);
395 static Evas_Object *__add_check_icon(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
397 retv_if(!item_data || !parent, NULL);
398 Evas_Object *check = __add_check(item_data, parent);
400 Evas_Object *thumb = NULL;
401 if (item_data->r_swallow_path) {
402 thumb = elm_icon_add(parent);
403 elm_icon_file_set(thumb,
404 item_data->r_swallow_path,
406 evas_object_size_hint_aspect_set(thumb,
407 EVAS_ASPECT_CONTROL_VERTICAL,
411 Evas_Object *layout = elm_layout_add(parent);
412 elm_layout_file_set(layout, SETTING_THEME_EDJ_NAME,
414 evas_object_size_hint_weight_set(layout,
417 elm_object_part_content_set(layout, "checkbox", check);
418 elm_object_part_content_set(layout, "thumbnail", thumb);
419 evas_object_show(layout);
422 static Evas_Object *__add_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
424 retv_if(!item_data || !parent, NULL);
425 Evas_Object *check = __add_check(item_data, parent);
426 elm_object_style_set(check, "on&off");
429 static Evas_Object *__add_multiline_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
431 retv_if(!item_data || !parent, NULL);
432 Evas_Object *chk = __add_toggle(item_data, parent);
433 elm_object_style_set(chk, "on&off");
437 static Evas_Object *__add_radio(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
439 retv_if(!item_data || !parent, NULL);
440 if (!item_data->rgd) { /* exceptional handling */
441 item_data->rgd = elm_radio_add(parent);
442 elm_radio_state_value_set(item_data->rgd, -1);
444 Evas_Object *radio = elm_radio_add(parent);
445 elm_radio_state_value_set(radio,
446 item_data->chk_status);
447 elm_radio_group_add(radio, item_data->rgd);
448 evas_object_show(radio);
449 item_data->eo_check = radio;
450 if (item_data->chk_change_cb) {
451 evas_object_smart_callback_add(radio,
453 item_data->chk_change_cb,
456 evas_object_smart_callback_add(radio,
463 static Evas_Object *__add_button(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
465 retv_if(!item_data || !parent, NULL);
466 Evas_Object *btn = elm_button_add(parent);
467 evas_object_show(btn);
468 if (item_data->r_swallow_path)
470 elm_object_style_set(btn, item_data->r_swallow_path);
472 if (item_data->keyStr)
474 elm_object_text_set(btn, _(item_data->keyStr));
476 evas_object_propagate_events_set(btn, EINA_FALSE);
477 if (item_data->chk_change_cb)
478 evas_object_smart_callback_add(btn,
480 item_data->chk_change_cb,
484 static Evas_Object *__add_entry(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
486 retv_if(!item_data || !parent, NULL);
487 elm_genlist_mode_set(parent, ELM_LIST_COMPRESS); /* resolve abnormal height issue */
488 Evas_Object *ed_name =
489 setting_create_editfiled(parent, _(item_data->keyStr),
490 item_data->sub_desc);
491 Evas_Object *entry = elm_object_part_content_get(ed_name, "elm.swallow.content");
492 item_data->eo_check = entry;
493 elm_entry_input_panel_layout_set(entry,
494 item_data->input_type);
496 if (item_data->isSinglelineFlag) {
497 elm_entry_single_line_set(entry, EINA_TRUE);
500 if (item_data->isPasswordFlag) {
501 elm_entry_single_line_set(entry, EINA_TRUE);
502 elm_entry_password_set(entry, EINA_TRUE);
505 if (item_data->limit_filter_data) {
506 elm_entry_markup_filter_append
508 elm_entry_filter_limit_size,
509 item_data->limit_filter_data);
511 evas_object_smart_callback_add(entry,
517 if (item_data->stop_change_cb) {//invoked when stop focusing on
518 evas_object_smart_callback_add(entry,
520 item_data->stop_change_cb,
525 evas_object_smart_callback_add(entry,
530 if (item_data->digits_filter_data) {
531 elm_entry_markup_filter_append
533 elm_entry_filter_accept_set,
534 item_data->digits_filter_data);
537 /* for Setting App, All the entrys's context popup shouldn't be able */
538 /* to insert images, text is the only one can be inserted. */
539 elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
541 if (item_data->chk_change_cb) {
542 evas_object_smart_callback_add
544 "changed", item_data->chk_change_cb,
548 evas_object_smart_callback_add(entry, "changed", __entry_changed, item_data);
549 evas_object_smart_callback_add(entry, "focused", __entry_focused, ed_name);
550 elm_object_signal_callback_add(ed_name, "elm,eraser,clicked", "elm", __eraser_clicked, entry);
552 if (item_data->start_change_cb) {
553 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, (Evas_Object_Event_Cb)(item_data->start_change_cb), item_data->userdata);
555 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, __entry_keydown, item_data);
557 if (item_data->input_panel_disable_flag) {
558 elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
562 static Evas_Object *__add_slider(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
564 retv_if(!item_data || !parent, NULL);
565 Evas_Object *li_slider =
566 setting_create_slider(parent, item_data->evas,
567 item_data->l_swallow_path,
568 item_data->r_swallow_path,
569 item_data->chk_status,
570 item_data->isIndicatorVisible,
571 item_data->slider_min,
572 item_data->slider_max,
573 item_data->chk_change_cb,
574 item_data->start_change_cb,
575 item_data->stop_change_cb,
577 evas_object_pass_events_set(li_slider, 1);
578 evas_object_propagate_events_set(li_slider, 0);
579 item_data->eo_check = li_slider;
583 static Evas_Object *__add_datefield(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
585 retv_if(!item_data || !parent, NULL);
586 /* **********create time/date field */
587 Evas_Object *datetimefield = item_data->eo_check = elm_datetime_add(parent);
588 evas_object_size_hint_weight_set(datetimefield, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
589 evas_object_size_hint_align_set(datetimefield, EVAS_HINT_FILL, 0.5);
590 evas_object_show(datetimefield);
592 char date_format[MAX_DATETIME_FORMAT_LEN + 1] = {0, };
593 const char *time_format = NULL;
594 if (item_data->chk_status)//12 hours
596 time_format = "%I : %M %p";
598 time_format = "%H : %M";
601 #if SUPPORT_DATEFIELD_DATE_FORMAT_AUTOSET //Get date-format from datefiled itself, if elm_datetime_add() supports set date-format via ICU.
602 char *old_format = elm_datetime_format_get(datetimefield);
603 snprintf(date_format, MAX_DATE_FORMAT_LEN + 1, //add one space " "
605 safeStrNCat(date_format, time_format, MAX_DATETIME_FORMAT_LEN);
607 SETTING_TRACE("datefield_format:%s", date_format);
609 snprintf(date_format, MAX_DATETIME_FORMAT_LEN,
610 "%s %s", item_data->sub_desc, time_format);
612 elm_datetime_format_set(datetimefield, date_format);
614 // min : 1970 1, 01, Thursday 00:00:00
615 // max : 2038 1, 19, Thursday 03:14:07
617 memset(&ts_ret, 0, sizeof(struct tm));
618 ts_ret.tm_year = 138;
621 elm_datetime_value_max_set(datetimefield, &ts_ret);
626 elm_datetime_value_min_set(datetimefield, &ts_ret);
629 time_t ctime = time(NULL);
631 struct tm *ts = localtime_r(&ctime, &ts_ret);
634 elm_datetime_value_set(datetimefield, &ts_ret);
636 if (item_data->chk_change_cb) {
637 evas_object_smart_callback_add(datetimefield,
639 item_data->chk_change_cb,
643 if (item_data->isItemDisableFlag) {
644 setting_disable_evas_object(datetimefield);
646 return datetimefield;
648 static Evas_Object *__add_radio_search(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
650 retv_if(!item_data || !parent, NULL);
651 Evas_Object *box = elm_box_add(parent);
652 elm_box_horizontal_set(box, 1);
655 Evas_Object *radio = __add_radio(item_data, parent);
656 setting_disable_evas_object(radio);
657 elm_box_pack_end(box, radio);
660 Evas_Object *separator =
661 setting_create_blank_rect_customize(box,
662 SETTING_HALF_SCREEN_WIDTH,
663 SETTING_PADDING_HEIGHT);
664 elm_box_pack_end(box, separator);
667 Evas_Object *progressbar = elm_progressbar_add(parent);
668 elm_object_style_set(progressbar, "list_process");
669 evas_object_size_hint_align_set(progressbar,
670 EVAS_HINT_FILL, 0.5);
671 evas_object_size_hint_weight_set(progressbar,
674 elm_progressbar_pulse(progressbar, EINA_TRUE);
675 evas_object_show(progressbar);
676 elm_box_pack_end(box, progressbar);
678 evas_object_show(box);
681 static Evas_Object *__add_search(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
683 retv_if(!item_data || !parent, NULL);
684 // added by JTS: CQ H0100135171
685 Evas_Object *box = elm_box_add(parent);
686 elm_box_horizontal_set(box, 1);
689 Evas_Object *separator =
690 setting_create_blank_rect_customize(box,
691 SETTING_HALF_SCREEN_WIDTH, SETTING_PADDING_HEIGHT);
692 elm_box_pack_end(box, separator);
695 Evas_Object *progressbar = elm_progressbar_add(parent);
696 elm_object_style_set(progressbar, "list_process");
697 evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5);
698 evas_object_size_hint_weight_set(progressbar,
699 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
700 elm_progressbar_pulse(progressbar, EINA_TRUE);
701 evas_object_show(progressbar);
702 elm_box_pack_end(box, progressbar);
704 evas_object_show(box);
708 static Evas_Object *__add_process(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
710 retv_if(!item_data || !parent, NULL);
711 Evas_Object *progressbar = elm_progressbar_add(parent);
712 elm_object_style_set(progressbar, "list_process");
713 evas_object_size_hint_align_set(progressbar,
714 EVAS_HINT_FILL, 0.5);
715 evas_object_size_hint_weight_set(progressbar,
718 elm_progressbar_pulse(progressbar, EINA_TRUE);
719 evas_object_show(progressbar);
723 static Evas_Object *__add_radio_lable(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
725 retv_if(!item_data || !parent, NULL);
728 Evas_Object *radio = __add_radio(item_data, parent);
733 static Evas_Object *__add_left_default(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
735 retv_if(!item_data || !parent || !item_data->l_swallow_path, NULL);
736 Evas_Object *icon = elm_icon_add(parent);
737 elm_icon_file_set(icon, item_data->l_swallow_path,NULL);
738 evas_object_size_hint_aspect_set(icon,EVAS_ASPECT_CONTROL_VERTICAL,1, 1);
741 static Evas_Object *__add_right_default(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
743 retv_if(!item_data || !parent || !item_data->r_swallow_path, NULL);
744 Evas_Object *icon = elm_icon_add(parent);
745 elm_icon_file_set(icon, item_data->r_swallow_path,NULL);
746 evas_object_size_hint_aspect_set(icon,EVAS_ASPECT_CONTROL_VERTICAL,1, 1);
751 typedef Evas_Object * (*__drawer_fp)(Setting_GenGroupItem_Data *item_data, Evas_Object *parent);
754 SWALLOW_Type type; // ui type
757 static __Content_Drawer __cd_left[SWALLOW_Type_MAX] = {
759 {SWALLOW_Type_1CHECK, __add_check},
760 {SWALLOW_Type_1TOGGLE, __add_toggle},
761 {SWALLOW_Type_1RADIO, __add_radio},
762 {SWALLOW_Type_1BUTTON, __add_button},
764 //base objects in an layout
765 {SWALLOW_Type_LAYOUT_ENTRY, __add_entry},
766 {SWALLOW_Type_LAYOUT_SLIDER, __add_slider},
767 {SWALLOW_Type_LAYOUT_DATEFIELD, __add_datefield},
769 //other compelx objects
770 {SWALLOW_Type_1SEARCH, __add_search},
771 {SWALLOW_Type_1PROCESS, __add_process},
772 {SWALLOW_Type_MULTILINE_1TOGGLE, __add_multiline_toggle},
773 {SWALLOW_Type_1CHECKICON, __add_check_icon},
774 {SWALLOW_Type_1RADIO_1SEARCH, __add_radio_search},
775 {SWALLOW_Type_1RADIO_1LABLE, __add_radio_lable},
777 //left part object of the type
778 {SWALLOW_Type_1ICON_1RADIO, __add_left_default},
779 {SWALLOW_Type_1RADIO_1PROCESS, __add_radio},
781 static __Content_Drawer __cd_right[SWALLOW_Type_MAX] = {
782 //right part object of the type
783 {SWALLOW_Type_1ICON_1RADIO, __add_toggle},
784 {SWALLOW_Type_1RADIO_1PROCESS, __add_process},
787 static __Content_Drawer __cd_end[SWALLOW_Type_MAX] = {
788 //end part object of the type
789 {SWALLOW_Type_1RADIO, __add_radio},
791 /*static __Part_Drawer __pd[__MAX_PART_NUM] = {
792 {"elm.icon", __cd_left},
793 {"elm.icon.1", __cd_left},
794 {"elm.icon.2", __cd_right},
795 {"elm.swallow.end", __cd_end},
798 static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj,
801 retv_if(!data, NULL);
802 Setting_GenGroupItem_Data *item_data = data;
803 retv_if(!data, NULL);
804 __Content_Drawer *cd_list = NULL;
805 __drawer_fp fp = NULL;
806 if (!safeStrCmp(part, "elm.icon") || !safeStrCmp(part, "elm.icon.1"))
808 fp = __add_left_default; //hold default drawer
811 else if (!safeStrCmp(part, "elm.icon.2"))
813 fp = __add_right_default; //hold default drawer
814 cd_list = __cd_right;
816 else if (!safeStrCmp(part, "elm.swallow.end"))
818 //the default value of fp is NULL here
821 if (!cd_list) return NULL;//invalid part
824 for (; idx < SWALLOW_Type_MAX; idx++)
826 if (item_data->swallow_type == cd_list[idx].type)//match using swallow type
828 fp = cd_list[idx].draw;
832 return fp ? fp(item_data, obj) : NULL;
835 static void _gl_Gendial_del(void *data, Evas_Object *obj)
837 /* SETTING_TRACE_BEGIN; */
838 Setting_GenGroupItem_Data *item_data =
839 (Setting_GenGroupItem_Data *) data;
841 G_FREE(item_data->keyStr);
842 G_FREE(item_data->sub_desc);
843 G_FREE((item_data->l_swallow_path));
844 G_FREE((item_data->r_swallow_path));
845 G_FREE(item_data->item_style);
848 if (item_data->digits_filter_data)
850 G_FREE(item_data->digits_filter_data->accepted);
851 G_FREE(item_data->digits_filter_data->rejected);
852 FREE(item_data->digits_filter_data);
856 if (item_data->notify) {
857 evas_object_del(item_data->notify);
858 item_data->notify = NULL;
861 FREE(item_data->limit_filter_data);
862 __BACK_POINTER_UNSET(item_data);
865 /* SETTING_TRACE_END; */
869 * To intialize an Elm_Genlist_Item_Class, according to item style
871 * @param[in] item_style
874 bool setting_create_Gendial_itc(const char *item_style,
875 Elm_Genlist_Item_Class *itc)
877 itc->item_style = item_style;
878 itc->func.text_get = _gl_Gendial_text_get;
879 itc->func.content_get = _gl_Gendial_content_get;
880 itc->func.state_get = NULL;
881 itc->func.del = _gl_Gendial_del; /* _gl_Gendial_del; */
886 * Create group style item
888 * @return a pointer to Setting_GenGroupItem_Data
890 Setting_GenGroupItem_Data *setting_create_Gendial_field_group_titleItem(Evas_Object *genlist,
891 const Elm_Genlist_Item_Class *itc,
892 Elm_Object_Item *parent,
893 Elm_Genlist_Item_Type flag, /* ELM_GENLIST_ITEM_GROUP or ELM_GENLIST_ITEM_NONE */
895 setting_call_back_func gl_sel)
897 /* SETTING_TRACE_BEGIN; */
898 Setting_GenGroupItem_Data *item_data =
899 (Setting_GenGroupItem_Data *) calloc(1,
901 (Setting_GenGroupItem_Data));
902 setting_retvm_if(!item_data, NULL, "calloc failed");
903 item_data->keyStr = (char *)g_strdup(keyStr);
906 elm_genlist_item_append(genlist, itc, item_data, parent,
910 elm_genlist_item_append(genlist, itc, item_data, parent,
911 flag, _gl_Gendial_sel, NULL);
917 * Create separator style item with title
919 * @return a pointer to Setting_GenGroupItem_Data
921 Setting_GenGroupItem_Data *setting_create_Gendial_field_titleItem(
922 Evas_Object *genlist,
923 const Elm_Genlist_Item_Class *itc,
925 setting_call_back_func gl_sel)
927 /* SETTING_TRACE_BEGIN; */
928 Setting_GenGroupItem_Data *item_data =
929 (Setting_GenGroupItem_Data *) calloc(1,
931 (Setting_GenGroupItem_Data));
932 setting_retvm_if(!item_data, NULL, "calloc failed");
933 item_data->keyStr = (char *)g_strdup(keyStr);
936 elm_genlist_item_append(genlist, itc, item_data, NULL,
937 ELM_GENLIST_ITEM_NONE, gl_sel,
941 elm_genlist_item_append(genlist, itc, item_data, NULL,
942 ELM_GENLIST_ITEM_NONE,
943 _gl_Gendial_sel, NULL);
949 * Create 1radio-1text style item
951 * @return a pointer to Setting_GenGroupItem_Data
954 Setting_GenGroupItem_Data *setting_create_Gendial_field_1radio(
955 Evas_Object *genlist,
956 const Elm_Genlist_Item_Class *itc,
957 setting_call_back_func gl_sel,
959 SWALLOW_Type swallow_type,
960 Evas_Object *rgd, int chk_status,
962 setting_call_back_func chk_change_cb)
964 /* SETTING_TRACE_BEGIN; */
965 Setting_GenGroupItem_Data *item_data =
966 (Setting_GenGroupItem_Data *) calloc(1,
968 (Setting_GenGroupItem_Data));
969 setting_retvm_if(!item_data, NULL, "calloc failed");
970 item_data->keyStr = (char *)g_strdup(keyStr);
971 item_data->swallow_type = swallow_type;
972 item_data->chk_status = chk_status;
973 item_data->chk_change_cb = chk_change_cb;
974 item_data->rgd = rgd;
978 elm_genlist_item_append(genlist, itc, item_data, NULL,
979 ELM_GENLIST_ITEM_NONE, gl_sel,
983 elm_genlist_item_append(genlist, itc, item_data, NULL,
984 ELM_GENLIST_ITEM_NONE,
985 _gl_Gendial_sel, sel_data);
990 Setting_GenGroupItem_Data *setting_create_Gendial_field_2radio(
991 Evas_Object *genlist,
992 const Elm_Genlist_Item_Class *itc,
993 setting_call_back_func gl_sel,
995 SWALLOW_Type swallow_type,
996 Evas_Object *rgd, int chk_status,
998 const char *sub_desc,
999 setting_call_back_func chk_change_cb)
1001 /* SETTING_TRACE_BEGIN; */
1002 Setting_GenGroupItem_Data *item_data =
1003 (Setting_GenGroupItem_Data *) calloc(1,
1005 (Setting_GenGroupItem_Data));
1006 setting_retvm_if(!item_data, NULL, "calloc failed");
1007 item_data->keyStr = (char *)g_strdup(keyStr);
1008 item_data->sub_desc = (char *)g_strdup(sub_desc);
1009 item_data->swallow_type = swallow_type;
1010 item_data->chk_status = chk_status;
1011 item_data->chk_change_cb = chk_change_cb;
1012 item_data->rgd = rgd;
1016 elm_genlist_item_append(genlist, itc, item_data, NULL,
1017 ELM_GENLIST_ITEM_NONE, gl_sel,
1021 elm_genlist_item_append(genlist, itc, item_data, NULL,
1022 ELM_GENLIST_ITEM_NONE,
1023 _gl_Gendial_sel, sel_data);
1029 * Create common style item with menu icon
1031 * @return a pointer to Setting_GenGroupItem_Data
1033 Setting_GenGroupItem_Data *setting_create_Gendial_field_groupitem(
1034 Evas_Object *genlist,
1035 const Elm_Genlist_Item_Class *itc,
1036 Elm_Object_Item *parent,
1037 setting_call_back_func gl_sel,
1039 SWALLOW_Type swallow_type,
1041 char *r_icon_path, int chk_status,
1042 const char *keyStr, char *sub_desc,
1043 setting_call_back_func
1046 // SETTING_TRACE_BEGIN;
1047 Setting_GenGroupItem_Data *item_data = (
1048 Setting_GenGroupItem_Data *) calloc(1, sizeof(Setting_GenGroupItem_Data));
1049 setting_retvm_if(!item_data, NULL, "calloc failed");
1051 /* to do formatting customizition in one place */
1052 if (SWALLOW_Type_LAYOUT_SPECIALIZTION == swallow_type
1053 || SWALLOW_Type_LAYOUT_SPECIALIZTION_X == swallow_type) {
1054 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
1056 char speciliztion[MAX_SPECIALIZITION_LEN] = { 0, };
1057 char* temp1 = (char *)keyStr;
1058 char*temp2 = strchr(temp1, '&');
1061 while (NULL != temp2) {
1062 if (0 == safeStrNCmp(temp2, "&", strlen("&")) ||//'&'
1063 0 == safeStrNCmp(temp2, "<", strlen("<")) ||//'<'
1064 0 == safeStrNCmp(temp2, ">", strlen(">")) ||//'>'
1065 0 == safeStrNCmp(temp2, """, strlen(""")) ||//double quotes
1066 0 == safeStrNCmp(temp2, "'", strlen("'")) ||//single quotes
1067 0 == safeStrNCmp(temp2, " ", strlen(" ")) ||//space character
1068 0 == safeStrNCmp(temp2, "©", strlen("©")) ||//copyright character
1069 0 == safeStrNCmp(temp2, "®", strlen("®"))//registeration character
1070 ) {//escape character,do nothing
1072 if ('\0' == temp[0]) break;
1073 temp2 = strchr(temp, '&');
1077 g_strlcat(speciliztion, temp1, temp2 - temp1 +1);
1078 g_strlcat(speciliztion, "&", MAX_SPECIALIZITION_LEN);
1080 if ('\0' == temp1[0]) break;
1081 temp2 = strchr(temp1, '&');
1084 if ('\0' != temp1[0]) {
1085 g_strlcat(speciliztion, temp1, MAX_SPECIALIZITION_LEN);
1089 item_data->keyStr = (char *)g_strdup(speciliztion);
1091 item_data->keyStr = (char *)g_strdup(keyStr);
1094 item_data->sub_desc = (char *)g_strdup(sub_desc);
1095 item_data->swallow_type = swallow_type;
1096 item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1097 item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1098 item_data->chk_status = chk_status;
1099 item_data->chk_change_cb = chk_change_cb;
1103 elm_genlist_item_append(genlist, itc, item_data, parent,
1104 ELM_GENLIST_ITEM_NONE, gl_sel,
1108 elm_genlist_item_append(genlist, itc, item_data, parent,
1109 ELM_GENLIST_ITEM_NONE,
1110 _gl_Gendial_sel, sel_data);
1112 if (SWALLOW_Type_LAYOUT_SPECIALIZTION == swallow_type) {
1113 Elm_Object_Item *item = elm_genlist_item_append(genlist,
1116 ELM_GENLIST_ITEM_NONE,
1118 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1119 //Fix the separator line disappear issue when clicking "SPECIALIZTION" words in new HD theme
1120 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1127 * Common function to create a genlist item
1128 * @return a pointer to Setting_GenGroupItem_Data
1130 Setting_GenGroupItem_Data *setting_create_Gendial_field_def(Evas_Object *
1132 const Elm_Genlist_Item_Class *itc,
1133 setting_call_back_func
1143 setting_call_back_func chk_change_cb)
1145 return setting_create_Gendial_field_groupitem(genlist, itc, NULL,
1147 swallow_type, l_icon_path,
1148 r_icon_path, chk_status,
1154 * Create 1entry style item
1155 * @return a pointer to Setting_GenGroupItem_Data
1157 Setting_GenGroupItem_Data *setting_create_Gendial_field_entry(Evas_Object *
1159 const Elm_Genlist_Item_Class *itc,
1160 setting_call_back_func gl_sel,
1169 setting_call_back_func
1171 Elm_Input_Panel_Layout
1173 bool isPasswordFlag,
1180 /* SETTING_TRACE_BEGIN; */
1181 Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *) calloc(1,
1182 sizeof (Setting_GenGroupItem_Data));
1183 setting_retvm_if(!item_data, NULL, "calloc failed");
1184 item_data->keyStr = (char *)g_strdup(keyStr);
1185 item_data->sub_desc = (char *)g_strdup(sub_desc);
1186 item_data->swallow_type = swallow_type;
1187 item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1188 item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1189 item_data->chk_status = chk_status;
1190 item_data->chk_change_cb = chk_change_cb;
1192 item_data->input_type = input_type;
1193 item_data->isPasswordFlag = isPasswordFlag;
1194 item_data->isFocusFlag = isFocusFlag;
1196 Elm_Entry_Filter_Accept_Set *digits_filter_data =
1197 (Elm_Entry_Filter_Accept_Set *) calloc(1, sizeof (Elm_Entry_Filter_Accept_Set));
1198 if(!digits_filter_data) {
1199 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Accept_Set failed");
1200 // free allocated data
1201 G_FREE(item_data->keyStr);
1202 G_FREE(item_data->sub_desc);
1203 G_FREE(item_data->l_swallow_path);
1204 G_FREE(item_data->r_swallow_path);
1210 Elm_Entry_Filter_Limit_Size *limit_filter_data =
1211 (Elm_Entry_Filter_Limit_Size *) calloc(1, sizeof (Elm_Entry_Filter_Limit_Size));
1212 if(!limit_filter_data) {
1213 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Limit_Size failed");
1215 // free allocated data
1216 G_FREE(item_data->keyStr);
1217 G_FREE(item_data->sub_desc);
1218 G_FREE(item_data->l_swallow_path);
1219 G_FREE(item_data->r_swallow_path);
1221 FREE(digits_filter_data);
1225 limit_filter_data->max_char_count = max_char_count;
1226 limit_filter_data->max_byte_count = max_byte_count;
1227 digits_filter_data->accepted = (char *)g_strdup(accepted);
1228 digits_filter_data->rejected = (char *)g_strdup(rejected);
1230 item_data->digits_filter_data = digits_filter_data;
1231 item_data->limit_filter_data = limit_filter_data;
1232 item_data->userdata = sel_data;
1236 elm_genlist_item_append(genlist, itc, item_data, NULL,
1237 ELM_GENLIST_ITEM_NONE, gl_sel,
1241 elm_genlist_item_append(genlist, itc, item_data, NULL,
1242 ELM_GENLIST_ITEM_NONE,
1243 _gl_Gendial_sel, sel_data);
1249 * General function to create a parent item of expandable item
1251 * @return a pointer to Setting_GenGroupItem_Data
1253 Setting_GenGroupItem_Data *setting_create_Gendial_exp_parent_field(
1254 Evas_Object *genlist,
1255 const Elm_Genlist_Item_Class *itc,
1256 setting_call_back_func gl_sel,
1258 SWALLOW_Type swallow_type,
1262 /* SETTING_TRACE_BEGIN; */
1263 Setting_GenGroupItem_Data *item_data =
1264 (Setting_GenGroupItem_Data *) calloc(1,
1266 (Setting_GenGroupItem_Data));
1267 setting_retvm_if(!item_data, NULL, "calloc failed");
1268 item_data->keyStr = (char *)g_strdup(keyStr);
1269 item_data->sub_desc = (char *)g_strdup(sub_desc);
1270 item_data->swallow_type = swallow_type;
1271 item_data->childs = NULL;
1275 elm_genlist_item_append(genlist, itc, item_data, NULL,
1276 ELM_GENLIST_ITEM_TREE, gl_sel,
1280 elm_genlist_item_append(genlist, itc, item_data, NULL,
1281 ELM_GENLIST_ITEM_TREE,
1282 _gl_Gendial_sel_expand, sel_data);
1288 * General function to create a subitem of expandable item
1290 * @return a pointer to Setting_GenGroupItem_Data
1292 Setting_GenGroupItem_Data *setting_create_Gendial_exp_sub_field(
1293 Evas_Object *genlist,
1294 const Elm_Genlist_Item_Class *itc,
1295 setting_call_back_func gl_sel,
1297 Elm_Object_Item *parent,
1298 SWALLOW_Type swallow_type,
1299 Evas_Object *rgd, int chk_status,
1301 setting_call_back_func
1304 /* SETTING_TRACE_BEGIN; */
1305 Setting_GenGroupItem_Data *item_data =
1306 (Setting_GenGroupItem_Data *) calloc(1,
1308 (Setting_GenGroupItem_Data));
1309 setting_retvm_if(!item_data, NULL, "calloc failed");
1310 item_data->keyStr = (char *)g_strdup(keyStr);
1311 item_data->swallow_type = swallow_type;
1312 item_data->chk_status = chk_status;
1313 item_data->rgd = rgd;
1316 gl_sel = setting_sub_list_sel_cb;
1318 if (!chk_change_cb) {
1319 chk_change_cb = setting_sub_list_rd_change;
1322 item_data->chk_change_cb = chk_change_cb;
1324 elm_genlist_item_append(genlist, itc, item_data, parent,
1325 ELM_GENLIST_ITEM_NONE, gl_sel, sel_data);
1330 * To make genlist support expandable style item
1332 void setting_enable_expandable_genlist(Evas_Object *genlist, void *data,
1333 setting_call_back_func gl_exp_cb,
1334 setting_call_back_func gl_smart_cb)
1336 ret_if(NULL == genlist);
1337 elm_genlist_tree_effect_enabled_set(genlist, TRUE);
1339 gl_smart_cb = __exp_list_smart_cb;
1343 evas_object_smart_callback_add(genlist, "expanded", gl_exp_cb, data);
1344 evas_object_smart_callback_add(genlist, "contracted", gl_smart_cb, "contracted");
1346 evas_object_smart_callback_add(genlist, "drag", gl_smart_cb, "drag");
1347 evas_object_smart_callback_add(genlist, "longpressed", gl_smart_cb, "longpressed");
1353 setting_create_Gendial_itc("dialogue/1text.2icon.2",
1354 &(networkUG->itc_1text_2icon));
1356 1. create a process genlist item : [intial state is 'PROCESS']
1357 ad->data_searching_net = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_2icon),
1358 setting_network_select_network_mouse_up_Gendial_list_radio_cb, ad,
1359 SWALLOW_Type_1RADIO_1PROCESS,
1360 ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL,
1361 "Searching..", NULL);
1362 or [intial state is 'UNPROCESS']
1363 ad->data_searching_net = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_2icon),
1364 setting_network_select_network_mouse_up_Gendial_list_radio_cb, ad,
1365 SWALLOW_Type_1RADIO,
1366 ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL,
1367 "Searching..", NULL);
1369 2. to set the PROCESS state at any place as you like:
1370 setting_begin_progress_genlist_item(ad->data_searching_net); -- change from UNPROCESS->PROCESS
1371 setting_finish_progress_genlist_item(ad->data_searching_net);--change from PROCESS->UNPROCESS
1373 void setting_begin_progress_genlist_item(Setting_GenGroupItem_Data *data_item)
1376 if (SWALLOW_Type_1RADIO != data_item->swallow_type) {
1380 data_item->swallow_type = SWALLOW_Type_1RADIO_1PROCESS;
1381 elm_object_item_data_set(data_item->item, data_item);
1382 elm_genlist_item_update(data_item->item);
1386 void setting_finish_progress_genlist_item(Setting_GenGroupItem_Data *data_item)
1389 if (SWALLOW_Type_1RADIO_1PROCESS != data_item->swallow_type) {
1392 data_item->swallow_type = SWALLOW_Type_1RADIO;
1393 elm_object_item_data_set(data_item->item, data_item);
1394 elm_genlist_item_update(data_item->item);
1399 * Check if some item is selected in done-list
1402 bool setting_done_list_is_some_item_selected(Setting_Done_List_Data *list_data)
1404 SETTING_TRACE_BEGIN;
1405 bool isFound = FALSE; /* wether can found some item checked */
1408 for (; idx < list_data->cur_item_num; idx++) {
1410 elm_check_state_get(list_data->chk_items[idx].
1411 data_GenItem->eo_check);
1420 static void __setting_done_list_item_sel(void *data)
1422 SETTING_TRACE_BEGIN;
1423 retm_if(data == NULL, "data == NULL");
1424 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1429 setting_create_sel_info_popup(list_data->ly_parent,
1430 &(list_data->selInfoPop_layout),
1431 &(list_data->selInfoPop));
1433 /* else for other checks, do rotinue checking */
1434 bool isFound = FALSE; /* wether found the item not checked */
1435 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1436 if (!list_data->chk_items[idx].data_GenItem->chk_status) {
1437 /* SETTING_TRACE("%s not select", _(list_data->chk_items[idx].item_name)); */
1441 /* SETTING_TRACE("%s select", _(list_data->chk_items[idx].item_name)); */
1446 if (isFound) { /* reset state of chk_sel_all */
1447 list_data->select_all_checked = 0;
1448 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1450 list_data->select_all_checked = 1;
1451 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1454 /* SETTING_TRACE("sel_num:%d", sel_num); */
1456 evas_object_hide(list_data->selInfoPop);
1459 char text[MAX_DISPLAY_NAME_LEN_ON_UI +1] = {0, };
1460 snprintf(text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s(%d)", _("IDS_ST_OPT_SELECTED"), sel_num);
1462 /* text set and timeout set */
1463 edje_object_part_text_set(_EDJ(list_data->selInfoPop_layout), "elm.text", text);
1468 * Do process when clicking the check object in the done-list item
1470 void setting_done_list_Gendial_chk_btn_cb(void *data, Evas_Object *obj,
1473 SETTING_TRACE_BEGIN;
1475 retm_if(data == NULL, "Data parameter is NULL");
1476 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1479 list_item->chk_status = elm_check_state_get(list_item->eo_check);
1481 Setting_Done_List_Data *list_data = list_item->userdata;
1482 __setting_done_list_item_sel(list_data);
1485 static void setting_done_list_Gendial_mouse_up_cb(void *data, Evas_Object *obj,
1489 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1490 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1491 elm_genlist_item_selected_set(item, 0);
1492 Setting_GenGroupItem_Data *list_item =
1493 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
1495 int old_status = elm_check_state_get(list_item->eo_check);
1497 list_item->chk_status = !old_status;
1498 elm_check_state_set(list_item->eo_check, list_item->chk_status);
1500 /* other process.. */
1501 Setting_Done_List_Data *list_data = list_item->userdata;
1502 __setting_done_list_item_sel(list_data);
1505 static void __setting_select_all_done(void *data)
1507 SETTING_TRACE_BEGIN;
1508 retm_if(data == NULL, "data == NULL");
1509 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1514 setting_create_sel_info_popup(list_data->ly_parent,
1515 &(list_data->selInfoPop_layout),
1516 &(list_data->selInfoPop));
1518 if (list_data->select_all_checked) {
1519 /* set all other checks state to be 1 */
1520 SETTING_TRACE_DEBUG("Select All checked");
1521 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1522 list_data->chk_items[idx].data_GenItem->chk_status = 1;
1523 elm_object_item_data_set(list_data->chk_items[idx].data_GenItem->item, list_data->chk_items [idx].data_GenItem);
1524 elm_genlist_item_update(list_data->chk_items [idx].data_GenItem->item);
1526 sel_num = list_data->cur_item_num;
1528 SETTING_TRACE_DEBUG("Select All unchecked");
1529 /* set all other checks state to be 0 */
1530 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1531 list_data->chk_items[idx].data_GenItem->chk_status = 0;
1532 elm_object_item_data_set(list_data->chk_items[idx].data_GenItem->item, list_data->chk_items[idx].data_GenItem);
1533 elm_genlist_item_update(list_data->chk_items[idx].data_GenItem->item);
1538 /* SETTING_TRACE("sel_num:%d", sel_num); */
1540 evas_object_hide(list_data->selInfoPop);
1543 char text[MAX_DISPLAY_NAME_LEN_ON_UI +1] = {0, };
1544 snprintf(text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s(%d)", _("IDS_ST_OPT_SELECTED"), sel_num);
1546 /* text set and timeout set */
1547 edje_object_part_text_set(_EDJ(list_data->selInfoPop_layout), "elm.text", text);
1551 static void __setting_select_all_layout_mouse_down_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1553 SETTING_TRACE_BEGIN;
1554 retm_if(data == NULL, "data == NULL");
1555 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1557 list_data->select_all_checked = !list_data->select_all_checked;
1558 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1560 __setting_select_all_done(list_data);
1563 static void __setting_select_all_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
1565 SETTING_TRACE_BEGIN;
1566 retm_if(data == NULL, "data == NULL");
1567 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1569 list_data->select_all_checked = elm_check_state_get(list_data->select_all_checkbox);
1570 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1571 __setting_select_all_done(data);
1575 * The API to create done-list.
1577 * @param[in] list_data
1578 * @return a done-list
1580 Evas_Object *setting_create_done_list(Setting_Done_List_Data *list_data)
1582 SETTING_TRACE_BEGIN;
1583 retvm_if(list_data == NULL, NULL, "list_data == NULL");
1584 Evas_Object *sub_layout = elm_layout_add(list_data->win_main);
1585 elm_layout_file_set(sub_layout, SETTING_THEME_EDJ_NAME, "search_layout");
1586 evas_object_size_hint_weight_set(sub_layout, EVAS_HINT_EXPAND, 0.0);
1587 evas_object_show(sub_layout);
1589 setting_create_Gendial_itc("1text.1icon.2", &(list_data->itc_1text_1icon));
1591 Evas_Object *select_all_layout = elm_layout_add(sub_layout);
1592 retvm_if(select_all_layout == NULL, NULL, "select_all_layout == NULL");
1593 elm_layout_theme_set(select_all_layout, "genlist", "item", "select_all/default");
1594 evas_object_size_hint_weight_set(select_all_layout, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
1595 evas_object_size_hint_align_set(select_all_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
1596 evas_object_event_callback_add(select_all_layout, EVAS_CALLBACK_MOUSE_DOWN, __setting_select_all_layout_mouse_down_cb, list_data);
1598 Eina_Bool select_all_checked = list_data->select_all_checked;
1599 Evas_Object *select_all_checkbox = elm_check_add(select_all_layout);
1600 elm_check_state_pointer_set(select_all_checkbox, &select_all_checked);
1601 evas_object_smart_callback_add(select_all_checkbox, "changed", __setting_select_all_check_changed_cb, list_data);
1602 evas_object_propagate_events_set(select_all_checkbox, EINA_FALSE);
1603 elm_object_part_content_set(select_all_layout, "elm.icon", select_all_checkbox);
1605 list_data->select_all_checkbox = select_all_checkbox;
1606 elm_object_part_text_set(select_all_layout, "elm.text", _(KeyStr_Select_All));
1608 Evas_Object *scroller = elm_genlist_add(list_data->win_main);
1609 retvm_if(scroller == NULL, NULL, "scroller == NULL");
1610 elm_genlist_clear(scroller); /* first to clear list */
1612 elm_object_part_content_set(sub_layout, "search_list", scroller);
1613 elm_object_part_content_set(sub_layout, "search_bar", select_all_layout);
1616 for (; index < list_data->cur_item_num; index++) {
1617 list_data->chk_items[index].data_GenItem =
1618 setting_create_Gendial_field_def(scroller,
1619 &(list_data->itc_1text_1icon),
1620 setting_done_list_Gendial_mouse_up_cb,
1622 SWALLOW_Type_1CHECK, NULL,
1624 list_data->chk_items
1625 [index].item_name, NULL,
1626 setting_done_list_Gendial_chk_btn_cb);
1627 if (list_data->chk_items[index].data_GenItem) {
1628 list_data->chk_items[index].data_GenItem->userdata = list_data;
1630 SETTING_TRACE_ERROR("list_data->chk_items[index].data_GenItem is NULL");
1639 * To disable a specialized genlist item
1643 void setting_disable_genlist_item(Elm_Object_Item *item)
1646 elm_object_item_disabled_set(item, EINA_TRUE); /* make it be dim displayed */
1651 * To enable a specialized genlist item
1655 void setting_enable_genlist_item(Elm_Object_Item *item)
1658 elm_object_item_disabled_set(item, EINA_FALSE); /* make it be normally displayed */