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