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>
33 Stage::Stage() = default;
35 Stage::~Stage() = default;
37 Stage::Stage(const Stage& handle) = default;
39 Stage& Stage::operator=(const Stage& rhs) = default;
41 Stage::Stage(Internal::Stage* internal)
42 : BaseHandle(internal)
46 Stage Stage::GetCurrent()
48 Internal::Stage* stage = Internal::Stage::GetCurrent();
49 DALI_ASSERT_ALWAYS(stage && "Stage doesn't exist");
53 bool Stage::IsInstalled()
55 return Internal::Stage::IsInstalled();
58 void Stage::Add(Actor& actor)
60 GetImplementation(*this).Add(GetImplementation(actor));
63 void Stage::Remove(Actor& actor)
65 GetImplementation(*this).Remove(GetImplementation(actor));
68 RenderTaskList Stage::GetRenderTaskList() const
70 return RenderTaskList(&GetImplementation(*this).GetRenderTaskList());
73 Vector2 Stage::GetSize() const
75 return GetImplementation(*this).GetSize();
78 uint32_t Stage::GetLayerCount() const
80 return GetImplementation(*this).GetLayerCount();
83 Layer Stage::GetLayer(uint32_t depth) const
85 return GetImplementation(*this).GetLayer(depth);
88 Layer Stage::GetRootLayer() const
90 return GetImplementation(*this).GetRootLayer();
93 void Stage::SetBackgroundColor(Vector4 color)
95 GetImplementation(*this).SetBackgroundColor(color);
98 Vector4 Stage::GetBackgroundColor() const
100 return GetImplementation(*this).GetBackgroundColor();
103 Vector2 Stage::GetDpi() const
105 return GetImplementation(*this).GetDpi();
108 ObjectRegistry Stage::GetObjectRegistry() const
110 Internal::Stage* stage = Internal::Stage::GetCurrent();
111 DALI_ASSERT_ALWAYS(stage && "GetObjectRegistry() : Stage is null");
113 Internal::ObjectRegistry& internal = stage->GetObjectRegistry();
114 return ObjectRegistry(&internal);
117 void Stage::KeepRendering(float durationSeconds)
119 GetImplementation(*this).KeepRendering(durationSeconds);
122 Stage::KeyEventSignalType& Stage::KeyEventSignal()
124 return GetImplementation(*this).KeyEventSignal();
127 Stage::EventProcessingFinishedSignalType& Stage::EventProcessingFinishedSignal()
129 return GetImplementation(*this).EventProcessingFinishedSignal();
132 Stage::TouchEventSignalType& Stage::TouchedSignal()
134 return GetImplementation(*this).TouchedSignal();
137 Stage::WheelEventSignalType& Stage::WheelEventSignal()
139 return GetImplementation(*this).WheelEventSignal();
142 Stage::ContextStatusSignal& Stage::ContextLostSignal()
144 return GetImplementation(*this).ContextLostSignal();
147 Stage::ContextStatusSignal& Stage::ContextRegainedSignal()
149 return GetImplementation(*this).ContextRegainedSignal();
152 Stage::SceneCreatedSignalType& Stage::SceneCreatedSignal()
154 return GetImplementation(*this).SceneCreatedSignal();