b0c604769e55e83dcc8c635c2c402feaba1bc73e
[platform/core/uifw/dali-adaptor.git] / dali / internal / adaptor / common / adaptor.cpp
1 /*
2  * Copyright (c) 2017 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 <dali/integration-api/adaptor.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/integration-api/debug.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/adaptor-framework/accessibility-adaptor.h>
26 #include <dali/devel-api/adaptor-framework/style-monitor.h>
27 #include <dali/integration-api/render-surface.h>
28 #include <dali/internal/adaptor/common/adaptor-impl.h>
29
30 namespace Dali
31 {
32
33 Adaptor& Adaptor::New( Window window )
34 {
35   return New( window, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
36 }
37
38 Adaptor& Adaptor::New( Window window, Configuration::ContextLoss configuration )
39 {
40   Adaptor* adaptor = Internal::Adaptor::Adaptor::New( window, configuration, NULL );
41   return *adaptor;
42 }
43
44 Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface )
45 {
46   return New( nativeWindow, surface, Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS );
47 }
48
49 Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface, Configuration::ContextLoss configuration )
50 {
51   Dali::RenderSurface* pSurface = const_cast<Dali::RenderSurface *>(&surface);
52   Adaptor* adaptor = Internal::Adaptor::Adaptor::New( nativeWindow, pSurface, configuration, NULL );
53   return *adaptor;
54 }
55
56 Adaptor::~Adaptor()
57 {
58   delete mImpl;
59 }
60
61 void Adaptor::Start()
62 {
63   mImpl->Start();
64 }
65
66 void Adaptor::Pause()
67 {
68   mImpl->Pause();
69 }
70
71 void Adaptor::Resume()
72 {
73   mImpl->Resume();
74 }
75
76 void Adaptor::Stop()
77 {
78   mImpl->Stop();
79 }
80
81 bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue )
82 {
83   return mImpl->AddIdle( callback, hasReturnValue, false );
84 }
85
86 void Adaptor::RemoveIdle( CallbackBase* callback )
87 {
88   mImpl->RemoveIdle( callback );
89 }
90
91 void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurface& surface )
92 {
93   mImpl->ReplaceSurface(nativeWindow, surface);
94 }
95
96 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
97 {
98   return mImpl->ResizedSignal();
99 }
100
101 Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
102 {
103   return mImpl->LanguageChangedSignal();
104 }
105
106 RenderSurface& Adaptor::GetSurface()
107 {
108   return mImpl->GetSurface();
109 }
110
111 Any Adaptor::GetNativeWindowHandle()
112 {
113   return mImpl->GetNativeWindowHandle();
114 }
115
116 void Adaptor::ReleaseSurfaceLock()
117 {
118   mImpl->ReleaseSurfaceLock();
119 }
120
121 void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender )
122 {
123   mImpl->SetRenderRefreshRate( numberOfVSyncsPerRender );
124 }
125
126 void Adaptor::SetUseHardwareVSync(bool useHardware)
127 {
128   mImpl->SetUseHardwareVSync( useHardware );
129 }
130
131 Adaptor& Adaptor::Get()
132 {
133   return Internal::Adaptor::Adaptor::Get();
134 }
135
136 bool Adaptor::IsAvailable()
137 {
138   return Internal::Adaptor::Adaptor::IsAvailable();
139 }
140
141 void Adaptor::NotifySceneCreated()
142 {
143   mImpl->NotifySceneCreated();
144 }
145
146 void Adaptor::NotifyLanguageChanged()
147 {
148   mImpl->NotifyLanguageChanged();
149 }
150
151 void Adaptor::SetMinimumPinchDistance(float distance)
152 {
153   mImpl->SetMinimumPinchDistance(distance);
154 }
155
156 void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp )
157 {
158   mImpl->FeedTouchPoint(point, timeStamp);
159 }
160
161 void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent )
162 {
163   mImpl->FeedWheelEvent(wheelEvent);
164 }
165
166 void Adaptor::FeedKeyEvent( KeyEvent& keyEvent )
167 {
168   mImpl->FeedKeyEvent(keyEvent);
169 }
170
171 void Adaptor::SceneCreated()
172 {
173   mImpl->SceneCreated();
174 }
175
176 void Adaptor::SetViewMode( ViewMode mode )
177 {
178   mImpl->SetViewMode( mode );
179 }
180
181 void Adaptor::SetStereoBase(  float stereoBase )
182 {
183   mImpl->SetStereoBase( stereoBase );
184 }
185
186 void Adaptor::RenderOnce()
187 {
188   mImpl->RenderOnce();
189 }
190
191 const LogFactoryInterface& Adaptor::GetLogFactory()
192 {
193   return mImpl->GetLogFactory();
194 }
195
196 Adaptor::Adaptor()
197 : mImpl( NULL )
198 {
199 }
200
201 } // namespace Dali