1 #include "stc-wearable-popup.h"
3 typedef struct appdata {
10 win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
16 win_back_cb(void *data, Evas_Object *obj, void *event_info)
19 /* Let window go to hide state. */
20 elm_win_lower(ad->win);
24 create_base_gui(appdata_s *ad)
27 /* Create and initialize elm_win.
28 elm_win is mandatory to manipulate window. */
29 ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
30 elm_win_autodel_set(ad->win, EINA_TRUE);
32 if (elm_win_wm_rotation_supported_get(ad->win)) {
33 int rots[4] = { 0, 90, 180, 270 };
34 elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
37 evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
38 eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, win_back_cb, ad);
41 /* Create and initialize elm_conformant.
42 elm_conformant is mandatory for base gui to have proper size
43 when indicator or virtual keypad is visible. */
44 ad->conform = elm_conformant_add(ad->win);
45 elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
46 elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE);
47 evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
48 elm_win_resize_object_add(ad->win, ad->conform);
49 evas_object_show(ad->conform);
52 /* Create an actual view of the base gui.
53 Modify this part to change the view. */
54 ad->label = elm_label_add(ad->conform);
55 elm_object_text_set(ad->label, "<align=center>Hello Tizen</align>");
56 evas_object_size_hint_weight_set(ad->label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
57 elm_object_content_set(ad->conform, ad->label);
59 /* Show window after base gui is set up */
60 evas_object_show(ad->win);
64 app_create(void *data)
66 /* Hook to take necessary actions before main event loop starts
67 Initialize UI resources and application's data
68 If this function returns true, the main loop of application starts
69 If this function returns false, the application is terminated */
78 app_control(app_control_h app_control, void *data)
80 /* Handle the launch request. */
86 /* Take necessary actions when application becomes invisible. */
90 app_resume(void *data)
92 /* Take necessary actions when application becomes visible. */
96 app_terminate(void *data)
98 /* Release all resources. */
102 ui_app_lang_changed(app_event_info_h event_info, void *user_data)
104 /*APP_EVENT_LANGUAGE_CHANGED*/
106 system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
107 elm_language_set(locale);
113 ui_app_orient_changed(app_event_info_h event_info, void *user_data)
115 /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
120 ui_app_region_changed(app_event_info_h event_info, void *user_data)
122 /*APP_EVENT_REGION_FORMAT_CHANGED*/
126 ui_app_low_battery(app_event_info_h event_info, void *user_data)
128 /*APP_EVENT_LOW_BATTERY*/
132 ui_app_low_memory(app_event_info_h event_info, void *user_data)
134 /*APP_EVENT_LOW_MEMORY*/
138 main(int argc, char *argv[])
143 ui_app_lifecycle_callback_s event_callback = {0,};
144 app_event_handler_h handlers[5] = {NULL, };
146 event_callback.create = app_create;
147 event_callback.terminate = app_terminate;
148 event_callback.pause = app_pause;
149 event_callback.resume = app_resume;
150 event_callback.app_control = app_control;
152 ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
153 ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
154 ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
155 ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
156 ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad);
158 ret = ui_app_main(argc, argv, &event_callback, &ad);
159 if (ret != APP_ERROR_NONE) {
160 dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);