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>
30 using AdaptorImpl = Dali::Internal::Adaptor::Adaptor;
35 ///////////////////////////////////////////////////////////////////////////////
37 // Dali::Internal::Adaptor::SceneHolder Stub
39 ///////////////////////////////////////////////////////////////////////////////
47 SceneHolder::SceneHolder( const Dali::Rect<int>& positionSize )
48 : mRenderSurface( positionSize ),
49 mScene( Dali::Integration::Scene::New( Dali::Size( static_cast<float>( positionSize.width ), static_cast<float>( positionSize.height ) ) ) )
53 SceneHolder::~SceneHolder()
55 if ( Dali::Adaptor::IsAvailable() )
57 AdaptorImpl::GetImpl( AdaptorImpl::Get() ).RemoveWindow( this );
61 void SceneHolder::Add( Dali::Actor actor )
66 void SceneHolder::Remove( Dali::Actor actor )
68 mScene.Remove( actor );
71 Dali::Layer SceneHolder::GetRootLayer() const
73 return mScene.GetRootLayer();
76 void SceneHolder::SetBackgroundColor( Vector4 color )
78 return mScene.SetBackgroundColor( color );
81 Vector4 SceneHolder::GetBackgroundColor() const
83 return mScene.GetBackgroundColor();
86 void SceneHolder::FeedTouchPoint( Dali::TouchPoint& point, int timeStamp )
90 void SceneHolder::FeedWheelEvent( Dali::WheelEvent& wheelEvent )
94 void SceneHolder::FeedKeyEvent( Dali::KeyEvent& keyEvent )
98 Dali::Integration::SceneHolder::KeyEventSignalType& SceneHolder::KeyEventSignal()
100 return mScene.KeyEventSignal();
103 Dali::Integration::SceneHolder::KeyEventGeneratedSignalType& SceneHolder::KeyEventGeneratedSignal()
105 return mScene.KeyEventGeneratedSignal();
108 Dali::Integration::SceneHolder::TouchEventSignalType& SceneHolder::TouchedSignal()
110 return mScene.TouchedSignal();
113 Dali::Integration::SceneHolder::WheelEventSignalType& SceneHolder::WheelEventSignal()
115 return mScene.WheelEventSignal();
118 Integration::Scene SceneHolder::GetScene()
123 Dali::RenderSurfaceInterface& SceneHolder::GetRenderSurface()
125 return mRenderSurface;
128 } // namespace Adaptor
130 } // namespace Internal
132 ///////////////////////////////////////////////////////////////////////////////
134 // Dali::Integration::SceneHolder Stub
136 ///////////////////////////////////////////////////////////////////////////////
138 namespace Integration
141 SceneHolder::SceneHolder()
143 // Dali::Internal::Adaptor::Adaptor::Get().WindowCreatedSignal().Emit( *this );
146 SceneHolder::~SceneHolder()
150 SceneHolder::SceneHolder( const SceneHolder& handle )
155 SceneHolder::SceneHolder( Internal::Adaptor::SceneHolder* internal )
156 : BaseHandle(internal)
160 SceneHolder& SceneHolder::operator=( const SceneHolder& rhs )
162 BaseHandle::operator=(rhs);
166 Dali::Integration::SceneHolder SceneHolder::Get( Dali::Actor actor )
168 Internal::Adaptor::SceneHolder* sceneHolderImpl = nullptr;
170 if ( Dali::Adaptor::IsAvailable() )
172 sceneHolderImpl = AdaptorImpl::GetImpl( AdaptorImpl::Get() ).GetWindow( actor );
175 return Dali::Integration::SceneHolder( sceneHolderImpl );
178 void SceneHolder::Add( Actor actor )
180 GetImplementation( *this ).Add( actor );
183 void SceneHolder::Remove( Actor actor )
185 GetImplementation( *this ).Remove( actor );
188 Dali::Layer SceneHolder::GetRootLayer() const
190 return GetImplementation( *this ).GetRootLayer();
193 void SceneHolder::SetBackgroundColor( Vector4 color )
195 GetImplementation( *this ).SetBackgroundColor( color );
198 Vector4 SceneHolder::GetBackgroundColor() const
200 return GetImplementation( *this ).GetBackgroundColor();
203 void SceneHolder::FeedTouchPoint( Dali::TouchPoint& point, int timeStamp )
205 GetImplementation( *this ).FeedTouchPoint( point, timeStamp );
208 void SceneHolder::FeedWheelEvent( Dali::WheelEvent& wheelEvent )
210 GetImplementation( *this ).FeedWheelEvent( wheelEvent );
213 void SceneHolder::FeedKeyEvent( Dali::KeyEvent& keyEvent )
215 GetImplementation( *this ).FeedKeyEvent( keyEvent );
218 SceneHolder::KeyEventSignalType& SceneHolder::KeyEventSignal()
220 return GetImplementation( *this ).KeyEventSignal();
223 SceneHolder::KeyEventGeneratedSignalType& SceneHolder::KeyEventGeneratedSignal()
225 return GetImplementation( *this ).KeyEventGeneratedSignal();
228 SceneHolder::TouchEventSignalType& SceneHolder::TouchedSignal()
230 return GetImplementation( *this ).TouchedSignal();
233 SceneHolder::WheelEventSignalType& SceneHolder::WheelEventSignal()
235 return GetImplementation( *this ).WheelEventSignal();