2 |R| * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
4 |R| * Licensed under the Apache License, Version 2.0 (the "License");
5 |R| * you may not use this file except in compliance with the License.
6 |R| * You may obtain a copy of the License at
8 |R| * http://www.apache.org/licenses/LICENSE-2.0
10 |R| * Unless required by applicable law or agreed to in writing, software
11 |R| * distributed under the License is distributed on an "AS IS" BASIS,
12 |R| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 |R| * See the License for the specific language governing permissions and
14 |R| * limitations under the License.
17 |R| static struct view_info {
19 |R| Evas_Object *conform;
26 |R| * @brief: Create Essential Object window, conformant and layout
28 |R| void view_create(void)
30 |R| /* Create window */
31 |R| s_info.win = view_create_win(PACKAGE);
32 |R| if (s_info.win == NULL) {
33 |R| dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a window.");
37 |R| /* Create conformant */
38 |R| s_info.conform = view_create_conformant_without_indicator(s_info.win);
39 |R| if (s_info.conform == NULL) {
40 |R| dlog_print(DLOG_ERROR, LOG_TAG, "failed to create a conformant");
44 |R| /* Show window after main view is set up */
45 |R| evas_object_show(s_info.win);
49 * @brief: Make a basic window named package
50 * @param[package]: Name of the window
52 Evas_Object *view_create_win(const char *pkg_name)
54 Evas_Object *win = NULL;
57 /* Create and initialize elm_win.
58 elm_win is mandatory to manipulate window. */
60 win = elm_win_util_standard_add(pkg_name, pkg_name);
61 elm_win_conformant_set(win, EINA_TRUE);
62 elm_win_autodel_set(win, EINA_TRUE);
64 if (elm_win_wm_rotation_supported_get(win)) {
65 int rots[4] = { 0, 90, 180, 270 };
66 elm_win_wm_rotation_available_rotations_set(win, (const int *)(&rots), 4);
69 evas_object_smart_callback_add(win, "delete,request", _win_delete_request_cb, NULL);
75 * @brief: Make a conformant without indicator for wearable app
76 * @param[win]: The object to which you want to set this conformant
77 * Conformant is mandatory for base GUI to have proper size
79 Evas_Object *view_create_conformant_without_indicator(Evas_Object *win)
82 * Create and initialize elm_conformant.
83 * elm_conformant is mandatory for base GUI to have proper size
84 * when indicator or virtual keypad is visible.
86 Evas_Object *conform = NULL;
89 dlog_print(DLOG_ERROR, LOG_TAG, "window is NULL.");
93 conform = elm_conformant_add(win);
94 evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
95 elm_win_resize_object_add(win, conform);
97 evas_object_show(conform);
103 * @brief: Make a layout to target parent object with edje file
104 * @param[parent]: The object to which you want to add this layout
105 * @param[file_name]: File path of EDJ
106 * @param[group_name]: Name of group in EDJ you want to set to
107 * @param[Evas_Object_Event_Cb]: File path of EDJ
108 * @param[user_data]: The user data to be passed to the callback functions
110 Evas_Object *view_create_layout(Evas_Object *parent, const char *edj_path, const char *group_name, Eext_Event_Cb cb_function, void *user_data)
112 Evas_Object *layout = NULL;
114 if (parent == NULL) {
115 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
119 /* Create layout by EDC(edje file) */
120 layout = elm_layout_add(parent);
121 elm_layout_file_set(layout, edj_path, group_name);
123 /* Layout size setting */
124 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
127 eext_object_event_callback_add(layout, EEXT_CALLBACK_BACK, cb_function, user_data);
129 evas_object_show(layout);
135 * @brief: Make and set a layout to conformant
136 * @param[parent]: Target conformant object
137 * @param[file_name]: File path of EDJ used
138 * @param[group_name]: Group name in EDJ you want to set to layout
139 * @param[cb_function]: Callback for back event handling
140 * @param[user_data]: The user data to be passed to the callback functions
142 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)
144 Evas_Object *layout = NULL;
146 if (parent == NULL) {
147 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
151 /* Create layout for conformant */
153 layout = view_create_layout_by_theme(parent, "layout", "application", "default");
155 layout = view_create_layout(parent, file_name, group_name, cb_function, user_data);
158 if (layout == NULL) {
159 dlog_print(DLOG_ERROR, LOG_TAG, "layout is NULL.");
163 elm_object_content_set(parent, layout);
169 * @brief: Make a layout with theme.
170 * @param[parent]: Object to which you want to add this layout
171 * @param[class]: The class of the group
172 * @param[group_name]: Group name in EDJ you want to set to layout
173 * @param[style]: The style to use
175 Evas_Object *view_create_layout_by_theme(Evas_Object *parent, const char *classname, const char *group, const char *style)
179 * Create and initialize elm_layout.
180 * view_create_layout_by_theme() is used to create layout by using premade edje file.
182 Evas_Object *layout = NULL;
184 if (parent == NULL) {
185 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
189 layout = elm_layout_add(parent);
190 elm_layout_theme_set(layout, classname, group, style);
191 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
193 evas_object_show(layout);
199 * @brief: Make and set a layout to the part
200 * @param[parent]: Object to which you want to set this layout
201 * @param[file_name]: File path of EDJ used
202 * @param[group_name]: Group name in EDJ you want to set to layout
203 * @param[part]: Part name to which you want to set this layout
205 Evas_Object *view_create_layout_for_part(Evas_Object *parent, char *part, char *file_name, char *group_name)
207 Evas_Object *layout = NULL;
209 if (parent == NULL) {
210 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
214 layout = elm_layout_add(parent);
215 elm_layout_file_set(layout, file_name, group_name);
216 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
218 evas_object_show(layout);
220 elm_object_part_content_set(parent, part, layout);
226 |R| * @brief: Destroy window and free important data to finish this application
228 |R| void view_destroy(void)
230 |R| if (s_info.win == NULL) {
234 |R| evas_object_del(s_info.win);
238 * @brief: Destroy given layout
239 * @param[layout]: The layout you want to destroy
241 void view_destroy_layout(Evas_Object *layout)
243 evas_object_del(layout);
247 |R| * @brief: Set image to given part
248 |R| * @param[parent]: object has part to which you want to set this image
249 |R| * @param[part]: part name to which you want to set this image
250 |R| * @param[image_path]: path of image file
252 |R| void view_set_image(Evas_Object *parent, const char *part, const char *image_path)
254 |R| Evas_Object *image = NULL;
256 |R| if (parent == NULL) {
257 |R| dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
261 |R| image = elm_object_part_content_get(parent, part);
262 |R| if (image == NULL) {
263 |R| image = elm_image_add(parent);
265 |R| dlog_print(DLOG_ERROR, LOG_TAG, "failed to create an image object.");
270 |R| if (EINA_FALSE == elm_image_file_set(image, image_path, NULL)) {
271 |R| dlog_print(DLOG_ERROR, LOG_TAG, "failed to set image.");
276 |R| elm_object_part_content_set(parent, part, image);
278 |R| elm_object_content_set(parent, image);
281 |R| evas_object_show(image);
287 * @brief: Set text to the part
288 * @param[parent]: Object has part to which you want to set text
289 * @param[part]: Part name to which you want to set text
290 * @param[text]: text you want to set to the part
292 void view_set_text(Evas_Object *parent, const char *part, const char *text)
294 if (parent == NULL) {
295 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
299 /* Set text of target part object */
300 elm_object_part_text_set(parent, part, text);
304 * @brief: Set color of the part
305 * @param[parent]: Object has part to which you want to set color
306 * @param[part]: Name of part to which you want to set color
307 * @param[r]: R of RGBA you want to set to the part
308 * @param[g]: G of RGBA you want to set to the part
309 * @param[b]: B of RGBA you want to set to the part
310 * @param[a]: A of RGBA you want to set to the part
312 void view_set_color(Evas_Object *parent, const char *part, int r, int g, int b, int a)
314 Evas_Object *obj = NULL;
316 if (parent == NULL) {
317 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
321 obj = elm_object_part_content_get(parent, part);
323 dlog_print(DLOG_ERROR, LOG_TAG, "failed to get parent.");
327 /* Set color of target part object */
328 evas_object_color_set(obj, r, g, b, a);
332 * @brief: Set the color of circle line and font in a given circle object
333 * @param[parent]: Object has part to which you want to set color
334 * @param[part]: Name of part to which you want to set color
335 * @param[r] The red component of the given color
336 * @param[g] The green component of the given color
337 * @param[b] The blue component of the given color
338 * @param[a] The alpha component of the given color
340 void view_set_color_of_circle_object(Evas_Object *parent, const char *part, int r, int g, int b, int a)
342 Evas_Object *obj = NULL;
344 if (parent == NULL) {
345 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
349 obj = elm_object_part_content_get(parent, part);
351 dlog_print(DLOG_ERROR, LOG_TAG, "failed to get parent.");
355 /* Set color of target part object */
356 eext_circle_object_color_set(obj, r, g, b, a);
360 * @brief: Make a naviframe and set to parent
361 * @param[parent]: Object to which you want to set naviframe
362 * @Add callback function will be operated when back key is pressed
364 Evas_Object *view_create_naviframe(Evas_Object *parent)
367 * Create and initialize elm_naviframe.
368 * Naviframe stands for navigation frame.
369 * elm_naviframe is a views manager for applications.
371 Evas_Object *nf = NULL;
373 if (parent == NULL) {
374 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
378 nf = elm_naviframe_add(parent);
380 elm_object_part_content_set(parent, "elm.swallow.content", nf);
381 eext_object_event_callback_add(nf, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
382 eext_object_event_callback_add(nf, EEXT_CALLBACK_MORE, eext_naviframe_more_cb, NULL);
384 evas_object_show(nf);
391 * @brief: Push item to naviframe
392 * @param[nf]: naviframe
393 * @param[item]: object will be added to naviframe
394 * @param[_pop_cb]: function will be operated when this item is popped from naviframe
395 * @param[cb_data]: data needed to operate '_pop_cb' function
396 * Naviframe make changing of view is easy and effectively
398 Elm_Object_Item* view_push_item_to_naviframe(Evas_Object *nf, Evas_Object *item, Elm_Naviframe_Item_Pop_Cb _pop_cb, void *cb_data)
400 Elm_Object_Item* nf_it = NULL;
403 dlog_print(DLOG_ERROR, LOG_TAG, "naviframe is NULL.");
408 dlog_print(DLOG_ERROR, LOG_TAG, "item is NULL.");
412 nf_it = elm_naviframe_item_push(nf, NULL, NULL, NULL, item, "empty");
415 elm_naviframe_item_pop_cb_set(nf_it, _pop_cb, cb_data);
421 void view_set_more_button(Evas_Object *parent, const char *part)
423 Evas_Object *more_btn = NULL;
425 if (pirent == NULL) {
426 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
430 more_btn = eext_more_option_add(parent);
431 if (more_btn == NULL) {
432 dlog_print(DLOG_ERROR, LOG_TAG, "more option is NULL.");
436 /* Add smart callback */
437 evas_object_smart_callback_add(more_btn, "more,option,opened", _more_option_opened, NULL);
438 evas_object_smart_callback_add(more_btn, "more,option,closed", _more_option_closed, NULL);
439 evas_object_smart_callback_add(more_btn, "item,selected", _item_selected, NULL);
441 elm_object_part_content_set(parent, part, more_btn);
445 * @brief: Make and set button.
446 * @param[parent]: object to which you want to set the button
447 * @param[style]: style of the button
448 * @param[text]: text will be written on the button
449 * @param[image_path]: path of image file will be used as button icon
450 * @param[part]: part name in EDJ to which you want to set the button
451 * @param[down_cb]: function will be operated when the button is pressed
452 * @param[up_cb]: function will be operated when the button is released
453 * @param[clicked_cb]: function will be operated when the button is clicked
454 * @param[data]: data needed in this function
456 void view_set_button(Evas_Object *parent, const char *part, const char *style, const char *image_path, const char *text,
457 Evas_Object_Event_Cb down_cb, Evas_Object_Event_Cb up_cb, Evas_Smart_Cb clicked_cb, void *data)
459 Evas_Object *btn = NULL;
461 if (parent == NULL) {
462 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
466 btn = elm_button_add(parent);
468 dlog_print(DLOG_ERROR, LOG_TAG, "failed to create button.");
473 elm_object_style_set(btn, style);
475 evas_object_size_hint_weight_set(btn ,EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
476 elm_object_part_content_set(parent, part, btn);
479 elm_object_text_set(btn, text);
482 view_set_image(btn, NULL, image_path);
485 evas_object_event_callback_add(btn , EVAS_CALLBACK_MOUSE_DOWN, down_cb, data);
487 evas_object_event_callback_add(btn, EVAS_CALLBACK_MOUSE_UP, up_cb, data);
489 evas_object_smart_callback_add(btn, "clicked", clicked_cb, data);
491 evas_object_show(btn);
495 * @brief: Add a more button item
496 * @param[parent]: object that contains more button
497 * @param[main_txt]: text will be written in the middle of the selector
498 * @param[sub_txt] Text will be written under the main_txt
499 * @param[img_path]: path of image file will be used as more button item icon
500 * @param[clicked_cb]: function will be operated when the more button item is clicked
501 * @param[user_data]: data needed in this function
503 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)
505 Evas_Object *img = NULL;
506 Evas_Object *more_btn = NULL;
507 char full_path[PATH_MAX] = { 0, };
509 if (parent == NULL) {
510 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
514 more_btn = elm_object_part_content_get(parent, part);
515 if (more_btn == NULL) {
519 /* Create the new item */
520 Eext_Object_Item *item = eext_more_option_item_append(more_btn);
522 /* Set the text in item text part */
523 eext_more_option_item_part_text_set(item, "selector,main_text", main_txt);
524 eext_more_option_item_part_text_set(item, "selector,sub_text", sub_txt);
526 img = elm_image_add(more_btn);
527 _get_resource(img_path, full_path, sizeof(full_path));
528 elm_image_file_set(img, full_path, NULL);
530 /* Set the content in item content part */
531 eext_more_option_item_part_content_set(item, "item,icon", img);
533 evas_object_smart_callback_add(more_btn, "item,clicked", clicked_cb, user_data);
537 * @brief: Make a Entry Object to target window
538 * @param[parent]: Object to which you want to set Entry
539 * @param[part]: Part of the layout which you want to locate Entry
540 * @param[data]: The user data to be passed to the callback function
541 * @Add callback function will be operated when mouse clicked event is triggered
543 Evas_Object *view_set_entry(Evas_Object *parent, const char *part, void (*_clicked_cb)(void *data, Evas_Object *obj, void *event_info), void *data)
545 Evas_Object *entry = NULL;
547 if (parent == NULL) {
548 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
552 /* Add Entry object to parent */
553 entry = elm_entry_add(parent);
555 dlog_print(DLOG_ERROR, LOG_TAG, "failed to add a entry");
559 /* Set Entry size option */
560 evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
562 /* Set Entry option for display and functionalities */
563 elm_entry_single_line_set(entry, EINA_TRUE);
564 elm_entry_scrollable_set(entry, EINA_TRUE);
565 elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
566 elm_entry_editable_set(entry, EINA_FALSE);
567 elm_entry_context_menu_disabled_set(entry, EINA_TRUE);
568 elm_entry_cursor_handler_disabled_set(entry, EINA_TRUE);
569 elm_entry_select_allow_set(entry, EINA_FALSE);
571 /* Set Entry text style using predefined style description */
572 elm_entry_text_style_user_push(entry, DIAL_TEXT_STYLE_NORMAL);
574 elm_object_part_content_set(parent, part, entry);
576 /* Set callback for event about Entry */
578 evas_object_smart_callback_add(entry, "clicked", _clicked_cb, data);
585 * @brief: make genlist for circular shape
586 * @param[parent]: object to which you want to set genlist
588 Evas_Object *view_create_circle_genlist(Evas_Object *parent)
590 Evas_Object *genlist = NULL;
591 Evas_Object *circle_genlist = NULL;
593 if (parent == NULL) {
594 dlog_print(DLOG_ERROR, LOG_TAG, "parent is NULL.");
598 if (s_info.circle_surface == NULL) {
599 dlog_print(DLOG_ERROR, LOG_TAG, "circle surface is NULL.");
603 genlist = elm_genlist_add(parent);
605 * This make selected list item is shown compressed.
607 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
608 evas_object_smart_callback_add(genlist, "selected", _gl_selected_cb, NULL);
611 * This make genlist style circular.
613 circle_genlist = eext_circle_object_genlist_add(genlist, s_info.circle_surface);
614 eext_circle_object_genlist_scroller_policy_set(circle_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
615 eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
617 evas_object_show(genlist);
623 * @brief: Add item to genlist.
624 * @param[genlist]: genlist
625 * @param[style]: style of item determine how to show this item, such as "1text", "1text1icon" and so on
626 * @param[data]: item data that use item's callback function
627 * @param[_clicked_cb]: function will be operated when the item is clicked
628 * @param[cb_data]: data needed in '_clicked_cb' function
629 * This make item's class and add item to genlist.
631 Elm_Object_Item *view_append_item_to_genlist(Evas_Object *genlist, const char *style,
632 const void *data, Evas_Smart_Cb _clicked_cb, const void *cb_data)
634 Elm_Genlist_Item_Class *item_class;
635 Elm_Object_Item *item;
637 if (genlist == NULL) {
638 dlog_print(DLOG_ERROR, LOG_TAG, "genlist is NULL.");
643 dlog_print(DLOG_ERROR, LOG_TAG, "item style is NULL.");
647 item_class = _set_genlist_item_class(style);
649 item = elm_genlist_item_append(genlist, item_class, data, NULL, ELM_GENLIST_ITEM_NONE, _clicked_cb, cb_data);
651 elm_genlist_item_class_free(item_class);
657 * @brief: Find item from genlist.
658 * @param[genlist]: genlist
659 * @param[val]: value determine which of the items has to remove
661 Elm_Object_Item *view_find_item_from_genlist(Evas_Object *genlist, const char *val)
665 Elm_Object_Item *item = NULL;
666 struct genlist_data *gendata = NULL;
669 dlog_print(DLOG_ERROR, LOG_TAG, "genlist is NULL.");
673 item_count = elm_genlist_items_count(genlist);
676 * The fist item and the last item are "padding".
678 for(i = 1; i < item_count-1; i++) {
679 item = elm_genlist_nth_item_get(genlist, i);
680 gendata = elm_object_item_data_get(item);
682 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, "sw.focus.txt", 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;