98ea7dcd5eb0eef3357fd5006b8db9794b31bd5b
[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/adaptors/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/adaptors/adaptor.h>
29 #include <toolkit-adaptor-impl.h>
30
31 namespace Dali
32 {
33
34 ///////////////////////////////////////////////////////////////////////////////
35 //
36 // Dali::Internal::Adaptor::SceneHolder Stub
37 //
38 ///////////////////////////////////////////////////////////////////////////////
39
40 namespace Internal
41 {
42
43 namespace Adaptor
44 {
45
46 SceneHolder::SceneHolder( const Dali::Rect<int>& positionSize )
47 : mRenderSurface( positionSize ),
48   mScene( Dali::Integration::Scene::New( mRenderSurface ) )
49 {
50 }
51
52 SceneHolder::~SceneHolder()
53 {
54 }
55
56 void SceneHolder::SetBackgroundColor( Vector4 color )
57 {
58   return mScene.SetBackgroundColor( color );
59 }
60
61 Vector4 SceneHolder::GetBackgroundColor() const
62 {
63   return mScene.GetBackgroundColor();
64 }
65
66 void SceneHolder::FeedTouchPoint( Dali::TouchPoint& point, int timeStamp )
67 {
68 }
69
70 void SceneHolder::FeedWheelEvent( Dali::WheelEvent& wheelEvent )
71 {
72 }
73
74 void SceneHolder::FeedKeyEvent( Dali::KeyEvent& keyEvent )
75 {
76 }
77
78 Dali::Integration::SceneHolder::KeyEventSignalType& SceneHolder::KeyEventSignal()
79 {
80   return mScene.KeyEventSignal();
81 }
82
83 Dali::Integration::SceneHolder::KeyEventGeneratedSignalType& SceneHolder::KeyEventGeneratedSignal()
84 {
85   return mScene.KeyEventGeneratedSignal();
86 }
87
88 Dali::Integration::SceneHolder::TouchSignalType& SceneHolder::TouchSignal()
89 {
90   return mScene.TouchSignal();
91 }
92
93 Dali::Integration::SceneHolder::WheelEventSignalType& SceneHolder::WheelEventSignal()
94 {
95   return mScene.WheelEventSignal();
96 }
97
98 Integration::Scene SceneHolder::GetScene()
99 {
100   return mScene;
101 }
102
103 Integration::RenderSurface& SceneHolder::GetRenderSurface()
104 {
105   return mRenderSurface;
106 }
107
108 } // namespace Adaptor
109
110 } // namespace Internal
111
112 ///////////////////////////////////////////////////////////////////////////////
113 //
114 // Dali::Integration::SceneHolder Stub
115 //
116 ///////////////////////////////////////////////////////////////////////////////
117
118 namespace Integration
119 {
120
121 SceneHolder::SceneHolder()
122 {
123   // Dali::Internal::Adaptor::Adaptor::Get().WindowCreatedSignal().Emit( *this );
124 }
125
126 SceneHolder::~SceneHolder()
127 {
128 }
129
130 SceneHolder::SceneHolder( const SceneHolder& handle )
131 : BaseHandle(handle)
132 {
133 }
134
135 SceneHolder::SceneHolder( Internal::Adaptor::SceneHolder* internal )
136 : BaseHandle(internal)
137 {
138 }
139
140 SceneHolder& SceneHolder::operator=( const SceneHolder& rhs )
141 {
142   BaseHandle::operator=(rhs);
143   return *this;
144 }
145
146 void SceneHolder::Add( Actor actor )
147 {
148 }
149
150 void SceneHolder::Remove( Actor actor )
151 {
152 }
153
154 Dali::Layer SceneHolder::GetRootLayer() const
155 {
156   return Dali::Stage::GetCurrent().GetRootLayer();
157 }
158
159 void SceneHolder::SetBackgroundColor( Vector4 color )
160 {
161   GetImplementation( *this ).SetBackgroundColor( color );
162 }
163
164 Vector4 SceneHolder::GetBackgroundColor() const
165 {
166   return GetImplementation( *this ).GetBackgroundColor();
167 }
168
169 void SceneHolder::FeedTouchPoint( Dali::TouchPoint& point, int timeStamp )
170 {
171   GetImplementation( *this ).FeedTouchPoint( point, timeStamp );
172 }
173
174 void SceneHolder::FeedWheelEvent( Dali::WheelEvent& wheelEvent )
175 {
176   GetImplementation( *this ).FeedWheelEvent( wheelEvent );
177 }
178
179 void SceneHolder::FeedKeyEvent( Dali::KeyEvent& keyEvent )
180 {
181   GetImplementation( *this ).FeedKeyEvent( keyEvent );
182 }
183
184 SceneHolder::KeyEventSignalType& SceneHolder::KeyEventSignal()
185 {
186   return GetImplementation( *this ).KeyEventSignal();
187 }
188
189 SceneHolder::KeyEventGeneratedSignalType& SceneHolder::KeyEventGeneratedSignal()
190 {
191   return GetImplementation( *this ).KeyEventGeneratedSignal();
192 }
193
194 SceneHolder::TouchSignalType& SceneHolder::TouchSignal()
195 {
196   return GetImplementation( *this ).TouchSignal();
197 }
198
199 SceneHolder::WheelEventSignalType& SceneHolder::WheelEventSignal()
200 {
201   return GetImplementation( *this ).WheelEventSignal();
202 }
203
204 SceneHolder SceneHolder::Get( Actor actor )
205 {
206   return SceneHolder();
207 }
208
209 } // Integration
210
211 } // Dali