Making DALi public API typesafe using guaranteed types; uint8_t, uint32_t
[platform/core/uifw/dali-core.git] / dali / public-api / actors / layer.cpp
1 /*
2  * Copyright (c) 2018 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/actors/layer.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/event/actors/layer-impl.h>
23 #include <dali/internal/event/images/frame-buffer-image-impl.h>
24
25 namespace Dali
26 {
27
28 using Dali::Layer;
29
30 Layer::Layer()
31 {
32 }
33
34 Layer Layer::New()
35 {
36   Internal::LayerPtr internal = Internal::Layer::New();
37
38   return Layer(internal.Get());
39 }
40
41 Layer Layer::DownCast( BaseHandle handle )
42 {
43   return Layer( dynamic_cast<Dali::Internal::Layer*>(handle.GetObjectPtr()) );
44 }
45
46 Layer::~Layer()
47 {
48 }
49
50 Layer::Layer(const Layer& copy)
51 : Actor(copy)
52 {
53 }
54
55 Layer& Layer::operator=(const Layer& rhs)
56 {
57   BaseHandle::operator=(rhs);
58   return *this;
59 }
60
61 uint32_t Layer::GetDepth() const
62 {
63   return GetImplementation(*this).GetDepth();
64 }
65
66 void Layer::Raise()
67 {
68   GetImplementation(*this).Raise();
69 }
70
71 void Layer::Lower()
72 {
73   GetImplementation(*this).Lower();
74 }
75
76 void Layer::RaiseAbove( Layer target )
77 {
78   GetImplementation(*this).RaiseAbove( GetImplementation( target ) );
79 }
80
81 void Layer::LowerBelow( Layer target )
82 {
83   GetImplementation(*this).LowerBelow( GetImplementation( target ) );
84 }
85
86 void Layer::RaiseToTop()
87 {
88   GetImplementation(*this).RaiseToTop();
89 }
90
91 void Layer::LowerToBottom()
92 {
93   GetImplementation(*this).LowerToBottom();
94 }
95
96 void Layer::MoveAbove( Layer target )
97 {
98   GetImplementation(*this).MoveAbove( GetImplementation( target ) );
99 }
100
101 void Layer::MoveBelow( Layer target )
102 {
103   GetImplementation(*this).MoveBelow( GetImplementation( target ) );
104 }
105
106 void Layer::SetBehavior( Behavior behavior )
107 {
108   GetImplementation(*this).SetBehavior( behavior );
109 }
110
111 Layer::Behavior Layer::GetBehavior() const
112 {
113   return GetImplementation(*this).GetBehavior();
114 }
115
116 void Layer::SetClipping(bool enabled)
117 {
118   GetImplementation(*this).SetClipping(enabled);
119 }
120
121 bool Layer::IsClipping() const
122 {
123   return GetImplementation(*this).IsClipping();
124 }
125
126 void Layer::SetClippingBox(int32_t x, int32_t y, int32_t width, int32_t height)
127 {
128   GetImplementation(*this).SetClippingBox(x, y, width, height);
129 }
130
131 void Layer::SetClippingBox(ClippingBox box)
132 {
133   GetImplementation(*this).SetClippingBox(box.x, box.y, box.width, box.height);
134 }
135
136 ClippingBox Layer::GetClippingBox() const
137 {
138   return GetImplementation(*this).GetClippingBox();
139 }
140
141 void Layer::SetDepthTestDisabled( bool disable )
142 {
143   GetImplementation(*this).SetDepthTestDisabled( disable );
144 }
145
146 bool Layer::IsDepthTestDisabled() const
147 {
148   return GetImplementation(*this).IsDepthTestDisabled();
149 }
150
151 void Layer::SetSortFunction(SortFunctionType function)
152 {
153   GetImplementation(*this).SetSortFunction(function);
154 }
155
156 void Layer::SetTouchConsumed( bool consume )
157 {
158   GetImplementation( *this ).SetTouchConsumed( consume );
159 }
160
161 bool Layer::IsTouchConsumed() const
162 {
163   return GetImplementation( *this ).IsTouchConsumed();
164 }
165
166 void Layer::SetHoverConsumed( bool consume )
167 {
168   GetImplementation( *this ).SetHoverConsumed( consume );
169 }
170
171 bool Layer::IsHoverConsumed() const
172 {
173   return GetImplementation( *this ).IsHoverConsumed();
174 }
175
176 Layer::Layer(Internal::Layer* internal)
177 : Actor(internal)
178 {
179 }
180
181 } // namespace Dali