Merge "Clean up the code to build successfully on macOS" into devel/master
[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/internal/common/core-impl.h>
23 #include <dali/internal/event/common/stage-impl.h>
24 #include <dali/public-api/actors/actor.h>
25 #include <dali/public-api/actors/layer.h>
26 #include <dali/public-api/object/object-registry.h>
27 #include <dali/public-api/render-tasks/render-task-list.h>
28
29 namespace Dali
30 {
31 using Internal::Core;
32
33 Stage::Stage() = default;
34
35 Stage::~Stage() = default;
36
37 Stage::Stage(const Stage& handle) = default;
38
39 Stage& Stage::operator=(const Stage& rhs) = default;
40
41 Stage::Stage(Internal::Stage* internal)
42 : BaseHandle(internal)
43 {
44 }
45
46 Stage Stage::GetCurrent()
47 {
48   Internal::Stage* stage = Internal::Stage::GetCurrent();
49   DALI_ASSERT_ALWAYS(stage && "Stage doesn't exist");
50   return Stage(stage);
51 }
52
53 bool Stage::IsInstalled()
54 {
55   return Internal::Stage::IsInstalled();
56 }
57
58 void Stage::Add(Actor& actor)
59 {
60   GetImplementation(*this).Add(GetImplementation(actor));
61 }
62
63 void Stage::Remove(Actor& actor)
64 {
65   GetImplementation(*this).Remove(GetImplementation(actor));
66 }
67
68 RenderTaskList Stage::GetRenderTaskList() const
69 {
70   return RenderTaskList(&GetImplementation(*this).GetRenderTaskList());
71 }
72
73 Vector2 Stage::GetSize() const
74 {
75   return GetImplementation(*this).GetSize();
76 }
77
78 uint32_t Stage::GetLayerCount() const
79 {
80   return GetImplementation(*this).GetLayerCount();
81 }
82
83 Layer Stage::GetLayer(uint32_t depth) const
84 {
85   return GetImplementation(*this).GetLayer(depth);
86 }
87
88 Layer Stage::GetRootLayer() const
89 {
90   return GetImplementation(*this).GetRootLayer();
91 }
92
93 void Stage::SetBackgroundColor(Vector4 color)
94 {
95   GetImplementation(*this).SetBackgroundColor(color);
96 }
97
98 Vector4 Stage::GetBackgroundColor() const
99 {
100   return GetImplementation(*this).GetBackgroundColor();
101 }
102
103 Vector2 Stage::GetDpi() const
104 {
105   return GetImplementation(*this).GetDpi();
106 }
107
108 ObjectRegistry Stage::GetObjectRegistry() const
109 {
110   Internal::Stage* stage = Internal::Stage::GetCurrent();
111   DALI_ASSERT_ALWAYS(stage && "GetObjectRegistry() : Stage is null");
112
113   Internal::ObjectRegistry& internal = stage->GetObjectRegistry();
114   return ObjectRegistry(&internal);
115 }
116
117 void Stage::KeepRendering(float durationSeconds)
118 {
119   GetImplementation(*this).KeepRendering(durationSeconds);
120 }
121
122 Stage::KeyEventSignalType& Stage::KeyEventSignal()
123 {
124   return GetImplementation(*this).KeyEventSignal();
125 }
126
127 Stage::EventProcessingFinishedSignalType& Stage::EventProcessingFinishedSignal()
128 {
129   return GetImplementation(*this).EventProcessingFinishedSignal();
130 }
131
132 Stage::TouchEventSignalType& Stage::TouchedSignal()
133 {
134   return GetImplementation(*this).TouchedSignal();
135 }
136
137 Stage::WheelEventSignalType& Stage::WheelEventSignal()
138 {
139   return GetImplementation(*this).WheelEventSignal();
140 }
141
142 Stage::ContextStatusSignal& Stage::ContextLostSignal()
143 {
144   return GetImplementation(*this).ContextLostSignal();
145 }
146
147 Stage::ContextStatusSignal& Stage::ContextRegainedSignal()
148 {
149   return GetImplementation(*this).ContextRegainedSignal();
150 }
151
152 Stage::SceneCreatedSignalType& Stage::SceneCreatedSignal()
153 {
154   return GetImplementation(*this).SceneCreatedSignal();
155 }
156
157 } // namespace Dali