2 * Copyright (c) 2020 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.
18 #include <dali/integration-api/events/touch-event-integ.h>
19 #include <dali/integration-api/adaptor-framework/scene-holder.h>
21 #include <toolkit-scene-holder-impl.h>
23 #include <dali/public-api/actors/actor.h>
24 #include <dali/public-api/actors/layer.h>
25 #include <dali/public-api/object/base-object.h>
27 #include <dali/integration-api/adaptor-framework/adaptor.h>
28 #include <toolkit-adaptor-impl.h>
29 #include <dali/public-api/render-tasks/render-task-list.h>
31 using AdaptorImpl = Dali::Internal::Adaptor::Adaptor;
36 ///////////////////////////////////////////////////////////////////////////////
38 // Dali::Internal::Adaptor::SceneHolder Stub
40 ///////////////////////////////////////////////////////////////////////////////
48 SceneHolder::SceneHolder( const Dali::Rect<int>& positionSize )
49 : mRenderSurface( positionSize ),
50 mScene( Dali::Integration::Scene::New( Dali::Size( static_cast<float>( positionSize.width ), static_cast<float>( positionSize.height ) ) ) )
54 SceneHolder::~SceneHolder()
56 if ( Dali::Adaptor::IsAvailable() )
58 AdaptorImpl::GetImpl( AdaptorImpl::Get() ).RemoveWindow( this );
62 void SceneHolder::Add( Dali::Actor actor )
67 void SceneHolder::Remove( Dali::Actor actor )
69 mScene.Remove( actor );
72 Dali::Layer SceneHolder::GetRootLayer() const
74 return mScene.GetRootLayer();
77 void SceneHolder::SetBackgroundColor( Vector4 color )
79 return mScene.SetBackgroundColor( color );
82 Vector4 SceneHolder::GetBackgroundColor() const
84 return mScene.GetBackgroundColor();
87 void SceneHolder::FeedTouchPoint( Dali::TouchPoint& point, int timeStamp )
91 void SceneHolder::FeedWheelEvent( Dali::WheelEvent& wheelEvent )
95 void SceneHolder::FeedKeyEvent( Dali::KeyEvent& keyEvent )
99 Dali::Integration::SceneHolder::KeyEventSignalType& SceneHolder::KeyEventSignal()
101 return mScene.KeyEventSignal();
104 Dali::Integration::SceneHolder::KeyEventGeneratedSignalType& SceneHolder::KeyEventGeneratedSignal()
106 return mScene.KeyEventGeneratedSignal();
109 Dali::Integration::SceneHolder::TouchEventSignalType& SceneHolder::TouchedSignal()
111 return mScene.TouchedSignal();
114 Dali::Integration::SceneHolder::WheelEventSignalType& SceneHolder::WheelEventSignal()
116 return mScene.WheelEventSignal();
119 Dali::Integration::SceneHolder::WheelEventGeneratedSignalType& SceneHolder::WheelEventGeneratedSignal()
121 return mScene.WheelEventGeneratedSignal();
124 Integration::Scene SceneHolder::GetScene()
129 Dali::RenderSurfaceInterface& SceneHolder::GetRenderSurface()
131 return mRenderSurface;
134 Dali::RenderTaskList SceneHolder::GetRenderTaskList()
136 return mScene.GetRenderTaskList();
139 } // namespace Adaptor
141 } // namespace Internal
143 ///////////////////////////////////////////////////////////////////////////////
145 // Dali::Integration::SceneHolder Stub
147 ///////////////////////////////////////////////////////////////////////////////
149 namespace Integration
152 SceneHolder::SceneHolder()
154 // Dali::Internal::Adaptor::Adaptor::Get().WindowCreatedSignal().Emit( *this );
157 SceneHolder::~SceneHolder()
161 SceneHolder::SceneHolder( const SceneHolder& handle )
166 SceneHolder::SceneHolder( Internal::Adaptor::SceneHolder* internal )
167 : BaseHandle(internal)
171 SceneHolder& SceneHolder::operator=( const SceneHolder& rhs )
173 BaseHandle::operator=(rhs);
177 Dali::Integration::SceneHolder SceneHolder::Get( Dali::Actor actor )
179 Internal::Adaptor::SceneHolder* sceneHolderImpl = nullptr;
181 if ( Dali::Adaptor::IsAvailable() )
183 sceneHolderImpl = AdaptorImpl::GetImpl( AdaptorImpl::Get() ).GetWindow( actor );
186 return Dali::Integration::SceneHolder( sceneHolderImpl );
189 void SceneHolder::Add( Actor actor )
191 GetImplementation( *this ).Add( actor );
194 void SceneHolder::Remove( Actor actor )
196 GetImplementation( *this ).Remove( actor );
199 Dali::Layer SceneHolder::GetRootLayer() const
201 return GetImplementation( *this ).GetRootLayer();
204 void SceneHolder::SetBackgroundColor( Vector4 color )
206 GetImplementation( *this ).SetBackgroundColor( color );
209 Vector4 SceneHolder::GetBackgroundColor() const
211 return GetImplementation( *this ).GetBackgroundColor();
214 void SceneHolder::FeedTouchPoint( Dali::TouchPoint& point, int timeStamp )
216 GetImplementation( *this ).FeedTouchPoint( point, timeStamp );
219 void SceneHolder::FeedWheelEvent( Dali::WheelEvent& wheelEvent )
221 GetImplementation( *this ).FeedWheelEvent( wheelEvent );
224 void SceneHolder::FeedKeyEvent( Dali::KeyEvent& keyEvent )
226 GetImplementation( *this ).FeedKeyEvent( keyEvent );
229 SceneHolder::KeyEventSignalType& SceneHolder::KeyEventSignal()
231 return GetImplementation( *this ).KeyEventSignal();
234 SceneHolder::KeyEventGeneratedSignalType& SceneHolder::KeyEventGeneratedSignal()
236 return GetImplementation( *this ).KeyEventGeneratedSignal();
239 SceneHolder::TouchEventSignalType& SceneHolder::TouchedSignal()
241 return GetImplementation( *this ).TouchedSignal();
244 SceneHolder::WheelEventSignalType& SceneHolder::WheelEventSignal()
246 return GetImplementation( *this ).WheelEventSignal();
249 SceneHolder::WheelEventGeneratedSignalType& SceneHolder::WheelEventGeneratedSignal()
251 return GetImplementation( *this ).WheelEventGeneratedSignal();