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.
17 static struct view_info {
27 * @brief: Create Essential Object window, conformant and layout
29 void view_create(void)
32 s_info.win = view_create_win(PACKAGE);
33 if (s_info.win == NULL) {
34 dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a window.");
38 /* Create conformant */
39 s_info.conform = view_create_conformant_without_indicator(s_info.win);
40 if (s_info.conform == NULL) {
41 dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a conformant");
45 /* Show window after main view is set up */
46 evas_object_show(s_info.win);
50 * @brief: Make a basic window named package
51 * @param[pkg_name]: Name of the window
53 Evas_Object *view_create_win(const char *pkg_name)
55 Evas_Object *win = NULL;
58 /* Create and initialize elm_win.
59 elm_win is mandatory to manipulate window. */
61 win = elm_win_util_standard_add(pkg_name, pkg_name);
62 elm_win_conformant_set(win, EINA_TRUE);
63 elm_win_autodel_set(win, EINA_TRUE);
65 /* Rotation setting */
66 if (elm_win_wm_rotation_supported_get(win)) {
67 int rots[4] = { 0, 90, 180, 270 };
68 elm_win_wm_rotation_available_rotations_set(win, (const int *)(&rots), 4);
71 evas_object_smart_callback_add(win, "delete,request", _win_delete_request_cb, NULL);
77 * @brief: Make a conformant without indicator for wearable app
78 * @param[win]: The object to which you want to set this conformant
79 * Conformant is mandatory for base GUI to have proper size
81 Evas_Object *view_create_conformant_without_indicator(Evas_Object *win)
84 * Create and initialize elm_conformant.
85 * elm_conformant is mandatory for base GUI to have proper size
86 * when indicator or virtual keypad is visible.
88 Evas_Object *conform = NULL;
91 dlog_print(DLOG_ERROR, LOG_TAG, "window is NULL.");
95 conform = elm_conformant_add(win);
96 evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
97 elm_win_resize_object_add(win, conform);
99 evas_object_show(conform);
105 * @brief: Make a layout to target parent object with edje file
106 * @param[parent]: The object to which you want to add this layout
107 * @param[file_name]: File path of EDJ
108 * @param[group_name]: Name of group in EDJ you want to set to
109 * @param[Evas_Object_Event_Cb]: File path of EDJ
110 * @param[user_data]: The user data to be passed to the callback functions
112 Evas_Object *view_create_layout(Evas_Object *parent, const char *edj_path, const char *group_name, Eext_Event_Cb cb_function, void *user_data)
114 Evas_Object *layout = NULL;
116 if (parent == NULL) {
117 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
121 /* Create layout by EDC(edje file) */
122 layout = elm_layout_add(parent);
123 elm_layout_file_set(layout, edj_path, group_name);
125 /* Layout size setting */
126 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
129 eext_object_event_callback_add(layout, EEXT_CALLBACK_BACK, cb_function, user_data);
131 evas_object_show(layout);
137 * @brief: Make and set a layout to conformant
138 * @param[parent]: Target conformant object
139 * @param[file_name]: File path of EDJ used
140 * @param[group_name]: Group name in EDJ you want to set to layout
141 * @param[cb_function]: Callback for back event handling
142 * @param[user_data]: The user data to be passed to the callback functions
144 Evas_Object *view_create_layout_for_conformant(Evas_Object *parent, const char *file_name, const char *group_name, Eext_Event_Cb cb_function, void *user_data)
146 Evas_Object *layout = NULL;
148 if (parent == NULL) {
149 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
153 /* Create layout for conformant */
155 layout = view_create_layout_by_theme(parent, "layout", "application", "default");
157 layout = view_create_layout(parent, file_name, group_name, cb_function, user_data);
160 if (layout == NULL) {
161 dlog_print(DLOG_ERROR, LOG_TAG, "layout is NULL.");
165 elm_object_content_set(parent, layout);
171 * @brief: Make a layout with theme.
172 * @param[parent]: Object to which you want to add this layout
173 * @param[class]: The class of the group
174 * @param[group_name]: Group name in EDJ you want to set to layout
175 * @param[style]: The style to use
177 Evas_Object *view_create_layout_by_theme(Evas_Object *parent, const char *classname, const char *group, const char *style)
181 * Create and initialize elm_layout.
182 * view_create_layout_by_theme() is used to create layout by using premade edje file.
184 Evas_Object *layout = NULL;
186 if (parent == NULL) {
187 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
191 layout = elm_layout_add(parent);
192 elm_layout_theme_set(layout, classname, group, style);
193 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
195 evas_object_show(layout);
201 * @brief: Make and set a layout to the part
202 * @param[parent]: Object to which you want to set this layout
203 * @param[file_name]: File path of EDJ used
204 * @param[group_name]: Group name in EDJ you want to set to layout
205 * @param[part]: Part name to which you want to set this layout
207 Evas_Object *view_create_layout_for_part(Evas_Object *parent, char *part, char *file_name, char *group_name)
209 Evas_Object *layout = NULL;
211 if (parent == NULL) {
212 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
216 layout = elm_layout_add(parent);
217 elm_layout_file_set(layout, file_name, group_name);
218 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
220 evas_object_show(layout);
222 elm_object_part_content_set(parent, part, layout);
228 * @brief: Destroy window and free important data to finish this application
229 * @param[user_data]: Structure has informations for managing this application
231 void view_destroy(void *user_data)
233 if (s_info.win == NULL) {
237 evas_object_del(s_info.win);
241 * @brief: Destroy given layout
242 * @param[layout]: The layout you want to destroy
244 void view_destroy_layout(Evas_Object *layout)
246 evas_object_del(layout);
250 * @brief: Set image to given part
251 * @param[parent]: object has part to which you want to set this image
252 * @param[part]: part name to which you want to set this image
253 * @param[image_path]: path of image file
255 void view_set_image(Evas_Object *parent, const char *part, const char *image_path)
257 Evas_Object *image = NULL;
259 if (parent == NULL) {
260 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
264 image = elm_object_part_content_get(parent, part);
266 image = elm_image_add(parent);
268 dlog_print(DLOG_ERROR, LOG_TAG, "failed to create an image object.");
273 if (EINA_FALSE == elm_image_file_set(image, image_path, NULL)) {
274 dlog_print(DLOG_ERROR, LOG_TAG, "failed to set image.");
279 elm_object_part_content_set(parent, part, image);
281 elm_object_content_set(parent, image);
284 evas_object_show(image);
290 * @brief: Set text to the part
291 * @param[parent]: Object has part to which you want to set text
292 * @param[part]: Part name to which you want to set text
293 * @param[text]: text you want to set to the part
295 void view_set_text(Evas_Object *parent, const char *part, const char *text)
297 if (parent == NULL) {
298 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
302 /* Set text of target part object */
303 elm_object_part_text_set(parent, part, text);
307 * @brief: Set color of the part
308 * @param[parent]: Object has part to which you want to set color
309 * @param[part]: Name of part to which you want to set color
310 * @param[r]: R of RGBA you want to set to the part
311 * @param[g]: G of RGBA you want to set to the part
312 * @param[b]: B of RGBA you want to set to the part
313 * @param[a]: A of RGBA you want to set to the part
315 void view_set_color(Evas_Object *parent, const char *part, int r, int g, int b, int a)
317 Evas_Object *obj = NULL;
319 if (parent == NULL) {
320 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
324 obj = elm_object_part_content_get(parent, part);
326 dlog_print(DLOG_ERROR, LOG_TAG, "failed to get parent.");
330 /* Set color of target part object */
331 evas_object_color_set(obj, r, g, b, a);
335 * @brief: Set the color of circle line and font in a given circle object
336 * @param[parent]: Object has part to which you want to set color
337 * @param[part]: Name of part to which you want to set color
338 * @param[r] The red component of the given color
339 * @param[g] The green component of the given color
340 * @param[b] The blue component of the given color
341 * @param[a] The alpha component of the given color
343 void view_set_color_of_circle_object(Evas_Object *parent, const char *part, int r, int g, int b, int a)
345 Evas_Object *obj = NULL;
347 if (parent == NULL) {
348 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
352 obj = elm_object_part_content_get(parent, part);
354 dlog_print(DLOG_ERROR, LOG_TAG, "failed to get parent.");
358 /* Set color of target part object */
359 eext_circle_object_color_set(obj, r, g, b, a);
363 * @brief: Make a naviframe and set to parent
364 * @param[parent]: Object to which you want to set naviframe
365 * @Add callback function will be operated when back key is pressed
367 Evas_Object *view_create_naviframe(Evas_Object *parent)
370 * Create and initialize elm_naviframe.
371 * Naviframe stands for navigation frame.
372 * elm_naviframe is a views manager for applications.
374 Evas_Object *nf = NULL;
376 if (parent == NULL) {
377 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
381 nf = elm_naviframe_add(parent);
383 elm_object_part_content_set(parent, "elm.swallow.content", nf);
384 eext_object_event_callback_add(nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
385 eext_object_event_callback_add(nf, EEXT_CALLBACK_MORE, eext_naviframe_more_cb, NULL);
387 evas_object_show(nf);
393 * @brief: Push item to naviframe
394 * @param[nf]: naviframe
395 * @param[item]: object will be added to naviframe
396 * @param[_pop_cb]: function will be operated when this item is popped from naviframe
397 * @param[cb_data]: data needed to operate '_pop_cb' function
398 * Naviframe make changing of view is easy and effectively
400 Elm_Object_Item* view_push_item_to_naviframe(Evas_Object *nf, Evas_Object *item, Elm_Naviframe_Item_Pop_Cb _pop_cb, void *cb_data)
402 Elm_Object_Item* nf_it = NULL;
405 dlog_print(DLOG_ERROR, LOG_TAG, "naviframe is NULL.");
410 dlog_print(DLOG_ERROR, LOG_TAG, "item is NULL.");
414 nf_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, item, "empty");
417 elm_naviframe_item_pop_cb_set(nf_it, _pop_cb, cb_data);
422 void view_set_more_button(Evas_Object *parent, const char *part)
424 Evas_Object *more_btn = NULL;
426 if (pirent == NULL) {
427 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
431 more_btn = eext_more_option_add(parent);
432 if (more_btn == NULL) {
433 dlog_print(DLOG_ERROR, LOG_TAG, "more option is NULL.");
437 /* Add smart callback */
438 evas_object_smart_callback_add(more_btn, "more,option,opened", _more_option_opened, NULL);
439 evas_object_smart_callback_add(more_btn, "more,option,closed", _more_option_closed, NULL);
440 evas_object_smart_callback_add(more_btn, "item,selected", _item_selected, NULL);
442 elm_object_part_content_set(parent, part, more_btn);
446 * @brief: Make and set button.
447 * @param[parent]: object to which you want to set the button
448 * @param[style]: style of the button
449 * @param[text]: text will be written on the button
450 * @param[image_path]: path of image file will be used as button icon
451 * @param[part]: part name in EDJ to which you want to set the button
452 * @param[down_cb]: function will be operated when the button is pressed
453 * @param[up_cb]: function will be operated when the button is released
454 * @param[clicked_cb]: function will be operated when the button is clicked
455 * @param[data]: data needed in this function
457 void view_set_button(Evas_Object *parent, const char *part, const char *style, const char *image_path, const char *text,
458 Evas_Object_Event_Cb down_cb, Evas_Object_Event_Cb up_cb, Evas_Smart_Cb clicked_cb, void *data)
460 Evas_Object *btn = NULL;
462 if (parent == NULL) {
463 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
467 btn = elm_button_add(parent);
469 dlog_print(DLOG_ERROR, LOG_TAG, "failed to create button.");
474 elm_object_style_set(btn, style);
476 evas_object_size_hint_weight_set(btn ,EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
477 elm_object_part_content_set(parent, part, btn);
480 elm_object_text_set(btn, text);
483 view_set_image(btn, NULL, image_path);
486 evas_object_event_callback_add(btn , EVAS_CALLBACK_MOUSE_DOWN, down_cb, data);
488 evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_UP, up_cb, data);
490 evas_object_smart_callback_add(btn, "clicked", clicked_cb, data);
492 evas_object_show(btn);
496 * @brief: Add a more button item
497 * @param[parent]: object that contains more button
498 * @param[main_txt]: text will be written in the middle of the selector
499 * @param[sub_txt] Text will be written under the main_txt
500 * @param[img_path]: path of image file will be used as more button item icon
501 * @param[clicked_cb]: function will be operated when the more button item is clicked
502 * @param[user_data]: data needed in this function
504 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)
506 Evas_Object *img = NULL;
507 Evas_Object *more_btn = NULL;
508 char full_path[PATH_MAX] = { 0, };
510 if (parent == NULL) {
511 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
515 more_btn = elm_object_part_content_get(parent, part);
516 if (more_btn == NULL) {
520 /* Create the new item */
521 Eext_Object_Item *item = eext_more_option_item_append(more_btn);
523 /* Set the text in item text part */
524 eext_more_option_item_part_text_set(item, "selector,main_text", main_txt);
525 eext_more_option_item_part_text_set(item, "selector,sub_text", sub_txt);
527 img = elm_image_add(more_btn);
528 _get_resource(img_path, full_path, sizeof(full_path));
529 elm_image_file_set(img, full_path, NULL);
531 /* Set the content in item content part */
532 eext_more_option_item_part_content_set(item, "item,icon", img);
534 evas_object_smart_callback_add(more_btn, "item,clicked", clicked_cb, user_data);
538 * @brief: Make a Entry Object to target window
539 * @param[parent]: Object to which you want to set Entry
540 * @param[part]: Part of the layout which you want to locate Entry
541 * @param[data]: The user data to be passed to the callback function
542 * @Add callback function will be operated when mouse clicked event is triggered
544 Evas_Object *view_set_entry(Evas_Object *parent, const char *part, void (*_clicked_cb)(void *data, Evas_Object *obj, void *event_info), void *data)
546 Evas_Object *entry = NULL;
548 if (parent == NULL) {
549 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
553 /* Add Entry object to parent */
554 entry = elm_entry_add(parent);
556 dlog_print(DLOG_ERROR, LOG_TAG, "failed to add a entry");
560 /* Set Entry size option */
561 evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
563 /* Set Entry option for display and functionalities */
564 elm_entry_single_line_set(entry, EINA_TRUE);
565 elm_entry_scrollable_set(entry, EINA_TRUE);
566 elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
567 elm_entry_editable_set(entry, EINA_FALSE);
568 elm_entry_context_menu_disabled_set(entry, EINA_TRUE);
569 elm_entry_cursor_handler_disabled_set(entry, EINA_TRUE);
570 elm_entry_select_allow_set(entry, EINA_FALSE);
572 /* Set Entry text style using predefined style description */
573 elm_entry_text_style_user_push(entry, DIAL_TEXT_STYLE_NORMAL);
575 elm_object_part_content_set(parent, part, entry);
577 /* Set callback for event about Entry */
579 evas_object_smart_callback_add(entry, "clicked", _clicked_cb, data);
586 * @brief: make genlist for circular shape
587 * @param[parent]: object to which you want to set genlist
589 Evas_Object *view_create_circle_genlist(Evas_Object *parent)
591 Evas_Object *genlist = NULL;
592 Evas_Object *circle_genlist = NULL;
594 if (parent == NULL) {
595 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
599 if (s_info.circle_surface == NULL) {
600 dlog_print(DLOG_ERROR, LOG_TAG, "circle surface is NULL.");
604 genlist = elm_genlist_add(parent);
606 * This make selected list item is shown compressed.
608 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
609 evas_object_smart_callback_add(genlist, "selected", _gl_selected_cb, NULL);
612 * This make genlist style circular.
614 circle_genlist = eext_circle_object_genlist_add(genlist, s_info.circle_surface);
615 eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
616 eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
618 evas_object_show(genlist);
624 * @brief: Add item to genlist.
625 * @param[genlist]: genlist
626 * @param[style]: style of item determine how to show this item, such as "1text", "1text1icon" and so on
627 * @param[data]: item data that use item's callback function
628 * @param[_clicked_cb]: function will be operated when the item is clicked
629 * @param[cb_data]: data needed in '_clicked_cb' function
630 * This make item's class and add item to genlist.
632 Elm_Object_Item *view_append_item_to_genlist(Evas_Object *genlist, const char *style,
633 const void *data, Evas_Smart_Cb _clicked_cb, const void *cb_data)
635 Elm_Genlist_Item_Class *item_class;
636 Elm_Object_Item *item;
638 if (genlist == NULL) {
639 dlog_print(DLOG_ERROR, LOG_TAG, "genlist is NULL.");
644 dlog_print(DLOG_ERROR, LOG_TAG, "item style is NULL.");
648 item_class = _set_genlist_item_class(style);
650 item = elm_genlist_item_append(genlist, item_class, data, NULL, ELM_GENLIST_ITEM_NONE, _clicked_cb, cb_data);
652 elm_genlist_item_class_free(item_class);
658 * @brief: Find item from genlist.
659 * @param[genlist]: genlist
660 * @param[val]: value determine which of the items has to remove
662 Elm_Object_Item *view_find_item_from_genlist(Evas_Object *genlist, const char *val)
666 Elm_Object_Item *item = NULL;
667 struct genlist_data *gendata = NULL;
670 dlog_print(DLOG_ERROR, LOG_TAG, "genlist is NULL.");
674 item_count = elm_genlist_items_count(genlist);
677 * The fist item and the last item are "padding".
679 for(i = 1; i < item_count-1; i++) {
680 item = elm_genlist_nth_item_get(genlist, i);
681 gendata = elm_object_item_data_get(item);
683 if (gendata->alarm_id == atoi(val)) {
692 * @brief: Remove item.
693 * @param[item]: item from genlist
695 void view_delete_item(Elm_Object_Item *item)
697 elm_object_item_del(item);
701 * @brief: Make popup with theme.
702 * @param[popup_style]: style of the popup's layout
703 * @param[data]: data needed in this function
705 void view_create_text_popup(Evas_Object *parent, double timeout, const char *text)
707 Evas_Object *popup = NULL;
708 Evas_Object *popup_layout = NULL;
710 if (parent == NULL) {
711 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
715 popup = elm_popup_add(parent);
716 elm_object_style_set(popup, "circle");
717 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
719 eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _popup_hide_cb, NULL);
721 * Delete popup object in _popup_hide_finished_cb(), when the "dismissed" signal will be called.
723 evas_object_smart_callback_add(popup, "dismissed", _popup_hide_finished_cb, NULL);
725 popup_layout = elm_layout_add(popup);
726 elm_layout_theme_set(popup_layout, "layout", "popup", "content/circle");
728 elm_object_content_set(popup, popup_layout);
730 elm_popup_timeout_set(popup, timeout);
733 view_set_text(popup_layout, "elm.text", text);
735 evas_object_show(popup);
738 void view_set_content_to_part(Evas_Object *layout, const char *part, Evas_Object *content)
740 elm_object_part_content_set(layout, part, content);
743 void view_send_signal_to_edje(Evas_Object *layout, const char *signal, const char *source)
745 elm_object_signal_emit(layout, signal, source);
748 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)
750 elm_object_signal_callback_add(item, signal, source, signal_cb, user_data);
754 * @brief: Register rotary event callback function.
755 * @param[obj]: object that will receive rotary event
756 * @param[rotary_cb]: function will be operated when rotary event happens
757 * @param[user_data]: data needed in this function
759 void view_set_rotary_event_callback(Evas_Object *obj, Eext_Rotary_Event_Cb rotary_cb, void *user_data)
762 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
766 eext_rotary_object_event_activated_set(obj, EINA_TRUE);
767 eext_rotary_object_event_callback_add(obj, rotary_cb, user_data);
771 * @brief: Make a label and set label options.
772 * @param[parent]: The object to which you want to add this label
774 Evas_Object *view_create_label(Evas_Object *parent)
776 Evas_Object *label = elm_label_add(parent);
778 if (parent == NULL) {
779 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
783 elm_object_style_set(label, "slide_short");
784 elm_label_wrap_width_set(label, 230);
785 elm_label_ellipsis_set(label, EINA_TRUE);
786 elm_label_slide_duration_set(label, 2);
787 elm_label_slide_mode_set(label, ELM_LABEL_SLIDE_MODE_NONE);
788 elm_label_slide_go(label);
789 evas_object_show(label);
795 * @brief: Set a text to label object
796 * @param[parent]: Object has part to which you want to set text
797 * @param[part]: Part name to which you want to set text
798 * @param[text]: text you want to set to the part
800 void view_set_label_text(Evas_Object *parent, const char *part, const char *text)
802 Evas_Object *label = NULL;
803 char *markup_text = NULL;
804 char buf[256] = { 0, };
806 if (parent == NULL) {
807 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
811 markup_text = elm_entry_utf8_to_markup(text);
812 snprintf(buf, sizeof(buf), "%s%s%s", LABEL_STYLE_START, markup_text, LABEL_STYLE_END);
815 label = elm_object_part_content_get(parent, part);
817 dlog_print(DLOG_ERROR, LOG_TAG, "label is NULL.");
821 elm_object_text_set(label, buf);
825 * @brief: Set a label to given part
826 * @param[parent]: object has part to which you want to set this label
827 * @param[part]: part name to which you want to set this label
829 void view_set_label(Evas_Object *parent, const char *part)
831 Evas_Object *label = NULL;
833 if (parent == NULL) {
834 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
838 label = view_create_label(parent);
840 dlog_print(DLOG_ERROR, LOG_TAG, "label is NULL.");
844 elm_object_part_content_set(parent, part, label);
848 * @brief: Create a progressbar
849 * @param[parent]: object has part to which you want to set this progressbar
850 * @param[radius]: radius The radius value of a given circle object
851 * @param[line_width]: line_width The line width value of the circle object
853 Evas_Object *view_create_progressbar(Evas_Object *parent, int radius, int line_width)
855 Evas_Object *progressbar = NULL;
857 if (parent == NULL) {
858 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
862 progressbar = eext_circle_object_progressbar_add(parent, NULL);
864 eext_circle_object_value_min_max_set(progressbar, 0.0, 100.0);
865 eext_circle_object_radius_set(progressbar, radius);
866 eext_circle_object_line_width_set(progressbar, line_width);
867 evas_object_show(progressbar);
873 * @brief: Set a progressbar to given part
874 * @param[parent]: object has part to which you want to set
875 * @param[part]: part name to which you want to set
876 * @param[radius]: radius The radius value of a given circle object
877 * @param[line_width]: line_width The line width value of the circle object
879 void view_set_progressbar(Evas_Object *parent, const char *part, int radius, int line_width)
881 Evas_Object *progressbar = NULL;
883 if (parent == NULL) {
884 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
888 progressbar = view_create_progressbar(parent, radius, line_width);
889 if (progressbar == NULL) {
890 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
894 elm_object_part_content_set(parent, part, progressbar);
898 * @brief: Set value to a progressbar
899 * @param[parent]: object has part to which you want to set
900 * @param[part]: part name to which you want to set
901 * @param[val]: value to which you want to set
903 void view_set_progressbar_val(Evas_Object *parent, const char *part, int val)
905 Evas_Object *progressbar = NULL;
907 if (parent == NULL) {
908 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
913 dlog_print(DLOG_ERROR, LOG_TAG, "part is NULL.");
917 progressbar = elm_object_part_content_get(parent, part);
918 if (progressbar == NULL) {
919 dlog_print(DLOG_ERROR, LOG_TAG, "progressbar is NULL.");
923 eext_circle_object_value_set(progressbar, val);
927 * @brief: Make a checkbox
928 * @param[parent]: The object to which you want to add this checkbox
930 Evas_Object *view_create_checkbox(Evas_Object *parent)
934 if (parent == NULL) {
935 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
939 check = elm_check_add(parent);
940 elm_check_state_set(check, EINA_FALSE);
941 evas_object_smart_callback_add(check, "changed", _icon_clicked_cb, NULL);
942 evas_object_show(check);
948 * @brief: Make no voice memo view
949 * @param[parent]: naviframe
950 * @param[title]: titile of this view
951 * @param[detail]: detail text of this view
952 * @param[image_file]: image file name will be used in this view
953 * This function make a view consists of one title, one center image and one detail text at the bottom
955 Evas_Object *view_create_layout_no_content(Evas_Object *parent, char *title, char *detail, char *image_file)
957 Evas_Object *layout = NULL;
961 if (parent == NULL) {
962 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
966 layout = elm_layout_add(parent);
967 /* this make you can use layout consists of one title, one image and one detail text */
968 elm_layout_theme_set(layout, "layout", "nocontents", "default");
969 evas_object_size_hint_weight_set (layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
970 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
973 img = elm_image_add(parent);
974 elm_image_file_set(img, image_file, NULL);
975 elm_object_part_content_set(layout, "elm.swallow.icon", img);
976 evas_object_show(img);
980 char detail_text[256] = {0, };
982 /* Customize font style bellow */
983 snprintf(detail_text, sizeof(detail_text), "<font=TIZEN:style=Medium align=center color=#FFFFFF><font_size=28>%s</font_size></font>", detail);
984 elm_object_part_text_set(layout, "elm.text", detail_text);
987 char title_text[256] = {0, };
989 snprintf(title_text, sizeof(title_text), "<font=TIZEN:style=Medium align=center color=#12B4FF><font_size=28>%s</font_size></font>", title);
990 elm_object_part_text_set(layout, "elm.text.title", title_text);
993 /* if this signal is not sent, title text will be disappear */
994 elm_object_signal_emit(layout, "elm,state,title,enable", "elm");
995 /* push this no voice memo view to naviframe to show */
996 it = elm_naviframe_item_push(parent, "Title Enabled", NULL, NULL, layout, NULL);
997 /* if this is EINA_TRUE, you can see Title of naviframe on the top of the screen */
998 elm_naviframe_item_title_enabled_set(it, EINA_FALSE, EINA_FALSE);
1004 * @brief: Set datetime to the part
1005 * @param[parent]: object to which you want to set datetime
1006 * @param[style]: style of the datetime
1008 Evas_Object *view_create_datetime(Evas_Object *parent, const char *style)
1010 Evas_Object *circle_datetime = NULL;
1012 if (parent == NULL) {
1013 dlog_print(DLOG_ERROR, LOG_TAG, "failed to get parent.");
1017 if (s_info.circle_surface == NULL) {
1018 dlog_print(DLOG_ERROR, LOG_TAG, "failed to get circle_surface.");
1022 s_info.datetime = elm_datetime_add(parent);
1023 circle_datetime = eext_circle_object_datetime_add(s_info.datetime, s_info.circle_surface);
1025 eext_rotary_object_event_activated_set(s_info.datetime, EINA_TRUE);
1026 elm_datetime_format_set(s_info.datetime, FORMAT);
1028 elm_object_style_set(s_info.datetime, style);
1030 elm_object_part_content_set(parent, "elm.swallow.content", s_info.datetime);
1032 return s_info.datetime;