2 * Copyright(c) 2021 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
31 internal BackgroundExtraData backgroundExtraData;
33 private bool layoutSet = false;
34 private LayoutItem layout; // Exclusive layout assigned to this View.
36 // List of transitions paired with the condition that uses the transition.
37 private Dictionary<TransitionCondition, TransitionList> layoutTransitions;
38 private int widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
39 private int heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
40 private float weight = 0.0f; // Weighting of child View in a Layout
41 private bool backgroundImageSynchronosLoading = false;
42 private bool controlStatePropagation = false;
43 private ViewStyle viewStyle;
44 private bool themeChangeSensitive = false;
45 private bool excludeLayouting = false;
46 private LayoutTransition layoutTransition;
47 private ControlState controlStates = ControlState.Normal;
48 private TransitionOptions transitionOptions = null;
53 /// Creates a new instance of a view.
55 /// <since_tizen> 3 </since_tizen>
56 public View() : this(Interop.View.New(), true)
58 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
61 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
62 [EditorBrowsable(EditorBrowsableState.Never)]
63 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
68 /// Create a new instance of a View with setting the status of shown or hidden.
70 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
71 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
72 [EditorBrowsable(EditorBrowsableState.Never)]
73 public View(bool shown) : this(Interop.View.New(), true)
75 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
81 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
87 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
90 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
92 InitializeStyle(viewStyle);
95 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
99 PositionUsesPivotPoint = false;
102 onWindowSendEventCallback = SendViewAddedEventToWindow;
103 this.OnWindowSignal().Connect(onWindowSendEventCallback);
111 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
122 /// The event that is triggered when the View's ControlState is changed.
124 [EditorBrowsable(EditorBrowsableState.Never)]
125 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
127 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
131 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
133 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
134 [EditorBrowsable(EditorBrowsableState.Never)]
135 public bool LayoutSet
144 /// Flag to allow Layouting to be disabled for Views.
145 /// Once a View has a Layout set then any children added to Views from then on will receive
146 /// automatic Layouts.
148 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
149 [EditorBrowsable(EditorBrowsableState.Never)]
150 public static bool LayoutingDisabled { get; set; } = true;
153 /// The style instance applied to this view.
154 /// Note that please do not modify the ViewStyle.
155 /// Modifying ViewStyle will affect other views with same ViewStyle.
157 [EditorBrowsable(EditorBrowsableState.Never)]
158 protected ViewStyle ViewStyle
162 if (null == viewStyle)
164 ApplyStyle(CreateViewStyle());
172 /// Get/Set the control state.
173 /// Note that the ControlState only available for the classes derived from Control.
174 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
175 /// please set <see cref="EnableControlState"/> to true.
177 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
178 [EditorBrowsable(EditorBrowsableState.Never)]
179 public ControlState ControlState
183 return controlStates;
187 if (controlStates == value)
192 var prevState = controlStates;
194 controlStates = value;
196 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
198 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
200 if (controlStatePropagation)
202 foreach (View child in Children)
204 child.ControlState = value;
208 OnControlStateChanged(changeInfo);
210 ControlStateChangedEvent?.Invoke(this, changeInfo);
215 /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
217 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
218 [EditorBrowsable(EditorBrowsableState.Never)]
219 public bool ExcludeLayouting
223 return excludeLayouting;
227 excludeLayouting = value;
228 if (Layout != null && Layout.SetPositionByLayout == value)
230 Layout.SetPositionByLayout = !value;
231 Layout.RequestLayout();
236 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
237 [EditorBrowsable(EditorBrowsableState.Never)]
238 public bool IsResourcesCreated
242 return Application.Current.IsResourcesCreated;
246 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
247 [EditorBrowsable(EditorBrowsableState.Never)]
248 public ResourceDictionary XamlResources
252 return Application.Current.XamlResources;
256 Application.Current.XamlResources = value;
261 /// The StyleName, type string.
262 /// The value indicates DALi style name defined in json theme file.
264 /// <since_tizen> 3 </since_tizen>
265 public string StyleName
269 return (string)GetValue(StyleNameProperty);
273 SetValue(StyleNameProperty, value);
274 NotifyPropertyChanged();
279 /// The KeyInputFocus, type bool.
281 [EditorBrowsable(EditorBrowsableState.Never)]
282 public bool KeyInputFocus
286 return (bool)GetValue(KeyInputFocusProperty);
290 SetValue(KeyInputFocusProperty, value);
291 NotifyPropertyChanged();
296 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
300 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
303 /// Animatable - This property can be animated using <c>Animation</c> class.
305 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
309 /// <since_tizen> 3 </since_tizen>
310 public Color BackgroundColor
314 Color temp = (Color)GetValue(BackgroundColorProperty);
315 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
319 SetValue(BackgroundColorProperty, value);
320 NotifyPropertyChanged();
325 /// The mutually exclusive with "backgroundColor" and "background" type Map.
327 /// <since_tizen> 3 </since_tizen>
328 public string BackgroundImage
332 return (string)GetValue(BackgroundImageProperty);
336 SetValue(BackgroundImageProperty, value);
337 NotifyPropertyChanged();
342 /// Get or set the border of background image.
344 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
345 [EditorBrowsable(EditorBrowsableState.Never)]
346 public Rectangle BackgroundImageBorder
350 return (Rectangle)GetValue(BackgroundImageBorderProperty);
354 SetValue(BackgroundImageBorderProperty, value);
355 NotifyPropertyChanged();
360 /// The background of view.
362 /// <since_tizen> 3 </since_tizen>
363 public Tizen.NUI.PropertyMap Background
367 return (PropertyMap)GetValue(BackgroundProperty);
371 SetValue(BackgroundProperty, value);
372 NotifyPropertyChanged();
377 /// Describes a shadow as an image for a View.
378 /// It is null by default.
381 /// Getter returns copied instance of current shadow.
384 /// The mutually exclusive with "BoxShadow".
388 /// Animatable - This property can be animated using <c>Animation</c> class.
389 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
391 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
393 /// Animatable sub-property : Offset.
396 [EditorBrowsable(EditorBrowsableState.Never)]
397 public ImageShadow ImageShadow
401 return (ImageShadow)GetValue(ImageShadowProperty);
405 SetValue(ImageShadowProperty, value);
406 NotifyPropertyChanged();
411 /// Describes a box shaped shadow drawing for a View.
412 /// It is null by default.
415 /// The mutually exclusive with "ImageShadow".
419 /// Animatable - This property can be animated using <c>Animation</c> class.
420 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
422 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
424 /// Animatable sub-property : Offset, Color, BlurRadius.
427 /// <since_tizen> 9 </since_tizen>
428 public Shadow BoxShadow
432 return (Shadow)GetValue(BoxShadowProperty);
436 SetValue(BoxShadowProperty, value);
437 NotifyPropertyChanged();
442 /// The radius for the rounded corners of the View.
443 /// This will rounds background and shadow edges.
444 /// The values in Vector4 are used in clockwise order from top-left to bottom-left : Vector4(top-left-corner, top-right-corner, bottom-right-corner, bottom-left-corner).
445 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
449 /// Animatable - This property can be animated using <c>Animation</c> class.
452 /// <since_tizen> 9 </since_tizen>
453 public Vector4 CornerRadius
457 return (Vector4)GetValue(CornerRadiusProperty);
461 SetValue(CornerRadiusProperty, value);
462 NotifyPropertyChanged();
468 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
469 /// It is absolute by default.
470 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
472 /// <since_tizen> 9 </since_tizen>
473 public VisualTransformPolicyType CornerRadiusPolicy
475 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
476 set => SetValue(CornerRadiusPolicyProperty, value);
480 /// The current state of the view.
482 /// <since_tizen> 3 </since_tizen>
487 return (States)GetValue(StateProperty);
491 SetValue(StateProperty, value);
492 NotifyPropertyChanged();
497 /// The current sub state of the view.
499 /// <since_tizen> 3 </since_tizen>
500 public States SubState
504 return (States)GetValue(SubStateProperty);
508 SetValue(SubStateProperty, value);
509 NotifyPropertyChanged();
514 /// Displays a tooltip
516 /// <since_tizen> 3 </since_tizen>
517 public Tizen.NUI.PropertyMap Tooltip
521 return (PropertyMap)GetValue(TooltipProperty);
525 SetValue(TooltipProperty, value);
526 NotifyPropertyChanged();
531 /// Displays a tooltip as a text.
533 /// <since_tizen> 3 </since_tizen>
534 public string TooltipText
538 using (var propertyValue = GetProperty(Property.TOOLTIP))
540 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
542 return retrivedValue;
544 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
545 return "error to get TooltipText";
550 var temp = new Tizen.NUI.PropertyValue(value);
551 SetProperty(View.Property.TOOLTIP, temp);
553 NotifyPropertyChanged();
558 /// The Child property of FlexContainer.<br />
559 /// The proportion of the free space in the container, the flex item will receive.<br />
560 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
562 /// <since_tizen> 3 </since_tizen>
563 [Obsolete("Deprecated in API8, will be removed in API10.")]
568 return (float)GetValue(FlexProperty);
572 SetValue(FlexProperty, value);
573 NotifyPropertyChanged();
578 /// The Child property of FlexContainer.<br />
579 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
581 /// <since_tizen> 3 </since_tizen>
582 [Obsolete("Deprecated in API8, will be removed in API10.")]
587 return (int)GetValue(AlignSelfProperty);
591 SetValue(AlignSelfProperty, value);
592 NotifyPropertyChanged();
597 /// The Child property of FlexContainer.<br />
598 /// The space around the flex item.<br />
601 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
603 /// <since_tizen> 3 </since_tizen>
604 [Obsolete("Deprecated in API8, will be removed in API10.")]
605 public Vector4 FlexMargin
609 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
610 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
614 SetValue(FlexMarginProperty, value);
615 NotifyPropertyChanged();
620 /// The top-left cell this child occupies, if not set, the first available cell is used.
623 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
624 /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
626 /// <since_tizen> 3 </since_tizen>
627 public Vector2 CellIndex
631 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
632 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
636 SetValue(CellIndexProperty, value);
637 NotifyPropertyChanged();
642 /// The number of rows this child occupies, if not set, the default value is 1.
645 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
647 /// <since_tizen> 3 </since_tizen>
652 return (float)GetValue(RowSpanProperty);
656 SetValue(RowSpanProperty, value);
657 NotifyPropertyChanged();
662 /// The number of columns this child occupies, if not set, the default value is 1.
665 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
667 /// <since_tizen> 3 </since_tizen>
668 public float ColumnSpan
672 return (float)GetValue(ColumnSpanProperty);
676 SetValue(ColumnSpanProperty, value);
677 NotifyPropertyChanged();
682 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
685 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
687 /// <since_tizen> 3 </since_tizen>
688 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
692 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
696 SetValue(CellHorizontalAlignmentProperty, value);
697 NotifyPropertyChanged();
702 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
705 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
707 /// <since_tizen> 3 </since_tizen>
708 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
712 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
716 SetValue(CellVerticalAlignmentProperty, value);
717 NotifyPropertyChanged();
722 /// The left focusable view.<br />
723 /// This will return null if not set.<br />
724 /// This will also return null if the specified left focusable view is not on a window.<br />
726 /// <since_tizen> 3 </since_tizen>
727 public View LeftFocusableView
729 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
732 return (View)GetValue(LeftFocusableViewProperty);
736 SetValue(LeftFocusableViewProperty, value);
737 NotifyPropertyChanged();
742 /// The right focusable view.<br />
743 /// This will return null if not set.<br />
744 /// This will also return null if the specified right focusable view is not on a window.<br />
746 /// <since_tizen> 3 </since_tizen>
747 public View RightFocusableView
749 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
752 return (View)GetValue(RightFocusableViewProperty);
756 SetValue(RightFocusableViewProperty, value);
757 NotifyPropertyChanged();
762 /// The up focusable view.<br />
763 /// This will return null if not set.<br />
764 /// This will also return null if the specified up focusable view is not on a window.<br />
766 /// <since_tizen> 3 </since_tizen>
767 public View UpFocusableView
769 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
772 return (View)GetValue(UpFocusableViewProperty);
776 SetValue(UpFocusableViewProperty, value);
777 NotifyPropertyChanged();
782 /// The down focusable view.<br />
783 /// This will return null if not set.<br />
784 /// This will also return null if the specified down focusable view is not on a window.<br />
786 /// <since_tizen> 3 </since_tizen>
787 public View DownFocusableView
789 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
792 return (View)GetValue(DownFocusableViewProperty);
796 SetValue(DownFocusableViewProperty, value);
797 NotifyPropertyChanged();
802 /// Whether the view should be focusable by keyboard navigation.
804 /// <since_tizen> 3 </since_tizen>
805 public bool Focusable
809 SetValue(FocusableProperty, value);
810 NotifyPropertyChanged();
814 return (bool)GetValue(FocusableProperty);
819 /// Retrieves the position of the view.<br />
820 /// The coordinates are relative to the view's parent.<br />
822 /// <since_tizen> 3 </since_tizen>
823 public Position CurrentPosition
827 return GetCurrentPosition();
832 /// Sets the size of a view for the width and the height.<br />
833 /// Geometry can be scaled to fit within this area.<br />
834 /// This does not interfere with the view's scale factor.<br />
835 /// The views default depth is the minimum of width and height.<br />
838 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
839 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
841 /// <since_tizen> 3 </since_tizen>
846 Size2D temp = (Size2D)GetValue(Size2DProperty);
847 int width = temp.Width;
848 int height = temp.Height;
850 if (this.Layout == null)
852 if (width < 0) { width = 0; }
853 if (height < 0) { height = 0; }
856 return new Size2D(OnSize2DChanged, width, height);
860 SetValue(Size2DProperty, value);
862 NotifyPropertyChanged();
867 /// Retrieves the size of the view.<br />
868 /// The coordinates are relative to the view's parent.<br />
870 /// <since_tizen> 3 </since_tizen>
871 public Size2D CurrentSize
875 return GetCurrentSize();
880 /// Retrieves and sets the view's opacity.<br />
882 /// <since_tizen> 3 </since_tizen>
887 return (float)GetValue(OpacityProperty);
891 SetValue(OpacityProperty, value);
892 NotifyPropertyChanged();
897 /// Sets the position of the view for X and Y.<br />
898 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
899 /// If the position inheritance is disabled, sets the world position.<br />
902 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
903 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
905 /// <since_tizen> 3 </since_tizen>
906 public Position2D Position2D
910 Position2D temp = (Position2D)GetValue(Position2DProperty);
911 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
915 SetValue(Position2DProperty, value);
916 NotifyPropertyChanged();
921 /// Retrieves the screen position of the view.<br />
923 /// <since_tizen> 3 </since_tizen>
924 public Vector2 ScreenPosition
928 Vector2 temp = new Vector2(0.0f, 0.0f);
929 var pValue = GetProperty(View.Property.ScreenPosition);
937 /// Determines whether the pivot point should be used to determine the position of the view.
938 /// This is false by default.
940 /// <remarks>If false, then the top-left of the view is used for the position.
941 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
943 /// <since_tizen> 3 </since_tizen>
944 public bool PositionUsesPivotPoint
948 return (bool)GetValue(PositionUsesPivotPointProperty);
952 SetValue(PositionUsesPivotPointProperty, value);
953 NotifyPropertyChanged();
958 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
960 /// <since_tizen> 3 </since_tizen>
961 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
963 "View view = new View(); " +
964 "view.PivotPoint = PivotPoint.Center; " +
965 "view.PositionUsesPivotPoint = true;" +
966 " Deprecated in API5: Will be removed in API8")]
967 [EditorBrowsable(EditorBrowsableState.Never)]
968 public bool PositionUsesAnchorPoint
973 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
974 pValue.Get(out temp);
980 var temp = new Tizen.NUI.PropertyValue(value);
981 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
983 NotifyPropertyChanged();
988 /// Queries whether the view is connected to the stage.<br />
989 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
991 /// <since_tizen> 3 </since_tizen>
992 public bool IsOnWindow
1001 /// Gets the depth in the hierarchy for the view.
1003 /// <since_tizen> 3 </since_tizen>
1004 public int HierarchyDepth
1008 return GetHierarchyDepth();
1013 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1016 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1017 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1018 /// The values set by this property will likely change.
1020 /// <since_tizen> 3 </since_tizen>
1021 public int SiblingOrder
1025 return (int)GetValue(SiblingOrderProperty);
1029 SetValue(SiblingOrderProperty, value);
1031 LayoutGroup layout = Layout as LayoutGroup;
1032 layout?.ChangeLayoutSiblingOrder(value);
1034 NotifyPropertyChanged();
1039 /// Returns the natural size of the view.
1042 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1044 /// <since_tizen> 5 </since_tizen>
1045 public Vector3 NaturalSize
1049 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1050 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1056 /// Returns the natural size (Size2D) of the view.
1059 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1061 /// <since_tizen> 4 </since_tizen>
1062 public Size2D NaturalSize2D
1066 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1067 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1069 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1076 /// Gets or sets the origin of a view within its parent's area.<br />
1077 /// 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 />
1078 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1079 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1081 /// <pre>The view has been initialized.</pre>
1082 /// <since_tizen> 3 </since_tizen>
1083 public Position ParentOrigin
1087 Position tmp = (Position)GetValue(ParentOriginProperty);
1088 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1092 SetValue(ParentOriginProperty, value);
1093 NotifyPropertyChanged();
1098 /// Gets or sets the anchor-point of a view.<br />
1099 /// 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 />
1100 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1101 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1102 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1103 /// <pre>The view has been initialized.</pre>
1106 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1108 /// <since_tizen> 3 </since_tizen>
1109 public Position PivotPoint
1113 Position tmp = (Position)GetValue(PivotPointProperty);
1114 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1118 SetValue(PivotPointProperty, value);
1119 NotifyPropertyChanged();
1124 /// Gets or sets the size width of the view.
1128 /// Animatable - This property can be animated using <c>Animation</c> class.
1131 /// <since_tizen> 3 </since_tizen>
1132 public float SizeWidth
1136 return (float)GetValue(SizeWidthProperty);
1140 SetValue(SizeWidthProperty, value);
1141 NotifyPropertyChanged();
1146 /// Gets or sets the size height of the view.
1150 /// Animatable - This property can be animated using <c>Animation</c> class.
1153 /// <since_tizen> 3 </since_tizen>
1154 public float SizeHeight
1158 return (float)GetValue(SizeHeightProperty);
1162 SetValue(SizeHeightProperty, value);
1163 NotifyPropertyChanged();
1168 /// Gets or sets the position of the view.<br />
1169 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1170 /// If the position inheritance is disabled, sets the world position.<br />
1174 /// Animatable - This property can be animated using <c>Animation</c> class.
1176 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1178 /// <since_tizen> 3 </since_tizen>
1179 public Position Position
1183 Position tmp = (Position)GetValue(PositionProperty);
1184 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1188 SetValue(PositionProperty, value);
1189 NotifyPropertyChanged();
1194 /// Gets or sets the position X of the view.
1198 /// Animatable - This property can be animated using <c>Animation</c> class.
1201 /// <since_tizen> 3 </since_tizen>
1202 public float PositionX
1206 return (float)GetValue(PositionXProperty);
1210 SetValue(PositionXProperty, value);
1211 NotifyPropertyChanged();
1216 /// Gets or sets the position Y of the view.
1220 /// Animatable - This property can be animated using <c>Animation</c> class.
1223 /// <since_tizen> 3 </since_tizen>
1224 public float PositionY
1228 return (float)GetValue(PositionYProperty);
1232 SetValue(PositionYProperty, value);
1233 NotifyPropertyChanged();
1238 /// Gets or sets the position Z of the view.
1242 /// Animatable - This property can be animated using <c>Animation</c> class.
1245 /// <since_tizen> 3 </since_tizen>
1246 public float PositionZ
1250 return (float)GetValue(PositionZProperty);
1254 SetValue(PositionZProperty, value);
1255 NotifyPropertyChanged();
1260 /// Gets or sets the world position of the view.
1262 /// <since_tizen> 3 </since_tizen>
1263 public Vector3 WorldPosition
1267 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1268 var pValue = GetProperty(View.Property.WorldPosition);
1276 /// Gets or sets the orientation of the view.<br />
1277 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1281 /// This is an asynchronous method.
1284 /// Animatable - This property can be animated using <c>Animation</c> class.
1287 /// <since_tizen> 3 </since_tizen>
1288 public Rotation Orientation
1292 return (Rotation)GetValue(OrientationProperty);
1296 SetValue(OrientationProperty, value);
1297 NotifyPropertyChanged();
1302 /// Gets or sets the world orientation of the view.<br />
1304 /// <since_tizen> 3 </since_tizen>
1305 public Rotation WorldOrientation
1309 Rotation temp = new Rotation();
1310 var pValue = GetProperty(View.Property.WorldOrientation);
1318 /// Gets or sets the scale factor applied to the view.<br />
1322 /// Animatable - This property can be animated using <c>Animation</c> class.
1324 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1326 /// <since_tizen> 3 </since_tizen>
1327 public Vector3 Scale
1331 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1332 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1336 SetValue(ScaleProperty, value);
1337 NotifyPropertyChanged();
1342 /// Gets or sets the scale X factor applied to the view.
1346 /// Animatable - This property can be animated using <c>Animation</c> class.
1349 /// <since_tizen> 3 </since_tizen>
1354 return (float)GetValue(ScaleXProperty);
1358 SetValue(ScaleXProperty, value);
1359 NotifyPropertyChanged();
1364 /// Gets or sets the scale Y factor applied to the view.
1368 /// Animatable - This property can be animated using <c>Animation</c> class.
1371 /// <since_tizen> 3 </since_tizen>
1376 return (float)GetValue(ScaleYProperty);
1380 SetValue(ScaleYProperty, value);
1381 NotifyPropertyChanged();
1386 /// Gets or sets the scale Z factor applied to the view.
1390 /// Animatable - This property can be animated using <c>Animation</c> class.
1393 /// <since_tizen> 3 </since_tizen>
1398 return (float)GetValue(ScaleZProperty);
1402 SetValue(ScaleZProperty, value);
1403 NotifyPropertyChanged();
1408 /// Gets the world scale of the view.
1410 /// <since_tizen> 3 </since_tizen>
1411 public Vector3 WorldScale
1415 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1416 var pValue = GetProperty(View.Property.WorldScale);
1424 /// Retrieves the visibility flag of the view.
1428 /// If the view is not visible, then the view and its children will not be rendered.
1429 /// 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.
1432 /// Animatable - This property can be animated using <c>Animation</c> class.
1435 /// <since_tizen> 3 </since_tizen>
1436 public bool Visibility
1441 var pValue = GetProperty(View.Property.VISIBLE);
1442 pValue.Get(out temp);
1449 /// Gets the view's world color.
1451 /// <since_tizen> 3 </since_tizen>
1452 public Vector4 WorldColor
1456 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1457 var pValue = GetProperty(View.Property.WorldColor);
1465 /// Gets or sets the view's name.
1467 /// <since_tizen> 3 </since_tizen>
1472 return (string)GetValue(NameProperty);
1476 SetValue(NameProperty, value);
1477 NotifyPropertyChanged();
1482 /// Get the number of children held by the view.
1484 /// <since_tizen> 3 </since_tizen>
1485 public new uint ChildCount
1489 return Convert.ToUInt32(Children.Count);
1494 /// Gets the view's ID.
1497 /// <since_tizen> 3 </since_tizen>
1507 /// Gets or sets the status of whether the view should emit touch or hover signals.
1509 /// <since_tizen> 3 </since_tizen>
1510 public bool Sensitive
1514 return (bool)GetValue(SensitiveProperty);
1518 SetValue(SensitiveProperty, value);
1519 NotifyPropertyChanged();
1524 /// 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.
1526 /// <since_tizen> 3 </since_tizen>
1527 public bool LeaveRequired
1531 return (bool)GetValue(LeaveRequiredProperty);
1535 SetValue(LeaveRequiredProperty, value);
1536 NotifyPropertyChanged();
1541 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1543 /// <since_tizen> 3 </since_tizen>
1544 public bool InheritOrientation
1548 return (bool)GetValue(InheritOrientationProperty);
1552 SetValue(InheritOrientationProperty, value);
1553 NotifyPropertyChanged();
1558 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1560 /// <since_tizen> 3 </since_tizen>
1561 public bool InheritScale
1565 return (bool)GetValue(InheritScaleProperty);
1569 SetValue(InheritScaleProperty, value);
1570 NotifyPropertyChanged();
1575 /// Gets or sets the status of how the view and its children should be drawn.<br />
1576 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1577 /// 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 />
1578 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1579 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1580 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1582 /// <since_tizen> 3 </since_tizen>
1583 public DrawModeType DrawMode
1587 return (DrawModeType)GetValue(DrawModeProperty);
1591 SetValue(DrawModeProperty, value);
1592 NotifyPropertyChanged();
1597 /// Gets or sets the relative to parent size factor of the view.<br />
1598 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1599 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1602 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1604 /// <since_tizen> 3 </since_tizen>
1605 public Vector3 SizeModeFactor
1609 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1610 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1614 SetValue(SizeModeFactorProperty, value);
1615 NotifyPropertyChanged();
1620 /// Gets or sets the width resize policy to be used.
1622 /// <since_tizen> 3 </since_tizen>
1623 public ResizePolicyType WidthResizePolicy
1627 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1631 SetValue(WidthResizePolicyProperty, value);
1632 NotifyPropertyChanged();
1637 /// Gets or sets the height resize policy to be used.
1639 /// <since_tizen> 3 </since_tizen>
1640 public ResizePolicyType HeightResizePolicy
1644 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1648 SetValue(HeightResizePolicyProperty, value);
1649 NotifyPropertyChanged();
1654 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1655 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1657 /// <since_tizen> 3 </since_tizen>
1658 public SizeScalePolicyType SizeScalePolicy
1662 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1666 SetValue(SizeScalePolicyProperty, value);
1667 NotifyPropertyChanged();
1672 /// Gets or sets the status of whether the width size is dependent on the height size.
1674 /// <since_tizen> 3 </since_tizen>
1675 public bool WidthForHeight
1679 return (bool)GetValue(WidthForHeightProperty);
1683 SetValue(WidthForHeightProperty, value);
1684 NotifyPropertyChanged();
1689 /// Gets or sets the status of whether the height size is dependent on the width size.
1691 /// <since_tizen> 3 </since_tizen>
1692 public bool HeightForWidth
1696 return (bool)GetValue(HeightForWidthProperty);
1700 SetValue(HeightForWidthProperty, value);
1701 NotifyPropertyChanged();
1706 /// Gets or sets the padding for use in layout.
1709 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1711 /// <since_tizen> 5 </since_tizen>
1712 public Extents Padding
1716 // If View has a Layout then padding in stored in the base Layout class
1719 return Layout.Padding;
1723 Extents temp = (Extents)GetValue(PaddingProperty);
1724 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1726 // Two return points to prevent creating a zeroed Extent native object before assignment
1730 Extents padding = value;
1733 // Layout set so store Padding in LayoutItem instead of in View.
1734 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1735 // the position and sizes measure in the Layouting.
1736 Layout.Padding = value;
1737 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1738 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1739 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1741 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1745 SetValue(PaddingProperty, padding);
1746 NotifyPropertyChanged();
1751 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1753 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1755 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1757 /// <since_tizen> 3 </since_tizen>
1758 public Size2D MinimumSize
1762 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1763 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1769 throw new ArgumentNullException(nameof(value));
1773 // Note: it only works if minimum size is >= than natural size.
1774 // To force the size it should be done through the width&height spec or Size2D.
1775 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1776 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1777 layout.RequestLayout();
1779 SetValue(MinimumSizeProperty, value);
1780 NotifyPropertyChanged();
1785 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1788 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1790 /// <since_tizen> 3 </since_tizen>
1791 public Size2D MaximumSize
1795 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1796 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1800 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1801 // MATCH_PARENT spec + parent container size can be used to limit
1804 layout.RequestLayout();
1806 SetValue(MaximumSizeProperty, value);
1807 NotifyPropertyChanged();
1812 /// Gets or sets whether a child view inherits it's parent's position.<br />
1813 /// Default is to inherit.<br />
1814 /// 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 />
1816 /// <since_tizen> 3 </since_tizen>
1817 public bool InheritPosition
1821 return (bool)GetValue(InheritPositionProperty);
1825 SetValue(InheritPositionProperty, value);
1826 NotifyPropertyChanged();
1831 /// Gets or sets the clipping behavior (mode) of it's children.
1833 /// <since_tizen> 3 </since_tizen>
1834 public ClippingModeType ClippingMode
1838 return (ClippingModeType)GetValue(ClippingModeProperty);
1842 SetValue(ClippingModeProperty, value);
1843 NotifyPropertyChanged();
1848 /// Gets the number of renderers held by the view.
1850 /// <since_tizen> 3 </since_tizen>
1851 public uint RendererCount
1855 return GetRendererCount();
1860 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1863 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1865 /// <since_tizen> 3 </since_tizen>
1866 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1868 "View view = new View(); " +
1869 "view.PivotPoint = PivotPoint.Center; " +
1870 "view.PositionUsesPivotPoint = true;")]
1871 [EditorBrowsable(EditorBrowsableState.Never)]
1872 public Position AnchorPoint
1876 Position temp = new Position(0.0f, 0.0f, 0.0f);
1877 var pValue = GetProperty(View.Property.AnchorPoint);
1880 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1886 var temp = new Tizen.NUI.PropertyValue(value);
1887 SetProperty(View.Property.AnchorPoint, temp);
1889 NotifyPropertyChanged();
1894 /// Sets the size of a view for the width, the height and the depth.<br />
1895 /// Geometry can be scaled to fit within this area.<br />
1896 /// This does not interfere with the view's scale factor.<br />
1897 /// The views default depth is the minimum of width and height.<br />
1901 /// Animatable - This property can be animated using <c>Animation</c> class.
1903 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1905 /// <since_tizen> 5 </since_tizen>
1910 Size tmp = (Size)GetValue(SizeProperty);
1911 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1915 SetValue(SizeProperty, value);
1916 NotifyPropertyChanged();
1921 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1923 /// <since_tizen> 3 </since_tizen>
1924 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1926 "Container parent = view.GetParent(); " +
1927 "View view = parent as View;")]
1928 [EditorBrowsable(EditorBrowsableState.Never)]
1929 public new View Parent
1934 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
1935 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1936 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1938 if (basehandle is Layer layer)
1940 ret = new View(Layer.getCPtr(layer).Handle, false);
1941 NUILog.Error("This Parent property is deprecated, should do not be used");
1945 ret = basehandle as View;
1948 Interop.BaseHandle.DeleteBaseHandle(CPtr);
1949 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1951 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1957 /// Gets/Sets whether inherit parent's the layout Direction.
1959 /// <since_tizen> 4 </since_tizen>
1960 public bool InheritLayoutDirection
1964 return (bool)GetValue(InheritLayoutDirectionProperty);
1968 SetValue(InheritLayoutDirectionProperty, value);
1969 NotifyPropertyChanged();
1974 /// Gets/Sets the layout Direction.
1976 /// <since_tizen> 4 </since_tizen>
1977 public ViewLayoutDirectionType LayoutDirection
1981 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1985 SetValue(LayoutDirectionProperty, value);
1986 NotifyPropertyChanged();
1987 layout?.RequestLayout();
1992 /// Gets or sets the Margin for use in layout.
1995 /// Margin property is supported by Layout algorithms and containers.
1996 /// Please Set Layout if you want to use Margin property.
1997 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1999 /// <since_tizen> 4 </since_tizen>
2000 public Extents Margin
2004 // If View has a Layout then margin is stored in Layout.
2007 return Layout.Margin;
2011 // If Layout not set then return margin stored in View.
2012 Extents temp = (Extents)GetValue(MarginProperty);
2013 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2015 // Two return points to prevent creating a zeroed Extent native object before assignment
2021 // Layout set so store Margin in LayoutItem instead of View.
2022 // If View stores the Margin too then the Legacy Size Negotiation will
2023 // overwrite the position and size values measured in the Layouting.
2024 Layout.Margin = value;
2025 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2026 layout?.RequestLayout();
2030 SetValue(MarginProperty, value);
2032 NotifyPropertyChanged();
2033 layout?.RequestLayout();
2038 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2042 /// // matchParentView matches its size to its parent size.
2043 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2044 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2046 /// // wrapContentView wraps its children with their desired size.
2047 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2048 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2050 /// // exactSizeView shows itself with an exact size.
2051 /// exactSizeView.WidthSpecification = 100;
2052 /// exactSizeView.HeightSpecification = 100;
2055 /// <since_tizen> 6 </since_tizen>
2056 public int WidthSpecification
2064 if (value == widthPolicy)
2067 widthPolicy = value;
2068 if (widthPolicy >= 0)
2070 if (heightPolicy >= 0) // Policy an exact value
2072 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2073 Size2D = new Size2D(widthPolicy, heightPolicy);
2076 layout?.RequestLayout();
2081 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2085 /// // matchParentView matches its size to its parent size.
2086 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2087 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2089 /// // wrapContentView wraps its children with their desired size.
2090 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2091 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2093 /// // exactSizeView shows itself with an exact size.
2094 /// exactSizeView.WidthSpecification = 100;
2095 /// exactSizeView.HeightSpecification = 100;
2098 /// <since_tizen> 6 </since_tizen>
2099 public int HeightSpecification
2103 return heightPolicy;
2107 if (value == heightPolicy)
2110 heightPolicy = value;
2111 if (heightPolicy >= 0)
2113 if (widthPolicy >= 0) // Policy an exact value
2115 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2116 Size2D = new Size2D(widthPolicy, heightPolicy);
2119 layout?.RequestLayout();
2124 /// Gets the List of transitions for this View.
2126 /// <since_tizen> 6 </since_tizen>
2127 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2131 if (layoutTransitions == null)
2133 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2135 return layoutTransitions;
2140 /// Sets a layout transitions for this View.
2142 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2144 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2146 /// <since_tizen> 6 </since_tizen>
2147 public LayoutTransition LayoutTransition
2151 return layoutTransition;
2157 throw new global::System.ArgumentNullException(nameof(value));
2159 if (layoutTransitions == null)
2161 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2164 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2166 AttachTransitionsToChildren(value);
2168 layoutTransition = value;
2173 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2176 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2178 /// <since_tizen> 4 </since_tizen>
2179 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2180 [EditorBrowsable(EditorBrowsableState.Never)]
2181 public Extents PaddingEX
2185 Extents temp = new Extents(0, 0, 0, 0);
2186 var pValue = GetProperty(View.Property.PADDING);
2189 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2195 var temp = new Tizen.NUI.PropertyValue(value);
2196 SetProperty(View.Property.PADDING, temp);
2198 NotifyPropertyChanged();
2199 layout?.RequestLayout();
2204 /// The Color of View. This is an RGBA value.
2208 /// Animatable - This property can be animated using <c>Animation</c> class.
2210 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2212 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2213 [EditorBrowsable(EditorBrowsableState.Never)]
2218 Color temp = (Color)GetValue(ColorProperty);
2219 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2223 SetValue(ColorProperty, value);
2224 NotifyPropertyChanged();
2229 /// Set the layout on this View. Replaces any existing Layout.
2232 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2234 /// <since_tizen> 6 </since_tizen>
2235 public LayoutItem Layout
2243 // Do nothing if layout provided is already set on this View.
2244 if (value == layout)
2249 LayoutingDisabled = false;
2252 // If new layout being set already has a owner then that owner receives a replacement default layout.
2253 // First check if the layout to be set already has a owner.
2254 if (value?.Owner != null)
2256 // Previous owner of the layout gets a default layout as a replacement.
2257 value.Owner.Layout = new AbsoluteLayout();
2259 // Copy Margin and Padding to replacement LayoutGroup.
2260 if (value.Owner.Layout != null)
2262 value.Owner.Layout.Margin = value.Margin;
2263 value.Owner.Layout.Padding = value.Padding;
2267 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2268 // View if no replacement. Previously margin and padding values would have been moved from
2269 // the View to the layout.
2270 if (layout != null) // Existing layout
2274 // Existing layout being replaced so copy over margin and padding values.
2275 value.Margin = layout.Margin;
2276 value.Padding = layout.Padding;
2280 // Layout not being replaced so restore margin and padding to View.
2281 SetValue(MarginProperty, layout.Margin);
2282 SetValue(PaddingProperty, layout.Padding);
2283 NotifyPropertyChanged();
2288 // First Layout to be added to the View hence copy
2290 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2293 Extents margin = Margin;
2294 Extents padding = Padding;
2295 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2297 // If View already has a margin set then store it in Layout instead.
2298 value.Margin = margin;
2299 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2300 NotifyPropertyChanged();
2303 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2305 // If View already has a padding set then store it in Layout instead.
2306 value.Padding = padding;
2308 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2309 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2310 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2312 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2313 NotifyPropertyChanged();
2319 // Remove existing layout from it's parent layout group.
2322 value.SetPositionByLayout = !excludeLayouting;
2324 // Set layout to this view
2330 /// The weight of the View, used to share available space in a layout with siblings.
2332 /// <since_tizen> 6 </since_tizen>
2342 layout?.RequestLayout();
2347 /// Whether to load the BackgroundImage synchronously.
2348 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2349 /// Note: For Normal Quad images only.
2351 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2352 [EditorBrowsable(EditorBrowsableState.Never)]
2353 public bool BackgroundImageSynchronosLoading
2357 return backgroundImageSynchronosLoading;
2361 backgroundImageSynchronosLoading = value;
2363 string bgUrl = null;
2364 var pValue = Background.Find(ImageVisualProperty.URL);
2365 pValue?.Get(out bgUrl);
2368 if (!string.IsNullOrEmpty(bgUrl))
2370 PropertyMap bgMap = this.Background;
2371 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2372 bgMap.Add("synchronousLoading", temp);
2379 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2380 [EditorBrowsable(EditorBrowsableState.Never)]
2381 public Vector2 UpdateSizeHint
2385 return (Vector2)GetValue(UpdateSizeHintProperty);
2389 SetValue(UpdateSizeHintProperty, value);
2390 NotifyPropertyChanged();
2395 /// Enable/Disable ControlState propagation for children.
2396 /// It is false by default.
2397 /// If the View needs to share ControlState with descendants, please set it true.
2398 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2400 [EditorBrowsable(EditorBrowsableState.Never)]
2401 public bool EnableControlStatePropagation
2403 get => controlStatePropagation;
2406 controlStatePropagation = value;
2408 foreach (View child in Children)
2410 child.EnableControlStatePropagation = value;
2416 /// By default, it is false in View, true in Control.
2417 /// Note that if the value is true, the View will be a touch receptor.
2419 [EditorBrowsable(EditorBrowsableState.Never)]
2420 public bool EnableControlState
2424 return (bool)GetValue(EnableControlStateProperty);
2428 SetValue(EnableControlStateProperty, value);
2433 /// Whether the actor grab all touches even if touch leaves its boundary.
2435 /// <returns>true, if it grab all touch after start</returns>
2436 [EditorBrowsable(EditorBrowsableState.Never)]
2437 public bool GrabTouchAfterLeave
2442 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2443 pValue.Get(out temp);
2449 var temp = new Tizen.NUI.PropertyValue(value);
2450 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2452 NotifyPropertyChanged();
2457 /// Determines which blend equation will be used to render renderers of this actor.
2459 /// <returns>blend equation enum currently assigned</returns>
2460 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2461 [EditorBrowsable(EditorBrowsableState.Never)]
2462 public BlendEquationType BlendEquation
2467 var pValue = GetProperty(View.Property.BlendEquation);
2468 pValue.Get(out temp);
2470 return (BlendEquationType)temp;
2474 var temp = new Tizen.NUI.PropertyValue((int)value);
2475 SetProperty(View.Property.BlendEquation, temp);
2477 NotifyPropertyChanged();
2482 /// If the value is true, the View will change its style as the theme changes.
2483 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2485 /// <since_tizen> 9 </since_tizen>
2486 public bool ThemeChangeSensitive
2488 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2489 set => SetValue(ThemeChangeSensitiveProperty, value);
2493 /// Create Style, it is abstract function and must be override.
2495 [EditorBrowsable(EditorBrowsableState.Never)]
2496 protected virtual ViewStyle CreateViewStyle()
2498 return new ViewStyle();
2502 /// Called after the View's ControlStates changed.
2504 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2505 [EditorBrowsable(EditorBrowsableState.Never)]
2506 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2512 [EditorBrowsable(EditorBrowsableState.Never)]
2513 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2519 /// Apply style instance to the view.
2520 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2522 /// <since_tizen> 9 </since_tizen>
2523 public virtual void ApplyStyle(ViewStyle viewStyle)
2525 if (viewStyle == null || this.viewStyle == viewStyle) return;
2527 this.viewStyle = viewStyle;
2529 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2535 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2537 if (bindablePropertyOfView == null)
2542 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2543 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2545 foreach (var sourceProperty in dirtyStyleProperties)
2547 var sourceValue = viewStyle.GetValue(sourceProperty);
2549 if (sourceValue == null)
2554 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2556 if (destinationProperty != null)
2558 SetValue(destinationProperty, sourceValue);
2564 /// Get whether the View is culled or not.
2565 /// True means that the View is out of the view frustum.
2568 /// Hidden-API (Inhouse-API).
2570 [EditorBrowsable(EditorBrowsableState.Never)]
2576 var pValue = GetProperty(View.Property.Culled);
2577 pValue.Get(out temp);
2584 /// Set or Get TransitionOptions for the page transition.
2585 /// This property is used to define how this view will be transitioned during Page switching.
2587 /// <since_tizen> 9 </since_tizen>
2588 public TransitionOptions TransitionOptions
2592 transitionOptions = value;
2596 return transitionOptions;