2 * Copyright(c) 2022 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 backgroundImageSynchronousLoading = false;
46 private bool excludeLayouting = false;
47 private LayoutTransition layoutTransition;
48 private TransitionOptions transitionOptions = null;
49 private ThemeData themeData;
51 // List of constraints
52 private Constraint widthConstraint = null;
53 private Constraint heightConstraint = null;
55 private Size2D internalMaximumSize = null;
56 private Size2D internalMinimumSize = null;
57 private Extents internalMargin = null;
58 private Extents internalPadding = null;
59 private Vector3 internalSizeModeFactor = null;
60 private Vector2 internalCellIndex = null;
61 private Color internalBackgroundColor = null;
62 private Color internalColor = null;
63 private Position internalPivotPoint = null;
64 private Position internalPosition = null;
65 private Position2D internalPosition2D = null;
66 private Vector3 internalScale = null;
67 private Size internalSize = null;
68 private Size2D internalSize2D = null;
69 private int layoutCount = 0;
73 RegisterPropertyGroup(PositionProperty, positionPropertyGroup);
74 RegisterPropertyGroup(Position2DProperty, positionPropertyGroup);
75 RegisterPropertyGroup(PositionXProperty, positionPropertyGroup);
76 RegisterPropertyGroup(PositionYProperty, positionPropertyGroup);
78 RegisterPropertyGroup(SizeProperty, sizePropertyGroup);
79 RegisterPropertyGroup(Size2DProperty, sizePropertyGroup);
80 RegisterPropertyGroup(SizeWidthProperty, sizePropertyGroup);
81 RegisterPropertyGroup(SizeHeightProperty, sizePropertyGroup);
83 RegisterPropertyGroup(ScaleProperty, scalePropertyGroup);
84 RegisterPropertyGroup(ScaleXProperty, scalePropertyGroup);
85 RegisterPropertyGroup(ScaleYProperty, scalePropertyGroup);
86 RegisterPropertyGroup(ScaleZProperty, scalePropertyGroup);
88 RegisterAccessibilityDelegate();
92 /// Creates a new instance of a view.
94 /// <since_tizen> 3 </since_tizen>
95 public View() : this(Interop.View.New(), true)
97 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
100 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
101 [EditorBrowsable(EditorBrowsableState.Never)]
102 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
107 /// Create a new instance of a View with setting the status of shown or hidden.
109 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
110 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
111 [EditorBrowsable(EditorBrowsableState.Never)]
112 public View(bool shown) : this(Interop.View.New(), true)
114 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
118 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
126 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
129 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
131 InitializeStyle(viewStyle);
134 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
138 PositionUsesPivotPoint = false;
141 onWindowSendEventCallback = SendViewAddedEventToWindow;
142 using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(SwigCPtr), false);
143 signal?.Connect(onWindowSendEventCallback);
151 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
153 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162 /// The event that is triggered when the View's ControlState is changed.
164 [EditorBrowsable(EditorBrowsableState.Never)]
165 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
167 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
171 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
173 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
174 [EditorBrowsable(EditorBrowsableState.Never)]
175 public bool LayoutSet
184 /// Flag to allow Layouting to be disabled for Views.
185 /// Once a View has a Layout set then any children added to Views from then on will receive
186 /// automatic Layouts.
188 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
189 [EditorBrowsable(EditorBrowsableState.Never)]
190 public static bool LayoutingDisabled { get; set; } = true;
193 /// Deprecate. Please do not use this.
194 /// The style instance applied to this view.
195 /// Note that please do not modify the ViewStyle.
196 /// Modifying ViewStyle will affect other views with same ViewStyle.
198 [EditorBrowsable(EditorBrowsableState.Never)]
199 protected ViewStyle ViewStyle
203 if (themeData == null) themeData = new ThemeData();
205 if (themeData.viewStyle == null)
207 ApplyStyle(CreateViewStyle());
209 return themeData.viewStyle;
214 /// Get/Set the control state.
215 /// Note that the ControlState only available for the classes derived from Control.
216 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
217 /// please set <see cref="EnableControlState"/> to true.
219 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
220 [EditorBrowsable(EditorBrowsableState.Never)]
221 public ControlState ControlState
225 return themeData == null ? ControlState.Normal : themeData.controlStates;
229 if (ControlState == value)
234 var prevState = ControlState;
236 if (themeData == null) themeData = new ThemeData();
237 themeData.controlStates = value;
239 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
241 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
243 if (themeData.ControlStatePropagation)
245 foreach (View child in Children)
247 child.ControlState = value;
251 OnControlStateChanged(changeInfo);
253 ControlStateChangedEvent?.Invoke(this, changeInfo);
258 /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
260 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
261 [EditorBrowsable(EditorBrowsableState.Never)]
262 public bool ExcludeLayouting
266 return (bool)GetValue(ExcludeLayoutingProperty);
270 SetValue(ExcludeLayoutingProperty, value);
271 NotifyPropertyChanged();
275 private bool InternalExcludeLayouting
279 return excludeLayouting;
283 excludeLayouting = value;
284 if (Layout != null && Layout.SetPositionByLayout == value)
286 Layout.SetPositionByLayout = !value;
287 Layout.RequestLayout();
293 /// The StyleName, type string.
294 /// The value indicates DALi style name defined in json theme file.
296 /// <since_tizen> 3 </since_tizen>
297 public string StyleName
301 return (string)GetValue(StyleNameProperty);
305 SetValue(StyleNameProperty, value);
306 NotifyPropertyChanged();
311 /// The KeyInputFocus, type bool.
313 [EditorBrowsable(EditorBrowsableState.Never)]
314 public bool KeyInputFocus
318 return (bool)GetValue(KeyInputFocusProperty);
322 SetValue(KeyInputFocusProperty, value);
323 NotifyPropertyChanged();
328 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
332 /// The property cascade chaining set is not recommended.
335 /// Animatable - This property can be animated using <c>Animation</c> class.
337 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
342 /// This way is recommended for setting the property
344 /// var view = new View();
345 /// view.BackgroundColor = new Color(0.5f, 0.1f, 0, 1);
347 /// This way to set the property is prohibited
349 /// view.BackgroundColor.R = 0.5f; //This does not guarantee a proper operation
352 /// <since_tizen> 3 </since_tizen>
353 public Color BackgroundColor
357 return (Color)GetValue(BackgroundColorProperty);
361 SetValue(BackgroundColorProperty, value);
362 NotifyPropertyChanged();
367 /// The mutually exclusive with "backgroundColor" and "background" type Map.
369 /// <since_tizen> 3 </since_tizen>
370 public string BackgroundImage
374 return (string)GetValue(BackgroundImageProperty);
378 SetValue(BackgroundImageProperty, value);
379 NotifyPropertyChanged();
384 /// Get or set the border of background image.
386 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
387 [EditorBrowsable(EditorBrowsableState.Never)]
388 public Rectangle BackgroundImageBorder
392 return (Rectangle)GetValue(BackgroundImageBorderProperty);
396 SetValue(BackgroundImageBorderProperty, value);
397 NotifyPropertyChanged();
402 /// The background of view.
404 /// <since_tizen> 3 </since_tizen>
405 public Tizen.NUI.PropertyMap Background
409 return (PropertyMap)GetValue(BackgroundProperty);
413 SetValue(BackgroundProperty, value);
414 NotifyPropertyChanged();
419 /// Describes a shadow as an image for a View.
420 /// It is null by default.
423 /// Getter returns copied instance of current shadow.
426 /// The mutually exclusive with "BoxShadow".
430 /// Animatable - This property can be animated using <c>Animation</c> class.
431 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
433 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
435 /// Animatable sub-property : Offset.
438 [EditorBrowsable(EditorBrowsableState.Never)]
439 public ImageShadow ImageShadow
443 return (ImageShadow)GetValue(ImageShadowProperty);
447 SetValue(ImageShadowProperty, value);
448 NotifyPropertyChanged();
453 /// Describes a box shaped shadow drawing for a View.
454 /// It is null by default.
457 /// The mutually exclusive with "ImageShadow".
461 /// Animatable - This property can be animated using <c>Animation</c> class.
462 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
464 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
466 /// Animatable sub-property : Offset, Color, BlurRadius.
469 /// <since_tizen> 9 </since_tizen>
470 public Shadow BoxShadow
474 return (Shadow)GetValue(BoxShadowProperty);
478 SetValue(BoxShadowProperty, value);
479 NotifyPropertyChanged();
484 /// The radius for the rounded corners of the View.
485 /// This will rounds background and shadow edges.
486 /// 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).
487 /// Each radius will clamp internally to the half of smaller of the view's width or height.
488 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
492 /// Animatable - This property can be animated using <c>Animation</c> class.
494 /// animation.AnimateTo(view, "CornerRadius", new Vector4(10, 10, 10, 10));
498 /// <since_tizen> 9 </since_tizen>
499 public Vector4 CornerRadius
503 return (Vector4)GetValue(CornerRadiusProperty);
507 SetValue(CornerRadiusProperty, value);
508 NotifyPropertyChanged();
513 /// Whether the CornerRadius property value is relative (percentage [0.0f to 0.5f] of the view size) or absolute (in world units).
514 /// It is absolute by default.
515 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
517 /// <since_tizen> 9 </since_tizen>
518 public VisualTransformPolicyType CornerRadiusPolicy
520 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
521 set => SetValue(CornerRadiusPolicyProperty, value);
525 /// The width for the borderline of the View.
529 /// Animatable - This property can be animated using <c>Animation</c> class.
531 /// animation.AnimateTo(view, "BorderlineWidth", 100.0f);
534 /// Note that, an image background may not have borderline if it uses the Border property.
536 /// <since_tizen> 9 </since_tizen>
537 public float BorderlineWidth
541 return (float)GetValue(BorderlineWidthProperty);
545 SetValue(BorderlineWidthProperty, value);
546 NotifyPropertyChanged();
551 /// The color for the borderline of the View.
552 /// It is Color.Black by default.
556 /// Animatable - This property can be animated using <c>Animation</c> class.
558 /// animation.AnimateTo(view, "BorderlineColor", new Color(r, g, b, a));
562 /// <since_tizen> 9 </since_tizen>
563 public Color BorderlineColor
567 return (Color)GetValue(BorderlineColorProperty);
571 SetValue(BorderlineColorProperty, value);
572 NotifyPropertyChanged();
577 /// The Relative offset for the borderline of the View.
578 /// Recommended range : [-1.0f to 1.0f].
579 /// If -1.0f, draw borderline inside of the View.
580 /// If 1.0f, draw borderline outside of the View.
581 /// If 0.0f, draw borderline half inside and half outside.
582 /// It is 0.0f by default.
586 /// Animatable - This property can be animated using <c>Animation</c> class.
588 /// animation.AnimateTo(view, "BorderlineOffset", -1.0f);
592 /// <since_tizen> 9 </since_tizen>
593 public float BorderlineOffset
597 return (float)GetValue(BorderlineOffsetProperty);
601 SetValue(BorderlineOffsetProperty, value);
602 NotifyPropertyChanged();
607 /// The current state of the view.
609 /// <since_tizen> 3 </since_tizen>
614 return (States)GetValue(StateProperty);
618 SetValue(StateProperty, value);
619 NotifyPropertyChanged();
624 /// The current sub state of the view.
626 /// <since_tizen> 3 </since_tizen>
627 public States SubState
631 return (States)GetValue(SubStateProperty);
635 SetValue(SubStateProperty, value);
636 NotifyPropertyChanged();
641 /// Displays a tooltip
643 /// <since_tizen> 3 </since_tizen>
644 public Tizen.NUI.PropertyMap Tooltip
648 return (PropertyMap)GetValue(TooltipProperty);
652 SetValue(TooltipProperty, value);
653 NotifyPropertyChanged();
658 /// Displays a tooltip as a text.
660 /// <since_tizen> 3 </since_tizen>
661 public string TooltipText
665 return GetValue(TooltipTextProperty) as string;
669 SetValue(TooltipTextProperty, value);
673 private string InternalTooltipText
677 using (var propertyValue = GetProperty(Property.TOOLTIP))
679 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
681 return retrivedValue;
683 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
684 return "error to get TooltipText";
689 var temp = new Tizen.NUI.PropertyValue(value);
690 SetProperty(View.Property.TOOLTIP, temp);
692 NotifyPropertyChanged();
697 /// The Child property of FlexContainer.<br />
698 /// The proportion of the free space in the container, the flex item will receive.<br />
699 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
701 /// <since_tizen> 3 </since_tizen>
702 [Obsolete("Deprecated in API8, will be removed in API10.")]
707 return (float)GetValue(FlexProperty);
711 SetValue(FlexProperty, value);
712 NotifyPropertyChanged();
717 /// The Child property of FlexContainer.<br />
718 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
720 /// <since_tizen> 3 </since_tizen>
721 [Obsolete("Deprecated in API8, will be removed in API10.")]
726 return (int)GetValue(AlignSelfProperty);
730 SetValue(AlignSelfProperty, value);
731 NotifyPropertyChanged();
736 /// The Child property of FlexContainer.<br />
737 /// The space around the flex item.<br />
740 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
742 /// <since_tizen> 3 </since_tizen>
743 [Obsolete("Deprecated in API8, will be removed in API10.")]
744 public Vector4 FlexMargin
748 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
749 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
753 SetValue(FlexMarginProperty, value);
754 NotifyPropertyChanged();
759 /// The top-left cell this child occupies, if not set, the first available cell is used.
762 /// The property cascade chaining set is not recommended.
763 /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
766 /// This way is recommended for setting the property
768 /// var view = new View();
769 /// view.CellIndex = new Vector2(1, 3);
771 /// This way to set the property is prohibited
773 /// view.CellIndex.X = 1; //This does not guarantee a proper operation
776 /// <since_tizen> 3 </since_tizen>
777 public Vector2 CellIndex
781 return (Vector2)GetValue(CellIndexProperty);
785 SetValue(CellIndexProperty, value);
786 NotifyPropertyChanged();
791 /// The number of rows this child occupies, if not set, the default value is 1.
794 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
796 /// <since_tizen> 3 </since_tizen>
801 return (float)GetValue(RowSpanProperty);
805 SetValue(RowSpanProperty, value);
806 NotifyPropertyChanged();
811 /// The number of columns this child occupies, if not set, the default value is 1.
814 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
816 /// <since_tizen> 3 </since_tizen>
817 public float ColumnSpan
821 return (float)GetValue(ColumnSpanProperty);
825 SetValue(ColumnSpanProperty, value);
826 NotifyPropertyChanged();
831 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
834 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
836 /// <since_tizen> 3 </since_tizen>
837 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
841 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
845 SetValue(CellHorizontalAlignmentProperty, value);
846 NotifyPropertyChanged();
851 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
854 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
856 /// <since_tizen> 3 </since_tizen>
857 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
861 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
865 SetValue(CellVerticalAlignmentProperty, value);
866 NotifyPropertyChanged();
871 /// The left focusable view.<br />
872 /// This will return null if not set.<br />
873 /// This will also return null if the specified left focusable view is not on a window.<br />
875 /// <since_tizen> 3 </since_tizen>
876 public View LeftFocusableView
878 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
881 return (View)GetValue(LeftFocusableViewProperty);
885 SetValue(LeftFocusableViewProperty, value);
886 NotifyPropertyChanged();
891 /// The right focusable view.<br />
892 /// This will return null if not set.<br />
893 /// This will also return null if the specified right focusable view is not on a window.<br />
895 /// <since_tizen> 3 </since_tizen>
896 public View RightFocusableView
898 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
901 return (View)GetValue(RightFocusableViewProperty);
905 SetValue(RightFocusableViewProperty, value);
906 NotifyPropertyChanged();
911 /// The up focusable view.<br />
912 /// This will return null if not set.<br />
913 /// This will also return null if the specified up focusable view is not on a window.<br />
915 /// <since_tizen> 3 </since_tizen>
916 public View UpFocusableView
918 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
921 return (View)GetValue(UpFocusableViewProperty);
925 SetValue(UpFocusableViewProperty, value);
926 NotifyPropertyChanged();
931 /// The down focusable view.<br />
932 /// This will return null if not set.<br />
933 /// This will also return null if the specified down focusable view is not on a window.<br />
935 /// <since_tizen> 3 </since_tizen>
936 public View DownFocusableView
938 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
941 return (View)GetValue(DownFocusableViewProperty);
945 SetValue(DownFocusableViewProperty, value);
946 NotifyPropertyChanged();
951 /// Whether the view should be focusable by keyboard navigation.
953 /// <since_tizen> 3 </since_tizen>
954 public bool Focusable
958 SetValue(FocusableProperty, value);
959 NotifyPropertyChanged();
963 return (bool)GetValue(FocusableProperty);
968 /// Whether the children of this view can be focusable by keyboard navigation. If user sets this to false, the children of this actor view will not be focused.
969 /// Note : Default value is true.
971 [EditorBrowsable(EditorBrowsableState.Never)]
972 public bool FocusableChildren
976 SetValue(FocusableChildrenProperty, value);
977 NotifyPropertyChanged();
981 return (bool)GetValue(FocusableChildrenProperty);
986 /// Whether this view can focus by touch.
987 /// If Focusable is false, FocusableInTouch is disabled.
988 /// If you want to have focus on touch, you need to set both Focusable and FocusableInTouch settings to true.
990 [EditorBrowsable(EditorBrowsableState.Never)]
991 public bool FocusableInTouch
995 SetValue(FocusableInTouchProperty, value);
996 NotifyPropertyChanged();
1000 return (bool)GetValue(FocusableInTouchProperty);
1005 /// Retrieves the position of the view.<br />
1006 /// The coordinates are relative to the view's parent.<br />
1008 /// <since_tizen> 3 </since_tizen>
1009 public Position CurrentPosition
1013 return GetCurrentPosition();
1018 /// Sets the size of a view for the width and the height.<br />
1019 /// Geometry can be scaled to fit within this area.<br />
1020 /// This does not interfere with the view's scale factor.<br />
1021 /// The views default depth is the minimum of width and height.<br />
1024 /// The property cascade chaining set is not recommended.
1027 /// This way is recommended for setting the property
1029 /// var view = new View();
1030 /// view.Size2D = new Size2D(100, 200);
1032 /// This way to set the property is prohibited
1034 /// view.Size2D.Width = 100; //This does not guarantee a proper operation
1037 /// <since_tizen> 3 </since_tizen>
1038 public Size2D Size2D
1042 var temp = (Size2D)GetValue(Size2DProperty);
1044 if (this.Layout == null)
1046 if (temp.Width < 0) { temp.Width = 0; }
1047 if (temp.Height < 0) { temp.Height = 0; }
1054 SetValue(Size2DProperty, value);
1056 NotifyPropertyChanged();
1061 /// Retrieves the size of the view.<br />
1062 /// The coordinates are relative to the view's parent.<br />
1064 /// <since_tizen> 3 </since_tizen>
1065 public Size2D CurrentSize
1069 return GetCurrentSize();
1074 /// Retrieves and sets the view's opacity.<br />
1078 /// Animatable - This property can be animated using <c>Animation</c> class.
1080 /// animation.AnimateTo(view, "Opacity", 0.5f);
1084 /// <since_tizen> 3 </since_tizen>
1085 public float Opacity
1089 return (float)GetValue(OpacityProperty);
1093 SetValue(OpacityProperty, value);
1094 NotifyPropertyChanged();
1099 /// Sets the position of the view for X and Y.<br />
1100 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1101 /// If the position inheritance is disabled, sets the world position.<br />
1104 /// The property cascade chaining set is not recommended.
1107 /// This way is recommended for setting the property
1109 /// var view = new View();
1110 /// view.Position2D = new Position2D(100, 200);
1112 /// This way to set the property is prohibited
1114 /// view.Position2D.X = 100; //This does not guarantee a proper operation
1117 /// <since_tizen> 3 </since_tizen>
1118 public Position2D Position2D
1122 return (Position2D)GetValue(Position2DProperty);
1126 SetValue(Position2DProperty, value);
1127 NotifyPropertyChanged();
1132 /// Retrieves the screen position of the view.<br />
1134 /// <since_tizen> 3 </since_tizen>
1135 public Vector2 ScreenPosition
1139 Vector2 temp = new Vector2(0.0f, 0.0f);
1140 var pValue = GetProperty(View.Property.ScreenPosition);
1148 /// Determines whether the pivot point should be used to determine the position of the view.
1149 /// This is false by default.
1151 /// <remarks>If false, then the top-left of the view is used for the position.
1152 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1154 /// <since_tizen> 3 </since_tizen>
1155 public bool PositionUsesPivotPoint
1159 return (bool)GetValue(PositionUsesPivotPointProperty);
1163 SetValue(PositionUsesPivotPointProperty, value);
1164 NotifyPropertyChanged();
1169 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1171 /// <since_tizen> 3 </since_tizen>
1172 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1174 "View view = new View(); " +
1175 "view.PivotPoint = PivotPoint.Center; " +
1176 "view.PositionUsesPivotPoint = true;" +
1177 " Deprecated in API5: Will be removed in API8")]
1178 [EditorBrowsable(EditorBrowsableState.Never)]
1179 public bool PositionUsesAnchorPoint
1183 return (bool)GetValue(PositionUsesAnchorPointProperty);
1187 SetValue(PositionUsesAnchorPointProperty, value);
1191 private bool InternalPositionUsesAnchorPoint
1196 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1197 pValue.Get(out temp);
1203 var temp = new Tizen.NUI.PropertyValue(value);
1204 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1206 NotifyPropertyChanged();
1211 /// Queries whether the view is connected to the stage.<br />
1212 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1214 /// <since_tizen> 3 </since_tizen>
1215 public bool IsOnWindow
1224 /// Gets the depth in the hierarchy for the view.
1226 /// <since_tizen> 3 </since_tizen>
1227 public int HierarchyDepth
1231 return GetHierarchyDepth();
1236 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1239 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1240 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1241 /// The values set by this property will likely change.
1243 /// <since_tizen> 3 </since_tizen>
1244 public int SiblingOrder
1248 return (int)GetValue(SiblingOrderProperty);
1252 SetValue(SiblingOrderProperty, value);
1254 Layout?.ChangeLayoutSiblingOrder(value);
1256 NotifyPropertyChanged();
1261 /// Returns the natural size of the view.
1264 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1266 /// <since_tizen> 5 </since_tizen>
1267 public Vector3 NaturalSize
1271 Vector3 ret = GetNaturalSize();
1272 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1278 /// Returns the natural size (Size2D) of the view.
1281 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1283 /// <since_tizen> 4 </since_tizen>
1284 public Size2D NaturalSize2D
1288 Vector3 temp = GetNaturalSize();
1289 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1291 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1298 /// Gets or sets the origin of a view within its parent's area.<br />
1299 /// 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 />
1300 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1301 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1303 /// <pre>The view has been initialized.</pre>
1304 /// <since_tizen> 3 </since_tizen>
1305 public Position ParentOrigin
1309 Position tmp = (Position)GetValue(ParentOriginProperty);
1310 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1314 SetValue(ParentOriginProperty, value);
1315 NotifyPropertyChanged();
1320 /// Gets or sets the anchor-point of a view.<br />
1321 /// 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 />
1322 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1323 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1324 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1325 /// <pre>The view has been initialized.</pre>
1328 /// The property cascade chaining set is not recommended.
1331 /// This way is recommended for setting the property
1333 /// var view = new View();
1334 /// view.PivotPoint = PivotPoint.Center;
1336 /// This way to set the property is prohibited
1338 /// view.PivotPoint.X = 0.5f; //This does not guarantee a proper operation
1341 /// <since_tizen> 3 </since_tizen>
1342 public Position PivotPoint
1346 return (Position)GetValue(PivotPointProperty);
1350 SetValue(PivotPointProperty, value);
1351 NotifyPropertyChanged();
1356 /// Gets or sets the size width of the view.
1360 /// Animatable - This property can be animated using <c>Animation</c> class.
1362 /// animation.AnimateTo(view, "SizeWidth", 500.0f);
1366 /// <since_tizen> 3 </since_tizen>
1367 public float SizeWidth
1371 return (float)GetValue(SizeWidthProperty);
1375 SetValue(SizeWidthProperty, value);
1376 NotifyPropertyChanged();
1381 /// Gets or sets the size height of the view.
1385 /// Animatable - This property can be animated using <c>Animation</c> class.
1388 /// animation.AnimateTo(view, "SizeHeight", 500.0f);
1391 /// <since_tizen> 3 </since_tizen>
1392 public float SizeHeight
1396 return (float)GetValue(SizeHeightProperty);
1400 SetValue(SizeHeightProperty, value);
1401 NotifyPropertyChanged();
1406 /// Gets or sets the position of the view.<br />
1407 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1408 /// If the position inheritance is disabled, sets the world position.<br />
1412 /// Animatable - This property can be animated using <c>Animation</c> class.
1414 /// animation.AnimateTo(view, "Position", new Position(50, 0));
1417 /// The property cascade chaining set is not recommended.
1420 /// This way is recommended for setting the property
1422 /// var view = new View();
1423 /// view.Position = new Position(100, 200.5f, 0);
1425 /// This way to set the property is prohibited
1427 /// view.Position.Y = 200.5f; //This does not guarantee a proper operation
1430 /// <since_tizen> 3 </since_tizen>
1431 public Position Position
1435 return (Position)GetValue(PositionProperty);
1439 SetValue(PositionProperty, value);
1440 NotifyPropertyChanged();
1445 /// Gets or sets the position X of the view.
1449 /// Animatable - This property can be animated using <c>Animation</c> class.
1451 /// animation.AnimateTo(view, "PositionX", 50.0f);
1455 /// <since_tizen> 3 </since_tizen>
1456 public float PositionX
1460 return (float)GetValue(PositionXProperty);
1464 SetValue(PositionXProperty, value);
1465 NotifyPropertyChanged();
1470 /// Gets or sets the position Y of the view.
1474 /// Animatable - This property can be animated using <c>Animation</c> class.
1476 /// animation.AnimateTo(view, "PositionY", 50.0f);
1480 /// <since_tizen> 3 </since_tizen>
1481 public float PositionY
1485 return (float)GetValue(PositionYProperty);
1489 SetValue(PositionYProperty, value);
1490 NotifyPropertyChanged();
1495 /// Gets or sets the position Z of the view.
1499 /// Animatable - This property can be animated using <c>Animation</c> class.
1501 /// animation.AnimateTo(view, "PositionZ", 50.0f);
1505 /// <since_tizen> 3 </since_tizen>
1506 public float PositionZ
1510 return (float)GetValue(PositionZProperty);
1514 SetValue(PositionZProperty, value);
1515 NotifyPropertyChanged();
1520 /// Gets or sets the world position of the view.
1522 /// <since_tizen> 3 </since_tizen>
1523 public Vector3 WorldPosition
1527 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1528 var pValue = GetProperty(View.Property.WorldPosition);
1536 /// Gets or sets the orientation of the view.<br />
1537 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1541 /// This is an asynchronous method.
1544 /// Animatable - This property can be animated using <c>Animation</c> class.
1546 /// animation.AnimateTo(view, "Orientation", new Rotation(new Radian((float)Math.PI), Vector3.XAxis));
1550 /// <since_tizen> 3 </since_tizen>
1551 public Rotation Orientation
1555 return (Rotation)GetValue(OrientationProperty);
1559 SetValue(OrientationProperty, value);
1560 NotifyPropertyChanged();
1565 /// Gets or sets the world orientation of the view.<br />
1567 /// <since_tizen> 3 </since_tizen>
1568 public Rotation WorldOrientation
1572 Rotation temp = new Rotation();
1573 var pValue = GetProperty(View.Property.WorldOrientation);
1581 /// Gets or sets the scale factor applied to the view.<br />
1585 /// Animatable - This property can be animated using <c>Animation</c> class.
1587 /// animation.AnimateTo(view, "Scale", new Vector3(1.5f, 1.5f, 1.0f));
1590 /// The property cascade chaining set is not recommended.
1593 /// This way is recommended for setting the property
1595 /// var view = new View();
1596 /// view.Scale = new Vector3(1.5f, 2.0f, 1.0f);
1598 /// This way to set the property is prohibited
1600 /// view.Scale.Width = 1.5f; //This does not guarantee a proper operation
1603 /// <since_tizen> 3 </since_tizen>
1604 public Vector3 Scale
1608 return (Vector3)GetValue(ScaleProperty);
1612 SetValue(ScaleProperty, value);
1613 NotifyPropertyChanged();
1618 /// Gets or sets the scale X factor applied to the view.
1622 /// Animatable - This property can be animated using <c>Animation</c> class.
1624 /// animation.AnimateTo(view, "ScaleX", 1.5f);
1628 /// <since_tizen> 3 </since_tizen>
1633 return (float)GetValue(ScaleXProperty);
1637 SetValue(ScaleXProperty, value);
1638 NotifyPropertyChanged();
1643 /// Gets or sets the scale Y factor applied to the view.
1647 /// Animatable - This property can be animated using <c>Animation</c> class.
1649 /// animation.AnimateTo(view, "ScaleY", 1.5f);
1653 /// <since_tizen> 3 </since_tizen>
1658 return (float)GetValue(ScaleYProperty);
1662 SetValue(ScaleYProperty, value);
1663 NotifyPropertyChanged();
1668 /// Gets or sets the scale Z factor applied to the view.
1672 /// Animatable - This property can be animated using <c>Animation</c> class.
1674 /// animation.AnimateTo(view, "ScaleZ", 1.5f);
1678 /// <since_tizen> 3 </since_tizen>
1683 return (float)GetValue(ScaleZProperty);
1687 SetValue(ScaleZProperty, value);
1688 NotifyPropertyChanged();
1693 /// Gets the world scale of the view.
1695 /// <since_tizen> 3 </since_tizen>
1696 public Vector3 WorldScale
1700 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1701 var pValue = GetProperty(View.Property.WorldScale);
1709 /// Retrieves the visibility flag of the view.
1713 /// If the view is not visible, then the view and its children will not be rendered.
1714 /// 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.
1717 /// Animatable - This property can be animated using <c>Animation</c> class.
1719 /// animation.AnimateTo(view, "Visibility", false);
1723 /// <since_tizen> 3 </since_tizen>
1724 public bool Visibility
1729 var pValue = GetProperty(View.Property.VISIBLE);
1730 pValue.Get(out temp);
1737 /// Gets the view's world color.
1739 /// <since_tizen> 3 </since_tizen>
1740 public Vector4 WorldColor
1744 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1745 var pValue = GetProperty(View.Property.WorldColor);
1753 /// Gets or sets the view's name.
1755 /// <since_tizen> 3 </since_tizen>
1760 return (string)GetValue(NameProperty);
1764 SetValue(NameProperty, value);
1765 NotifyPropertyChanged();
1770 /// Get the number of children held by the view.
1772 /// <since_tizen> 3 </since_tizen>
1773 public new uint ChildCount
1777 return Convert.ToUInt32(Children.Count);
1782 /// Gets the view's ID.
1785 /// <since_tizen> 3 </since_tizen>
1795 /// Gets or sets the status of whether the view should emit touch or hover signals.
1796 /// If a View is made insensitive, then the View and its children are not hittable.
1798 /// <since_tizen> 3 </since_tizen>
1799 public bool Sensitive
1803 return (bool)GetValue(SensitiveProperty);
1807 SetValue(SensitiveProperty, value);
1808 NotifyPropertyChanged();
1813 /// 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.
1815 /// <since_tizen> 3 </since_tizen>
1816 public bool LeaveRequired
1820 return (bool)GetValue(LeaveRequiredProperty);
1824 SetValue(LeaveRequiredProperty, value);
1825 NotifyPropertyChanged();
1830 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1832 /// <since_tizen> 3 </since_tizen>
1833 public bool InheritOrientation
1837 return (bool)GetValue(InheritOrientationProperty);
1841 SetValue(InheritOrientationProperty, value);
1842 NotifyPropertyChanged();
1847 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1849 /// <since_tizen> 3 </since_tizen>
1850 public bool InheritScale
1854 return (bool)GetValue(InheritScaleProperty);
1858 SetValue(InheritScaleProperty, value);
1859 NotifyPropertyChanged();
1864 /// Gets or sets the status of how the view and its children should be drawn.<br />
1865 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1866 /// 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 />
1867 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1868 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1869 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1871 /// <since_tizen> 3 </since_tizen>
1872 public DrawModeType DrawMode
1876 return (DrawModeType)GetValue(DrawModeProperty);
1880 SetValue(DrawModeProperty, value);
1881 NotifyPropertyChanged();
1886 /// Gets or sets the relative to parent size factor of the view.<br />
1887 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1888 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1891 /// The property cascade chaining set is not recommended.
1894 /// This way is recommended for setting the property
1896 /// var text = new TextField();
1897 /// text.SizeModeFactor = new Vector3(1.0f, 0.45f, 1.0f);
1899 /// This way to set the property is prohibited
1901 /// text.SizeModeFactor.Width = 1.0f; //This does not guarantee a proper operation
1904 /// <since_tizen> 3 </since_tizen>
1905 public Vector3 SizeModeFactor
1909 return (Vector3)GetValue(SizeModeFactorProperty);
1913 SetValue(SizeModeFactorProperty, value);
1914 NotifyPropertyChanged();
1919 /// Gets or sets the width resize policy to be used.
1921 /// <since_tizen> 3 </since_tizen>
1922 public ResizePolicyType WidthResizePolicy
1926 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1930 SetValue(WidthResizePolicyProperty, value);
1931 NotifyPropertyChanged();
1936 /// Gets or sets the height resize policy to be used.
1938 /// <since_tizen> 3 </since_tizen>
1939 public ResizePolicyType HeightResizePolicy
1943 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1947 SetValue(HeightResizePolicyProperty, value);
1948 NotifyPropertyChanged();
1953 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1954 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1956 /// <since_tizen> 3 </since_tizen>
1957 public SizeScalePolicyType SizeScalePolicy
1961 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1965 SetValue(SizeScalePolicyProperty, value);
1966 NotifyPropertyChanged();
1971 /// Gets or sets the status of whether the width size is dependent on the height size.
1973 /// <since_tizen> 3 </since_tizen>
1974 public bool WidthForHeight
1978 return (bool)GetValue(WidthForHeightProperty);
1982 SetValue(WidthForHeightProperty, value);
1983 NotifyPropertyChanged();
1988 /// Gets or sets the status of whether the height size is dependent on the width size.
1990 /// <since_tizen> 3 </since_tizen>
1991 public bool HeightForWidth
1995 return (bool)GetValue(HeightForWidthProperty);
1999 SetValue(HeightForWidthProperty, value);
2000 NotifyPropertyChanged();
2005 /// Gets or sets the padding for use in layout.
2008 /// The property cascade chaining set is not recommended.
2011 /// This way is recommended for setting the property
2013 /// var view = new View();
2014 /// view.Padding = new Extents(5, 5, 5, 5);
2016 /// This way to set the property is prohibited
2018 /// view.Padding.Start = 5; //This does not guarantee a proper operation
2021 /// <since_tizen> 5 </since_tizen>
2022 public Extents Padding
2026 // If View has a Layout then padding in stored in the base Layout class
2029 return Layout.Padding;
2033 return (Extents)GetValue(PaddingProperty);
2035 // Two return points to prevent creating a zeroed Extent native object before assignment
2039 Extents padding = value;
2042 // Layout set so store Padding in LayoutItem instead of in View.
2043 // If View stores the Padding value then Legacy Size Negotiation will overwrite
2044 // the position and sizes measure in the Layouting.
2045 Layout.Padding = value;
2046 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2047 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2048 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
2050 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
2054 SetValue(PaddingProperty, padding);
2055 NotifyPropertyChanged();
2060 /// Gets or sets the minimum size the view can be assigned in size negotiation.
2062 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2064 /// The property cascade chaining set is not recommended.
2067 /// This way is recommended for setting the property
2069 /// var view = new View();
2070 /// view.MinimumSize = new Size2D(100, 200);
2072 /// This way to set the property is prohibited
2074 /// view.MinimumSize.Width = 100; //This does not guarantee a proper operation
2077 /// <since_tizen> 3 </since_tizen>
2078 public Size2D MinimumSize
2082 return (Size2D)GetValue(MinimumSizeProperty);
2088 throw new ArgumentNullException(nameof(value));
2092 // Note: it only works if minimum size is >= than natural size.
2093 // To force the size it should be done through the width&height spec or Size2D.
2094 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
2095 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
2096 layout.RequestLayout();
2098 SetValue(MinimumSizeProperty, value);
2099 NotifyPropertyChanged();
2104 /// Gets or sets the maximum size the view can be assigned in size negotiation.
2107 /// This way is recommended for setting the property
2109 /// var view = new View();
2110 /// view.MaximumSize = new Size2D(100, 200);
2112 /// This way to set the property is prohibited
2114 /// view.MaximumSize.Height = 200; //This does not guarantee a proper operation
2117 /// <since_tizen> 3 </since_tizen>
2118 public Size2D MaximumSize
2122 return (Size2D)GetValue(MaximumSizeProperty);
2126 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
2127 // MATCH_PARENT spec + parent container size can be used to limit
2130 layout.RequestLayout();
2132 SetValue(MaximumSizeProperty, value);
2133 NotifyPropertyChanged();
2138 /// Gets or sets whether a child view inherits it's parent's position.<br />
2139 /// Default is to inherit.<br />
2140 /// 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 />
2142 /// <since_tizen> 3 </since_tizen>
2143 public bool InheritPosition
2147 return (bool)GetValue(InheritPositionProperty);
2151 SetValue(InheritPositionProperty, value);
2152 NotifyPropertyChanged();
2157 /// Gets or sets the clipping behavior (mode) of it's children.
2159 /// <since_tizen> 3 </since_tizen>
2160 public ClippingModeType ClippingMode
2164 return (ClippingModeType)GetValue(ClippingModeProperty);
2168 SetValue(ClippingModeProperty, value);
2169 NotifyPropertyChanged();
2174 /// Gets the number of renderers held by the view.
2176 /// <since_tizen> 3 </since_tizen>
2177 public uint RendererCount
2181 return GetRendererCount();
2186 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2189 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2191 /// <since_tizen> 3 </since_tizen>
2192 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2194 "View view = new View(); " +
2195 "view.PivotPoint = PivotPoint.Center; " +
2196 "view.PositionUsesPivotPoint = true;")]
2197 [EditorBrowsable(EditorBrowsableState.Never)]
2198 public Position AnchorPoint
2202 return GetValue(AnchorPointProperty) as Position;
2206 SetValue(AnchorPointProperty, value);
2210 private Position InternalAnchorPoint
2214 Position temp = new Position(0.0f, 0.0f, 0.0f);
2215 var pValue = GetProperty(View.Property.AnchorPoint);
2218 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2224 var temp = new Tizen.NUI.PropertyValue(value);
2225 SetProperty(View.Property.AnchorPoint, temp);
2227 NotifyPropertyChanged();
2232 /// Sets the size of a view for the width, the height and the depth.<br />
2233 /// Geometry can be scaled to fit within this area.<br />
2234 /// This does not interfere with the view's scale factor.<br />
2235 /// The views default depth is the minimum of width and height.<br />
2239 /// Animatable - This property can be animated using <c>Animation</c> class.
2241 /// animation.AnimateTo(view, "Size", new Size(100, 100));
2244 /// The property cascade chaining set is not recommended.
2247 /// This way is recommended for setting the property
2249 /// var view = new View();
2250 /// view.Size = new Size(100.5f, 200, 0);
2252 /// This way to set the property is prohibited
2254 /// view.Size.Width = 100.5f; //This does not guarantee a proper operation
2257 /// <since_tizen> 5 </since_tizen>
2262 return (Size)GetValue(SizeProperty);
2266 SetValue(SizeProperty, value);
2267 NotifyPropertyChanged();
2272 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2274 /// <since_tizen> 3 </since_tizen>
2275 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2277 "Container parent = view.GetParent(); " +
2278 "View view = parent as View;")]
2279 [EditorBrowsable(EditorBrowsableState.Never)]
2280 public new View Parent
2285 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2286 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2287 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2289 if (basehandle is Layer layer)
2291 ret = new View(Layer.getCPtr(layer).Handle, false);
2292 NUILog.Error("This Parent property is deprecated, should do not be used");
2296 ret = basehandle as View;
2299 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2300 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2302 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2308 /// Gets/Sets whether inherit parent's the layout Direction.
2310 /// <since_tizen> 4 </since_tizen>
2311 public bool InheritLayoutDirection
2315 return (bool)GetValue(InheritLayoutDirectionProperty);
2319 SetValue(InheritLayoutDirectionProperty, value);
2320 NotifyPropertyChanged();
2325 /// Gets/Sets the layout Direction.
2327 /// <since_tizen> 4 </since_tizen>
2328 public ViewLayoutDirectionType LayoutDirection
2332 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2336 SetValue(LayoutDirectionProperty, value);
2337 NotifyPropertyChanged();
2338 layout?.RequestLayout();
2343 /// Gets or sets the Margin for use in layout.
2346 /// Margin property is supported by Layout algorithms and containers.
2347 /// Please Set Layout if you want to use Margin property.
2348 /// The property cascade chaining set is not recommended.
2351 /// This way is recommended for setting the property
2353 /// var view = new View();
2354 /// view.Margin = new Extents(10, 5, 15, 20);
2356 /// This way to set the property is prohibited
2358 /// view.Margin.Top = 15; //This does not guarantee a proper operation
2361 /// <since_tizen> 4 </since_tizen>
2362 public Extents Margin
2366 // If View has a Layout then margin is stored in Layout.
2369 return Layout.Margin;
2373 // If Layout not set then return margin stored in View.
2374 return (Extents)GetValue(MarginProperty);
2376 // Two return points to prevent creating a zeroed Extent native object before assignment
2382 // Layout set so store Margin in LayoutItem instead of View.
2383 // If View stores the Margin too then the Legacy Size Negotiation will
2384 // overwrite the position and size values measured in the Layouting.
2385 Layout.Margin = value;
2386 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2387 layout?.RequestLayout();
2391 SetValue(MarginProperty, value);
2393 NotifyPropertyChanged();
2394 layout?.RequestLayout();
2399 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2403 /// // matchParentView matches its size to its parent size.
2404 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2405 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2407 /// // wrapContentView wraps its children with their desired size.
2408 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2409 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2411 /// // exactSizeView shows itself with an exact size.
2412 /// exactSizeView.WidthSpecification = 100;
2413 /// exactSizeView.HeightSpecification = 100;
2416 /// <since_tizen> 6 </since_tizen>
2417 [Binding.TypeConverter(typeof(IntGraphicsTypeConverter))]
2418 public int WidthSpecification
2422 return (int)GetValue(WidthSpecificationProperty);
2426 SetValue(WidthSpecificationProperty, value);
2427 NotifyPropertyChanged();
2431 private int InternalWidthSpecification
2439 if (value == widthPolicy)
2442 widthPolicy = value;
2443 if (widthPolicy >= 0)
2445 if (heightPolicy >= 0) // Policy an exact value
2447 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2448 Size2D = new Size2D(widthPolicy, heightPolicy);
2451 layout?.RequestLayout();
2456 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2460 /// // matchParentView matches its size to its parent size.
2461 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2462 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2464 /// // wrapContentView wraps its children with their desired size.
2465 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2466 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2468 /// // exactSizeView shows itself with an exact size.
2469 /// exactSizeView.WidthSpecification = 100;
2470 /// exactSizeView.HeightSpecification = 100;
2473 /// <since_tizen> 6 </since_tizen>
2474 [Binding.TypeConverter(typeof(IntGraphicsTypeConverter))]
2475 public int HeightSpecification
2479 return (int)GetValue(HeightSpecificationProperty);
2483 SetValue(HeightSpecificationProperty, value);
2484 NotifyPropertyChanged();
2488 private int InternalHeightSpecification
2492 return heightPolicy;
2496 if (value == heightPolicy)
2499 heightPolicy = value;
2500 if (heightPolicy >= 0)
2502 if (widthPolicy >= 0) // Policy an exact value
2504 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2505 Size2D = new Size2D(widthPolicy, heightPolicy);
2508 layout?.RequestLayout();
2513 /// Gets the List of transitions for this View.
2515 /// <since_tizen> 6 </since_tizen>
2516 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2520 if (layoutTransitions == null)
2522 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2524 return layoutTransitions;
2529 /// Sets a layout transitions for this View.
2531 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2533 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2535 /// <since_tizen> 6 </since_tizen>
2536 public LayoutTransition LayoutTransition
2540 return GetValue(LayoutTransitionProperty) as LayoutTransition;
2544 SetValue(LayoutTransitionProperty, value);
2545 NotifyPropertyChanged();
2549 private LayoutTransition InternalLayoutTransition
2553 return layoutTransition;
2559 throw new global::System.ArgumentNullException(nameof(value));
2561 if (layoutTransitions == null)
2563 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2566 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2568 AttachTransitionsToChildren(value);
2570 layoutTransition = value;
2575 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2578 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2580 /// <since_tizen> 4 </since_tizen>
2581 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2582 [EditorBrowsable(EditorBrowsableState.Never)]
2583 public Extents PaddingEX
2587 return GetValue(PaddingEXProperty) as Extents;
2591 SetValue(PaddingEXProperty, value);
2595 private Extents InternalPaddingEX
2599 Extents temp = new Extents(0, 0, 0, 0);
2600 var pValue = GetProperty(View.Property.PADDING);
2603 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2609 var temp = new Tizen.NUI.PropertyValue(value);
2610 SetProperty(View.Property.PADDING, temp);
2612 NotifyPropertyChanged();
2613 layout?.RequestLayout();
2618 /// The Color of View. This is an RGBA value.
2622 /// Animatable - This property can be animated using <c>Animation</c> class.
2624 /// The property cascade chaining set is not recommended.
2627 /// This way is recommended for setting the property
2629 /// var view = new View();
2630 /// view.Color = new Color(0.5f, 0.2f, 0.1f, 0.5f);
2632 /// This way to set the property is prohibited
2634 /// view.Color.A = 0.5f; //This does not guarantee a proper operation
2637 [EditorBrowsable(EditorBrowsableState.Never)]
2642 return (Color)GetValue(ColorProperty);
2646 SetValue(ColorProperty, value);
2647 NotifyPropertyChanged();
2652 /// Set the layout on this View. Replaces any existing Layout.
2655 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2657 /// <since_tizen> 6 </since_tizen>
2658 public LayoutItem Layout
2662 return GetValue(LayoutProperty) as LayoutItem;
2666 SetValue(LayoutProperty, value);
2670 private LayoutItem InternalLayout
2678 // Do nothing if layout provided is already set on this View.
2679 if (value == layout)
2684 LayoutingDisabled = false;
2687 // If new layout being set already has a owner then that owner receives a replacement default layout.
2688 // First check if the layout to be set already has a owner.
2689 if (value?.Owner != null)
2691 // Previous owner of the layout gets a default layout as a replacement.
2692 value.Owner.Layout = new AbsoluteLayout()
2694 // Copy Margin and Padding to replacement LayoutGroup.
2695 Margin = value.Margin,
2696 Padding = value.Padding,
2700 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2701 // View if no replacement. Previously margin and padding values would have been moved from
2702 // the View to the layout.
2703 if (layout != null) // Existing layout
2707 // Existing layout being replaced so copy over margin and padding values.
2708 value.Margin = layout.Margin;
2709 value.Padding = layout.Padding;
2710 value.SetPositionByLayout = !excludeLayouting;
2714 // Layout not being replaced so restore margin and padding to View.
2715 SetValue(MarginProperty, layout.Margin);
2716 SetValue(PaddingProperty, layout.Padding);
2717 NotifyPropertyChanged();
2722 // First Layout to be added to the View hence copy
2724 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2727 Extents margin = Margin;
2728 Extents padding = Padding;
2729 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2731 // If View already has a margin set then store it in Layout instead.
2732 value.Margin = margin;
2733 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2734 NotifyPropertyChanged();
2737 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2739 // If View already has a padding set then store it in Layout instead.
2740 value.Padding = padding;
2742 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2743 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2744 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2746 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2747 NotifyPropertyChanged();
2751 value.SetPositionByLayout = !excludeLayouting;
2755 // Remove existing layout from it's parent layout group.
2758 // Set layout to this view
2764 /// The weight of the View, used to share available space in a layout with siblings.
2766 /// <since_tizen> 6 </since_tizen>
2776 layout?.RequestLayout();
2781 /// Whether to load the BackgroundImage synchronously.
2782 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2783 /// Note: For Normal Quad images only.
2785 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2786 [EditorBrowsable(EditorBrowsableState.Never)]
2787 public bool BackgroundImageSynchronosLoading
2791 return (bool)GetValue(BackgroundImageSynchronosLoadingProperty);
2795 SetValue(BackgroundImageSynchronosLoadingProperty, value);
2796 NotifyPropertyChanged();
2800 private bool InternalBackgroundImageSynchronosLoading
2804 return BackgroundImageSynchronousLoading;
2808 BackgroundImageSynchronousLoading = value;
2813 /// Whether to load the BackgroundImage synchronously.
2814 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2815 /// Note: For Normal Quad images only.
2817 /// This will be public opened in tizen_7.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2818 [EditorBrowsable(EditorBrowsableState.Never)]
2819 public bool BackgroundImageSynchronousLoading
2823 return (bool)GetValue(BackgroundImageSynchronousLoadingProperty);
2827 SetValue(BackgroundImageSynchronousLoadingProperty, value);
2828 NotifyPropertyChanged();
2832 private bool InternalBackgroundImageSynchronousLoading
2836 return backgroundImageSynchronousLoading;
2840 backgroundImageSynchronousLoading = value;
2842 string bgUrl = null;
2843 var pValue = Background.Find(ImageVisualProperty.URL);
2844 pValue?.Get(out bgUrl);
2847 if (!string.IsNullOrEmpty(bgUrl))
2849 PropertyMap bgMap = this.Background;
2850 var temp = new PropertyValue(backgroundImageSynchronousLoading);
2851 bgMap[ImageVisualProperty.SynchronousLoading] = temp;
2858 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2859 [EditorBrowsable(EditorBrowsableState.Never)]
2860 public Vector2 UpdateSizeHint
2864 return (Vector2)GetValue(UpdateSizeHintProperty);
2868 SetValue(UpdateSizeHintProperty, value);
2869 NotifyPropertyChanged();
2874 /// Enable/Disable ControlState propagation for children.
2875 /// It is false by default.
2876 /// If the View needs to share ControlState with descendants, please set it true.
2877 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2879 [EditorBrowsable(EditorBrowsableState.Never)]
2880 public bool EnableControlStatePropagation
2884 return (bool)GetValue(EnableControlStatePropagationProperty);
2888 SetValue(EnableControlStatePropagationProperty, value);
2889 NotifyPropertyChanged();
2893 private bool InternalEnableControlStatePropagation
2895 get => themeData?.ControlStatePropagation ?? false;
2898 if (InternalEnableControlStatePropagation == value) return;
2900 if (themeData == null) themeData = new ThemeData();
2902 themeData.ControlStatePropagation = value;
2904 foreach (View child in Children)
2906 child.EnableControlStatePropagation = value;
2912 /// By default, it is false in View, true in Control.
2913 /// Note that if the value is true, the View will be a touch receptor.
2915 [EditorBrowsable(EditorBrowsableState.Never)]
2916 public bool EnableControlState
2920 return (bool)GetValue(EnableControlStateProperty);
2924 SetValue(EnableControlStateProperty, value);
2929 /// Whether the actor grab all touches even if touch leaves its boundary.
2931 /// <returns>true, if it grab all touch after start</returns>
2932 [EditorBrowsable(EditorBrowsableState.Never)]
2933 public bool GrabTouchAfterLeave
2937 return (bool)GetValue(GrabTouchAfterLeaveProperty);
2941 SetValue(GrabTouchAfterLeaveProperty, value);
2945 private bool InternalGrabTouchAfterLeave
2950 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2951 pValue.Get(out temp);
2957 var temp = new Tizen.NUI.PropertyValue(value);
2958 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2960 NotifyPropertyChanged();
2965 /// Determines which blend equation will be used to render renderers of this actor.
2967 /// <returns>blend equation enum currently assigned</returns>
2968 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2969 [EditorBrowsable(EditorBrowsableState.Never)]
2970 public BlendEquationType BlendEquation
2974 return (BlendEquationType)GetValue(BlendEquationProperty);
2978 SetValue(BlendEquationProperty, value);
2982 private BlendEquationType InternalBlendEquation
2987 var pValue = GetProperty(View.Property.BlendEquation);
2988 pValue.Get(out temp);
2990 return (BlendEquationType)temp;
2994 var temp = new Tizen.NUI.PropertyValue((int)value);
2995 SetProperty(View.Property.BlendEquation, temp);
2997 NotifyPropertyChanged();
3002 /// If the value is true, the View will change its style as the theme changes.
3003 /// The default value is false in normal case but it can be true when the NUIApplication is created with <see cref="NUIApplication.ThemeOptions.ThemeChangeSensitive"/>.
3005 /// <since_tizen> 9 </since_tizen>
3006 public bool ThemeChangeSensitive
3008 get => (bool)GetValue(ThemeChangeSensitiveProperty);
3009 set => SetValue(ThemeChangeSensitiveProperty, value);
3013 /// Create Style, it is abstract function and must be override.
3015 [EditorBrowsable(EditorBrowsableState.Never)]
3016 protected virtual ViewStyle CreateViewStyle()
3018 return new ViewStyle();
3022 /// Called after the View's ControlStates changed.
3024 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
3025 [EditorBrowsable(EditorBrowsableState.Never)]
3026 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
3032 [EditorBrowsable(EditorBrowsableState.Never)]
3033 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
3035 if (string.IsNullOrEmpty(styleName)) ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(GetType()));
3036 else ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(styleName));
3040 /// Apply style instance to the view.
3041 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
3043 /// <since_tizen> 9 </since_tizen>
3044 public virtual void ApplyStyle(ViewStyle viewStyle)
3046 if (viewStyle == null || themeData?.viewStyle == viewStyle) return;
3048 if (themeData == null) themeData = new ThemeData();
3050 themeData.viewStyle = viewStyle;
3052 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
3058 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
3060 if (bindablePropertyOfView == null)
3065 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
3066 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
3068 foreach (var sourceProperty in dirtyStyleProperties)
3070 var sourceValue = viewStyle.GetValue(sourceProperty);
3072 if (sourceValue == null)
3077 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
3079 if (destinationProperty != null)
3081 SetValue(destinationProperty, sourceValue);
3087 /// Get whether the View is culled or not.
3088 /// True means that the View is out of the view frustum.
3091 /// Hidden-API (Inhouse-API).
3093 [EditorBrowsable(EditorBrowsableState.Never)]
3099 var pValue = GetProperty(View.Property.Culled);
3100 pValue.Get(out temp);
3107 /// Set or Get TransitionOptions for the page transition.
3108 /// This property is used to define how this view will be transitioned during Page switching.
3110 /// <since_tizen> 9 </since_tizen>
3111 public TransitionOptions TransitionOptions
3115 return GetValue(TransitionOptionsProperty) as TransitionOptions;
3119 SetValue(TransitionOptionsProperty, value);
3120 NotifyPropertyChanged();
3124 private TransitionOptions InternalTransitionOptions
3128 transitionOptions = value;
3132 return transitionOptions;
3137 /// Gets or sets the status of whether the view should emit key event signals.
3138 /// If a View's DispatchKeyEvents is set to false, then it's children will not emit a key event signal either.
3140 [EditorBrowsable(EditorBrowsableState.Never)]
3141 public bool DispatchKeyEvents
3145 return (bool)GetValue(DispatchKeyEventsProperty);
3149 SetValue(DispatchKeyEventsProperty, value);
3150 NotifyPropertyChanged();