Merge remote-tracking branch 'origin/tizen' into devel/new_mesh
[platform/core/uifw/dali-core.git] / dali / public-api / common / stage.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
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
18 // CLASS HEADER
19 #include <dali/public-api/common/stage.h>
20
21 // INTERNAL INCLUDES
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>
28
29 namespace Dali
30 {
31
32 using Internal::Core;
33
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);
36
37 Stage::Stage()
38 {
39 }
40
41 Stage::~Stage()
42 {
43 }
44
45 Stage::Stage(const Stage& handle)
46 : BaseHandle(handle)
47 {
48 }
49
50 Stage& Stage::operator=(const Stage& rhs)
51 {
52   BaseHandle::operator=(rhs);
53   return *this;
54 }
55
56 Stage::Stage(Internal::Stage* internal)
57 : BaseHandle(internal)
58 {
59 }
60
61 Stage Stage::GetCurrent()
62 {
63   Internal::Stage* stage = Internal::Stage::GetCurrent();
64   DALI_ASSERT_ALWAYS( stage && "Stage doesn't exist" );
65   return Stage( stage );
66 }
67
68 bool Stage::IsInstalled()
69 {
70   return Internal::Stage::IsInstalled();
71 }
72
73 void Stage::Add(Actor& actor)
74 {
75   GetImplementation(*this).Add(GetImplementation(actor));
76 }
77
78 void Stage::Remove(Actor& actor)
79 {
80   GetImplementation(*this).Remove(GetImplementation(actor));
81 }
82
83 RenderTaskList Stage::GetRenderTaskList() const
84 {
85   return RenderTaskList( &GetImplementation(*this).GetRenderTaskList() );
86 }
87
88 Vector2 Stage::GetSize() const
89 {
90   return GetImplementation(*this).GetSize();
91 }
92
93 unsigned int Stage::GetLayerCount() const
94 {
95   return GetImplementation(*this).GetLayerCount();
96 }
97
98 Layer Stage::GetLayer(unsigned int depth) const
99 {
100   return GetImplementation(*this).GetLayer(depth);
101 }
102
103 Layer Stage::GetRootLayer() const
104 {
105   return GetImplementation(*this).GetRootLayer();
106 }
107
108 void Stage::SetBackgroundColor(Vector4 color)
109 {
110   GetImplementation(*this).SetBackgroundColor(color);
111 }
112
113 Vector4 Stage::GetBackgroundColor() const
114 {
115   return GetImplementation(*this).GetBackgroundColor();
116 }
117
118 Vector2 Stage::GetDpi() const
119 {
120   return GetImplementation(*this).GetDpi();
121 }
122
123 ObjectRegistry Stage::GetObjectRegistry() const
124 {
125   Internal::ObjectRegistry& internal = Internal::Stage::GetCurrent()->GetObjectRegistry();
126
127   return ObjectRegistry(&internal);
128 }
129
130 void Stage::KeepRendering( float durationSeconds )
131 {
132   GetImplementation(*this).KeepRendering( durationSeconds );
133 }
134
135 Stage::KeyEventSignalType& Stage::KeyEventSignal()
136 {
137   return GetImplementation(*this).KeyEventSignal();
138 }
139
140 Stage::EventProcessingFinishedSignalType& Stage::EventProcessingFinishedSignal()
141 {
142   return GetImplementation(*this).EventProcessingFinishedSignal();
143 }
144
145 Stage::TouchedSignalType& Stage::TouchedSignal()
146 {
147   return GetImplementation(*this).TouchedSignal();
148 }
149
150 Stage::WheelEventSignalType& Stage::WheelEventSignal()
151 {
152   return GetImplementation(*this).WheelEventSignal();
153 }
154
155 Stage::ContextStatusSignal& Stage::ContextLostSignal()
156 {
157   return GetImplementation(*this).ContextLostSignal();
158 }
159
160 Stage::ContextStatusSignal& Stage::ContextRegainedSignal()
161 {
162   return GetImplementation(*this).ContextRegainedSignal();
163 }
164
165 Stage::SceneCreatedSignalType& Stage::SceneCreatedSignal()
166 {
167   return GetImplementation(*this).SceneCreatedSignal();
168 }
169
170 } // namespace Dali