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 "application.h"
22 #include <dali/integration-api/debug.h>
25 #include <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 DevelWindow::SetTransparency( internal->GetWindow(), ( 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()
103 Application::Application()
107 Application::Application(const Application& application)
108 : BaseHandle(application)
112 Application& Application::operator=(const Application& application)
114 if( *this != application )
116 BaseHandle::operator=( application );
121 void Application::MainLoop()
123 Internal::Adaptor::GetImplementation(*this).MainLoop(Configuration::APPLICATION_HANDLES_CONTEXT_LOSS);
126 void Application::MainLoop(Configuration::ContextLoss configuration)
128 Internal::Adaptor::GetImplementation(*this).MainLoop(configuration);
131 void Application::Lower()
133 Internal::Adaptor::GetImplementation(*this).Lower();
136 void Application::Quit()
138 Internal::Adaptor::GetImplementation(*this).Quit();
141 bool Application::AddIdle( CallbackBase* callback )
143 return Internal::Adaptor::GetImplementation(*this).AddIdle( callback );
146 Window Application::GetWindow()
148 return Internal::Adaptor::GetImplementation(*this).GetWindow();
151 void Application::ReplaceWindow(PositionSize windowPosition, const std::string& name)
153 Internal::Adaptor::GetImplementation(*this).ReplaceWindow(windowPosition, name);
156 std::string Application::GetResourcePath()
158 return Internal::Adaptor::Application::GetResourcePath();
161 void Application::SetViewMode( ViewMode viewMode )
163 Internal::Adaptor::GetImplementation(*this).SetViewMode( viewMode );
166 ViewMode Application::GetViewMode() const
168 return Internal::Adaptor::GetImplementation(*this).GetViewMode();
171 void Application::SetStereoBase( float stereoBase )
173 Internal::Adaptor::GetImplementation(*this).SetStereoBase( stereoBase );
176 float Application::GetStereoBase() const
178 return Internal::Adaptor::GetImplementation(*this).GetStereoBase();
181 Application::AppSignalType& Application::InitSignal()
183 return Internal::Adaptor::GetImplementation(*this).InitSignal();
186 Application::AppSignalType& Application::TerminateSignal()
188 return Internal::Adaptor::GetImplementation(*this).TerminateSignal();
191 Application::AppSignalType& Application::PauseSignal()
193 return Internal::Adaptor::GetImplementation(*this).PauseSignal();
196 Application::AppSignalType& Application::ResumeSignal()
198 return Internal::Adaptor::GetImplementation(*this).ResumeSignal();
201 Application::AppSignalType& Application::ResetSignal()
203 return Internal::Adaptor::GetImplementation(*this).ResetSignal();
206 Application::AppSignalType& Application::ResizeSignal()
208 DALI_LOG_WARNING_NOFN( "DEPRECATION WARNING: ResizeSignal() is deprecated and will be removed from next release. Use Window::ResizedSignal() instead.\n" );
210 return Internal::Adaptor::GetImplementation(*this).ResizeSignal();
213 Application::AppControlSignalType & Application::AppControlSignal()
215 return Internal::Adaptor::GetImplementation(*this).AppControlSignal();
218 Application::AppSignalType& Application::LanguageChangedSignal()
220 return Internal::Adaptor::GetImplementation(*this).LanguageChangedSignal();
223 Application::AppSignalType& Application::RegionChangedSignal()
225 return Internal::Adaptor::GetImplementation(*this).RegionChangedSignal();
228 Application::AppSignalType& Application::BatteryLowSignal()
230 return Internal::Adaptor::GetImplementation(*this).BatteryLowSignal();
233 Application::AppSignalType& Application::MemoryLowSignal()
235 return Internal::Adaptor::GetImplementation(*this).MemoryLowSignal();
238 Application::Application(Internal::Adaptor::Application* application)
239 : BaseHandle(application)