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