Remove unused Retention policy
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-scene-holder.cpp
1 /*
2  * Copyright (c) 2019 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 #include <dali/integration-api/events/touch-event-integ.h>
19 #include <dali/integration-api/adaptor-framework/scene-holder.h>
20
21 #include <toolkit-scene-holder-impl.h>
22
23 #include <dali/public-api/actors/actor.h>
24 #include <dali/public-api/actors/layer.h>
25 #include <dali/public-api/common/stage.h>
26 #include <dali/public-api/object/base-object.h>
27
28 #include <dali/integration-api/adaptor-framework/adaptor.h>
29 #include <toolkit-adaptor-impl.h>
30
31 using AdaptorImpl = Dali::Internal::Adaptor::Adaptor;
32
33 namespace Dali
34 {
35
36 ///////////////////////////////////////////////////////////////////////////////
37 //
38 // Dali::Internal::Adaptor::SceneHolder Stub
39 //
40 ///////////////////////////////////////////////////////////////////////////////
41
42 namespace Internal
43 {
44
45 namespace Adaptor
46 {
47
48 SceneHolder::SceneHolder( const Dali::Rect<int>& positionSize )
49 : mRenderSurface( positionSize ),
50   mScene( Dali::Integration::Scene::New( mRenderSurface ) )
51 {
52 }
53
54 SceneHolder::~SceneHolder()
55 {
56   if ( Dali::Adaptor::IsAvailable() )
57   {
58     AdaptorImpl::GetImpl( AdaptorImpl::Get() ).RemoveWindow( this );
59   }
60 }
61
62 void SceneHolder::Add( Dali::Actor actor )
63 {
64   mScene.Add( actor );
65 }
66
67 void SceneHolder::Remove( Dali::Actor actor )
68 {
69   mScene.Remove( actor );
70 }
71
72 Dali::Layer SceneHolder::GetRootLayer() const
73 {
74   return mScene.GetRootLayer();
75 }
76
77 void SceneHolder::SetBackgroundColor( Vector4 color )
78 {
79   return mScene.SetBackgroundColor( color );
80 }
81
82 Vector4 SceneHolder::GetBackgroundColor() const
83 {
84   return mScene.GetBackgroundColor();
85 }
86
87 void SceneHolder::FeedTouchPoint( Dali::TouchPoint& point, int timeStamp )
88 {
89 }
90
91 void SceneHolder::FeedWheelEvent( Dali::WheelEvent& wheelEvent )
92 {
93 }
94
95 void SceneHolder::FeedKeyEvent( Dali::KeyEvent& keyEvent )
96 {
97 }
98
99 Dali::Integration::SceneHolder::KeyEventSignalType& SceneHolder::KeyEventSignal()
100 {
101   return mScene.KeyEventSignal();
102 }
103
104 Dali::Integration::SceneHolder::KeyEventGeneratedSignalType& SceneHolder::KeyEventGeneratedSignal()
105 {
106   return mScene.KeyEventGeneratedSignal();
107 }
108
109 Dali::Integration::SceneHolder::TouchSignalType& SceneHolder::TouchSignal()
110 {
111   return mScene.TouchSignal();
112 }
113
114 Dali::Integration::SceneHolder::WheelEventSignalType& SceneHolder::WheelEventSignal()
115 {
116   return mScene.WheelEventSignal();
117 }
118
119 Integration::Scene SceneHolder::GetScene()
120 {
121   return mScene;
122 }
123
124 Integration::RenderSurface& SceneHolder::GetRenderSurface()
125 {
126   return mRenderSurface;
127 }
128
129 } // namespace Adaptor
130
131 } // namespace Internal
132
133 ///////////////////////////////////////////////////////////////////////////////
134 //
135 // Dali::Integration::SceneHolder Stub
136 //
137 ///////////////////////////////////////////////////////////////////////////////
138
139 namespace Integration
140 {
141
142 SceneHolder::SceneHolder()
143 {
144   // Dali::Internal::Adaptor::Adaptor::Get().WindowCreatedSignal().Emit( *this );
145 }
146
147 SceneHolder::~SceneHolder()
148 {
149 }
150
151 SceneHolder::SceneHolder( const SceneHolder& handle )
152 : BaseHandle(handle)
153 {
154 }
155
156 SceneHolder::SceneHolder( Internal::Adaptor::SceneHolder* internal )
157 : BaseHandle(internal)
158 {
159 }
160
161 SceneHolder& SceneHolder::operator=( const SceneHolder& rhs )
162 {
163   BaseHandle::operator=(rhs);
164   return *this;
165 }
166
167 Dali::Integration::SceneHolder SceneHolder::Get( Dali::Actor actor )
168 {
169   Internal::Adaptor::SceneHolder* sceneHolderImpl = nullptr;
170
171   if ( Dali::Adaptor::IsAvailable() )
172   {
173     sceneHolderImpl = AdaptorImpl::GetImpl( AdaptorImpl::Get() ).GetWindow( actor );
174   }
175
176   return Dali::Integration::SceneHolder( sceneHolderImpl );
177 }
178
179 void SceneHolder::Add( Actor actor )
180 {
181   GetImplementation( *this ).Add( actor );
182 }
183
184 void SceneHolder::Remove( Actor actor )
185 {
186   GetImplementation( *this ).Remove( actor );
187 }
188
189 Dali::Layer SceneHolder::GetRootLayer() const
190 {
191   return GetImplementation( *this ).GetRootLayer();
192 }
193
194 void SceneHolder::SetBackgroundColor( Vector4 color )
195 {
196   GetImplementation( *this ).SetBackgroundColor( color );
197 }
198
199 Vector4 SceneHolder::GetBackgroundColor() const
200 {
201   return GetImplementation( *this ).GetBackgroundColor();
202 }
203
204 void SceneHolder::FeedTouchPoint( Dali::TouchPoint& point, int timeStamp )
205 {
206   GetImplementation( *this ).FeedTouchPoint( point, timeStamp );
207 }
208
209 void SceneHolder::FeedWheelEvent( Dali::WheelEvent& wheelEvent )
210 {
211   GetImplementation( *this ).FeedWheelEvent( wheelEvent );
212 }
213
214 void SceneHolder::FeedKeyEvent( Dali::KeyEvent& keyEvent )
215 {
216   GetImplementation( *this ).FeedKeyEvent( keyEvent );
217 }
218
219 SceneHolder::KeyEventSignalType& SceneHolder::KeyEventSignal()
220 {
221   return GetImplementation( *this ).KeyEventSignal();
222 }
223
224 SceneHolder::KeyEventGeneratedSignalType& SceneHolder::KeyEventGeneratedSignal()
225 {
226   return GetImplementation( *this ).KeyEventGeneratedSignal();
227 }
228
229 SceneHolder::TouchSignalType& SceneHolder::TouchSignal()
230 {
231   return GetImplementation( *this ).TouchSignal();
232 }
233
234 SceneHolder::WheelEventSignalType& SceneHolder::WheelEventSignal()
235 {
236   return GetImplementation( *this ).WheelEventSignal();
237 }
238
239 } // Integration
240
241 } // Dali