2 * Copyright (c) 2020 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.
19 #include <dali/devel-api/common/stage.h>
22 #include <dali/internal/common/core-impl.h>
23 #include <dali/internal/event/common/stage-impl.h>
24 #include <dali/public-api/actors/actor.h>
25 #include <dali/public-api/actors/layer.h>
26 #include <dali/public-api/object/object-registry.h>
27 #include <dali/public-api/render-tasks/render-task-list.h>
41 Stage::Stage(const Stage& handle)
46 Stage& Stage::operator=(const Stage& rhs)
48 BaseHandle::operator=(rhs);
52 Stage::Stage(Internal::Stage* internal)
53 : BaseHandle(internal)
57 Stage Stage::GetCurrent()
59 Internal::Stage* stage = Internal::Stage::GetCurrent();
60 DALI_ASSERT_ALWAYS(stage && "Stage doesn't exist");
64 bool Stage::IsInstalled()
66 return Internal::Stage::IsInstalled();
69 void Stage::Add(Actor& actor)
71 GetImplementation(*this).Add(GetImplementation(actor));
74 void Stage::Remove(Actor& actor)
76 GetImplementation(*this).Remove(GetImplementation(actor));
79 RenderTaskList Stage::GetRenderTaskList() const
81 return RenderTaskList(&GetImplementation(*this).GetRenderTaskList());
84 Vector2 Stage::GetSize() const
86 return GetImplementation(*this).GetSize();
89 uint32_t Stage::GetLayerCount() const
91 return GetImplementation(*this).GetLayerCount();
94 Layer Stage::GetLayer(uint32_t depth) const
96 return GetImplementation(*this).GetLayer(depth);
99 Layer Stage::GetRootLayer() const
101 return GetImplementation(*this).GetRootLayer();
104 void Stage::SetBackgroundColor(Vector4 color)
106 GetImplementation(*this).SetBackgroundColor(color);
109 Vector4 Stage::GetBackgroundColor() const
111 return GetImplementation(*this).GetBackgroundColor();
114 Vector2 Stage::GetDpi() const
116 return GetImplementation(*this).GetDpi();
119 ObjectRegistry Stage::GetObjectRegistry() const
121 Internal::Stage* stage = Internal::Stage::GetCurrent();
122 DALI_ASSERT_ALWAYS(stage && "GetObjectRegistry() : Stage is null");
124 Internal::ObjectRegistry& internal = stage->GetObjectRegistry();
125 return ObjectRegistry(&internal);
128 void Stage::KeepRendering(float durationSeconds)
130 GetImplementation(*this).KeepRendering(durationSeconds);
133 Stage::KeyEventSignalType& Stage::KeyEventSignal()
135 return GetImplementation(*this).KeyEventSignal();
138 Stage::EventProcessingFinishedSignalType& Stage::EventProcessingFinishedSignal()
140 return GetImplementation(*this).EventProcessingFinishedSignal();
143 Stage::TouchEventSignalType& Stage::TouchedSignal()
145 return GetImplementation(*this).TouchedSignal();
148 Stage::WheelEventSignalType& Stage::WheelEventSignal()
150 return GetImplementation(*this).WheelEventSignal();
153 Stage::ContextStatusSignal& Stage::ContextLostSignal()
155 return GetImplementation(*this).ContextLostSignal();
158 Stage::ContextStatusSignal& Stage::ContextRegainedSignal()
160 return GetImplementation(*this).ContextRegainedSignal();
163 Stage::SceneCreatedSignalType& Stage::SceneCreatedSignal()
165 return GetImplementation(*this).SceneCreatedSignal();