2 * Copyright (c) 2019 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/common/stage.h>
26 #include <dali/public-api/object/base-object.h>
28 #include <dali/integration-api/adaptor-framework/adaptor.h>
29 #include <toolkit-adaptor-impl.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( mRenderSurface ) )
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::TouchSignalType& SceneHolder::TouchSignal()
111 return mScene.TouchSignal();
114 Dali::Integration::SceneHolder::WheelEventSignalType& SceneHolder::WheelEventSignal()
116 return mScene.WheelEventSignal();
119 Integration::Scene SceneHolder::GetScene()
124 Integration::RenderSurface& SceneHolder::GetRenderSurface()
126 return mRenderSurface;
129 } // namespace Adaptor
131 } // namespace Internal
133 ///////////////////////////////////////////////////////////////////////////////
135 // Dali::Integration::SceneHolder Stub
137 ///////////////////////////////////////////////////////////////////////////////
139 namespace Integration
142 SceneHolder::SceneHolder()
144 // Dali::Internal::Adaptor::Adaptor::Get().WindowCreatedSignal().Emit( *this );
147 SceneHolder::~SceneHolder()
151 SceneHolder::SceneHolder( const SceneHolder& handle )
156 SceneHolder::SceneHolder( Internal::Adaptor::SceneHolder* internal )
157 : BaseHandle(internal)
161 SceneHolder& SceneHolder::operator=( const SceneHolder& rhs )
163 BaseHandle::operator=(rhs);
167 Dali::Integration::SceneHolder SceneHolder::Get( Dali::Actor actor )
169 Internal::Adaptor::SceneHolder* sceneHolderImpl = nullptr;
171 if ( Dali::Adaptor::IsAvailable() )
173 sceneHolderImpl = AdaptorImpl::GetImpl( AdaptorImpl::Get() ).GetWindow( actor );
176 return Dali::Integration::SceneHolder( sceneHolderImpl );
179 void SceneHolder::Add( Actor actor )
181 GetImplementation( *this ).Add( actor );
184 void SceneHolder::Remove( Actor actor )
186 GetImplementation( *this ).Remove( actor );
189 Dali::Layer SceneHolder::GetRootLayer() const
191 return GetImplementation( *this ).GetRootLayer();
194 void SceneHolder::SetBackgroundColor( Vector4 color )
196 GetImplementation( *this ).SetBackgroundColor( color );
199 Vector4 SceneHolder::GetBackgroundColor() const
201 return GetImplementation( *this ).GetBackgroundColor();
204 void SceneHolder::FeedTouchPoint( Dali::TouchPoint& point, int timeStamp )
206 GetImplementation( *this ).FeedTouchPoint( point, timeStamp );
209 void SceneHolder::FeedWheelEvent( Dali::WheelEvent& wheelEvent )
211 GetImplementation( *this ).FeedWheelEvent( wheelEvent );
214 void SceneHolder::FeedKeyEvent( Dali::KeyEvent& keyEvent )
216 GetImplementation( *this ).FeedKeyEvent( keyEvent );
219 SceneHolder::KeyEventSignalType& SceneHolder::KeyEventSignal()
221 return GetImplementation( *this ).KeyEventSignal();
224 SceneHolder::KeyEventGeneratedSignalType& SceneHolder::KeyEventGeneratedSignal()
226 return GetImplementation( *this ).KeyEventGeneratedSignal();
229 SceneHolder::TouchSignalType& SceneHolder::TouchSignal()
231 return GetImplementation( *this ).TouchSignal();
234 SceneHolder::WheelEventSignalType& SceneHolder::WheelEventSignal()
236 return GetImplementation( *this ).WheelEventSignal();