8c141423cf12a27e910f0a45ba7a66f476b1960d
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / Layer.cs
1 /*
2  * Copyright(c) 2019 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 using System;
18 using Tizen.NUI.BaseComponents;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.Binding;
22
23 namespace Tizen.NUI
24 {
25
26     /// <summary>
27     /// Layers provide a mechanism for overlaying groups of actors on top of each other.
28     /// </summary>
29     /// <since_tizen> 3 </since_tizen>
30     public class Layer : Container
31     {
32         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
33         private Window window;
34
35         /// <summary>
36         /// Creates a Layer object.
37         /// </summary>
38         /// <since_tizen> 3 </since_tizen>
39         public Layer() : this(Interop.Layer.Layer_New(), true)
40         {
41             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
42             if (Window.Instance != null)
43             {
44                 this.SetAnchorPoint(Tizen.NUI.PivotPoint.TopLeft);
45                 this.SetResizePolicy(ResizePolicyType.FillToParent, DimensionType.AllDimensions);
46             }
47         }
48
49         internal Layer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Layer.Layer_SWIGUpcast(cPtr), cMemoryOwn)
50         {
51             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
52         }
53
54         /// <summary>
55         /// Enumeration for the behavior of the layer.
56         /// </summary>
57         /// <since_tizen> 3 </since_tizen>
58         public enum LayerBehavior
59         {
60             /// <summary>
61             /// UI control rendering mode (default mode).
62             /// This mode is designed for UI controls that can overlap. In this
63             /// mode renderer order will be respective to the tree hierarchy of
64             /// Actors.<br />
65             /// The rendering order is depth first, so for the following actor tree,
66             /// A will be drawn first, then B, D, E, then C, F.  This ensures that
67             /// overlapping actors are drawn as expected (whereas, with breadth first
68             /// traversal, the actors would interleave).<br />
69             /// </summary>
70             /// <since_tizen> 3 </since_tizen>
71             LayerUI,
72
73             /// <summary>
74             /// UI control rendering mode.
75             /// </summary>
76             /// <since_tizen> 3 </since_tizen>
77             Layer2D = LayerUI,
78
79             /// <summary>
80             /// Layer will use depth test.
81             /// This mode is designed for a 3 dimensional scene where actors in front
82             /// of other actors will obscure them, i.e. the actors are sorted by the
83             /// distance from the camera.<br />
84             /// When using this mode, a depth test will be used. A depth clear will
85             /// happen for each layer, which means actors in a layer "above" other
86             /// layers will be rendered in front of actors in those layers regardless
87             /// of their Z positions (see Layer::Raise() and Layer::Lower()).<br />
88             /// Opaque renderers are drawn first and write to the depth buffer.  Then
89             /// transparent renderers are drawn with depth test enabled but depth
90             /// write switched off.  Transparent renderers are drawn based on their
91             /// distance from the camera.  A renderer's DEPTH_INDEX property is used to
92             /// offset the distance to the camera when ordering transparent renderers.
93             /// This is useful if you want to define the draw order of two or more
94             /// transparent renderers that are equal distance from the camera.  Unlike
95             /// LAYER_UI, parent-child relationship does not affect rendering order at
96             /// all.
97             /// </summary>
98             /// <since_tizen> 3 </since_tizen>
99             Layer3D
100         }
101
102         internal enum TreeDepthMultiplier
103         {
104             TREE_DEPTH_MULTIPLIER = 10000
105         }
106
107         /// <summary>
108         /// Layer behavior, type String (Layer.LayerBehavior).
109         /// </summary>
110         /// <since_tizen> 3 </since_tizen>
111         public Layer.LayerBehavior Behavior
112         {
113             get
114             {
115                 return GetBehavior();
116             }
117             set
118             {
119                 SetBehavior(value);
120             }
121         }
122
123         /// <summary>
124         /// Sets the viewport (in window coordinates), type rectangle.
125         /// The contents of the layer will not be visible outside this box, when ViewportEnabled is true.
126         /// </summary>
127         /// <since_tizen> 4 </since_tizen>
128         public Rectangle Viewport
129         {
130             get
131             {
132                 if (ClippingEnabled)
133                 {
134                     Rectangle ret = new Rectangle(Interop.Layer.Layer_GetClippingBox(swigCPtr), true);
135                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
136                     return ret;
137                 }
138                 else
139                 {
140                     // Clipping not enabled so return the window size
141                     Size2D windowSize = window?.Size;
142                     Rectangle ret = new Rectangle(0, 0, windowSize.Width, windowSize.Height);
143                     return ret;
144                 }
145             }
146             set
147             {
148                 Interop.Layer.Layer_SetClippingBox__SWIG_1(swigCPtr, Rectangle.getCPtr(value));
149                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
150                 ClippingEnabled = true;
151             }
152         }
153
154         /// <summary>
155         /// Retrieves and sets the layer's opacity.<br />
156         /// </summary>
157         /// <since_tizen> 3 </since_tizen>
158         public float Opacity
159         {
160             get
161             {
162                 float temp = 0.0f;
163                 GetProperty(View.Property.OPACITY).Get(out temp);
164                 return temp;
165             }
166             set
167             {
168                 SetProperty(View.Property.OPACITY, new Tizen.NUI.PropertyValue(value));
169             }
170         }
171
172         /// <summary>
173         /// Retrieves and sets the layer's visibility.
174         /// </summary>
175         /// <since_tizen> 3 </since_tizen>
176         public bool Visibility
177         {
178             get
179             {
180                 bool temp = false;
181                 GetProperty(View.Property.VISIBLE).Get(out temp);
182                 return temp;
183             }
184             set
185             {
186                 SetProperty(View.Property.VISIBLE, new Tizen.NUI.PropertyValue(value));
187             }
188         }
189
190         /// <summary>
191         /// Get the number of children held by the layer.
192         /// </summary>
193         /// <since_tizen> 3 </since_tizen>
194         public new uint ChildCount
195         {
196             get
197             {
198                 return Convert.ToUInt32(Children.Count);
199             }
200         }
201
202         /// <summary>
203         /// Gets or sets the layer's name.
204         /// </summary>
205         /// <since_tizen> 3 </since_tizen>
206         public string Name
207         {
208             get
209             {
210                 return GetName();
211             }
212             set
213             {
214                 SetName(value);
215             }
216         }
217
218         /// <summary>
219         /// Queries the depth of the layer.<br />
220         /// 0 is the bottommost layer, higher number is on the top.<br />
221         /// </summary>
222         /// <since_tizen> 3 </since_tizen>
223         public uint Depth
224         {
225             get
226             {
227                 return GetDepth();
228             }
229         }
230
231         /// <summary>
232         /// Internal only property to enable or disable clipping, type boolean.
233         /// By default, this is false, i.e., the viewport of the layer is the entire window.
234         /// </summary>
235         internal bool ClippingEnabled
236         {
237             get
238             {
239                 bool ret = Interop.Layer.Layer_IsClipping(swigCPtr);
240                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
241                 return ret;
242             }
243             set
244             {
245                 Interop.Layer.Layer_SetClipping(swigCPtr, value);
246                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
247             }
248         }
249
250         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
251         [EditorBrowsable(EditorBrowsableState.Never)]
252         public ResourceDictionary XamlResources
253         {
254             get
255             {
256                 return Application.Current.XamlResources;
257             }
258             set
259             {
260                 Application.Current.XamlResources = value;
261             }
262         }
263
264         /// From the Container base class.
265
266         /// <summary>
267         /// Adds a child view to this layer.
268         /// </summary>
269         /// <seealso cref="Container.Add">
270         /// </seealso>
271         /// <since_tizen> 4 </since_tizen>
272         public override void Add(View child)
273         {
274             Container oldParent = child.GetParent();
275
276             if (oldParent != this)
277             {
278                 if (oldParent != null)
279                 {
280                     oldParent.Remove(child);
281                 }
282                 else
283                 {
284                     child.InternalParent = this;
285                 }
286                 Interop.Actor.Actor_Add( swigCPtr , View.getCPtr(child));
287                 if (NDalicPINVOKE.SWIGPendingException.Pending)
288                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
289                 Children.Add(child);
290                 BindableObject.SetInheritedBindingContext(child, this?.BindingContext);
291             }
292         }
293
294         /// <summary>
295         /// Removes a child view from this layer. If the view was not a child of this layer, this is a no-op.
296         /// </summary>
297         /// <seealso cref="Container.Remove">
298         /// </seealso>
299         /// <since_tizen> 4 </since_tizen>
300         public override void Remove(View child)
301         {
302             Interop.Actor.Actor_Remove( swigCPtr, View.getCPtr(child));
303             if (NDalicPINVOKE.SWIGPendingException.Pending)
304                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
305
306             Children.Remove(child);
307             child.InternalParent = null;
308         }
309
310         /// <summary>
311         /// Retrieves a child view by the index.
312         /// </summary>
313         /// <pre>The view has been initialized.</pre>
314         /// <param name="index">The index of the child to retrieve.</param>
315         /// <returns>The view for the given index or empty handle if children not initialized.</returns>
316         /// <since_tizen> 4 </since_tizen>
317         public override View GetChildAt(uint index)
318         {
319             if (index < Children.Count)
320             {
321                 return Children[Convert.ToInt32(index)];
322             }
323             else
324             {
325                 return null;
326             }
327         }
328
329         /// <summary>
330         /// Get parent of the layer.
331         /// </summary>
332         /// <returns>The view's container</returns>
333         /// <since_tizen> 4 </since_tizen>
334         public override Container GetParent()
335         {
336             return null;
337         }
338
339         /// <summary>
340         /// Get the child count of the layer.
341         /// </summary>
342         /// <returns>The child count of the layer.</returns>
343         /// <since_tizen> 4 </since_tizen>
344         public override uint GetChildCount()
345         {
346             return Convert.ToUInt32(Children.Count);
347         }
348
349         /// <summary>
350         /// Downcasts a handle to layer handle.
351         /// </summary>
352         /// <since_tizen> 3 </since_tizen>
353         /// Please do not use! this will be deprecated!
354         /// Instead please use as keyword.
355         [Obsolete("Please do not use! This will be deprecated! Please use as keyword instead!")]
356         [EditorBrowsable(EditorBrowsableState.Never)]
357         public static Layer DownCast(BaseHandle handle)
358         {
359             Layer ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Layer;
360             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
361             return ret;
362         }
363
364         /// <summary>
365         /// Search through this layer's hierarchy for a view with the given unique ID.
366         /// </summary>
367         /// <pre>This layer (the parent) has been initialized.</pre>
368         /// <remarks>The actor itself is also considered in the search.</remarks>
369         /// <param name="id">The id of the child to find</param>
370         /// <returns> A handle to the view if found, or an empty handle if not. </returns>
371         /// <since_tizen> 3 </since_tizen>
372         public View FindChildById(uint id)
373         {
374             //to fix memory leak issue, match the handle count with native side.
375             IntPtr cPtr = Interop.Actor.Actor_FindChildById(swigCPtr, id);
376             HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
377             View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View;
378             Interop.BaseHandle.delete_BaseHandle(CPtr);
379             CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
380
381             if (NDalicPINVOKE.SWIGPendingException.Pending)
382                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
383             return ret;
384         }
385
386         internal override View FindCurrentChildById(uint id)
387         {
388             return FindChildById(id);
389         }
390
391         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
392         [EditorBrowsable(EditorBrowsableState.Never)]
393         public View FindChildByName(string viewName)
394         {
395             //to fix memory leak issue, match the handle count with native side.
396             IntPtr cPtr = Interop.Actor.Actor_FindChildByName(swigCPtr, viewName);
397             HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
398             View ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as View;
399             Interop.BaseHandle.delete_BaseHandle(CPtr);
400             CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
401
402             if (NDalicPINVOKE.SWIGPendingException.Pending)
403                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
404             return ret;
405         }
406
407         /// <summary>
408         /// Increments the depth of the layer.
409         /// </summary>
410         /// <since_tizen> 3 </since_tizen>
411         public void Raise()
412         {
413             var parentChildren = window?.LayersChildren;
414             if (parentChildren != null)
415             {
416                 int currentIdx = parentChildren.IndexOf(this);
417
418                 if (currentIdx >= 0 && currentIdx < parentChildren.Count - 1)
419                 {
420                     var upper = parentChildren[currentIdx + 1];
421                     RaiseAbove(upper);
422                 }
423             }
424         }
425
426         /// <summary>
427         /// Decrements the depth of the layer.
428         /// </summary>
429         /// <since_tizen> 3 </since_tizen>
430         public void Lower()
431         {
432             var parentChildren = window?.LayersChildren;
433             if (parentChildren != null)
434             {
435                 int currentIdx = parentChildren.IndexOf(this);
436
437                 if (currentIdx > 0 && currentIdx < parentChildren.Count)
438                 {
439                     var low = parentChildren[currentIdx - 1];
440                     LowerBelow(low);
441                 }
442             }
443         }
444
445         /// <summary>
446         /// Raises the layer to the top.
447         /// </summary>
448         /// <since_tizen> 3 </since_tizen>
449         public void RaiseToTop()
450         {
451             var parentChildren = window?.LayersChildren;
452
453             if (parentChildren != null)
454             {
455                 parentChildren.Remove(this);
456                 parentChildren.Add(this);
457
458                 Interop.Layer.Layer_RaiseToTop(swigCPtr);
459                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
460             }
461         }
462
463         /// <summary>
464         /// Lowers the layer to the bottom.
465         /// </summary>
466         /// <since_tizen> 3 </since_tizen>
467         public void LowerToBottom()
468         {
469             var parentChildren = window?.LayersChildren;
470
471             if (parentChildren != null)
472             {
473                 parentChildren.Remove(this);
474                 parentChildren.Insert(0, this);
475
476                 Interop.Layer.Layer_LowerToBottom(swigCPtr);
477                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
478             }
479
480         }
481
482         /// <summary>
483         /// Moves the layer directly above the given layer.<br />
484         /// After the call, this layer's depth will be immediately above target.<br />
485         /// </summary>
486         /// <param name="target">The layer to get on top of.</param>
487         /// <since_tizen> 3 </since_tizen>
488         public void MoveAbove(Layer target)
489         {
490             Interop.Layer.Layer_MoveAbove(swigCPtr, Layer.getCPtr(target));
491             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
492         }
493
494         /// <summary>
495         /// Moves the layer directly below the given layer.<br />
496         /// After the call, this layer's depth will be immediately below target.<br />
497         /// </summary>
498         /// <param name="target">The layer to get below of.</param>
499         /// <since_tizen> 3 </since_tizen>
500         public void MoveBelow(Layer target)
501         {
502             Interop.Layer.Layer_MoveBelow(swigCPtr, Layer.getCPtr(target));
503             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
504         }
505
506         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Layer obj)
507         {
508             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
509         }
510
511         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
512         [EditorBrowsable(EditorBrowsableState.Never)]
513         public void SetAnchorPoint(Vector3 anchorPoint)
514         {
515             Interop.Actor.Actor_SetAnchorPoint(swigCPtr, Vector3.getCPtr(anchorPoint));
516             if (NDalicPINVOKE.SWIGPendingException.Pending)
517                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
518         }
519
520         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
521         [EditorBrowsable(EditorBrowsableState.Never)]
522         public void SetSize(float width, float height)
523         {
524             Interop.ActorInternal.Actor_SetSize__SWIG_0(swigCPtr, width, height);
525             if (NDalicPINVOKE.SWIGPendingException.Pending)
526                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
527         }
528
529         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
530         [EditorBrowsable(EditorBrowsableState.Never)]
531         public void SetParentOrigin(Vector3 parentOrigin)
532         {
533             Interop.ActorInternal.Actor_SetParentOrigin(swigCPtr, Vector3.getCPtr(parentOrigin));
534             if (NDalicPINVOKE.SWIGPendingException.Pending)
535                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
536         }
537
538         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
539         [EditorBrowsable(EditorBrowsableState.Never)]
540         public void SetResizePolicy(ResizePolicyType policy, DimensionType dimension)
541         {
542             Interop.Actor.Actor_SetResizePolicy(swigCPtr, (int)policy, (int)dimension);
543             if (NDalicPINVOKE.SWIGPendingException.Pending)
544                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
545         }
546
547         internal uint GetDepth()
548         {
549             var parentChildren = window?.LayersChildren;
550             if (parentChildren != null)
551             {
552                 int idx = parentChildren.IndexOf(this);
553                 if (idx >= 0)
554                 {
555                     return Convert.ToUInt32(idx); ;
556                 }
557             }
558             return 0u;
559         }
560         internal void RaiseAbove(Layer target)
561         {
562             var parentChildren = window?.LayersChildren;
563             if (parentChildren != null)
564             {
565                 int currentIndex = parentChildren.IndexOf(this);
566                 int targetIndex = parentChildren.IndexOf(target);
567
568                 if (currentIndex < 0 || targetIndex < 0 ||
569                     currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
570                 {
571                     NUILog.Error("index should be bigger than 0 and less than children of layer count");
572                     return;
573                 }
574
575                 // If the currentIndex is less than the target index and the target has the same parent.
576                 if (currentIndex < targetIndex)
577                 {
578                     parentChildren.Remove(this);
579                     parentChildren.Insert(targetIndex, this);
580
581                     Interop.Layer.Layer_MoveAbove(swigCPtr, Layer.getCPtr(target));
582                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
583                 }
584             }
585         }
586
587         internal void LowerBelow(Layer target)
588         {
589             var parentChildren = window?.LayersChildren;
590
591             if (parentChildren != null)
592             {
593                 int currentIndex = parentChildren.IndexOf(this);
594                 int targetIndex = parentChildren.IndexOf(target);
595
596                 if (currentIndex < 0 || targetIndex < 0 ||
597                     currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
598                 {
599                     NUILog.Error("index should be bigger than 0 and less than children of layer count");
600                     return;
601                 }
602
603                 // If the currentIndex is not already the 0th index and the target has the same parent.
604                 if ((currentIndex != 0) && (targetIndex != -1) &&
605                     (currentIndex > targetIndex))
606                 {
607                     parentChildren.Remove(this);
608                     parentChildren.Insert(targetIndex, this);
609
610                     Interop.Layer.Layer_MoveBelow(swigCPtr, Layer.getCPtr(target));
611                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
612                 }
613             }
614         }
615
616         internal void SetSortFunction(SWIGTYPE_p_f_r_q_const__Dali__Vector3__float function)
617         {
618             Interop.Layer.Layer_SetSortFunction(swigCPtr, SWIGTYPE_p_f_r_q_const__Dali__Vector3__float.getCPtr(function));
619             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
620         }
621
622         internal void SetTouchConsumed(bool consume)
623         {
624             Interop.Layer.Layer_SetTouchConsumed(swigCPtr, consume);
625             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
626         }
627
628         internal bool IsTouchConsumed()
629         {
630             bool ret = Interop.Layer.Layer_IsTouchConsumed(swigCPtr);
631             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
632             return ret;
633         }
634
635         internal void SetHoverConsumed(bool consume)
636         {
637             Interop.Layer.Layer_SetHoverConsumed(swigCPtr, consume);
638             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
639         }
640
641         internal bool IsHoverConsumed()
642         {
643             bool ret = Interop.Layer.Layer_IsHoverConsumed(swigCPtr);
644             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
645             return ret;
646         }
647
648         internal void AddViewToLayerList(View view)
649         {
650             Children.Add(view);
651         }
652
653         internal void RemoveViewFromLayerList(View view)
654         {
655             Children.Remove(view);
656         }
657
658         internal string GetName()
659         {
660             string ret = Interop.Actor.Actor_GetName(swigCPtr);
661             if (NDalicPINVOKE.SWIGPendingException.Pending)
662                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
663             return ret;
664         }
665
666         internal void SetName(string name)
667         {
668             Interop.Actor.Actor_SetName(swigCPtr, name);
669             if (NDalicPINVOKE.SWIGPendingException.Pending)
670                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
671         }
672
673         internal void SetWindow(Window win)
674         {
675             window = win;
676         }
677
678         /// <summary>
679         /// Dispose.
680         /// </summary>
681         /// <since_tizen> 3 </since_tizen>
682         protected override void Dispose(DisposeTypes type)
683         {
684             if (disposed)
685             {
686                 return;
687             }
688
689             if (type == DisposeTypes.Explicit)
690             {
691                 //Called by User
692                 //Release your own managed resources here.
693                 //You should release all of your own disposable objects here.
694             }
695
696             //Release your own unmanaged resources here.
697             //You should not access any managed member here except static instance.
698             //because the execution order of Finalizes is non-deterministic.
699
700             if (swigCPtr.Handle != global::System.IntPtr.Zero)
701             {
702                 if (swigCMemOwn)
703                 {
704                     swigCMemOwn = false;
705                     Interop.Layer.delete_Layer(swigCPtr);
706                 }
707                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
708             }
709
710             base.Dispose(type);
711
712         }
713
714         private void SetBehavior(LayerBehavior behavior)
715         {
716             Interop.Layer.Layer_SetBehavior(swigCPtr, (int)behavior);
717             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
718         }
719
720         private LayerBehavior GetBehavior()
721         {
722             Layer.LayerBehavior ret = (Layer.LayerBehavior)Interop.Layer.Layer_GetBehavior(swigCPtr);
723             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
724             return ret;
725         }
726
727         internal class Property
728         {
729             internal static readonly int BEHAVIOR = Interop.Layer.Layer_Property_BEHAVIOR_get();
730         }
731     }
732 }