2 * Copyright (c) 2022 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(Stage&& handle) noexcept = default;
43 Stage& Stage::operator=(Stage&& rhs) noexcept = default;
45 Stage::Stage(Internal::Stage* internal)
46 : BaseHandle(internal)
50 Stage Stage::GetCurrent()
52 Internal::Stage* stage = Internal::Stage::GetCurrent();
53 DALI_ASSERT_ALWAYS(stage && "Stage doesn't exist");
57 bool Stage::IsInstalled()
59 return Internal::Stage::IsInstalled();
62 void Stage::Add(Actor& actor)
64 GetImplementation(*this).Add(GetImplementation(actor));
67 void Stage::Remove(Actor& actor)
69 GetImplementation(*this).Remove(GetImplementation(actor));
72 RenderTaskList Stage::GetRenderTaskList() const
74 return RenderTaskList(&GetImplementation(*this).GetRenderTaskList());
77 Vector2 Stage::GetSize() const
79 return GetImplementation(*this).GetSize();
82 uint32_t Stage::GetLayerCount() const
84 return GetImplementation(*this).GetLayerCount();
87 Layer Stage::GetLayer(uint32_t depth) const
89 return GetImplementation(*this).GetLayer(depth);
92 Layer Stage::GetRootLayer() const
94 return GetImplementation(*this).GetRootLayer();
97 void Stage::SetBackgroundColor(Vector4 color)
99 GetImplementation(*this).SetBackgroundColor(color);
102 Vector4 Stage::GetBackgroundColor() const
104 return GetImplementation(*this).GetBackgroundColor();
107 Vector2 Stage::GetDpi() const
109 return GetImplementation(*this).GetDpi();
112 ObjectRegistry Stage::GetObjectRegistry() const
114 Internal::Stage* stage = Internal::Stage::GetCurrent();
115 DALI_ASSERT_ALWAYS(stage && "GetObjectRegistry() : Stage is null");
117 Internal::ObjectRegistry& internal = stage->GetObjectRegistry();
118 return ObjectRegistry(&internal);
121 void Stage::KeepRendering(float durationSeconds)
123 GetImplementation(*this).KeepRendering(durationSeconds);
126 Stage::KeyEventSignalType& Stage::KeyEventSignal()
128 return GetImplementation(*this).KeyEventSignal();
131 Stage::EventProcessingFinishedSignalType& Stage::EventProcessingFinishedSignal()
133 return GetImplementation(*this).EventProcessingFinishedSignal();
136 Stage::TouchEventSignalType& Stage::TouchedSignal()
138 return GetImplementation(*this).TouchedSignal();
141 Stage::WheelEventSignalType& Stage::WheelEventSignal()
143 return GetImplementation(*this).WheelEventSignal();
146 Stage::ContextStatusSignal& Stage::ContextLostSignal()
148 return GetImplementation(*this).ContextLostSignal();
151 Stage::ContextStatusSignal& Stage::ContextRegainedSignal()
153 return GetImplementation(*this).ContextRegainedSignal();
156 Stage::SceneCreatedSignalType& Stage::SceneCreatedSignal()
158 return GetImplementation(*this).SceneCreatedSignal();