b746ed42f54669120fe4b7b42683eda170cb5371
[platform/core/uifw/libscl-core.git] / src / sclcoreui.cpp
1 /*
2  * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 #include <dlog.h>
19
20 #include "sclcoreui.h"
21
22 #include "sclcoreui-efl.h"
23
24 using namespace scl;
25
26 CSCLCoreUI::CSCLCoreUI()
27 {
28     m_backend_identifier = "undefined";
29     m_impl = NULL;
30 }
31
32 CSCLCoreUI::~CSCLCoreUI()
33 {
34 }
35
36 std::string CSCLCoreUI::get_backend_indentifier()
37 {
38     return m_backend_identifier;
39 }
40
41 sclboolean CSCLCoreUI::init(sclwindow main_window)
42 {
43     sclboolean ret = FALSE;
44     if (m_impl == NULL) {
45         /* There could be other backend implementations.. */
46         m_impl = new CSCLCoreUIEFL;
47         if (m_impl) {
48             ret = m_impl->init(main_window);
49         }
50     }
51     return ret;
52 }
53
54 void CSCLCoreUI::fini()
55 {
56     if (m_impl) {
57         m_impl->fini();
58         delete m_impl;
59         m_impl = NULL;
60     }
61 }
62
63 void CSCLCoreUI::run(const sclchar *display)
64 {
65     if (m_impl) {
66         m_impl->run(display);
67     }
68 }
69
70 void CSCLCoreUI::set_keyboard_size_hints(SclSize portrait, SclSize landscape)
71 {
72     if (m_impl) {
73         m_impl->set_keyboard_size_hints(portrait, landscape);
74     }
75 }
76
77 sclwindow CSCLCoreUI::get_main_window()
78 {
79     sclwindow ret = SCLWINDOW_INVALID;
80     if (m_impl) {
81         ret = m_impl->get_main_window();
82     }
83     return ret;
84 }
85
86 int CSCLCoreUI::get_screen_rotation_degree()
87 {
88     int ret = 0;
89     if (m_impl) {
90         ret = m_impl->get_screen_rotation_degree();
91     }
92     return ret;
93 }
94
95 sclwindow CSCLCoreUI::create_option_window(SCLOptionWindowType type)
96 {
97     sclwindow ret = SCLWINDOW_INVALID;
98     if (m_impl) {
99         ret = m_impl->create_option_window(type);
100     }
101     return ret;
102 }
103
104 bool CSCLCoreUI::show_option_window(SCLOptionWindowType type)
105 {
106     bool ret = false;
107     if (m_impl) {
108         ret = m_impl->show_option_window(type);
109     }
110     return ret;
111 }
112
113 void CSCLCoreUI::destroy_option_window(sclwindow window)
114 {
115     if (m_impl) {
116         m_impl->destroy_option_window(window);
117     }
118 }
119
120 void CSCLCoreUI::process_keyboard_ui_state_change(KEYBOARD_UI_STATE state)
121 {
122     if (m_impl) {
123         m_impl->process_keyboard_ui_state_change(state);
124     }
125 }
126
127 void CSCLCoreUI::set_floating_mode(sclboolean floating_mode)
128 {
129     if (m_impl) {
130         m_impl->set_floating_mode(floating_mode);
131     }
132 }