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 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;
56 RegisterPropertyGroup(PositionProperty, positionPropertyGroup);
57 RegisterPropertyGroup(Position2DProperty, positionPropertyGroup);
58 RegisterPropertyGroup(PositionXProperty, positionPropertyGroup);
59 RegisterPropertyGroup(PositionYProperty, positionPropertyGroup);
61 RegisterPropertyGroup(SizeProperty, sizePropertyGroup);
62 RegisterPropertyGroup(Size2DProperty, sizePropertyGroup);
63 RegisterPropertyGroup(SizeWidthProperty, sizePropertyGroup);
64 RegisterPropertyGroup(SizeHeightProperty, sizePropertyGroup);
66 RegisterPropertyGroup(ScaleProperty, scalePropertyGroup);
67 RegisterPropertyGroup(ScaleXProperty, scalePropertyGroup);
68 RegisterPropertyGroup(ScaleYProperty, scalePropertyGroup);
69 RegisterPropertyGroup(ScaleZProperty, scalePropertyGroup);
73 /// Creates a new instance of a view.
75 /// <since_tizen> 3 </since_tizen>
76 public View() : this(Interop.View.New(), true)
78 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
81 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
82 [EditorBrowsable(EditorBrowsableState.Never)]
83 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
88 /// Create a new instance of a View with setting the status of shown or hidden.
90 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
91 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
92 [EditorBrowsable(EditorBrowsableState.Never)]
93 public View(bool shown) : this(Interop.View.New(), true)
95 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
101 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
107 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
110 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
112 InitializeStyle(viewStyle);
115 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
119 PositionUsesPivotPoint = false;
122 onWindowSendEventCallback = SendViewAddedEventToWindow;
123 using ViewSignal signal = new ViewSignal(Interop.ActorSignal.ActorOnSceneSignal(SwigCPtr), false);
124 signal?.Connect(onWindowSendEventCallback);
132 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
134 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
143 /// The event that is triggered when the View's ControlState is changed.
145 [EditorBrowsable(EditorBrowsableState.Never)]
146 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
148 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
152 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
154 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
155 [EditorBrowsable(EditorBrowsableState.Never)]
156 public bool LayoutSet
165 /// Flag to allow Layouting to be disabled for Views.
166 /// Once a View has a Layout set then any children added to Views from then on will receive
167 /// automatic Layouts.
169 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
170 [EditorBrowsable(EditorBrowsableState.Never)]
171 public static bool LayoutingDisabled { get; set; } = true;
174 /// Deprecate. Please do not use this.
175 /// The style instance applied to this view.
176 /// Note that please do not modify the ViewStyle.
177 /// Modifying ViewStyle will affect other views with same ViewStyle.
179 [EditorBrowsable(EditorBrowsableState.Never)]
180 protected ViewStyle ViewStyle
184 if (themeData == null) themeData = new ThemeData();
186 if (themeData.viewStyle == null)
188 ApplyStyle(CreateViewStyle());
190 return themeData.viewStyle;
195 /// Get/Set the control state.
196 /// Note that the ControlState only available for the classes derived from Control.
197 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
198 /// please set <see cref="EnableControlState"/> to true.
200 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
201 [EditorBrowsable(EditorBrowsableState.Never)]
202 public ControlState ControlState
206 return themeData == null ? ControlState.Normal : themeData.controlStates;
210 if (ControlState == value)
215 var prevState = ControlState;
217 if (themeData == null) themeData = new ThemeData();
218 themeData.controlStates = value;
220 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
222 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
224 if (themeData.ControlStatePropagation)
226 foreach (View child in Children)
228 child.ControlState = value;
232 OnControlStateChanged(changeInfo);
234 ControlStateChangedEvent?.Invoke(this, changeInfo);
239 /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
241 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
242 [EditorBrowsable(EditorBrowsableState.Never)]
243 public bool ExcludeLayouting
247 return excludeLayouting;
251 excludeLayouting = value;
252 if (Layout != null && Layout.SetPositionByLayout == value)
254 Layout.SetPositionByLayout = !value;
255 Layout.RequestLayout();
260 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
261 [EditorBrowsable(EditorBrowsableState.Never)]
262 public bool IsResourcesCreated
266 return Application.Current.IsResourcesCreated;
270 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
271 [EditorBrowsable(EditorBrowsableState.Never)]
272 public ResourceDictionary XamlResources
276 return Application.Current.XamlResources;
280 Application.Current.XamlResources = value;
285 /// The StyleName, type string.
286 /// The value indicates DALi style name defined in json theme file.
288 /// <since_tizen> 3 </since_tizen>
289 public string StyleName
293 return (string)GetValue(StyleNameProperty);
297 SetValue(StyleNameProperty, value);
298 NotifyPropertyChanged();
303 /// The KeyInputFocus, type bool.
305 [EditorBrowsable(EditorBrowsableState.Never)]
306 public bool KeyInputFocus
310 return (bool)GetValue(KeyInputFocusProperty);
314 SetValue(KeyInputFocusProperty, value);
315 NotifyPropertyChanged();
320 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
324 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
327 /// Animatable - This property can be animated using <c>Animation</c> class.
329 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
333 /// <since_tizen> 3 </since_tizen>
334 public Color BackgroundColor
338 Color temp = (Color)GetValue(BackgroundColorProperty);
339 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
343 SetValue(BackgroundColorProperty, value);
344 NotifyPropertyChanged();
349 /// The mutually exclusive with "backgroundColor" and "background" type Map.
351 /// <since_tizen> 3 </since_tizen>
352 public string BackgroundImage
356 return (string)GetValue(BackgroundImageProperty);
360 SetValue(BackgroundImageProperty, value);
361 NotifyPropertyChanged();
366 /// Get or set the border of background image.
368 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
369 [EditorBrowsable(EditorBrowsableState.Never)]
370 public Rectangle BackgroundImageBorder
374 return (Rectangle)GetValue(BackgroundImageBorderProperty);
378 SetValue(BackgroundImageBorderProperty, value);
379 NotifyPropertyChanged();
384 /// The background of view.
386 /// <since_tizen> 3 </since_tizen>
387 public Tizen.NUI.PropertyMap Background
391 return (PropertyMap)GetValue(BackgroundProperty);
395 SetValue(BackgroundProperty, value);
396 NotifyPropertyChanged();
401 /// Describes a shadow as an image for a View.
402 /// It is null by default.
405 /// Getter returns copied instance of current shadow.
408 /// The mutually exclusive with "BoxShadow".
412 /// Animatable - This property can be animated using <c>Animation</c> class.
413 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
415 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
417 /// Animatable sub-property : Offset.
420 [EditorBrowsable(EditorBrowsableState.Never)]
421 public ImageShadow ImageShadow
425 return (ImageShadow)GetValue(ImageShadowProperty);
429 SetValue(ImageShadowProperty, value);
430 NotifyPropertyChanged();
435 /// Describes a box shaped shadow drawing for a View.
436 /// It is null by default.
439 /// The mutually exclusive with "ImageShadow".
443 /// Animatable - This property can be animated using <c>Animation</c> class.
444 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
446 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
448 /// Animatable sub-property : Offset, Color, BlurRadius.
451 /// <since_tizen> 9 </since_tizen>
452 public Shadow BoxShadow
456 return (Shadow)GetValue(BoxShadowProperty);
460 SetValue(BoxShadowProperty, value);
461 NotifyPropertyChanged();
466 /// The radius for the rounded corners of the View.
467 /// This will rounds background and shadow edges.
468 /// 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).
469 /// Each radius will clamp internally to the half of smaller of the view's width or height.
470 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
474 /// Animatable - This property can be animated using <c>Animation</c> class.
476 /// animation.AnimateTo(view, "CornerRadius", new Vector4(10, 10, 10, 10));
480 /// <since_tizen> 9 </since_tizen>
481 public Vector4 CornerRadius
485 return (Vector4)GetValue(CornerRadiusProperty);
489 SetValue(CornerRadiusProperty, value);
490 NotifyPropertyChanged();
495 /// Whether the CornerRadius property value is relative (percentage [0.0f to 0.5f] of the view size) or absolute (in world units).
496 /// It is absolute by default.
497 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
499 /// <since_tizen> 9 </since_tizen>
500 public VisualTransformPolicyType CornerRadiusPolicy
502 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
503 set => SetValue(CornerRadiusPolicyProperty, value);
507 /// The width for the borderline of the View.
508 /// Note that, an image background may not have borderline if it uses a Border property.
512 /// Animatable - This property can be animated using <c>Animation</c> class.
514 /// animation.AnimateTo(view, "BorderlineWidth", 100.0f);
518 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
519 [EditorBrowsable(EditorBrowsableState.Never)]
520 public float BorderlineWidth
524 return (float)GetValue(BorderlineWidthProperty);
528 SetValue(BorderlineWidthProperty, value);
529 NotifyPropertyChanged();
534 /// The color for the borderline of the View.
535 /// It is Color.Black by default.
539 /// Animatable - This property can be animated using <c>Animation</c> class.
541 /// animation.AnimateTo(view, "BorderlineColor", new Color(r, g, b, a));
545 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
546 [EditorBrowsable(EditorBrowsableState.Never)]
547 public Color BorderlineColor
551 return (Color)GetValue(BorderlineColorProperty);
555 SetValue(BorderlineColorProperty, value);
556 NotifyPropertyChanged();
561 /// The Relative offset for the borderline of the View.
562 /// recommand [-1.0f to 1.0f] range.
563 /// If -1.0f, borderline draw inside of View.
564 /// If 1.0f, borderline draw outside of View.
565 /// If 0.0f, borderline draw half at inside and half at outside.
566 /// It is 0.0f by default.
570 /// Animatable - This property can be animated using <c>Animation</c> class.
572 /// animation.AnimateTo(view, "BorderlineOffset", -1.0f);
576 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
577 [EditorBrowsable(EditorBrowsableState.Never)]
578 public float BorderlineOffset
582 return (float)GetValue(BorderlineOffsetProperty);
586 SetValue(BorderlineOffsetProperty, value);
587 NotifyPropertyChanged();
592 /// The current state of the view.
594 /// <since_tizen> 3 </since_tizen>
599 return (States)GetValue(StateProperty);
603 SetValue(StateProperty, value);
604 NotifyPropertyChanged();
609 /// The current sub state of the view.
611 /// <since_tizen> 3 </since_tizen>
612 public States SubState
616 return (States)GetValue(SubStateProperty);
620 SetValue(SubStateProperty, value);
621 NotifyPropertyChanged();
626 /// Displays a tooltip
628 /// <since_tizen> 3 </since_tizen>
629 public Tizen.NUI.PropertyMap Tooltip
633 return (PropertyMap)GetValue(TooltipProperty);
637 SetValue(TooltipProperty, value);
638 NotifyPropertyChanged();
643 /// Displays a tooltip as a text.
645 /// <since_tizen> 3 </since_tizen>
646 public string TooltipText
650 using (var propertyValue = GetProperty(Property.TOOLTIP))
652 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
654 return retrivedValue;
656 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
657 return "error to get TooltipText";
662 var temp = new Tizen.NUI.PropertyValue(value);
663 SetProperty(View.Property.TOOLTIP, temp);
665 NotifyPropertyChanged();
670 /// The Child property of FlexContainer.<br />
671 /// The proportion of the free space in the container, the flex item will receive.<br />
672 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
674 /// <since_tizen> 3 </since_tizen>
675 [Obsolete("Deprecated in API8, will be removed in API10.")]
680 return (float)GetValue(FlexProperty);
684 SetValue(FlexProperty, value);
685 NotifyPropertyChanged();
690 /// The Child property of FlexContainer.<br />
691 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
693 /// <since_tizen> 3 </since_tizen>
694 [Obsolete("Deprecated in API8, will be removed in API10.")]
699 return (int)GetValue(AlignSelfProperty);
703 SetValue(AlignSelfProperty, value);
704 NotifyPropertyChanged();
709 /// The Child property of FlexContainer.<br />
710 /// The space around the flex item.<br />
713 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
715 /// <since_tizen> 3 </since_tizen>
716 [Obsolete("Deprecated in API8, will be removed in API10.")]
717 public Vector4 FlexMargin
721 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
722 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
726 SetValue(FlexMarginProperty, value);
727 NotifyPropertyChanged();
732 /// The top-left cell this child occupies, if not set, the first available cell is used.
735 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
736 /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
738 /// <since_tizen> 3 </since_tizen>
739 public Vector2 CellIndex
743 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
744 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
748 SetValue(CellIndexProperty, value);
749 NotifyPropertyChanged();
754 /// The number of rows this child occupies, if not set, the default value is 1.
757 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
759 /// <since_tizen> 3 </since_tizen>
764 return (float)GetValue(RowSpanProperty);
768 SetValue(RowSpanProperty, value);
769 NotifyPropertyChanged();
774 /// The number of columns this child occupies, if not set, the default value is 1.
777 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
779 /// <since_tizen> 3 </since_tizen>
780 public float ColumnSpan
784 return (float)GetValue(ColumnSpanProperty);
788 SetValue(ColumnSpanProperty, value);
789 NotifyPropertyChanged();
794 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
797 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
799 /// <since_tizen> 3 </since_tizen>
800 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
804 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
808 SetValue(CellHorizontalAlignmentProperty, value);
809 NotifyPropertyChanged();
814 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
817 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
819 /// <since_tizen> 3 </since_tizen>
820 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
824 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
828 SetValue(CellVerticalAlignmentProperty, value);
829 NotifyPropertyChanged();
834 /// The left focusable view.<br />
835 /// This will return null if not set.<br />
836 /// This will also return null if the specified left focusable view is not on a window.<br />
838 /// <since_tizen> 3 </since_tizen>
839 public View LeftFocusableView
841 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
844 return (View)GetValue(LeftFocusableViewProperty);
848 SetValue(LeftFocusableViewProperty, value);
849 NotifyPropertyChanged();
854 /// The right focusable view.<br />
855 /// This will return null if not set.<br />
856 /// This will also return null if the specified right focusable view is not on a window.<br />
858 /// <since_tizen> 3 </since_tizen>
859 public View RightFocusableView
861 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
864 return (View)GetValue(RightFocusableViewProperty);
868 SetValue(RightFocusableViewProperty, value);
869 NotifyPropertyChanged();
874 /// The up focusable view.<br />
875 /// This will return null if not set.<br />
876 /// This will also return null if the specified up focusable view is not on a window.<br />
878 /// <since_tizen> 3 </since_tizen>
879 public View UpFocusableView
881 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
884 return (View)GetValue(UpFocusableViewProperty);
888 SetValue(UpFocusableViewProperty, value);
889 NotifyPropertyChanged();
894 /// The down focusable view.<br />
895 /// This will return null if not set.<br />
896 /// This will also return null if the specified down focusable view is not on a window.<br />
898 /// <since_tizen> 3 </since_tizen>
899 public View DownFocusableView
901 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
904 return (View)GetValue(DownFocusableViewProperty);
908 SetValue(DownFocusableViewProperty, value);
909 NotifyPropertyChanged();
914 /// Whether the view should be focusable by keyboard navigation.
916 /// <since_tizen> 3 </since_tizen>
917 public bool Focusable
921 SetValue(FocusableProperty, value);
922 NotifyPropertyChanged();
926 return (bool)GetValue(FocusableProperty);
931 /// 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.
932 /// Note : Default value is true.
934 [EditorBrowsable(EditorBrowsableState.Never)]
935 public bool FocusableChildren
939 SetValue(FocusableChildrenProperty, value);
940 NotifyPropertyChanged();
944 return (bool)GetValue(FocusableChildrenProperty);
949 /// Whether this view can focus by touch.
950 /// If Focusable is false, FocusableInTouch is disabled.
951 /// If you want to have focus on touch, you need to set both Focusable and FocusableInTouch settings to true.
953 [EditorBrowsable(EditorBrowsableState.Never)]
954 public bool FocusableInTouch
958 SetValue(FocusableInTouchProperty, value);
959 NotifyPropertyChanged();
963 return (bool)GetValue(FocusableInTouchProperty);
968 /// Retrieves the position of the view.<br />
969 /// The coordinates are relative to the view's parent.<br />
971 /// <since_tizen> 3 </since_tizen>
972 public Position CurrentPosition
976 return GetCurrentPosition();
981 /// Sets the size of a view for the width and the height.<br />
982 /// Geometry can be scaled to fit within this area.<br />
983 /// This does not interfere with the view's scale factor.<br />
984 /// The views default depth is the minimum of width and height.<br />
987 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
988 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
990 /// <since_tizen> 3 </since_tizen>
995 Size2D temp = (Size2D)GetValue(Size2DProperty);
996 int width = temp.Width;
997 int height = temp.Height;
999 if (this.Layout == null)
1001 if (width < 0) { width = 0; }
1002 if (height < 0) { height = 0; }
1005 return new Size2D(OnSize2DChanged, width, height);
1009 SetValue(Size2DProperty, value);
1011 NotifyPropertyChanged();
1016 /// Retrieves the size of the view.<br />
1017 /// The coordinates are relative to the view's parent.<br />
1019 /// <since_tizen> 3 </since_tizen>
1020 public Size2D CurrentSize
1024 return GetCurrentSize();
1029 /// Retrieves and sets the view's opacity.<br />
1033 /// Animatable - This property can be animated using <c>Animation</c> class.
1035 /// animation.AnimateTo(view, "Opacity", 0.5f);
1039 /// <since_tizen> 3 </since_tizen>
1040 public float Opacity
1044 return (float)GetValue(OpacityProperty);
1048 SetValue(OpacityProperty, value);
1049 NotifyPropertyChanged();
1054 /// Sets the position of the view for X and Y.<br />
1055 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1056 /// If the position inheritance is disabled, sets the world position.<br />
1059 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1060 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1062 /// <since_tizen> 3 </since_tizen>
1063 public Position2D Position2D
1067 Position2D temp = (Position2D)GetValue(Position2DProperty);
1068 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1072 SetValue(Position2DProperty, value);
1073 NotifyPropertyChanged();
1078 /// Retrieves the screen position of the view.<br />
1080 /// <since_tizen> 3 </since_tizen>
1081 public Vector2 ScreenPosition
1085 Vector2 temp = new Vector2(0.0f, 0.0f);
1086 var pValue = GetProperty(View.Property.ScreenPosition);
1094 /// Determines whether the pivot point should be used to determine the position of the view.
1095 /// This is false by default.
1097 /// <remarks>If false, then the top-left of the view is used for the position.
1098 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1100 /// <since_tizen> 3 </since_tizen>
1101 public bool PositionUsesPivotPoint
1105 return (bool)GetValue(PositionUsesPivotPointProperty);
1109 SetValue(PositionUsesPivotPointProperty, value);
1110 NotifyPropertyChanged();
1115 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1117 /// <since_tizen> 3 </since_tizen>
1118 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1120 "View view = new View(); " +
1121 "view.PivotPoint = PivotPoint.Center; " +
1122 "view.PositionUsesPivotPoint = true;" +
1123 " Deprecated in API5: Will be removed in API8")]
1124 [EditorBrowsable(EditorBrowsableState.Never)]
1125 public bool PositionUsesAnchorPoint
1130 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1131 pValue.Get(out temp);
1137 var temp = new Tizen.NUI.PropertyValue(value);
1138 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1140 NotifyPropertyChanged();
1145 /// Queries whether the view is connected to the stage.<br />
1146 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1148 /// <since_tizen> 3 </since_tizen>
1149 public bool IsOnWindow
1158 /// Gets the depth in the hierarchy for the view.
1160 /// <since_tizen> 3 </since_tizen>
1161 public int HierarchyDepth
1165 return GetHierarchyDepth();
1170 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1173 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1174 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1175 /// The values set by this property will likely change.
1177 /// <since_tizen> 3 </since_tizen>
1178 public int SiblingOrder
1182 return (int)GetValue(SiblingOrderProperty);
1186 SetValue(SiblingOrderProperty, value);
1188 LayoutGroup layout = Layout as LayoutGroup;
1189 layout?.ChangeLayoutSiblingOrder(value);
1191 NotifyPropertyChanged();
1196 /// Returns the natural size of the view.
1199 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1201 /// <since_tizen> 5 </since_tizen>
1202 public Vector3 NaturalSize
1206 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1207 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1213 /// Returns the natural size (Size2D) of the view.
1216 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1218 /// <since_tizen> 4 </since_tizen>
1219 public Size2D NaturalSize2D
1223 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1224 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1226 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1233 /// Gets or sets the origin of a view within its parent's area.<br />
1234 /// 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 />
1235 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1236 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1238 /// <pre>The view has been initialized.</pre>
1239 /// <since_tizen> 3 </since_tizen>
1240 public Position ParentOrigin
1244 Position tmp = (Position)GetValue(ParentOriginProperty);
1245 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1249 SetValue(ParentOriginProperty, value);
1250 NotifyPropertyChanged();
1255 /// Gets or sets the anchor-point of a view.<br />
1256 /// 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 />
1257 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1258 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1259 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1260 /// <pre>The view has been initialized.</pre>
1263 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1265 /// <since_tizen> 3 </since_tizen>
1266 public Position PivotPoint
1270 Position tmp = (Position)GetValue(PivotPointProperty);
1271 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1275 SetValue(PivotPointProperty, value);
1276 NotifyPropertyChanged();
1281 /// Gets or sets the size width of the view.
1285 /// Animatable - This property can be animated using <c>Animation</c> class.
1287 /// animation.AnimateTo(view, "SizeWidth", 500.0f);
1291 /// <since_tizen> 3 </since_tizen>
1292 public float SizeWidth
1296 return (float)GetValue(SizeWidthProperty);
1300 SetValue(SizeWidthProperty, value);
1301 NotifyPropertyChanged();
1306 /// Gets or sets the size height of the view.
1310 /// Animatable - This property can be animated using <c>Animation</c> class.
1313 /// animation.AnimateTo(view, "SizeHeight", 500.0f);
1316 /// <since_tizen> 3 </since_tizen>
1317 public float SizeHeight
1321 return (float)GetValue(SizeHeightProperty);
1325 SetValue(SizeHeightProperty, value);
1326 NotifyPropertyChanged();
1331 /// Gets or sets the position of the view.<br />
1332 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1333 /// If the position inheritance is disabled, sets the world position.<br />
1337 /// Animatable - This property can be animated using <c>Animation</c> class.
1339 /// animation.AnimateTo(view, "Position", new Position(50, 0));
1342 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1344 /// <since_tizen> 3 </since_tizen>
1345 public Position Position
1349 Position tmp = (Position)GetValue(PositionProperty);
1350 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1354 SetValue(PositionProperty, value);
1355 NotifyPropertyChanged();
1360 /// Gets or sets the position X of the view.
1364 /// Animatable - This property can be animated using <c>Animation</c> class.
1366 /// animation.AnimateTo(view, "PositionX", 50.0f);
1370 /// <since_tizen> 3 </since_tizen>
1371 public float PositionX
1375 return (float)GetValue(PositionXProperty);
1379 SetValue(PositionXProperty, value);
1380 NotifyPropertyChanged();
1385 /// Gets or sets the position Y of the view.
1389 /// Animatable - This property can be animated using <c>Animation</c> class.
1391 /// animation.AnimateTo(view, "PositionY", 50.0f);
1395 /// <since_tizen> 3 </since_tizen>
1396 public float PositionY
1400 return (float)GetValue(PositionYProperty);
1404 SetValue(PositionYProperty, value);
1405 NotifyPropertyChanged();
1410 /// Gets or sets the position Z of the view.
1414 /// Animatable - This property can be animated using <c>Animation</c> class.
1416 /// animation.AnimateTo(view, "PositionZ", 50.0f);
1420 /// <since_tizen> 3 </since_tizen>
1421 public float PositionZ
1425 return (float)GetValue(PositionZProperty);
1429 SetValue(PositionZProperty, value);
1430 NotifyPropertyChanged();
1435 /// Gets or sets the world position of the view.
1437 /// <since_tizen> 3 </since_tizen>
1438 public Vector3 WorldPosition
1442 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1443 var pValue = GetProperty(View.Property.WorldPosition);
1451 /// Gets or sets the orientation of the view.<br />
1452 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1456 /// This is an asynchronous method.
1459 /// Animatable - This property can be animated using <c>Animation</c> class.
1461 /// animation.AnimateTo(view, "Orientation", new Rotation(new Radian((float)Math.PI), Vector3.XAxis));
1465 /// <since_tizen> 3 </since_tizen>
1466 public Rotation Orientation
1470 return (Rotation)GetValue(OrientationProperty);
1474 SetValue(OrientationProperty, value);
1475 NotifyPropertyChanged();
1480 /// Gets or sets the world orientation of the view.<br />
1482 /// <since_tizen> 3 </since_tizen>
1483 public Rotation WorldOrientation
1487 Rotation temp = new Rotation();
1488 var pValue = GetProperty(View.Property.WorldOrientation);
1496 /// Gets or sets the scale factor applied to the view.<br />
1500 /// Animatable - This property can be animated using <c>Animation</c> class.
1502 /// animation.AnimateTo(view, "Scale", new Vector3(1.5f, 1.5f, 1.0f));
1505 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1507 /// <since_tizen> 3 </since_tizen>
1508 public Vector3 Scale
1512 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1513 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1517 SetValue(ScaleProperty, value);
1518 NotifyPropertyChanged();
1523 /// Gets or sets the scale X factor applied to the view.
1527 /// Animatable - This property can be animated using <c>Animation</c> class.
1529 /// animation.AnimateTo(view, "ScaleX", 1.5f);
1533 /// <since_tizen> 3 </since_tizen>
1538 return (float)GetValue(ScaleXProperty);
1542 SetValue(ScaleXProperty, value);
1543 NotifyPropertyChanged();
1548 /// Gets or sets the scale Y factor applied to the view.
1552 /// Animatable - This property can be animated using <c>Animation</c> class.
1554 /// animation.AnimateTo(view, "ScaleY", 1.5f);
1558 /// <since_tizen> 3 </since_tizen>
1563 return (float)GetValue(ScaleYProperty);
1567 SetValue(ScaleYProperty, value);
1568 NotifyPropertyChanged();
1573 /// Gets or sets the scale Z factor applied to the view.
1577 /// Animatable - This property can be animated using <c>Animation</c> class.
1579 /// animation.AnimateTo(view, "ScaleZ", 1.5f);
1583 /// <since_tizen> 3 </since_tizen>
1588 return (float)GetValue(ScaleZProperty);
1592 SetValue(ScaleZProperty, value);
1593 NotifyPropertyChanged();
1598 /// Gets the world scale of the view.
1600 /// <since_tizen> 3 </since_tizen>
1601 public Vector3 WorldScale
1605 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1606 var pValue = GetProperty(View.Property.WorldScale);
1614 /// Retrieves the visibility flag of the view.
1618 /// If the view is not visible, then the view and its children will not be rendered.
1619 /// 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.
1622 /// Animatable - This property can be animated using <c>Animation</c> class.
1624 /// animation.AnimateTo(view, "Visibility", false);
1628 /// <since_tizen> 3 </since_tizen>
1629 public bool Visibility
1634 var pValue = GetProperty(View.Property.VISIBLE);
1635 pValue.Get(out temp);
1642 /// Gets the view's world color.
1644 /// <since_tizen> 3 </since_tizen>
1645 public Vector4 WorldColor
1649 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1650 var pValue = GetProperty(View.Property.WorldColor);
1658 /// Gets or sets the view's name.
1660 /// <since_tizen> 3 </since_tizen>
1665 return (string)GetValue(NameProperty);
1669 SetValue(NameProperty, value);
1670 NotifyPropertyChanged();
1675 /// Get the number of children held by the view.
1677 /// <since_tizen> 3 </since_tizen>
1678 public new uint ChildCount
1682 return Convert.ToUInt32(Children.Count);
1687 /// Gets the view's ID.
1690 /// <since_tizen> 3 </since_tizen>
1700 /// Gets or sets the status of whether the view should emit touch or hover signals.
1701 /// If a View is made insensitive, then the View and its children are not hittable.
1703 /// <since_tizen> 3 </since_tizen>
1704 public bool Sensitive
1708 return (bool)GetValue(SensitiveProperty);
1712 SetValue(SensitiveProperty, value);
1713 NotifyPropertyChanged();
1718 /// 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.
1720 /// <since_tizen> 3 </since_tizen>
1721 public bool LeaveRequired
1725 return (bool)GetValue(LeaveRequiredProperty);
1729 SetValue(LeaveRequiredProperty, value);
1730 NotifyPropertyChanged();
1735 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1737 /// <since_tizen> 3 </since_tizen>
1738 public bool InheritOrientation
1742 return (bool)GetValue(InheritOrientationProperty);
1746 SetValue(InheritOrientationProperty, value);
1747 NotifyPropertyChanged();
1752 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1754 /// <since_tizen> 3 </since_tizen>
1755 public bool InheritScale
1759 return (bool)GetValue(InheritScaleProperty);
1763 SetValue(InheritScaleProperty, value);
1764 NotifyPropertyChanged();
1769 /// Gets or sets the status of how the view and its children should be drawn.<br />
1770 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1771 /// 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 />
1772 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1773 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1774 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1776 /// <since_tizen> 3 </since_tizen>
1777 public DrawModeType DrawMode
1781 return (DrawModeType)GetValue(DrawModeProperty);
1785 SetValue(DrawModeProperty, value);
1786 NotifyPropertyChanged();
1791 /// Gets or sets the relative to parent size factor of the view.<br />
1792 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1793 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1796 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1798 /// <since_tizen> 3 </since_tizen>
1799 public Vector3 SizeModeFactor
1803 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1804 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1808 SetValue(SizeModeFactorProperty, value);
1809 NotifyPropertyChanged();
1814 /// Gets or sets the width resize policy to be used.
1816 /// <since_tizen> 3 </since_tizen>
1817 public ResizePolicyType WidthResizePolicy
1821 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1825 SetValue(WidthResizePolicyProperty, value);
1826 NotifyPropertyChanged();
1831 /// Gets or sets the height resize policy to be used.
1833 /// <since_tizen> 3 </since_tizen>
1834 public ResizePolicyType HeightResizePolicy
1838 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1842 SetValue(HeightResizePolicyProperty, value);
1843 NotifyPropertyChanged();
1848 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1849 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1851 /// <since_tizen> 3 </since_tizen>
1852 public SizeScalePolicyType SizeScalePolicy
1856 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1860 SetValue(SizeScalePolicyProperty, value);
1861 NotifyPropertyChanged();
1866 /// Gets or sets the status of whether the width size is dependent on the height size.
1868 /// <since_tizen> 3 </since_tizen>
1869 public bool WidthForHeight
1873 return (bool)GetValue(WidthForHeightProperty);
1877 SetValue(WidthForHeightProperty, value);
1878 NotifyPropertyChanged();
1883 /// Gets or sets the status of whether the height size is dependent on the width size.
1885 /// <since_tizen> 3 </since_tizen>
1886 public bool HeightForWidth
1890 return (bool)GetValue(HeightForWidthProperty);
1894 SetValue(HeightForWidthProperty, value);
1895 NotifyPropertyChanged();
1900 /// Gets or sets the padding for use in layout.
1903 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1905 /// <since_tizen> 5 </since_tizen>
1906 public Extents Padding
1910 // If View has a Layout then padding in stored in the base Layout class
1913 return Layout.Padding;
1917 Extents temp = (Extents)GetValue(PaddingProperty);
1918 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1920 // Two return points to prevent creating a zeroed Extent native object before assignment
1924 Extents padding = value;
1927 // Layout set so store Padding in LayoutItem instead of in View.
1928 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1929 // the position and sizes measure in the Layouting.
1930 Layout.Padding = value;
1931 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1932 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1933 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1935 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1939 SetValue(PaddingProperty, padding);
1940 NotifyPropertyChanged();
1945 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1947 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1949 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1951 /// <since_tizen> 3 </since_tizen>
1952 public Size2D MinimumSize
1956 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1957 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1963 throw new ArgumentNullException(nameof(value));
1967 // Note: it only works if minimum size is >= than natural size.
1968 // To force the size it should be done through the width&height spec or Size2D.
1969 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1970 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1971 layout.RequestLayout();
1973 SetValue(MinimumSizeProperty, value);
1974 NotifyPropertyChanged();
1979 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1982 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1984 /// <since_tizen> 3 </since_tizen>
1985 public Size2D MaximumSize
1989 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1990 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1994 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1995 // MATCH_PARENT spec + parent container size can be used to limit
1998 layout.RequestLayout();
2000 SetValue(MaximumSizeProperty, value);
2001 NotifyPropertyChanged();
2006 /// Gets or sets whether a child view inherits it's parent's position.<br />
2007 /// Default is to inherit.<br />
2008 /// 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 />
2010 /// <since_tizen> 3 </since_tizen>
2011 public bool InheritPosition
2015 return (bool)GetValue(InheritPositionProperty);
2019 SetValue(InheritPositionProperty, value);
2020 NotifyPropertyChanged();
2025 /// Gets or sets the clipping behavior (mode) of it's children.
2027 /// <since_tizen> 3 </since_tizen>
2028 public ClippingModeType ClippingMode
2032 return (ClippingModeType)GetValue(ClippingModeProperty);
2036 SetValue(ClippingModeProperty, value);
2037 NotifyPropertyChanged();
2042 /// Gets the number of renderers held by the view.
2044 /// <since_tizen> 3 </since_tizen>
2045 public uint RendererCount
2049 return GetRendererCount();
2054 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2057 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2059 /// <since_tizen> 3 </since_tizen>
2060 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2062 "View view = new View(); " +
2063 "view.PivotPoint = PivotPoint.Center; " +
2064 "view.PositionUsesPivotPoint = true;")]
2065 [EditorBrowsable(EditorBrowsableState.Never)]
2066 public Position AnchorPoint
2070 Position temp = new Position(0.0f, 0.0f, 0.0f);
2071 var pValue = GetProperty(View.Property.AnchorPoint);
2074 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2080 var temp = new Tizen.NUI.PropertyValue(value);
2081 SetProperty(View.Property.AnchorPoint, temp);
2083 NotifyPropertyChanged();
2088 /// Sets the size of a view for the width, the height and the depth.<br />
2089 /// Geometry can be scaled to fit within this area.<br />
2090 /// This does not interfere with the view's scale factor.<br />
2091 /// The views default depth is the minimum of width and height.<br />
2095 /// Animatable - This property can be animated using <c>Animation</c> class.
2097 /// animation.AnimateTo(view, "Size", new Size(100, 100));
2100 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2102 /// <since_tizen> 5 </since_tizen>
2107 Size tmp = (Size)GetValue(SizeProperty);
2108 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2112 SetValue(SizeProperty, value);
2113 NotifyPropertyChanged();
2118 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2120 /// <since_tizen> 3 </since_tizen>
2121 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2123 "Container parent = view.GetParent(); " +
2124 "View view = parent as View;")]
2125 [EditorBrowsable(EditorBrowsableState.Never)]
2126 public new View Parent
2131 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2132 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2133 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2135 if (basehandle is Layer layer)
2137 ret = new View(Layer.getCPtr(layer).Handle, false);
2138 NUILog.Error("This Parent property is deprecated, should do not be used");
2142 ret = basehandle as View;
2145 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2146 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2148 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2154 /// Gets/Sets whether inherit parent's the layout Direction.
2156 /// <since_tizen> 4 </since_tizen>
2157 public bool InheritLayoutDirection
2161 return (bool)GetValue(InheritLayoutDirectionProperty);
2165 SetValue(InheritLayoutDirectionProperty, value);
2166 NotifyPropertyChanged();
2171 /// Gets/Sets the layout Direction.
2173 /// <since_tizen> 4 </since_tizen>
2174 public ViewLayoutDirectionType LayoutDirection
2178 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2182 SetValue(LayoutDirectionProperty, value);
2183 NotifyPropertyChanged();
2184 layout?.RequestLayout();
2189 /// Gets or sets the Margin for use in layout.
2192 /// Margin property is supported by Layout algorithms and containers.
2193 /// Please Set Layout if you want to use Margin property.
2194 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2196 /// <since_tizen> 4 </since_tizen>
2197 public Extents Margin
2201 // If View has a Layout then margin is stored in Layout.
2204 return Layout.Margin;
2208 // If Layout not set then return margin stored in View.
2209 Extents temp = (Extents)GetValue(MarginProperty);
2210 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2212 // Two return points to prevent creating a zeroed Extent native object before assignment
2218 // Layout set so store Margin in LayoutItem instead of View.
2219 // If View stores the Margin too then the Legacy Size Negotiation will
2220 // overwrite the position and size values measured in the Layouting.
2221 Layout.Margin = value;
2222 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2223 layout?.RequestLayout();
2227 SetValue(MarginProperty, value);
2229 NotifyPropertyChanged();
2230 layout?.RequestLayout();
2235 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2239 /// // matchParentView matches its size to its parent size.
2240 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2241 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2243 /// // wrapContentView wraps its children with their desired size.
2244 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2245 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2247 /// // exactSizeView shows itself with an exact size.
2248 /// exactSizeView.WidthSpecification = 100;
2249 /// exactSizeView.HeightSpecification = 100;
2252 /// <since_tizen> 6 </since_tizen>
2253 [Binding.TypeConverter(typeof(IntDpTypeConverter))]
2254 public int WidthSpecification
2262 if (value == widthPolicy)
2265 widthPolicy = value;
2266 if (widthPolicy >= 0)
2268 if (heightPolicy >= 0) // Policy an exact value
2270 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2271 Size2D = new Size2D(widthPolicy, heightPolicy);
2274 layout?.RequestLayout();
2279 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2283 /// // matchParentView matches its size to its parent size.
2284 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2285 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2287 /// // wrapContentView wraps its children with their desired size.
2288 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2289 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2291 /// // exactSizeView shows itself with an exact size.
2292 /// exactSizeView.WidthSpecification = 100;
2293 /// exactSizeView.HeightSpecification = 100;
2296 /// <since_tizen> 6 </since_tizen>
2297 [Binding.TypeConverter(typeof(IntDpTypeConverter))]
2298 public int HeightSpecification
2302 return heightPolicy;
2306 if (value == heightPolicy)
2309 heightPolicy = value;
2310 if (heightPolicy >= 0)
2312 if (widthPolicy >= 0) // Policy an exact value
2314 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2315 Size2D = new Size2D(widthPolicy, heightPolicy);
2318 layout?.RequestLayout();
2323 /// Gets the List of transitions for this View.
2325 /// <since_tizen> 6 </since_tizen>
2326 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2330 if (layoutTransitions == null)
2332 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2334 return layoutTransitions;
2339 /// Sets a layout transitions for this View.
2341 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2343 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2345 /// <since_tizen> 6 </since_tizen>
2346 public LayoutTransition LayoutTransition
2350 return layoutTransition;
2356 throw new global::System.ArgumentNullException(nameof(value));
2358 if (layoutTransitions == null)
2360 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2363 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2365 AttachTransitionsToChildren(value);
2367 layoutTransition = value;
2372 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2375 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2377 /// <since_tizen> 4 </since_tizen>
2378 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2379 [EditorBrowsable(EditorBrowsableState.Never)]
2380 public Extents PaddingEX
2384 Extents temp = new Extents(0, 0, 0, 0);
2385 var pValue = GetProperty(View.Property.PADDING);
2388 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2394 var temp = new Tizen.NUI.PropertyValue(value);
2395 SetProperty(View.Property.PADDING, temp);
2397 NotifyPropertyChanged();
2398 layout?.RequestLayout();
2402 [EditorBrowsable(EditorBrowsableState.Never)]
2403 public XamlStyle XamlStyle
2407 return (XamlStyle)GetValue(XamlStyleProperty);
2411 SetValue(XamlStyleProperty, value);
2416 /// The Color of View. This is an RGBA value.
2420 /// Animatable - This property can be animated using <c>Animation</c> class.
2422 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2424 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2425 [EditorBrowsable(EditorBrowsableState.Never)]
2430 Color temp = (Color)GetValue(ColorProperty);
2431 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2435 SetValue(ColorProperty, value);
2436 NotifyPropertyChanged();
2441 /// Set the layout on this View. Replaces any existing Layout.
2444 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2446 /// <since_tizen> 6 </since_tizen>
2447 public LayoutItem Layout
2455 // Do nothing if layout provided is already set on this View.
2456 if (value == layout)
2461 LayoutingDisabled = false;
2464 // If new layout being set already has a owner then that owner receives a replacement default layout.
2465 // First check if the layout to be set already has a owner.
2466 if (value?.Owner != null)
2468 // Previous owner of the layout gets a default layout as a replacement.
2469 value.Owner.Layout = new AbsoluteLayout()
2471 // Copy Margin and Padding to replacement LayoutGroup.
2472 Margin = value.Margin,
2473 Padding = value.Padding,
2477 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2478 // View if no replacement. Previously margin and padding values would have been moved from
2479 // the View to the layout.
2480 if (layout != null) // Existing layout
2484 // Existing layout being replaced so copy over margin and padding values.
2485 value.Margin = layout.Margin;
2486 value.Padding = layout.Padding;
2487 value.SetPositionByLayout = !excludeLayouting;
2491 // Layout not being replaced so restore margin and padding to View.
2492 SetValue(MarginProperty, layout.Margin);
2493 SetValue(PaddingProperty, layout.Padding);
2494 NotifyPropertyChanged();
2499 // First Layout to be added to the View hence copy
2501 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2504 Extents margin = Margin;
2505 Extents padding = Padding;
2506 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2508 // If View already has a margin set then store it in Layout instead.
2509 value.Margin = margin;
2510 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2511 NotifyPropertyChanged();
2514 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2516 // If View already has a padding set then store it in Layout instead.
2517 value.Padding = padding;
2519 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2520 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2521 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2523 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2524 NotifyPropertyChanged();
2528 value.SetPositionByLayout = !excludeLayouting;
2532 // Remove existing layout from it's parent layout group.
2535 // Set layout to this view
2541 /// The weight of the View, used to share available space in a layout with siblings.
2543 /// <since_tizen> 6 </since_tizen>
2553 layout?.RequestLayout();
2558 /// Whether to load the BackgroundImage synchronously.
2559 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2560 /// Note: For Normal Quad images only.
2562 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2563 [EditorBrowsable(EditorBrowsableState.Never)]
2564 public bool BackgroundImageSynchronosLoading
2568 return BackgroundImageSynchronousLoading;
2572 BackgroundImageSynchronousLoading = value;
2577 /// Whether to load the BackgroundImage synchronously.
2578 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2579 /// Note: For Normal Quad images only.
2581 /// This will be public opened in tizen_7.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2582 [EditorBrowsable(EditorBrowsableState.Never)]
2583 public bool BackgroundImageSynchronousLoading
2587 return backgroundImageSynchronousLoading;
2591 backgroundImageSynchronousLoading = value;
2593 string bgUrl = null;
2594 var pValue = Background.Find(ImageVisualProperty.URL);
2595 pValue?.Get(out bgUrl);
2598 if (!string.IsNullOrEmpty(bgUrl))
2600 PropertyMap bgMap = this.Background;
2601 var temp = new PropertyValue(backgroundImageSynchronousLoading);
2602 bgMap.Add("synchronousLoading", temp);
2609 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2610 [EditorBrowsable(EditorBrowsableState.Never)]
2611 public Vector2 UpdateSizeHint
2615 return (Vector2)GetValue(UpdateSizeHintProperty);
2619 SetValue(UpdateSizeHintProperty, value);
2620 NotifyPropertyChanged();
2625 /// Enable/Disable ControlState propagation for children.
2626 /// It is false by default.
2627 /// If the View needs to share ControlState with descendants, please set it true.
2628 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2630 [EditorBrowsable(EditorBrowsableState.Never)]
2631 public bool EnableControlStatePropagation
2633 get => themeData?.ControlStatePropagation ?? false;
2636 if (EnableControlStatePropagation == value) return;
2638 if (themeData == null) themeData = new ThemeData();
2640 themeData.ControlStatePropagation = value;
2642 foreach (View child in Children)
2644 child.EnableControlStatePropagation = value;
2650 /// By default, it is false in View, true in Control.
2651 /// Note that if the value is true, the View will be a touch receptor.
2653 [EditorBrowsable(EditorBrowsableState.Never)]
2654 public bool EnableControlState
2658 return (bool)GetValue(EnableControlStateProperty);
2662 SetValue(EnableControlStateProperty, value);
2667 /// Whether the actor grab all touches even if touch leaves its boundary.
2669 /// <returns>true, if it grab all touch after start</returns>
2670 [EditorBrowsable(EditorBrowsableState.Never)]
2671 public bool GrabTouchAfterLeave
2676 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2677 pValue.Get(out temp);
2683 var temp = new Tizen.NUI.PropertyValue(value);
2684 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2686 NotifyPropertyChanged();
2691 /// Determines which blend equation will be used to render renderers of this actor.
2693 /// <returns>blend equation enum currently assigned</returns>
2694 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2695 [EditorBrowsable(EditorBrowsableState.Never)]
2696 public BlendEquationType BlendEquation
2701 var pValue = GetProperty(View.Property.BlendEquation);
2702 pValue.Get(out temp);
2704 return (BlendEquationType)temp;
2708 var temp = new Tizen.NUI.PropertyValue((int)value);
2709 SetProperty(View.Property.BlendEquation, temp);
2711 NotifyPropertyChanged();
2716 /// If the value is true, the View will change its style as the theme changes.
2717 /// The default value is false in normal case but it can be true when the NUIApplication is created with <see cref="NUIApplication.ThemeOptions.ThemeChangeSensitive"/>.
2719 /// <since_tizen> 9 </since_tizen>
2720 public bool ThemeChangeSensitive
2722 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2723 set => SetValue(ThemeChangeSensitiveProperty, value);
2727 /// Create Style, it is abstract function and must be override.
2729 [EditorBrowsable(EditorBrowsableState.Never)]
2730 protected virtual ViewStyle CreateViewStyle()
2732 return new ViewStyle();
2736 /// Called after the View's ControlStates changed.
2738 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2739 [EditorBrowsable(EditorBrowsableState.Never)]
2740 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2746 [EditorBrowsable(EditorBrowsableState.Never)]
2747 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2749 if (string.IsNullOrEmpty(styleName)) ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(GetType()));
2750 else ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(styleName));
2754 /// Apply style instance to the view.
2755 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2757 /// <since_tizen> 9 </since_tizen>
2758 public virtual void ApplyStyle(ViewStyle viewStyle)
2760 if (viewStyle == null || themeData?.viewStyle == viewStyle) return;
2762 if (themeData == null) themeData = new ThemeData();
2764 themeData.viewStyle = viewStyle;
2766 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2772 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2774 if (bindablePropertyOfView == null)
2779 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2780 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2782 foreach (var sourceProperty in dirtyStyleProperties)
2784 var sourceValue = viewStyle.GetValue(sourceProperty);
2786 if (sourceValue == null)
2791 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2793 if (destinationProperty != null)
2795 SetValue(destinationProperty, sourceValue);
2801 /// Get whether the View is culled or not.
2802 /// True means that the View is out of the view frustum.
2805 /// Hidden-API (Inhouse-API).
2807 [EditorBrowsable(EditorBrowsableState.Never)]
2813 var pValue = GetProperty(View.Property.Culled);
2814 pValue.Get(out temp);
2821 /// Set or Get TransitionOptions for the page transition.
2822 /// This property is used to define how this view will be transitioned during Page switching.
2824 /// <since_tizen> 9 </since_tizen>
2825 public TransitionOptions TransitionOptions
2829 transitionOptions = value;
2833 return transitionOptions;