[dali_1.9.5] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-scene-holder-impl.h
1 #ifndef DALI_TOOLKIT_SCENE_HOLDER_IMPL_H
2 #define DALI_TOOLKIT_SCENE_HOLDER_IMPL_H
3
4 /*
5  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 #include <test-render-surface.h>
22
23 #include <dali/integration-api/scene.h>
24 #include <dali/public-api/actors/layer.h>
25 #include <dali/public-api/object/base-object.h>
26
27 namespace Dali
28 {
29
30 namespace Internal
31 {
32
33 namespace Adaptor
34 {
35
36 class SceneHolder : public Dali::BaseObject
37 {
38 public:
39
40   SceneHolder( const Dali::Rect<int>& positionSize );
41
42   virtual ~SceneHolder();
43
44   void Add( Dali::Actor actor );
45
46   void Remove( Dali::Actor actor );
47
48   Dali::Layer GetRootLayer() const;
49
50   void SetBackgroundColor( Vector4 color );
51
52   Vector4 GetBackgroundColor() const;
53
54   void FeedTouchPoint( Dali::TouchPoint& point, int timeStamp );
55
56   void FeedWheelEvent( Dali::WheelEvent& wheelEvent );
57
58   void FeedKeyEvent( Dali::KeyEvent& keyEvent );
59
60   Dali::Integration::SceneHolder::KeyEventSignalType& KeyEventSignal();
61
62   Dali::Integration::SceneHolder::KeyEventGeneratedSignalType& KeyEventGeneratedSignal();
63
64   Dali::Integration::SceneHolder::TouchSignalType& TouchSignal();
65
66   Dali::Integration::SceneHolder::WheelEventSignalType& WheelEventSignal();
67
68   Integration::Scene GetScene();
69
70   Integration::RenderSurface& GetRenderSurface();
71
72 private:
73
74   TestRenderSurface mRenderSurface;
75   Integration::Scene mScene;
76 };
77
78 } // namespace Adaptor
79
80 } // namespace Internal
81
82 inline Internal::Adaptor::SceneHolder& GetImplementation( Dali::Integration::SceneHolder& sceneHolder )
83 {
84   DALI_ASSERT_ALWAYS( sceneHolder && "SceneHolder handle is empty" );
85   BaseObject& object = sceneHolder.GetBaseObject();
86   return static_cast<Internal::Adaptor::SceneHolder&>( object );
87 }
88
89 inline const Internal::Adaptor::SceneHolder& GetImplementation( const Dali::Integration::SceneHolder& sceneHolder )
90 {
91   DALI_ASSERT_ALWAYS( sceneHolder && "SceneHolder handle is empty" );
92   const BaseObject& object = sceneHolder.GetBaseObject();
93   return static_cast<const Internal::Adaptor::SceneHolder&>( object );
94 }
95
96 } // namespace Dali
97
98 #endif // DALI_TOOLKIT_SCENE_HOLDER_IMPL_H