2 * Copyright(c) 2019 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.
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.Binding;
23 namespace Tizen.NUI.BaseComponents
26 /// View is the base class for all views.
28 /// <since_tizen> 3 </since_tizen>
29 public partial class View : Container, IResourcesProvider
32 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
34 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
35 [EditorBrowsable(EditorBrowsableState.Never)]
36 public bool layoutSet = false;
39 /// Flag to allow Layouting to be disabled for Views.
40 /// Once a View has a Layout set then any children added to Views from then on will receive
41 /// automatic Layouts.
43 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
44 [EditorBrowsable(EditorBrowsableState.Never)]
45 public static bool layoutingDisabled{get; set;} = true;
47 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
48 private LayoutItem _layout; // Exclusive layout assigned to this View.
50 // List of transitions paired with the condition that uses the transition.
51 private Dictionary<TransitionCondition, TransitionList> _layoutTransitions;
52 private int _widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
53 private int _heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
54 private float _weight = 0.0f; // Weighting of child View in a Layout
55 private MeasureSpecification _measureSpecificationWidth; // Layout width and internal Mode
56 private MeasureSpecification _measureSpecificationHeight; // Layout height and internal Mode
57 private bool _backgroundImageSynchronosLoading = false;
58 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
59 private string[] transitionNames;
62 /// Creates a new instance of a view.
64 /// <since_tizen> 3 </since_tizen>
65 public View() : this(Interop.View.View_New(), true)
67 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
71 /// Create a new instance of a View with setting the status of shown or hidden.
73 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
74 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
75 [EditorBrowsable(EditorBrowsableState.Never)]
76 public View(bool shown) : this(Interop.View.View_New(), true)
78 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
82 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
84 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
91 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
93 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
96 PositionUsesPivotPoint = false;
99 _onWindowSendEventCallback = SendViewAddedEventToWindow;
100 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
108 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
110 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
118 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
119 [EditorBrowsable(EditorBrowsableState.Never)]
120 public bool IsResourcesCreated
124 return Application.Current.IsResourcesCreated;
128 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
129 [EditorBrowsable(EditorBrowsableState.Never)]
130 public ResourceDictionary XamlResources
134 return Application.Current.XamlResources;
138 Application.Current.XamlResources = value;
143 /// The StyleName, type string.
145 /// <since_tizen> 3 </since_tizen>
146 public string StyleName
150 return (string)GetValue(StyleNameProperty);
154 SetValue(StyleNameProperty, value);
155 NotifyPropertyChanged();
160 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
162 /// <since_tizen> 3 </since_tizen>
163 public Color BackgroundColor
167 return (Color)GetValue(BackgroundColorProperty);
171 SetValue(BackgroundColorProperty, value);
172 NotifyPropertyChanged();
177 /// The mutually exclusive with "backgroundColor" and "background" type Map.
179 /// <since_tizen> 3 </since_tizen>
180 public string BackgroundImage
184 return (string)GetValue(BackgroundImageProperty);
188 SetValue(BackgroundImageProperty, value);
189 NotifyPropertyChanged();
194 /// The background of view.
196 /// <since_tizen> 3 </since_tizen>
197 public Tizen.NUI.PropertyMap Background
201 return (PropertyMap)GetValue(BackgroundProperty);
205 SetValue(BackgroundProperty, value);
206 NotifyPropertyChanged();
211 /// The current state of the view.
213 /// <since_tizen> 3 </since_tizen>
218 return (States)GetValue(StateProperty);
222 SetValue(StateProperty, value);
223 NotifyPropertyChanged();
228 /// The current sub state of the view.
230 /// <since_tizen> 3 </since_tizen>
231 public States SubState
235 return (States)GetValue(SubStateProperty);
239 SetValue(SubStateProperty, value);
240 NotifyPropertyChanged();
245 /// Displays a tooltip
247 /// <since_tizen> 3 </since_tizen>
248 public Tizen.NUI.PropertyMap Tooltip
252 return (PropertyMap)GetValue(TooltipProperty);
256 SetValue(TooltipProperty, value);
257 NotifyPropertyChanged();
262 /// Displays a tooltip as a text.
264 /// <since_tizen> 3 </since_tizen>
265 public string TooltipText
269 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
270 NotifyPropertyChanged();
275 /// The Child property of FlexContainer.<br />
276 /// The proportion of the free space in the container, the flex item will receive.<br />
277 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
279 /// <since_tizen> 3 </since_tizen>
284 return (float)GetValue(FlexProperty);
288 SetValue(FlexProperty, value);
289 NotifyPropertyChanged();
294 /// The Child property of FlexContainer.<br />
295 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
297 /// <since_tizen> 3 </since_tizen>
302 return (int)GetValue(AlignSelfProperty);
306 SetValue(AlignSelfProperty, value);
307 NotifyPropertyChanged();
312 /// The Child property of FlexContainer.<br />
313 /// The space around the flex item.<br />
315 /// <since_tizen> 3 </since_tizen>
316 public Vector4 FlexMargin
320 return (Vector4)GetValue(FlexMarginProperty);
324 SetValue(FlexMarginProperty, value);
325 NotifyPropertyChanged();
330 /// The top-left cell this child occupies, if not set, the first available cell is used.
332 /// <since_tizen> 3 </since_tizen>
333 public Vector2 CellIndex
337 return (Vector2)GetValue(CellIndexProperty);
341 SetValue(CellIndexProperty, value);
342 NotifyPropertyChanged();
347 /// The number of rows this child occupies, if not set, the default value is 1.
349 /// <since_tizen> 3 </since_tizen>
354 return (float)GetValue(RowSpanProperty);
358 SetValue(RowSpanProperty, value);
359 NotifyPropertyChanged();
364 /// The number of columns this child occupies, if not set, the default value is 1.
366 /// <since_tizen> 3 </since_tizen>
367 public float ColumnSpan
371 return (float)GetValue(ColumnSpanProperty);
375 SetValue(ColumnSpanProperty, value);
376 NotifyPropertyChanged();
381 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
383 /// <since_tizen> 3 </since_tizen>
384 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
388 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
392 SetValue(CellHorizontalAlignmentProperty, value);
393 NotifyPropertyChanged();
398 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
400 /// <since_tizen> 3 </since_tizen>
401 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
405 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
409 SetValue(CellVerticalAlignmentProperty, value);
410 NotifyPropertyChanged();
415 /// The left focusable view.<br />
416 /// This will return null if not set.<br />
417 /// This will also return null if the specified left focusable view is not on a window.<br />
419 /// <since_tizen> 3 </since_tizen>
420 public View LeftFocusableView
422 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
425 return (View)GetValue(LeftFocusableViewProperty);
429 SetValue(LeftFocusableViewProperty, value);
430 NotifyPropertyChanged();
435 /// The right focusable view.<br />
436 /// This will return null if not set.<br />
437 /// This will also return null if the specified right focusable view is not on a window.<br />
439 /// <since_tizen> 3 </since_tizen>
440 public View RightFocusableView
442 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
445 return (View)GetValue(RightFocusableViewProperty);
449 SetValue(RightFocusableViewProperty, value);
450 NotifyPropertyChanged();
455 /// The up focusable view.<br />
456 /// This will return null if not set.<br />
457 /// This will also return null if the specified up focusable view is not on a window.<br />
459 /// <since_tizen> 3 </since_tizen>
460 public View UpFocusableView
462 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
465 return (View)GetValue(UpFocusableViewProperty);
469 SetValue(UpFocusableViewProperty, value);
470 NotifyPropertyChanged();
475 /// The down focusable view.<br />
476 /// This will return null if not set.<br />
477 /// This will also return null if the specified down focusable view is not on a window.<br />
479 /// <since_tizen> 3 </since_tizen>
480 public View DownFocusableView
482 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
485 return (View)GetValue(DownFocusableViewProperty);
489 SetValue(DownFocusableViewProperty, value);
490 NotifyPropertyChanged();
495 /// Whether the view should be focusable by keyboard navigation.
497 /// <since_tizen> 3 </since_tizen>
498 public bool Focusable
502 SetValue(FocusableProperty, value);
503 NotifyPropertyChanged();
507 return (bool)GetValue(FocusableProperty);
512 /// Retrieves the position of the view.<br />
513 /// The coordinates are relative to the view's parent.<br />
515 /// <since_tizen> 3 </since_tizen>
516 public Position CurrentPosition
520 return GetCurrentPosition();
525 /// Sets the size of a view for the width and the height.<br />
526 /// Geometry can be scaled to fit within this area.<br />
527 /// This does not interfere with the view's scale factor.<br />
528 /// The views default depth is the minimum of width and height.<br />
531 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
532 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
533 /// Please note that this multi-cascade setting is especially possible for this NUI object (Size2D). <br />
534 /// This means by default others are impossible so it is recommended that NUI object typed properties are configured by their constructor with parameters. <br />
535 /// For example, this code is working fine : view.Scale = new Vector3( 2.0f, 1.5f, 0.0f); <br />
536 /// but this will not work! : view.Scale.X = 2.0f; view.Scale.Y = 1.5f; <br />
537 /// It may not match the current value in some cases, i.e. when the animation is progressing or the maximum or minimum size is set. <br />
539 /// <since_tizen> 3 </since_tizen>
544 Size2D temp = (Size2D)GetValue(Size2DProperty);
545 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
549 SetValue(Size2DProperty, value);
550 // Set Specification so when layouts measure this View it matches the value set here.
551 // All Views are currently Layouts.
552 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
553 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
554 _widthPolicy = value.Width;
555 _heightPolicy = value.Height;
556 _layout?.RequestLayout();
557 NotifyPropertyChanged();
562 /// Retrieves the size of the view.<br />
563 /// The coordinates are relative to the view's parent.<br />
565 /// <since_tizen> 3 </since_tizen>
566 public Size2D CurrentSize
570 return GetCurrentSize();
575 /// Retrieves and sets the view's opacity.<br />
577 /// <since_tizen> 3 </since_tizen>
582 return (float)GetValue(OpacityProperty);
586 SetValue(OpacityProperty, value);
587 NotifyPropertyChanged();
592 /// Sets the position of the view for X and Y.<br />
593 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
594 /// If the position inheritance is disabled, sets the world position.<br />
597 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
598 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
599 /// Please note that this multi-cascade setting is especially possible for this NUI object (Position2D). <br />
600 /// This means by default others are impossible so it is recommended that NUI object typed properties are configured by their constructor with parameters. <br />
601 /// For example, this code is working fine : view.Scale = new Vector3( 2.0f, 1.5f, 0.0f); <br />
602 /// but this will not work! : view.Scale.X = 2.0f; view.Scale.Y = 1.5f; <br />
604 /// <since_tizen> 3 </since_tizen>
605 public Position2D Position2D
609 Position2D temp = (Position2D)GetValue(Position2DProperty);
610 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
614 SetValue(Position2DProperty, value);
615 NotifyPropertyChanged();
620 /// Retrieves the screen postion of the view.<br />
622 /// <since_tizen> 3 </since_tizen>
623 public Vector2 ScreenPosition
627 Vector2 temp = new Vector2(0.0f, 0.0f);
628 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
634 /// Determines whether the pivot point should be used to determine the position of the view.
635 /// This is true by default.
637 /// <remarks>If false, then the top-left of the view is used for the position.
638 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
640 /// <since_tizen> 3 </since_tizen>
641 public bool PositionUsesPivotPoint
645 return (bool)GetValue(PositionUsesPivotPointProperty);
649 SetValue(PositionUsesPivotPointProperty, value);
650 NotifyPropertyChanged();
655 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
657 /// <since_tizen> 3 </since_tizen>
658 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
660 "View view = new View(); " +
661 "view.PivotPoint = PivotPoint.Center; " +
662 "view.PositionUsesPivotPoint = true;" +
663 " Deprecated in API5: Will be removed in API8")]
664 [EditorBrowsable(EditorBrowsableState.Never)]
665 public bool PositionUsesAnchorPoint
670 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
675 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
676 NotifyPropertyChanged();
681 /// Queries whether the view is connected to the stage.<br />
682 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
684 /// <since_tizen> 3 </since_tizen>
685 public bool IsOnWindow
694 /// Gets the depth in the hierarchy for the view.
696 /// <since_tizen> 3 </since_tizen>
697 public int HierarchyDepth
701 return GetHierarchyDepth();
706 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
709 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
710 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
711 /// The values set by this property will likely change.
713 /// <since_tizen> 3 </since_tizen>
714 public int SiblingOrder
718 return (int)GetValue(SiblingOrderProperty);
722 SetValue(SiblingOrderProperty, value);
723 NotifyPropertyChanged();
728 /// Returns the natural size of the view.
731 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
733 /// <since_tizen> 5 </since_tizen>
734 public Vector3 NaturalSize
738 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
739 if (NDalicPINVOKE.SWIGPendingException.Pending)
740 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
746 /// Returns the natural size (Size2D) of the view.
749 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
751 /// <since_tizen> 4 </since_tizen>
752 public Size2D NaturalSize2D
756 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
757 if (NDalicPINVOKE.SWIGPendingException.Pending)
758 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
760 return new Size2D((int)temp.Width, (int)temp.Height);
765 /// Gets or sets the origin of a view within its parent's area.<br />
766 /// This is expressed in unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the parent, and (1.0, 1.0, 0.5) is the bottom-right corner.<br />
767 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
768 /// A view's position is the distance between this origin and the view's anchor-point.<br />
770 /// <pre>The view has been initialized.</pre>
771 /// <since_tizen> 3 </since_tizen>
772 public Position ParentOrigin
776 Position tmp = (Position)GetValue(ParentOriginProperty);
777 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
781 SetValue(ParentOriginProperty, value);
782 NotifyPropertyChanged();
787 /// Gets or sets the anchor-point of a view.<br />
788 /// This is expressed in unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the view, and (1.0, 1.0, 0.5) is the bottom-right corner.<br />
789 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
790 /// A view position is the distance between its parent-origin and this anchor-point.<br />
791 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
792 /// <pre>The view has been initialized.</pre>
794 /// <since_tizen> 3 </since_tizen>
795 public Position PivotPoint
799 Position tmp = (Position)GetValue(PivotPointProperty);
800 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
804 SetValue(PivotPointProperty, value);
805 NotifyPropertyChanged();
810 /// Gets or sets the size width of the view.
814 /// Animatable - This property can be animated using <c>Animation</c> class.
817 /// <since_tizen> 3 </since_tizen>
818 public float SizeWidth
822 return (float)GetValue(SizeWidthProperty);
826 SetValue(SizeWidthProperty, value);
827 WidthSpecification = (int)Math.Ceiling(value);
828 NotifyPropertyChanged();
833 /// Gets or sets the size height of the view.
837 /// Animatable - This property can be animated using <c>Animation</c> class.
840 /// <since_tizen> 3 </since_tizen>
841 public float SizeHeight
845 return (float)GetValue(SizeHeightProperty);
849 SetValue(SizeHeightProperty, value);
850 HeightSpecification = (int)Math.Ceiling(value);
851 NotifyPropertyChanged();
856 /// Gets or sets the position of the view.<br />
857 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
858 /// If the position inheritance is disabled, sets the world position.<br />
862 /// Animatable - This property can be animated using <c>Animation</c> class.
865 /// <since_tizen> 3 </since_tizen>
866 public Position Position
870 Position tmp = (Position)GetValue(PositionProperty);
871 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
875 SetValue(PositionProperty, value);
876 NotifyPropertyChanged();
881 /// Gets or sets the position X of the view.
885 /// Animatable - This property can be animated using <c>Animation</c> class.
888 /// <since_tizen> 3 </since_tizen>
889 public float PositionX
893 return (float)GetValue(PositionXProperty);
897 SetValue(PositionXProperty, value);
898 NotifyPropertyChanged();
903 /// Gets or sets the position Y of the view.
907 /// Animatable - This property can be animated using <c>Animation</c> class.
910 /// <since_tizen> 3 </since_tizen>
911 public float PositionY
915 return (float)GetValue(PositionYProperty);
919 SetValue(PositionYProperty, value);
920 NotifyPropertyChanged();
925 /// Gets or sets the position Z of the view.
929 /// Animatable - This property can be animated using <c>Animation</c> class.
932 /// <since_tizen> 3 </since_tizen>
933 public float PositionZ
937 return (float)GetValue(PositionZProperty);
941 SetValue(PositionZProperty, value);
942 NotifyPropertyChanged();
947 /// Gets or sets the world position of the view.
949 /// <since_tizen> 3 </since_tizen>
950 public Vector3 WorldPosition
954 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
955 GetProperty(View.Property.WORLD_POSITION).Get(temp);
961 /// Gets or sets the orientation of the view.<br />
962 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
966 /// This is an asynchronous method.
969 /// Animatable - This property can be animated using <c>Animation</c> class.
972 /// <since_tizen> 3 </since_tizen>
973 public Rotation Orientation
977 return (Rotation)GetValue(OrientationProperty);
981 SetValue(OrientationProperty, value);
982 NotifyPropertyChanged();
987 /// Gets or sets the world orientation of the view.<br />
989 /// <since_tizen> 3 </since_tizen>
990 public Rotation WorldOrientation
994 Rotation temp = new Rotation();
995 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1001 /// Gets or sets the scale factor applied to the view.<br />
1005 /// Animatable - This property can be animated using <c>Animation</c> class.
1008 /// <since_tizen> 3 </since_tizen>
1009 public Vector3 Scale
1013 return (Vector3)GetValue(ScaleProperty);
1017 SetValue(ScaleProperty, value);
1018 NotifyPropertyChanged();
1023 /// Gets or sets the scale X factor applied to the view.
1027 /// Animatable - This property can be animated using <c>Animation</c> class.
1030 /// <since_tizen> 3 </since_tizen>
1035 return (float)GetValue(ScaleXProperty);
1039 SetValue(ScaleXProperty, value);
1040 NotifyPropertyChanged();
1045 /// Gets or sets the scale Y factor applied to the view.
1049 /// Animatable - This property can be animated using <c>Animation</c> class.
1052 /// <since_tizen> 3 </since_tizen>
1057 return (float)GetValue(ScaleYProperty);
1061 SetValue(ScaleYProperty, value);
1062 NotifyPropertyChanged();
1067 /// Gets or sets the scale Z factor applied to the view.
1071 /// Animatable - This property can be animated using <c>Animation</c> class.
1074 /// <since_tizen> 3 </since_tizen>
1079 return (float)GetValue(ScaleZProperty);
1083 SetValue(ScaleZProperty, value);
1084 NotifyPropertyChanged();
1089 /// Gets the world scale of the view.
1091 /// <since_tizen> 3 </since_tizen>
1092 public Vector3 WorldScale
1096 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1097 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1103 /// Retrieves the visibility flag of the view.
1107 /// If the view is not visible, then the view and its children will not be rendered.
1108 /// This is regardless of the individual visibility values of the children, i.e., the view will only be rendered if all of its parents have visibility set to true.
1111 /// Animatable - This property can be animated using <c>Animation</c> class.
1114 /// <since_tizen> 3 </since_tizen>
1115 public bool Visibility
1120 GetProperty(View.Property.VISIBLE).Get(out temp);
1126 /// Gets the view's world color.
1128 /// <since_tizen> 3 </since_tizen>
1129 public Vector4 WorldColor
1133 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1134 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1140 /// Gets or sets the view's name.
1142 /// <since_tizen> 3 </since_tizen>
1147 return (string)GetValue(NameProperty);
1151 SetValue(NameProperty, value);
1152 NotifyPropertyChanged();
1157 /// Get the number of children held by the view.
1159 /// <since_tizen> 3 </since_tizen>
1160 public new uint ChildCount
1164 return GetChildCount();
1169 /// Gets the view's ID.
1172 /// <since_tizen> 3 </since_tizen>
1182 /// Gets or sets the status of whether the view should emit touch or hover signals.
1184 /// <since_tizen> 3 </since_tizen>
1185 public bool Sensitive
1189 return (bool)GetValue(SensitiveProperty);
1193 SetValue(SensitiveProperty, value);
1194 NotifyPropertyChanged();
1199 /// Gets or sets the status of whether the view should receive a notification when touch or hover motion events leave the boundary of the view.
1201 /// <since_tizen> 3 </since_tizen>
1202 public bool LeaveRequired
1206 return (bool)GetValue(LeaveRequiredProperty);
1210 SetValue(LeaveRequiredProperty, value);
1211 NotifyPropertyChanged();
1216 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1218 /// <since_tizen> 3 </since_tizen>
1219 public bool InheritOrientation
1223 return (bool)GetValue(InheritOrientationProperty);
1227 SetValue(InheritOrientationProperty, value);
1228 NotifyPropertyChanged();
1233 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1235 /// <since_tizen> 3 </since_tizen>
1236 public bool InheritScale
1240 return (bool)GetValue(InheritScaleProperty);
1244 SetValue(InheritScaleProperty, value);
1245 NotifyPropertyChanged();
1250 /// Gets or sets the status of how the view and its children should be drawn.<br />
1251 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1252 /// If an object is in a 3D layer, it will be depth-tested against other objects in the world, i.e., it may be obscured if other objects are in front.<br />
1253 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1254 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1255 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1257 /// <since_tizen> 3 </since_tizen>
1258 public DrawModeType DrawMode
1262 return (DrawModeType)GetValue(DrawModeProperty);
1266 SetValue(DrawModeProperty, value);
1267 NotifyPropertyChanged();
1272 /// Gets or sets the relative to parent size factor of the view.<br />
1273 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1274 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1276 /// <since_tizen> 3 </since_tizen>
1277 public Vector3 SizeModeFactor
1281 return (Vector3)GetValue(SizeModeFactorProperty);
1285 SetValue(SizeModeFactorProperty, value);
1286 NotifyPropertyChanged();
1291 /// Gets or sets the width resize policy to be used.
1293 /// <since_tizen> 3 </since_tizen>
1294 public ResizePolicyType WidthResizePolicy
1298 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1302 SetValue(WidthResizePolicyProperty, value);
1303 // Match ResizePolicy to new Layouting.
1304 // Parent relative policies can not be mapped at this point as parent size unknown.
1307 case ResizePolicyType.UseNaturalSize:
1309 WidthSpecification = LayoutParamPolicies.WrapContent;
1312 case ResizePolicyType.FillToParent:
1314 WidthSpecification = LayoutParamPolicies.MatchParent;
1317 case ResizePolicyType.FitToChildren:
1319 WidthSpecification = LayoutParamPolicies.WrapContent;
1325 NotifyPropertyChanged();
1330 /// Gets or sets the height resize policy to be used.
1332 /// <since_tizen> 3 </since_tizen>
1333 public ResizePolicyType HeightResizePolicy
1337 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1341 SetValue(HeightResizePolicyProperty, value);
1342 // Match ResizePolicy to new Layouting.
1343 // Parent relative policies can not be mapped at this point as parent size unknown.
1346 case ResizePolicyType.UseNaturalSize:
1348 HeightSpecification = LayoutParamPolicies.WrapContent;
1351 case ResizePolicyType.FillToParent:
1353 HeightSpecification = LayoutParamPolicies.MatchParent;
1356 case ResizePolicyType.FitToChildren:
1358 HeightSpecification = LayoutParamPolicies.WrapContent;
1364 NotifyPropertyChanged();
1369 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1370 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1372 /// <since_tizen> 3 </since_tizen>
1373 public SizeScalePolicyType SizeScalePolicy
1377 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1381 SetValue(SizeScalePolicyProperty, value);
1382 NotifyPropertyChanged();
1387 /// Gets or sets the status of whether the width size is dependent on the height size.
1389 /// <since_tizen> 3 </since_tizen>
1390 public bool WidthForHeight
1394 return (bool)GetValue(WidthForHeightProperty);
1398 SetValue(WidthForHeightProperty, value);
1399 NotifyPropertyChanged();
1404 /// Gets or sets the status of whether the height size is dependent on the width size.
1406 /// <since_tizen> 3 </since_tizen>
1407 public bool HeightForWidth
1411 return (bool)GetValue(HeightForWidthProperty);
1415 SetValue(HeightForWidthProperty, value);
1416 NotifyPropertyChanged();
1421 /// Gets or sets the padding for use in layout.
1423 /// <since_tizen> 5 </since_tizen>
1424 public Extents Padding
1428 // If View has a Layout then padding in stored in the base Layout class
1431 return Layout.Padding;
1435 return (Extents)GetValue(PaddingProperty);
1437 // Two return points to prevent creating a zeroed Extent native object before assignment
1441 Extents padding = value;
1444 // Layout set so store Padding in LayoutItem instead of in View.
1445 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1446 // the position and sizes measure in the Layouting.
1447 Layout.Padding = value;
1448 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1449 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1450 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1452 padding = new Extents(0,0,0,0); // Reset value stored in View.
1454 _layout?.RequestLayout();
1456 SetValue(PaddingProperty, padding);
1457 NotifyPropertyChanged();
1458 _layout?.RequestLayout();
1463 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1465 /// <since_tizen> 3 </since_tizen>
1466 public Size2D MinimumSize
1470 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1471 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1475 if (_layout != null)
1477 // Note: it only works if minimum size is >= than natural size.
1478 // To force the size it should be done through the width&height spec or Size2D.
1479 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1480 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1481 _layout.RequestLayout();
1483 SetValue(MinimumSizeProperty, value);
1484 NotifyPropertyChanged();
1489 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1491 /// <since_tizen> 3 </since_tizen>
1492 public Size2D MaximumSize
1496 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1497 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1501 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1502 // MATCH_PARENT spec + parent container size can be used to limit
1503 if (_layout != null)
1505 // Note: it only works if minimum size is >= than natural size.
1506 // To force the size it should be done through the width&height spec or Size2D.
1507 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Width);
1508 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Height);
1509 _layout.RequestLayout();
1511 SetValue(MaximumSizeProperty, value);
1512 NotifyPropertyChanged();
1517 /// Gets or sets whether a child view inherits it's parent's position.<br />
1518 /// Default is to inherit.<br />
1519 /// Switching this off means that using position sets the view's world position, i.e., translates from the world origin (0,0,0) to the pivot point of the view.<br />
1521 /// <since_tizen> 3 </since_tizen>
1522 public bool InheritPosition
1526 return (bool)GetValue(InheritPositionProperty);
1530 SetValue(InheritPositionProperty, value);
1531 NotifyPropertyChanged();
1536 /// Gets or sets the clipping behavior (mode) of it's children.
1538 /// <since_tizen> 3 </since_tizen>
1539 public ClippingModeType ClippingMode
1543 return (ClippingModeType)GetValue(ClippingModeProperty);
1547 SetValue(ClippingModeProperty, value);
1548 NotifyPropertyChanged();
1553 /// Gets the number of renderers held by the view.
1555 /// <since_tizen> 3 </since_tizen>
1556 public uint RendererCount
1560 return GetRendererCount();
1565 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1567 /// <since_tizen> 3 </since_tizen>
1568 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1570 "View view = new View(); " +
1571 "view.PivotPoint = PivotPoint.Center; " +
1572 "view.PositionUsesPivotPoint = true;")]
1573 [EditorBrowsable(EditorBrowsableState.Never)]
1574 public Position AnchorPoint
1578 Position temp = new Position(0.0f, 0.0f, 0.0f);
1579 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1584 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1585 NotifyPropertyChanged();
1590 /// Sets the size of a view for the width, the height and the depth.<br />
1591 /// Geometry can be scaled to fit within this area.<br />
1592 /// This does not interfere with the view's scale factor.<br />
1593 /// The views default depth is the minimum of width and height.<br />
1597 /// Please note that multi-cascade setting is not possible for this NUI object. <br />
1598 /// It is recommended that NUI object typed properties are configured by their constructor with parameters. <br />
1599 /// For example, this code is working fine : view.Size = new Size( 1.0f, 1.0f, 0.0f); <br />
1600 /// but this will not work! : view.Size.Width = 2.0f; view.Size.Height = 2.0f; <br />
1601 /// It may not match the current value in some cases, i.e. when the animation is progressing or the maximum or minimu size is set. <br />
1604 /// Animatable - This property can be animated using <c>Animation</c> class.
1607 /// <since_tizen> 5 </since_tizen>
1612 Size tmp = (Size)GetValue(SizeProperty);
1613 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1617 SetValue(SizeProperty, value);
1618 // Set Specification so when layouts measure this View it matches the value set here.
1619 // All Views are currently Layouts.
1620 WidthSpecification = (int)Math.Ceiling(value.Width);
1621 HeightSpecification = (int)Math.Ceiling(value.Height);
1622 NotifyPropertyChanged();
1627 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1629 /// <since_tizen> 3 </since_tizen>
1630 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1632 "Container parent = view.GetParent(); " +
1633 "View view = parent as View;")]
1634 [EditorBrowsable(EditorBrowsableState.Never)]
1635 public new View Parent
1640 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1641 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1642 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1644 if (basehandle is Layer layer)
1646 ret = new View(Layer.getCPtr(layer).Handle, false);
1647 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1651 ret = basehandle as View;
1654 Interop.BaseHandle.delete_BaseHandle(CPtr);
1655 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1657 if (NDalicPINVOKE.SWIGPendingException.Pending)
1658 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1664 /// Gets/Sets whether inherit parent's the layout Direction.
1666 /// <since_tizen> 4 </since_tizen>
1667 public bool InheritLayoutDirection
1671 return (bool)GetValue(InheritLayoutDirectionProperty);
1675 SetValue(InheritLayoutDirectionProperty, value);
1676 NotifyPropertyChanged();
1681 /// Gets/Sets the layout Direction.
1683 /// <since_tizen> 4 </since_tizen>
1684 public ViewLayoutDirectionType LayoutDirection
1688 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1692 SetValue(LayoutDirectionProperty, value);
1693 NotifyPropertyChanged();
1694 _layout?.RequestLayout();
1699 /// Gets or sets the Margin for use in layout.
1702 /// Margin property is supported by Layout algorithms and containers.
1703 /// Please Set Layout if you want to use Margin property.
1705 /// <since_tizen> 4 </since_tizen>
1706 public Extents Margin
1710 // If View has a Layout then margin is stored in Layout.
1713 return Layout.Margin;
1717 // If Layout not set then return margin stored in View.
1718 return (Extents)GetValue(MarginProperty);
1720 // Two return points to prevent creating a zeroed Extent native object before assignment
1726 // Layout set so store Margin in LayoutItem instead of View.
1727 // If View stores the Margin too then the Legacy Size Negotiation will
1728 // overwrite the position and size values measured in the Layouting.
1729 Layout.Margin = value;
1730 SetValue(MarginProperty, new Extents(0,0,0,0));
1731 _layout?.RequestLayout();
1735 SetValue(MarginProperty, value);
1737 NotifyPropertyChanged();
1738 _layout?.RequestLayout();
1743 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1745 /// <since_tizen> 6 </since_tizen>
1746 public int WidthSpecification
1750 return _widthPolicy;
1754 _widthPolicy = value;
1755 if (_widthPolicy >= 0)
1757 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1758 Size2D.Width = _widthPolicy;
1761 _layout?.RequestLayout();
1766 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1768 /// <since_tizen> 6 </since_tizen>
1769 [EditorBrowsable(EditorBrowsableState.Never)]
1770 public int HeightSpecification
1774 return _heightPolicy;
1778 _heightPolicy = value;
1779 if (_heightPolicy >= 0)
1781 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1782 Size2D.Height = _heightPolicy;
1785 _layout?.RequestLayout();
1790 /// Gets the List of transitions for this View.
1792 /// <since_tizen> 6 </since_tizen>
1793 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
1797 if (_layoutTransitions == null)
1799 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
1801 return _layoutTransitions;
1806 /// Set a layout transitions for this View.
1809 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
1811 /// <since_tizen> 6 </since_tizen>
1812 public LayoutTransition LayoutTransition
1816 if (_layoutTransitions == null)
1818 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
1820 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
1822 AttachTransitionsToChildren(value);
1827 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
1829 /// <since_tizen> 4 </since_tizen>
1830 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
1831 [EditorBrowsable(EditorBrowsableState.Never)]
1832 public Extents PaddingEX
1836 Extents temp = new Extents(0, 0, 0, 0);
1837 GetProperty(View.Property.PADDING).Get(temp);
1842 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
1843 NotifyPropertyChanged();
1844 _layout?.RequestLayout();
1848 /// <since_tizen> 6 </since_tizen>
1849 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
1850 [EditorBrowsable(EditorBrowsableState.Never)]
1851 public Style XamlStyle
1855 return (Style)GetValue(XamlStyleProperty);
1859 SetValue(XamlStyleProperty, value);
1864 /// The Color of View. This is an RGBA value.
1868 /// Animatable - This property can be animated using <c>Animation</c> class.
1871 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1872 [EditorBrowsable(EditorBrowsableState.Never)]
1881 return GetCurrentColor();
1886 /// Set the layout on this View. Replaces any existing Layout.
1888 /// <since_tizen> 6 </since_tizen>
1889 public LayoutItem Layout
1897 // Do nothing if layout provided is already set on this View.
1898 if (value == _layout)
1903 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
1904 layoutingDisabled = false;
1907 // If new layout being set already has a owner then that owner receives a replacement default layout.
1908 // First check if the layout to be set already has a owner.
1909 if (value?.Owner != null)
1911 // Previous owner of the layout gets a default layout as a replacement.
1912 value.Owner.Layout = new LayoutGroup();
1914 // Copy Margin and Padding to replacement LayoutGroup.
1915 value.Owner.Layout.Margin = value.Margin;
1916 value.Owner.Layout.Padding = value.Padding;
1919 // Copy Margin and Padding to new layout being set or restore padding and margin back to
1920 // View if no replacement. Previously margin and padding values would have been moved from
1921 // the View to the layout.
1922 if (_layout != null ) // Existing layout
1926 // Existing layout being replaced so copy over margin and padding values.
1927 value.Margin = _layout.Margin;
1928 value.Padding = _layout.Padding;
1932 // Layout not being replaced so restore margin and padding to View.
1933 SetValue(MarginProperty, _layout.Margin);
1934 SetValue(PaddingProperty, _layout.Padding);
1935 NotifyPropertyChanged();
1940 // First Layout to be added to the View hence copy
1942 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
1945 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
1947 // If View already has a margin set then store it in Layout instead.
1948 value.Margin = Margin;
1949 SetValue(MarginProperty, new Extents(0,0,0,0));
1950 NotifyPropertyChanged();
1953 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
1955 // If View already has a padding set then store it in Layout instead.
1956 value.Padding = Padding;
1957 SetValue(PaddingProperty, new Extents(0,0,0,0));
1958 NotifyPropertyChanged();
1963 // Remove existing layout from it's parent layout group.
1964 _layout?.Unparent();
1966 // Set layout to this view
1972 /// The weight of the View, used to share available space in a layout with siblings.
1974 /// <since_tizen> 6 </since_tizen>
1984 _layout?.RequestLayout();
1989 /// Whether to load the BackgroundImage synchronously.
1990 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
1991 /// Note: For Normal Quad images only.
1993 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
1994 [EditorBrowsable(EditorBrowsableState.Never)]
1995 public bool BackgroundImageSynchronosLoading
1999 return _backgroundImageSynchronosLoading;
2003 _backgroundImageSynchronosLoading = value;
2006 Background.Find(Visual.Property.Type)?.Get(out visualType);
2007 if (visualType == (int)Visual.Type.Image)
2009 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2012 if (bgUrl.Length != 0)
2014 PropertyMap bgMap = this.Background;
2015 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2021 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2022 [EditorBrowsable(EditorBrowsableState.Never)]
2023 public Vector2 UpdateSizeHint
2027 return (Vector2)GetValue(UpdateSizeHintProperty);
2031 SetValue(UpdateSizeHintProperty, value);
2032 NotifyPropertyChanged();
2036 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2037 [EditorBrowsable(EditorBrowsableState.Never)]
2038 public string[] TransitionNames
2042 return transitionNames;
2046 transitionNames = value;