2 * Copyright (c) 2015 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/public-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>
34 const Vector4 Stage::DEFAULT_BACKGROUND_COLOR(0.0f, 0.0f, 0.0f, 1.0f);
35 const Vector4 Stage::DEBUG_BACKGROUND_COLOR(0.2f, 0.5f, 0.2f, 1.0f);
45 Stage::Stage(const Stage& handle)
50 Stage& Stage::operator=(const Stage& rhs)
52 BaseHandle::operator=(rhs);
56 Stage::Stage(Internal::Stage* internal)
57 : BaseHandle(internal)
61 Stage Stage::GetCurrent()
63 Internal::Stage* stage = Internal::Stage::GetCurrent();
64 DALI_ASSERT_ALWAYS( stage && "Stage doesn't exist" );
65 return Stage( stage );
68 bool Stage::IsInstalled()
70 return Internal::Stage::IsInstalled();
73 void Stage::Add(Actor& actor)
75 GetImplementation(*this).Add(GetImplementation(actor));
78 void Stage::Remove(Actor& actor)
80 GetImplementation(*this).Remove(GetImplementation(actor));
83 RenderTaskList Stage::GetRenderTaskList() const
85 return RenderTaskList( &GetImplementation(*this).GetRenderTaskList() );
88 Vector2 Stage::GetSize() const
90 return GetImplementation(*this).GetSize();
93 unsigned int Stage::GetLayerCount() const
95 return GetImplementation(*this).GetLayerCount();
98 Layer Stage::GetLayer(unsigned int depth) const
100 return GetImplementation(*this).GetLayer(depth);
103 Layer Stage::GetRootLayer() const
105 return GetImplementation(*this).GetRootLayer();
108 void Stage::SetBackgroundColor(Vector4 color)
110 GetImplementation(*this).SetBackgroundColor(color);
113 Vector4 Stage::GetBackgroundColor() const
115 return GetImplementation(*this).GetBackgroundColor();
118 Vector2 Stage::GetDpi() const
120 return GetImplementation(*this).GetDpi();
123 ObjectRegistry Stage::GetObjectRegistry() const
125 Internal::Stage* stage = Internal::Stage::GetCurrent();
126 DALI_ASSERT_ALWAYS( stage && "GetObjectRegistry() : Stage is null" );
128 Internal::ObjectRegistry& internal = stage->GetObjectRegistry();
129 return ObjectRegistry(&internal);
132 void Stage::KeepRendering( float durationSeconds )
134 GetImplementation(*this).KeepRendering( durationSeconds );
137 Stage::KeyEventSignalType& Stage::KeyEventSignal()
139 return GetImplementation(*this).KeyEventSignal();
142 Stage::EventProcessingFinishedSignalType& Stage::EventProcessingFinishedSignal()
144 return GetImplementation(*this).EventProcessingFinishedSignal();
147 Stage::TouchedSignalType& Stage::TouchedSignal()
149 DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: TouchedSignal() is deprecated and will be removed from next release. Use TouchSignal() instead.\n" );
151 return GetImplementation(*this).TouchedSignal();
154 Stage::TouchSignalType& Stage::TouchSignal()
156 return GetImplementation( *this ).TouchSignal();
159 Stage::WheelEventSignalType& Stage::WheelEventSignal()
161 return GetImplementation(*this).WheelEventSignal();
164 Stage::ContextStatusSignal& Stage::ContextLostSignal()
166 return GetImplementation(*this).ContextLostSignal();
169 Stage::ContextStatusSignal& Stage::ContextRegainedSignal()
171 return GetImplementation(*this).ContextRegainedSignal();
174 Stage::SceneCreatedSignalType& Stage::SceneCreatedSignal()
176 return GetImplementation(*this).SceneCreatedSignal();