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 excludeLayouting = false;
43 private LayoutTransition layoutTransition;
44 private TransitionOptions transitionOptions = null;
45 private ThemeData themeData;
47 internal class ThemeData
49 public bool controlStatePropagation = false;
50 public ViewStyle viewStyle;
51 public bool themeChangeSensitive = false;
52 public ControlState controlStates = ControlState.Normal;
53 public ViewSelectorData selectorData;
59 /// Creates a new instance of a view.
61 /// <since_tizen> 3 </since_tizen>
62 public View() : this(Interop.View.New(), true)
64 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
67 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
68 [EditorBrowsable(EditorBrowsableState.Never)]
69 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
74 /// Create a new instance of a View with setting the status of shown or hidden.
76 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
77 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
78 [EditorBrowsable(EditorBrowsableState.Never)]
79 public View(bool shown) : this(Interop.View.New(), true)
81 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
85 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
87 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
96 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
98 InitializeStyle(viewStyle);
101 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
105 PositionUsesPivotPoint = false;
108 onWindowSendEventCallback = SendViewAddedEventToWindow;
109 this.OnWindowSignal().Connect(onWindowSendEventCallback);
117 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
128 /// The event that is triggered when the View's ControlState is changed.
130 [EditorBrowsable(EditorBrowsableState.Never)]
131 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
133 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
137 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
139 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
140 [EditorBrowsable(EditorBrowsableState.Never)]
141 public bool LayoutSet
150 /// Flag to allow Layouting to be disabled for Views.
151 /// Once a View has a Layout set then any children added to Views from then on will receive
152 /// automatic Layouts.
154 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
155 [EditorBrowsable(EditorBrowsableState.Never)]
156 public static bool LayoutingDisabled { get; set; } = true;
159 /// The style instance applied to this view.
160 /// Note that please do not modify the ViewStyle.
161 /// Modifying ViewStyle will affect other views with same ViewStyle.
163 [EditorBrowsable(EditorBrowsableState.Never)]
164 protected ViewStyle ViewStyle
168 if (themeData == null) themeData = new ThemeData();
170 if (themeData.viewStyle == null)
172 ApplyStyle(CreateViewStyle());
174 return themeData.viewStyle;
179 /// Get/Set the control state.
180 /// Note that the ControlState only available for the classes derived from Control.
181 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
182 /// please set <see cref="EnableControlState"/> to true.
184 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
185 [EditorBrowsable(EditorBrowsableState.Never)]
186 public ControlState ControlState
190 return themeData == null ? ControlState.Normal : themeData.controlStates;
194 if (ControlState == value)
199 var prevState = ControlState;
201 if (themeData == null) themeData = new ThemeData();
202 themeData.controlStates = value;
204 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
206 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
208 if (themeData.controlStatePropagation)
210 foreach (View child in Children)
212 child.ControlState = value;
216 OnControlStateChanged(changeInfo);
218 ControlStateChangedEvent?.Invoke(this, changeInfo);
223 /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
225 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
226 [EditorBrowsable(EditorBrowsableState.Never)]
227 public bool ExcludeLayouting
231 return excludeLayouting;
235 excludeLayouting = value;
236 if (Layout != null && Layout.SetPositionByLayout == value)
238 Layout.SetPositionByLayout = !value;
239 Layout.RequestLayout();
244 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
245 [EditorBrowsable(EditorBrowsableState.Never)]
246 public bool IsResourcesCreated
250 return Application.Current.IsResourcesCreated;
254 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
255 [EditorBrowsable(EditorBrowsableState.Never)]
256 public ResourceDictionary XamlResources
260 return Application.Current.XamlResources;
264 Application.Current.XamlResources = value;
269 /// The StyleName, type string.
270 /// The value indicates DALi style name defined in json theme file.
272 /// <since_tizen> 3 </since_tizen>
273 public string StyleName
277 return (string)GetValue(StyleNameProperty);
281 SetValue(StyleNameProperty, value);
282 NotifyPropertyChanged();
287 /// The KeyInputFocus, type bool.
289 [EditorBrowsable(EditorBrowsableState.Never)]
290 public bool KeyInputFocus
294 return (bool)GetValue(KeyInputFocusProperty);
298 SetValue(KeyInputFocusProperty, value);
299 NotifyPropertyChanged();
304 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
308 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
311 /// Animatable - This property can be animated using <c>Animation</c> class.
313 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
317 /// <since_tizen> 3 </since_tizen>
318 public Color BackgroundColor
322 Color temp = (Color)GetValue(BackgroundColorProperty);
323 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
327 SetValue(BackgroundColorProperty, value);
328 NotifyPropertyChanged();
333 /// The mutually exclusive with "backgroundColor" and "background" type Map.
335 /// <since_tizen> 3 </since_tizen>
336 public string BackgroundImage
340 return (string)GetValue(BackgroundImageProperty);
344 SetValue(BackgroundImageProperty, value);
345 NotifyPropertyChanged();
350 /// Get or set the border of background image.
352 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
353 [EditorBrowsable(EditorBrowsableState.Never)]
354 public Rectangle BackgroundImageBorder
358 return (Rectangle)GetValue(BackgroundImageBorderProperty);
362 SetValue(BackgroundImageBorderProperty, value);
363 NotifyPropertyChanged();
368 /// The background of view.
370 /// <since_tizen> 3 </since_tizen>
371 public Tizen.NUI.PropertyMap Background
375 return (PropertyMap)GetValue(BackgroundProperty);
379 SetValue(BackgroundProperty, value);
380 NotifyPropertyChanged();
385 /// Describes a shadow as an image for a View.
386 /// It is null by default.
389 /// Getter returns copied instance of current shadow.
392 /// The mutually exclusive with "BoxShadow".
396 /// Animatable - This property can be animated using <c>Animation</c> class.
397 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
399 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
401 /// Animatable sub-property : Offset.
404 [EditorBrowsable(EditorBrowsableState.Never)]
405 public ImageShadow ImageShadow
409 return (ImageShadow)GetValue(ImageShadowProperty);
413 SetValue(ImageShadowProperty, value);
414 NotifyPropertyChanged();
419 /// Describes a box shaped shadow drawing for a View.
420 /// It is null by default.
423 /// The mutually exclusive with "ImageShadow".
427 /// Animatable - This property can be animated using <c>Animation</c> class.
428 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
430 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
432 /// Animatable sub-property : Offset, Color, BlurRadius.
435 /// <since_tizen> 9 </since_tizen>
436 public Shadow BoxShadow
440 return (Shadow)GetValue(BoxShadowProperty);
444 SetValue(BoxShadowProperty, value);
445 NotifyPropertyChanged();
450 /// The radius for the rounded corners of the View.
451 /// This will rounds background and shadow edges.
452 /// 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).
453 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
457 /// Animatable - This property can be animated using <c>Animation</c> class.
460 /// <since_tizen> 9 </since_tizen>
461 public Vector4 CornerRadius
465 return (Vector4)GetValue(CornerRadiusProperty);
469 SetValue(CornerRadiusProperty, value);
470 NotifyPropertyChanged();
476 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
477 /// It is absolute by default.
478 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
480 /// <since_tizen> 9 </since_tizen>
481 public VisualTransformPolicyType CornerRadiusPolicy
483 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
484 set => SetValue(CornerRadiusPolicyProperty, value);
488 /// The current state of the view.
490 /// <since_tizen> 3 </since_tizen>
495 return (States)GetValue(StateProperty);
499 SetValue(StateProperty, value);
500 NotifyPropertyChanged();
505 /// The current sub state of the view.
507 /// <since_tizen> 3 </since_tizen>
508 public States SubState
512 return (States)GetValue(SubStateProperty);
516 SetValue(SubStateProperty, value);
517 NotifyPropertyChanged();
522 /// Displays a tooltip
524 /// <since_tizen> 3 </since_tizen>
525 public Tizen.NUI.PropertyMap Tooltip
529 return (PropertyMap)GetValue(TooltipProperty);
533 SetValue(TooltipProperty, value);
534 NotifyPropertyChanged();
539 /// Displays a tooltip as a text.
541 /// <since_tizen> 3 </since_tizen>
542 public string TooltipText
546 using (var propertyValue = GetProperty(Property.TOOLTIP))
548 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
550 return retrivedValue;
552 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
553 return "error to get TooltipText";
558 var temp = new Tizen.NUI.PropertyValue(value);
559 SetProperty(View.Property.TOOLTIP, temp);
561 NotifyPropertyChanged();
566 /// The Child property of FlexContainer.<br />
567 /// The proportion of the free space in the container, the flex item will receive.<br />
568 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
570 /// <since_tizen> 3 </since_tizen>
571 [Obsolete("Deprecated in API8, will be removed in API10.")]
576 return (float)GetValue(FlexProperty);
580 SetValue(FlexProperty, value);
581 NotifyPropertyChanged();
586 /// The Child property of FlexContainer.<br />
587 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
589 /// <since_tizen> 3 </since_tizen>
590 [Obsolete("Deprecated in API8, will be removed in API10.")]
595 return (int)GetValue(AlignSelfProperty);
599 SetValue(AlignSelfProperty, value);
600 NotifyPropertyChanged();
605 /// The Child property of FlexContainer.<br />
606 /// The space around the flex item.<br />
609 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
611 /// <since_tizen> 3 </since_tizen>
612 [Obsolete("Deprecated in API8, will be removed in API10.")]
613 public Vector4 FlexMargin
617 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
618 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
622 SetValue(FlexMarginProperty, value);
623 NotifyPropertyChanged();
628 /// The top-left cell this child occupies, if not set, the first available cell is used.
631 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
632 /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
634 /// <since_tizen> 3 </since_tizen>
635 public Vector2 CellIndex
639 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
640 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
644 SetValue(CellIndexProperty, value);
645 NotifyPropertyChanged();
650 /// The number of rows this child occupies, if not set, the default value is 1.
653 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
655 /// <since_tizen> 3 </since_tizen>
660 return (float)GetValue(RowSpanProperty);
664 SetValue(RowSpanProperty, value);
665 NotifyPropertyChanged();
670 /// The number of columns this child occupies, if not set, the default value is 1.
673 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
675 /// <since_tizen> 3 </since_tizen>
676 public float ColumnSpan
680 return (float)GetValue(ColumnSpanProperty);
684 SetValue(ColumnSpanProperty, value);
685 NotifyPropertyChanged();
690 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
693 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
695 /// <since_tizen> 3 </since_tizen>
696 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
700 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
704 SetValue(CellHorizontalAlignmentProperty, value);
705 NotifyPropertyChanged();
710 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
713 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
715 /// <since_tizen> 3 </since_tizen>
716 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
720 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
724 SetValue(CellVerticalAlignmentProperty, value);
725 NotifyPropertyChanged();
730 /// The left focusable view.<br />
731 /// This will return null if not set.<br />
732 /// This will also return null if the specified left focusable view is not on a window.<br />
734 /// <since_tizen> 3 </since_tizen>
735 public View LeftFocusableView
737 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
740 return (View)GetValue(LeftFocusableViewProperty);
744 SetValue(LeftFocusableViewProperty, value);
745 NotifyPropertyChanged();
750 /// The right focusable view.<br />
751 /// This will return null if not set.<br />
752 /// This will also return null if the specified right focusable view is not on a window.<br />
754 /// <since_tizen> 3 </since_tizen>
755 public View RightFocusableView
757 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
760 return (View)GetValue(RightFocusableViewProperty);
764 SetValue(RightFocusableViewProperty, value);
765 NotifyPropertyChanged();
770 /// The up focusable view.<br />
771 /// This will return null if not set.<br />
772 /// This will also return null if the specified up focusable view is not on a window.<br />
774 /// <since_tizen> 3 </since_tizen>
775 public View UpFocusableView
777 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
780 return (View)GetValue(UpFocusableViewProperty);
784 SetValue(UpFocusableViewProperty, value);
785 NotifyPropertyChanged();
790 /// The down focusable view.<br />
791 /// This will return null if not set.<br />
792 /// This will also return null if the specified down focusable view is not on a window.<br />
794 /// <since_tizen> 3 </since_tizen>
795 public View DownFocusableView
797 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
800 return (View)GetValue(DownFocusableViewProperty);
804 SetValue(DownFocusableViewProperty, value);
805 NotifyPropertyChanged();
810 /// Whether the view should be focusable by keyboard navigation.
812 /// <since_tizen> 3 </since_tizen>
813 public bool Focusable
817 SetValue(FocusableProperty, value);
818 NotifyPropertyChanged();
822 return (bool)GetValue(FocusableProperty);
827 /// Retrieves the position of the view.<br />
828 /// The coordinates are relative to the view's parent.<br />
830 /// <since_tizen> 3 </since_tizen>
831 public Position CurrentPosition
835 return GetCurrentPosition();
840 /// Sets the size of a view for the width and the height.<br />
841 /// Geometry can be scaled to fit within this area.<br />
842 /// This does not interfere with the view's scale factor.<br />
843 /// The views default depth is the minimum of width and height.<br />
846 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
847 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
849 /// <since_tizen> 3 </since_tizen>
854 Size2D temp = (Size2D)GetValue(Size2DProperty);
855 int width = temp.Width;
856 int height = temp.Height;
858 if (this.Layout == null)
860 if (width < 0) { width = 0; }
861 if (height < 0) { height = 0; }
864 return new Size2D(OnSize2DChanged, width, height);
868 SetValue(Size2DProperty, value);
870 NotifyPropertyChanged();
875 /// Retrieves the size of the view.<br />
876 /// The coordinates are relative to the view's parent.<br />
878 /// <since_tizen> 3 </since_tizen>
879 public Size2D CurrentSize
883 return GetCurrentSize();
888 /// Retrieves and sets the view's opacity.<br />
890 /// <since_tizen> 3 </since_tizen>
895 return (float)GetValue(OpacityProperty);
899 SetValue(OpacityProperty, value);
900 NotifyPropertyChanged();
905 /// Sets the position of the view for X and Y.<br />
906 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
907 /// If the position inheritance is disabled, sets the world position.<br />
910 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
911 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
913 /// <since_tizen> 3 </since_tizen>
914 public Position2D Position2D
918 Position2D temp = (Position2D)GetValue(Position2DProperty);
919 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
923 SetValue(Position2DProperty, value);
924 NotifyPropertyChanged();
929 /// Retrieves the screen position of the view.<br />
931 /// <since_tizen> 3 </since_tizen>
932 public Vector2 ScreenPosition
936 Vector2 temp = new Vector2(0.0f, 0.0f);
937 var pValue = GetProperty(View.Property.ScreenPosition);
945 /// Determines whether the pivot point should be used to determine the position of the view.
946 /// This is false by default.
948 /// <remarks>If false, then the top-left of the view is used for the position.
949 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
951 /// <since_tizen> 3 </since_tizen>
952 public bool PositionUsesPivotPoint
956 return (bool)GetValue(PositionUsesPivotPointProperty);
960 SetValue(PositionUsesPivotPointProperty, value);
961 NotifyPropertyChanged();
966 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
968 /// <since_tizen> 3 </since_tizen>
969 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
971 "View view = new View(); " +
972 "view.PivotPoint = PivotPoint.Center; " +
973 "view.PositionUsesPivotPoint = true;" +
974 " Deprecated in API5: Will be removed in API8")]
975 [EditorBrowsable(EditorBrowsableState.Never)]
976 public bool PositionUsesAnchorPoint
981 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
982 pValue.Get(out temp);
988 var temp = new Tizen.NUI.PropertyValue(value);
989 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
991 NotifyPropertyChanged();
996 /// Queries whether the view is connected to the stage.<br />
997 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
999 /// <since_tizen> 3 </since_tizen>
1000 public bool IsOnWindow
1009 /// Gets the depth in the hierarchy for the view.
1011 /// <since_tizen> 3 </since_tizen>
1012 public int HierarchyDepth
1016 return GetHierarchyDepth();
1021 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1024 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1025 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1026 /// The values set by this property will likely change.
1028 /// <since_tizen> 3 </since_tizen>
1029 public int SiblingOrder
1033 return (int)GetValue(SiblingOrderProperty);
1037 SetValue(SiblingOrderProperty, value);
1039 LayoutGroup layout = Layout as LayoutGroup;
1040 layout?.ChangeLayoutSiblingOrder(value);
1042 NotifyPropertyChanged();
1047 /// Returns the natural size of the view.
1050 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1052 /// <since_tizen> 5 </since_tizen>
1053 public Vector3 NaturalSize
1057 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1058 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1064 /// Returns the natural size (Size2D) of the view.
1067 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1069 /// <since_tizen> 4 </since_tizen>
1070 public Size2D NaturalSize2D
1074 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1075 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1077 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1084 /// Gets or sets the origin of a view within its parent's area.<br />
1085 /// 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 />
1086 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1087 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1089 /// <pre>The view has been initialized.</pre>
1090 /// <since_tizen> 3 </since_tizen>
1091 public Position ParentOrigin
1095 Position tmp = (Position)GetValue(ParentOriginProperty);
1096 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1100 SetValue(ParentOriginProperty, value);
1101 NotifyPropertyChanged();
1106 /// Gets or sets the anchor-point of a view.<br />
1107 /// 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 />
1108 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1109 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1110 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1111 /// <pre>The view has been initialized.</pre>
1114 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1116 /// <since_tizen> 3 </since_tizen>
1117 public Position PivotPoint
1121 Position tmp = (Position)GetValue(PivotPointProperty);
1122 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1126 SetValue(PivotPointProperty, value);
1127 NotifyPropertyChanged();
1132 /// Gets or sets the size width of the view.
1136 /// Animatable - This property can be animated using <c>Animation</c> class.
1139 /// <since_tizen> 3 </since_tizen>
1140 public float SizeWidth
1144 return (float)GetValue(SizeWidthProperty);
1148 SetValue(SizeWidthProperty, value);
1149 NotifyPropertyChanged();
1154 /// Gets or sets the size height of the view.
1158 /// Animatable - This property can be animated using <c>Animation</c> class.
1161 /// <since_tizen> 3 </since_tizen>
1162 public float SizeHeight
1166 return (float)GetValue(SizeHeightProperty);
1170 SetValue(SizeHeightProperty, value);
1171 NotifyPropertyChanged();
1176 /// Gets or sets the position of the view.<br />
1177 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1178 /// If the position inheritance is disabled, sets the world position.<br />
1182 /// Animatable - This property can be animated using <c>Animation</c> class.
1184 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1186 /// <since_tizen> 3 </since_tizen>
1187 public Position Position
1191 Position tmp = (Position)GetValue(PositionProperty);
1192 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1196 SetValue(PositionProperty, value);
1197 NotifyPropertyChanged();
1202 /// Gets or sets the position X of the view.
1206 /// Animatable - This property can be animated using <c>Animation</c> class.
1209 /// <since_tizen> 3 </since_tizen>
1210 public float PositionX
1214 return (float)GetValue(PositionXProperty);
1218 SetValue(PositionXProperty, value);
1219 NotifyPropertyChanged();
1224 /// Gets or sets the position Y of the view.
1228 /// Animatable - This property can be animated using <c>Animation</c> class.
1231 /// <since_tizen> 3 </since_tizen>
1232 public float PositionY
1236 return (float)GetValue(PositionYProperty);
1240 SetValue(PositionYProperty, value);
1241 NotifyPropertyChanged();
1246 /// Gets or sets the position Z of the view.
1250 /// Animatable - This property can be animated using <c>Animation</c> class.
1253 /// <since_tizen> 3 </since_tizen>
1254 public float PositionZ
1258 return (float)GetValue(PositionZProperty);
1262 SetValue(PositionZProperty, value);
1263 NotifyPropertyChanged();
1268 /// Gets or sets the world position of the view.
1270 /// <since_tizen> 3 </since_tizen>
1271 public Vector3 WorldPosition
1275 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1276 var pValue = GetProperty(View.Property.WorldPosition);
1284 /// Gets or sets the orientation of the view.<br />
1285 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1289 /// This is an asynchronous method.
1292 /// Animatable - This property can be animated using <c>Animation</c> class.
1295 /// <since_tizen> 3 </since_tizen>
1296 public Rotation Orientation
1300 return (Rotation)GetValue(OrientationProperty);
1304 SetValue(OrientationProperty, value);
1305 NotifyPropertyChanged();
1310 /// Gets or sets the world orientation of the view.<br />
1312 /// <since_tizen> 3 </since_tizen>
1313 public Rotation WorldOrientation
1317 Rotation temp = new Rotation();
1318 var pValue = GetProperty(View.Property.WorldOrientation);
1326 /// Gets or sets the scale factor applied to the view.<br />
1330 /// Animatable - This property can be animated using <c>Animation</c> class.
1332 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1334 /// <since_tizen> 3 </since_tizen>
1335 public Vector3 Scale
1339 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1340 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1344 SetValue(ScaleProperty, value);
1345 NotifyPropertyChanged();
1350 /// Gets or sets the scale X factor applied to the view.
1354 /// Animatable - This property can be animated using <c>Animation</c> class.
1357 /// <since_tizen> 3 </since_tizen>
1362 return (float)GetValue(ScaleXProperty);
1366 SetValue(ScaleXProperty, value);
1367 NotifyPropertyChanged();
1372 /// Gets or sets the scale Y factor applied to the view.
1376 /// Animatable - This property can be animated using <c>Animation</c> class.
1379 /// <since_tizen> 3 </since_tizen>
1384 return (float)GetValue(ScaleYProperty);
1388 SetValue(ScaleYProperty, value);
1389 NotifyPropertyChanged();
1394 /// Gets or sets the scale Z factor applied to the view.
1398 /// Animatable - This property can be animated using <c>Animation</c> class.
1401 /// <since_tizen> 3 </since_tizen>
1406 return (float)GetValue(ScaleZProperty);
1410 SetValue(ScaleZProperty, value);
1411 NotifyPropertyChanged();
1416 /// Gets the world scale of the view.
1418 /// <since_tizen> 3 </since_tizen>
1419 public Vector3 WorldScale
1423 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1424 var pValue = GetProperty(View.Property.WorldScale);
1432 /// Retrieves the visibility flag of the view.
1436 /// If the view is not visible, then the view and its children will not be rendered.
1437 /// 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.
1440 /// Animatable - This property can be animated using <c>Animation</c> class.
1443 /// <since_tizen> 3 </since_tizen>
1444 public bool Visibility
1449 var pValue = GetProperty(View.Property.VISIBLE);
1450 pValue.Get(out temp);
1457 /// Gets the view's world color.
1459 /// <since_tizen> 3 </since_tizen>
1460 public Vector4 WorldColor
1464 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1465 var pValue = GetProperty(View.Property.WorldColor);
1473 /// Gets or sets the view's name.
1475 /// <since_tizen> 3 </since_tizen>
1480 return (string)GetValue(NameProperty);
1484 SetValue(NameProperty, value);
1485 NotifyPropertyChanged();
1490 /// Get the number of children held by the view.
1492 /// <since_tizen> 3 </since_tizen>
1493 public new uint ChildCount
1497 return Convert.ToUInt32(Children.Count);
1502 /// Gets the view's ID.
1505 /// <since_tizen> 3 </since_tizen>
1515 /// Gets or sets the status of whether the view should emit touch or hover signals.
1517 /// <since_tizen> 3 </since_tizen>
1518 public bool Sensitive
1522 return (bool)GetValue(SensitiveProperty);
1526 SetValue(SensitiveProperty, value);
1527 NotifyPropertyChanged();
1532 /// 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.
1534 /// <since_tizen> 3 </since_tizen>
1535 public bool LeaveRequired
1539 return (bool)GetValue(LeaveRequiredProperty);
1543 SetValue(LeaveRequiredProperty, value);
1544 NotifyPropertyChanged();
1549 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1551 /// <since_tizen> 3 </since_tizen>
1552 public bool InheritOrientation
1556 return (bool)GetValue(InheritOrientationProperty);
1560 SetValue(InheritOrientationProperty, value);
1561 NotifyPropertyChanged();
1566 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1568 /// <since_tizen> 3 </since_tizen>
1569 public bool InheritScale
1573 return (bool)GetValue(InheritScaleProperty);
1577 SetValue(InheritScaleProperty, value);
1578 NotifyPropertyChanged();
1583 /// Gets or sets the status of how the view and its children should be drawn.<br />
1584 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1585 /// 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 />
1586 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1587 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1588 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1590 /// <since_tizen> 3 </since_tizen>
1591 public DrawModeType DrawMode
1595 return (DrawModeType)GetValue(DrawModeProperty);
1599 SetValue(DrawModeProperty, value);
1600 NotifyPropertyChanged();
1605 /// Gets or sets the relative to parent size factor of the view.<br />
1606 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1607 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1610 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1612 /// <since_tizen> 3 </since_tizen>
1613 public Vector3 SizeModeFactor
1617 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1618 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1622 SetValue(SizeModeFactorProperty, value);
1623 NotifyPropertyChanged();
1628 /// Gets or sets the width resize policy to be used.
1630 /// <since_tizen> 3 </since_tizen>
1631 public ResizePolicyType WidthResizePolicy
1635 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1639 SetValue(WidthResizePolicyProperty, value);
1640 NotifyPropertyChanged();
1645 /// Gets or sets the height resize policy to be used.
1647 /// <since_tizen> 3 </since_tizen>
1648 public ResizePolicyType HeightResizePolicy
1652 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1656 SetValue(HeightResizePolicyProperty, value);
1657 NotifyPropertyChanged();
1662 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1663 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1665 /// <since_tizen> 3 </since_tizen>
1666 public SizeScalePolicyType SizeScalePolicy
1670 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1674 SetValue(SizeScalePolicyProperty, value);
1675 NotifyPropertyChanged();
1680 /// Gets or sets the status of whether the width size is dependent on the height size.
1682 /// <since_tizen> 3 </since_tizen>
1683 public bool WidthForHeight
1687 return (bool)GetValue(WidthForHeightProperty);
1691 SetValue(WidthForHeightProperty, value);
1692 NotifyPropertyChanged();
1697 /// Gets or sets the status of whether the height size is dependent on the width size.
1699 /// <since_tizen> 3 </since_tizen>
1700 public bool HeightForWidth
1704 return (bool)GetValue(HeightForWidthProperty);
1708 SetValue(HeightForWidthProperty, value);
1709 NotifyPropertyChanged();
1714 /// Gets or sets the padding for use in layout.
1717 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1719 /// <since_tizen> 5 </since_tizen>
1720 public Extents Padding
1724 // If View has a Layout then padding in stored in the base Layout class
1727 return Layout.Padding;
1731 Extents temp = (Extents)GetValue(PaddingProperty);
1732 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1734 // Two return points to prevent creating a zeroed Extent native object before assignment
1738 Extents padding = value;
1741 // Layout set so store Padding in LayoutItem instead of in View.
1742 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1743 // the position and sizes measure in the Layouting.
1744 Layout.Padding = value;
1745 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1746 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1747 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1749 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1753 SetValue(PaddingProperty, padding);
1754 NotifyPropertyChanged();
1759 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1761 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1763 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1765 /// <since_tizen> 3 </since_tizen>
1766 public Size2D MinimumSize
1770 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1771 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1777 throw new ArgumentNullException(nameof(value));
1781 // Note: it only works if minimum size is >= than natural size.
1782 // To force the size it should be done through the width&height spec or Size2D.
1783 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1784 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1785 layout.RequestLayout();
1787 SetValue(MinimumSizeProperty, value);
1788 NotifyPropertyChanged();
1793 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1796 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1798 /// <since_tizen> 3 </since_tizen>
1799 public Size2D MaximumSize
1803 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1804 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1808 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1809 // MATCH_PARENT spec + parent container size can be used to limit
1812 layout.RequestLayout();
1814 SetValue(MaximumSizeProperty, value);
1815 NotifyPropertyChanged();
1820 /// Gets or sets whether a child view inherits it's parent's position.<br />
1821 /// Default is to inherit.<br />
1822 /// 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 />
1824 /// <since_tizen> 3 </since_tizen>
1825 public bool InheritPosition
1829 return (bool)GetValue(InheritPositionProperty);
1833 SetValue(InheritPositionProperty, value);
1834 NotifyPropertyChanged();
1839 /// Gets or sets the clipping behavior (mode) of it's children.
1841 /// <since_tizen> 3 </since_tizen>
1842 public ClippingModeType ClippingMode
1846 return (ClippingModeType)GetValue(ClippingModeProperty);
1850 SetValue(ClippingModeProperty, value);
1851 NotifyPropertyChanged();
1856 /// Gets the number of renderers held by the view.
1858 /// <since_tizen> 3 </since_tizen>
1859 public uint RendererCount
1863 return GetRendererCount();
1868 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1871 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1873 /// <since_tizen> 3 </since_tizen>
1874 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1876 "View view = new View(); " +
1877 "view.PivotPoint = PivotPoint.Center; " +
1878 "view.PositionUsesPivotPoint = true;")]
1879 [EditorBrowsable(EditorBrowsableState.Never)]
1880 public Position AnchorPoint
1884 Position temp = new Position(0.0f, 0.0f, 0.0f);
1885 var pValue = GetProperty(View.Property.AnchorPoint);
1888 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1894 var temp = new Tizen.NUI.PropertyValue(value);
1895 SetProperty(View.Property.AnchorPoint, temp);
1897 NotifyPropertyChanged();
1902 /// Sets the size of a view for the width, the height and the depth.<br />
1903 /// Geometry can be scaled to fit within this area.<br />
1904 /// This does not interfere with the view's scale factor.<br />
1905 /// The views default depth is the minimum of width and height.<br />
1909 /// Animatable - This property can be animated using <c>Animation</c> class.
1911 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1913 /// <since_tizen> 5 </since_tizen>
1918 Size tmp = (Size)GetValue(SizeProperty);
1919 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1923 SetValue(SizeProperty, value);
1924 NotifyPropertyChanged();
1929 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1931 /// <since_tizen> 3 </since_tizen>
1932 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1934 "Container parent = view.GetParent(); " +
1935 "View view = parent as View;")]
1936 [EditorBrowsable(EditorBrowsableState.Never)]
1937 public new View Parent
1942 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
1943 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1944 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1946 if (basehandle is Layer layer)
1948 ret = new View(Layer.getCPtr(layer).Handle, false);
1949 NUILog.Error("This Parent property is deprecated, should do not be used");
1953 ret = basehandle as View;
1956 Interop.BaseHandle.DeleteBaseHandle(CPtr);
1957 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1959 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1965 /// Gets/Sets whether inherit parent's the layout Direction.
1967 /// <since_tizen> 4 </since_tizen>
1968 public bool InheritLayoutDirection
1972 return (bool)GetValue(InheritLayoutDirectionProperty);
1976 SetValue(InheritLayoutDirectionProperty, value);
1977 NotifyPropertyChanged();
1982 /// Gets/Sets the layout Direction.
1984 /// <since_tizen> 4 </since_tizen>
1985 public ViewLayoutDirectionType LayoutDirection
1989 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1993 SetValue(LayoutDirectionProperty, value);
1994 NotifyPropertyChanged();
1995 layout?.RequestLayout();
2000 /// Gets or sets the Margin for use in layout.
2003 /// Margin property is supported by Layout algorithms and containers.
2004 /// Please Set Layout if you want to use Margin property.
2005 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2007 /// <since_tizen> 4 </since_tizen>
2008 public Extents Margin
2012 // If View has a Layout then margin is stored in Layout.
2015 return Layout.Margin;
2019 // If Layout not set then return margin stored in View.
2020 Extents temp = (Extents)GetValue(MarginProperty);
2021 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2023 // Two return points to prevent creating a zeroed Extent native object before assignment
2029 // Layout set so store Margin in LayoutItem instead of View.
2030 // If View stores the Margin too then the Legacy Size Negotiation will
2031 // overwrite the position and size values measured in the Layouting.
2032 Layout.Margin = value;
2033 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2034 layout?.RequestLayout();
2038 SetValue(MarginProperty, value);
2040 NotifyPropertyChanged();
2041 layout?.RequestLayout();
2046 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2050 /// // matchParentView matches its size to its parent size.
2051 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2052 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2054 /// // wrapContentView wraps its children with their desired size.
2055 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2056 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2058 /// // exactSizeView shows itself with an exact size.
2059 /// exactSizeView.WidthSpecification = 100;
2060 /// exactSizeView.HeightSpecification = 100;
2063 /// <since_tizen> 6 </since_tizen>
2064 public int WidthSpecification
2072 if (value == widthPolicy)
2075 widthPolicy = value;
2076 if (widthPolicy >= 0)
2078 if (heightPolicy >= 0) // Policy an exact value
2080 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2081 Size2D = new Size2D(widthPolicy, heightPolicy);
2084 layout?.RequestLayout();
2089 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2093 /// // matchParentView matches its size to its parent size.
2094 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2095 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2097 /// // wrapContentView wraps its children with their desired size.
2098 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2099 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2101 /// // exactSizeView shows itself with an exact size.
2102 /// exactSizeView.WidthSpecification = 100;
2103 /// exactSizeView.HeightSpecification = 100;
2106 /// <since_tizen> 6 </since_tizen>
2107 public int HeightSpecification
2111 return heightPolicy;
2115 if (value == heightPolicy)
2118 heightPolicy = value;
2119 if (heightPolicy >= 0)
2121 if (widthPolicy >= 0) // Policy an exact value
2123 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2124 Size2D = new Size2D(widthPolicy, heightPolicy);
2127 layout?.RequestLayout();
2132 /// Gets the List of transitions for this View.
2134 /// <since_tizen> 6 </since_tizen>
2135 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2139 if (layoutTransitions == null)
2141 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2143 return layoutTransitions;
2148 /// Sets a layout transitions for this View.
2150 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2152 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2154 /// <since_tizen> 6 </since_tizen>
2155 public LayoutTransition LayoutTransition
2159 return layoutTransition;
2165 throw new global::System.ArgumentNullException(nameof(value));
2167 if (layoutTransitions == null)
2169 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2172 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2174 AttachTransitionsToChildren(value);
2176 layoutTransition = value;
2181 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2184 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2186 /// <since_tizen> 4 </since_tizen>
2187 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2188 [EditorBrowsable(EditorBrowsableState.Never)]
2189 public Extents PaddingEX
2193 Extents temp = new Extents(0, 0, 0, 0);
2194 var pValue = GetProperty(View.Property.PADDING);
2197 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2203 var temp = new Tizen.NUI.PropertyValue(value);
2204 SetProperty(View.Property.PADDING, temp);
2206 NotifyPropertyChanged();
2207 layout?.RequestLayout();
2212 /// The Color of View. This is an RGBA value.
2216 /// Animatable - This property can be animated using <c>Animation</c> class.
2218 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2220 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2221 [EditorBrowsable(EditorBrowsableState.Never)]
2226 Color temp = (Color)GetValue(ColorProperty);
2227 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2231 SetValue(ColorProperty, value);
2232 NotifyPropertyChanged();
2237 /// Set the layout on this View. Replaces any existing Layout.
2240 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2242 /// <since_tizen> 6 </since_tizen>
2243 public LayoutItem Layout
2251 // Do nothing if layout provided is already set on this View.
2252 if (value == layout)
2257 LayoutingDisabled = false;
2260 // If new layout being set already has a owner then that owner receives a replacement default layout.
2261 // First check if the layout to be set already has a owner.
2262 if (value?.Owner != null)
2264 // Previous owner of the layout gets a default layout as a replacement.
2265 value.Owner.Layout = new AbsoluteLayout();
2267 // Copy Margin and Padding to replacement LayoutGroup.
2268 if (value.Owner.Layout != null)
2270 value.Owner.Layout.Margin = value.Margin;
2271 value.Owner.Layout.Padding = value.Padding;
2275 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2276 // View if no replacement. Previously margin and padding values would have been moved from
2277 // the View to the layout.
2278 if (layout != null) // Existing layout
2282 // Existing layout being replaced so copy over margin and padding values.
2283 value.Margin = layout.Margin;
2284 value.Padding = layout.Padding;
2288 // Layout not being replaced so restore margin and padding to View.
2289 SetValue(MarginProperty, layout.Margin);
2290 SetValue(PaddingProperty, layout.Padding);
2291 NotifyPropertyChanged();
2296 // First Layout to be added to the View hence copy
2298 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2301 Extents margin = Margin;
2302 Extents padding = Padding;
2303 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2305 // If View already has a margin set then store it in Layout instead.
2306 value.Margin = margin;
2307 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2308 NotifyPropertyChanged();
2311 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2313 // If View already has a padding set then store it in Layout instead.
2314 value.Padding = padding;
2316 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2317 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2318 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2320 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2321 NotifyPropertyChanged();
2327 // Remove existing layout from it's parent layout group.
2330 value.SetPositionByLayout = !excludeLayouting;
2332 // Set layout to this view
2338 /// The weight of the View, used to share available space in a layout with siblings.
2340 /// <since_tizen> 6 </since_tizen>
2350 layout?.RequestLayout();
2355 /// Whether to load the BackgroundImage synchronously.
2356 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2357 /// Note: For Normal Quad images only.
2359 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2360 [EditorBrowsable(EditorBrowsableState.Never)]
2361 public bool BackgroundImageSynchronosLoading
2365 return backgroundImageSynchronosLoading;
2369 backgroundImageSynchronosLoading = value;
2371 string bgUrl = null;
2372 var pValue = Background.Find(ImageVisualProperty.URL);
2373 pValue?.Get(out bgUrl);
2376 if (!string.IsNullOrEmpty(bgUrl))
2378 PropertyMap bgMap = this.Background;
2379 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2380 bgMap.Add("synchronousLoading", temp);
2387 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2388 [EditorBrowsable(EditorBrowsableState.Never)]
2389 public Vector2 UpdateSizeHint
2393 return (Vector2)GetValue(UpdateSizeHintProperty);
2397 SetValue(UpdateSizeHintProperty, value);
2398 NotifyPropertyChanged();
2403 /// Enable/Disable ControlState propagation for children.
2404 /// It is false by default.
2405 /// If the View needs to share ControlState with descendants, please set it true.
2406 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2408 [EditorBrowsable(EditorBrowsableState.Never)]
2409 public bool EnableControlStatePropagation
2411 get => themeData?.controlStatePropagation ?? false;
2414 if (EnableControlStatePropagation == value) return;
2416 if (themeData == null) themeData = new ThemeData();
2418 themeData.controlStatePropagation = value;
2420 foreach (View child in Children)
2422 child.EnableControlStatePropagation = value;
2428 /// By default, it is false in View, true in Control.
2429 /// Note that if the value is true, the View will be a touch receptor.
2431 [EditorBrowsable(EditorBrowsableState.Never)]
2432 public bool EnableControlState
2436 return (bool)GetValue(EnableControlStateProperty);
2440 SetValue(EnableControlStateProperty, value);
2445 /// Whether the actor grab all touches even if touch leaves its boundary.
2447 /// <returns>true, if it grab all touch after start</returns>
2448 [EditorBrowsable(EditorBrowsableState.Never)]
2449 public bool GrabTouchAfterLeave
2454 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2455 pValue.Get(out temp);
2461 var temp = new Tizen.NUI.PropertyValue(value);
2462 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2464 NotifyPropertyChanged();
2469 /// Determines which blend equation will be used to render renderers of this actor.
2471 /// <returns>blend equation enum currently assigned</returns>
2472 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2473 [EditorBrowsable(EditorBrowsableState.Never)]
2474 public BlendEquationType BlendEquation
2479 var pValue = GetProperty(View.Property.BlendEquation);
2480 pValue.Get(out temp);
2482 return (BlendEquationType)temp;
2486 var temp = new Tizen.NUI.PropertyValue((int)value);
2487 SetProperty(View.Property.BlendEquation, temp);
2489 NotifyPropertyChanged();
2494 /// If the value is true, the View will change its style as the theme changes.
2495 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2497 /// <since_tizen> 9 </since_tizen>
2498 public bool ThemeChangeSensitive
2500 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2501 set => SetValue(ThemeChangeSensitiveProperty, value);
2505 /// Create Style, it is abstract function and must be override.
2507 [EditorBrowsable(EditorBrowsableState.Never)]
2508 protected virtual ViewStyle CreateViewStyle()
2510 return new ViewStyle();
2514 /// Called after the View's ControlStates changed.
2516 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2517 [EditorBrowsable(EditorBrowsableState.Never)]
2518 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2524 [EditorBrowsable(EditorBrowsableState.Never)]
2525 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2531 /// Apply style instance to the view.
2532 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2534 /// <since_tizen> 9 </since_tizen>
2535 public virtual void ApplyStyle(ViewStyle viewStyle)
2537 if (viewStyle == null || themeData?.viewStyle == viewStyle) return;
2539 if (themeData == null) themeData = new ThemeData();
2541 themeData.viewStyle = viewStyle;
2543 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2549 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2551 if (bindablePropertyOfView == null)
2556 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2557 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2559 foreach (var sourceProperty in dirtyStyleProperties)
2561 var sourceValue = viewStyle.GetValue(sourceProperty);
2563 if (sourceValue == null)
2568 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2570 if (destinationProperty != null)
2572 SetValue(destinationProperty, sourceValue);
2578 /// Get whether the View is culled or not.
2579 /// True means that the View is out of the view frustum.
2582 /// Hidden-API (Inhouse-API).
2584 [EditorBrowsable(EditorBrowsableState.Never)]
2590 var pValue = GetProperty(View.Property.Culled);
2591 pValue.Get(out temp);
2598 /// Set or Get TransitionOptions for the page transition.
2599 /// This property is used to define how this view will be transitioned during Page switching.
2601 /// <since_tizen> 9 </since_tizen>
2602 public TransitionOptions TransitionOptions
2606 transitionOptions = value;
2610 return transitionOptions;