sync with devel/master branch
[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         protected override void Dispose(DisposeTypes type)
48         {
49             if(disposed)
50             {
51                 return;
52             }
53
54             if(type == DisposeTypes.Explicit)
55             {
56                 //Called by User
57                 //Release your own managed resources here.
58                 //You should release all of your own disposable objects here.
59             }
60
61             //Release your own unmanaged resources here.
62             //You should not access any managed member here except static instance.
63             //because the execution order of Finalizes is non-deterministic.
64
65             if (swigCPtr.Handle != global::System.IntPtr.Zero)
66             {
67                 if (swigCMemOwn)
68                 {
69                     swigCMemOwn = false;
70                     NDalicPINVOKE.delete_Layer(swigCPtr);
71                 }
72                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
73             }
74
75             base.Dispose(type);
76         }
77
78
79         internal class Property : global::System.IDisposable
80         {
81             private global::System.Runtime.InteropServices.HandleRef swigCPtr;
82             protected bool swigCMemOwn;
83
84             internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
85             {
86                 swigCMemOwn = cMemoryOwn;
87                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
88             }
89
90             internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
91             {
92                 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
93             }
94
95             //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) 
96
97             //A Flag to check who called Dispose(). (By User or DisposeQueue)
98             private bool isDisposeQueued = false;
99             //A Flat to check if it is already disposed.
100             protected bool disposed = false;
101
102             ~Property()
103             {
104                 if(!isDisposeQueued)
105                 {
106                     isDisposeQueued = true;
107                     DisposeQueue.Instance.Add(this);
108                 }
109             }
110
111             public void Dispose()
112             {
113                 //Throw excpetion if Dispose() is called in separate thread.
114                 if (!Window.IsInstalled())
115                 {
116                     throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
117                 }
118
119                 if (isDisposeQueued)
120                 {
121                     Dispose(DisposeTypes.Implicit);
122                 }
123                 else
124                 {
125                     Dispose(DisposeTypes.Explicit);
126                     System.GC.SuppressFinalize(this);
127                 }
128             }
129
130             protected virtual void Dispose(DisposeTypes type)
131             {
132                 if (disposed)
133                 {
134                     return;
135                 }
136
137                 if(type == DisposeTypes.Explicit)
138                 {
139                     //Called by User
140                     //Release your own managed resources here.
141                     //You should release all of your own disposable objects here.
142                 }
143
144                 //Release your own unmanaged resources here.
145                 //You should not access any managed member here except static instance.
146                 //because the execution order of Finalizes is non-deterministic.
147
148                 if (swigCPtr.Handle != global::System.IntPtr.Zero)
149                 {
150                     if (swigCMemOwn)
151                     {
152                         swigCMemOwn = false;
153                         NDalicPINVOKE.delete_Layer_Property(swigCPtr);
154                     }
155                     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
156                 }
157                 disposed = true;
158             }
159
160             internal Property() : this(NDalicPINVOKE.new_Layer_Property(), true)
161             {
162                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
163             }
164
165             internal static readonly int CLIPPING_ENABLE = NDalicPINVOKE.Layer_Property_CLIPPING_ENABLE_get();
166             internal static readonly int CLIPPING_BOX = NDalicPINVOKE.Layer_Property_CLIPPING_BOX_get();
167             internal static readonly int BEHAVIOR = NDalicPINVOKE.Layer_Property_BEHAVIOR_get();
168
169         }
170
171         /// <summary>
172         /// Creates a Layer object.
173         /// </summary>
174         public Layer() : this(NDalicPINVOKE.Layer_New(), true)
175         {
176             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177
178         }
179         /// <summary>
180         /// Downcasts a handle to Layer handle.<br>
181         /// If handle points to a Layer, the downcast produces valid handle.<br>
182         /// If not, the returned handle is left uninitialized.<br>
183         /// </summary>
184         /// <param name="handle">Handle to an object</param>
185         /// <returns>Handle to a Layer or an uninitialized handle</returns>
186         public new static Layer DownCast(BaseHandle handle)
187         {
188             Layer ret = new Layer(NDalicPINVOKE.Layer_DownCast(BaseHandle.getCPtr(handle)), true);
189             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
190             return ret;
191         }
192
193         internal Layer(Layer copy) : this(NDalicPINVOKE.new_Layer__SWIG_1(Layer.getCPtr(copy)), true)
194         {
195             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196         }
197
198         internal Layer Assign(Layer rhs)
199         {
200             Layer ret = new Layer(NDalicPINVOKE.Layer_Assign(swigCPtr, Layer.getCPtr(rhs)), false);
201             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
202             return ret;
203         }
204
205         public View FindChildById(uint id)
206         {
207             View ret = new View(NDalicPINVOKE.Actor_FindChildById(swigCPtr, id), true);
208             if (NDalicPINVOKE.SWIGPendingException.Pending)
209                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
210             return ret;
211         }
212
213         public void Add(View child)
214         {
215             NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child));
216             if (NDalicPINVOKE.SWIGPendingException.Pending)
217                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
218         }
219
220         public void Remove(View child)
221         {
222             NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child));
223             if (NDalicPINVOKE.SWIGPendingException.Pending)
224                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
225         }
226
227         /// <summary>
228         /// Queries the depth of the layer.<br>
229         /// 0 is the bottom most layer, higher number is on top.<br>
230         /// </summary>
231         public uint Depth
232         {
233             get
234             {
235                 return GetDepth();
236             }
237         }
238
239         internal uint GetDepth()
240         {
241             uint ret = NDalicPINVOKE.Layer_GetDepth(swigCPtr);
242             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
243             return ret;
244         }
245
246         /// <summary>
247         /// Increments the depth of the layer.
248         /// </summary>
249         public void Raise()
250         {
251             NDalicPINVOKE.Layer_Raise(swigCPtr);
252             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
253         }
254
255         /// <summary>
256         /// Decrements the depth of the layer.
257         /// </summary>
258         public void Lower()
259         {
260             NDalicPINVOKE.Layer_Lower(swigCPtr);
261             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
262         }
263
264         internal void RaiseAbove(Layer target)
265         {
266             NDalicPINVOKE.Layer_RaiseAbove(swigCPtr, Layer.getCPtr(target));
267             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
268         }
269
270         internal void LowerBelow(Layer target)
271         {
272             NDalicPINVOKE.Layer_LowerBelow(swigCPtr, Layer.getCPtr(target));
273             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
274         }
275
276         /// <summary>
277         /// Raises the layer to the top.
278         /// </summary>
279         public void RaiseToTop()
280         {
281             NDalicPINVOKE.Layer_RaiseToTop(swigCPtr);
282             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
283         }
284
285         /// <summary>
286         /// Lowers the layer to the bottom.
287         /// </summary>
288         public void LowerToBottom()
289         {
290             NDalicPINVOKE.Layer_LowerToBottom(swigCPtr);
291             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
292         }
293
294         /// <summary>
295         /// Moves the layer directly above the given layer.<br>
296         /// After the call, this layers depth will be immediately above target.<br>
297         /// </summary>
298         /// <param name="target">Layer to get on top of</param>
299         public void MoveAbove(Layer target)
300         {
301             NDalicPINVOKE.Layer_MoveAbove(swigCPtr, Layer.getCPtr(target));
302             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
303         }
304
305         /// <summary>
306         /// Moves the layer directly below the given layer.<br>
307         /// After the call, this layers depth will be immediately below target.<br>
308         /// </summary>
309         /// <param name="target">Layer to get below of</param>
310         public void MoveBelow(Layer target)
311         {
312             NDalicPINVOKE.Layer_MoveBelow(swigCPtr, Layer.getCPtr(target));
313             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
314         }
315
316         internal void SetBehavior(LayerBehavior behavior)
317         {
318             NDalicPINVOKE.Layer_SetBehavior(swigCPtr, (int)behavior);
319             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
320         }
321
322         internal LayerBehavior GetBehavior()
323         {
324             Layer.LayerBehavior ret = (Layer.LayerBehavior)NDalicPINVOKE.Layer_GetBehavior(swigCPtr);
325             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
326             return ret;
327         }
328
329         internal void SetClipping(bool enabled)
330         {
331             NDalicPINVOKE.Layer_SetClipping(swigCPtr, enabled);
332             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
333         }
334
335         internal bool IsClipping()
336         {
337             bool ret = NDalicPINVOKE.Layer_IsClipping(swigCPtr);
338             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
339             return ret;
340         }
341
342         internal void SetClippingBox(int x, int y, int width, int height)
343         {
344             NDalicPINVOKE.Layer_SetClippingBox__SWIG_0(swigCPtr, x, y, width, height);
345             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
346         }
347
348         /// <summary>
349         /// Sets the clipping box of a layer, in window coordinates.<br>
350         /// The contents of the layer will not be visible outside this box, when clipping is
351         /// enabled. The default clipping box is empty (0,0,0,0) which means everything is clipped.<br>
352         /// </summary>
353         /// <param name="box">The clipping box</param>
354         public void SetClippingBox(Rectangle box)
355         {
356             NDalicPINVOKE.Layer_SetClippingBox__SWIG_1(swigCPtr, Rectangle.getCPtr(box));
357             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
358         }
359
360         /// <summary>
361         /// Retrieves the clipping box of a layer in window coordinates.
362         /// </summary>
363         /// <returns>The clipping box</returns>
364         public Rectangle GetClippingBox()
365         {
366             Rectangle ret = new Rectangle(NDalicPINVOKE.Layer_GetClippingBox(swigCPtr), true);
367             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
368             return ret;
369         }
370
371         internal void SetDepthTestDisabled(bool disable)
372         {
373             NDalicPINVOKE.Layer_SetDepthTestDisabled(swigCPtr, disable);
374             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
375         }
376
377         internal bool IsDepthTestDisabled()
378         {
379             bool ret = NDalicPINVOKE.Layer_IsDepthTestDisabled(swigCPtr);
380             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
381             return ret;
382         }
383
384         internal void SetSortFunction(SWIGTYPE_p_f_r_q_const__Dali__Vector3__float function)
385         {
386             NDalicPINVOKE.Layer_SetSortFunction(swigCPtr, SWIGTYPE_p_f_r_q_const__Dali__Vector3__float.getCPtr(function));
387             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
388         }
389
390         internal void SetTouchConsumed(bool consume)
391         {
392             NDalicPINVOKE.Layer_SetTouchConsumed(swigCPtr, consume);
393             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
394         }
395
396         internal bool IsTouchConsumed()
397         {
398             bool ret = NDalicPINVOKE.Layer_IsTouchConsumed(swigCPtr);
399             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
400             return ret;
401         }
402
403         internal void SetHoverConsumed(bool consume)
404         {
405             NDalicPINVOKE.Layer_SetHoverConsumed(swigCPtr, consume);
406             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
407         }
408
409         internal bool IsHoverConsumed()
410         {
411             bool ret = NDalicPINVOKE.Layer_IsHoverConsumed(swigCPtr);
412             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
413             return ret;
414         }
415
416         /// <summary>
417         /// Retrieves child view by index.
418         /// </summary>
419         /// <pre>The View has been initialized.</pre>
420         /// <param name="index">The index of the child to retrieve</param>
421         /// <returns>The view for the given index or empty handle if children not initialized</returns>
422         public View GetChildAt(uint index)
423         {
424             View ret = new View(NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index), true);
425             if (NDalicPINVOKE.SWIGPendingException.Pending)
426                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
427             return ret;
428         }
429
430         /// <summary>
431         /// Enumeration for the behavior of the layer.
432         /// </summary>
433         public enum LayerBehavior
434         {
435             Layer2D,
436             LayerUI = Layer2D,
437             Layer3D
438         }
439
440         internal enum TreeDepthMultiplier
441         {
442             TREE_DEPTH_MULTIPLIER = 10000
443         }
444
445         /// <summary>
446         /// Layer ClippingEnable, type bool
447         /// </summary>
448         public bool ClippingEnable
449         {
450             get
451             {
452                 bool temp = false;
453                 GetProperty(Layer.Property.CLIPPING_ENABLE).Get(ref temp);
454                 return temp;
455             }
456             set
457             {
458                 SetProperty(Layer.Property.CLIPPING_ENABLE, new Tizen.NUI.PropertyValue(value));
459             }
460         }
461         /// <summary>
462         /// Layer ClippingBox, type Rectangle
463         /// </summary>
464         public Rectangle ClippingBox
465         {
466             get
467             {
468                 Rectangle temp = new Rectangle(0, 0, 0, 0);
469                 GetProperty(Layer.Property.CLIPPING_BOX).Get(temp);
470                 return temp;
471             }
472             set
473             {
474                 SetProperty(Layer.Property.CLIPPING_BOX, new Tizen.NUI.PropertyValue(value));
475             }
476         }
477         /// <summary>
478         /// Layer Behavior, type String(Layer.LayerBehavior)
479         /// </summary>
480         public Layer.LayerBehavior Behavior
481         {
482             get
483             {
484                 return GetBehavior();
485             }
486             set
487             {
488                 SetBehavior(value);
489             }
490         }
491
492     }
493
494 }