1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
\r
3 * Licensed under the Apache License, Version 2.0 (the "License");
\r
4 * you may not use this file except in compliance with the License.
\r
5 * You may obtain a copy of the License at
\r
7 * http://www.apache.org/licenses/LICENSE-2.0
\r
9 * Unless required by applicable law or agreed to in writing, software
\r
10 * distributed under the License is distributed on an "AS IS" BASIS,
\r
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
12 * See the License for the specific language governing permissions and
\r
13 * limitations under the License.
\r
19 using Tizen.NUI.BaseComponents;
\r
22 /// Layers provide a mechanism for overlaying groups of actors on top of each other.
\r
24 public class Layer : Animatable
\r
26 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
\r
28 internal Layer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Layer_SWIGUpcast(cPtr), cMemoryOwn)
\r
30 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
\r
33 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Layer obj)
\r
35 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
\r
38 protected override void Dispose(DisposeTypes type)
\r
45 if (type == DisposeTypes.Explicit)
\r
48 //Release your own managed resources here.
\r
49 //You should release all of your own disposable objects here.
\r
52 //Release your own unmanaged resources here.
\r
53 //You should not access any managed member here except static instance.
\r
54 //because the execution order of Finalizes is non-deterministic.
\r
56 if (swigCPtr.Handle != global::System.IntPtr.Zero)
\r
60 swigCMemOwn = false;
\r
61 NDalicPINVOKE.delete_Layer(swigCPtr);
\r
63 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
\r
70 internal class Property
\r
72 internal static readonly int BEHAVIOR = NDalicPINVOKE.Layer_Property_BEHAVIOR_get();
\r
76 /// Creates a Layer object.
\r
78 public Layer() : this(NDalicPINVOKE.Layer_New(), true)
\r
80 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
84 /// this method will be changed as internal method on later release
86 public new static Layer DownCast(BaseHandle handle)
\r
88 Layer ret = new Layer(NDalicPINVOKE.Layer_DownCast(BaseHandle.getCPtr(handle)), true);
\r
89 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
94 /// Search through this layer's hierarchy for an view with the given unique ID.
\r
96 /// <pre>This layer(the parent) has been initialized.</pre>
\r
97 /// <remarks>The actor itself is also considered in the search.</remarks>
\r
98 /// <param name="child">The id of the child to find</param>
\r
99 /// <returns> A handle to the view if found, or an empty handle if not. </returns>
\r
100 public View FindChildById(uint id)
\r
102 View ret = new View(NDalicPINVOKE.Actor_FindChildById(swigCPtr, id), true);
\r
103 if (NDalicPINVOKE.SWIGPendingException.Pending)
\r
104 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
109 /// Adds a child view to this layer.
\r
111 /// <pre>This layer(the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent layer.</pre>
\r
112 /// <post>The child will be referenced by its parent. This means that the child will be kept alive, even if the handle passed into this method is reset or destroyed.</post>
\r
113 /// <remarks>If the child already has a parent, it will be removed from old parent and reparented to this layer. This may change child's position, color, scale etc as it now inherits them from this layer.</remarks>
\r
114 /// <param name="child">The child</param>
\r
115 public void Add(View child)
\r
117 NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child));
\r
118 if (NDalicPINVOKE.SWIGPendingException.Pending)
\r
119 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
123 /// Removes a child View from this layer. If the view was not a child of this layer, this is a no-op.
\r
125 /// <pre>This layer(the parent) has been initialized. The child view is not the same as the parent view.</pre>
\r
126 /// <param name="child">The child</param>
\r
127 public void Remove(View child)
\r
129 NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child));
\r
130 if (NDalicPINVOKE.SWIGPendingException.Pending)
\r
131 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
135 /// Queries the depth of the layer.<br>
\r
136 /// 0 is the bottom most layer, higher number is on top.<br>
\r
146 internal uint GetDepth()
\r
148 uint ret = NDalicPINVOKE.Layer_GetDepth(swigCPtr);
\r
149 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
154 /// Increments the depth of the layer.
\r
156 public void Raise()
\r
158 NDalicPINVOKE.Layer_Raise(swigCPtr);
\r
159 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
163 /// Decrements the depth of the layer.
\r
165 public void Lower()
\r
167 NDalicPINVOKE.Layer_Lower(swigCPtr);
\r
168 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
171 internal void RaiseAbove(Layer target)
\r
173 NDalicPINVOKE.Layer_RaiseAbove(swigCPtr, Layer.getCPtr(target));
\r
174 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
177 internal void LowerBelow(Layer target)
\r
179 NDalicPINVOKE.Layer_LowerBelow(swigCPtr, Layer.getCPtr(target));
\r
180 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
184 /// Raises the layer to the top.
\r
186 public void RaiseToTop()
\r
188 NDalicPINVOKE.Layer_RaiseToTop(swigCPtr);
\r
189 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
193 /// Lowers the layer to the bottom.
\r
195 public void LowerToBottom()
\r
197 NDalicPINVOKE.Layer_LowerToBottom(swigCPtr);
\r
198 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
202 /// Moves the layer directly above the given layer.<br>
\r
203 /// After the call, this layers depth will be immediately above target.<br>
\r
205 /// <param name="target">Layer to get on top of</param>
\r
206 public void MoveAbove(Layer target)
\r
208 NDalicPINVOKE.Layer_MoveAbove(swigCPtr, Layer.getCPtr(target));
\r
209 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
213 /// Moves the layer directly below the given layer.<br>
\r
214 /// After the call, this layers depth will be immediately below target.<br>
\r
216 /// <param name="target">Layer to get below of</param>
\r
217 public void MoveBelow(Layer target)
\r
219 NDalicPINVOKE.Layer_MoveBelow(swigCPtr, Layer.getCPtr(target));
\r
220 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
223 private void SetBehavior(LayerBehavior behavior)
\r
225 NDalicPINVOKE.Layer_SetBehavior(swigCPtr, (int)behavior);
\r
226 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
229 private LayerBehavior GetBehavior()
\r
231 Layer.LayerBehavior ret = (Layer.LayerBehavior)NDalicPINVOKE.Layer_GetBehavior(swigCPtr);
\r
232 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
236 internal void SetSortFunction(SWIGTYPE_p_f_r_q_const__Dali__Vector3__float function)
\r
238 NDalicPINVOKE.Layer_SetSortFunction(swigCPtr, SWIGTYPE_p_f_r_q_const__Dali__Vector3__float.getCPtr(function));
\r
239 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
242 internal void SetTouchConsumed(bool consume)
\r
244 NDalicPINVOKE.Layer_SetTouchConsumed(swigCPtr, consume);
\r
245 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
248 internal bool IsTouchConsumed()
\r
250 bool ret = NDalicPINVOKE.Layer_IsTouchConsumed(swigCPtr);
\r
251 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
255 internal void SetHoverConsumed(bool consume)
\r
257 NDalicPINVOKE.Layer_SetHoverConsumed(swigCPtr, consume);
\r
258 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
261 internal bool IsHoverConsumed()
\r
263 bool ret = NDalicPINVOKE.Layer_IsHoverConsumed(swigCPtr);
\r
264 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
269 /// Retrieves child view by index.
\r
271 /// <pre>The View has been initialized.</pre>
\r
272 /// <param name="index">The index of the child to retrieve</param>
\r
273 /// <returns>The view for the given index or empty handle if children not initialized</returns>
\r
274 public View GetChildAt(uint index)
\r
276 System.IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index);
\r
277 cPtr = NDalicPINVOKE.View_SWIGUpcast(cPtr);
\r
278 cPtr = NDalicPINVOKE.Handle_SWIGUpcast(cPtr);
\r
280 BaseHandle ret = new BaseHandle(cPtr, false);
\r
282 View temp = ViewRegistry.GetViewFromBaseHandle(ret);
\r
284 if (NDalicPINVOKE.SWIGPendingException.Pending)
\r
285 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
287 return temp ?? null;
\r
291 /// Enumeration for the behavior of the layer.
\r
293 public enum LayerBehavior
\r
300 internal enum TreeDepthMultiplier
\r
302 TREE_DEPTH_MULTIPLIER = 10000
\r
306 /// Layer Behavior, type String(Layer.LayerBehavior)
\r
308 public Layer.LayerBehavior Behavior
\r
312 return GetBehavior();
\r
316 SetBehavior(value);
\r
321 /// Retrieves and sets the Layer's opacity.<br>
\r
323 public float Opacity
\r
328 GetProperty(View.Property.OPACITY).Get(out temp);
\r
333 SetProperty(View.Property.OPACITY, new Tizen.NUI.PropertyValue(value));
\r
338 /// Retrieves and sets the Layer's visibility.
\r
340 public bool Visibility
\r
345 GetProperty(View.Property.VISIBLE).Get(out temp);
\r
350 SetProperty(View.Property.VISIBLE, new Tizen.NUI.PropertyValue(value));
\r
355 /// Get the number of children held by the layer.
\r
357 public uint ChildCount
\r
361 uint ret = NDalicPINVOKE.Actor_GetChildCount(swigCPtr);
\r
362 if (NDalicPINVOKE.SWIGPendingException.Pending)
\r
363 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
369 /// Gets/Sets the Layer's name.
\r
383 internal string GetName()
\r
385 string ret = NDalicPINVOKE.Actor_GetName(swigCPtr);
\r
386 if (NDalicPINVOKE.SWIGPendingException.Pending)
\r
387 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
391 internal void SetName(string name)
\r
393 NDalicPINVOKE.Actor_SetName(swigCPtr, name);
\r
394 if (NDalicPINVOKE.SWIGPendingException.Pending)
\r
395 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r