2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.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
8 // http://floralicense.org/license/
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.
18 #include <dali/public-api/actors/layer.h>
21 #include <dali/internal/event/actors/layer-impl.h>
22 #include <dali/internal/event/images/frame-buffer-image-impl.h>
29 const char* const Layer::ACTION_RAISE = "raise";
30 const char* const Layer::ACTION_LOWER = "lower";
31 const char* const Layer::ACTION_RAISE_TO_TOP = "raise-to-top";
32 const char* const Layer::ACTION_LOWER_TO_BOTTOM = "lower-to-bottom";
41 Internal::LayerPtr internal = Internal::Layer::New();
43 return Layer(internal.Get());
46 Layer Layer::DownCast( BaseHandle handle )
48 return Layer( dynamic_cast<Dali::Internal::Layer*>(handle.GetObjectPtr()) );
55 unsigned int Layer::GetDepth() const
57 return GetImplementation(*this).GetDepth();
62 GetImplementation(*this).Raise();
67 GetImplementation(*this).Lower();
70 void Layer::RaiseAbove( Layer target )
72 GetImplementation(*this).RaiseAbove( GetImplementation( target ) );
75 void Layer::LowerBelow( Layer target )
77 GetImplementation(*this).LowerBelow( GetImplementation( target ) );
80 void Layer::RaiseToTop()
82 GetImplementation(*this).RaiseToTop();
85 void Layer::LowerToBottom()
87 GetImplementation(*this).LowerToBottom();
90 void Layer::MoveAbove( Layer target )
92 GetImplementation(*this).MoveAbove( GetImplementation( target ) );
95 void Layer::MoveBelow( Layer target )
97 GetImplementation(*this).MoveBelow( GetImplementation( target ) );
100 void Layer::SetClipping(bool enabled)
102 GetImplementation(*this).SetClipping(enabled);
105 bool Layer::IsClipping() const
107 return GetImplementation(*this).IsClipping();
110 void Layer::SetClippingBox(int x, int y, int width, int height)
112 GetImplementation(*this).SetClippingBox(x, y, width, height);
115 void Layer::SetClippingBox(ClippingBox box)
117 GetImplementation(*this).SetClippingBox(box.x, box.y, box.width, box.height);
120 ClippingBox Layer::GetClippingBox() const
122 return GetImplementation(*this).GetClippingBox();
125 void Layer::SetDepthTestDisabled( bool disable )
127 GetImplementation(*this).SetDepthTestDisabled( disable );
130 bool Layer::IsDepthTestDisabled() const
132 return GetImplementation(*this).IsDepthTestDisabled();
135 float Layer::ZValue(const Vector3& position, float sortModifier)
137 return -position.z + sortModifier;
140 void Layer::SetSortFunction(SortFunctionType function)
142 GetImplementation(*this).SetSortFunction(function);
145 Layer::Layer(Internal::Layer* internal)