Revert "[Tizen] Modify DALI_KEY_H"
[platform/core/uifw/dali-adaptor.git] / dali / integration-api / scene-holder.h
1 #ifndef DALI_INTEGRATION_SCENEHOLDER_H
2 #define DALI_INTEGRATION_SCENEHOLDER_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 // EXTERNAL INCLUDES
22 #include <dali/public-api/dali-adaptor-common.h>
23 #include <dali/public-api/object/base-handle.h>
24 #include <dali/public-api/math/vector4.h>
25
26 namespace Dali
27 {
28
29 class Actor;
30 class Layer;
31 class Any;
32 struct TouchPoint;
33 struct WheelEvent;
34 struct KeyEvent;
35
36 namespace Internal DALI_INTERNAL
37 {
38
39 namespace Adaptor
40 {
41
42 class SceneHolder;
43
44 }
45
46 }
47
48 namespace Integration
49 {
50
51 /**
52  * @brief SceneHolder is responsible for creating a Scene for rendering.
53  */
54 class DALI_ADAPTOR_API SceneHolder : public BaseHandle
55 {
56 public:
57
58   /**
59    * @brief Create an uninitialized SceneHolder handle.
60    */
61   SceneHolder();
62
63   /**
64    * @brief Destructor
65    *
66    * This is non-virtual since derived Handle types must not contain data or virtual methods.
67    */
68   ~SceneHolder();
69
70   /**
71    * @brief This copy constructor is required for (smart) pointer semantics.
72    *
73    * @param [in] handle A reference to the copied handle
74    */
75   SceneHolder( const SceneHolder& handle );
76
77   /**
78    * @brief This assignment operator is required for (smart) pointer semantics.
79    *
80    * @param [in] rhs  A reference to the copied handle
81    * @return A reference to this
82    */
83   SceneHolder& operator=( const SceneHolder& rhs );
84
85   /**
86    * @brief Adds a child Actor to the SceneHolder.
87    *
88    * The child will be referenced.
89    * @param[in] actor The child
90    * @pre The actor has been initialized.
91    * @pre The actor does not have a parent.
92    */
93   void Add( Actor actor );
94
95   /**
96    * @brief Removes a child Actor from the SceneHolder.
97    *
98    * The child will be unreferenced.
99    * @param[in] actor The child
100    * @pre The actor has been added to the SceneHolder.
101    */
102   void Remove( Actor actor );
103
104   /**
105    * @brief Returns the Scene's Root Layer.
106    *
107    * @return The root layer
108    */
109   Layer GetRootLayer() const;
110
111   /**
112    * @brief Sets the background color.
113    *
114    * @param[in] color The new background color
115    */
116   void SetBackgroundColor( Vector4 color );
117
118   /**
119    * @brief Gets the background color.
120    *
121    * @return The background color
122    */
123   Vector4 GetBackgroundColor() const;
124
125   /**
126    * @brief Gets the native handle.
127    *
128    * When users call this function, it wraps the actual type used by the underlying system.
129    *
130    * @return The native handle or an empty handle
131    */
132   Any GetNativeHandle() const;
133
134   /**
135    * @brief Feed (Send) touch event to core
136    * @param[in] point The touch point
137    * @param[in] timeStamp The time stamp
138    */
139   void FeedTouchPoint( Dali::TouchPoint& point, int timeStamp );
140
141   /**
142    * @brief Feed (Send) wheel event to core
143    * @param[in] wheelEvent The wheel event
144    */
145   void FeedWheelEvent( Dali::WheelEvent& wheelEvent );
146
147   /**
148    * @brief Feed (Send) key event to core
149    * @param[in] keyEvent The key event holding the key information.
150    */
151   void FeedKeyEvent( Dali::KeyEvent& keyEvent );
152
153   /**
154    * @brief Retrieve the SceneHolder that the given actor is added to.
155    *
156    * @param[in] actor The actor
157    * @return The SceneHolder the actor is added to or an empty handle if the actor is not added to any SceneHolder.
158    */
159   static SceneHolder Get( Actor actor );
160
161 public: // Not intended for application developers
162
163   /**
164    * @brief This constructor is used internally to create additional SceneHolder handles.
165    *
166    * @param[in] sceneHolder A pointer to a newly allocated Dali resource
167    */
168   explicit SceneHolder( Internal::Adaptor::SceneHolder* sceneHolder );
169
170 };
171
172 } // namespace Integration
173
174 } // namespace Dali
175
176 #endif // DALI_INTEGRATION_SCENEHOLDER_H