[NUI] Do not connect default signals when View created
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / ViewPublicMethods.cs
1 /*
2  * Copyright(c) 2022 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
18 using System;
19 using System.ComponentModel;
20 using System.Reflection;
21 using System.Runtime.InteropServices;
22 using Tizen.NUI.Binding;
23
24 namespace Tizen.NUI.BaseComponents
25 {
26     /// <summary>
27     /// View is the base class for all views.
28     /// </summary>
29     /// <since_tizen> 3 </since_tizen>
30     public partial class View
31     {
32         /// <summary>
33         /// Perform an action on a visual registered to this view. <br />
34         /// Visuals will have actions. This API is used to perform one of these actions with the given attributes.
35         /// </summary>
36         /// <param name="propertyIndexOfVisual">The Property index of the visual.</param>
37         /// <param name="propertyIndexOfActionId">The action to perform. See Visual to find the supported actions.</param>
38         /// <param name="attributes">Optional attributes for the action.</param>
39         /// <since_tizen> 5 </since_tizen>
40         public void DoAction(int propertyIndexOfVisual, int propertyIndexOfActionId, PropertyValue attributes)
41         {
42             Interop.View.DoAction(SwigCPtr, propertyIndexOfVisual, propertyIndexOfActionId, PropertyValue.getCPtr(attributes));
43             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
44         }
45
46         /// <summary>
47         /// Creates an animation to animate the background color visual. If there is no
48         /// background visual, creates one with transparent black as it's mixColor.
49         /// </summary>
50         /// <since_tizen> 3 </since_tizen>
51         public Animation AnimateBackgroundColor(object destinationValue,
52                                                  int startTime,
53                                                  int endTime,
54                                                  AlphaFunction.BuiltinFunctions? alphaFunction = null,
55                                                  object initialValue = null)
56         {
57             if (IsBackgroundEmpty())
58             {
59                 // If there is no background yet, ensure there is a transparent
60                 // color visual
61                 BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
62             }
63             return AnimateColor("background", destinationValue, startTime, endTime, alphaFunction, initialValue);
64         }
65
66         /// <summary>
67         /// Creates an animation to animate the mixColor of the named visual.
68         /// </summary>
69         /// <since_tizen> 3 </since_tizen>
70         public Animation AnimateColor(string targetVisual, object destinationColor, int startTime, int endTime, AlphaFunction.BuiltinFunctions? alphaFunction = null, object initialColor = null)
71         {
72             Animation animation = null;
73             using (PropertyMap animator = new PropertyMap())
74             using (PropertyMap timePeriod = new PropertyMap())
75             using (PropertyValue pvDuration = new PropertyValue((endTime - startTime) / 1000.0f))
76             using (PropertyValue pvDelay = new PropertyValue(startTime / 1000.0f))
77             using (PropertyMap transition = new PropertyMap())
78             using (PropertyValue pvTarget = new PropertyValue(targetVisual))
79             using (PropertyValue pvProperty = new PropertyValue("mixColor"))
80             using (PropertyValue destValue = PropertyValue.CreateFromObject(destinationColor))
81             {
82                 if (alphaFunction != null)
83                 {
84                     using (PropertyValue pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(alphaFunction)))
85                     {
86                         animator.Add("alphaFunction", pvAlpha);
87                     }
88                 }
89
90                 timePeriod.Add("duration", pvDuration);
91                 timePeriod.Add("delay", pvDelay);
92                 using (PropertyValue pvTimePeriod = new PropertyValue(timePeriod))
93                 {
94                     animator.Add("timePeriod", pvTimePeriod);
95                 }
96                 using (PropertyValue pvAnimator = new PropertyValue(animator))
97                 {
98                     transition.Add("animator", pvAnimator);
99                 }
100                 transition.Add("target", pvTarget);
101                 transition.Add("property", pvProperty);
102
103                 if (initialColor != null)
104                 {
105                     using (PropertyValue initValue = PropertyValue.CreateFromObject(initialColor))
106                     {
107                         transition.Add("initialValue", initValue);
108                     }
109                 }
110
111                 transition.Add("targetValue", destValue);
112                 using (TransitionData transitionData = new TransitionData(transition))
113                 {
114                     animation = new Animation(Interop.View.CreateTransition(SwigCPtr, TransitionData.getCPtr(transitionData)), true);
115                 }
116                 if (NDalicPINVOKE.SWIGPendingException.Pending)
117                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
118             }
119             return animation;
120         }
121
122         // From Container Base class
123         /// <summary>
124         /// Adds a child view to this view.
125         /// </summary>
126         /// <seealso cref="Container.Add" />
127         /// <since_tizen> 4 </since_tizen>
128         public override void Add(View child)
129         {
130             bool hasLayout = (layout != null);
131
132             if (null == child)
133             {
134                 Tizen.Log.Fatal("NUI", "Child is null");
135                 return;
136             }
137
138             Container oldParent = child.GetParent();
139             if (oldParent != this)
140             {
141                 // If child already has a parent then re-parent child
142                 if (oldParent != null)
143                 {
144                     if (child.Layout != null)
145                     {
146                         child.Layout.SetReplaceFlag();
147                     }
148                     oldParent.Remove(child);
149                 }
150                 child.InternalParent = this;
151                 LayoutCount += child.LayoutCount;
152
153                 Interop.Actor.Add(SwigCPtr, View.getCPtr(child));
154
155                 if (NDalicPINVOKE.SWIGPendingException.Pending)
156                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
157                 Children.Add(child);
158                 OnChildAdded(child);
159
160                 if (ChildAdded != null)
161                 {
162                     ChildAddedEventArgs e = new ChildAddedEventArgs
163                     {
164                         Added = child
165                     };
166                     ChildAdded(this, e);
167                 }
168             }
169         }
170
171         /// <summary>
172         /// Removes a child view from this View. If the view was not a child of this view, this is a no-op.
173         /// </summary>
174         /// <seealso cref="Container.Remove" />
175         /// <since_tizen> 4 </since_tizen>
176         /// <exception cref="InvalidOperationException">Thrown when deleting a view that is not a child of this view</exception>
177         public override void Remove(View child)
178         {
179             if (child == null || child.GetParent() == null) // Early out if child null.
180                 return;
181
182             if (child.GetParent() != this)
183             {
184                 //throw new System.InvalidOperationException("You have deleted a view that is not a child of this view.");
185                 Tizen.Log.Error("NUI", "You have deleted a view that is not a child of this view.");
186                 return;
187             }
188
189             bool hasLayout = (layout != null);
190
191             // If View has a layout then do a deferred child removal
192             // Actual child removal is performed by the layouting system so
193             // transitions can be completed.
194             if (hasLayout)
195             {
196                 (layout as LayoutGroup)?.RemoveChildFromLayoutGroup(child);
197             }
198
199             RemoveChild(child);
200         }
201
202         /// <summary>
203         /// Retrieves a child view by index.
204         /// </summary>
205         /// <seealso cref="Container.GetChildAt" />
206         /// <since_tizen> 4 </since_tizen>
207         public override View GetChildAt(uint index)
208         {
209             if (index < Children.Count)
210             {
211                 return Children[Convert.ToInt32(index)];
212             }
213             else
214             {
215                 return null;
216             }
217         }
218
219         /// <summary>
220         /// Retrieves a child view as Animatable by index.
221         /// </summary>
222         /// <param name="index">The index of the Animatable to find.</param>
223         /// <returns>A handle to the view as Animatable if found, or an empty handle if not.</returns>
224         /// This will not be public opened.
225         [EditorBrowsable(EditorBrowsableState.Never)]
226         public Animatable GetChildAnimatableAt(uint index)
227         {
228             if (index < Children.Count)
229             {
230                 return Children[Convert.ToInt32(index)] as Animatable;
231             }
232             else
233             {
234                 return null;
235             }
236         }
237
238         /// <summary>
239         /// Retrieves the number of children held by the view.
240         /// </summary>
241         /// <seealso cref="Container.GetChildCount" />
242         /// <since_tizen> 4 </since_tizen>
243         [Obsolete("This has been deprecated in API9 and will be removed in API11. Use ChildCount property instead.")]
244         public override uint GetChildCount()
245         {
246             return Convert.ToUInt32(Children.Count);
247         }
248
249         /// <summary>
250         /// Gets the views parent.
251         /// </summary>
252         /// <seealso cref="Container.GetParent()" />
253         /// <since_tizen> 4 </since_tizen>
254         public override Container GetParent()
255         {
256             return InternalParent as Container;
257         }
258
259         /// <summary>
260         /// Queries whether the view has a focus.
261         /// </summary>
262         /// <returns>True if this view has a focus.</returns>
263         /// <since_tizen> 3 </since_tizen>
264         public bool HasFocus()
265         {
266             bool ret = false;
267             if (SwigCPtr.Handle != global::System.IntPtr.Zero)
268             {
269                 ret = Interop.View.HasKeyInputFocus(SwigCPtr);
270                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
271             }
272             else
273             {
274                 Tizen.Log.Error("NUI", "swigCPtr of view is already disposed.");
275             }
276             return ret;
277         }
278
279         /// <summary>
280         /// Sets the name of the style to be applied to the view.
281         /// </summary>
282         /// <param name="styleName">A string matching a style described in a stylesheet.</param>
283         /// <since_tizen> 3 </since_tizen>
284         [Obsolete("This has been deprecated in API9 and will be removed in API11. Use StyleName property instead.")]
285         public void SetStyleName(string styleName)
286         {
287             Interop.View.SetStyleName(SwigCPtr, styleName);
288             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
289         }
290
291         /// <summary>
292         /// Retrieves the name of the style to be applied to the view (if any).
293         /// </summary>
294         /// <returns>A string matching a style, or an empty string.</returns>
295         /// <since_tizen> 3 </since_tizen>
296         [Obsolete("This has been deprecated in API9 and will be removed in API11. Use StyleName property instead.")]
297         public string GetStyleName()
298         {
299             string ret = Interop.View.GetStyleName(SwigCPtr);
300             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
301             return ret;
302         }
303
304         /// <summary>
305         /// Clears the background.
306         /// </summary>
307         /// <since_tizen> 3 </since_tizen>
308         public void ClearBackground()
309         {
310             Interop.View.ClearBackground(SwigCPtr);
311             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
312         }
313
314         /// <summary>
315         /// Shows the view.
316         /// </summary>
317         /// <remarks>
318         /// This is an asynchronous method.
319         /// </remarks>
320         /// <since_tizen> 3 </since_tizen>
321         public void Show()
322         {
323             SetVisible(true);
324
325             if (GetAccessibilityStates()[AccessibilityState.Modal])
326             {
327                 RegisterDefaultLabel();
328
329                 if (Accessibility.Accessibility.IsEnabled)
330                 {
331                     EmitAccessibilityStateChangedEvent(AccessibilityState.Showing, true);
332                 }
333             }
334         }
335
336         /// <summary>
337         /// Hides the view.
338         /// </summary>
339         /// <remarks>
340         /// This is an asynchronous method.
341         /// If the view is hidden, then the view and its children will not be rendered.
342         /// This is regardless of the individual visibility of the children, i.e., the view will only be rendered if all of its parents are shown.
343         /// </remarks>
344         /// <since_tizen> 3 </since_tizen>
345         public void Hide()
346         {
347             SetVisible(false);
348
349             if (GetAccessibilityStates()[AccessibilityState.Modal])
350             {
351                 UnregisterDefaultLabel();
352
353                 if (Accessibility.Accessibility.IsEnabled)
354                 {
355                     EmitAccessibilityStateChangedEvent(AccessibilityState.Showing, false);
356                 }
357             }
358         }
359
360         /// <summary>
361         /// Raises the view above all other views.
362         /// </summary>
363         /// <remarks>
364         /// Sibling order of views within the parent will be updated automatically.
365         /// Once a raise or lower API is used, that view will then have an exclusive sibling order independent of insertion.
366         /// </remarks>
367         /// <since_tizen> 3 </since_tizen>
368         public void RaiseToTop()
369         {
370             var parentChildren = GetParent()?.Children;
371
372             if (parentChildren != null)
373             {
374                 parentChildren.Remove(this);
375                 parentChildren.Add(this);
376
377                 LayoutGroup layout = Layout as LayoutGroup;
378                 layout?.ChangeLayoutSiblingOrder(parentChildren.Count - 1);
379
380                 Interop.NDalic.RaiseToTop(SwigCPtr);
381                 if (NDalicPINVOKE.SWIGPendingException.Pending)
382                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
383             }
384
385         }
386
387         /// <summary>
388         /// Lowers the view to the bottom of all views.
389         /// </summary>
390         /// <remarks>
391         /// The sibling order of views within the parent will be updated automatically.
392         /// Once a raise or lower API is used that view will then have an exclusive sibling order independent of insertion.
393         /// </remarks>
394         /// <since_tizen> 3 </since_tizen>
395         public void LowerToBottom()
396         {
397             var parentChildren = GetParent()?.Children;
398
399             if (parentChildren != null)
400             {
401                 parentChildren.Remove(this);
402                 parentChildren.Insert(0, this);
403
404                 LayoutGroup layout = Layout as LayoutGroup;
405                 layout?.ChangeLayoutSiblingOrder(0);
406
407                 Interop.NDalic.LowerToBottom(SwigCPtr);
408                 if (NDalicPINVOKE.SWIGPendingException.Pending)
409                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
410             }
411         }
412
413         /// <summary>
414         /// Queries if all resources required by a view are loaded and ready.
415         /// </summary>
416         /// <remarks>Most resources are only loaded when the control is placed on the stage.
417         /// </remarks>
418         /// <since_tizen> 3 </since_tizen>
419         public bool IsResourceReady()
420         {
421             bool ret = Interop.View.IsResourceReady(SwigCPtr);
422             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
423             return ret;
424         }
425
426         /// <summary>
427         /// Gets the parent layer of this view.If a view has no parent, this method does not do anything.
428         /// </summary>
429         /// <pre>The view has been initialized. </pre>
430         /// <returns>The parent layer of view </returns>
431         /// <since_tizen> 5 </since_tizen>
432         public Layer GetLayer()
433         {
434             //to fix memory leak issue, match the handle count with native side.
435             IntPtr cPtr = Interop.Actor.GetLayer(SwigCPtr);
436             Layer ret = this.GetInstanceSafely<Layer>(cPtr);
437             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
438             return ret;
439         }
440
441         /// <summary>
442         /// Removes a view from its parent view or layer. If a view has no parent, this method does nothing.
443         /// </summary>
444         /// <pre>The (child) view has been initialized. </pre>
445         /// <since_tizen> 4 </since_tizen>
446         public void Unparent()
447         {
448             GetParent()?.Remove(this);
449         }
450
451         /// <summary>
452         /// Search through this view's hierarchy for a view with the given name.
453         /// The view itself is also considered in the search.
454         /// </summary>
455         /// <pre>The view has been initialized.</pre>
456         /// <param name="viewName">The name of the view to find.</param>
457         /// <returns>A handle to the view if found, or an empty handle if not.</returns>
458         /// <since_tizen> 3 </since_tizen>
459         public View FindChildByName(string viewName)
460         {
461             //to fix memory leak issue, match the handle count with native side.
462             IntPtr cPtr = Interop.Actor.FindChildByName(SwigCPtr, viewName);
463             View ret = this.GetInstanceSafely<View>(cPtr);
464             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
465             return ret;
466         }
467
468         /// <summary>
469         /// Search through this view's hierarchy for a view as Animatable with the given name.
470         /// The view itself is also considered in the search.
471         /// </summary>
472         /// <pre>The view has been initialized.</pre>
473         /// <param name="childName">The name of the Animatable to find.</param>
474         /// <returns>A handle to the view as Animatable if found, or an empty handle if not.</returns>
475         /// This will not be public opened.
476         [EditorBrowsable(EditorBrowsableState.Never)]
477         public Animatable FindChildAnimatableByName(string childName)
478         {
479             //to fix memory leak issue, match the handle count with native side.
480             IntPtr cPtr = Interop.Actor.FindChildByName(SwigCPtr, childName);
481             Animatable ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Animatable;
482             if(ret == null)
483             {
484                 // Register new camera into Registry.
485                 ret = new Animatable(cPtr, true);
486             }
487             else
488             {
489                 // We found matched NUI camera. Reduce cPtr reference count.
490                 HandleRef handle = new HandleRef(this, cPtr);
491                 Interop.Actor.DeleteActor(handle);
492                 handle = new HandleRef(null, IntPtr.Zero);
493             }
494             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
495             return ret;
496         }
497
498         /// <summary>
499         /// Converts screen coordinates into the view's coordinate system using the default camera.
500         /// </summary>
501         /// <pre>The view has been initialized.</pre>
502         /// <remarks>The view coordinates are relative to the top-left(0.0, 0.0, 0.5).</remarks>
503         /// <param name="localX">On return, the X-coordinate relative to the view.</param>
504         /// <param name="localY">On return, the Y-coordinate relative to the view.</param>
505         /// <param name="screenX">The screen X-coordinate.</param>
506         /// <param name="screenY">The screen Y-coordinate.</param>
507         /// <returns>True if the conversion succeeded.</returns>
508         /// <since_tizen> 3 </since_tizen>
509         public bool ScreenToLocal(out float localX, out float localY, float screenX, float screenY)
510         {
511             bool ret = Interop.Actor.ScreenToLocal(SwigCPtr, out localX, out localY, screenX, screenY);
512             if (NDalicPINVOKE.SWIGPendingException.Pending)
513                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
514             return ret;
515         }
516
517         /// <summary>
518         /// Sets the relative to parent size factor of the view.<br />
519         /// This factor is only used when ResizePolicy is set to either:
520         /// ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.<br />
521         /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicy.<br />
522         /// </summary>
523         /// <pre>The view has been initialized.</pre>
524         /// <param name="factor">A Vector3 representing the relative factor to be applied to each axis.</param>
525         /// <since_tizen> 3 </since_tizen>
526         public void SetSizeModeFactor(Vector3 factor)
527         {
528             Interop.Actor.SetSizeModeFactor(SwigCPtr, Vector3.getCPtr(factor));
529             if (NDalicPINVOKE.SWIGPendingException.Pending)
530                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
531         }
532         /// <summary>
533         /// Calculates the height of the view given a width.<br />
534         /// The natural size is used for default calculation.<br />
535         /// Size 0 is treated as aspect ratio 1:1.<br />
536         /// </summary>
537         /// <param name="width">The width to use.</param>
538         /// <returns>The height based on the width.</returns>
539         /// <since_tizen> 3 </since_tizen>
540         public float GetHeightForWidth(float width)
541         {
542             float ret = Interop.Actor.GetHeightForWidth(SwigCPtr, width);
543             if (NDalicPINVOKE.SWIGPendingException.Pending)
544                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
545             return ret;
546         }
547
548         /// <summary>
549         /// Calculates the width of the view given a height.<br />
550         /// The natural size is used for default calculation.<br />
551         /// Size 0 is treated as aspect ratio 1:1.<br />
552         /// </summary>
553         /// <param name="height">The height to use.</param>
554         /// <returns>The width based on the height.</returns>
555         /// <since_tizen> 3 </since_tizen>
556         public float GetWidthForHeight(float height)
557         {
558             float ret = Interop.Actor.GetWidthForHeight(SwigCPtr, height);
559             if (NDalicPINVOKE.SWIGPendingException.Pending)
560                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
561             return ret;
562         }
563
564         /// <summary>
565         /// Return the amount of size allocated for relayout.
566         /// </summary>
567         /// <param name="dimension">The dimension to retrieve.</param>
568         /// <returns>Return the size.</returns>
569         /// <since_tizen> 3 </since_tizen>
570         public float GetRelayoutSize(DimensionType dimension)
571         {
572             float ret = Interop.Actor.GetRelayoutSize(SwigCPtr, (int)dimension);
573             if (NDalicPINVOKE.SWIGPendingException.Pending)
574                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
575             return ret;
576         }
577
578         /// <summary>
579         /// Set the padding for the view.
580         /// </summary>
581         /// <param name="padding">Padding for the view.</param>
582         /// <since_tizen> 3 </since_tizen>
583         // [Obsolete("This has been deprecated in API9 and will be removed in API11. Use Padding property instead.")]
584         public void SetPadding(PaddingType padding)
585         {
586             Interop.Actor.SetPadding(SwigCPtr, PaddingType.getCPtr(padding));
587             if (NDalicPINVOKE.SWIGPendingException.Pending)
588                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
589         }
590
591         /// <summary>
592         /// Return the value of padding for the view.
593         /// </summary>
594         /// <param name="paddingOut">the value of padding for the view</param>
595         /// <since_tizen> 3 </since_tizen>
596         [Obsolete("This has been deprecated in API9 and will be removed in API11. Use Padding property instead.")]
597         public void GetPadding(PaddingType paddingOut)
598         {
599             Interop.Actor.GetPadding(SwigCPtr, PaddingType.getCPtr(paddingOut));
600             if (NDalicPINVOKE.SWIGPendingException.Pending)
601                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
602         }
603
604         /// <since_tizen> 3 </since_tizen>
605         public uint AddRenderer(Renderer renderer)
606         {
607             uint ret = Interop.Actor.AddRenderer(SwigCPtr, Renderer.getCPtr(renderer));
608             if (NDalicPINVOKE.SWIGPendingException.Pending)
609                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
610             return ret;
611         }
612
613         /// <since_tizen> 3 </since_tizen>
614         public Renderer GetRendererAt(uint index)
615         {
616             //to fix memory leak issue, match the handle count with native side.
617             IntPtr cPtr = Interop.Actor.GetRendererAt(SwigCPtr, index);
618             HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
619             Renderer ret = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle) as Renderer;
620             if (cPtr != null && ret == null)
621             {
622                 ret = new Renderer(cPtr, false);
623                 if (NDalicPINVOKE.SWIGPendingException.Pending)
624                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
625                 return ret;
626             }
627             Interop.BaseHandle.DeleteBaseHandle(CPtr);
628             CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
629
630             if (NDalicPINVOKE.SWIGPendingException.Pending)
631                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
632             return ret;
633         }
634
635         /// <since_tizen> 3 </since_tizen>
636         public void RemoveRenderer(Renderer renderer)
637         {
638             Interop.Actor.RemoveRenderer(SwigCPtr, Renderer.getCPtr(renderer));
639             if (NDalicPINVOKE.SWIGPendingException.Pending)
640                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
641         }
642
643         /// <since_tizen> 3 </since_tizen>
644         public void RemoveRenderer(uint index)
645         {
646             Interop.Actor.RemoveRenderer(SwigCPtr, index);
647             if (NDalicPINVOKE.SWIGPendingException.Pending)
648                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
649         }
650
651         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
652         [EditorBrowsable(EditorBrowsableState.Never)]
653         public void RotateBy(Degree angle, Vector3 axis)
654         {
655             Interop.ActorInternal.RotateByDegree(SwigCPtr, Degree.getCPtr(angle), Vector3.getCPtr(axis));
656             if (NDalicPINVOKE.SWIGPendingException.Pending)
657                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
658         }
659
660         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
661         [EditorBrowsable(EditorBrowsableState.Never)]
662         public void RotateBy(Radian angle, Vector3 axis)
663         {
664             Interop.ActorInternal.RotateByRadian(SwigCPtr, Radian.getCPtr(angle), Vector3.getCPtr(axis));
665             if (NDalicPINVOKE.SWIGPendingException.Pending)
666                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
667         }
668
669         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
670         [EditorBrowsable(EditorBrowsableState.Never)]
671         public void RotateBy(Rotation relativeRotation)
672         {
673             Interop.ActorInternal.RotateByQuaternion(SwigCPtr, Rotation.getCPtr(relativeRotation));
674             if (NDalicPINVOKE.SWIGPendingException.Pending)
675                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
676         }
677
678         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
679         [EditorBrowsable(EditorBrowsableState.Never)]
680         public void ScaleBy(Vector3 relativeScale)
681         {
682             Interop.ActorInternal.ScaleBy(SwigCPtr, Vector3.getCPtr(relativeScale));
683             if (NDalicPINVOKE.SWIGPendingException.Pending)
684                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
685         }
686
687         /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
688         [EditorBrowsable(EditorBrowsableState.Never)]
689         public void SetColorMode(ColorMode colorMode)
690         {
691             Interop.ActorInternal.SetColorMode(SwigCPtr, (int)colorMode);
692             if (NDalicPINVOKE.SWIGPendingException.Pending)
693                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
694         }
695
696         /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
697         [EditorBrowsable(EditorBrowsableState.Never)]
698         public void ObjectDump()
699         {
700             if (0 == Children.Count)
701             {
702                 Type type = this.GetType();
703                 PropertyInfo[] properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
704                 foreach (var property in properties)
705                 {
706                     if (null != property && property.CanRead)
707                     {
708                         Tizen.Log.Fatal("NUI", $"{type.Name} {property.Name} ({property.PropertyType.Name}): {property.GetValueString(this, property.PropertyType)}");
709                     }
710                 }
711                 return;
712             }
713
714             foreach (View view in Children)
715             {
716                 view.ObjectDump();
717             }
718         }
719
720         /// <summary>
721         /// Search through this View's hierarchy for a View with the given unique ID.
722         /// The View itself is also considered in the search.
723         /// </summary>
724         /// <param name="id">The ID of the View to find</param>
725         /// <returns>A View if found or a null if not</returns>
726         [EditorBrowsable(EditorBrowsableState.Never)]
727         [Obsolete("This will be removed at API11. Use FindDescendantByID(uint id) instead.")]
728         public View FindChildByID(uint id)
729         {
730             IntPtr cPtr = Interop.Actor.FindChildById(SwigCPtr, id);
731             View ret = this.GetInstanceSafely<View>(cPtr);
732             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
733             return ret;
734         }
735
736         /// <summary>
737         /// Search through this View's hierarchy for a View with the given unique ID.
738         /// </summary>
739         /// <param name="id">The ID of the View to find.</param>
740         /// <returns>A handle to the View if found, or an empty handle if not.</returns>
741         /// <since_tizen> 9 </since_tizen>
742         public View FindDescendantByID(uint id)
743         {
744             return FindChildById(id);
745         }
746
747         /// <summary>
748         /// Raise view above the next sibling view.
749         /// </summary>
750         /// <since_tizen> 9 </since_tizen>
751         public void Raise()
752         {
753             var parentChildren = GetParent()?.Children;
754
755             if (parentChildren != null)
756             {
757                 int currentIndex = parentChildren.IndexOf(this);
758
759                 // If the view is not already the last item in the list.
760                 if (currentIndex >= 0 && currentIndex < parentChildren.Count - 1)
761                 {
762                     View temp = parentChildren[currentIndex + 1];
763                     parentChildren[currentIndex + 1] = this;
764                     parentChildren[currentIndex] = temp;
765
766                     Interop.NDalic.Raise(SwigCPtr);
767                     if (NDalicPINVOKE.SWIGPendingException.Pending)
768                         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
769                 }
770             }
771         }
772
773         /// <summary>
774         /// Lower the view below the previous sibling view.
775         /// </summary>
776         /// <since_tizen> 9 </since_tizen>
777         public void Lower()
778         {
779             var parentChildren = GetParent()?.Children;
780
781             if (parentChildren != null)
782             {
783                 int currentIndex = parentChildren.IndexOf(this);
784
785                 // If the view is not already the first item in the list.
786                 if (currentIndex > 0 && currentIndex < parentChildren.Count)
787                 {
788                     View temp = parentChildren[currentIndex - 1];
789                     parentChildren[currentIndex - 1] = this;
790                     parentChildren[currentIndex] = temp;
791
792                     Interop.NDalic.Lower(SwigCPtr);
793                     if (NDalicPINVOKE.SWIGPendingException.Pending)
794                         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
795                 }
796             }
797         }
798
799         /// <summary>
800         /// Raises the view to above the target view.
801         /// </summary>
802         /// <remarks>The sibling order of views within the parent will be updated automatically.
803         /// Views on the level above the target view will still be shown above this view.
804         /// Once a raise or lower API is used then that view will have an exclusive sibling order independent of insertion.
805         /// </remarks>
806         /// <param name="target">Will be raised above this view.</param>
807         /// <since_tizen> 9 </since_tizen>
808         public void RaiseAbove(View target)
809         {
810             var parentChildren = GetParent()?.Children;
811
812             if (parentChildren != null)
813             {
814                 int currentIndex = parentChildren.IndexOf(this);
815                 int targetIndex = parentChildren.IndexOf(target);
816
817                 if (currentIndex < 0 || targetIndex < 0 ||
818                     currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
819                 {
820                     NUILog.Error("index should be bigger than 0 and less than children of layer count");
821                     return;
822                 }
823                 // If the currentIndex is less than the target index and the target has the same parent.
824                 if (currentIndex < targetIndex)
825                 {
826                     parentChildren.Remove(this);
827                     parentChildren.Insert(targetIndex, this);
828
829                     Interop.NDalic.RaiseAbove(SwigCPtr, View.getCPtr(target));
830                     if (NDalicPINVOKE.SWIGPendingException.Pending)
831                         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
832                 }
833             }
834
835         }
836
837         /// <summary>
838         /// Lowers the view to below the target view.
839         /// </summary>
840         /// <remarks>The sibling order of views within the parent will be updated automatically.
841         /// Once a raise or lower API is used then that view will have an exclusive sibling order independent of insertion.
842         /// </remarks>
843         /// <param name="target">Will be lowered below this view.</param>
844         /// <since_tizen> 9 </since_tizen>
845         public void LowerBelow(View target)
846         {
847             var parentChildren = GetParent()?.Children;
848
849             if (parentChildren != null)
850             {
851                 int currentIndex = parentChildren.IndexOf(this);
852                 int targetIndex = parentChildren.IndexOf(target);
853                 if (currentIndex < 0 || targetIndex < 0 ||
854                    currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
855                 {
856                     NUILog.Error("index should be bigger than 0 and less than children of layer count");
857                     return;
858                 }
859
860                 // If the currentIndex is not already the 0th index and the target has the same parent.
861                 if ((currentIndex != 0) && (targetIndex != -1) &&
862                     (currentIndex > targetIndex))
863                 {
864                     parentChildren.Remove(this);
865                     parentChildren.Insert(targetIndex, this);
866
867                     Interop.NDalic.LowerBelow(SwigCPtr, View.getCPtr(target));
868                     if (NDalicPINVOKE.SWIGPendingException.Pending)
869                         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
870                 }
871             }
872
873         }
874
875         /// <summary>
876         /// Sets the position of the View.
877         /// The coordinates are relative to the View's parent.
878         /// The View's z position will be set to 0.0f.
879         /// </summary>
880         /// <param name="x">The new x position</param>
881         /// <param name="y">The new y position</param>
882         /// <remarks>
883         /// This is a hidden API(inhouse API) only for internal purpose.
884         /// </remarks>
885         [EditorBrowsable(EditorBrowsableState.Never)]
886         public void SetPosition(float x, float y)
887         {
888             Interop.ActorInternal.SetPosition(SwigCPtr, x, y);
889             if (NDalicPINVOKE.SWIGPendingException.Pending)
890                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
891         }
892
893         /// <summary>
894         /// Sets the position of the View.
895         /// The coordinates are relative to the View's parent.
896         /// </summary>
897         /// <param name="x">The new x position</param>
898         /// <param name="y">The new y position</param>
899         /// <param name="z">The new z position</param>
900         /// <remarks>
901         /// This is a hidden API(inhouse API) only for internal purpose.
902         /// </remarks>
903         [EditorBrowsable(EditorBrowsableState.Never)]
904         public void SetPosition(float x, float y, float z)
905         {
906             Interop.ActorInternal.SetPosition(SwigCPtr, x, y, z);
907             if (NDalicPINVOKE.SWIGPendingException.Pending)
908                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
909         }
910
911         /// <summary>
912         /// Sets the position of the View.
913         /// The coordinates are relative to the View's parent.
914         /// </summary>
915         /// <param name="position">The new position</param>
916         /// <remarks>
917         /// This is a hidden API(inhouse API) only for internal purpose.
918         /// </remarks>
919         [EditorBrowsable(EditorBrowsableState.Never)]
920         public void SetPosition(Vector3 position)
921         {
922             Interop.ActorInternal.SetPosition(SwigCPtr, Vector3.getCPtr(position));
923             if (NDalicPINVOKE.SWIGPendingException.Pending)
924                 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
925         }
926
927         /// <summary>
928         /// Register custom HitTest function for this view.
929         /// </summary>
930         /// <seealso cref="View.HitTest" />
931         /// <remarks>
932         /// This is a hidden API(inhouse API) only for internal purpose.
933         /// </remarks>
934         [EditorBrowsable(EditorBrowsableState.Never)]
935         protected void RegisterHitTestCallback()
936         {
937             if (hitTestResultDataCallback == null)
938             {
939                 hitTestResultDataCallback = OnHitTestResult;
940                 using TouchDataSignal touchDataSignal = new TouchDataSignal(Interop.ActorSignal.ActorHitTestResultSignal(SwigCPtr), false);
941                 touchDataSignal?.Connect(hitTestResultDataCallback);
942                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
943             }
944         }
945
946         /// <summary>
947         /// Unregister custom HitTest function.
948         /// </summary>
949         /// <remarks>
950         /// This is a hidden API(inhouse API) only for internal purpose.
951         /// </remarks>
952         [EditorBrowsable(EditorBrowsableState.Never)]
953         protected void UnregisterHitTestCallback()
954         {
955             if (hitTestResultDataCallback != null)
956             {
957                 using TouchDataSignal touchDataSignal = new TouchDataSignal(Interop.ActorSignal.ActorHitTestResultSignal(SwigCPtr), false);
958                 touchDataSignal?.Disconnect(hitTestResultDataCallback);
959                 hitTestResultDataCallback = null;
960                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
961             }
962         }
963     }
964 }