2 * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @brief: Make a essential object for the this app, like window, conformant and layout
19 * @param[ad]: The object has informations for managing this app
21 void view_create(appdata_s *ad)
24 dlog_print(DLOG_ERROR, LOG_TAG, "appdata is NULL.");
29 ad->win = view_create_win();
30 if (ad->win == NULL) {
31 dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a window.");
35 /* Create conformant */
36 ad->conform = view_create_conformant_without_indicator(ad->win);
37 if (ad->conform == NULL) {
38 dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a conformant");
42 /* Show window after main view is set up */
43 evas_object_show(ad->win);
47 * @brief: Make a basic window named package
48 * @param[package]: Name of the window
50 Evas_Object *view_create_win(const char *pkg_name)
52 Evas_Object *win = NULL;
55 /* Create and initialize elm_win.
56 elm_win is mandatory to manipulate window. */
58 win = elm_win_util_standard_add(pkg_name, pkg_name);
59 elm_win_conformant_set(win, EINA_TRUE);
60 elm_win_autodel_set(win, EINA_TRUE);
62 if (elm_win_wm_rotation_supported_get(win)) {
63 int rots[4] = { 0, 90, 180, 270 };
64 elm_win_wm_rotation_available_rotations_set(win, (const int *)(&rots), 4);
67 evas_object_smart_callback_add(win, "delete,request", _win_delete_request_cb, NULL);
73 * @brief: Make a conformant without indicator for wearable app
74 * @param[win]: The object to which you want to set this conformant
75 * Confromant is mandatory for base GUI to have proper size
77 Evas_Object *view_create_conformant_without_indicator(Evas_Object *win)
80 * Create and initialize elm_conformant.
81 * elm_conformant is mandatory for base GUI to have proper size
82 * when indicator or virtual keypad is visible.
84 Evas_Object *conform = NULL;
87 dlog_print(DLOG_ERROR, LOG_TAG, "window is NULL.");
91 conform = elm_conformant_add(win);
92 evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
93 elm_win_resize_object_add(win, conform);
95 evas_object_show(conform);
101 * @brief: Make a layout to target parent object with edje file
102 * @param[parent]: The object to which you want to add this layout
103 * @param[file_name]: File path of EDJ
104 * @param[group_name]: Name of group in EDJ you want to set to
105 * @param[Evas_Object_Event_Cb]: File path of EDJ
106 * @param[user_data]: The user data to be passed to the callback functions
108 Evas_Object *view_create_layout(Evas_Object *parent, const char *edj_path, const char *group_name, Eext_Event_Cb cb_function, void *user_data)
110 Evas_Object *layout = NULL;
112 if (parent == NULL) {
113 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
117 /* Create layout by EDC(edje file) */
118 layout = elm_layout_add(parent);
119 elm_layout_file_set(layout, edj_path, group_name);
121 /* Layout size setting */
122 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
125 eext_object_event_callback_add(layout, EEXT_CALLBACK_BACK, cb_function, user_data);
127 evas_object_show(layout);
133 * @brief: Make and set a layout to conformant
134 * @param[parent]: Target conformant object
135 * @param[file_name]: File path of EDJ used
136 * @param[group_name]: Group name in EDJ you want to set to layout
137 * @param[user_data]: The user data to be passed to the callback functions
139 Evas_Object *view_create_layout_for_conformant(Evas_Object *parent, Evas_Object *conformant, const char *file_name, const char *group_name, void *user_data)
141 Evas_Object *layout = NULL;
143 if (parent == NULL) {
144 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
148 /* Create layout for conformant */
149 layout = view_create_layout(parent, file_name, group_name, NULL, user_data);
150 if (layout == NULL) {
151 dlog_print(DLOG_ERROR, LOG_TAG, "layout is NULL.");
155 elm_object_content_set(conformant, layout);
161 * @brief: Make a layout with theme.
162 * @param[parent]: Object to which you want to add this layout
163 * @param[class]: The class of the group
164 * @param[group_name]: Group name in EDJ you want to set to layout
165 * @param[style]: The style to use
167 Evas_Object *view_create_layout_by_theme(Evas_Object *parent, const char *classname, const char *group, const char *style)
171 * Create and initialize elm_layout.
172 * view_create_layout_by_theme() is used to create layout by using premade edje file.
174 Evas_Object *layout = NULL;
176 if (parent == NULL) {
177 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
181 layout = elm_layout_add(parent);
182 elm_layout_theme_set(layout, classname, group, style);
183 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
185 evas_object_show(layout);
191 * @brief: Make and set a layout to the part
192 * @param[parent]: Object to which you want to set this layout
193 * @param[file_name]: File path of EDJ used
194 * @param[group_name]: Group name in EDJ you want to set to layout
195 * @param[part]: Part name to which you want to set this layout
197 Evas_Object *view_create_layout_for_part(Evas_Object *parent, char *part, char *file_name, char *group_name)
199 Evas_Object *layout = NULL;
201 if (parent == NULL) {
202 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
206 layout = elm_layout_add(parent);
207 elm_layout_file_set(layout, file_name, group_name);
208 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
210 evas_object_show(layout);
212 elm_object_part_content_set(parent, part, layout);
218 * @brief: Destroy window and free important data to finish this app
219 * @param[ad]: The object has informations for managing this app
221 void view_destroy(void *user_data)
223 appdata_s *ad = NULL;
227 dlog_print(DLOG_ERROR, LOG_TAG, "failed to destroy data.");
231 evas_object_del(ad->win);
235 * @brief: Destroy given layout
236 * @param[layout]: The layout you want to destroy
238 void view_destroy_layout(Evas_Object *layout)
240 evas_object_del(layout);
244 * @brief: Set image to given part
245 * @param[parent]: object has part to which you want to set this image
246 * @param[part]: part name to which you want to set this image
247 * @param[image_path]: path of image file
249 void view_set_image(Evas_Object *parent, const char *part, const char *image_path)
251 Evas_Object *image = NULL;
253 if (parent == NULL) {
254 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
258 image = elm_object_part_content_get(parent, part);
260 image = elm_image_add(parent);
262 dlog_print(DLOG_ERROR, LOG_TAG, "failed to create an image object.");
267 if (EINA_FALSE == elm_image_file_set(image, image_path, NULL)) {
268 dlog_print(DLOG_ERROR, LOG_TAG, "failed to set image.");
273 elm_object_part_content_set(parent, part, image);
275 elm_object_content_set(parent, image);
278 evas_object_show(image);
284 * @brief: Set text to the part
285 * @param[parent]: Object has part to which you want to set text
286 * @param[part]: Part name to which you want to set text
287 * @param[text]: text you want to set to the part
289 void view_set_text(Evas_Object *parent, const char *part, const char *text)
291 if (parent == NULL) {
292 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
296 /* Set text of target part object */
297 elm_object_part_text_set(parent, part, text);
301 * @brief: Set color of the part
302 * @param[parent]: Object has part to which you want to set color
303 * @param[part]: Name of part to which you want to set color
304 * @param[r]: R of RGBA you want to set to the part
305 * @param[g]: G of RGBA you want to set to the part
306 * @param[b]: B of RGBA you want to set to the part
307 * @param[a]: A of RGBA you want to set to the part
309 void view_set_color(Evas_Object *parent, const char *part, int r, int g, int b, int a)
311 Evas_Object *obj = NULL;
313 if (parent == NULL) {
314 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
318 obj = elm_object_part_content_get(parent, part);
320 dlog_print(DLOG_ERROR, LOG_TAG, "failed to get parent.");
324 /* Set color of target part object */
325 evas_object_color_set(obj, r, g, b, a);
329 * @brief: Make a naviframe and set to parent
330 * @param[parent]: Object to which you want to set naviframe
331 * @Add callback function will be operated when back key is pressed
333 Evas_Object *view_create_naviframe(Evas_Object *parent)
336 * Create and initialize elm_naviframe.
337 * Naviframe stands for navigation frame.
338 * elm_naviframe is a views manager for applications.
340 Evas_Object *nf = NULL;
342 if (parent == NULL) {
343 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
347 nf = elm_naviframe_add(parent);
349 elm_object_part_content_set(parent, "elm.swallow.content", nf);
350 eext_object_event_callback_add(nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
351 eext_object_event_callback_add(nf, EEXT_CALLBACK_MORE, eext_naviframe_more_cb, NULL);
353 evas_object_show(nf);
360 * @brief: Push item to naviframe
361 * @param[nf]: naviframe
362 * @param[item]: object will be added to naviframe
363 * @param[_pop_cb]: function will be operated when this item is poped from naviframe
364 * @param[cb_data]: data needed to operate '_pop_cb' function
365 * Naviframe make changing of view is easy and effectively
367 Elm_Object_Item* view_push_item_to_naviframe(Evas_Object *nf, Evas_Object *item, Elm_Naviframe_Item_Pop_Cb _pop_cb, void *cb_data)
369 Elm_Object_Item* nf_it = NULL;
372 dlog_print(DLOG_ERROR, LOG_TAG, "naviframe is NULL.");
377 dlog_print(DLOG_ERROR, LOG_TAG, "item is NULL.");
381 nf_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, item, "empty");
384 elm_naviframe_item_pop_cb_set(nf_it, _pop_cb, cb_data);
390 void view_set_more_button(Evas_Object *parent, const char *part)
392 Evas_Object *more_btn = NULL;
394 if (pirent == NULL) {
395 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
399 more_btn = eext_more_option_add(parent);
400 if (more_btn == NULL) {
401 dlog_print(DLOG_ERROR, LOG_TAG, "more option is NULL.");
405 /* Add smart callback */
406 evas_object_smart_callback_add(more_btn, "more,option,opened", _more_option_opened, NULL);
407 evas_object_smart_callback_add(more_btn, "more,option,closed", _more_option_closed, NULL);
408 evas_object_smart_callback_add(more_btn, "item,selected", _item_selected, NULL);
410 elm_object_part_content_set(parent, part, more_btn);
414 * @brief: Make and set button.
415 * @param[parent]: object to which you want to set the button
416 * @param[style]: style of the button
417 * @param[text]: text will be written on the button
418 * @param[image_path]: path of image file will be used as button icon
419 * @param[part]: part name in EDJ to which you want to set the button
420 * @param[down_cb]: function will be operated when the button is pressed
421 * @param[up_cb]: function will be operated when the button is released
422 * @param[clicked_cb]: function will be operated when the button is clicked
423 * @param[data]: data needed in this function
425 void view_set_button(Evas_Object *parent, const char *part, const char *style, const char *image_path, const char *text,
426 Evas_Object_Event_Cb down_cb, Evas_Object_Event_Cb up_cb, Evas_Smart_Cb clicked_cb, void *data)
428 Evas_Object *btn = NULL;
430 if (parent == NULL) {
431 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
435 btn = elm_button_add(parent);
437 dlog_print(DLOG_ERROR, LOG_TAG, "failed to create button.");
442 elm_object_style_set(btn, style);
444 evas_object_size_hint_weight_set(btn ,EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
445 elm_object_part_content_set(parent, part, btn);
448 elm_object_text_set(btn, text);
451 view_set_image(btn, NULL, image_path);
454 evas_object_event_callback_add(btn , EVAS_CALLBACK_MOUSE_DOWN, down_cb, parent);
456 evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_UP, up_cb, parent);
458 evas_object_smart_callback_add(btn, "clicked", clicked_cb, data);
460 evas_object_show(btn);
464 * @brief: Add a more button item
465 * @param[parent]: object that contains more button
466 * @param[main_txt]: text will be written in the middle of the selector
467 * @param[sub_txt] Text will be written under the main_txt
468 * @param[img_path]: path of image file will be used as more button item icon
469 * @param[clicked_cb]: function will be operated when the more button item is clicked
470 * @param[user_data]: data needed in this function
472 void view_add_more_button_item(Evas_Object *parent, const char *part, const char *main_txt, const char *sub_txt, const char *img_path, Evas_Smart_Cb clicked_cb, void *user_data)
474 Evas_Object *img = NULL;
475 Evas_Object *more_btn = NULL;
476 char full_path[PATH_MAX] = { 0, };
478 if (parent == NULL) {
479 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
483 more_btn = elm_object_part_content_get(parent, part);
484 if (more_btn == NULL) {
488 /* Create the new item */
489 Eext_Object_Item *item = eext_more_option_item_append(more_btn);
491 /* Set the text in item text part */
492 eext_more_option_item_part_text_set(item, "selector,main_text", main_txt);
493 eext_more_option_item_part_text_set(item, "selector,sub_text", sub_txt);
495 img = elm_image_add(more_btn);
496 _get_resource(img_path, full_path, sizeof(full_path));
497 elm_image_file_set(img, full_path, NULL);
499 /* Set the content in item content part */
500 eext_more_option_item_part_content_set(item, "item,icon", img);
502 evas_object_smart_callback_add(more_btn, "item,clicked", clicked_cb, user_data);
506 * @brief: Make a Entry Object to target window
507 * @param[parent]: Object to which you want to set Entry
508 * @param[part]: Part of the layout which you want to locate Entry
509 * @param[data]: The user data to be passed to the callback function
510 * @Add callback function will be operated when mouse clicked event is triggered
512 Evas_Object *view_set_entry(Evas_Object *parent, const char *part, void (_clicked_cb)(void *data, Evas_Object *obj, void *event_info), void *data)
514 Evas_Object *entry = NULL;
516 if (parent == NULL) {
517 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
521 /* Add Entry object to parent */
522 entry = elm_entry_add(parent);
524 dlog_print(DLOG_ERROR, LOG_TAG, "failed to add a entry");
528 /* Set Entry size option */
529 evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
531 /* Set Entry option for display and functionalities */
532 elm_entry_single_line_set(entry, EINA_TRUE);
533 elm_entry_scrollable_set(entry, EINA_TRUE);
534 elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
535 elm_entry_editable_set(entry, EINA_FALSE);
536 elm_entry_context_menu_disabled_set(entry, EINA_TRUE);
537 elm_entry_cursor_handler_disabled_set(entry, EINA_TRUE);
538 elm_entry_select_allow_set(entry, EINA_FALSE);
540 /* Set Entry text style using predefined style description */
541 elm_entry_text_style_user_push(entry, DIAL_TEXT_STYLE_NORMAL);
543 elm_object_part_content_set(parent, part, entry);
545 /* Set callback for event about Entry */
547 evas_object_smart_callback_add(entry, "clicked", _clicked_cb, data);
554 * @brief: make genlist for circular shape.
555 * @param[parent]: object to which you want to set genlist
556 * @param[circle_surface]: object render a connected circle object
558 Evas_Object *view_create_circle_genlist(Evas_Object *parent, Eext_Circle_Surface *circle_surface)
560 Evas_Object *genlist = NULL;
561 Evas_Object *circle_genlist = NULL;
563 if (parent == NULL) {
564 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
568 if (circle_surface == NULL) {
569 dlog_print(DLOG_ERROR, LOG_TAG, "circle surface is NULL.");
573 genlist = elm_genlist_add(parent);
574 /* this make selected list item is shown compressed */
575 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
576 evas_object_smart_callback_add(genlist, "selected", _gl_selected_cb, NULL);
578 /* this make genlist style circular */
579 circle_genlist = eext_circle_object_genlist_add(genlist, circle_surface);
580 eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
581 eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
583 evas_object_show(genlist);
589 * @brief: Add item to genlist.
590 * @param[genlist]: genlist
591 * @param[style]: style of item determine how to show this item, such as "1text", "1text1icon" and so on
592 * @param[data]: item data that use item's callback function
593 * @param[_clicked_cb]: function will be operated when the item is clicked
594 * @param[cb_data]: data needed in '_clicked_cb' function
595 * This make item's class and add item to genlist.
597 Elm_Object_Item *view_append_item_to_genlist(Evas_Object *genlist, const char *style,
598 const void *data, Evas_Smart_Cb _clicked_cb, const void *cb_data)
600 Elm_Genlist_Item_Class *item_class;
601 Elm_Object_Item *item;
603 if (genlist == NULL) {
604 dlog_print(DLOG_ERROR, LOG_TAG, "genlist is NULL.");
609 dlog_print(DLOG_ERROR, LOG_TAG, "item style is NULL.");
613 item_class = _set_genlist_item_class(style);
615 item = elm_genlist_item_append(genlist, item_class, data, NULL, ELM_GENLIST_ITEM_NONE, _clicked_cb, cb_data);
617 elm_genlist_item_class_free(item_class);
623 * @brief: Find item from genlist.
624 * @param[genlist]: genlist
625 * @param[val]: value determine which of the itmes has to remove
627 Elm_Object_Item *view_find_item_from_genlist(Evas_Object *genlist, const char *val)
631 Elm_Object_Item *item = NULL;
632 struct genlist_data *gendata = NULL;
635 dlog_print(DLOG_ERROR, LOG_TAG, "genlist is NULL.");
639 item_count = elm_genlist_items_count(genlist);
642 * The fist item and the last item are "padding".
644 for(i = 1; i < item_count-1; i++) {
645 item = elm_genlist_nth_item_get(genlist, i);
646 gendata = elm_object_item_data_get(item);
648 if (gendata->alarm_id == atoi(val)) {
658 * @brief: Remove item.
659 * @param[item]: item from genlist
661 void view_delete_item(Elm_Object_Item *item)
663 elm_object_item_del(item);
667 * @brief: Make popup with theme.
668 * @param[popup_style]: style of the popup's layout
669 * @param[data]: data needed in this function
671 void view_create_text_popup(Evas_Object *parent, double timeout, const char *text)
673 Evas_Object *popup = NULL;
674 Evas_Object *popup_layout = NULL;
676 if (parent == NULL) {
677 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
681 popup = elm_popup_add(parent);
682 elm_object_style_set(popup, "circle");
683 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
685 eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _popup_hide_cb, NULL);
687 * Delete popup object in _popup_hide_finished_cb(), when the "dismissed" signal will be called.
689 evas_object_smart_callback_add(popup, "dismissed", _popup_hide_finished_cb, NULL);
691 popup_layout = elm_layout_add(popup);
692 elm_layout_theme_set(popup_layout, "layout", "popup", "content/circle");
694 elm_object_content_set(popup, popup_layout);
696 elm_popup_timeout_set(popup, timeout);
699 view_set_text(popup_layout, "elm.text", text);
701 evas_object_show(popup);
704 void view_set_content_to_part(Evas_Object *layout, const char *part, Evas_Object *content)
706 elm_object_part_content_set(layout, part, content);
709 void view_send_signal_to_edje(Evas_Object *layout, const char *signal, const char *source)
711 elm_object_signal_emit(layout, signal, source);
714 void view_set_customized_event_callback(Evas_Object *item, char *signal, char *source, void (*signal_cb)(void *data, Evas_Object *obj, const char *emission, const char *source), void *user_data)
716 elm_object_signal_callback_add(item, signal, source, signal_cb, user_data);
720 * @brief: Register roatry event callback function.
721 * @param[obj]: object that will receive rotary event
722 * @param[rotary_cb]: function will be operated when rotary event happens
723 * @param[user_data]: data needed in this function
725 void view_set_rotary_event_callback(Evas_Object *obj, Eext_Rotary_Event_Cb rotary_cb, void *user_data)
728 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
732 eext_rotary_object_event_activated_set(obj, EINA_TRUE);
733 eext_rotary_object_event_callback_add(obj, rotary_cb, user_data);
737 * @brief: Make a label and set label options.
738 * @param[parent]: The object to which you want to add this label
740 Evas_Object *view_create_label(Evas_Object *parent)
742 Evas_Object *label = elm_label_add(parent);
744 if (parent == NULL) {
745 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
749 elm_object_style_set(label, "slide_short");
750 elm_label_wrap_width_set(label, 230);
751 elm_label_ellipsis_set(label, EINA_TRUE);
752 elm_label_slide_duration_set(label, 2);
753 elm_label_slide_mode_set(label, ELM_LABEL_SLIDE_MODE_NONE);
754 elm_label_slide_go(label);
755 evas_object_show(label);
761 * @brief: Set a text to label object
762 * @param[parent]: Object has part to which you want to set text
763 * @param[part]: Part name to which you want to set text
764 * @param[text]: text you want to set to the part
766 void view_set_label_text(Evas_Object *parent, const char *part, const char *text)
768 Evas_Object *label = NULL;
769 char *markup_text = NULL;
770 char buf[256] = { 0, };
772 if (parent == NULL) {
773 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
777 markup_text = elm_entry_utf8_to_markup(text);
778 snprintf(buf, sizeof(buf), "%s%s%s", LABEL_STYLE_START, markup_text, LABEL_STYLE_END);
781 label = elm_object_part_content_get(parent, part);
783 dlog_print(DLOG_ERROR, LOG_TAG, "label is NULL.");
787 elm_object_text_set(label, buf);
791 * @brief: Set a label to given part
792 * @param[parent]: object has part to which you want to set this label
793 * @param[part]: part name to which you want to set this label
795 void view_set_label(Evas_Object *parent, const char *part)
797 Evas_Object *label = NULL;
799 if (parent == NULL) {
800 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
804 label = view_create_label(parent);
806 dlog_print(DLOG_ERROR, LOG_TAG, "label is NULL.");
810 elm_object_part_content_set(parent, "sw.focus.txt", label);
814 * @brief: Create a progressbar
815 * @param[parent]: object has part to which you want to set this progressbar
817 Evas_Object *view_create_progressbar(Evas_Object *parent)
819 Evas_Object *progressbar = NULL;
821 if (parent == NULL) {
822 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
826 progressbar = eext_circle_object_progressbar_add(parent, NULL);
828 eext_circle_object_value_min_max_set(progressbar, 0.0, 100.0);
829 eext_circle_object_radius_set(progressbar, 53);
830 eext_circle_object_line_width_set(progressbar, 5);
831 evas_object_show(progressbar);
837 * @brief: Set a progressbar to given part
838 * @param[parent]: object has part to which you want to set this progressbar
839 * @param[part]: part name to which you want to set this progressbar
841 void view_set_progressbar(Evas_Object *parent, const char *part)
843 Evas_Object *progressbar = NULL;
845 if (parent == NULL) {
846 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
850 progressbar = view_create_progressbar(parent);
851 if (progressbar == NULL) {
852 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
856 elm_object_part_content_set(parent, part, progressbar);
860 * @brief: Set value to a progressbar
861 * @param[parent]: object has part to which you want to set
862 * @param[part]: part name to which you want to set
863 * @param[val]: value to which you want to set
865 void view_set_progressbar_val(Evas_Object *parent, const char *part, int val)
867 Evas_Object *progressbar = NULL;
869 if (parent == NULL) {
870 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
875 dlog_print(DLOG_ERROR, LOG_TAG, "part is NULL.");
879 progressbar = elm_object_part_content_get(parent, part);
880 if (progressbar == NULL) {
881 dlog_print(DLOG_ERROR, LOG_TAG, "prgressbar is NULL.");
885 eext_circle_object_value_set(progressbar, val);
889 * @brief: Make a checkbox
890 * @param[parent]: The object to which you want to add this checkbox
892 Evas_Object *view_create_checkbox(Evas_Object *parent)
896 if (parent == NULL) {
897 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
901 check = elm_check_add(parent);
902 elm_check_state_set(check, EINA_FALSE);
903 evas_object_smart_callback_add(check, "changed", _icon_clicked_cb, NULL);
904 evas_object_show(check);
910 * @brief: Make no voice memo view
911 * @param[parent]: naviframe
912 * @param[title]: titile of this view
913 * @param[detail]: detail text of this view
914 * @param[image_file]: image file name will be used in this view
915 * This function make a view consists of one title, one center image and one detail text at the bottom
917 Evas_Object *view_create_layout_no_content(Evas_Object *parent, char *title, char *detail, char *image_file)
919 Evas_Object *layout = NULL;
923 if (parent == NULL) {
924 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
928 layout = elm_layout_add(parent);
929 /* this make you can use layout consists of one title, one image and one detail text */
930 elm_layout_theme_set(layout, "layout", "nocontents", "default");
931 evas_object_size_hint_weight_set (layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
932 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
935 img = elm_image_add(parent);
936 elm_image_file_set(img, image_file, NULL);
937 elm_object_part_content_set(layout, "elm.swallow.icon", img);
938 evas_object_show(img);
942 char detail_text[256] = {0, };
944 /* Customize font style bellow */
945 snprintf(detail_text, sizeof(detail_text), "<font=TIZEN:style=Medium align=center color=#FFFFFF><font_size=28>%s</font_size></font>", detail);
946 elm_object_part_text_set(layout, "elm.text", detail_text);
949 char title_text[256] = {0, };
951 snprintf(title_text, sizeof(title_text), "<font=TIZEN:style=Medium align=center color=#12B4FF><font_size=28>%s</font_size></font>", title);
952 elm_object_part_text_set(layout, "elm.text.title", title_text);
955 /* if this signal is not sent, title text will be disappear */
956 elm_object_signal_emit(layout, "elm,state,title,enable", "elm");
957 /* push this no voice memo view to naviframe to show */
958 it = elm_naviframe_item_push(parent, "Title Enabled", NULL, NULL, layout, NULL);
959 /* if this is EINA_TRUE, you can see Title of naviframe on the top of the screen */
960 elm_naviframe_item_title_enabled_set(it, EINA_FALSE, EINA_FALSE);
966 * @brief: Set datetime to the part.
967 * @param[parent]: object to which you want to set datetime
968 * @param[circle_surface]: object render a connected circle object
969 * @param[part]: part name to which you want to set this datetime
970 * @param[style]: style of the datetime
972 Evas_Object *view_create_datetime(Evas_Object *parent, Eext_Circle_Surface *circle_surface, const char *style)
974 Evas_Object *datetime = NULL;
975 Evas_Object *circle_datetime = NULL;
977 if (parent == NULL) {
978 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
982 if (circle_surface == NULL) {
983 dlog_print(DLOG_ERROR, LOG_TAG, "failed to get circle_surface.");
987 datetime = elm_datetime_add(parent);
988 circle_datetime = eext_circle_object_datetime_add(datetime, circle_surface);
990 eext_rotary_object_event_activated_set(datetime, EINA_TRUE);
991 elm_datetime_format_set(datetime, FORMAT);
993 elm_object_style_set(datetime, style);