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