2 * Copyright (c) 2014 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>
29 #include <dali/public-api/dynamics/dynamics-world.h>
30 #include <dali/public-api/dynamics/dynamics-world-config.h>
32 #ifdef DYNAMICS_SUPPORT
33 #include <dali/internal/event/dynamics/dynamics-declarations.h>
34 #include <dali/internal/event/dynamics/dynamics-world-config-impl.h>
35 #include <dali/internal/event/dynamics/dynamics-world-impl.h>
45 const Vector4 Stage::DEFAULT_BACKGROUND_COLOR(0.0f, 0.0f, 0.0f, 1.0f);
46 const Vector4 Stage::DEBUG_BACKGROUND_COLOR(0.2f, 0.5f, 0.2f, 1.0f);
48 const char* const Stage::SIGNAL_KEY_EVENT = "key-event";
49 const char* const Stage::SIGNAL_EVENT_PROCESSING_FINISHED = "event-processing-finished";
50 const char* const Stage::SIGNAL_TOUCHED = "touched";
60 Stage::Stage(const Stage& handle)
65 Stage& Stage::operator=(const Stage& rhs)
67 BaseHandle::operator=(rhs);
71 Stage::Stage(Internal::Stage* internal)
72 : BaseHandle(internal)
76 Stage Stage::GetCurrent()
78 return Stage(Internal::Stage::GetCurrent());
81 bool Stage::IsInstalled()
83 return Internal::Stage::IsInstalled();
86 void Stage::Add(Actor& actor)
88 GetImplementation(*this).Add(GetImplementation(actor));
91 void Stage::Remove(Actor& actor)
93 GetImplementation(*this).Remove(GetImplementation(actor));
96 RenderTaskList Stage::GetRenderTaskList() const
98 return RenderTaskList( &GetImplementation(*this).GetRenderTaskList() );
101 Vector2 Stage::GetSize() const
103 return GetImplementation(*this).GetSize();
106 unsigned int Stage::GetLayerCount() const
108 return GetImplementation(*this).GetLayerCount();
111 Layer Stage::GetLayer(unsigned int depth) const
113 return GetImplementation(*this).GetLayer(depth);
116 Layer Stage::GetRootLayer() const
118 return GetImplementation(*this).GetRootLayer();
121 void Stage::SetBackgroundColor(Vector4 color)
123 GetImplementation(*this).SetBackgroundColor(color);
126 Vector4 Stage::GetBackgroundColor() const
128 return GetImplementation(*this).GetBackgroundColor();
131 Vector2 Stage::GetDpi() const
133 return GetImplementation(*this).GetDpi();
136 ObjectRegistry Stage::GetObjectRegistry() const
138 Internal::ObjectRegistry& internal = Internal::Stage::GetCurrent()->GetObjectRegistry();
140 return ObjectRegistry(&internal);
143 DynamicsWorld Stage::InitializeDynamics(DynamicsWorldConfig config)
145 #ifdef DYNAMICS_SUPPORT
146 Internal::DynamicsWorldConfigPtr configImpl( &(GetImplementation(config)) );
148 return DynamicsWorld( GetImplementation(*this).InitializeDynamics(configImpl).Get() );
150 return DynamicsWorld();
154 DynamicsWorld Stage::GetDynamicsWorld()
156 #ifdef DYNAMICS_SUPPORT
157 return DynamicsWorld( GetImplementation(*this).GetDynamicsWorld().Get() );
159 return DynamicsWorld();
163 void Stage::TerminateDynamics()
165 #ifdef DYNAMICS_SUPPORT
166 GetImplementation(*this).TerminateDynamics();
170 void Stage::KeepRendering( float durationSeconds )
172 GetImplementation(*this).KeepRendering( durationSeconds );
175 Stage::KeyEventSignalV2& Stage::KeyEventSignal()
177 return GetImplementation(*this).KeyEventSignal();
180 Stage::EventProcessingFinishedSignalV2& Stage::EventProcessingFinishedSignal()
182 return GetImplementation(*this).EventProcessingFinishedSignal();
185 Stage::TouchedSignalV2& Stage::TouchedSignal()
187 return GetImplementation(*this).TouchedSignal();
191 Stage::ContextStatusSignal& Stage::ContextLostSignal()
193 return GetImplementation(*this).ContextLostSignal();
196 Stage::ContextStatusSignal& Stage::ContextRegainedSignal()
198 return GetImplementation(*this).ContextRegainedSignal();