[SRUK] Initial copy from Tizen 2.2 version
[platform/core/uifw/dali-core.git] / dali / public-api / common / stage.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://floralicense.org/license/
9 //
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.
15 //
16
17 // CLASS HEADER
18 #include <dali/public-api/common/stage.h>
19
20 // INTERNAL INCLUDES
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>
30
31 using namespace std;
32
33 namespace Dali
34 {
35
36 using Internal::Core;
37
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);
40
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";
44
45 Stage::Stage()
46 {
47 }
48
49 Stage::~Stage()
50 {
51 }
52
53 Stage::Stage(Internal::Stage* internal)
54 : BaseHandle(internal)
55 {
56 }
57
58 Stage Stage::GetCurrent()
59 {
60   return Stage(Internal::Stage::GetCurrent());
61 }
62
63 bool Stage::IsInstalled()
64 {
65   return Internal::Stage::IsInstalled();
66 }
67
68 void Stage::Add(Actor& actor)
69 {
70   GetImplementation(*this).Add(GetImplementation(actor));
71 }
72
73 void Stage::Remove(Actor& actor)
74 {
75   GetImplementation(*this).Remove(GetImplementation(actor));
76 }
77
78 RenderTaskList Stage::GetRenderTaskList() const
79 {
80   return RenderTaskList( &GetImplementation(*this).GetRenderTaskList() );
81 }
82
83 Vector2 Stage::GetSize() const
84 {
85   return GetImplementation(*this).GetSize();
86 }
87
88 unsigned int Stage::GetLayerCount() const
89 {
90   return GetImplementation(*this).GetLayerCount();
91 }
92
93 Layer Stage::GetLayer(unsigned int depth) const
94 {
95   return GetImplementation(*this).GetLayer(depth);
96 }
97
98 Layer Stage::GetRootLayer() const
99 {
100   return GetImplementation(*this).GetRootLayer();
101 }
102
103 void Stage::SetBackgroundColor(Vector4 color)
104 {
105   GetImplementation(*this).SetBackgroundColor(color);
106 }
107
108 Vector4 Stage::GetBackgroundColor() const
109 {
110   return GetImplementation(*this).GetBackgroundColor();
111 }
112
113 Vector2 Stage::GetDpi() const
114 {
115   return GetImplementation(*this).GetDpi();
116 }
117
118 ObjectRegistry Stage::GetObjectRegistry() const
119 {
120   Internal::ObjectRegistry& internal = Internal::Stage::GetCurrent()->GetObjectRegistry();
121
122   return ObjectRegistry(&internal);
123 }
124
125 DynamicsWorld Stage::InitializeDynamics(DynamicsWorldConfig config)
126 {
127   Internal::DynamicsWorldConfigPtr configImpl( &(GetImplementation(config)) );
128
129   return DynamicsWorld( GetImplementation(*this).InitializeDynamics(configImpl).Get() );
130 }
131
132 DynamicsWorld Stage::GetDynamicsWorld()
133 {
134   return DynamicsWorld( GetImplementation(*this).GetDynamicsWorld().Get() );
135 }
136
137 void Stage::TerminateDynamics()
138 {
139   GetImplementation(*this).TerminateDynamics();
140 }
141
142 void Stage::KeepRendering( float durationSeconds )
143 {
144   GetImplementation(*this).KeepRendering( durationSeconds );
145 }
146
147 Stage::KeyEventSignalV2& Stage::KeyEventSignal()
148 {
149   return GetImplementation(*this).KeyEventSignal();
150 }
151
152 Stage::EventProcessingFinishedSignalV2& Stage::EventProcessingFinishedSignal()
153 {
154   return GetImplementation(*this).EventProcessingFinishedSignal();
155 }
156
157 Stage::TouchedSignalV2& Stage::TouchedSignal()
158 {
159   return GetImplementation(*this).TouchedSignal();
160 }
161
162 } // namespace Dali