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();
475 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
476 /// It is absolute by default.
477 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
479 /// <since_tizen> 9 </since_tizen>
480 public VisualTransformPolicyType CornerRadiusPolicy
482 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
483 set => SetValue(CornerRadiusPolicyProperty, value);
487 /// The current state of the view.
489 /// <since_tizen> 3 </since_tizen>
494 return (States)GetValue(StateProperty);
498 SetValue(StateProperty, value);
499 NotifyPropertyChanged();
504 /// The current sub state of the view.
506 /// <since_tizen> 3 </since_tizen>
507 public States SubState
511 return (States)GetValue(SubStateProperty);
515 SetValue(SubStateProperty, value);
516 NotifyPropertyChanged();
521 /// Displays a tooltip
523 /// <since_tizen> 3 </since_tizen>
524 public Tizen.NUI.PropertyMap Tooltip
528 return (PropertyMap)GetValue(TooltipProperty);
532 SetValue(TooltipProperty, value);
533 NotifyPropertyChanged();
538 /// Displays a tooltip as a text.
540 /// <since_tizen> 3 </since_tizen>
541 public string TooltipText
545 using (var propertyValue = GetProperty(Property.TOOLTIP))
547 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
549 return retrivedValue;
551 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
552 return "error to get TooltipText";
557 var temp = new Tizen.NUI.PropertyValue(value);
558 SetProperty(View.Property.TOOLTIP, temp);
560 NotifyPropertyChanged();
565 /// The Child property of FlexContainer.<br />
566 /// The proportion of the free space in the container, the flex item will receive.<br />
567 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
569 /// <since_tizen> 3 </since_tizen>
570 [Obsolete("Deprecated in API8, will be removed in API10.")]
575 return (float)GetValue(FlexProperty);
579 SetValue(FlexProperty, value);
580 NotifyPropertyChanged();
585 /// The Child property of FlexContainer.<br />
586 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
588 /// <since_tizen> 3 </since_tizen>
589 [Obsolete("Deprecated in API8, will be removed in API10.")]
594 return (int)GetValue(AlignSelfProperty);
598 SetValue(AlignSelfProperty, value);
599 NotifyPropertyChanged();
604 /// The Child property of FlexContainer.<br />
605 /// The space around the flex item.<br />
608 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
610 /// <since_tizen> 3 </since_tizen>
611 [Obsolete("Deprecated in API8, will be removed in API10.")]
612 public Vector4 FlexMargin
616 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
617 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
621 SetValue(FlexMarginProperty, value);
622 NotifyPropertyChanged();
627 /// The top-left cell this child occupies, if not set, the first available cell is used.
630 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
631 /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
633 /// <since_tizen> 3 </since_tizen>
634 public Vector2 CellIndex
638 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
639 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
643 SetValue(CellIndexProperty, value);
644 NotifyPropertyChanged();
649 /// The number of rows this child occupies, if not set, the default value is 1.
652 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
654 /// <since_tizen> 3 </since_tizen>
659 return (float)GetValue(RowSpanProperty);
663 SetValue(RowSpanProperty, value);
664 NotifyPropertyChanged();
669 /// The number of columns this child occupies, if not set, the default value is 1.
672 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
674 /// <since_tizen> 3 </since_tizen>
675 public float ColumnSpan
679 return (float)GetValue(ColumnSpanProperty);
683 SetValue(ColumnSpanProperty, value);
684 NotifyPropertyChanged();
689 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
692 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
694 /// <since_tizen> 3 </since_tizen>
695 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
699 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
703 SetValue(CellHorizontalAlignmentProperty, value);
704 NotifyPropertyChanged();
709 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
712 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
714 /// <since_tizen> 3 </since_tizen>
715 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
719 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
723 SetValue(CellVerticalAlignmentProperty, value);
724 NotifyPropertyChanged();
729 /// The left focusable view.<br />
730 /// This will return null if not set.<br />
731 /// This will also return null if the specified left focusable view is not on a window.<br />
733 /// <since_tizen> 3 </since_tizen>
734 public View LeftFocusableView
736 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
739 return (View)GetValue(LeftFocusableViewProperty);
743 SetValue(LeftFocusableViewProperty, value);
744 NotifyPropertyChanged();
749 /// The right focusable view.<br />
750 /// This will return null if not set.<br />
751 /// This will also return null if the specified right focusable view is not on a window.<br />
753 /// <since_tizen> 3 </since_tizen>
754 public View RightFocusableView
756 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
759 return (View)GetValue(RightFocusableViewProperty);
763 SetValue(RightFocusableViewProperty, value);
764 NotifyPropertyChanged();
769 /// The up focusable view.<br />
770 /// This will return null if not set.<br />
771 /// This will also return null if the specified up focusable view is not on a window.<br />
773 /// <since_tizen> 3 </since_tizen>
774 public View UpFocusableView
776 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
779 return (View)GetValue(UpFocusableViewProperty);
783 SetValue(UpFocusableViewProperty, value);
784 NotifyPropertyChanged();
789 /// The down focusable view.<br />
790 /// This will return null if not set.<br />
791 /// This will also return null if the specified down focusable view is not on a window.<br />
793 /// <since_tizen> 3 </since_tizen>
794 public View DownFocusableView
796 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
799 return (View)GetValue(DownFocusableViewProperty);
803 SetValue(DownFocusableViewProperty, value);
804 NotifyPropertyChanged();
809 /// Whether the view should be focusable by keyboard navigation.
811 /// <since_tizen> 3 </since_tizen>
812 public bool Focusable
816 SetValue(FocusableProperty, value);
817 NotifyPropertyChanged();
821 return (bool)GetValue(FocusableProperty);
826 /// Retrieves the position of the view.<br />
827 /// The coordinates are relative to the view's parent.<br />
829 /// <since_tizen> 3 </since_tizen>
830 public Position CurrentPosition
834 return GetCurrentPosition();
839 /// Sets the size of a view for the width and the height.<br />
840 /// Geometry can be scaled to fit within this area.<br />
841 /// This does not interfere with the view's scale factor.<br />
842 /// The views default depth is the minimum of width and height.<br />
845 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
846 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
848 /// <since_tizen> 3 </since_tizen>
853 Size2D temp = (Size2D)GetValue(Size2DProperty);
854 int width = temp.Width;
855 int height = temp.Height;
857 if (this.Layout == null)
859 if (width < 0) { width = 0; }
860 if (height < 0) { height = 0; }
863 return new Size2D(OnSize2DChanged, width, height);
867 SetValue(Size2DProperty, value);
869 NotifyPropertyChanged();
874 /// Retrieves the size of the view.<br />
875 /// The coordinates are relative to the view's parent.<br />
877 /// <since_tizen> 3 </since_tizen>
878 public Size2D CurrentSize
882 return GetCurrentSize();
887 /// Retrieves and sets the view's opacity.<br />
889 /// <since_tizen> 3 </since_tizen>
894 return (float)GetValue(OpacityProperty);
898 SetValue(OpacityProperty, value);
899 NotifyPropertyChanged();
904 /// Sets the position of the view for X and Y.<br />
905 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
906 /// If the position inheritance is disabled, sets the world position.<br />
909 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
910 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
912 /// <since_tizen> 3 </since_tizen>
913 public Position2D Position2D
917 Position2D temp = (Position2D)GetValue(Position2DProperty);
918 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
922 SetValue(Position2DProperty, value);
923 NotifyPropertyChanged();
928 /// Retrieves the screen position of the view.<br />
930 /// <since_tizen> 3 </since_tizen>
931 public Vector2 ScreenPosition
935 Vector2 temp = new Vector2(0.0f, 0.0f);
936 var pValue = GetProperty(View.Property.ScreenPosition);
944 /// Determines whether the pivot point should be used to determine the position of the view.
945 /// This is false by default.
947 /// <remarks>If false, then the top-left of the view is used for the position.
948 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
950 /// <since_tizen> 3 </since_tizen>
951 public bool PositionUsesPivotPoint
955 return (bool)GetValue(PositionUsesPivotPointProperty);
959 SetValue(PositionUsesPivotPointProperty, value);
960 NotifyPropertyChanged();
965 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
967 /// <since_tizen> 3 </since_tizen>
968 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
970 "View view = new View(); " +
971 "view.PivotPoint = PivotPoint.Center; " +
972 "view.PositionUsesPivotPoint = true;" +
973 " Deprecated in API5: Will be removed in API8")]
974 [EditorBrowsable(EditorBrowsableState.Never)]
975 public bool PositionUsesAnchorPoint
980 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
981 pValue.Get(out temp);
987 var temp = new Tizen.NUI.PropertyValue(value);
988 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
990 NotifyPropertyChanged();
995 /// Queries whether the view is connected to the stage.<br />
996 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
998 /// <since_tizen> 3 </since_tizen>
999 public bool IsOnWindow
1008 /// Gets the depth in the hierarchy for the view.
1010 /// <since_tizen> 3 </since_tizen>
1011 public int HierarchyDepth
1015 return GetHierarchyDepth();
1020 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1023 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1024 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1025 /// The values set by this property will likely change.
1027 /// <since_tizen> 3 </since_tizen>
1028 public int SiblingOrder
1032 return (int)GetValue(SiblingOrderProperty);
1036 SetValue(SiblingOrderProperty, value);
1038 LayoutGroup layout = Layout as LayoutGroup;
1039 layout?.ChangeLayoutSiblingOrder(value);
1041 NotifyPropertyChanged();
1046 /// Returns the natural size of the view.
1049 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1051 /// <since_tizen> 5 </since_tizen>
1052 public Vector3 NaturalSize
1056 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1057 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1063 /// Returns the natural size (Size2D) of the view.
1066 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1068 /// <since_tizen> 4 </since_tizen>
1069 public Size2D NaturalSize2D
1073 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1074 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1076 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1083 /// Gets or sets the origin of a view within its parent's area.<br />
1084 /// 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 />
1085 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1086 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1088 /// <pre>The view has been initialized.</pre>
1089 /// <since_tizen> 3 </since_tizen>
1090 public Position ParentOrigin
1094 Position tmp = (Position)GetValue(ParentOriginProperty);
1095 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1099 SetValue(ParentOriginProperty, value);
1100 NotifyPropertyChanged();
1105 /// Gets or sets the anchor-point of a view.<br />
1106 /// 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 />
1107 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1108 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1109 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1110 /// <pre>The view has been initialized.</pre>
1113 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1115 /// <since_tizen> 3 </since_tizen>
1116 public Position PivotPoint
1120 Position tmp = (Position)GetValue(PivotPointProperty);
1121 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1125 SetValue(PivotPointProperty, value);
1126 NotifyPropertyChanged();
1131 /// Gets or sets the size width of the view.
1135 /// Animatable - This property can be animated using <c>Animation</c> class.
1138 /// <since_tizen> 3 </since_tizen>
1139 public float SizeWidth
1143 return (float)GetValue(SizeWidthProperty);
1147 SetValue(SizeWidthProperty, value);
1148 NotifyPropertyChanged();
1153 /// Gets or sets the size height of the view.
1157 /// Animatable - This property can be animated using <c>Animation</c> class.
1160 /// <since_tizen> 3 </since_tizen>
1161 public float SizeHeight
1165 return (float)GetValue(SizeHeightProperty);
1169 SetValue(SizeHeightProperty, value);
1170 NotifyPropertyChanged();
1175 /// Gets or sets the position of the view.<br />
1176 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1177 /// If the position inheritance is disabled, sets the world position.<br />
1181 /// Animatable - This property can be animated using <c>Animation</c> class.
1183 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1185 /// <since_tizen> 3 </since_tizen>
1186 public Position Position
1190 Position tmp = (Position)GetValue(PositionProperty);
1191 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1195 SetValue(PositionProperty, value);
1196 NotifyPropertyChanged();
1201 /// Gets or sets the position X of the view.
1205 /// Animatable - This property can be animated using <c>Animation</c> class.
1208 /// <since_tizen> 3 </since_tizen>
1209 public float PositionX
1213 return (float)GetValue(PositionXProperty);
1217 SetValue(PositionXProperty, value);
1218 NotifyPropertyChanged();
1223 /// Gets or sets the position Y of the view.
1227 /// Animatable - This property can be animated using <c>Animation</c> class.
1230 /// <since_tizen> 3 </since_tizen>
1231 public float PositionY
1235 return (float)GetValue(PositionYProperty);
1239 SetValue(PositionYProperty, value);
1240 NotifyPropertyChanged();
1245 /// Gets or sets the position Z of the view.
1249 /// Animatable - This property can be animated using <c>Animation</c> class.
1252 /// <since_tizen> 3 </since_tizen>
1253 public float PositionZ
1257 return (float)GetValue(PositionZProperty);
1261 SetValue(PositionZProperty, value);
1262 NotifyPropertyChanged();
1267 /// Gets or sets the world position of the view.
1269 /// <since_tizen> 3 </since_tizen>
1270 public Vector3 WorldPosition
1274 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1275 var pValue = GetProperty(View.Property.WorldPosition);
1283 /// Gets or sets the orientation of the view.<br />
1284 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1288 /// This is an asynchronous method.
1291 /// Animatable - This property can be animated using <c>Animation</c> class.
1294 /// <since_tizen> 3 </since_tizen>
1295 public Rotation Orientation
1299 return (Rotation)GetValue(OrientationProperty);
1303 SetValue(OrientationProperty, value);
1304 NotifyPropertyChanged();
1309 /// Gets or sets the world orientation of the view.<br />
1311 /// <since_tizen> 3 </since_tizen>
1312 public Rotation WorldOrientation
1316 Rotation temp = new Rotation();
1317 var pValue = GetProperty(View.Property.WorldOrientation);
1325 /// Gets or sets the scale factor applied to the view.<br />
1329 /// Animatable - This property can be animated using <c>Animation</c> class.
1331 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1333 /// <since_tizen> 3 </since_tizen>
1334 public Vector3 Scale
1338 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1339 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1343 SetValue(ScaleProperty, value);
1344 NotifyPropertyChanged();
1349 /// Gets or sets the scale X factor applied to the view.
1353 /// Animatable - This property can be animated using <c>Animation</c> class.
1356 /// <since_tizen> 3 </since_tizen>
1361 return (float)GetValue(ScaleXProperty);
1365 SetValue(ScaleXProperty, value);
1366 NotifyPropertyChanged();
1371 /// Gets or sets the scale Y factor applied to the view.
1375 /// Animatable - This property can be animated using <c>Animation</c> class.
1378 /// <since_tizen> 3 </since_tizen>
1383 return (float)GetValue(ScaleYProperty);
1387 SetValue(ScaleYProperty, value);
1388 NotifyPropertyChanged();
1393 /// Gets or sets the scale Z factor applied to the view.
1397 /// Animatable - This property can be animated using <c>Animation</c> class.
1400 /// <since_tizen> 3 </since_tizen>
1405 return (float)GetValue(ScaleZProperty);
1409 SetValue(ScaleZProperty, value);
1410 NotifyPropertyChanged();
1415 /// Gets the world scale of the view.
1417 /// <since_tizen> 3 </since_tizen>
1418 public Vector3 WorldScale
1422 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1423 var pValue = GetProperty(View.Property.WorldScale);
1431 /// Retrieves the visibility flag of the view.
1435 /// If the view is not visible, then the view and its children will not be rendered.
1436 /// 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.
1439 /// Animatable - This property can be animated using <c>Animation</c> class.
1442 /// <since_tizen> 3 </since_tizen>
1443 public bool Visibility
1448 var pValue = GetProperty(View.Property.VISIBLE);
1449 pValue.Get(out temp);
1456 /// Gets the view's world color.
1458 /// <since_tizen> 3 </since_tizen>
1459 public Vector4 WorldColor
1463 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1464 var pValue = GetProperty(View.Property.WorldColor);
1472 /// Gets or sets the view's name.
1474 /// <since_tizen> 3 </since_tizen>
1479 return (string)GetValue(NameProperty);
1483 SetValue(NameProperty, value);
1484 NotifyPropertyChanged();
1489 /// Get the number of children held by the view.
1491 /// <since_tizen> 3 </since_tizen>
1492 public new uint ChildCount
1496 return Convert.ToUInt32(Children.Count);
1501 /// Gets the view's ID.
1504 /// <since_tizen> 3 </since_tizen>
1514 /// Gets or sets the status of whether the view should emit touch or hover signals.
1516 /// <since_tizen> 3 </since_tizen>
1517 public bool Sensitive
1521 return (bool)GetValue(SensitiveProperty);
1525 SetValue(SensitiveProperty, value);
1526 NotifyPropertyChanged();
1531 /// 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.
1533 /// <since_tizen> 3 </since_tizen>
1534 public bool LeaveRequired
1538 return (bool)GetValue(LeaveRequiredProperty);
1542 SetValue(LeaveRequiredProperty, value);
1543 NotifyPropertyChanged();
1548 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1550 /// <since_tizen> 3 </since_tizen>
1551 public bool InheritOrientation
1555 return (bool)GetValue(InheritOrientationProperty);
1559 SetValue(InheritOrientationProperty, value);
1560 NotifyPropertyChanged();
1565 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1567 /// <since_tizen> 3 </since_tizen>
1568 public bool InheritScale
1572 return (bool)GetValue(InheritScaleProperty);
1576 SetValue(InheritScaleProperty, value);
1577 NotifyPropertyChanged();
1582 /// Gets or sets the status of how the view and its children should be drawn.<br />
1583 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1584 /// 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 />
1585 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1586 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1587 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1589 /// <since_tizen> 3 </since_tizen>
1590 public DrawModeType DrawMode
1594 return (DrawModeType)GetValue(DrawModeProperty);
1598 SetValue(DrawModeProperty, value);
1599 NotifyPropertyChanged();
1604 /// Gets or sets the relative to parent size factor of the view.<br />
1605 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1606 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1609 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1611 /// <since_tizen> 3 </since_tizen>
1612 public Vector3 SizeModeFactor
1616 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1617 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1621 SetValue(SizeModeFactorProperty, value);
1622 NotifyPropertyChanged();
1627 /// Gets or sets the width resize policy to be used.
1629 /// <since_tizen> 3 </since_tizen>
1630 public ResizePolicyType WidthResizePolicy
1634 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1638 SetValue(WidthResizePolicyProperty, value);
1639 NotifyPropertyChanged();
1644 /// Gets or sets the height resize policy to be used.
1646 /// <since_tizen> 3 </since_tizen>
1647 public ResizePolicyType HeightResizePolicy
1651 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1655 SetValue(HeightResizePolicyProperty, value);
1656 NotifyPropertyChanged();
1661 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1662 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1664 /// <since_tizen> 3 </since_tizen>
1665 public SizeScalePolicyType SizeScalePolicy
1669 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1673 SetValue(SizeScalePolicyProperty, value);
1674 NotifyPropertyChanged();
1679 /// Gets or sets the status of whether the width size is dependent on the height size.
1681 /// <since_tizen> 3 </since_tizen>
1682 public bool WidthForHeight
1686 return (bool)GetValue(WidthForHeightProperty);
1690 SetValue(WidthForHeightProperty, value);
1691 NotifyPropertyChanged();
1696 /// Gets or sets the status of whether the height size is dependent on the width size.
1698 /// <since_tizen> 3 </since_tizen>
1699 public bool HeightForWidth
1703 return (bool)GetValue(HeightForWidthProperty);
1707 SetValue(HeightForWidthProperty, value);
1708 NotifyPropertyChanged();
1713 /// Gets or sets the padding for use in layout.
1716 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1718 /// <since_tizen> 5 </since_tizen>
1719 public Extents Padding
1723 // If View has a Layout then padding in stored in the base Layout class
1726 return Layout.Padding;
1730 Extents temp = (Extents)GetValue(PaddingProperty);
1731 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1733 // Two return points to prevent creating a zeroed Extent native object before assignment
1737 Extents padding = value;
1740 // Layout set so store Padding in LayoutItem instead of in View.
1741 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1742 // the position and sizes measure in the Layouting.
1743 Layout.Padding = value;
1744 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1745 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1746 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1748 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1752 SetValue(PaddingProperty, padding);
1753 NotifyPropertyChanged();
1758 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1760 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1762 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1764 /// <since_tizen> 3 </since_tizen>
1765 public Size2D MinimumSize
1769 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1770 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1776 throw new ArgumentNullException(nameof(value));
1780 // Note: it only works if minimum size is >= than natural size.
1781 // To force the size it should be done through the width&height spec or Size2D.
1782 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1783 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1784 layout.RequestLayout();
1786 SetValue(MinimumSizeProperty, value);
1787 NotifyPropertyChanged();
1792 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1795 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1797 /// <since_tizen> 3 </since_tizen>
1798 public Size2D MaximumSize
1802 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1803 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1807 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1808 // MATCH_PARENT spec + parent container size can be used to limit
1811 layout.RequestLayout();
1813 SetValue(MaximumSizeProperty, value);
1814 NotifyPropertyChanged();
1819 /// Gets or sets whether a child view inherits it's parent's position.<br />
1820 /// Default is to inherit.<br />
1821 /// 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 />
1823 /// <since_tizen> 3 </since_tizen>
1824 public bool InheritPosition
1828 return (bool)GetValue(InheritPositionProperty);
1832 SetValue(InheritPositionProperty, value);
1833 NotifyPropertyChanged();
1838 /// Gets or sets the clipping behavior (mode) of it's children.
1840 /// <since_tizen> 3 </since_tizen>
1841 public ClippingModeType ClippingMode
1845 return (ClippingModeType)GetValue(ClippingModeProperty);
1849 SetValue(ClippingModeProperty, value);
1850 NotifyPropertyChanged();
1855 /// Gets the number of renderers held by the view.
1857 /// <since_tizen> 3 </since_tizen>
1858 public uint RendererCount
1862 return GetRendererCount();
1867 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1870 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1872 /// <since_tizen> 3 </since_tizen>
1873 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1875 "View view = new View(); " +
1876 "view.PivotPoint = PivotPoint.Center; " +
1877 "view.PositionUsesPivotPoint = true;")]
1878 [EditorBrowsable(EditorBrowsableState.Never)]
1879 public Position AnchorPoint
1883 Position temp = new Position(0.0f, 0.0f, 0.0f);
1884 var pValue = GetProperty(View.Property.AnchorPoint);
1887 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1893 var temp = new Tizen.NUI.PropertyValue(value);
1894 SetProperty(View.Property.AnchorPoint, temp);
1896 NotifyPropertyChanged();
1901 /// Sets the size of a view for the width, the height and the depth.<br />
1902 /// Geometry can be scaled to fit within this area.<br />
1903 /// This does not interfere with the view's scale factor.<br />
1904 /// The views default depth is the minimum of width and height.<br />
1908 /// Animatable - This property can be animated using <c>Animation</c> class.
1910 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1912 /// <since_tizen> 5 </since_tizen>
1917 Size tmp = (Size)GetValue(SizeProperty);
1918 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1922 SetValue(SizeProperty, value);
1923 NotifyPropertyChanged();
1928 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1930 /// <since_tizen> 3 </since_tizen>
1931 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1933 "Container parent = view.GetParent(); " +
1934 "View view = parent as View;")]
1935 [EditorBrowsable(EditorBrowsableState.Never)]
1936 public new View Parent
1941 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
1942 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1943 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1945 if (basehandle is Layer layer)
1947 ret = new View(Layer.getCPtr(layer).Handle, false);
1948 NUILog.Error("This Parent property is deprecated, should do not be used");
1952 ret = basehandle as View;
1955 Interop.BaseHandle.DeleteBaseHandle(CPtr);
1956 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1958 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1964 /// Gets/Sets whether inherit parent's the layout Direction.
1966 /// <since_tizen> 4 </since_tizen>
1967 public bool InheritLayoutDirection
1971 return (bool)GetValue(InheritLayoutDirectionProperty);
1975 SetValue(InheritLayoutDirectionProperty, value);
1976 NotifyPropertyChanged();
1981 /// Gets/Sets the layout Direction.
1983 /// <since_tizen> 4 </since_tizen>
1984 public ViewLayoutDirectionType LayoutDirection
1988 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1992 SetValue(LayoutDirectionProperty, value);
1993 NotifyPropertyChanged();
1994 layout?.RequestLayout();
1999 /// Gets or sets the Margin for use in layout.
2002 /// Margin property is supported by Layout algorithms and containers.
2003 /// Please Set Layout if you want to use Margin property.
2004 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2006 /// <since_tizen> 4 </since_tizen>
2007 public Extents Margin
2011 // If View has a Layout then margin is stored in Layout.
2014 return Layout.Margin;
2018 // If Layout not set then return margin stored in View.
2019 Extents temp = (Extents)GetValue(MarginProperty);
2020 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2022 // Two return points to prevent creating a zeroed Extent native object before assignment
2028 // Layout set so store Margin in LayoutItem instead of View.
2029 // If View stores the Margin too then the Legacy Size Negotiation will
2030 // overwrite the position and size values measured in the Layouting.
2031 Layout.Margin = value;
2032 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2033 layout?.RequestLayout();
2037 SetValue(MarginProperty, value);
2039 NotifyPropertyChanged();
2040 layout?.RequestLayout();
2045 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2049 /// // matchParentView matches its size to its parent size.
2050 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2051 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2053 /// // wrapContentView wraps its children with their desired size.
2054 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2055 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2057 /// // exactSizeView shows itself with an exact size.
2058 /// exactSizeView.WidthSpecification = 100;
2059 /// exactSizeView.HeightSpecification = 100;
2062 /// <since_tizen> 6 </since_tizen>
2063 public int WidthSpecification
2071 if (value == widthPolicy)
2074 widthPolicy = value;
2075 if (widthPolicy >= 0)
2077 if (heightPolicy >= 0) // Policy an exact value
2079 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2080 Size2D = new Size2D(widthPolicy, heightPolicy);
2083 layout?.RequestLayout();
2088 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2092 /// // matchParentView matches its size to its parent size.
2093 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2094 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2096 /// // wrapContentView wraps its children with their desired size.
2097 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2098 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2100 /// // exactSizeView shows itself with an exact size.
2101 /// exactSizeView.WidthSpecification = 100;
2102 /// exactSizeView.HeightSpecification = 100;
2105 /// <since_tizen> 6 </since_tizen>
2106 public int HeightSpecification
2110 return heightPolicy;
2114 if (value == heightPolicy)
2117 heightPolicy = value;
2118 if (heightPolicy >= 0)
2120 if (widthPolicy >= 0) // Policy an exact value
2122 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2123 Size2D = new Size2D(widthPolicy, heightPolicy);
2126 layout?.RequestLayout();
2131 /// Gets the List of transitions for this View.
2133 /// <since_tizen> 6 </since_tizen>
2134 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2138 if (layoutTransitions == null)
2140 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2142 return layoutTransitions;
2147 /// Sets a layout transitions for this View.
2149 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2151 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2153 /// <since_tizen> 6 </since_tizen>
2154 public LayoutTransition LayoutTransition
2158 return layoutTransition;
2164 throw new global::System.ArgumentNullException(nameof(value));
2166 if (layoutTransitions == null)
2168 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2171 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2173 AttachTransitionsToChildren(value);
2175 layoutTransition = value;
2180 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2183 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2185 /// <since_tizen> 4 </since_tizen>
2186 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2187 [EditorBrowsable(EditorBrowsableState.Never)]
2188 public Extents PaddingEX
2192 Extents temp = new Extents(0, 0, 0, 0);
2193 var pValue = GetProperty(View.Property.PADDING);
2196 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2202 var temp = new Tizen.NUI.PropertyValue(value);
2203 SetProperty(View.Property.PADDING, temp);
2205 NotifyPropertyChanged();
2206 layout?.RequestLayout();
2211 /// The Color of View. This is an RGBA value.
2215 /// Animatable - This property can be animated using <c>Animation</c> class.
2217 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2219 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2220 [EditorBrowsable(EditorBrowsableState.Never)]
2225 Color temp = (Color)GetValue(ColorProperty);
2226 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2230 SetValue(ColorProperty, value);
2231 NotifyPropertyChanged();
2236 /// Set the layout on this View. Replaces any existing Layout.
2239 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2241 /// <since_tizen> 6 </since_tizen>
2242 public LayoutItem Layout
2250 // Do nothing if layout provided is already set on this View.
2251 if (value == layout)
2256 LayoutingDisabled = false;
2259 // If new layout being set already has a owner then that owner receives a replacement default layout.
2260 // First check if the layout to be set already has a owner.
2261 if (value?.Owner != null)
2263 // Previous owner of the layout gets a default layout as a replacement.
2264 value.Owner.Layout = new AbsoluteLayout();
2266 // Copy Margin and Padding to replacement LayoutGroup.
2267 if (value.Owner.Layout != null)
2269 value.Owner.Layout.Margin = value.Margin;
2270 value.Owner.Layout.Padding = value.Padding;
2274 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2275 // View if no replacement. Previously margin and padding values would have been moved from
2276 // the View to the layout.
2277 if (layout != null) // Existing layout
2281 // Existing layout being replaced so copy over margin and padding values.
2282 value.Margin = layout.Margin;
2283 value.Padding = layout.Padding;
2287 // Layout not being replaced so restore margin and padding to View.
2288 SetValue(MarginProperty, layout.Margin);
2289 SetValue(PaddingProperty, layout.Padding);
2290 NotifyPropertyChanged();
2295 // First Layout to be added to the View hence copy
2297 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2300 Extents margin = Margin;
2301 Extents padding = Padding;
2302 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2304 // If View already has a margin set then store it in Layout instead.
2305 value.Margin = margin;
2306 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2307 NotifyPropertyChanged();
2310 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2312 // If View already has a padding set then store it in Layout instead.
2313 value.Padding = padding;
2315 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2316 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2317 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2319 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2320 NotifyPropertyChanged();
2326 // Remove existing layout from it's parent layout group.
2329 value.SetPositionByLayout = !excludeLayouting;
2331 // Set layout to this view
2337 /// The weight of the View, used to share available space in a layout with siblings.
2339 /// <since_tizen> 6 </since_tizen>
2349 layout?.RequestLayout();
2354 /// Whether to load the BackgroundImage synchronously.
2355 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2356 /// Note: For Normal Quad images only.
2358 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2359 [EditorBrowsable(EditorBrowsableState.Never)]
2360 public bool BackgroundImageSynchronosLoading
2364 return backgroundImageSynchronosLoading;
2368 backgroundImageSynchronosLoading = value;
2370 string bgUrl = null;
2371 var pValue = Background.Find(ImageVisualProperty.URL);
2372 pValue?.Get(out bgUrl);
2375 if (!string.IsNullOrEmpty(bgUrl))
2377 PropertyMap bgMap = this.Background;
2378 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2379 bgMap.Add("synchronousLoading", temp);
2386 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2387 [EditorBrowsable(EditorBrowsableState.Never)]
2388 public Vector2 UpdateSizeHint
2392 return (Vector2)GetValue(UpdateSizeHintProperty);
2396 SetValue(UpdateSizeHintProperty, value);
2397 NotifyPropertyChanged();
2402 /// Enable/Disable ControlState propagation for children.
2403 /// It is false by default.
2404 /// If the View needs to share ControlState with descendants, please set it true.
2405 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2407 [EditorBrowsable(EditorBrowsableState.Never)]
2408 public bool EnableControlStatePropagation
2410 get => themeData?.controlStatePropagation ?? false;
2413 if (EnableControlStatePropagation == value) return;
2415 if (themeData == null) themeData = new ThemeData();
2417 themeData.controlStatePropagation = value;
2419 foreach (View child in Children)
2421 child.EnableControlStatePropagation = value;
2427 /// By default, it is false in View, true in Control.
2428 /// Note that if the value is true, the View will be a touch receptor.
2430 [EditorBrowsable(EditorBrowsableState.Never)]
2431 public bool EnableControlState
2435 return (bool)GetValue(EnableControlStateProperty);
2439 SetValue(EnableControlStateProperty, value);
2444 /// Whether the actor grab all touches even if touch leaves its boundary.
2446 /// <returns>true, if it grab all touch after start</returns>
2447 [EditorBrowsable(EditorBrowsableState.Never)]
2448 public bool GrabTouchAfterLeave
2453 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2454 pValue.Get(out temp);
2460 var temp = new Tizen.NUI.PropertyValue(value);
2461 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2463 NotifyPropertyChanged();
2468 /// Determines which blend equation will be used to render renderers of this actor.
2470 /// <returns>blend equation enum currently assigned</returns>
2471 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2472 [EditorBrowsable(EditorBrowsableState.Never)]
2473 public BlendEquationType BlendEquation
2478 var pValue = GetProperty(View.Property.BlendEquation);
2479 pValue.Get(out temp);
2481 return (BlendEquationType)temp;
2485 var temp = new Tizen.NUI.PropertyValue((int)value);
2486 SetProperty(View.Property.BlendEquation, temp);
2488 NotifyPropertyChanged();
2493 /// If the value is true, the View will change its style as the theme changes.
2494 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2496 /// <since_tizen> 9 </since_tizen>
2497 public bool ThemeChangeSensitive
2499 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2500 set => SetValue(ThemeChangeSensitiveProperty, value);
2504 /// Create Style, it is abstract function and must be override.
2506 [EditorBrowsable(EditorBrowsableState.Never)]
2507 protected virtual ViewStyle CreateViewStyle()
2509 return new ViewStyle();
2513 /// Called after the View's ControlStates changed.
2515 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2516 [EditorBrowsable(EditorBrowsableState.Never)]
2517 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2523 [EditorBrowsable(EditorBrowsableState.Never)]
2524 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2530 /// Apply style instance to the view.
2531 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2533 /// <since_tizen> 9 </since_tizen>
2534 public virtual void ApplyStyle(ViewStyle viewStyle)
2536 if (viewStyle == null || themeData?.viewStyle == viewStyle) return;
2538 if (themeData == null) themeData = new ThemeData();
2540 themeData.viewStyle = viewStyle;
2542 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2548 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2550 if (bindablePropertyOfView == null)
2555 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2556 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2558 foreach (var sourceProperty in dirtyStyleProperties)
2560 var sourceValue = viewStyle.GetValue(sourceProperty);
2562 if (sourceValue == null)
2567 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2569 if (destinationProperty != null)
2571 SetValue(destinationProperty, sourceValue);
2577 /// Get whether the View is culled or not.
2578 /// True means that the View is out of the view frustum.
2581 /// Hidden-API (Inhouse-API).
2583 [EditorBrowsable(EditorBrowsableState.Never)]
2589 var pValue = GetProperty(View.Property.Culled);
2590 pValue.Get(out temp);
2597 /// Set or Get TransitionOptions for the page transition.
2598 /// This property is used to define how this view will be transitioned during Page switching.
2600 /// <since_tizen> 9 </since_tizen>
2601 public TransitionOptions TransitionOptions
2605 transitionOptions = value;
2609 return transitionOptions;