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/public-api/actors/actor.h>
23 #include <dali/public-api/render-tasks/render-task-list.h>
24 #include <dali/internal/event/common/stage-impl.h>
25 #include <dali/internal/common/core-impl.h>
26 #include <dali/public-api/actors/layer.h>
27 #include <dali/public-api/object/object-registry.h>
42 Stage::Stage(const Stage& handle)
47 Stage& Stage::operator=(const Stage& rhs)
49 BaseHandle::operator=(rhs);
53 Stage::Stage(Internal::Stage* internal)
54 : BaseHandle(internal)
58 Stage Stage::GetCurrent()
60 Internal::Stage* stage = Internal::Stage::GetCurrent();
61 DALI_ASSERT_ALWAYS( stage && "Stage doesn't exist" );
62 return Stage( stage );
65 bool Stage::IsInstalled()
67 return Internal::Stage::IsInstalled();
70 void Stage::Add(Actor& actor)
72 GetImplementation(*this).Add(GetImplementation(actor));
75 void Stage::Remove(Actor& actor)
77 GetImplementation(*this).Remove(GetImplementation(actor));
80 RenderTaskList Stage::GetRenderTaskList() const
82 return RenderTaskList( &GetImplementation(*this).GetRenderTaskList() );
85 Vector2 Stage::GetSize() const
87 return GetImplementation(*this).GetSize();
90 uint32_t Stage::GetLayerCount() const
92 return GetImplementation(*this).GetLayerCount();
95 Layer Stage::GetLayer(uint32_t depth) const
97 return GetImplementation(*this).GetLayer(depth);
100 Layer Stage::GetRootLayer() const
102 return GetImplementation(*this).GetRootLayer();
105 void Stage::SetBackgroundColor(Vector4 color)
107 GetImplementation(*this).SetBackgroundColor(color);
110 Vector4 Stage::GetBackgroundColor() const
112 return GetImplementation(*this).GetBackgroundColor();
115 Vector2 Stage::GetDpi() const
117 return GetImplementation(*this).GetDpi();
120 ObjectRegistry Stage::GetObjectRegistry() const
122 Internal::Stage* stage = Internal::Stage::GetCurrent();
123 DALI_ASSERT_ALWAYS( stage && "GetObjectRegistry() : Stage is null" );
125 Internal::ObjectRegistry& internal = stage->GetObjectRegistry();
126 return ObjectRegistry(&internal);
129 void Stage::KeepRendering( float durationSeconds )
131 GetImplementation(*this).KeepRendering( durationSeconds );
134 Stage::KeyEventSignalType& Stage::KeyEventSignal()
136 return GetImplementation(*this).KeyEventSignal();
139 Stage::EventProcessingFinishedSignalType& Stage::EventProcessingFinishedSignal()
141 return GetImplementation(*this).EventProcessingFinishedSignal();
144 Stage::TouchSignalType& Stage::TouchSignal()
146 return GetImplementation( *this ).TouchSignal();
149 Stage::WheelEventSignalType& Stage::WheelEventSignal()
151 return GetImplementation(*this).WheelEventSignal();
154 Stage::ContextStatusSignal& Stage::ContextLostSignal()
156 return GetImplementation(*this).ContextLostSignal();
159 Stage::ContextStatusSignal& Stage::ContextRegainedSignal()
161 return GetImplementation(*this).ContextRegainedSignal();
164 Stage::SceneCreatedSignalType& Stage::SceneCreatedSignal()
166 return GetImplementation(*this).SceneCreatedSignal();