[dali_1.0.5] Merge branch 'tizen'
[platform/core/uifw/dali-adaptor.git] / adaptors / public-api / adaptor-framework / application.cpp
1 /*
2  * Copyright (c) 2014 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 "application.h"
20
21 // EXTERNAL INCLUDES
22 #include <orientation.h>
23 #include <dali/integration-api/debug.h>
24
25 // INTERNAL INCLUDES
26 #include <application-impl.h>
27 #include <orientation-impl.h>
28
29 namespace Dali
30 {
31
32 Application Application::New( int* argc, char **argv[] )
33 {
34   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, "Dali Application", DeviceLayout::DEFAULT_BASE_LAYOUT, OPAQUE );
35   return Application(internal.Get());
36 }
37
38 Application Application::New( int* argc, char **argv[], const std::string& name )
39 {
40   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, name, DeviceLayout::DEFAULT_BASE_LAYOUT, OPAQUE );
41   return Application(internal.Get());
42 }
43
44 Application Application::New( int* argc, char **argv[], const std::string& name, WINDOW_MODE windowMode )
45 {
46   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, name, DeviceLayout::DEFAULT_BASE_LAYOUT, windowMode );
47   return Application(internal.Get());
48 }
49
50 Application Application::New(int* argc, char **argv[], const DeviceLayout& baseLayout)
51 {
52   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, "Dali Application", baseLayout, OPAQUE );
53   return Application(internal.Get());
54 }
55
56 Application Application::New(int* argc, char **argv[], const std::string& name, const DeviceLayout& baseLayout)
57 {
58   Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::New( argc, argv, name, baseLayout, OPAQUE );
59   return Application(internal.Get());
60 }
61
62 Application::~Application()
63 {
64 }
65
66 Application::Application(const Application& application)
67 : BaseHandle(application)
68 {
69 }
70
71 Application& Application::operator=(const Application& application)
72 {
73   if( *this != application )
74   {
75     BaseHandle::operator=( application );
76   }
77   return *this;
78 }
79
80 void Application::MainLoop()
81 {
82   Internal::Adaptor::GetImplementation(*this).MainLoop();
83 }
84
85 void Application::Lower()
86 {
87   Internal::Adaptor::GetImplementation(*this).Lower();
88 }
89
90 void Application::Quit()
91 {
92   Internal::Adaptor::GetImplementation(*this).Quit();
93 }
94
95 Orientation Application::GetOrientation()
96 {
97   Window window = GetWindow();
98   if( window )
99   {
100     return window.GetOrientation();
101   }
102   return Orientation();
103 }
104
105 bool Application::AddIdle(boost::function<void(void)> callBack)
106 {
107   return Internal::Adaptor::GetImplementation(*this).AddIdle(callBack);
108 }
109
110 Window Application::GetWindow()
111 {
112   return Internal::Adaptor::GetImplementation(*this).GetWindow();
113 }
114
115 Application Application::Get()
116 {
117   return Internal::Adaptor::Application::Get();
118 }
119
120 void Application::SetViewMode( ViewMode viewMode )
121 {
122   Internal::Adaptor::GetImplementation(*this).SetViewMode( viewMode );
123 }
124
125 ViewMode Application::GetViewMode() const
126 {
127   return Internal::Adaptor::GetImplementation(*this).GetViewMode();
128 }
129
130 void Application::SetStereoBase( float stereoBase )
131 {
132   Internal::Adaptor::GetImplementation(*this).SetStereoBase( stereoBase );
133 }
134
135 float Application::GetStereoBase() const
136 {
137   return Internal::Adaptor::GetImplementation(*this).GetStereoBase();
138 }
139
140 Application::AppSignalV2& Application::InitSignal()
141 {
142   return Internal::Adaptor::GetImplementation(*this).InitSignal();
143 }
144
145 Application::AppSignalV2& Application::TerminateSignal()
146 {
147   return Internal::Adaptor::GetImplementation(*this).TerminateSignal();
148 }
149
150 Application::AppSignalV2& Application::PauseSignal()
151 {
152   return Internal::Adaptor::GetImplementation(*this).PauseSignal();
153 }
154
155 Application::AppSignalV2& Application::ResumeSignal()
156 {
157   return Internal::Adaptor::GetImplementation(*this).ResumeSignal();
158 }
159
160 Application::AppSignalV2& Application::ResetSignal()
161 {
162   return Internal::Adaptor::GetImplementation(*this).ResetSignal();
163 }
164
165 Application::AppSignalV2& Application::ResizeSignal()
166 {
167   return Internal::Adaptor::GetImplementation(*this).ResizeSignal();
168 }
169
170 Application::AppSignalV2& Application::LanguageChangedSignal()
171 {
172   return Internal::Adaptor::GetImplementation(*this).LanguageChangedSignal();
173 }
174
175 Application::Application(Internal::Adaptor::Application* application)
176 : BaseHandle(application)
177 {
178 }
179
180
181 } // namespace Dali