Remove StereoMode
[platform/core/uifw/dali-adaptor.git] / dali / 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 <dali/public-api/adaptor-framework/application.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/integration-api/debug.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/internal/adaptor/common/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::GetPreInitializedApplication();
38   if( internal )
39   {
40     if( argc && ( *argc > 0 ) )
41     {
42       internal->GetWindow().SetClass( (*argv)[0], "" );
43     }
44
45     return Application( internal.Get() );
46   }
47   else
48   {
49     internal = Internal::Adaptor::Application::New( argc, argv, "", OPAQUE, PositionSize(),
50       Internal::Adaptor::Framework::NORMAL);
51     return Application(internal.Get());
52   }
53 }
54
55 Application Application::New( int* argc, char **argv[], const std::string& stylesheet )
56 {
57   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
58   if( internal )
59   {
60     if( argc && ( *argc > 0 ) )
61     {
62       internal->GetWindow().SetClass( (*argv)[0], "" );
63     }
64     internal->SetStyleSheet( stylesheet );
65
66     return Application( internal.Get() );
67   }
68   else
69   {
70     internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, OPAQUE, PositionSize(),
71       Internal::Adaptor::Framework::NORMAL);
72     return Application(internal.Get());
73   }
74 }
75
76 Application Application::New( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode )
77 {
78   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
79   if( internal )
80   {
81     if( argc && ( *argc > 0 ) )
82     {
83       internal->GetWindow().SetClass( (*argv)[0], "" );
84     }
85     internal->SetStyleSheet( stylesheet );
86
87     internal->GetWindow().SetTransparency( ( windowMode == Application::OPAQUE ? false : true ) );
88
89     return Application( internal.Get() );
90   }
91   else
92   {
93     internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode, PositionSize(),
94       Internal::Adaptor::Framework::NORMAL);
95     return Application(internal.Get());
96   }
97 }
98
99 Application Application::New( int* argc, char **argv[], const std::string& stylesheet, Application::WINDOW_MODE windowMode, PositionSize positionSize )
100 {
101   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
102   if( internal )
103   {
104     if( argc && ( *argc > 0 ) )
105     {
106       internal->GetWindow().SetClass( (*argv)[0], "" );
107     }
108     internal->SetStyleSheet( stylesheet );
109
110     internal->GetWindow().SetTransparency( ( windowMode == Application::OPAQUE ? false : true ) );
111     internal->GetWindow().SetSize( Window::WindowSize( positionSize.width, positionSize.height ) );
112     internal->GetWindow().SetPosition( Window::WindowPosition( positionSize.x, positionSize.y ) );
113
114     return Application( internal.Get() );
115   }
116   else
117   {
118     internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode, positionSize, Internal::Adaptor::Framework::NORMAL );
119     return Application( internal.Get() );
120   }
121 }
122
123 Application::~Application()
124 {
125 }
126
127 Application::Application()
128 {
129 }
130
131 Application::Application(const Application& application)
132 : BaseHandle(application)
133 {
134 }
135
136 Application& Application::operator=(const Application& application)
137 {
138   if( *this != application )
139   {
140     BaseHandle::operator=( application );
141   }
142   return *this;
143 }
144
145 void Application::MainLoop()
146 {
147   Internal::Adaptor::GetImplementation(*this).MainLoop(Configuration::APPLICATION_HANDLES_CONTEXT_LOSS);
148 }
149
150 void Application::MainLoop(Configuration::ContextLoss configuration)
151 {
152   Internal::Adaptor::GetImplementation(*this).MainLoop(configuration);
153 }
154
155 void Application::Lower()
156 {
157   Internal::Adaptor::GetImplementation(*this).Lower();
158 }
159
160 void Application::Quit()
161 {
162   Internal::Adaptor::GetImplementation(*this).Quit();
163 }
164
165 bool Application::AddIdle( CallbackBase* callback )
166 {
167   return Internal::Adaptor::GetImplementation(*this).AddIdle( callback, false );
168 }
169
170 Window Application::GetWindow()
171 {
172   return Internal::Adaptor::GetImplementation(*this).GetWindow();
173 }
174
175 void Application::ReplaceWindow(PositionSize windowPosition, const std::string& name)
176 {
177   Internal::Adaptor::GetImplementation(*this).ReplaceWindow(windowPosition, name);
178 }
179
180 std::string Application::GetResourcePath()
181 {
182   return Internal::Adaptor::Application::GetResourcePath();
183 }
184
185 std::string Application::GetRegion() const
186 {
187   return Internal::Adaptor::GetImplementation(*this).GetRegion();
188 }
189
190 std::string Application::GetLanguage() const
191 {
192   return Internal::Adaptor::GetImplementation(*this).GetLanguage();
193 }
194
195 void Application::SetViewMode( ViewMode /*viewMode*/ )
196 {
197 }
198
199 ViewMode Application::GetViewMode() const
200 {
201   return ViewMode::MONO;
202 }
203
204 void Application::SetStereoBase( float /*stereoBase*/ )
205 {
206 }
207
208 float Application::GetStereoBase() const
209 {
210   return 0.f;
211 }
212
213 Application::AppSignalType& Application::InitSignal()
214 {
215   return Internal::Adaptor::GetImplementation(*this).InitSignal();
216 }
217
218 Application::AppSignalType& Application::TerminateSignal()
219 {
220   return Internal::Adaptor::GetImplementation(*this).TerminateSignal();
221 }
222
223 Application::AppSignalType& Application::PauseSignal()
224 {
225   return Internal::Adaptor::GetImplementation(*this).PauseSignal();
226 }
227
228 Application::AppSignalType& Application::ResumeSignal()
229 {
230   return Internal::Adaptor::GetImplementation(*this).ResumeSignal();
231 }
232
233 Application::AppSignalType& Application::ResetSignal()
234 {
235   return Internal::Adaptor::GetImplementation(*this).ResetSignal();
236 }
237
238 Application::AppSignalType& Application::ResizeSignal()
239 {
240   DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: ResizeSignal() is deprecated and will be removed from next release. Use Window::ResizedSignal() instead.\n" );
241
242   return Internal::Adaptor::GetImplementation(*this).ResizeSignal();
243 }
244
245 Application::AppControlSignalType & Application::AppControlSignal()
246 {
247   return Internal::Adaptor::GetImplementation(*this).AppControlSignal();
248 }
249
250 Application::AppSignalType& Application::LanguageChangedSignal()
251 {
252   return Internal::Adaptor::GetImplementation(*this).LanguageChangedSignal();
253 }
254
255 Application::AppSignalType& Application::RegionChangedSignal()
256 {
257   return Internal::Adaptor::GetImplementation(*this).RegionChangedSignal();
258 }
259
260 Application::AppSignalType& Application::BatteryLowSignal()
261 {
262   DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: BatteryLowSignal() is deprecated and will be removed from next release. Use Application::LowBatterySignal() instead.\n" );
263   return Internal::Adaptor::GetImplementation(*this).BatteryLowSignal();
264 }
265
266 Application::AppSignalType& Application::MemoryLowSignal()
267 {
268   DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: MemoryLowSignal() is deprecated and will be removed from next release. Use Application::LowMemorySignal() instead.\n" );
269   return Internal::Adaptor::GetImplementation(*this).MemoryLowSignal();
270 }
271
272 Application::LowBatterySignalType& Application::LowBatterySignal()
273 {
274   return Internal::Adaptor::GetImplementation(*this).LowBatterySignal();
275 }
276
277 Application::LowMemorySignalType& Application::LowMemorySignal()
278 {
279   return Internal::Adaptor::GetImplementation(*this).LowMemorySignal();
280 }
281
282 Application::Application(Internal::Adaptor::Application* application)
283 : BaseHandle(application)
284 {
285 }
286
287
288 } // namespace Dali