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>
43 const Vector4 Stage::DEFAULT_BACKGROUND_COLOR(0.0f, 0.0f, 0.0f, 1.0f);
44 const Vector4 Stage::DEBUG_BACKGROUND_COLOR(0.2f, 0.5f, 0.2f, 1.0f);
46 const char* const Stage::SIGNAL_KEY_EVENT = "key-event";
47 const char* const Stage::SIGNAL_EVENT_PROCESSING_FINISHED = "event-processing-finished";
48 const char* const Stage::SIGNAL_TOUCHED = "touched";
58 Stage::Stage(const Stage& handle)
63 Stage& Stage::operator=(const Stage& rhs)
65 BaseHandle::operator=(rhs);
69 Stage::Stage(Internal::Stage* internal)
70 : BaseHandle(internal)
74 Stage Stage::GetCurrent()
76 return Stage(Internal::Stage::GetCurrent());
79 bool Stage::IsInstalled()
81 return Internal::Stage::IsInstalled();
84 void Stage::Add(Actor& actor)
86 GetImplementation(*this).Add(GetImplementation(actor));
89 void Stage::Remove(Actor& actor)
91 GetImplementation(*this).Remove(GetImplementation(actor));
94 RenderTaskList Stage::GetRenderTaskList() const
96 return RenderTaskList( &GetImplementation(*this).GetRenderTaskList() );
99 Vector2 Stage::GetSize() const
101 return GetImplementation(*this).GetSize();
104 unsigned int Stage::GetLayerCount() const
106 return GetImplementation(*this).GetLayerCount();
109 Layer Stage::GetLayer(unsigned int depth) const
111 return GetImplementation(*this).GetLayer(depth);
114 Layer Stage::GetRootLayer() const
116 return GetImplementation(*this).GetRootLayer();
119 void Stage::SetBackgroundColor(Vector4 color)
121 GetImplementation(*this).SetBackgroundColor(color);
124 Vector4 Stage::GetBackgroundColor() const
126 return GetImplementation(*this).GetBackgroundColor();
129 Vector2 Stage::GetDpi() const
131 return GetImplementation(*this).GetDpi();
134 ObjectRegistry Stage::GetObjectRegistry() const
136 Internal::ObjectRegistry& internal = Internal::Stage::GetCurrent()->GetObjectRegistry();
138 return ObjectRegistry(&internal);
141 DynamicsWorld Stage::InitializeDynamics(DynamicsWorldConfig config)
143 #ifdef DYNAMICS_SUPPORT
144 Internal::DynamicsWorldConfigPtr configImpl( &(GetImplementation(config)) );
146 return DynamicsWorld( GetImplementation(*this).InitializeDynamics(configImpl).Get() );
148 return DynamicsWorld();
152 DynamicsWorld Stage::GetDynamicsWorld()
154 #ifdef DYNAMICS_SUPPORT
155 return DynamicsWorld( GetImplementation(*this).GetDynamicsWorld().Get() );
157 return DynamicsWorld();
161 void Stage::TerminateDynamics()
163 #ifdef DYNAMICS_SUPPORT
164 GetImplementation(*this).TerminateDynamics();
168 void Stage::KeepRendering( float durationSeconds )
170 GetImplementation(*this).KeepRendering( durationSeconds );
173 Stage::KeyEventSignalV2& Stage::KeyEventSignal()
175 return GetImplementation(*this).KeyEventSignal();
178 Stage::EventProcessingFinishedSignalV2& Stage::EventProcessingFinishedSignal()
180 return GetImplementation(*this).EventProcessingFinishedSignal();
183 Stage::TouchedSignalV2& Stage::TouchedSignal()
185 return GetImplementation(*this).TouchedSignal();
188 Stage::ContextStatusSignal& Stage::ContextLostSignal()
190 return GetImplementation(*this).ContextLostSignal();
193 Stage::ContextStatusSignal& Stage::ContextRegainedSignal()
195 return GetImplementation(*this).ContextRegainedSignal();
198 Stage::SceneCreatedSignalV2& Stage::SceneCreatedSignal()
200 return GetImplementation(*this).SceneCreatedSignal();