2 * Copyright (c) 2014 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 <orientation.h>
23 #include <dali/integration-api/debug.h>
26 #include <application-impl.h>
27 #include <orientation-impl.h>
32 Application Application::New()
34 return New( NULL, NULL );
37 Application Application::New( int* argc, char **argv[] )
39 Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, "Dali Application", DeviceLayout::DEFAULT_BASE_LAYOUT, OPAQUE );
40 return Application(internal.Get());
43 Application Application::New( int* argc, char **argv[], const std::string& name )
45 Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, name, DeviceLayout::DEFAULT_BASE_LAYOUT, OPAQUE );
46 return Application(internal.Get());
49 Application Application::New( int* argc, char **argv[], const std::string& name, WINDOW_MODE windowMode )
51 Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, name, DeviceLayout::DEFAULT_BASE_LAYOUT, windowMode );
52 return Application(internal.Get());
55 Application Application::New(int* argc, char **argv[], const DeviceLayout& baseLayout)
57 Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, "Dali Application", baseLayout, OPAQUE );
58 return Application(internal.Get());
61 Application Application::New(int* argc, char **argv[], const std::string& name, const DeviceLayout& baseLayout)
63 Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, name, baseLayout, OPAQUE );
64 return Application(internal.Get());
67 Application::~Application()
71 Application::Application()
75 Application::Application(const Application& application)
76 : BaseHandle(application)
80 Application& Application::operator=(const Application& application)
82 if( *this != application )
84 BaseHandle::operator=( application );
89 void Application::MainLoop()
91 Internal::Adaptor::GetImplementation(*this).MainLoop(Configuration::APPLICATION_HANDLES_CONTEXT_LOSS);
94 void Application::MainLoop(Configuration::ContextLoss configuration)
96 Internal::Adaptor::GetImplementation(*this).MainLoop(configuration);
99 void Application::Lower()
101 Internal::Adaptor::GetImplementation(*this).Lower();
104 void Application::Quit()
106 Internal::Adaptor::GetImplementation(*this).Quit();
109 Orientation Application::GetOrientation()
111 Window window = GetWindow();
114 return window.GetOrientation();
116 return Orientation();
119 bool Application::AddIdle(boost::function<void(void)> callBack)
121 return Internal::Adaptor::GetImplementation(*this).AddIdle(callBack);
124 Window Application::GetWindow()
126 return Internal::Adaptor::GetImplementation(*this).GetWindow();
129 void Application::ReplaceWindow(PositionSize windowPosition, const std::string& name)
131 Internal::Adaptor::GetImplementation(*this).ReplaceWindow(windowPosition, name);
134 void Application::SetViewMode( ViewMode viewMode )
136 Internal::Adaptor::GetImplementation(*this).SetViewMode( viewMode );
139 ViewMode Application::GetViewMode() const
141 return Internal::Adaptor::GetImplementation(*this).GetViewMode();
144 void Application::SetStereoBase( float stereoBase )
146 Internal::Adaptor::GetImplementation(*this).SetStereoBase( stereoBase );
149 float Application::GetStereoBase() const
151 return Internal::Adaptor::GetImplementation(*this).GetStereoBase();
154 Application::AppSignalV2& Application::InitSignal()
156 return Internal::Adaptor::GetImplementation(*this).InitSignal();
159 Application::AppSignalV2& Application::TerminateSignal()
161 return Internal::Adaptor::GetImplementation(*this).TerminateSignal();
164 Application::AppSignalV2& Application::PauseSignal()
166 return Internal::Adaptor::GetImplementation(*this).PauseSignal();
169 Application::AppSignalV2& Application::ResumeSignal()
171 return Internal::Adaptor::GetImplementation(*this).ResumeSignal();
174 Application::AppSignalV2& Application::ResetSignal()
176 return Internal::Adaptor::GetImplementation(*this).ResetSignal();
179 Application::AppSignalV2& Application::ResizeSignal()
181 return Internal::Adaptor::GetImplementation(*this).ResizeSignal();
184 Application::AppSignalV2& Application::LanguageChangedSignal()
186 return Internal::Adaptor::GetImplementation(*this).LanguageChangedSignal();
189 Application::Application(Internal::Adaptor::Application* application)
190 : BaseHandle(application)