Support scene holder instead of window in keyinput/keyboard focus
[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   Dali::Layer GetRootLayer() const;
45
46   void SetBackgroundColor( Vector4 color );
47
48   Vector4 GetBackgroundColor() const;
49
50   void FeedTouchPoint( Dali::TouchPoint& point, int timeStamp );
51
52   void FeedWheelEvent( Dali::WheelEvent& wheelEvent );
53
54   void FeedKeyEvent( Dali::KeyEvent& keyEvent );
55
56   Dali::Integration::SceneHolder::KeyEventSignalType& KeyEventSignal();
57
58   Dali::Integration::SceneHolder::KeyEventGeneratedSignalType& KeyEventGeneratedSignal();
59
60   Dali::Integration::SceneHolder::TouchSignalType& TouchSignal();
61
62   Dali::Integration::SceneHolder::WheelEventSignalType& WheelEventSignal();
63
64   Integration::Scene GetScene();
65
66   Integration::RenderSurface& GetRenderSurface();
67
68 private:
69
70   TestRenderSurface mRenderSurface;
71   Integration::Scene mScene;
72 };
73
74 } // namespace Adaptor
75
76 } // namespace Internal
77
78 inline Internal::Adaptor::SceneHolder& GetImplementation( Dali::Integration::SceneHolder& sceneHolder )
79 {
80   DALI_ASSERT_ALWAYS( sceneHolder && "SceneHolder handle is empty" );
81   BaseObject& object = sceneHolder.GetBaseObject();
82   return static_cast<Internal::Adaptor::SceneHolder&>( object );
83 }
84
85 inline const Internal::Adaptor::SceneHolder& GetImplementation( const Dali::Integration::SceneHolder& sceneHolder )
86 {
87   DALI_ASSERT_ALWAYS( sceneHolder && "SceneHolder handle is empty" );
88   const BaseObject& object = sceneHolder.GetBaseObject();
89   return static_cast<const Internal::Adaptor::SceneHolder&>( object );
90 }
91
92 } // namespace Dali
93
94 #endif // DALI_TOOLKIT_SCENE_HOLDER_IMPL_H