Moved (DEFAULT|DEBUG)_BACKGROUND_COLOR out of Stage and over to constants.h
[platform/core/uifw/dali-core.git] / dali / devel-api / common / stage.cpp
1 /*
2  * Copyright (c) 2020 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/devel-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 Stage::Stage()
35 {
36 }
37
38 Stage::~Stage()
39 {
40 }
41
42 Stage::Stage(const Stage& handle)
43 : BaseHandle(handle)
44 {
45 }
46
47 Stage& Stage::operator=(const Stage& rhs)
48 {
49   BaseHandle::operator=(rhs);
50   return *this;
51 }
52
53 Stage::Stage(Internal::Stage* internal)
54 : BaseHandle(internal)
55 {
56 }
57
58 Stage Stage::GetCurrent()
59 {
60   Internal::Stage* stage = Internal::Stage::GetCurrent();
61   DALI_ASSERT_ALWAYS( stage && "Stage doesn't exist" );
62   return Stage( stage );
63 }
64
65 bool Stage::IsInstalled()
66 {
67   return Internal::Stage::IsInstalled();
68 }
69
70 void Stage::Add(Actor& actor)
71 {
72   GetImplementation(*this).Add(GetImplementation(actor));
73 }
74
75 void Stage::Remove(Actor& actor)
76 {
77   GetImplementation(*this).Remove(GetImplementation(actor));
78 }
79
80 RenderTaskList Stage::GetRenderTaskList() const
81 {
82   return RenderTaskList( &GetImplementation(*this).GetRenderTaskList() );
83 }
84
85 Vector2 Stage::GetSize() const
86 {
87   return GetImplementation(*this).GetSize();
88 }
89
90 uint32_t Stage::GetLayerCount() const
91 {
92   return GetImplementation(*this).GetLayerCount();
93 }
94
95 Layer Stage::GetLayer(uint32_t depth) const
96 {
97   return GetImplementation(*this).GetLayer(depth);
98 }
99
100 Layer Stage::GetRootLayer() const
101 {
102   return GetImplementation(*this).GetRootLayer();
103 }
104
105 void Stage::SetBackgroundColor(Vector4 color)
106 {
107   GetImplementation(*this).SetBackgroundColor(color);
108 }
109
110 Vector4 Stage::GetBackgroundColor() const
111 {
112   return GetImplementation(*this).GetBackgroundColor();
113 }
114
115 Vector2 Stage::GetDpi() const
116 {
117   return GetImplementation(*this).GetDpi();
118 }
119
120 ObjectRegistry Stage::GetObjectRegistry() const
121 {
122   Internal::Stage* stage = Internal::Stage::GetCurrent();
123   DALI_ASSERT_ALWAYS( stage && "GetObjectRegistry() : Stage is null" );
124
125   Internal::ObjectRegistry& internal = stage->GetObjectRegistry();
126   return ObjectRegistry(&internal);
127 }
128
129 void Stage::KeepRendering( float durationSeconds )
130 {
131   GetImplementation(*this).KeepRendering( durationSeconds );
132 }
133
134 Stage::KeyEventSignalType& Stage::KeyEventSignal()
135 {
136   return GetImplementation(*this).KeyEventSignal();
137 }
138
139 Stage::EventProcessingFinishedSignalType& Stage::EventProcessingFinishedSignal()
140 {
141   return GetImplementation(*this).EventProcessingFinishedSignal();
142 }
143
144 Stage::TouchSignalType& Stage::TouchSignal()
145 {
146   return GetImplementation( *this ).TouchSignal();
147 }
148
149 Stage::WheelEventSignalType& Stage::WheelEventSignal()
150 {
151   return GetImplementation(*this).WheelEventSignal();
152 }
153
154 Stage::ContextStatusSignal& Stage::ContextLostSignal()
155 {
156   return GetImplementation(*this).ContextLostSignal();
157 }
158
159 Stage::ContextStatusSignal& Stage::ContextRegainedSignal()
160 {
161   return GetImplementation(*this).ContextRegainedSignal();
162 }
163
164 Stage::SceneCreatedSignalType& Stage::SceneCreatedSignal()
165 {
166   return GetImplementation(*this).SceneCreatedSignal();
167 }
168
169 } // namespace Dali