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 static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj, const char *part);
28 static char *_gl_Gendial_text_get(void *data, Evas_Object *obj, const char *part);
29 static void _gl_Gendial_del(void *data, Evas_Object *obj);
30 const Elm_Genlist_Item_Class itc_seperator = {
31 .item_style = "dialogue/separator",
32 .func.text_get = NULL,
33 .func.content_get = NULL,
34 .func.state_get = NULL,
38 const Elm_Genlist_Item_Class itc_bottom_seperator = {
39 .item_style = "dialogue/separator",
40 .func.text_get = NULL,
41 .func.content_get = NULL,
42 .func.state_get = NULL,
46 const Elm_Genlist_Item_Class itc_sep_line = {
47 .item_style = "dialogue/separator",
48 .func.text_get = _gl_Gendial_text_get,
49 .func.content_get = NULL,
50 .func.state_get = NULL,
54 #define DEFINE_ITC1(style, name) \
55 const Elm_Genlist_Item_Class name = {\
57 .func.text_get = _gl_Gendial_text_get,\
58 .func.content_get = _gl_Gendial_content_get,\
59 .func.state_get = NULL,\
60 .func.del = _gl_Gendial_del,\
63 DEFINE_ITC1("dialogue/1text", itc_1text);
64 DEFINE_ITC1("dialogue/1text.1icon.2", itc_1text_1icon_2);
66 DEFINE_ITC1("dialogue/1icon", itc_1icon);
67 DEFINE_ITC1("dialogue/1text.1icon/expandable2", itc_1icon_1text_sub);
68 DEFINE_ITC1("dialogue/1text.1icon", itc_1text_1icon);
69 DEFINE_ITC1("dialogue/1text.2icon", itc_1text_2icon);
70 DEFINE_ITC1("dialogue/1text.2icon.2", itc_1text_2icon_2);
72 DEFINE_ITC1("dialogue/2text.2", itc_2text_2);
73 DEFINE_ITC1("dialogue/2text", itc_2text);
74 DEFINE_ITC1("multiline/2text.1icon", itc_multiline_2text_1icon);
75 DEFINE_ITC1("dialogue/2text.1icon.3", itc_2text_1icon_3);
76 DEFINE_ITC1("dialogue/2text.1icon.6", itc_2text_1icon_6);
77 DEFINE_ITC1("dialogue/2text.1icon.10.tb", itc_2text_1icon_7);
79 DEFINE_ITC1("dialogue/2text.3/expandable", itc_2text_3_parent);
80 DEFINE_ITC1("dialogue/2text.3", itc_2text_3);
81 DEFINE_ITC1("dialogue/2text.2icon.3", itc_2text_2icon_3);
83 DEFINE_ITC1("multiline/1text", itc_multiline_text);
84 DEFINE_ITC1("1text.1icon.3", itc_1text_1icon_3_tb);
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("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.
172 Evas_Object *entry = data;
173 elm_entry_entry_set(entry, "");
174 elm_object_focus_set(entry, EINA_TRUE);
177 static void __chk_changed(void *data, Evas_Object *obj, void *event_info)
179 retm_if(data == NULL, "Data parameter is NULL");
181 Setting_GenGroupItem_Data *list_item =
182 (Setting_GenGroupItem_Data *) data;
183 list_item->chk_status = elm_check_state_get(obj); /* for update */
186 static void __error_popup_response_cb(void *data, Evas_Object *obj,
190 retm_if(data == NULL, "Data parameter is NULL");
191 Setting_GenGroupItem_Data *list_item = data;
192 if (list_item->notify) {
193 evas_object_del(list_item->notify);
194 list_item->notify = NULL;
198 static void __max_len_reached(void *data, Evas_Object *obj, void *event_info)
201 retm_if(data == NULL, "Data parameter is NULL");
202 retm_if(!elm_object_focus_get(obj), "Entry is not focused");//notify only when entry is being focused on.
204 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
205 if (!list_item->notify)
207 list_item->notify = setting_create_popup_without_btn(list_item, list_item->win_main,
208 NULL, _(EXCEED_LIMITATION_STR),
209 __error_popup_response_cb,
210 POPUP_INTERVAL, FALSE, FALSE);
211 elm_object_focus_set(list_item->eo_check, EINA_FALSE);
213 //postpone 2 seconds again
214 elm_popup_timeout_set(list_item->notify, POPUP_INTERVAL);
219 static void __entry_keydown(void *data, Evas *e, Evas_Object *obj, void *event_info)
221 retm_if(data == NULL, "Data parameter is NULL");
222 retm_if(event_info == NULL, "event_info is NULL");
223 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
224 Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event_info;
226 if(safeStrCmp(ev->key, "KP_Enter") == 0 //it is for Japanese keyboard to fix N_SE-10719
227 || safeStrCmp(ev->key, "Return") == 0) //to disable the 'Enter' orginal function
229 SETTING_TRACE("ENTER %s ev->key:%s", __FUNCTION__, ev->key);
230 list_item->enterKeyPressFlag = true;
231 //hide the eraser button
232 //format like:xx<br/>
233 if (list_item->isSinglelineFlag == FALSE) {
234 const char *entry_str = remove_first_substring(elm_entry_entry_get(obj), "<br/>");
235 elm_entry_entry_set(obj, entry_str);
237 elm_entry_cursor_end_set(obj);
239 setting_hide_input_pannel_cb(obj);
241 list_item->enterKeyPressFlag = false;
242 Evas_Object *entry_container = elm_object_parent_widget_get(obj);
243 if(safeStrLen(elm_entry_entry_get(obj)) > 0) {
244 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
246 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
253 * Do process when clicking radio in subitem of expandable item
255 void setting_sub_list_rd_change(void *data, Evas_Object *obj, void *event_info)
258 retm_if(data == NULL, "Data parameter is NULL");
259 Setting_GenGroupItem_Data *list_item =
260 (Setting_GenGroupItem_Data *) data;
261 list_item->chk_status = elm_radio_value_get(obj); /* for update */
263 Elm_Object_Item *subItem = list_item->item;
264 Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subItem);
266 Setting_GenGroupItem_Data *data_subItem = elm_object_item_data_get(subItem); /* subItem data */
267 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
269 ret_if(NULL == data_subItem || NULL == data_parentItem);
271 setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
272 list_item->chk_status, &err);
274 data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
275 elm_object_item_data_set(data_parentItem->item, data_parentItem);
276 elm_genlist_item_update(data_parentItem->item);
280 * Do process when clicking on subitem of expandable item
282 void setting_sub_list_sel_cb(void *data, Evas_Object *obj, void *event_info)
286 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
287 Elm_Object_Item *subitem = (Elm_Object_Item *) event_info;
288 Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subitem);
289 elm_genlist_item_selected_set(subitem, 0);
290 Setting_GenGroupItem_Data *data_subItem =
291 elm_object_item_data_get(subitem);
292 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
293 ret_if(NULL == data_subItem || NULL == data_parentItem);
295 elm_radio_value_set(data_subItem->rgd, data_subItem->chk_status);
297 setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
298 data_subItem->chk_status, &err);
299 setting_retm_if(0 != err, "Set vconf error[%d]",data_parentItem->int_slp_setting_binded);
301 data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
302 elm_object_item_data_set(data_parentItem->item, data_parentItem);
303 elm_genlist_item_update(data_parentItem->item);
306 static void __exp_list_smart_cb(void *data, Evas_Object *obj, void *event_info)
308 ret_if(data == NULL || event_info == NULL);
309 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
310 char *cb_type = data;
312 if (0 == safeStrCmp(cb_type, "drag")
313 || 0 == safeStrCmp(cb_type, "longpressed")) {
314 //Evas_Object *base_view = (Evas_Object *) elm_genlist_item_object_get(item);
315 //edje_object_signal_emit(base_view, "mouse,out", "touch_arrow");
316 } else if (0 == safeStrCmp(cb_type, "contracted")) {
317 elm_genlist_item_subitems_clear(item);
321 static void _gl_Gendial_sel(void *data, Evas_Object *obj, void *event_info)
323 /* SETTING_TRACE_BEGIN; */
324 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
325 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
326 elm_genlist_item_selected_set(item, 0);
329 static void _gl_Gendial_sel_expand(void *data, Evas_Object *obj,
332 /* SETTING_TRACE_BEGIN; */
333 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
334 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
335 elm_genlist_item_selected_set(item, 0);
336 bool status = !elm_genlist_item_expanded_get(item);
337 elm_genlist_item_expanded_set(item, status);
340 static char *_gl_Gendial_text_get(void *data, Evas_Object *obj,
343 /* SETTING_TRACE_BEGIN; */
344 Setting_GenGroupItem_Data *item_data =
345 (Setting_GenGroupItem_Data *) data;
346 /* SETTING_TRACE("part:%s", part); */
347 if (SWALLOW_Type_LAYOUT_ENTRY == item_data->swallow_type) { /* no need to create 'text' part */
351 /* for font size view */
352 if (SWALLOW_Type_1RADIO_1LABLE == item_data->swallow_type) {
353 char speciliztion[MAX_SPECIALIZITION_LEN] = {0,};
355 SETTING_TRACE("item_data->chk_status:%d", item_data->chk_status);
356 if (SYSTEM_SETTINGS_FONT_SIZE_SMALL == item_data->chk_status) {
357 font_size = LABEL_FONT_SIZE_SMALL;
358 } else if (SYSTEM_SETTINGS_FONT_SIZE_LARGE == item_data->chk_status) {
359 font_size = LABEL_FONT_SIZE_LARGE;
360 } else if (SYSTEM_SETTINGS_FONT_SIZE_HUGE == item_data->chk_status) {
361 font_size = LABEL_FONT_SIZE_HUGE;
362 } else if (SYSTEM_SETTINGS_FONT_SIZE_GIANT == item_data->chk_status) {
363 font_size = LABEL_FONT_SIZE_GIANT;
365 font_size = LABEL_FONT_SIZE_NORMAL;
367 SETTING_TRACE("font_size:%d", font_size);
368 snprintf(speciliztion, sizeof(speciliztion), "<font_size=%d>%s</font_size>",
369 font_size, _(item_data->keyStr));
370 return (char *)g_strdup(speciliztion);
373 if (!safeStrCmp(part, "elm.text") || !safeStrCmp(part, "elm.text.1")) { /* title */
374 if (item_data->keyStr) {
375 return (char *)g_strdup(_(item_data->keyStr)); /* use item_data->keyStr */
378 } else if (!safeStrCmp(part, "elm.text.2")) { /* bottom or right */
379 if (item_data->sub_desc) {
380 return (char *)g_strdup(item_data->sub_desc);
387 static Evas_Object *__add_check(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
389 retv_if(!item_data || !parent, NULL);
390 Evas_Object *check = elm_check_add(parent);
391 elm_check_state_set(check, item_data->chk_status);
392 evas_object_show(check);
393 evas_object_pass_events_set(check, 1);
394 evas_object_propagate_events_set(check, 0);
396 item_data->eo_check = check;
398 if (item_data->chk_change_cb) {
399 evas_object_smart_callback_add(check,"changed",item_data->chk_change_cb,item_data);
401 evas_object_smart_callback_add(check,"changed", __chk_changed, item_data);
405 static Evas_Object *__add_check_icon(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
407 retv_if(!item_data || !parent, NULL);
408 Evas_Object *check = __add_check(item_data, parent);
410 Evas_Object *thumb = NULL;
411 if (item_data->r_swallow_path) {
412 thumb = elm_icon_add(parent);
413 elm_icon_file_set(thumb,
414 item_data->r_swallow_path,
416 evas_object_size_hint_aspect_set(thumb,
417 EVAS_ASPECT_CONTROL_VERTICAL,
421 Evas_Object *layout = elm_layout_add(parent);
422 elm_layout_file_set(layout, SETTING_THEME_EDJ_NAME,
424 evas_object_size_hint_weight_set(layout,
427 elm_object_part_content_set(layout, "checkbox", check);
428 elm_object_part_content_set(layout, "thumbnail", thumb);
429 evas_object_show(layout);
432 static Evas_Object *__add_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
434 retv_if(!item_data || !parent, NULL);
435 Evas_Object *check = __add_check(item_data, parent);
436 elm_object_style_set(check, "on&off");
439 static Evas_Object *__add_multiline_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
441 retv_if(!item_data || !parent, NULL);
442 Evas_Object *chk = __add_toggle(item_data, parent);
443 elm_object_style_set(chk, "on&off");
447 static Evas_Object *__add_radio(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
449 retv_if(!item_data || !parent, NULL);
450 if (!item_data->rgd) { /* exceptional handling */
451 item_data->rgd = elm_radio_add(parent);
452 elm_radio_state_value_set(item_data->rgd, -1);
454 Evas_Object *radio = elm_radio_add(parent);
455 elm_radio_state_value_set(radio,
456 item_data->chk_status);
457 elm_radio_group_add(radio, item_data->rgd);
458 evas_object_show(radio);
459 item_data->eo_check = radio;
460 if (item_data->chk_change_cb) {
461 evas_object_smart_callback_add(radio,
463 item_data->chk_change_cb,
466 evas_object_smart_callback_add(radio,
473 static Evas_Object *__add_button(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
475 retv_if(!item_data || !parent, NULL);
476 Evas_Object *btn = elm_button_add(parent);
477 evas_object_show(btn);
478 if (item_data->r_swallow_path)
480 elm_object_style_set(btn, item_data->r_swallow_path);
482 if (item_data->keyStr)
484 elm_object_text_set(btn, _(item_data->keyStr));
486 evas_object_propagate_events_set(btn, EINA_FALSE);
487 if (item_data->chk_change_cb)
488 evas_object_smart_callback_add(btn,
490 item_data->chk_change_cb,
495 static Evas_Object *__add_entry(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
497 retv_if(!item_data || !parent, NULL);
498 elm_genlist_mode_set(parent, ELM_LIST_COMPRESS); /* resolve abnormal height issue */
499 Evas_Object *ed_name =
500 setting_create_editfiled(parent, _(item_data->keyStr),
501 item_data->sub_desc);
502 evas_object_pass_events_set(ed_name, 1);
503 evas_object_propagate_events_set(ed_name, 0);
504 Evas_Object *entry = elm_object_part_content_get(ed_name, "elm.swallow.content");
505 item_data->eo_check = entry;
506 elm_entry_input_panel_layout_set(entry,
507 item_data->input_type);
509 if (item_data->isSinglelineFlag) {
510 elm_entry_scrollable_set(entry, EINA_TRUE);
511 elm_entry_single_line_set(entry, EINA_TRUE);
514 if (item_data->isPasswordFlag) {
515 elm_entry_single_line_set(entry, EINA_TRUE);
516 elm_entry_password_set(entry, EINA_TRUE);
519 if (item_data->limit_filter_data) {
520 elm_entry_markup_filter_append
522 elm_entry_filter_limit_size,
523 item_data->limit_filter_data);
525 if (item_data->maxlength_reached_cb) {
526 evas_object_smart_callback_add(entry,
528 item_data->maxlength_reached_cb,
531 evas_object_smart_callback_add(entry,
537 if (item_data->stop_change_cb) {//invoked when stop focusing on
538 evas_object_smart_callback_add(entry,
540 item_data->stop_change_cb,
545 evas_object_smart_callback_add(entry,
550 if (item_data->digits_filter_data) {
551 elm_entry_markup_filter_append
553 elm_entry_filter_accept_set,
554 item_data->digits_filter_data);
557 /* for Setting App, All the entrys's context popup shouldn't be able */
558 /* to insert images, text is the only one can be inserted. */
559 elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
561 if (item_data->chk_change_cb) {
562 evas_object_smart_callback_add
564 "changed", item_data->chk_change_cb,
568 evas_object_smart_callback_add(entry, "changed", __entry_changed, item_data);
569 evas_object_smart_callback_add(entry, "focused", __entry_focused, ed_name);
570 elm_object_signal_callback_add(ed_name, "elm,eraser,clicked", "elm", __eraser_clicked, entry);
572 if (item_data->start_change_cb) {
573 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, (Evas_Object_Event_Cb)(item_data->start_change_cb), item_data->userdata);
575 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, __entry_keydown, item_data);
577 Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(entry);
578 if (imf_context) ecore_imf_context_input_panel_event_callback_add(imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, item_data->x_callback_cb, item_data->userdata);
580 if (item_data->input_panel_disable_flag) {
581 elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
585 static Evas_Object *__add_slider(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
587 retv_if(!item_data || !parent, NULL);
588 Evas_Object *li_slider =
589 setting_create_slider(parent, item_data->evas,
590 item_data->l_swallow_path,
591 item_data->r_swallow_path,
592 item_data->chk_status,
593 item_data->isIndicatorVisible,
594 item_data->slider_min,
595 item_data->slider_max,
596 item_data->chk_change_cb,
597 item_data->start_change_cb,
598 item_data->stop_change_cb,
600 evas_object_pass_events_set(li_slider, 1);
601 evas_object_propagate_events_set(li_slider, 0);
602 item_data->eo_check = li_slider;
606 static Evas_Object *__add_datefield(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
608 retv_if(!item_data || !parent, NULL);
609 /* **********create time/date field */
610 Evas_Object *datetimefield = item_data->eo_check = elm_datetime_add(parent);
611 evas_object_size_hint_weight_set(datetimefield, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
612 evas_object_size_hint_align_set(datetimefield, EVAS_HINT_FILL, 0.5);
613 evas_object_show(datetimefield);
615 evas_object_pass_events_set(datetimefield, 1);
616 evas_object_propagate_events_set(datetimefield, 0);
618 char date_format[MAX_DATETIME_FORMAT_LEN + 1] = {0, };
619 const char *time_format = NULL;
620 if (item_data->chk_status)//12 hours
622 time_format = "%I : %M %p";
624 time_format = "%H : %M";
627 #if SUPPORT_DATEFIELD_DATE_FORMAT_AUTOSET //Get date-format from datefiled itself, if elm_datetime_add() supports set date-format via ICU.
628 char *old_format = elm_datetime_format_get(datetimefield);
629 snprintf(date_format, MAX_DATE_FORMAT_LEN + 1, //add one space " "
631 safeStrNCat(date_format, time_format, MAX_DATETIME_FORMAT_LEN);
633 SETTING_TRACE("datefield_format:%s", date_format);
635 snprintf(date_format, MAX_DATETIME_FORMAT_LEN,
636 "%s %s", item_data->sub_desc, time_format);
638 elm_datetime_format_set(datetimefield, date_format);
640 // min : 1970 1, 01, Thursday 00:00:00
641 // max : 2038 1, 19, Thursday 03:14:07
643 memset(&ts_ret, 0, sizeof(struct tm));
644 ts_ret.tm_year = 138;
647 elm_datetime_value_max_set(datetimefield, &ts_ret);
652 elm_datetime_value_min_set(datetimefield, &ts_ret);
655 time_t ctime = time(NULL);
657 struct tm *ts = localtime_r(&ctime, &ts_ret);
660 elm_datetime_value_set(datetimefield, &ts_ret);
662 if (item_data->chk_change_cb) {
663 evas_object_smart_callback_add(datetimefield,
665 item_data->chk_change_cb,
669 if (item_data->isItemDisableFlag) {
670 setting_disable_evas_object(datetimefield);
672 return datetimefield;
674 static Evas_Object *__add_radio_search(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
676 retv_if(!item_data || !parent, NULL);
677 Evas_Object *box = elm_box_add(parent);
678 elm_box_horizontal_set(box, 1);
681 Evas_Object *radio = __add_radio(item_data, parent);
682 setting_disable_evas_object(radio);
683 elm_box_pack_end(box, radio);
686 Evas_Object *separator =
687 setting_create_blank_rect_customize(box,
688 SETTING_HALF_SCREEN_WIDTH,
689 SETTING_PADDING_HEIGHT);
690 elm_box_pack_end(box, separator);
693 Evas_Object *progressbar = elm_progressbar_add(parent);
694 elm_object_style_set(progressbar, "list_process");
695 evas_object_size_hint_align_set(progressbar,
696 EVAS_HINT_FILL, 0.5);
697 evas_object_size_hint_weight_set(progressbar,
700 elm_progressbar_pulse(progressbar, EINA_TRUE);
701 evas_object_show(progressbar);
702 elm_box_pack_end(box, progressbar);
704 evas_object_show(box);
707 static Evas_Object *__add_search(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
709 retv_if(!item_data || !parent, NULL);
710 // added by JTS: CQ H0100135171
711 Evas_Object *box = elm_box_add(parent);
712 elm_box_horizontal_set(box, 1);
715 Evas_Object *separator =
716 setting_create_blank_rect_customize(box,
717 SETTING_HALF_SCREEN_WIDTH, SETTING_PADDING_HEIGHT);
718 elm_box_pack_end(box, separator);
721 Evas_Object *progressbar = elm_progressbar_add(parent);
722 elm_object_style_set(progressbar, "list_process");
723 evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5);
724 evas_object_size_hint_weight_set(progressbar,
725 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
726 elm_progressbar_pulse(progressbar, EINA_TRUE);
727 evas_object_show(progressbar);
728 elm_box_pack_end(box, progressbar);
730 evas_object_show(box);
734 static Evas_Object *__add_process(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
736 retv_if(!item_data || !parent, NULL);
737 Evas_Object *progressbar = elm_progressbar_add(parent);
738 elm_object_style_set(progressbar, "list_process");
739 evas_object_size_hint_align_set(progressbar,
740 EVAS_HINT_FILL, 0.5);
741 evas_object_size_hint_weight_set(progressbar,
744 elm_progressbar_pulse(progressbar, EINA_TRUE);
745 evas_object_show(progressbar);
749 static Evas_Object *__add_radio_lable(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
751 retv_if(!item_data || !parent, NULL);
754 Evas_Object *radio = __add_radio(item_data, parent);
759 static Evas_Object *__add_left_default(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
761 retv_if(!item_data || !parent || !item_data->l_swallow_path, NULL);
762 Evas_Object *icon = elm_icon_add(parent);
763 elm_icon_file_set(icon, item_data->l_swallow_path,NULL);
764 evas_object_size_hint_aspect_set(icon,EVAS_ASPECT_CONTROL_VERTICAL,1, 1);
767 static Evas_Object *__add_right_default(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
769 retv_if(!item_data || !parent || !item_data->r_swallow_path, NULL);
770 Evas_Object *icon = elm_icon_add(parent);
771 elm_icon_file_set(icon, item_data->r_swallow_path,NULL);
772 evas_object_size_hint_aspect_set(icon,EVAS_ASPECT_CONTROL_VERTICAL,1, 1);
777 typedef Evas_Object * (*__drawer_fp)(Setting_GenGroupItem_Data *item_data, Evas_Object *parent);
780 SWALLOW_Type type; // ui type
783 static __Content_Drawer __cd_left[SWALLOW_Type_MAX] = {
785 {SWALLOW_Type_1CHECK, __add_check},
786 {SWALLOW_Type_1TOGGLE, __add_toggle},
787 {SWALLOW_Type_1RADIO, __add_radio},
788 {SWALLOW_Type_1BUTTON, __add_button},
790 //base objects in an layout
791 {SWALLOW_Type_LAYOUT_ENTRY, __add_entry},
792 {SWALLOW_Type_LAYOUT_SLIDER, __add_slider},
793 {SWALLOW_Type_LAYOUT_DATEFIELD, __add_datefield},
795 //other compelx objects
796 {SWALLOW_Type_1SEARCH, __add_search},
797 {SWALLOW_Type_1PROCESS, __add_process},
798 {SWALLOW_Type_MULTILINE_1TOGGLE, __add_multiline_toggle},
799 {SWALLOW_Type_1CHECKICON, __add_check_icon},
800 {SWALLOW_Type_1RADIO_1SEARCH, __add_radio_search},
801 {SWALLOW_Type_1RADIO_1LABLE, __add_radio_lable},
803 //left part object of the type
804 {SWALLOW_Type_1ICON_1RADIO, __add_left_default},
805 {SWALLOW_Type_1RADIO_1PROCESS, __add_radio},
807 static __Content_Drawer __cd_right[SWALLOW_Type_MAX] = {
808 //right part object of the type
809 {SWALLOW_Type_1ICON_1RADIO, __add_toggle},
810 {SWALLOW_Type_1RADIO_1PROCESS, __add_process},
813 static __Content_Drawer __cd_end[SWALLOW_Type_MAX] = {
814 //end part object of the type
815 {SWALLOW_Type_1RADIO, __add_radio},
817 /*static __Part_Drawer __pd[__MAX_PART_NUM] = {
818 {"elm.icon", __cd_left},
819 {"elm.icon.1", __cd_left},
820 {"elm.icon.2", __cd_right},
821 {"elm.swallow.end", __cd_end},
824 static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj,
827 retv_if(!data, NULL);
828 Setting_GenGroupItem_Data *item_data = data;
829 retv_if(!data, NULL);
830 __Content_Drawer *cd_list = NULL;
831 __drawer_fp fp = NULL;
832 if (!safeStrCmp(part, "elm.icon") || !safeStrCmp(part, "elm.icon.1"))
834 fp = __add_left_default; //hold default drawer
837 else if (!safeStrCmp(part, "elm.icon.2"))
839 fp = __add_right_default; //hold default drawer
840 cd_list = __cd_right;
842 else if (!safeStrCmp(part, "elm.swallow.end"))
844 //the default value of fp is NULL here
847 if (!cd_list) return NULL;//invalid part
850 for (; idx < SWALLOW_Type_MAX; idx++)
852 if (item_data->swallow_type == cd_list[idx].type)//match using swallow type
854 fp = cd_list[idx].draw;
858 return fp ? fp(item_data, obj) : NULL;
861 static void _gl_Gendial_del(void *data, Evas_Object *obj)
863 /* SETTING_TRACE_BEGIN; */
864 Setting_GenGroupItem_Data *item_data =
865 (Setting_GenGroupItem_Data *) data;
867 G_FREE(item_data->keyStr);
868 G_FREE(item_data->sub_desc);
869 G_FREE((item_data->l_swallow_path));
870 G_FREE((item_data->r_swallow_path));
871 G_FREE(item_data->item_style);
874 if (item_data->digits_filter_data)
876 G_FREE(item_data->digits_filter_data->accepted);
877 G_FREE(item_data->digits_filter_data->rejected);
878 FREE(item_data->digits_filter_data);
882 if (item_data->notify) {
883 evas_object_del(item_data->notify);
884 item_data->notify = NULL;
887 FREE(item_data->limit_filter_data);
888 __BACK_POINTER_UNSET(item_data);
891 /* SETTING_TRACE_END; */
895 * To intialize an Elm_Genlist_Item_Class, according to item style
897 * @param[in] item_style
900 bool setting_create_Gendial_itc(const char *item_style,
901 Elm_Genlist_Item_Class *itc)
903 itc->item_style = item_style;
904 itc->func.text_get = _gl_Gendial_text_get;
905 itc->func.content_get = _gl_Gendial_content_get;
906 itc->func.state_get = NULL;
907 itc->func.del = _gl_Gendial_del; /* _gl_Gendial_del; */
912 * Create group style item
914 * @return a pointer to Setting_GenGroupItem_Data
916 Setting_GenGroupItem_Data *setting_create_Gendial_field_group_titleItem(Evas_Object *genlist,
917 const Elm_Genlist_Item_Class *itc,
918 Elm_Object_Item *parent,
919 Elm_Genlist_Item_Type flag, /* ELM_GENLIST_ITEM_GROUP or ELM_GENLIST_ITEM_NONE */
921 setting_call_back_func gl_sel)
923 /* SETTING_TRACE_BEGIN; */
924 Setting_GenGroupItem_Data *item_data =
925 (Setting_GenGroupItem_Data *) calloc(1,
927 (Setting_GenGroupItem_Data));
928 setting_retvm_if(!item_data, NULL, "calloc failed");
929 item_data->keyStr = (char *)g_strdup(keyStr);
932 elm_genlist_item_append(genlist, itc, item_data, parent,
936 elm_genlist_item_append(genlist, itc, item_data, parent,
937 flag, _gl_Gendial_sel, NULL);
943 * Create separator style item with title
945 * @return a pointer to Setting_GenGroupItem_Data
947 Setting_GenGroupItem_Data *setting_create_Gendial_field_titleItem(
948 Evas_Object *genlist,
949 const Elm_Genlist_Item_Class *itc,
951 setting_call_back_func gl_sel)
953 /* SETTING_TRACE_BEGIN; */
954 Setting_GenGroupItem_Data *item_data =
955 (Setting_GenGroupItem_Data *) calloc(1,
957 (Setting_GenGroupItem_Data));
958 setting_retvm_if(!item_data, NULL, "calloc failed");
959 item_data->keyStr = (char *)g_strdup(keyStr);
962 elm_genlist_item_append(genlist, itc, item_data, NULL,
963 ELM_GENLIST_ITEM_NONE, gl_sel,
967 elm_genlist_item_append(genlist, itc, item_data, NULL,
968 ELM_GENLIST_ITEM_NONE,
969 _gl_Gendial_sel, NULL);
975 * Create 1radio-1text style item
977 * @return a pointer to Setting_GenGroupItem_Data
980 Setting_GenGroupItem_Data *setting_create_Gendial_field_1radio(
981 Evas_Object *genlist,
982 const Elm_Genlist_Item_Class *itc,
983 setting_call_back_func gl_sel,
985 SWALLOW_Type swallow_type,
986 Evas_Object *rgd, int chk_status,
988 setting_call_back_func chk_change_cb)
990 /* SETTING_TRACE_BEGIN; */
991 Setting_GenGroupItem_Data *item_data =
992 (Setting_GenGroupItem_Data *) calloc(1,
994 (Setting_GenGroupItem_Data));
995 setting_retvm_if(!item_data, NULL, "calloc failed");
996 item_data->keyStr = (char *)g_strdup(keyStr);
997 item_data->swallow_type = swallow_type;
998 item_data->chk_status = chk_status;
999 item_data->chk_change_cb = chk_change_cb;
1000 item_data->rgd = rgd;
1004 elm_genlist_item_append(genlist, itc, item_data, NULL,
1005 ELM_GENLIST_ITEM_NONE, gl_sel,
1009 elm_genlist_item_append(genlist, itc, item_data, NULL,
1010 ELM_GENLIST_ITEM_NONE,
1011 _gl_Gendial_sel, sel_data);
1016 Setting_GenGroupItem_Data *setting_create_Gendial_field_2radio(
1017 Evas_Object *genlist,
1018 const Elm_Genlist_Item_Class *itc,
1019 setting_call_back_func gl_sel,
1021 SWALLOW_Type swallow_type,
1022 Evas_Object *rgd, int chk_status,
1024 const char *sub_desc,
1025 setting_call_back_func chk_change_cb)
1027 /* SETTING_TRACE_BEGIN; */
1028 Setting_GenGroupItem_Data *item_data =
1029 (Setting_GenGroupItem_Data *) calloc(1,
1031 (Setting_GenGroupItem_Data));
1032 setting_retvm_if(!item_data, NULL, "calloc failed");
1033 item_data->keyStr = (char *)g_strdup(keyStr);
1034 item_data->sub_desc = (char *)g_strdup(sub_desc);
1035 item_data->swallow_type = swallow_type;
1036 item_data->chk_status = chk_status;
1037 item_data->chk_change_cb = chk_change_cb;
1038 item_data->rgd = rgd;
1042 elm_genlist_item_append(genlist, itc, item_data, NULL,
1043 ELM_GENLIST_ITEM_NONE, gl_sel,
1047 elm_genlist_item_append(genlist, itc, item_data, NULL,
1048 ELM_GENLIST_ITEM_NONE,
1049 _gl_Gendial_sel, sel_data);
1055 * Create common style item with menu icon
1057 * @return a pointer to Setting_GenGroupItem_Data
1059 Setting_GenGroupItem_Data *setting_create_Gendial_field_groupitem(
1060 Evas_Object *genlist,
1061 const Elm_Genlist_Item_Class *itc,
1062 Elm_Object_Item *parent,
1063 setting_call_back_func gl_sel,
1065 SWALLOW_Type swallow_type,
1067 char *r_icon_path, int chk_status,
1068 const char *keyStr, char *sub_desc,
1069 setting_call_back_func
1072 // SETTING_TRACE_BEGIN;
1073 Setting_GenGroupItem_Data *item_data = (
1074 Setting_GenGroupItem_Data *) calloc(1, sizeof(Setting_GenGroupItem_Data));
1075 setting_retvm_if(!item_data, NULL, "calloc failed");
1077 /* to do formatting customizition in one place */
1078 if (SWALLOW_Type_LAYOUT_SPECIALIZTION == swallow_type
1079 || SWALLOW_Type_LAYOUT_SPECIALIZTION_X == swallow_type) {
1080 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
1082 char speciliztion[MAX_SPECIALIZITION_LEN] = { 0, };
1083 char* temp1 = (char *)keyStr;
1084 char*temp2 = strchr(temp1, '&');
1087 while (NULL != temp2) {
1088 if (0 == safeStrNCmp(temp2, "&", strlen("&")) ||//'&'
1089 0 == safeStrNCmp(temp2, "<", strlen("<")) ||//'<'
1090 0 == safeStrNCmp(temp2, ">", strlen(">")) ||//'>'
1091 0 == safeStrNCmp(temp2, """, strlen(""")) ||//double quotes
1092 0 == safeStrNCmp(temp2, "'", strlen("'")) ||//single quotes
1093 0 == safeStrNCmp(temp2, " ", strlen(" ")) ||//space character
1094 0 == safeStrNCmp(temp2, "©", strlen("©")) ||//copyright character
1095 0 == safeStrNCmp(temp2, "®", strlen("®"))//registeration character
1096 ) {//escape character,do nothing
1098 if ('\0' == temp[0]) break;
1099 temp2 = strchr(temp, '&');
1103 g_strlcat(speciliztion, temp1, temp2 - temp1 +1);
1104 g_strlcat(speciliztion, "&", MAX_SPECIALIZITION_LEN);
1106 if ('\0' == temp1[0]) break;
1107 temp2 = strchr(temp1, '&');
1110 if ('\0' != temp1[0]) {
1111 g_strlcat(speciliztion, temp1, MAX_SPECIALIZITION_LEN);
1115 item_data->keyStr = (char *)g_strdup(speciliztion);
1117 item_data->keyStr = (char *)g_strdup(keyStr);
1120 item_data->sub_desc = (char *)g_strdup(sub_desc);
1121 item_data->swallow_type = swallow_type;
1122 item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1123 item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1124 item_data->chk_status = chk_status;
1125 item_data->chk_change_cb = chk_change_cb;
1129 elm_genlist_item_append(genlist, itc, item_data, parent,
1130 ELM_GENLIST_ITEM_NONE, gl_sel,
1134 elm_genlist_item_append(genlist, itc, item_data, parent,
1135 ELM_GENLIST_ITEM_NONE,
1136 _gl_Gendial_sel, sel_data);
1138 //help text clicking issue
1139 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1141 if (SWALLOW_Type_LAYOUT_SPECIALIZTION == swallow_type) {
1142 Elm_Object_Item *item = elm_genlist_item_append(genlist,
1145 ELM_GENLIST_ITEM_NONE,
1147 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1148 //Fix the separator line disappear issue when clicking "SPECIALIZTION" words in new HD theme
1149 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1156 * Common function to create a genlist item
1157 * @return a pointer to Setting_GenGroupItem_Data
1159 Setting_GenGroupItem_Data *setting_create_Gendial_field_def(Evas_Object *
1161 const Elm_Genlist_Item_Class *itc,
1162 setting_call_back_func
1172 setting_call_back_func chk_change_cb)
1174 return setting_create_Gendial_field_groupitem(genlist, itc, NULL,
1176 swallow_type, l_icon_path,
1177 r_icon_path, chk_status,
1183 * Create 1entry style item
1184 * @return a pointer to Setting_GenGroupItem_Data
1186 Setting_GenGroupItem_Data *setting_create_Gendial_field_entry(Evas_Object *
1188 const Elm_Genlist_Item_Class *itc,
1189 setting_call_back_func gl_sel,
1198 setting_call_back_func
1200 Elm_Input_Panel_Layout
1202 bool isPasswordFlag,
1209 /* SETTING_TRACE_BEGIN; */
1210 Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *) calloc(1,
1211 sizeof (Setting_GenGroupItem_Data));
1212 setting_retvm_if(!item_data, NULL, "calloc failed");
1213 item_data->keyStr = (char *)g_strdup(keyStr);
1214 item_data->sub_desc = (char *)g_strdup(sub_desc);
1215 item_data->swallow_type = swallow_type;
1216 item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1217 item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1218 item_data->chk_status = chk_status;
1219 item_data->chk_change_cb = chk_change_cb;
1221 item_data->input_type = input_type;
1222 item_data->isPasswordFlag = isPasswordFlag;
1223 item_data->isFocusFlag = isFocusFlag;
1225 Elm_Entry_Filter_Accept_Set *digits_filter_data =
1226 (Elm_Entry_Filter_Accept_Set *) calloc(1, sizeof (Elm_Entry_Filter_Accept_Set));
1227 if(!digits_filter_data) {
1228 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Accept_Set failed");
1229 // free allocated data
1230 G_FREE(item_data->keyStr);
1231 G_FREE(item_data->sub_desc);
1232 G_FREE(item_data->l_swallow_path);
1233 G_FREE(item_data->r_swallow_path);
1239 Elm_Entry_Filter_Limit_Size *limit_filter_data =
1240 (Elm_Entry_Filter_Limit_Size *) calloc(1, sizeof (Elm_Entry_Filter_Limit_Size));
1241 if(!limit_filter_data) {
1242 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Limit_Size failed");
1244 // free allocated data
1245 G_FREE(item_data->keyStr);
1246 G_FREE(item_data->sub_desc);
1247 G_FREE(item_data->l_swallow_path);
1248 G_FREE(item_data->r_swallow_path);
1250 FREE(digits_filter_data);
1254 limit_filter_data->max_char_count = max_char_count;
1255 limit_filter_data->max_byte_count = max_byte_count;
1256 digits_filter_data->accepted = (char *)g_strdup(accepted);
1257 digits_filter_data->rejected = (char *)g_strdup(rejected);
1259 item_data->digits_filter_data = digits_filter_data;
1260 item_data->limit_filter_data = limit_filter_data;
1261 item_data->userdata = sel_data;
1265 elm_genlist_item_append(genlist, itc, item_data, NULL,
1266 ELM_GENLIST_ITEM_NONE, gl_sel,
1270 elm_genlist_item_append(genlist, itc, item_data, NULL,
1271 ELM_GENLIST_ITEM_NONE,
1272 _gl_Gendial_sel, sel_data);
1278 * General function to create a parent item of expandable item
1280 * @return a pointer to Setting_GenGroupItem_Data
1282 Setting_GenGroupItem_Data *setting_create_Gendial_exp_parent_field(
1283 Evas_Object *genlist,
1284 const Elm_Genlist_Item_Class *itc,
1285 setting_call_back_func gl_sel,
1287 SWALLOW_Type swallow_type,
1291 /* SETTING_TRACE_BEGIN; */
1292 Setting_GenGroupItem_Data *item_data =
1293 (Setting_GenGroupItem_Data *) calloc(1,
1295 (Setting_GenGroupItem_Data));
1296 setting_retvm_if(!item_data, NULL, "calloc failed");
1297 item_data->keyStr = (char *)g_strdup(keyStr);
1298 item_data->sub_desc = (char *)g_strdup(sub_desc);
1299 item_data->swallow_type = swallow_type;
1303 elm_genlist_item_append(genlist, itc, item_data, NULL,
1304 ELM_GENLIST_ITEM_TREE, gl_sel,
1308 elm_genlist_item_append(genlist, itc, item_data, NULL,
1309 ELM_GENLIST_ITEM_TREE,
1310 _gl_Gendial_sel_expand, sel_data);
1316 * General function to create a subitem of expandable item
1318 * @return a pointer to Setting_GenGroupItem_Data
1320 Setting_GenGroupItem_Data *setting_create_Gendial_exp_sub_field(
1321 Evas_Object *genlist,
1322 const Elm_Genlist_Item_Class *itc,
1323 setting_call_back_func gl_sel,
1325 Elm_Object_Item *parent,
1326 SWALLOW_Type swallow_type,
1327 Evas_Object *rgd, int chk_status,
1329 setting_call_back_func
1332 /* SETTING_TRACE_BEGIN; */
1333 Setting_GenGroupItem_Data *item_data =
1334 (Setting_GenGroupItem_Data *) calloc(1,
1336 (Setting_GenGroupItem_Data));
1337 setting_retvm_if(!item_data, NULL, "calloc failed");
1338 item_data->keyStr = (char *)g_strdup(keyStr);
1339 item_data->swallow_type = swallow_type;
1340 item_data->chk_status = chk_status;
1341 item_data->rgd = rgd;
1344 gl_sel = setting_sub_list_sel_cb;
1346 if (!chk_change_cb) {
1347 chk_change_cb = setting_sub_list_rd_change;
1350 item_data->chk_change_cb = chk_change_cb;
1352 elm_genlist_item_append(genlist, itc, item_data, parent,
1353 ELM_GENLIST_ITEM_NONE, gl_sel, sel_data);
1358 * To make genlist support expandable style item
1360 void setting_enable_expandable_genlist(Evas_Object *genlist, void *data,
1361 setting_call_back_func gl_exp_cb,
1362 setting_call_back_func gl_smart_cb)
1364 ret_if(NULL == genlist);
1365 elm_genlist_tree_effect_enabled_set(genlist, TRUE);
1367 gl_smart_cb = __exp_list_smart_cb;
1371 evas_object_smart_callback_add(genlist, "expanded", gl_exp_cb, data);
1372 evas_object_smart_callback_add(genlist, "contracted", gl_smart_cb, "contracted");
1374 evas_object_smart_callback_add(genlist, "drag", gl_smart_cb, "drag");
1375 evas_object_smart_callback_add(genlist, "longpressed", gl_smart_cb, "longpressed");
1381 setting_create_Gendial_itc("dialogue/1text.2icon.2",
1382 &(networkUG->itc_1text_2icon));
1384 1. create a process genlist item : [intial state is 'PROCESS']
1385 ad->data_searching_net = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_2icon),
1386 setting_network_select_network_mouse_up_Gendial_list_radio_cb, ad,
1387 SWALLOW_Type_1RADIO_1PROCESS,
1388 ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL,
1389 "Searching..", NULL);
1390 or [intial state is 'UNPROCESS']
1391 ad->data_searching_net = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_2icon),
1392 setting_network_select_network_mouse_up_Gendial_list_radio_cb, ad,
1393 SWALLOW_Type_1RADIO,
1394 ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL,
1395 "Searching..", NULL);
1397 2. to set the PROCESS state at any place as you like:
1398 setting_begin_progress_genlist_item(ad->data_searching_net); -- change from UNPROCESS->PROCESS
1399 setting_finish_progress_genlist_item(ad->data_searching_net);--change from PROCESS->UNPROCESS
1401 void setting_begin_progress_genlist_item(Setting_GenGroupItem_Data *data_item)
1404 if (SWALLOW_Type_1RADIO != data_item->swallow_type) {
1408 data_item->swallow_type = SWALLOW_Type_1RADIO_1PROCESS;
1409 elm_object_item_data_set(data_item->item, data_item);
1410 elm_genlist_item_update(data_item->item);
1414 void setting_finish_progress_genlist_item(Setting_GenGroupItem_Data *data_item)
1417 if (SWALLOW_Type_1RADIO_1PROCESS != data_item->swallow_type) {
1420 data_item->swallow_type = SWALLOW_Type_1RADIO;
1421 elm_object_item_data_set(data_item->item, data_item);
1422 elm_genlist_item_update(data_item->item);
1427 * Check if some item is selected in done-list
1430 bool setting_done_list_is_some_item_selected(Setting_Done_List_Data *list_data)
1432 SETTING_TRACE_BEGIN;
1433 bool isFound = FALSE; /* wether can found some item checked */
1436 for (; idx < list_data->cur_item_num; idx++) {
1438 elm_check_state_get(list_data->chk_items[idx].
1439 data_GenItem->eo_check);
1448 static void __setting_done_list_item_sel(void *data)
1450 SETTING_TRACE_BEGIN;
1451 retm_if(data == NULL, "data == NULL");
1452 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1457 setting_create_sel_info_popup(list_data->ly_parent,
1458 &(list_data->selInfoPop_layout),
1459 &(list_data->selInfoPop));
1461 /* else for other checks, do rotinue checking */
1462 bool isFound = FALSE; /* wether found the item not checked */
1463 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1464 if (!list_data->chk_items[idx].data_GenItem->chk_status) {
1465 /* SETTING_TRACE("%s not select", _(list_data->chk_items[idx].item_name)); */
1469 /* SETTING_TRACE("%s select", _(list_data->chk_items[idx].item_name)); */
1474 if (isFound) { /* reset state of chk_sel_all */
1475 list_data->select_all_checked = 0;
1476 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1478 list_data->select_all_checked = 1;
1479 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1482 /* SETTING_TRACE("sel_num:%d", sel_num); */
1484 if (list_data->navi_it) {
1485 Evas_Object *button = elm_object_item_part_content_get(list_data->navi_it, "toolbar_button1");
1486 elm_object_disabled_set(button, EINA_TRUE);
1488 evas_object_hide(list_data->selInfoPop);
1492 char text[MAX_DISPLAY_NAME_LEN_ON_UI +1] = {0, };
1493 snprintf(text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s (%d)", _("IDS_ST_OPT_SELECTED"), sel_num);
1495 /* text set and timeout set */
1496 edje_object_part_text_set(_EDJ(list_data->selInfoPop_layout), "elm.text", text);
1498 if (list_data->navi_it) {
1499 Evas_Object *button = elm_object_item_part_content_get(list_data->navi_it, "toolbar_button1");
1500 elm_object_disabled_set(button, EINA_FALSE);
1505 * Do process when clicking the check object in the done-list item
1507 void setting_done_list_Gendial_chk_btn_cb(void *data, Evas_Object *obj,
1510 SETTING_TRACE_BEGIN;
1512 retm_if(data == NULL, "Data parameter is NULL");
1513 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1516 list_item->chk_status = elm_check_state_get(list_item->eo_check);
1518 Setting_Done_List_Data *list_data = list_item->userdata;
1519 __setting_done_list_item_sel(list_data);
1522 static void setting_done_list_Gendial_mouse_up_cb(void *data, Evas_Object *obj,
1526 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1527 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1528 elm_genlist_item_selected_set(item, 0);
1529 Setting_GenGroupItem_Data *list_item =
1530 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
1532 int old_status = elm_check_state_get(list_item->eo_check);
1534 list_item->chk_status = !old_status;
1535 elm_check_state_set(list_item->eo_check, list_item->chk_status);
1537 /* other process.. */
1538 Setting_Done_List_Data *list_data = list_item->userdata;
1539 __setting_done_list_item_sel(list_data);
1542 static void __setting_select_all_done(void *data)
1544 SETTING_TRACE_BEGIN;
1545 retm_if(data == NULL, "data == NULL");
1546 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1551 setting_create_sel_info_popup(list_data->ly_parent,
1552 &(list_data->selInfoPop_layout),
1553 &(list_data->selInfoPop));
1555 if (list_data->select_all_checked) {
1556 /* set all other checks state to be 1 */
1557 SETTING_TRACE_DEBUG("Select All checked");
1558 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1559 list_data->chk_items[idx].data_GenItem->chk_status = 1;
1560 elm_object_item_data_set(list_data->chk_items[idx].data_GenItem->item, list_data->chk_items [idx].data_GenItem);
1561 elm_genlist_item_update(list_data->chk_items [idx].data_GenItem->item);
1563 sel_num = list_data->cur_item_num;
1565 SETTING_TRACE_DEBUG("Select All unchecked");
1566 /* set all other checks state to be 0 */
1567 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1568 list_data->chk_items[idx].data_GenItem->chk_status = 0;
1569 elm_object_item_data_set(list_data->chk_items[idx].data_GenItem->item, list_data->chk_items[idx].data_GenItem);
1570 elm_genlist_item_update(list_data->chk_items[idx].data_GenItem->item);
1575 /* SETTING_TRACE("sel_num:%d", sel_num); */
1577 if (list_data->navi_it) {
1578 Evas_Object *button = elm_object_item_part_content_get(list_data->navi_it, "toolbar_button1");
1579 elm_object_disabled_set(button, EINA_TRUE);
1582 evas_object_hide(list_data->selInfoPop);
1585 char text[MAX_DISPLAY_NAME_LEN_ON_UI +1] = {0, };
1586 snprintf(text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s (%d)", _("IDS_ST_OPT_SELECTED"), sel_num);
1588 /* text set and timeout set */
1589 edje_object_part_text_set(_EDJ(list_data->selInfoPop_layout), "elm.text", text);
1591 if (list_data->navi_it) {
1592 Evas_Object *button = elm_object_item_part_content_get(list_data->navi_it, "toolbar_button1");
1593 elm_object_disabled_set(button, EINA_FALSE);
1597 static void __setting_select_all_layout_mouse_down_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1599 SETTING_TRACE_BEGIN;
1600 retm_if(data == NULL, "data == NULL");
1601 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1603 list_data->select_all_checked = !list_data->select_all_checked;
1604 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1606 __setting_select_all_done(list_data);
1609 static void __setting_select_all_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
1611 SETTING_TRACE_BEGIN;
1612 retm_if(data == NULL, "data == NULL");
1613 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1615 list_data->select_all_checked = elm_check_state_get(list_data->select_all_checkbox);
1616 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1617 __setting_select_all_done(data);
1621 * The API to create done-list.
1623 * @param[in] list_data
1624 * @return a done-list
1626 Evas_Object *setting_create_done_list(Setting_Done_List_Data *list_data)
1628 SETTING_TRACE_BEGIN;
1629 retvm_if(list_data == NULL, NULL, "list_data == NULL");
1630 Evas_Object *sub_layout = elm_layout_add(list_data->win_main);
1631 elm_layout_file_set(sub_layout, SETTING_THEME_EDJ_NAME, "search_layout");
1632 evas_object_size_hint_weight_set(sub_layout, EVAS_HINT_EXPAND, 0.0);
1633 evas_object_show(sub_layout);
1635 setting_create_Gendial_itc("1text.1icon.3", &(list_data->itc_1text_1icon));
1637 Evas_Object *select_all_layout = elm_layout_add(sub_layout);
1638 retvm_if(select_all_layout == NULL, NULL, "select_all_layout == NULL");
1639 elm_layout_theme_set(select_all_layout, "genlist", "item", "select_all/default"); //select_all/default
1640 evas_object_size_hint_weight_set(select_all_layout, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
1641 evas_object_size_hint_align_set(select_all_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
1642 evas_object_event_callback_add(select_all_layout, EVAS_CALLBACK_MOUSE_DOWN, __setting_select_all_layout_mouse_down_cb, list_data);
1644 Eina_Bool select_all_checked = list_data->select_all_checked;
1645 Evas_Object *select_all_checkbox = elm_check_add(select_all_layout);
1646 elm_check_state_pointer_set(select_all_checkbox, &select_all_checked);
1647 evas_object_smart_callback_add(select_all_checkbox, "changed", __setting_select_all_check_changed_cb, list_data);
1648 evas_object_propagate_events_set(select_all_checkbox, EINA_FALSE);
1649 elm_object_part_content_set(select_all_layout, "elm.icon", select_all_checkbox);
1651 list_data->select_all_checkbox = select_all_checkbox;
1652 elm_object_part_text_set(select_all_layout, "elm.text", _(KeyStr_Select_All));
1654 Evas_Object *scroller = elm_genlist_add(list_data->win_main);
1655 retvm_if(scroller == NULL, NULL, "scroller == NULL");
1656 elm_genlist_clear(scroller); /* first to clear list */
1658 elm_object_part_content_set(sub_layout, "search_list", scroller);
1659 elm_object_part_content_set(sub_layout, "search_bar", select_all_layout);
1662 for (; index < list_data->cur_item_num; index++) {
1663 list_data->chk_items[index].data_GenItem =
1664 setting_create_Gendial_field_def(scroller,
1665 &(list_data->itc_1text_1icon),
1666 setting_done_list_Gendial_mouse_up_cb,
1668 SWALLOW_Type_1CHECK, NULL,
1670 list_data->chk_items
1671 [index].item_name, NULL,
1672 setting_done_list_Gendial_chk_btn_cb);
1673 if (list_data->chk_items[index].data_GenItem) {
1674 list_data->chk_items[index].data_GenItem->userdata = list_data;
1676 SETTING_TRACE_ERROR("list_data->chk_items[index].data_GenItem is NULL");
1685 * To disable a specialized genlist item
1689 void setting_disable_genlist_item(Elm_Object_Item *item)
1692 elm_object_item_disabled_set(item, EINA_TRUE); /* make it be dim displayed */
1697 * To enable a specialized genlist item
1701 void setting_enable_genlist_item(Elm_Object_Item *item)
1704 elm_object_item_disabled_set(item, EINA_FALSE); /* make it be normally displayed */