Conversion to Apache 2.0 license
[platform/core/uifw/dali-core.git] / dali / public-api / actors / layer.cpp
1 /*
2  * Copyright (c) 2014 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 const char* const Layer::ACTION_RAISE = "raise";
31 const char* const Layer::ACTION_LOWER = "lower";
32 const char* const Layer::ACTION_RAISE_TO_TOP = "raise-to-top";
33 const char* const Layer::ACTION_LOWER_TO_BOTTOM = "lower-to-bottom";
34
35
36 Layer::Layer()
37 {
38 }
39
40 Layer Layer::New()
41 {
42   Internal::LayerPtr internal = Internal::Layer::New();
43
44   return Layer(internal.Get());
45 }
46
47 Layer Layer::DownCast( BaseHandle handle )
48 {
49   return Layer( dynamic_cast<Dali::Internal::Layer*>(handle.GetObjectPtr()) );
50 }
51
52 Layer::~Layer()
53 {
54 }
55
56 unsigned int Layer::GetDepth() const
57 {
58   return GetImplementation(*this).GetDepth();
59 }
60
61 void Layer::Raise()
62 {
63   GetImplementation(*this).Raise();
64 }
65
66 void Layer::Lower()
67 {
68   GetImplementation(*this).Lower();
69 }
70
71 void Layer::RaiseAbove( Layer target )
72 {
73   GetImplementation(*this).RaiseAbove( GetImplementation( target ) );
74 }
75
76 void Layer::LowerBelow( Layer target )
77 {
78   GetImplementation(*this).LowerBelow( GetImplementation( target ) );
79 }
80
81 void Layer::RaiseToTop()
82 {
83   GetImplementation(*this).RaiseToTop();
84 }
85
86 void Layer::LowerToBottom()
87 {
88   GetImplementation(*this).LowerToBottom();
89 }
90
91 void Layer::MoveAbove( Layer target )
92 {
93   GetImplementation(*this).MoveAbove( GetImplementation( target ) );
94 }
95
96 void Layer::MoveBelow( Layer target )
97 {
98   GetImplementation(*this).MoveBelow( GetImplementation( target ) );
99 }
100
101 void Layer::SetClipping(bool enabled)
102 {
103   GetImplementation(*this).SetClipping(enabled);
104 }
105
106 bool Layer::IsClipping() const
107 {
108   return GetImplementation(*this).IsClipping();
109 }
110
111 void Layer::SetClippingBox(int x, int y, int width, int height)
112 {
113   GetImplementation(*this).SetClippingBox(x, y, width, height);
114 }
115
116 void Layer::SetClippingBox(ClippingBox box)
117 {
118   GetImplementation(*this).SetClippingBox(box.x, box.y, box.width, box.height);
119 }
120
121 ClippingBox Layer::GetClippingBox() const
122 {
123   return GetImplementation(*this).GetClippingBox();
124 }
125
126 void Layer::SetDepthTestDisabled( bool disable )
127 {
128   GetImplementation(*this).SetDepthTestDisabled( disable );
129 }
130
131 bool Layer::IsDepthTestDisabled() const
132 {
133   return GetImplementation(*this).IsDepthTestDisabled();
134 }
135
136 float Layer::ZValue(const Vector3& position, float sortModifier)
137 {
138   return Internal::Layer::ZValue( position, sortModifier );
139 }
140
141 void Layer::SetSortFunction(SortFunctionType function)
142 {
143   GetImplementation(*this).SetSortFunction(function);
144 }
145
146 Layer::Layer(Internal::Layer* internal)
147 : Actor(internal)
148 {
149 }
150
151 } // namespace Dali
152