2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.1 (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://floralicense.org/license/
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 #include "view_manager/view_manager.h"
20 typedef struct _s_ui {
23 Evas_Object *naviframe;
24 s_view_base *current_view;
27 static s_ui s_info = { 0,};
29 static void _win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
34 static void _create_window(void)
36 s_info.win = elm_win_util_standard_add(PACKAGE, PACKAGE);
38 assert(!"Failed to create the main window");
41 elm_win_conformant_set(s_info.win, EINA_TRUE);
42 elm_win_autodel_set(s_info.win, EINA_TRUE);
44 evas_object_smart_callback_add(s_info.win, "delete,request", _win_delete_request_cb, NULL);
47 static void _create_conformant(void)
49 s_info.conform = elm_conformant_add(s_info.win);
50 elm_win_indicator_mode_set(s_info.win, ELM_WIN_INDICATOR_SHOW);
51 elm_win_indicator_opacity_set(s_info.win, ELM_WIN_INDICATOR_OPAQUE);
52 evas_object_size_hint_weight_set(s_info.conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
53 elm_win_resize_object_add(s_info.win, s_info.conform);
54 evas_object_show(s_info.conform);
57 static void _create_naviframe(void)
59 s_info.naviframe = elm_naviframe_add(s_info.win);
60 evas_object_size_hint_weight_set(s_info.naviframe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
61 elm_object_content_set(s_info.conform, s_info.naviframe);
62 evas_object_show(s_info.conform);
65 void view_manager_set_view(view_id id)
67 view_base_hide(s_info.current_view);
69 s_view_base *view = view_factory_create_view(s_info.naviframe, id);
71 s_info.current_view = view;
72 elm_naviframe_item_simple_push(s_info.naviframe, s_info.current_view->layout);
74 view_base_show(s_info.current_view);
77 void view_manager_initialize_ui(void)
83 view_manager_set_view(VIEW_CONNECT_TO_CAR);
84 evas_object_show(s_info.win);
87 Evas_Object *view_manager_get_win(void)
92 Evas_Object *view_manager_get_conform(void)
94 return s_info.conform;