2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/public-api/adaptor-framework/application.h>
22 #include <dali/integration-api/debug.h>
25 #include <dali/internal/adaptor/common/application-impl.h>
30 Application Application::New()
32 return New( NULL, NULL );
35 Application Application::New( int* argc, char **argv[] )
37 Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
40 if( argc && ( *argc > 0 ) )
42 internal->GetWindow().SetClass( (*argv)[0], "" );
45 return Application( internal.Get() );
49 internal = Internal::Adaptor::Application::New( argc, argv, "", OPAQUE, PositionSize(),
50 Internal::Adaptor::Framework::NORMAL);
51 return Application(internal.Get());
55 Application Application::New( int* argc, char **argv[], const std::string& stylesheet )
57 Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
60 if( argc && ( *argc > 0 ) )
62 internal->GetWindow().SetClass( (*argv)[0], "" );
64 internal->SetStyleSheet( stylesheet );
66 return Application( internal.Get() );
70 internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, OPAQUE, PositionSize(),
71 Internal::Adaptor::Framework::NORMAL);
72 return Application(internal.Get());
76 Application Application::New( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode )
78 Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
81 if( argc && ( *argc > 0 ) )
83 internal->GetWindow().SetClass( (*argv)[0], "" );
85 internal->SetStyleSheet( stylesheet );
87 internal->GetWindow().SetTransparency( ( windowMode == Application::OPAQUE ? false : true ) );
89 return Application( internal.Get() );
93 internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode, PositionSize(),
94 Internal::Adaptor::Framework::NORMAL);
95 return Application(internal.Get());
99 Application Application::New( int* argc, char **argv[], const std::string& stylesheet, Application::WINDOW_MODE windowMode, PositionSize positionSize )
101 Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
104 if( argc && ( *argc > 0 ) )
106 internal->GetWindow().SetClass( (*argv)[0], "" );
108 internal->SetStyleSheet( stylesheet );
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 ) );
114 return Application( internal.Get() );
118 internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode, positionSize, Internal::Adaptor::Framework::NORMAL );
119 return Application( internal.Get() );
123 Application::~Application()
127 Application::Application()
131 Application::Application(const Application& application)
132 : BaseHandle(application)
136 Application& Application::operator=(const Application& application)
138 if( *this != application )
140 BaseHandle::operator=( application );
145 void Application::MainLoop()
147 Internal::Adaptor::GetImplementation(*this).MainLoop(Configuration::APPLICATION_HANDLES_CONTEXT_LOSS);
150 void Application::MainLoop(Configuration::ContextLoss configuration)
152 Internal::Adaptor::GetImplementation(*this).MainLoop(configuration);
155 void Application::Lower()
157 Internal::Adaptor::GetImplementation(*this).Lower();
160 void Application::Quit()
162 Internal::Adaptor::GetImplementation(*this).Quit();
165 bool Application::AddIdle( CallbackBase* callback )
167 return Internal::Adaptor::GetImplementation(*this).AddIdle( callback, false );
170 Window Application::GetWindow()
172 return Internal::Adaptor::GetImplementation(*this).GetWindow();
175 void Application::ReplaceWindow(PositionSize windowPosition, const std::string& name)
177 Internal::Adaptor::GetImplementation(*this).ReplaceWindow(windowPosition, name);
180 std::string Application::GetResourcePath()
182 return Internal::Adaptor::Application::GetResourcePath();
185 std::string Application::GetRegion() const
187 return Internal::Adaptor::GetImplementation(*this).GetRegion();
190 std::string Application::GetLanguage() const
192 return Internal::Adaptor::GetImplementation(*this).GetLanguage();
195 void Application::SetViewMode( ViewMode viewMode )
197 Internal::Adaptor::GetImplementation(*this).SetViewMode( viewMode );
200 ViewMode Application::GetViewMode() const
202 return Internal::Adaptor::GetImplementation(*this).GetViewMode();
205 void Application::SetStereoBase( float stereoBase )
207 Internal::Adaptor::GetImplementation(*this).SetStereoBase( stereoBase );
210 float Application::GetStereoBase() const
212 return Internal::Adaptor::GetImplementation(*this).GetStereoBase();
215 Application::AppSignalType& Application::InitSignal()
217 return Internal::Adaptor::GetImplementation(*this).InitSignal();
220 Application::AppSignalType& Application::TerminateSignal()
222 return Internal::Adaptor::GetImplementation(*this).TerminateSignal();
225 Application::AppSignalType& Application::PauseSignal()
227 return Internal::Adaptor::GetImplementation(*this).PauseSignal();
230 Application::AppSignalType& Application::ResumeSignal()
232 return Internal::Adaptor::GetImplementation(*this).ResumeSignal();
235 Application::AppSignalType& Application::ResetSignal()
237 return Internal::Adaptor::GetImplementation(*this).ResetSignal();
240 Application::AppSignalType& Application::ResizeSignal()
242 DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: ResizeSignal() is deprecated and will be removed from next release. Use Window::ResizedSignal() instead.\n" );
244 return Internal::Adaptor::GetImplementation(*this).ResizeSignal();
247 Application::AppControlSignalType & Application::AppControlSignal()
249 return Internal::Adaptor::GetImplementation(*this).AppControlSignal();
252 Application::AppSignalType& Application::LanguageChangedSignal()
254 return Internal::Adaptor::GetImplementation(*this).LanguageChangedSignal();
257 Application::AppSignalType& Application::RegionChangedSignal()
259 return Internal::Adaptor::GetImplementation(*this).RegionChangedSignal();
262 Application::AppSignalType& Application::BatteryLowSignal()
264 DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: BatteryLowSignal() is deprecated and will be removed from next release. Use Application::LowBatterySignal() instead.\n" );
265 return Internal::Adaptor::GetImplementation(*this).BatteryLowSignal();
268 Application::AppSignalType& Application::MemoryLowSignal()
270 DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: MemoryLowSignal() is deprecated and will be removed from next release. Use Application::LowMemorySignal() instead.\n" );
271 return Internal::Adaptor::GetImplementation(*this).MemoryLowSignal();
274 Application::LowBatterySignalType& Application::LowBatterySignal()
276 return Internal::Adaptor::GetImplementation(*this).LowBatterySignal();
279 Application::LowMemorySignalType& Application::LowMemorySignal()
281 return Internal::Adaptor::GetImplementation(*this).LowMemorySignal();
284 Application::Application(Internal::Adaptor::Application* application)
285 : BaseHandle(application)