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 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: DALi is deprecated and will be removed from next version. Please use NUI(C# interface of DALi).\n For more information on NUI, see the NUI quick start page : https://docs.tizen.org/application/dotnet/get-started/nui/quickstart/ \n" );
33 return New( NULL, NULL );
36 Application Application::New( int* argc, char **argv[] )
38 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: DALi is deprecated and will be removed from next version. Please use NUI(C# interface of DALi).\n For more information on NUI, see the NUI quick start page : https://docs.tizen.org/application/dotnet/get-started/nui/quickstart/ \n" );
39 Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
42 // pre-initialized application
43 internal->SetCommandLineOptions( argc, argv );
44 if( argc && ( *argc > 0 ) )
46 internal->GetWindow().SetClass( (*argv)[0], "" );
49 return Application( internal.Get() );
53 internal = Internal::Adaptor::Application::New( argc, argv, "", OPAQUE, PositionSize(),
54 Internal::Adaptor::Framework::NORMAL);
55 return Application(internal.Get());
59 Application Application::New( int* argc, char **argv[], const std::string& stylesheet )
61 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: DALi is deprecated and will be removed from next version. Please use NUI(C# interface of DALi).\n For more information on NUI, see the NUI quick start page : https://docs.tizen.org/application/dotnet/get-started/nui/quickstart/ \n" );
62 Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
65 // pre-initialized application
66 internal->SetCommandLineOptions( argc, argv );
67 if( argc && ( *argc > 0 ) )
69 internal->GetWindow().SetClass( (*argv)[0], "" );
71 internal->SetStyleSheet( stylesheet );
73 return Application( internal.Get() );
77 internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, OPAQUE, PositionSize(),
78 Internal::Adaptor::Framework::NORMAL);
79 return Application(internal.Get());
83 Application Application::New( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode )
85 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: DALi is deprecated and will be removed from next version. Please use NUI(C# interface of DALi).\n For more information on NUI, see the NUI quick start page : https://docs.tizen.org/application/dotnet/get-started/nui/quickstart/ \n" );
86 Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
89 // pre-initialized application
90 internal->SetCommandLineOptions( argc, argv );
91 if( argc && ( *argc > 0 ) )
93 internal->GetWindow().SetClass( (*argv)[0], "" );
95 internal->SetStyleSheet( stylesheet );
97 internal->GetWindow().SetTransparency( ( windowMode == Application::OPAQUE ? false : true ) );
99 return Application( internal.Get() );
103 internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode, PositionSize(),
104 Internal::Adaptor::Framework::NORMAL);
105 return Application(internal.Get());
109 Application Application::New( int* argc, char **argv[], const std::string& stylesheet, Application::WINDOW_MODE windowMode, PositionSize positionSize )
111 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: DALi is deprecated and will be removed from next version. Please use NUI(C# interface of DALi).\n For more information on NUI, see the NUI quick start page : https://docs.tizen.org/application/dotnet/get-started/nui/quickstart/ \n" );
112 Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
115 // pre-initialized application
116 internal->SetCommandLineOptions( argc, argv );
117 if( argc && ( *argc > 0 ) )
119 internal->GetWindow().SetClass( (*argv)[0], "" );
121 internal->SetStyleSheet( stylesheet );
123 internal->GetWindow().SetTransparency( ( windowMode == Application::OPAQUE ? false : true ) );
124 internal->GetWindow().SetSize( Window::WindowSize( positionSize.width, positionSize.height ) );
125 internal->GetWindow().SetPosition( Window::WindowPosition( positionSize.x, positionSize.y ) );
127 return Application( internal.Get() );
131 internal = Internal::Adaptor::Application::New( argc, argv, stylesheet, windowMode, positionSize, Internal::Adaptor::Framework::NORMAL );
132 return Application( internal.Get() );
136 Application::~Application()
140 Application::Application()
144 Application::Application(const Application& application)
145 : BaseHandle(application)
149 Application& Application::operator=(const Application& application)
151 if( *this != application )
153 BaseHandle::operator=( application );
158 void Application::MainLoop()
160 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: DALi is deprecated and will be removed from next version. Please use NUI(C# interface of DALi).\n For more information on NUI, see the NUI quick start page : https://docs.tizen.org/application/dotnet/get-started/nui/quickstart/ \n" );
161 Internal::Adaptor::GetImplementation(*this).MainLoop(Configuration::APPLICATION_HANDLES_CONTEXT_LOSS);
164 void Application::MainLoop(Configuration::ContextLoss configuration)
166 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: DALi is deprecated and will be removed from next version. Please use NUI(C# interface of DALi).\n For more information on NUI, see the NUI quick start page : https://docs.tizen.org/application/dotnet/get-started/nui/quickstart/ \n" );
167 Internal::Adaptor::GetImplementation(*this).MainLoop(configuration);
170 void Application::Lower()
172 Internal::Adaptor::GetImplementation(*this).Lower();
175 void Application::Quit()
177 Internal::Adaptor::GetImplementation(*this).Quit();
180 bool Application::AddIdle( CallbackBase* callback )
182 return Internal::Adaptor::GetImplementation(*this).AddIdle( callback, false );
185 Window Application::GetWindow()
187 return Internal::Adaptor::GetImplementation(*this).GetWindow();
190 void Application::ReplaceWindow(PositionSize windowPosition, const std::string& name)
192 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ReplaceWindow is deprecated and will be removed from next release.\n" );
194 Internal::Adaptor::GetImplementation(*this).ReplaceWindow(windowPosition, name);
197 std::string Application::GetResourcePath()
199 return Internal::Adaptor::Application::GetResourcePath();
202 std::string Application::GetRegion() const
204 return Internal::Adaptor::GetImplementation(*this).GetRegion();
207 std::string Application::GetLanguage() const
209 return Internal::Adaptor::GetImplementation(*this).GetLanguage();
212 void Application::SetViewMode( ViewMode viewMode )
214 Internal::Adaptor::GetImplementation(*this).SetViewMode( viewMode );
217 ViewMode Application::GetViewMode() const
219 return Internal::Adaptor::GetImplementation(*this).GetViewMode();
222 void Application::SetStereoBase( float stereoBase )
224 Internal::Adaptor::GetImplementation(*this).SetStereoBase( stereoBase );
227 float Application::GetStereoBase() const
229 return Internal::Adaptor::GetImplementation(*this).GetStereoBase();
232 Application::AppSignalType& Application::InitSignal()
234 return Internal::Adaptor::GetImplementation(*this).InitSignal();
237 Application::AppSignalType& Application::TerminateSignal()
239 return Internal::Adaptor::GetImplementation(*this).TerminateSignal();
242 Application::AppSignalType& Application::PauseSignal()
244 return Internal::Adaptor::GetImplementation(*this).PauseSignal();
247 Application::AppSignalType& Application::ResumeSignal()
249 return Internal::Adaptor::GetImplementation(*this).ResumeSignal();
252 Application::AppSignalType& Application::ResetSignal()
254 return Internal::Adaptor::GetImplementation(*this).ResetSignal();
257 Application::AppSignalType& Application::ResizeSignal()
259 DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: ResizeSignal() is deprecated and will be removed from next release. Use Window::ResizedSignal() instead.\n" );
261 return Internal::Adaptor::GetImplementation(*this).ResizeSignal();
264 Application::AppControlSignalType & Application::AppControlSignal()
266 return Internal::Adaptor::GetImplementation(*this).AppControlSignal();
269 Application::AppSignalType& Application::LanguageChangedSignal()
271 return Internal::Adaptor::GetImplementation(*this).LanguageChangedSignal();
274 Application::AppSignalType& Application::RegionChangedSignal()
276 return Internal::Adaptor::GetImplementation(*this).RegionChangedSignal();
279 Application::AppSignalType& Application::BatteryLowSignal()
281 DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: BatteryLowSignal() is deprecated and will be removed from next release. Use Application::LowBatterySignal() instead.\n" );
282 return Internal::Adaptor::GetImplementation(*this).BatteryLowSignal();
285 Application::AppSignalType& Application::MemoryLowSignal()
287 DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: MemoryLowSignal() is deprecated and will be removed from next release. Use Application::LowMemorySignal() instead.\n" );
288 return Internal::Adaptor::GetImplementation(*this).MemoryLowSignal();
291 Application::LowBatterySignalType& Application::LowBatterySignal()
293 return Internal::Adaptor::GetImplementation(*this).LowBatterySignal();
296 Application::LowMemorySignalType& Application::LowMemorySignal()
298 return Internal::Adaptor::GetImplementation(*this).LowMemorySignal();
301 Application::Application(Internal::Adaptor::Application* application)
302 : BaseHandle(application)