9db6ce406fd134a007f84b428cef6ca293bc2647
[platform/core/uifw/dali-adaptor.git] / adaptors / public-api / adaptor-framework / application.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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 // CLASS HEADER
19 #include "application.h"
20
21 // EXTERNAL INCLUDES
22 #include <dali/integration-api/debug.h>
23
24 // INTERNAL INCLUDES
25 #include <application-impl.h>
26
27 namespace Dali
28 {
29
30 Application Application::New()
31 {
32   return New( NULL, NULL );
33 }
34
35 Application Application::New( int* argc, char **argv[] )
36 {
37   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, "Dali Application", DeviceLayout::DEFAULT_BASE_LAYOUT, OPAQUE );
38   return Application(internal.Get());
39 }
40
41 Application Application::New( int* argc, char **argv[], const std::string& name )
42 {
43   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, name, DeviceLayout::DEFAULT_BASE_LAYOUT, OPAQUE );
44   return Application(internal.Get());
45 }
46
47 Application Application::New( int* argc, char **argv[], const std::string& name, WINDOW_MODE windowMode )
48 {
49   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, name, DeviceLayout::DEFAULT_BASE_LAYOUT, windowMode );
50   return Application(internal.Get());
51 }
52
53 Application Application::New(int* argc, char **argv[], const DeviceLayout& baseLayout)
54 {
55   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, "Dali Application", baseLayout, OPAQUE );
56   return Application(internal.Get());
57 }
58
59 Application Application::New(int* argc, char **argv[], const std::string& name, const DeviceLayout& baseLayout)
60 {
61   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, name, baseLayout, OPAQUE );
62   return Application(internal.Get());
63 }
64
65 Application::~Application()
66 {
67 }
68
69 Application::Application()
70 {
71 }
72
73 Application::Application(const Application& application)
74 : BaseHandle(application)
75 {
76 }
77
78 Application& Application::operator=(const Application& application)
79 {
80   if( *this != application )
81   {
82     BaseHandle::operator=( application );
83   }
84   return *this;
85 }
86
87 void Application::MainLoop()
88 {
89   Internal::Adaptor::GetImplementation(*this).MainLoop(Configuration::APPLICATION_HANDLES_CONTEXT_LOSS);
90 }
91
92 void Application::MainLoop(Configuration::ContextLoss configuration)
93 {
94   Internal::Adaptor::GetImplementation(*this).MainLoop(configuration);
95 }
96
97 void Application::Lower()
98 {
99   Internal::Adaptor::GetImplementation(*this).Lower();
100 }
101
102 void Application::Quit()
103 {
104   Internal::Adaptor::GetImplementation(*this).Quit();
105 }
106
107 bool Application::AddIdle( CallbackBase* callback )
108 {
109   return Internal::Adaptor::GetImplementation(*this).AddIdle( callback );
110 }
111
112 Window Application::GetWindow()
113 {
114   return Internal::Adaptor::GetImplementation(*this).GetWindow();
115 }
116
117 void Application::ReplaceWindow(PositionSize windowPosition, const std::string& name)
118 {
119   Internal::Adaptor::GetImplementation(*this).ReplaceWindow(windowPosition, name);
120 }
121
122 void Application::SetViewMode( ViewMode viewMode )
123 {
124   Internal::Adaptor::GetImplementation(*this).SetViewMode( viewMode );
125 }
126
127 ViewMode Application::GetViewMode() const
128 {
129   return Internal::Adaptor::GetImplementation(*this).GetViewMode();
130 }
131
132 void Application::SetStereoBase( float stereoBase )
133 {
134   Internal::Adaptor::GetImplementation(*this).SetStereoBase( stereoBase );
135 }
136
137 float Application::GetStereoBase() const
138 {
139   return Internal::Adaptor::GetImplementation(*this).GetStereoBase();
140 }
141
142 Application::AppSignalType& Application::InitSignal()
143 {
144   return Internal::Adaptor::GetImplementation(*this).InitSignal();
145 }
146
147 Application::AppSignalType& Application::TerminateSignal()
148 {
149   return Internal::Adaptor::GetImplementation(*this).TerminateSignal();
150 }
151
152 Application::AppSignalType& Application::PauseSignal()
153 {
154   return Internal::Adaptor::GetImplementation(*this).PauseSignal();
155 }
156
157 Application::AppSignalType& Application::ResumeSignal()
158 {
159   return Internal::Adaptor::GetImplementation(*this).ResumeSignal();
160 }
161
162 Application::AppSignalType& Application::ResetSignal()
163 {
164   return Internal::Adaptor::GetImplementation(*this).ResetSignal();
165 }
166
167 Application::AppSignalType& Application::ResizeSignal()
168 {
169   return Internal::Adaptor::GetImplementation(*this).ResizeSignal();
170 }
171
172 Application::AppControlSignalType & Application::AppControlSignal()
173 {
174   return Internal::Adaptor::GetImplementation(*this).AppControlSignal();
175 }
176
177 Application::AppSignalType& Application::LanguageChangedSignal()
178 {
179   return Internal::Adaptor::GetImplementation(*this).LanguageChangedSignal();
180 }
181
182 Application::AppSignalType& Application::RegionChangedSignal()
183 {
184   return Internal::Adaptor::GetImplementation(*this).RegionChangedSignal();
185 }
186
187 Application::AppSignalType& Application::BatteryLowSignal()
188 {
189   return Internal::Adaptor::GetImplementation(*this).BatteryLowSignal();
190 }
191
192 Application::AppSignalType& Application::MemoryLowSignal()
193 {
194   return Internal::Adaptor::GetImplementation(*this).MemoryLowSignal();
195 }
196
197 Application::Application(Internal::Adaptor::Application* application)
198 : BaseHandle(application)
199 {
200 }
201
202
203 } // namespace Dali