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 private static HashSet<BindableProperty> positionPropertyGroup = new HashSet<BindableProperty>();
32 private static HashSet<BindableProperty> sizePropertyGroup = new HashSet<BindableProperty>();
33 private static HashSet<BindableProperty> scalePropertyGroup = new HashSet<BindableProperty>();
35 internal BackgroundExtraData backgroundExtraData;
37 private bool layoutSet = false;
38 private LayoutItem layout; // Exclusive layout assigned to this View.
40 // List of transitions paired with the condition that uses the transition.
41 private Dictionary<TransitionCondition, TransitionList> layoutTransitions;
42 private int widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
43 private int heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
44 private float weight = 0.0f; // Weighting of child View in a Layout
45 private bool backgroundImageSynchronosLoading = false;
46 private bool excludeLayouting = false;
47 private LayoutTransition layoutTransition;
48 private TransitionOptions transitionOptions = null;
49 private ThemeData themeData;
53 RegisterPropertyGroup(PositionProperty, positionPropertyGroup);
54 RegisterPropertyGroup(Position2DProperty, positionPropertyGroup);
55 RegisterPropertyGroup(PositionXProperty, positionPropertyGroup);
56 RegisterPropertyGroup(PositionYProperty, positionPropertyGroup);
58 RegisterPropertyGroup(SizeProperty, sizePropertyGroup);
59 RegisterPropertyGroup(Size2DProperty, sizePropertyGroup);
60 RegisterPropertyGroup(SizeWidthProperty, sizePropertyGroup);
61 RegisterPropertyGroup(SizeHeightProperty, sizePropertyGroup);
63 RegisterPropertyGroup(ScaleProperty, scalePropertyGroup);
64 RegisterPropertyGroup(ScaleXProperty, scalePropertyGroup);
65 RegisterPropertyGroup(ScaleYProperty, scalePropertyGroup);
66 RegisterPropertyGroup(ScaleZProperty, scalePropertyGroup);
70 /// Creates a new instance of a view.
72 /// <since_tizen> 3 </since_tizen>
73 public View() : this(Interop.View.New(), true)
75 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
78 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
79 [EditorBrowsable(EditorBrowsableState.Never)]
80 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
85 /// Create a new instance of a View with setting the status of shown or hidden.
87 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
88 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
89 [EditorBrowsable(EditorBrowsableState.Never)]
90 public View(bool shown) : this(Interop.View.New(), true)
92 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
98 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
107 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
109 InitializeStyle(viewStyle);
112 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
116 PositionUsesPivotPoint = false;
119 onWindowSendEventCallback = SendViewAddedEventToWindow;
120 this.OnWindowSignal().Connect(onWindowSendEventCallback);
128 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
139 /// The event that is triggered when the View's ControlState is changed.
141 [EditorBrowsable(EditorBrowsableState.Never)]
142 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
144 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
148 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
150 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
151 [EditorBrowsable(EditorBrowsableState.Never)]
152 public bool LayoutSet
161 /// Flag to allow Layouting to be disabled for Views.
162 /// Once a View has a Layout set then any children added to Views from then on will receive
163 /// automatic Layouts.
165 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
166 [EditorBrowsable(EditorBrowsableState.Never)]
167 public static bool LayoutingDisabled { get; set; } = true;
170 /// Deprecate. Please do not use this.
171 /// The style instance applied to this view.
172 /// Note that please do not modify the ViewStyle.
173 /// Modifying ViewStyle will affect other views with same ViewStyle.
175 [EditorBrowsable(EditorBrowsableState.Never)]
176 protected ViewStyle ViewStyle
180 if (themeData == null) themeData = new ThemeData();
182 if (themeData.viewStyle == null)
184 ApplyStyle(CreateViewStyle());
186 return themeData.viewStyle;
191 /// Get/Set the control state.
192 /// Note that the ControlState only available for the classes derived from Control.
193 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
194 /// please set <see cref="EnableControlState"/> to true.
196 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
197 [EditorBrowsable(EditorBrowsableState.Never)]
198 public ControlState ControlState
202 return themeData == null ? ControlState.Normal : themeData.controlStates;
206 if (ControlState == value)
211 var prevState = ControlState;
213 if (themeData == null) themeData = new ThemeData();
214 themeData.controlStates = value;
216 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
218 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
220 if (themeData.ControlStatePropagation)
222 foreach (View child in Children)
224 child.ControlState = value;
228 OnControlStateChanged(changeInfo);
230 ControlStateChangedEvent?.Invoke(this, changeInfo);
235 /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
237 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
238 [EditorBrowsable(EditorBrowsableState.Never)]
239 public bool ExcludeLayouting
243 return excludeLayouting;
247 excludeLayouting = value;
248 if (Layout != null && Layout.SetPositionByLayout == value)
250 Layout.SetPositionByLayout = !value;
251 Layout.RequestLayout();
256 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
257 [EditorBrowsable(EditorBrowsableState.Never)]
258 public bool IsResourcesCreated
262 return Application.Current.IsResourcesCreated;
266 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
267 [EditorBrowsable(EditorBrowsableState.Never)]
268 public ResourceDictionary XamlResources
272 return Application.Current.XamlResources;
276 Application.Current.XamlResources = value;
281 /// The StyleName, type string.
282 /// The value indicates DALi style name defined in json theme file.
284 /// <since_tizen> 3 </since_tizen>
285 public string StyleName
289 return (string)GetValue(StyleNameProperty);
293 SetValue(StyleNameProperty, value);
294 NotifyPropertyChanged();
299 /// The KeyInputFocus, type bool.
301 [EditorBrowsable(EditorBrowsableState.Never)]
302 public bool KeyInputFocus
306 return (bool)GetValue(KeyInputFocusProperty);
310 SetValue(KeyInputFocusProperty, value);
311 NotifyPropertyChanged();
316 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
320 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
323 /// Animatable - This property can be animated using <c>Animation</c> class.
325 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
329 /// <since_tizen> 3 </since_tizen>
330 public Color BackgroundColor
334 Color temp = (Color)GetValue(BackgroundColorProperty);
335 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
339 SetValue(BackgroundColorProperty, value);
340 NotifyPropertyChanged();
345 /// The mutually exclusive with "backgroundColor" and "background" type Map.
347 /// <since_tizen> 3 </since_tizen>
348 public string BackgroundImage
352 return (string)GetValue(BackgroundImageProperty);
356 SetValue(BackgroundImageProperty, value);
357 NotifyPropertyChanged();
362 /// Get or set the border of background image.
364 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
365 [EditorBrowsable(EditorBrowsableState.Never)]
366 public Rectangle BackgroundImageBorder
370 return (Rectangle)GetValue(BackgroundImageBorderProperty);
374 SetValue(BackgroundImageBorderProperty, value);
375 NotifyPropertyChanged();
380 /// The background of view.
382 /// <since_tizen> 3 </since_tizen>
383 public Tizen.NUI.PropertyMap Background
387 return (PropertyMap)GetValue(BackgroundProperty);
391 SetValue(BackgroundProperty, value);
392 NotifyPropertyChanged();
397 /// Describes a shadow as an image for a View.
398 /// It is null by default.
401 /// Getter returns copied instance of current shadow.
404 /// The mutually exclusive with "BoxShadow".
408 /// Animatable - This property can be animated using <c>Animation</c> class.
409 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
411 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
413 /// Animatable sub-property : Offset.
416 [EditorBrowsable(EditorBrowsableState.Never)]
417 public ImageShadow ImageShadow
421 return (ImageShadow)GetValue(ImageShadowProperty);
425 SetValue(ImageShadowProperty, value);
426 NotifyPropertyChanged();
431 /// Describes a box shaped shadow drawing for a View.
432 /// It is null by default.
435 /// The mutually exclusive with "ImageShadow".
439 /// Animatable - This property can be animated using <c>Animation</c> class.
440 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
442 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
444 /// Animatable sub-property : Offset, Color, BlurRadius.
447 /// <since_tizen> 9 </since_tizen>
448 public Shadow BoxShadow
452 return (Shadow)GetValue(BoxShadowProperty);
456 SetValue(BoxShadowProperty, value);
457 NotifyPropertyChanged();
462 /// The radius for the rounded corners of the View.
463 /// This will rounds background and shadow edges.
464 /// 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).
465 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
469 /// Animatable - This property can be animated using <c>Animation</c> class.
472 /// <since_tizen> 9 </since_tizen>
473 public Vector4 CornerRadius
477 return (Vector4)GetValue(CornerRadiusProperty);
481 SetValue(CornerRadiusProperty, value);
482 NotifyPropertyChanged();
487 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
488 /// It is absolute by default.
489 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
491 /// <since_tizen> 9 </since_tizen>
492 public VisualTransformPolicyType CornerRadiusPolicy
494 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
495 set => SetValue(CornerRadiusPolicyProperty, value);
499 /// The width for the borderline of the View.
500 /// This will draw borderline at background.
501 /// Note that, an image background may not have borderline if it uses a Border property.
505 /// Animatable - This property can be animated using <c>Animation</c> class.
508 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
509 [EditorBrowsable(EditorBrowsableState.Never)]
510 public float BorderlineWidth
514 return (float)GetValue(BorderlineWidthProperty);
518 SetValue(BorderlineWidthProperty, value);
519 NotifyPropertyChanged();
524 /// The color for the borderline of the View.
525 /// It is Color.Black by default.
529 /// Animatable - This property can be animated using <c>Animation</c> class.
532 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
533 [EditorBrowsable(EditorBrowsableState.Never)]
534 public Color BorderlineColor
538 return (Color)GetValue(BorderlineColorProperty);
542 SetValue(BorderlineColorProperty, value);
543 NotifyPropertyChanged();
548 /// The Relative offset for the borderline of the View.
549 /// recommand [-1.0f to 1.0f] range.
550 /// If -1.0f, borderline draw inside of View.
551 /// If 1.0f, borderline draw outside of View.
552 /// If 0.0f, borderline draw half at inside and half at outside.
553 /// It is 0.0f by default.
557 /// Animatable - This property can be animated using <c>Animation</c> class.
560 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
561 [EditorBrowsable(EditorBrowsableState.Never)]
562 public float BorderlineOffset
566 return (float)GetValue(BorderlineOffsetProperty);
570 SetValue(BorderlineOffsetProperty, value);
571 NotifyPropertyChanged();
576 /// The current state of the view.
578 /// <since_tizen> 3 </since_tizen>
583 return (States)GetValue(StateProperty);
587 SetValue(StateProperty, value);
588 NotifyPropertyChanged();
593 /// The current sub state of the view.
595 /// <since_tizen> 3 </since_tizen>
596 public States SubState
600 return (States)GetValue(SubStateProperty);
604 SetValue(SubStateProperty, value);
605 NotifyPropertyChanged();
610 /// Displays a tooltip
612 /// <since_tizen> 3 </since_tizen>
613 public Tizen.NUI.PropertyMap Tooltip
617 return (PropertyMap)GetValue(TooltipProperty);
621 SetValue(TooltipProperty, value);
622 NotifyPropertyChanged();
627 /// Displays a tooltip as a text.
629 /// <since_tizen> 3 </since_tizen>
630 public string TooltipText
634 using (var propertyValue = GetProperty(Property.TOOLTIP))
636 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
638 return retrivedValue;
640 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
641 return "error to get TooltipText";
646 var temp = new Tizen.NUI.PropertyValue(value);
647 SetProperty(View.Property.TOOLTIP, temp);
649 NotifyPropertyChanged();
654 /// The Child property of FlexContainer.<br />
655 /// The proportion of the free space in the container, the flex item will receive.<br />
656 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
658 /// <since_tizen> 3 </since_tizen>
659 [Obsolete("Deprecated in API8, will be removed in API10.")]
664 return (float)GetValue(FlexProperty);
668 SetValue(FlexProperty, value);
669 NotifyPropertyChanged();
674 /// The Child property of FlexContainer.<br />
675 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
677 /// <since_tizen> 3 </since_tizen>
678 [Obsolete("Deprecated in API8, will be removed in API10.")]
683 return (int)GetValue(AlignSelfProperty);
687 SetValue(AlignSelfProperty, value);
688 NotifyPropertyChanged();
693 /// The Child property of FlexContainer.<br />
694 /// The space around the flex item.<br />
697 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
699 /// <since_tizen> 3 </since_tizen>
700 [Obsolete("Deprecated in API8, will be removed in API10.")]
701 public Vector4 FlexMargin
705 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
706 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
710 SetValue(FlexMarginProperty, value);
711 NotifyPropertyChanged();
716 /// The top-left cell this child occupies, if not set, the first available cell is used.
719 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
720 /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
722 /// <since_tizen> 3 </since_tizen>
723 public Vector2 CellIndex
727 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
728 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
732 SetValue(CellIndexProperty, value);
733 NotifyPropertyChanged();
738 /// The number of rows this child occupies, if not set, the default value is 1.
741 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
743 /// <since_tizen> 3 </since_tizen>
748 return (float)GetValue(RowSpanProperty);
752 SetValue(RowSpanProperty, value);
753 NotifyPropertyChanged();
758 /// The number of columns this child occupies, if not set, the default value is 1.
761 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
763 /// <since_tizen> 3 </since_tizen>
764 public float ColumnSpan
768 return (float)GetValue(ColumnSpanProperty);
772 SetValue(ColumnSpanProperty, value);
773 NotifyPropertyChanged();
778 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
781 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
783 /// <since_tizen> 3 </since_tizen>
784 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
788 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
792 SetValue(CellHorizontalAlignmentProperty, value);
793 NotifyPropertyChanged();
798 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
801 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
803 /// <since_tizen> 3 </since_tizen>
804 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
808 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
812 SetValue(CellVerticalAlignmentProperty, value);
813 NotifyPropertyChanged();
818 /// The left focusable view.<br />
819 /// This will return null if not set.<br />
820 /// This will also return null if the specified left focusable view is not on a window.<br />
822 /// <since_tizen> 3 </since_tizen>
823 public View LeftFocusableView
825 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
828 return (View)GetValue(LeftFocusableViewProperty);
832 SetValue(LeftFocusableViewProperty, value);
833 NotifyPropertyChanged();
838 /// The right focusable view.<br />
839 /// This will return null if not set.<br />
840 /// This will also return null if the specified right focusable view is not on a window.<br />
842 /// <since_tizen> 3 </since_tizen>
843 public View RightFocusableView
845 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
848 return (View)GetValue(RightFocusableViewProperty);
852 SetValue(RightFocusableViewProperty, value);
853 NotifyPropertyChanged();
858 /// The up focusable view.<br />
859 /// This will return null if not set.<br />
860 /// This will also return null if the specified up focusable view is not on a window.<br />
862 /// <since_tizen> 3 </since_tizen>
863 public View UpFocusableView
865 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
868 return (View)GetValue(UpFocusableViewProperty);
872 SetValue(UpFocusableViewProperty, value);
873 NotifyPropertyChanged();
878 /// The down focusable view.<br />
879 /// This will return null if not set.<br />
880 /// This will also return null if the specified down focusable view is not on a window.<br />
882 /// <since_tizen> 3 </since_tizen>
883 public View DownFocusableView
885 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
888 return (View)GetValue(DownFocusableViewProperty);
892 SetValue(DownFocusableViewProperty, value);
893 NotifyPropertyChanged();
898 /// Whether the view should be focusable by keyboard navigation.
900 /// <since_tizen> 3 </since_tizen>
901 public bool Focusable
905 SetValue(FocusableProperty, value);
906 NotifyPropertyChanged();
910 return (bool)GetValue(FocusableProperty);
915 /// Retrieves the position of the view.<br />
916 /// The coordinates are relative to the view's parent.<br />
918 /// <since_tizen> 3 </since_tizen>
919 public Position CurrentPosition
923 return GetCurrentPosition();
928 /// Sets the size of a view for the width and the height.<br />
929 /// Geometry can be scaled to fit within this area.<br />
930 /// This does not interfere with the view's scale factor.<br />
931 /// The views default depth is the minimum of width and height.<br />
934 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
935 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
937 /// <since_tizen> 3 </since_tizen>
942 Size2D temp = (Size2D)GetValue(Size2DProperty);
943 int width = temp.Width;
944 int height = temp.Height;
946 if (this.Layout == null)
948 if (width < 0) { width = 0; }
949 if (height < 0) { height = 0; }
952 return new Size2D(OnSize2DChanged, width, height);
956 SetValue(Size2DProperty, value);
958 NotifyPropertyChanged();
963 /// Retrieves the size of the view.<br />
964 /// The coordinates are relative to the view's parent.<br />
966 /// <since_tizen> 3 </since_tizen>
967 public Size2D CurrentSize
971 return GetCurrentSize();
976 /// Retrieves and sets the view's opacity.<br />
978 /// <since_tizen> 3 </since_tizen>
983 return (float)GetValue(OpacityProperty);
987 SetValue(OpacityProperty, value);
988 NotifyPropertyChanged();
993 /// Sets the position of the view for X and Y.<br />
994 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
995 /// If the position inheritance is disabled, sets the world position.<br />
998 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
999 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1001 /// <since_tizen> 3 </since_tizen>
1002 public Position2D Position2D
1006 Position2D temp = (Position2D)GetValue(Position2DProperty);
1007 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1011 SetValue(Position2DProperty, value);
1012 NotifyPropertyChanged();
1017 /// Retrieves the screen position of the view.<br />
1019 /// <since_tizen> 3 </since_tizen>
1020 public Vector2 ScreenPosition
1024 Vector2 temp = new Vector2(0.0f, 0.0f);
1025 var pValue = GetProperty(View.Property.ScreenPosition);
1033 /// Determines whether the pivot point should be used to determine the position of the view.
1034 /// This is false by default.
1036 /// <remarks>If false, then the top-left of the view is used for the position.
1037 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1039 /// <since_tizen> 3 </since_tizen>
1040 public bool PositionUsesPivotPoint
1044 return (bool)GetValue(PositionUsesPivotPointProperty);
1048 SetValue(PositionUsesPivotPointProperty, value);
1049 NotifyPropertyChanged();
1054 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1056 /// <since_tizen> 3 </since_tizen>
1057 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1059 "View view = new View(); " +
1060 "view.PivotPoint = PivotPoint.Center; " +
1061 "view.PositionUsesPivotPoint = true;" +
1062 " Deprecated in API5: Will be removed in API8")]
1063 [EditorBrowsable(EditorBrowsableState.Never)]
1064 public bool PositionUsesAnchorPoint
1069 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1070 pValue.Get(out temp);
1076 var temp = new Tizen.NUI.PropertyValue(value);
1077 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1079 NotifyPropertyChanged();
1084 /// Queries whether the view is connected to the stage.<br />
1085 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1087 /// <since_tizen> 3 </since_tizen>
1088 public bool IsOnWindow
1097 /// Gets the depth in the hierarchy for the view.
1099 /// <since_tizen> 3 </since_tizen>
1100 public int HierarchyDepth
1104 return GetHierarchyDepth();
1109 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1112 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1113 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1114 /// The values set by this property will likely change.
1116 /// <since_tizen> 3 </since_tizen>
1117 public int SiblingOrder
1121 return (int)GetValue(SiblingOrderProperty);
1125 SetValue(SiblingOrderProperty, value);
1127 LayoutGroup layout = Layout as LayoutGroup;
1128 layout?.ChangeLayoutSiblingOrder(value);
1130 NotifyPropertyChanged();
1135 /// Returns the natural size of the view.
1138 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1140 /// <since_tizen> 5 </since_tizen>
1141 public Vector3 NaturalSize
1145 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1146 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1152 /// Returns the natural size (Size2D) of the view.
1155 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1157 /// <since_tizen> 4 </since_tizen>
1158 public Size2D NaturalSize2D
1162 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1165 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1172 /// Gets or sets the origin of a view within its parent's area.<br />
1173 /// 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 />
1174 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1175 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1177 /// <pre>The view has been initialized.</pre>
1178 /// <since_tizen> 3 </since_tizen>
1179 public Position ParentOrigin
1183 Position tmp = (Position)GetValue(ParentOriginProperty);
1184 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1188 SetValue(ParentOriginProperty, value);
1189 NotifyPropertyChanged();
1194 /// Gets or sets the anchor-point of a view.<br />
1195 /// 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 />
1196 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1197 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1198 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1199 /// <pre>The view has been initialized.</pre>
1202 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1204 /// <since_tizen> 3 </since_tizen>
1205 public Position PivotPoint
1209 Position tmp = (Position)GetValue(PivotPointProperty);
1210 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1214 SetValue(PivotPointProperty, value);
1215 NotifyPropertyChanged();
1220 /// Gets or sets the size width of the view.
1224 /// Animatable - This property can be animated using <c>Animation</c> class.
1227 /// <since_tizen> 3 </since_tizen>
1228 public float SizeWidth
1232 return (float)GetValue(SizeWidthProperty);
1236 SetValue(SizeWidthProperty, value);
1237 NotifyPropertyChanged();
1242 /// Gets or sets the size height of the view.
1246 /// Animatable - This property can be animated using <c>Animation</c> class.
1249 /// <since_tizen> 3 </since_tizen>
1250 public float SizeHeight
1254 return (float)GetValue(SizeHeightProperty);
1258 SetValue(SizeHeightProperty, value);
1259 NotifyPropertyChanged();
1264 /// Gets or sets the position of the view.<br />
1265 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1266 /// If the position inheritance is disabled, sets the world position.<br />
1270 /// Animatable - This property can be animated using <c>Animation</c> class.
1272 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1274 /// <since_tizen> 3 </since_tizen>
1275 public Position Position
1279 Position tmp = (Position)GetValue(PositionProperty);
1280 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1284 SetValue(PositionProperty, value);
1285 NotifyPropertyChanged();
1290 /// Gets or sets the position X of the view.
1294 /// Animatable - This property can be animated using <c>Animation</c> class.
1297 /// <since_tizen> 3 </since_tizen>
1298 public float PositionX
1302 return (float)GetValue(PositionXProperty);
1306 SetValue(PositionXProperty, value);
1307 NotifyPropertyChanged();
1312 /// Gets or sets the position Y of the view.
1316 /// Animatable - This property can be animated using <c>Animation</c> class.
1319 /// <since_tizen> 3 </since_tizen>
1320 public float PositionY
1324 return (float)GetValue(PositionYProperty);
1328 SetValue(PositionYProperty, value);
1329 NotifyPropertyChanged();
1334 /// Gets or sets the position Z of the view.
1338 /// Animatable - This property can be animated using <c>Animation</c> class.
1341 /// <since_tizen> 3 </since_tizen>
1342 public float PositionZ
1346 return (float)GetValue(PositionZProperty);
1350 SetValue(PositionZProperty, value);
1351 NotifyPropertyChanged();
1356 /// Gets or sets the world position of the view.
1358 /// <since_tizen> 3 </since_tizen>
1359 public Vector3 WorldPosition
1363 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1364 var pValue = GetProperty(View.Property.WorldPosition);
1372 /// Gets or sets the orientation of the view.<br />
1373 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1377 /// This is an asynchronous method.
1380 /// Animatable - This property can be animated using <c>Animation</c> class.
1383 /// <since_tizen> 3 </since_tizen>
1384 public Rotation Orientation
1388 return (Rotation)GetValue(OrientationProperty);
1392 SetValue(OrientationProperty, value);
1393 NotifyPropertyChanged();
1398 /// Gets or sets the world orientation of the view.<br />
1400 /// <since_tizen> 3 </since_tizen>
1401 public Rotation WorldOrientation
1405 Rotation temp = new Rotation();
1406 var pValue = GetProperty(View.Property.WorldOrientation);
1414 /// Gets or sets the scale factor applied to the view.<br />
1418 /// Animatable - This property can be animated using <c>Animation</c> class.
1420 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1422 /// <since_tizen> 3 </since_tizen>
1423 public Vector3 Scale
1427 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1428 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1432 SetValue(ScaleProperty, value);
1433 NotifyPropertyChanged();
1438 /// Gets or sets the scale X factor applied to the view.
1442 /// Animatable - This property can be animated using <c>Animation</c> class.
1445 /// <since_tizen> 3 </since_tizen>
1450 return (float)GetValue(ScaleXProperty);
1454 SetValue(ScaleXProperty, value);
1455 NotifyPropertyChanged();
1460 /// Gets or sets the scale Y factor applied to the view.
1464 /// Animatable - This property can be animated using <c>Animation</c> class.
1467 /// <since_tizen> 3 </since_tizen>
1472 return (float)GetValue(ScaleYProperty);
1476 SetValue(ScaleYProperty, value);
1477 NotifyPropertyChanged();
1482 /// Gets or sets the scale Z factor applied to the view.
1486 /// Animatable - This property can be animated using <c>Animation</c> class.
1489 /// <since_tizen> 3 </since_tizen>
1494 return (float)GetValue(ScaleZProperty);
1498 SetValue(ScaleZProperty, value);
1499 NotifyPropertyChanged();
1504 /// Gets the world scale of the view.
1506 /// <since_tizen> 3 </since_tizen>
1507 public Vector3 WorldScale
1511 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1512 var pValue = GetProperty(View.Property.WorldScale);
1520 /// Retrieves the visibility flag of the view.
1524 /// If the view is not visible, then the view and its children will not be rendered.
1525 /// 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.
1528 /// Animatable - This property can be animated using <c>Animation</c> class.
1531 /// <since_tizen> 3 </since_tizen>
1532 public bool Visibility
1537 var pValue = GetProperty(View.Property.VISIBLE);
1538 pValue.Get(out temp);
1545 /// Gets the view's world color.
1547 /// <since_tizen> 3 </since_tizen>
1548 public Vector4 WorldColor
1552 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1553 var pValue = GetProperty(View.Property.WorldColor);
1561 /// Gets or sets the view's name.
1563 /// <since_tizen> 3 </since_tizen>
1568 return (string)GetValue(NameProperty);
1572 SetValue(NameProperty, value);
1573 NotifyPropertyChanged();
1578 /// Get the number of children held by the view.
1580 /// <since_tizen> 3 </since_tizen>
1581 public new uint ChildCount
1585 return Convert.ToUInt32(Children.Count);
1590 /// Gets the view's ID.
1593 /// <since_tizen> 3 </since_tizen>
1603 /// Gets or sets the status of whether the view should emit touch or hover signals.
1605 /// <since_tizen> 3 </since_tizen>
1606 public bool Sensitive
1610 return (bool)GetValue(SensitiveProperty);
1614 SetValue(SensitiveProperty, value);
1615 NotifyPropertyChanged();
1620 /// 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.
1622 /// <since_tizen> 3 </since_tizen>
1623 public bool LeaveRequired
1627 return (bool)GetValue(LeaveRequiredProperty);
1631 SetValue(LeaveRequiredProperty, value);
1632 NotifyPropertyChanged();
1637 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1639 /// <since_tizen> 3 </since_tizen>
1640 public bool InheritOrientation
1644 return (bool)GetValue(InheritOrientationProperty);
1648 SetValue(InheritOrientationProperty, value);
1649 NotifyPropertyChanged();
1654 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1656 /// <since_tizen> 3 </since_tizen>
1657 public bool InheritScale
1661 return (bool)GetValue(InheritScaleProperty);
1665 SetValue(InheritScaleProperty, value);
1666 NotifyPropertyChanged();
1671 /// Gets or sets the status of how the view and its children should be drawn.<br />
1672 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1673 /// 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 />
1674 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1675 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1676 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1678 /// <since_tizen> 3 </since_tizen>
1679 public DrawModeType DrawMode
1683 return (DrawModeType)GetValue(DrawModeProperty);
1687 SetValue(DrawModeProperty, value);
1688 NotifyPropertyChanged();
1693 /// Gets or sets the relative to parent size factor of the view.<br />
1694 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1695 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1698 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1700 /// <since_tizen> 3 </since_tizen>
1701 [Obsolete("Deprecated. Since Tizen.NUI.ResizePolicyType is deprecated, SizeModeFactor is no longer supported. Instead, please use parent view having Tizen.NUI.RelativeLayout as its Layout.")]
1702 public Vector3 SizeModeFactor
1706 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1707 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1711 SetValue(SizeModeFactorProperty, value);
1712 NotifyPropertyChanged();
1717 /// Gets or sets the width resize policy to be used.
1719 /// <since_tizen> 3 </since_tizen>
1720 [Obsolete("Deprecated. Please set Layout and use WidthSpecification instead.")]
1721 public ResizePolicyType WidthResizePolicy
1725 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1729 SetValue(WidthResizePolicyProperty, value);
1730 NotifyPropertyChanged();
1735 /// Gets or sets the height resize policy to be used.
1737 /// <since_tizen> 3 </since_tizen>
1738 [Obsolete("Deprecated. Please set Layout and use HeightSpecification instead.")]
1739 public ResizePolicyType HeightResizePolicy
1743 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1747 SetValue(HeightResizePolicyProperty, value);
1748 NotifyPropertyChanged();
1753 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1754 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1756 /// <since_tizen> 3 </since_tizen>
1757 public SizeScalePolicyType SizeScalePolicy
1761 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1765 SetValue(SizeScalePolicyProperty, value);
1766 NotifyPropertyChanged();
1771 /// Gets or sets the status of whether the width size is dependent on the height size.
1773 /// <since_tizen> 3 </since_tizen>
1774 public bool WidthForHeight
1778 return (bool)GetValue(WidthForHeightProperty);
1782 SetValue(WidthForHeightProperty, value);
1783 NotifyPropertyChanged();
1788 /// Gets or sets the status of whether the height size is dependent on the width size.
1790 /// <since_tizen> 3 </since_tizen>
1791 public bool HeightForWidth
1795 return (bool)GetValue(HeightForWidthProperty);
1799 SetValue(HeightForWidthProperty, value);
1800 NotifyPropertyChanged();
1805 /// Gets or sets the padding for use in layout.
1808 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1810 /// <since_tizen> 5 </since_tizen>
1811 public Extents Padding
1815 // If View has a Layout then padding in stored in the base Layout class
1818 return Layout.Padding;
1822 Extents temp = (Extents)GetValue(PaddingProperty);
1823 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1825 // Two return points to prevent creating a zeroed Extent native object before assignment
1829 Extents padding = value;
1832 // Layout set so store Padding in LayoutItem instead of in View.
1833 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1834 // the position and sizes measure in the Layouting.
1835 Layout.Padding = value;
1836 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1837 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1838 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1840 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1844 SetValue(PaddingProperty, padding);
1845 NotifyPropertyChanged();
1850 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1852 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1854 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1856 /// <since_tizen> 3 </since_tizen>
1857 public Size2D MinimumSize
1861 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1862 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1868 throw new ArgumentNullException(nameof(value));
1872 // Note: it only works if minimum size is >= than natural size.
1873 // To force the size it should be done through the width&height spec or Size2D.
1874 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1875 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1876 layout.RequestLayout();
1878 SetValue(MinimumSizeProperty, value);
1879 NotifyPropertyChanged();
1884 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1887 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1889 /// <since_tizen> 3 </since_tizen>
1890 public Size2D MaximumSize
1894 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1895 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1899 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1900 // MATCH_PARENT spec + parent container size can be used to limit
1903 layout.RequestLayout();
1905 SetValue(MaximumSizeProperty, value);
1906 NotifyPropertyChanged();
1911 /// Gets or sets whether a child view inherits it's parent's position.<br />
1912 /// Default is to inherit.<br />
1913 /// 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 />
1915 /// <since_tizen> 3 </since_tizen>
1916 public bool InheritPosition
1920 return (bool)GetValue(InheritPositionProperty);
1924 SetValue(InheritPositionProperty, value);
1925 NotifyPropertyChanged();
1930 /// Gets or sets the clipping behavior (mode) of it's children.
1932 /// <since_tizen> 3 </since_tizen>
1933 public ClippingModeType ClippingMode
1937 return (ClippingModeType)GetValue(ClippingModeProperty);
1941 SetValue(ClippingModeProperty, value);
1942 NotifyPropertyChanged();
1947 /// Gets the number of renderers held by the view.
1949 /// <since_tizen> 3 </since_tizen>
1950 public uint RendererCount
1954 return GetRendererCount();
1959 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1962 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1964 /// <since_tizen> 3 </since_tizen>
1965 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1967 "View view = new View(); " +
1968 "view.PivotPoint = PivotPoint.Center; " +
1969 "view.PositionUsesPivotPoint = true;")]
1970 [EditorBrowsable(EditorBrowsableState.Never)]
1971 public Position AnchorPoint
1975 Position temp = new Position(0.0f, 0.0f, 0.0f);
1976 var pValue = GetProperty(View.Property.AnchorPoint);
1979 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1985 var temp = new Tizen.NUI.PropertyValue(value);
1986 SetProperty(View.Property.AnchorPoint, temp);
1988 NotifyPropertyChanged();
1993 /// Sets the size of a view for the width, the height and the depth.<br />
1994 /// Geometry can be scaled to fit within this area.<br />
1995 /// This does not interfere with the view's scale factor.<br />
1996 /// The views default depth is the minimum of width and height.<br />
2000 /// Animatable - This property can be animated using <c>Animation</c> class.
2002 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2004 /// <since_tizen> 5 </since_tizen>
2009 Size tmp = (Size)GetValue(SizeProperty);
2010 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2014 SetValue(SizeProperty, value);
2015 NotifyPropertyChanged();
2020 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2022 /// <since_tizen> 3 </since_tizen>
2023 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2025 "Container parent = view.GetParent(); " +
2026 "View view = parent as View;")]
2027 [EditorBrowsable(EditorBrowsableState.Never)]
2028 public new View Parent
2033 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2034 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2035 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2037 if (basehandle is Layer layer)
2039 ret = new View(Layer.getCPtr(layer).Handle, false);
2040 NUILog.Error("This Parent property is deprecated, should do not be used");
2044 ret = basehandle as View;
2047 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2048 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2050 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2056 /// Gets/Sets whether inherit parent's the layout Direction.
2058 /// <since_tizen> 4 </since_tizen>
2059 public bool InheritLayoutDirection
2063 return (bool)GetValue(InheritLayoutDirectionProperty);
2067 SetValue(InheritLayoutDirectionProperty, value);
2068 NotifyPropertyChanged();
2073 /// Gets/Sets the layout Direction.
2075 /// <since_tizen> 4 </since_tizen>
2076 public ViewLayoutDirectionType LayoutDirection
2080 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2084 SetValue(LayoutDirectionProperty, value);
2085 NotifyPropertyChanged();
2086 layout?.RequestLayout();
2091 /// Gets or sets the Margin for use in layout.
2094 /// Margin property is supported by Layout algorithms and containers.
2095 /// Please Set Layout if you want to use Margin property.
2096 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2098 /// <since_tizen> 4 </since_tizen>
2099 public Extents Margin
2103 // If View has a Layout then margin is stored in Layout.
2106 return Layout.Margin;
2110 // If Layout not set then return margin stored in View.
2111 Extents temp = (Extents)GetValue(MarginProperty);
2112 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2114 // Two return points to prevent creating a zeroed Extent native object before assignment
2120 // Layout set so store Margin in LayoutItem instead of View.
2121 // If View stores the Margin too then the Legacy Size Negotiation will
2122 // overwrite the position and size values measured in the Layouting.
2123 Layout.Margin = value;
2124 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2125 layout?.RequestLayout();
2129 SetValue(MarginProperty, value);
2131 NotifyPropertyChanged();
2132 layout?.RequestLayout();
2137 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2141 /// // matchParentView matches its size to its parent size.
2142 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2143 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2145 /// // wrapContentView wraps its children with their desired size.
2146 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2147 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2149 /// // exactSizeView shows itself with an exact size.
2150 /// exactSizeView.WidthSpecification = 100;
2151 /// exactSizeView.HeightSpecification = 100;
2154 /// <since_tizen> 6 </since_tizen>
2155 public int WidthSpecification
2163 if (value == widthPolicy)
2166 widthPolicy = value;
2167 if (widthPolicy >= 0)
2169 if (heightPolicy >= 0) // Policy an exact value
2171 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2172 Size2D = new Size2D(widthPolicy, heightPolicy);
2175 layout?.RequestLayout();
2180 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2184 /// // matchParentView matches its size to its parent size.
2185 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2186 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2188 /// // wrapContentView wraps its children with their desired size.
2189 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2190 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2192 /// // exactSizeView shows itself with an exact size.
2193 /// exactSizeView.WidthSpecification = 100;
2194 /// exactSizeView.HeightSpecification = 100;
2197 /// <since_tizen> 6 </since_tizen>
2198 public int HeightSpecification
2202 return heightPolicy;
2206 if (value == heightPolicy)
2209 heightPolicy = value;
2210 if (heightPolicy >= 0)
2212 if (widthPolicy >= 0) // Policy an exact value
2214 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2215 Size2D = new Size2D(widthPolicy, heightPolicy);
2218 layout?.RequestLayout();
2223 /// Gets the List of transitions for this View.
2225 /// <since_tizen> 6 </since_tizen>
2226 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2230 if (layoutTransitions == null)
2232 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2234 return layoutTransitions;
2239 /// Sets a layout transitions for this View.
2241 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2243 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2245 /// <since_tizen> 6 </since_tizen>
2246 public LayoutTransition LayoutTransition
2250 return layoutTransition;
2256 throw new global::System.ArgumentNullException(nameof(value));
2258 if (layoutTransitions == null)
2260 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2263 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2265 AttachTransitionsToChildren(value);
2267 layoutTransition = value;
2272 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2275 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2277 /// <since_tizen> 4 </since_tizen>
2278 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2279 [EditorBrowsable(EditorBrowsableState.Never)]
2280 public Extents PaddingEX
2284 Extents temp = new Extents(0, 0, 0, 0);
2285 var pValue = GetProperty(View.Property.PADDING);
2288 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2294 var temp = new Tizen.NUI.PropertyValue(value);
2295 SetProperty(View.Property.PADDING, temp);
2297 NotifyPropertyChanged();
2298 layout?.RequestLayout();
2303 /// The Color of View. This is an RGBA value.
2307 /// Animatable - This property can be animated using <c>Animation</c> class.
2309 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2311 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2312 [EditorBrowsable(EditorBrowsableState.Never)]
2317 Color temp = (Color)GetValue(ColorProperty);
2318 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2322 SetValue(ColorProperty, value);
2323 NotifyPropertyChanged();
2328 /// Set the layout on this View. Replaces any existing Layout.
2331 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2333 /// <since_tizen> 6 </since_tizen>
2334 public LayoutItem Layout
2342 // Do nothing if layout provided is already set on this View.
2343 if (value == layout)
2348 LayoutingDisabled = false;
2351 // If new layout being set already has a owner then that owner receives a replacement default layout.
2352 // First check if the layout to be set already has a owner.
2353 if (value?.Owner != null)
2355 // Previous owner of the layout gets a default layout as a replacement.
2356 value.Owner.Layout = new AbsoluteLayout();
2358 // Copy Margin and Padding to replacement LayoutGroup.
2359 if (value.Owner.Layout != null)
2361 value.Owner.Layout.Margin = value.Margin;
2362 value.Owner.Layout.Padding = value.Padding;
2366 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2367 // View if no replacement. Previously margin and padding values would have been moved from
2368 // the View to the layout.
2369 if (layout != null) // Existing layout
2373 // Existing layout being replaced so copy over margin and padding values.
2374 value.Margin = layout.Margin;
2375 value.Padding = layout.Padding;
2379 // Layout not being replaced so restore margin and padding to View.
2380 SetValue(MarginProperty, layout.Margin);
2381 SetValue(PaddingProperty, layout.Padding);
2382 NotifyPropertyChanged();
2387 // First Layout to be added to the View hence copy
2389 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2392 Extents margin = Margin;
2393 Extents padding = Padding;
2394 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2396 // If View already has a margin set then store it in Layout instead.
2397 value.Margin = margin;
2398 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2399 NotifyPropertyChanged();
2402 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2404 // If View already has a padding set then store it in Layout instead.
2405 value.Padding = padding;
2407 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2408 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2409 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2411 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2412 NotifyPropertyChanged();
2418 // Remove existing layout from it's parent layout group.
2421 value.SetPositionByLayout = !excludeLayouting;
2423 // Set layout to this view
2429 /// The weight of the View, used to share available space in a layout with siblings.
2431 /// <since_tizen> 6 </since_tizen>
2441 layout?.RequestLayout();
2446 /// Whether to load the BackgroundImage synchronously.
2447 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2448 /// Note: For Normal Quad images only.
2450 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2451 [EditorBrowsable(EditorBrowsableState.Never)]
2452 public bool BackgroundImageSynchronosLoading
2456 return backgroundImageSynchronosLoading;
2460 backgroundImageSynchronosLoading = value;
2462 string bgUrl = null;
2463 var pValue = Background.Find(ImageVisualProperty.URL);
2464 pValue?.Get(out bgUrl);
2467 if (!string.IsNullOrEmpty(bgUrl))
2469 PropertyMap bgMap = this.Background;
2470 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2471 bgMap.Add("synchronousLoading", temp);
2478 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2479 [EditorBrowsable(EditorBrowsableState.Never)]
2480 public Vector2 UpdateSizeHint
2484 return (Vector2)GetValue(UpdateSizeHintProperty);
2488 SetValue(UpdateSizeHintProperty, value);
2489 NotifyPropertyChanged();
2494 /// Enable/Disable ControlState propagation for children.
2495 /// It is false by default.
2496 /// If the View needs to share ControlState with descendants, please set it true.
2497 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2499 [EditorBrowsable(EditorBrowsableState.Never)]
2500 public bool EnableControlStatePropagation
2502 get => themeData?.ControlStatePropagation ?? false;
2505 if (EnableControlStatePropagation == value) return;
2507 if (themeData == null) themeData = new ThemeData();
2509 themeData.ControlStatePropagation = value;
2511 foreach (View child in Children)
2513 child.EnableControlStatePropagation = value;
2519 /// By default, it is false in View, true in Control.
2520 /// Note that if the value is true, the View will be a touch receptor.
2522 [EditorBrowsable(EditorBrowsableState.Never)]
2523 public bool EnableControlState
2527 return (bool)GetValue(EnableControlStateProperty);
2531 SetValue(EnableControlStateProperty, value);
2536 /// Whether the actor grab all touches even if touch leaves its boundary.
2538 /// <returns>true, if it grab all touch after start</returns>
2539 [EditorBrowsable(EditorBrowsableState.Never)]
2540 public bool GrabTouchAfterLeave
2545 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2546 pValue.Get(out temp);
2552 var temp = new Tizen.NUI.PropertyValue(value);
2553 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2555 NotifyPropertyChanged();
2560 /// Determines which blend equation will be used to render renderers of this actor.
2562 /// <returns>blend equation enum currently assigned</returns>
2563 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2564 [EditorBrowsable(EditorBrowsableState.Never)]
2565 public BlendEquationType BlendEquation
2570 var pValue = GetProperty(View.Property.BlendEquation);
2571 pValue.Get(out temp);
2573 return (BlendEquationType)temp;
2577 var temp = new Tizen.NUI.PropertyValue((int)value);
2578 SetProperty(View.Property.BlendEquation, temp);
2580 NotifyPropertyChanged();
2585 /// If the value is true, the View will change its style as the theme changes.
2586 /// The default value is false in normal case but it can be true when the NUIApplication is created with <see cref="NUIApplication.ThemeOptions.ThemeChangeSensitive"/>.
2588 /// <since_tizen> 9 </since_tizen>
2589 public bool ThemeChangeSensitive
2591 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2592 set => SetValue(ThemeChangeSensitiveProperty, value);
2596 /// Create Style, it is abstract function and must be override.
2598 [EditorBrowsable(EditorBrowsableState.Never)]
2599 protected virtual ViewStyle CreateViewStyle()
2601 return new ViewStyle();
2605 /// Called after the View's ControlStates changed.
2607 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2608 [EditorBrowsable(EditorBrowsableState.Never)]
2609 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2615 [EditorBrowsable(EditorBrowsableState.Never)]
2616 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2618 if (string.IsNullOrEmpty(styleName)) ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(GetType()));
2619 else ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(styleName));
2623 /// Apply style instance to the view.
2624 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2626 /// <since_tizen> 9 </since_tizen>
2627 public virtual void ApplyStyle(ViewStyle viewStyle)
2629 if (viewStyle == null || themeData?.viewStyle == viewStyle) return;
2631 if (themeData == null) themeData = new ThemeData();
2633 themeData.viewStyle = viewStyle;
2635 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2641 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2643 if (bindablePropertyOfView == null)
2648 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2649 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2651 foreach (var sourceProperty in dirtyStyleProperties)
2653 var sourceValue = viewStyle.GetValue(sourceProperty);
2655 if (sourceValue == null)
2660 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2662 if (destinationProperty != null)
2664 SetValue(destinationProperty, sourceValue);
2670 /// Get whether the View is culled or not.
2671 /// True means that the View is out of the view frustum.
2674 /// Hidden-API (Inhouse-API).
2676 [EditorBrowsable(EditorBrowsableState.Never)]
2682 var pValue = GetProperty(View.Property.Culled);
2683 pValue.Get(out temp);
2690 /// Set or Get TransitionOptions for the page transition.
2691 /// This property is used to define how this view will be transitioned during Page switching.
2693 /// <since_tizen> 9 </since_tizen>
2694 public TransitionOptions TransitionOptions
2698 transitionOptions = value;
2702 return transitionOptions;