2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
18 #include <dali/public-api/common/stage.h>
21 #include <dali/public-api/actors/actor.h>
22 #include <dali/public-api/render-tasks/render-task-list.h>
23 #include <dali/internal/event/common/stage-impl.h>
24 #include <dali/internal/common/core-impl.h>
25 #include <dali/internal/event/dynamics/dynamics-declarations.h>
26 #include <dali/internal/event/dynamics/dynamics-world-config-impl.h>
27 #include <dali/internal/event/dynamics/dynamics-world-impl.h>
28 #include <dali/public-api/actors/layer.h>
29 #include <dali/public-api/object/object-registry.h>
38 const Vector4 Stage::DEFAULT_BACKGROUND_COLOR(0.0f, 0.0f, 0.0f, 1.0f);
39 const Vector4 Stage::DEBUG_BACKGROUND_COLOR(0.2f, 0.5f, 0.2f, 1.0f);
41 const char* const Stage::SIGNAL_KEY_EVENT = "key-event";
42 const char* const Stage::SIGNAL_EVENT_PROCESSING_FINISHED = "event-processing-finished";
43 const char* const Stage::SIGNAL_TOUCHED = "touched";
53 Stage::Stage(Internal::Stage* internal)
54 : BaseHandle(internal)
58 Stage Stage::GetCurrent()
60 return Stage(Internal::Stage::GetCurrent());
63 bool Stage::IsInstalled()
65 return Internal::Stage::IsInstalled();
68 void Stage::Add(Actor& actor)
70 GetImplementation(*this).Add(GetImplementation(actor));
73 void Stage::Remove(Actor& actor)
75 GetImplementation(*this).Remove(GetImplementation(actor));
78 RenderTaskList Stage::GetRenderTaskList() const
80 return RenderTaskList( &GetImplementation(*this).GetRenderTaskList() );
83 Vector2 Stage::GetSize() const
85 return GetImplementation(*this).GetSize();
88 unsigned int Stage::GetLayerCount() const
90 return GetImplementation(*this).GetLayerCount();
93 Layer Stage::GetLayer(unsigned int depth) const
95 return GetImplementation(*this).GetLayer(depth);
98 Layer Stage::GetRootLayer() const
100 return GetImplementation(*this).GetRootLayer();
103 void Stage::SetBackgroundColor(Vector4 color)
105 GetImplementation(*this).SetBackgroundColor(color);
108 Vector4 Stage::GetBackgroundColor() const
110 return GetImplementation(*this).GetBackgroundColor();
113 Vector2 Stage::GetDpi() const
115 return GetImplementation(*this).GetDpi();
118 ObjectRegistry Stage::GetObjectRegistry() const
120 Internal::ObjectRegistry& internal = Internal::Stage::GetCurrent()->GetObjectRegistry();
122 return ObjectRegistry(&internal);
125 DynamicsWorld Stage::InitializeDynamics(DynamicsWorldConfig config)
127 Internal::DynamicsWorldConfigPtr configImpl( &(GetImplementation(config)) );
129 return DynamicsWorld( GetImplementation(*this).InitializeDynamics(configImpl).Get() );
132 DynamicsWorld Stage::GetDynamicsWorld()
134 return DynamicsWorld( GetImplementation(*this).GetDynamicsWorld().Get() );
137 void Stage::TerminateDynamics()
139 GetImplementation(*this).TerminateDynamics();
142 void Stage::KeepRendering( float durationSeconds )
144 GetImplementation(*this).KeepRendering( durationSeconds );
147 Stage::KeyEventSignalV2& Stage::KeyEventSignal()
149 return GetImplementation(*this).KeyEventSignal();
152 Stage::EventProcessingFinishedSignalV2& Stage::EventProcessingFinishedSignal()
154 return GetImplementation(*this).EventProcessingFinishedSignal();
157 Stage::TouchedSignalV2& Stage::TouchedSignal()
159 return GetImplementation(*this).TouchedSignal();