2 * Copyright(c) 2022 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 using System.ComponentModel;
20 using System.Reflection;
21 using System.Runtime.InteropServices;
22 using Tizen.NUI.Binding;
24 namespace Tizen.NUI.BaseComponents
27 /// View is the base class for all views.
29 /// <since_tizen> 3 </since_tizen>
30 public partial class View
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.
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)
42 Interop.View.DoAction(SwigCPtr, propertyIndexOfVisual, propertyIndexOfActionId, PropertyValue.getCPtr(attributes));
43 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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.
50 /// <since_tizen> 3 </since_tizen>
51 public Animation AnimateBackgroundColor(object destinationValue,
54 AlphaFunction.BuiltinFunctions? alphaFunction = null,
55 object initialValue = null)
57 #if NUI_VISUAL_PROPERTY_CHANGE_1
58 if (IsBackgroundEmpty())
60 // If there is no background yet, ensure there is a transparent
62 BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
65 Tizen.NUI.PropertyMap background = Background;
67 if (background.Empty())
69 // If there is no background yet, ensure there is a transparent
71 BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
72 background = Background;
75 return AnimateColor("background", destinationValue, startTime, endTime, alphaFunction, initialValue);
79 /// Creates an animation to animate the mixColor of the named visual.
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)
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))
94 if (alphaFunction != null)
96 using (PropertyValue pvAlpha = new PropertyValue(AlphaFunction.BuiltinToPropertyKey(alphaFunction)))
98 animator.Add("alphaFunction", pvAlpha);
102 timePeriod.Add("duration", pvDuration);
103 timePeriod.Add("delay", pvDelay);
104 using (PropertyValue pvTimePeriod = new PropertyValue(timePeriod))
106 animator.Add("timePeriod", pvTimePeriod);
108 using (PropertyValue pvAnimator = new PropertyValue(animator))
110 transition.Add("animator", pvAnimator);
112 transition.Add("target", pvTarget);
113 transition.Add("property", pvProperty);
115 if (initialColor != null)
117 using (PropertyValue initValue = PropertyValue.CreateFromObject(initialColor))
119 transition.Add("initialValue", initValue);
123 transition.Add("targetValue", destValue);
124 using (TransitionData transitionData = new TransitionData(transition))
126 animation = new Animation(Interop.View.CreateTransition(SwigCPtr, TransitionData.getCPtr(transitionData)), true);
128 if (NDalicPINVOKE.SWIGPendingException.Pending)
129 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
134 // From Container Base class
136 /// Adds a child view to this view.
138 /// <seealso cref="Container.Add" />
139 /// <since_tizen> 4 </since_tizen>
140 public override void Add(View child)
142 bool hasLayout = (layout != null);
146 Tizen.Log.Fatal("NUI", "Child is null");
150 Container oldParent = child.GetParent();
151 if (oldParent != this)
153 // If child already has a parent then re-parent child
154 if (oldParent != null)
156 if (child.Layout != null)
158 child.Layout.SetReplaceFlag();
160 oldParent.Remove(child);
162 child.InternalParent = this;
163 LayoutCount += child.LayoutCount;
165 Interop.Actor.Add(SwigCPtr, View.getCPtr(child));
167 if (NDalicPINVOKE.SWIGPendingException.Pending)
168 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172 if (ChildAdded != null)
174 ChildAddedEventArgs e = new ChildAddedEventArgs
184 /// Removes a child view from this View. If the view was not a child of this view, this is a no-op.
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)
191 if (child == null || child.GetParent() == null) // Early out if child null.
194 if (child.GetParent() != this)
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.");
201 bool hasLayout = (layout != null);
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.
208 (layout as LayoutGroup)?.RemoveChildFromLayoutGroup(child);
215 /// Retrieves a child view by index.
217 /// <seealso cref="Container.GetChildAt" />
218 /// <since_tizen> 4 </since_tizen>
219 public override View GetChildAt(uint index)
221 if (index < Children.Count)
223 return Children[Convert.ToInt32(index)];
232 /// Retrieves the number of children held by the view.
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()
239 return Convert.ToUInt32(Children.Count);
243 /// Gets the views parent.
245 /// <seealso cref="Container.GetParent()" />
246 /// <since_tizen> 4 </since_tizen>
247 public override Container GetParent()
249 return InternalParent as Container;
253 /// Queries whether the view has a focus.
255 /// <returns>True if this view has a focus.</returns>
256 /// <since_tizen> 3 </since_tizen>
257 public bool HasFocus()
260 if (SwigCPtr.Handle != global::System.IntPtr.Zero)
262 ret = Interop.View.HasKeyInputFocus(SwigCPtr);
263 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
267 Tizen.Log.Error("NUI", "swigCPtr of view is already disposed.");
273 /// Sets the name of the style to be applied to the view.
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)
280 Interop.View.SetStyleName(SwigCPtr, styleName);
281 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
285 /// Retrieves the name of the style to be applied to the view (if any).
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()
292 string ret = Interop.View.GetStyleName(SwigCPtr);
293 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
298 /// Clears the background.
300 /// <since_tizen> 3 </since_tizen>
301 public void ClearBackground()
303 Interop.View.ClearBackground(SwigCPtr);
304 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
311 /// This is an asynchronous method.
313 /// <since_tizen> 3 </since_tizen>
318 if (GetAccessibilityStates()[AccessibilityState.Modal])
320 RegisterDefaultLabel();
322 if (Accessibility.Accessibility.IsEnabled)
324 EmitAccessibilityStateChangedEvent(AccessibilityState.Showing, true);
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.
337 /// <since_tizen> 3 </since_tizen>
342 if (GetAccessibilityStates()[AccessibilityState.Modal])
344 UnregisterDefaultLabel();
346 if (Accessibility.Accessibility.IsEnabled)
348 EmitAccessibilityStateChangedEvent(AccessibilityState.Showing, false);
354 /// Raises the view above all other views.
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.
360 /// <since_tizen> 3 </since_tizen>
361 public void RaiseToTop()
363 var parentChildren = GetParent()?.Children;
365 if (parentChildren != null)
367 parentChildren.Remove(this);
368 parentChildren.Add(this);
370 LayoutGroup layout = Layout as LayoutGroup;
371 layout?.ChangeLayoutSiblingOrder(parentChildren.Count - 1);
373 Interop.NDalic.RaiseToTop(SwigCPtr);
374 if (NDalicPINVOKE.SWIGPendingException.Pending)
375 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
381 /// Lowers the view to the bottom of all views.
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.
387 /// <since_tizen> 3 </since_tizen>
388 public void LowerToBottom()
390 var parentChildren = GetParent()?.Children;
392 if (parentChildren != null)
394 parentChildren.Remove(this);
395 parentChildren.Insert(0, this);
397 LayoutGroup layout = Layout as LayoutGroup;
398 layout?.ChangeLayoutSiblingOrder(0);
400 Interop.NDalic.LowerToBottom(SwigCPtr);
401 if (NDalicPINVOKE.SWIGPendingException.Pending)
402 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
407 /// Queries if all resources required by a view are loaded and ready.
409 /// <remarks>Most resources are only loaded when the control is placed on the stage.
411 /// <since_tizen> 3 </since_tizen>
412 public bool IsResourceReady()
414 bool ret = Interop.View.IsResourceReady(SwigCPtr);
415 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
420 /// Gets the parent layer of this view.If a view has no parent, this method does not do anything.
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()
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();
435 /// Removes a view from its parent view or layer. If a view has no parent, this method does nothing.
437 /// <pre>The (child) view has been initialized. </pre>
438 /// <since_tizen> 4 </since_tizen>
439 public void Unparent()
441 GetParent()?.Remove(this);
445 /// Search through this view's hierarchy for a view with the given name.
446 /// The view itself is also considered in the search.
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)
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();
462 /// Converts screen coordinates into the view's coordinate system using the default camera.
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)
474 bool ret = Interop.Actor.ScreenToLocal(SwigCPtr, out localX, out localY, screenX, screenY);
475 if (NDalicPINVOKE.SWIGPendingException.Pending)
476 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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 />
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)
491 Interop.Actor.SetSizeModeFactor(SwigCPtr, Vector3.getCPtr(factor));
492 if (NDalicPINVOKE.SWIGPendingException.Pending)
493 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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 />
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)
505 float ret = Interop.Actor.GetHeightForWidth(SwigCPtr, width);
506 if (NDalicPINVOKE.SWIGPendingException.Pending)
507 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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 />
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)
521 float ret = Interop.Actor.GetWidthForHeight(SwigCPtr, height);
522 if (NDalicPINVOKE.SWIGPendingException.Pending)
523 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
528 /// Return the amount of size allocated for relayout.
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)
535 float ret = Interop.Actor.GetRelayoutSize(SwigCPtr, (int)dimension);
536 if (NDalicPINVOKE.SWIGPendingException.Pending)
537 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
542 /// Set the padding for the view.
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)
549 Interop.Actor.SetPadding(SwigCPtr, PaddingType.getCPtr(padding));
550 if (NDalicPINVOKE.SWIGPendingException.Pending)
551 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
555 /// Return the value of padding for the view.
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)
562 Interop.Actor.GetPadding(SwigCPtr, PaddingType.getCPtr(paddingOut));
563 if (NDalicPINVOKE.SWIGPendingException.Pending)
564 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
567 /// <since_tizen> 3 </since_tizen>
568 public uint AddRenderer(Renderer renderer)
570 uint ret = Interop.Actor.AddRenderer(SwigCPtr, Renderer.getCPtr(renderer));
571 if (NDalicPINVOKE.SWIGPendingException.Pending)
572 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
576 /// <since_tizen> 3 </since_tizen>
577 public Renderer GetRendererAt(uint index)
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)
585 ret = new Renderer(cPtr, false);
586 if (NDalicPINVOKE.SWIGPendingException.Pending)
587 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
590 Interop.BaseHandle.DeleteBaseHandle(CPtr);
591 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
593 if (NDalicPINVOKE.SWIGPendingException.Pending)
594 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
598 /// <since_tizen> 3 </since_tizen>
599 public void RemoveRenderer(Renderer renderer)
601 Interop.Actor.RemoveRenderer(SwigCPtr, Renderer.getCPtr(renderer));
602 if (NDalicPINVOKE.SWIGPendingException.Pending)
603 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
606 /// <since_tizen> 3 </since_tizen>
607 public void RemoveRenderer(uint index)
609 Interop.Actor.RemoveRenderer(SwigCPtr, index);
610 if (NDalicPINVOKE.SWIGPendingException.Pending)
611 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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)
618 Interop.ActorInternal.RotateByDegree(SwigCPtr, Degree.getCPtr(angle), Vector3.getCPtr(axis));
619 if (NDalicPINVOKE.SWIGPendingException.Pending)
620 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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)
627 Interop.ActorInternal.RotateByRadian(SwigCPtr, Radian.getCPtr(angle), Vector3.getCPtr(axis));
628 if (NDalicPINVOKE.SWIGPendingException.Pending)
629 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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)
636 Interop.ActorInternal.RotateByQuaternion(SwigCPtr, Rotation.getCPtr(relativeRotation));
637 if (NDalicPINVOKE.SWIGPendingException.Pending)
638 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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)
645 Interop.ActorInternal.ScaleBy(SwigCPtr, Vector3.getCPtr(relativeScale));
646 if (NDalicPINVOKE.SWIGPendingException.Pending)
647 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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)
654 Interop.ActorInternal.SetColorMode(SwigCPtr, (int)colorMode);
655 if (NDalicPINVOKE.SWIGPendingException.Pending)
656 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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()
663 if (0 == Children.Count)
665 Type type = this.GetType();
666 PropertyInfo[] properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
667 foreach (var property in properties)
669 if (null != property && property.CanRead)
671 Tizen.Log.Fatal("NUI", $"{type.Name} {property.Name} ({property.PropertyType.Name}): {property.GetValueString(this, property.PropertyType)}");
677 foreach (View view in Children)
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.
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)
693 IntPtr cPtr = Interop.Actor.FindChildById(SwigCPtr, id);
694 View ret = this.GetInstanceSafely<View>(cPtr);
695 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
700 /// Search through this View's hierarchy for a View with the given unique ID.
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)
707 return FindChildById(id);
711 /// Raise view above the next sibling view.
713 /// <since_tizen> 9 </since_tizen>
716 var parentChildren = GetParent()?.Children;
718 if (parentChildren != null)
720 int currentIndex = parentChildren.IndexOf(this);
722 // If the view is not already the last item in the list.
723 if (currentIndex >= 0 && currentIndex < parentChildren.Count - 1)
725 View temp = parentChildren[currentIndex + 1];
726 parentChildren[currentIndex + 1] = this;
727 parentChildren[currentIndex] = temp;
729 Interop.NDalic.Raise(SwigCPtr);
730 if (NDalicPINVOKE.SWIGPendingException.Pending)
731 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
737 /// Lower the view below the previous sibling view.
739 /// <since_tizen> 9 </since_tizen>
742 var parentChildren = GetParent()?.Children;
744 if (parentChildren != null)
746 int currentIndex = parentChildren.IndexOf(this);
748 // If the view is not already the first item in the list.
749 if (currentIndex > 0 && currentIndex < parentChildren.Count)
751 View temp = parentChildren[currentIndex - 1];
752 parentChildren[currentIndex - 1] = this;
753 parentChildren[currentIndex] = temp;
755 Interop.NDalic.Lower(SwigCPtr);
756 if (NDalicPINVOKE.SWIGPendingException.Pending)
757 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
763 /// Raises the view to above the target view.
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.
769 /// <param name="target">Will be raised above this view.</param>
770 /// <since_tizen> 9 </since_tizen>
771 public void RaiseAbove(View target)
773 var parentChildren = GetParent()?.Children;
775 if (parentChildren != null)
777 int currentIndex = parentChildren.IndexOf(this);
778 int targetIndex = parentChildren.IndexOf(target);
780 if (currentIndex < 0 || targetIndex < 0 ||
781 currentIndex >= parentChildren.Count || targetIndex >= parentChildren.Count)
783 NUILog.Error("index should be bigger than 0 and less than children of layer count");
786 // If the currentIndex is less than the target index and the target has the same parent.
787 if (currentIndex < targetIndex)
789 parentChildren.Remove(this);
790 parentChildren.Insert(targetIndex, this);
792 Interop.NDalic.RaiseAbove(SwigCPtr, View.getCPtr(target));
793 if (NDalicPINVOKE.SWIGPendingException.Pending)
794 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
801 /// Lowers the view to below the target view.
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.
806 /// <param name="target">Will be lowered below this view.</param>
807 /// <since_tizen> 9 </since_tizen>
808 public void LowerBelow(View target)
810 var parentChildren = GetParent()?.Children;
812 if (parentChildren != null)
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)
819 NUILog.Error("index should be bigger than 0 and less than children of layer count");
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))
827 parentChildren.Remove(this);
828 parentChildren.Insert(targetIndex, this);
830 Interop.NDalic.LowerBelow(SwigCPtr, View.getCPtr(target));
831 if (NDalicPINVOKE.SWIGPendingException.Pending)
832 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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.
843 /// <param name="x">The new x position</param>
844 /// <param name="y">The new y position</param>
846 /// This is a hidden API(inhouse API) only for internal purpose.
848 [EditorBrowsable(EditorBrowsableState.Never)]
849 public void SetPosition(float x, float y)
851 Interop.ActorInternal.SetPosition(SwigCPtr, x, y);
852 if (NDalicPINVOKE.SWIGPendingException.Pending)
853 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
857 /// Sets the position of the View.
858 /// The coordinates are relative to the View's parent.
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>
864 /// This is a hidden API(inhouse API) only for internal purpose.
866 [EditorBrowsable(EditorBrowsableState.Never)]
867 public void SetPosition(float x, float y, float z)
869 Interop.ActorInternal.SetPosition(SwigCPtr, x, y, z);
870 if (NDalicPINVOKE.SWIGPendingException.Pending)
871 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
875 /// Sets the position of the View.
876 /// The coordinates are relative to the View's parent.
878 /// <param name="position">The new position</param>
880 /// This is a hidden API(inhouse API) only for internal purpose.
882 [EditorBrowsable(EditorBrowsableState.Never)]
883 public void SetPosition(Vector3 position)
885 Interop.ActorInternal.SetPosition(SwigCPtr, Vector3.getCPtr(position));
886 if (NDalicPINVOKE.SWIGPendingException.Pending)
887 throw NDalicPINVOKE.SWIGPendingException.Retrieve();