nui 0.2.39 release
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Layer.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 *
15 */
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 //------------------------------------------------------------------------------
18 // <auto-generated />
19 //
20 // This file was automatically generated by SWIG (http://www.swig.org).
21 // Version 3.0.9
22 //
23 // Do not make changes to this file unless you know what you are doing--modify
24 // the SWIG interface file instead.
25 //------------------------------------------------------------------------------
26
27 namespace Tizen.NUI
28 {
29     using Tizen.NUI.BaseComponents;
30     /// <summary>
31     /// Layers provide a mechanism for overlaying groups of actors on top of each other.
32     /// </summary>
33     public class Layer : Animatable
34     {
35         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
36
37         internal Layer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Layer_SWIGUpcast(cPtr), cMemoryOwn)
38         {
39             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
40         }
41
42         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Layer obj)
43         {
44             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
45         }
46
47         public virtual void Dispose()
48         {
49             if (!Window.IsInstalled())
50             {
51                 DisposeQueue.Instance.Add(this);
52                 return;
53             }
54
55             lock (this)
56             {
57                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
58                 {
59                     if (swigCMemOwn)
60                     {
61                         swigCMemOwn = false;
62                         NDalicPINVOKE.delete_Layer(swigCPtr);
63                     }
64                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
65                 }
66                 global::System.GC.SuppressFinalize(this);
67                 //base.Dispose();  //xb.teng
68             }
69         }
70
71
72         internal class Property : global::System.IDisposable
73         {
74             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
75             protected bool swigCMemOwn;
76
77             internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
78             {
79                 swigCMemOwn = cMemoryOwn;
80                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
81             }
82
83             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
84             {
85                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
86             }
87
88             ~Property()
89             {
90                 DisposeQueue.Instance.Add(this);
91             }
92
93             public virtual void Dispose()
94             {
95                 if (!Window.IsInstalled()) {
96                     DisposeQueue.Instance.Add(this);
97                     return;
98                 }
99
100                 lock (this)
101                 {
102                     if (swigCPtr.Handle != global::System.IntPtr.Zero)
103                     {
104                         if (swigCMemOwn)
105                         {
106                             swigCMemOwn = false;
107                             NDalicPINVOKE.delete_Layer_Property(swigCPtr);
108                         }
109                         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
110                     }
111                     global::System.GC.SuppressFinalize(this);
112                 }
113             }
114
115             internal Property() : this(NDalicPINVOKE.new_Layer_Property(), true)
116             {
117                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
118             }
119
120             internal static readonly int CLIPPING_ENABLE = NDalicPINVOKE.Layer_Property_CLIPPING_ENABLE_get();
121             internal static readonly int CLIPPING_BOX = NDalicPINVOKE.Layer_Property_CLIPPING_BOX_get();
122             internal static readonly int BEHAVIOR = NDalicPINVOKE.Layer_Property_BEHAVIOR_get();
123
124         }
125
126         /// <summary>
127         /// Creates a Layer object.
128         /// </summary>
129         public Layer() : this(NDalicPINVOKE.Layer_New(), true)
130         {
131             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
132
133         }
134         /// <summary>
135         /// Downcasts a handle to Layer handle.<br>
136         /// If handle points to a Layer, the downcast produces valid handle.<br>
137         /// If not, the returned handle is left uninitialized.<br>
138         /// </summary>
139         /// <param name="handle">Handle to an object</param>
140         /// <returns>Handle to a Layer or an uninitialized handle</returns>
141         public new static Layer DownCast(BaseHandle handle)
142         {
143             Layer ret = new Layer(NDalicPINVOKE.Layer_DownCast(BaseHandle.getCPtr(handle)), true);
144             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
145             return ret;
146         }
147
148         internal Layer(Layer copy) : this(NDalicPINVOKE.new_Layer__SWIG_1(Layer.getCPtr(copy)), true)
149         {
150             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
151         }
152
153         internal Layer Assign(Layer rhs)
154         {
155             Layer ret = new Layer(NDalicPINVOKE.Layer_Assign(swigCPtr, Layer.getCPtr(rhs)), false);
156             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
157             return ret;
158         }
159
160         public View FindChildById(uint id)
161         {
162             View ret = new View(NDalicPINVOKE.Actor_FindChildById(swigCPtr, id), true);
163             if (NDalicPINVOKE.SWIGPendingException.Pending)
164                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
165             return ret;
166         }
167
168         public void Add(View child)
169         {
170             NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child));
171             if (NDalicPINVOKE.SWIGPendingException.Pending)
172                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
173         }
174
175         public void Remove(View child)
176         {
177             NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child));
178             if (NDalicPINVOKE.SWIGPendingException.Pending)
179                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180         }
181
182         /// <summary>
183         /// Queries the depth of the layer.<br>
184         /// 0 is the bottom most layer, higher number is on top.<br>
185         /// </summary>
186         public uint Depth
187         {
188             get
189             {
190                 return GetDepth();
191             }
192         }
193
194         internal uint GetDepth()
195         {
196             uint ret = NDalicPINVOKE.Layer_GetDepth(swigCPtr);
197             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
198             return ret;
199         }
200
201         /// <summary>
202         /// Increments the depth of the layer.
203         /// </summary>
204         public void Raise()
205         {
206             NDalicPINVOKE.Layer_Raise(swigCPtr);
207             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
208         }
209
210         /// <summary>
211         /// Decrements the depth of the layer.
212         /// </summary>
213         public void Lower()
214         {
215             NDalicPINVOKE.Layer_Lower(swigCPtr);
216             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
217         }
218
219         internal void RaiseAbove(Layer target)
220         {
221             NDalicPINVOKE.Layer_RaiseAbove(swigCPtr, Layer.getCPtr(target));
222             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
223         }
224
225         internal void LowerBelow(Layer target)
226         {
227             NDalicPINVOKE.Layer_LowerBelow(swigCPtr, Layer.getCPtr(target));
228             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
229         }
230
231         /// <summary>
232         /// Raises the layer to the top.
233         /// </summary>
234         public void RaiseToTop()
235         {
236             NDalicPINVOKE.Layer_RaiseToTop(swigCPtr);
237             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
238         }
239
240         /// <summary>
241         /// Lowers the layer to the bottom.
242         /// </summary>
243         public void LowerToBottom()
244         {
245             NDalicPINVOKE.Layer_LowerToBottom(swigCPtr);
246             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
247         }
248
249         /// <summary>
250         /// Moves the layer directly above the given layer.<br>
251         /// After the call, this layers depth will be immediately above target.<br>
252         /// </summary>
253         /// <param name="target">Layer to get on top of</param>
254         public void MoveAbove(Layer target)
255         {
256             NDalicPINVOKE.Layer_MoveAbove(swigCPtr, Layer.getCPtr(target));
257             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
258         }
259
260         /// <summary>
261         /// Moves the layer directly below the given layer.<br>
262         /// After the call, this layers depth will be immediately below target.<br>
263         /// </summary>
264         /// <param name="target">Layer to get below of</param>
265         public void MoveBelow(Layer target)
266         {
267             NDalicPINVOKE.Layer_MoveBelow(swigCPtr, Layer.getCPtr(target));
268             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
269         }
270
271         internal void SetBehavior(LayerBehavior behavior)
272         {
273             NDalicPINVOKE.Layer_SetBehavior(swigCPtr, (int)behavior);
274             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
275         }
276
277         internal LayerBehavior GetBehavior()
278         {
279             Layer.LayerBehavior ret = (Layer.LayerBehavior)NDalicPINVOKE.Layer_GetBehavior(swigCPtr);
280             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
281             return ret;
282         }
283
284         internal void SetClipping(bool enabled)
285         {
286             NDalicPINVOKE.Layer_SetClipping(swigCPtr, enabled);
287             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
288         }
289
290         internal bool IsClipping()
291         {
292             bool ret = NDalicPINVOKE.Layer_IsClipping(swigCPtr);
293             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
294             return ret;
295         }
296
297         internal void SetClippingBox(int x, int y, int width, int height)
298         {
299             NDalicPINVOKE.Layer_SetClippingBox__SWIG_0(swigCPtr, x, y, width, height);
300             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
301         }
302
303         /// <summary>
304         /// Sets the clipping box of a layer, in window coordinates.<br>
305         /// The contents of the layer will not be visible outside this box, when clipping is
306         /// enabled. The default clipping box is empty (0,0,0,0) which means everything is clipped.<br>
307         /// </summary>
308         /// <param name="box">The clipping box</param>
309         public void SetClippingBox(Rectangle box)
310         {
311             NDalicPINVOKE.Layer_SetClippingBox__SWIG_1(swigCPtr, Rectangle.getCPtr(box));
312             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
313         }
314
315         /// <summary>
316         /// Retrieves the clipping box of a layer in window coordinates.
317         /// </summary>
318         /// <returns>The clipping box</returns>
319         public Rectangle GetClippingBox()
320         {
321             Rectangle ret = new Rectangle(NDalicPINVOKE.Layer_GetClippingBox(swigCPtr), true);
322             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
323             return ret;
324         }
325
326         internal void SetDepthTestDisabled(bool disable)
327         {
328             NDalicPINVOKE.Layer_SetDepthTestDisabled(swigCPtr, disable);
329             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
330         }
331
332         internal bool IsDepthTestDisabled()
333         {
334             bool ret = NDalicPINVOKE.Layer_IsDepthTestDisabled(swigCPtr);
335             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
336             return ret;
337         }
338
339         internal void SetSortFunction(SWIGTYPE_p_f_r_q_const__Dali__Vector3__float function)
340         {
341             NDalicPINVOKE.Layer_SetSortFunction(swigCPtr, SWIGTYPE_p_f_r_q_const__Dali__Vector3__float.getCPtr(function));
342             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
343         }
344
345         internal void SetTouchConsumed(bool consume)
346         {
347             NDalicPINVOKE.Layer_SetTouchConsumed(swigCPtr, consume);
348             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
349         }
350
351         internal bool IsTouchConsumed()
352         {
353             bool ret = NDalicPINVOKE.Layer_IsTouchConsumed(swigCPtr);
354             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
355             return ret;
356         }
357
358         internal void SetHoverConsumed(bool consume)
359         {
360             NDalicPINVOKE.Layer_SetHoverConsumed(swigCPtr, consume);
361             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
362         }
363
364         internal bool IsHoverConsumed()
365         {
366             bool ret = NDalicPINVOKE.Layer_IsHoverConsumed(swigCPtr);
367             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
368             return ret;
369         }
370
371         /// <summary>
372         /// Retrieves child view by index.
373         /// </summary>
374         /// <pre>The View has been initialized.</pre>
375         /// <param name="index">The index of the child to retrieve</param>
376         /// <returns>The view for the given index or empty handle if children not initialized</returns>
377         public View GetChildAt(uint index)
378         {
379             View ret = new View(NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index), true);
380             if (NDalicPINVOKE.SWIGPendingException.Pending)
381                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
382             return ret;
383         }
384
385         /// <summary>
386         /// Enumeration for the behavior of the layer.
387         /// </summary>
388         public enum LayerBehavior
389         {
390             Layer2D,
391             LayerUI = Layer2D,
392             Layer3D
393         }
394
395         internal enum TreeDepthMultiplier
396         {
397             TREE_DEPTH_MULTIPLIER = 10000
398         }
399
400         /// <summary>
401         /// Layer ClippingEnable, type bool
402         /// </summary>
403         public bool ClippingEnable
404         {
405             get
406             {
407                 bool temp = false;
408                 GetProperty(Layer.Property.CLIPPING_ENABLE).Get(ref temp);
409                 return temp;
410             }
411             set
412             {
413                 SetProperty(Layer.Property.CLIPPING_ENABLE, new Tizen.NUI.PropertyValue(value));
414             }
415         }
416         /// <summary>
417         /// Layer ClippingBox, type Rectangle
418         /// </summary>
419         public Rectangle ClippingBox
420         {
421             get
422             {
423                 Rectangle temp = new Rectangle(0, 0, 0, 0);
424                 GetProperty(Layer.Property.CLIPPING_BOX).Get(temp);
425                 return temp;
426             }
427             set
428             {
429                 SetProperty(Layer.Property.CLIPPING_BOX, new Tizen.NUI.PropertyValue(value));
430             }
431         }
432         /// <summary>
433         /// Layer Behavior, type String(Layer.LayerBehavior)
434         /// </summary>
435         public Layer.LayerBehavior Behavior
436         {
437             get
438             {
439                 return GetBehavior();
440             }
441             set
442             {
443                 SetBehavior(value);
444             }
445         }
446
447     }
448
449 }