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