[dali_2.3.26] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / dali / integration-api / adaptor-framework / scene-holder.cpp
1 /*
2  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/integration-api/adaptor-framework/scene-holder.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/integration-api/events/key-event-integ.h>
23 #include <dali/integration-api/events/touch-event-integ.h>
24 #include <dali/integration-api/events/wheel-event-integ.h>
25 #include <dali/public-api/events/wheel-event.h>
26 #include <dali/public-api/render-tasks/render-task-list.h>
27
28 // INTERNAL INCLUDES
29 #include <dali/integration-api/adaptor-framework/scene-holder-impl.h>
30 #include <dali/public-api/actors/layer.h>
31
32 namespace Dali
33 {
34 namespace Integration
35 {
36 SceneHolder::SceneHolder()
37 {
38 }
39
40 SceneHolder::~SceneHolder()
41 {
42 }
43
44 SceneHolder::SceneHolder(const SceneHolder& copy) = default;
45
46 SceneHolder& SceneHolder::operator=(const SceneHolder& rhs) = default;
47
48 SceneHolder::SceneHolder(SceneHolder&& rhs) noexcept = default;
49
50 SceneHolder& SceneHolder::operator=(SceneHolder&& rhs) noexcept = default;
51
52 SceneHolder::SceneHolder(Internal::Adaptor::SceneHolder* internal)
53 : BaseHandle(internal)
54 {
55 }
56
57 void SceneHolder::Add(Actor actor)
58 {
59   GetImplementation(*this).Add(actor);
60 }
61
62 void SceneHolder::Remove(Actor actor)
63 {
64   GetImplementation(*this).Remove(actor);
65 }
66
67 Layer SceneHolder::GetRootLayer() const
68 {
69   return GetImplementation(*this).GetRootLayer();
70 }
71
72 void SceneHolder::SetBackgroundColor(Vector4 color)
73 {
74   GetImplementation(*this).SetBackgroundColor(color);
75 }
76
77 Vector4 SceneHolder::GetBackgroundColor() const
78 {
79   return GetImplementation(*this).GetBackgroundColor();
80 }
81
82 Any SceneHolder::GetNativeHandle() const
83 {
84   return GetImplementation(*this).GetNativeHandle();
85 }
86
87 void SceneHolder::FeedTouchPoint(Dali::TouchPoint& point, int timeStamp)
88 {
89   Integration::Point convertedPoint(point);
90   GetImplementation(*this).FeedTouchPoint(convertedPoint, timeStamp);
91 }
92
93 void SceneHolder::FeedWheelEvent(Dali::WheelEvent& wheelEvent)
94 {
95   Integration::WheelEvent event(static_cast<Integration::WheelEvent::Type>(wheelEvent.GetType()), wheelEvent.GetDirection(), wheelEvent.GetModifiers(), wheelEvent.GetPoint(), wheelEvent.GetDelta(), wheelEvent.GetTime());
96   GetImplementation(*this).FeedWheelEvent(event);
97 }
98
99 void SceneHolder::FeedKeyEvent(Dali::KeyEvent& keyEvent)
100 {
101   Integration::KeyEvent event(keyEvent.GetKeyName(), keyEvent.GetLogicalKey(), keyEvent.GetKeyString(), keyEvent.GetKeyCode(), keyEvent.GetKeyModifier(), keyEvent.GetTime(), static_cast<Integration::KeyEvent::State>(keyEvent.GetState()), keyEvent.GetCompose(), keyEvent.GetDeviceName(), keyEvent.GetDeviceClass(), keyEvent.GetDeviceSubclass());
102   GetImplementation(*this).FeedKeyEvent(event);
103 }
104
105 void SceneHolder::FeedHoverEvent(Dali::TouchPoint& point)
106 {
107   Integration::Point convertedPoint(point);
108   GetImplementation(*this).FeedHoverEvent(convertedPoint);
109 }
110
111 void SceneHolder::SetGeometryHittestEnabled(bool enabled)
112 {
113   GetImplementation(*this).SetGeometryHittestEnabled(enabled);
114 }
115
116 bool SceneHolder::IsGeometryHittestEnabled()
117 {
118   return GetImplementation(*this).IsGeometryHittestEnabled();
119 }
120
121 RenderTaskList SceneHolder::GetRenderTaskList()
122 {
123   return GetImplementation(*this).GetRenderTaskList();
124 }
125
126 int32_t SceneHolder::GetNativeId() const
127 {
128   return GetImplementation(*this).GetNativeId();
129 }
130
131 SceneHolder SceneHolder::Get(Actor actor)
132 {
133   return Internal::Adaptor::SceneHolder::Get(actor);
134 }
135
136 SceneHolder::KeyEventSignalType& SceneHolder::KeyEventSignal()
137 {
138   return GetImplementation(*this).KeyEventSignal();
139 }
140
141 SceneHolder::KeyEventGeneratedSignalType& SceneHolder::KeyEventGeneratedSignal()
142 {
143   return GetImplementation(*this).KeyEventGeneratedSignal();
144 }
145
146 SceneHolder::KeyEventGeneratedSignalType& SceneHolder::InterceptKeyEventSignal()
147 {
148   return GetImplementation(*this).InterceptKeyEventSignal();
149 }
150
151 SceneHolder::TouchEventSignalType& SceneHolder::TouchedSignal()
152 {
153   return GetImplementation(*this).TouchedSignal();
154 }
155
156 SceneHolder::WheelEventSignalType& SceneHolder::WheelEventSignal()
157 {
158   return GetImplementation(*this).WheelEventSignal();
159 }
160
161 SceneHolder::WheelEventGeneratedSignalType& SceneHolder::WheelEventGeneratedSignal()
162 {
163   return GetImplementation(*this).WheelEventGeneratedSignal();
164 }
165
166 } // namespace Integration
167
168 } // namespace Dali