2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.Binding;
23 namespace Tizen.NUI.BaseComponents
26 /// View is the base class for all views.
28 /// <since_tizen> 3 </since_tizen>
29 public partial class View : Container, IResourcesProvider
31 private static HashSet<BindableProperty> positionPropertyGroup = new HashSet<BindableProperty>();
32 private static HashSet<BindableProperty> sizePropertyGroup = new HashSet<BindableProperty>();
33 private static HashSet<BindableProperty> scalePropertyGroup = new HashSet<BindableProperty>();
35 internal BackgroundExtraData backgroundExtraData;
37 private bool layoutSet = false;
38 private LayoutItem layout; // Exclusive layout assigned to this View.
40 // List of transitions paired with the condition that uses the transition.
41 private Dictionary<TransitionCondition, TransitionList> layoutTransitions;
42 private int widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
43 private int heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
44 private float weight = 0.0f; // Weighting of child View in a Layout
45 private bool backgroundImageSynchronosLoading = false;
46 private bool excludeLayouting = false;
47 private LayoutTransition layoutTransition;
48 private TransitionOptions transitionOptions = null;
49 private ThemeData themeData;
53 RegisterPropertyGroup(PositionProperty, positionPropertyGroup);
54 RegisterPropertyGroup(Position2DProperty, positionPropertyGroup);
55 RegisterPropertyGroup(PositionXProperty, positionPropertyGroup);
56 RegisterPropertyGroup(PositionYProperty, positionPropertyGroup);
58 RegisterPropertyGroup(SizeProperty, sizePropertyGroup);
59 RegisterPropertyGroup(Size2DProperty, sizePropertyGroup);
60 RegisterPropertyGroup(SizeWidthProperty, sizePropertyGroup);
61 RegisterPropertyGroup(SizeHeightProperty, sizePropertyGroup);
63 RegisterPropertyGroup(ScaleProperty, scalePropertyGroup);
64 RegisterPropertyGroup(ScaleXProperty, scalePropertyGroup);
65 RegisterPropertyGroup(ScaleYProperty, scalePropertyGroup);
66 RegisterPropertyGroup(ScaleZProperty, scalePropertyGroup);
70 /// Creates a new instance of a view.
72 /// <since_tizen> 3 </since_tizen>
73 public View() : this(Interop.View.New(), true)
75 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
78 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
79 [EditorBrowsable(EditorBrowsableState.Never)]
80 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
85 /// Create a new instance of a View with setting the status of shown or hidden.
87 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
88 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
89 [EditorBrowsable(EditorBrowsableState.Never)]
90 public View(bool shown) : this(Interop.View.New(), true)
92 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
98 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
107 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
109 InitializeStyle(viewStyle);
112 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
116 PositionUsesPivotPoint = false;
119 onWindowSendEventCallback = SendViewAddedEventToWindow;
120 this.OnWindowSignal().Connect(onWindowSendEventCallback);
128 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
139 /// The event that is triggered when the View's ControlState is changed.
141 [EditorBrowsable(EditorBrowsableState.Never)]
142 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
144 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
148 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
150 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
151 [EditorBrowsable(EditorBrowsableState.Never)]
152 public bool LayoutSet
161 /// Flag to allow Layouting to be disabled for Views.
162 /// Once a View has a Layout set then any children added to Views from then on will receive
163 /// automatic Layouts.
165 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
166 [EditorBrowsable(EditorBrowsableState.Never)]
167 public static bool LayoutingDisabled { get; set; } = true;
170 /// Deprecate. Please do not use this.
171 /// The style instance applied to this view.
172 /// Note that please do not modify the ViewStyle.
173 /// Modifying ViewStyle will affect other views with same ViewStyle.
175 [EditorBrowsable(EditorBrowsableState.Never)]
176 protected ViewStyle ViewStyle
180 if (themeData == null) themeData = new ThemeData();
182 if (themeData.viewStyle == null)
184 ApplyStyle(CreateViewStyle());
186 return themeData.viewStyle;
191 /// Get/Set the control state.
192 /// Note that the ControlState only available for the classes derived from Control.
193 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
194 /// please set <see cref="EnableControlState"/> to true.
196 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
197 [EditorBrowsable(EditorBrowsableState.Never)]
198 public ControlState ControlState
202 return themeData == null ? ControlState.Normal : themeData.controlStates;
206 if (ControlState == value)
211 var prevState = ControlState;
213 if (themeData == null) themeData = new ThemeData();
214 themeData.controlStates = value;
216 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
218 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
220 if (themeData.ControlStatePropagation)
222 foreach (View child in Children)
224 child.ControlState = value;
228 OnControlStateChanged(changeInfo);
230 ControlStateChangedEvent?.Invoke(this, changeInfo);
235 /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
237 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
238 [EditorBrowsable(EditorBrowsableState.Never)]
239 public bool ExcludeLayouting
243 return excludeLayouting;
247 excludeLayouting = value;
248 if (Layout != null && Layout.SetPositionByLayout == value)
250 Layout.SetPositionByLayout = !value;
251 Layout.RequestLayout();
256 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
257 [EditorBrowsable(EditorBrowsableState.Never)]
258 public bool IsResourcesCreated
262 return Application.Current.IsResourcesCreated;
266 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
267 [EditorBrowsable(EditorBrowsableState.Never)]
268 public ResourceDictionary XamlResources
272 return Application.Current.XamlResources;
276 Application.Current.XamlResources = value;
281 /// The StyleName, type string.
282 /// The value indicates DALi style name defined in json theme file.
284 /// <since_tizen> 3 </since_tizen>
285 public string StyleName
289 return (string)GetValue(StyleNameProperty);
293 SetValue(StyleNameProperty, value);
294 NotifyPropertyChanged();
299 /// The KeyInputFocus, type bool.
301 [EditorBrowsable(EditorBrowsableState.Never)]
302 public bool KeyInputFocus
306 return (bool)GetValue(KeyInputFocusProperty);
310 SetValue(KeyInputFocusProperty, value);
311 NotifyPropertyChanged();
316 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
320 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
323 /// Animatable - This property can be animated using <c>Animation</c> class.
325 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
329 /// <since_tizen> 3 </since_tizen>
330 public Color BackgroundColor
334 Color temp = (Color)GetValue(BackgroundColorProperty);
335 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
339 SetValue(BackgroundColorProperty, value);
340 NotifyPropertyChanged();
345 /// The mutually exclusive with "backgroundColor" and "background" type Map.
347 /// <since_tizen> 3 </since_tizen>
348 public string BackgroundImage
352 return (string)GetValue(BackgroundImageProperty);
356 SetValue(BackgroundImageProperty, value);
357 NotifyPropertyChanged();
362 /// Get or set the border of background image.
364 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
365 [EditorBrowsable(EditorBrowsableState.Never)]
366 public Rectangle BackgroundImageBorder
370 return (Rectangle)GetValue(BackgroundImageBorderProperty);
374 SetValue(BackgroundImageBorderProperty, value);
375 NotifyPropertyChanged();
380 /// The background of view.
382 /// <since_tizen> 3 </since_tizen>
383 public Tizen.NUI.PropertyMap Background
387 return (PropertyMap)GetValue(BackgroundProperty);
391 SetValue(BackgroundProperty, value);
392 NotifyPropertyChanged();
397 /// Describes a shadow as an image for a View.
398 /// It is null by default.
401 /// Getter returns copied instance of current shadow.
404 /// The mutually exclusive with "BoxShadow".
408 /// Animatable - This property can be animated using <c>Animation</c> class.
409 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
411 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
413 /// Animatable sub-property : Offset.
416 [EditorBrowsable(EditorBrowsableState.Never)]
417 public ImageShadow ImageShadow
421 return (ImageShadow)GetValue(ImageShadowProperty);
425 SetValue(ImageShadowProperty, value);
426 NotifyPropertyChanged();
431 /// Describes a box shaped shadow drawing for a View.
432 /// It is null by default.
435 /// The mutually exclusive with "ImageShadow".
439 /// Animatable - This property can be animated using <c>Animation</c> class.
440 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
442 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
444 /// Animatable sub-property : Offset, Color, BlurRadius.
447 /// <since_tizen> 9 </since_tizen>
448 public Shadow BoxShadow
452 return (Shadow)GetValue(BoxShadowProperty);
456 SetValue(BoxShadowProperty, value);
457 NotifyPropertyChanged();
462 /// The radius for the rounded corners of the View.
463 /// This will rounds background and shadow edges.
464 /// The values in Vector4 are used in clockwise order from top-left to bottom-left : Vector4(top-left-corner, top-right-corner, bottom-right-corner, bottom-left-corner).
465 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
469 /// Animatable - This property can be animated using <c>Animation</c> class.
472 /// <since_tizen> 9 </since_tizen>
473 public Vector4 CornerRadius
477 return (Vector4)GetValue(CornerRadiusProperty);
481 SetValue(CornerRadiusProperty, value);
482 NotifyPropertyChanged();
487 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
488 /// It is absolute by default.
489 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
491 /// <since_tizen> 9 </since_tizen>
492 public VisualTransformPolicyType CornerRadiusPolicy
494 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
495 set => SetValue(CornerRadiusPolicyProperty, value);
499 /// The width for the borderline of the View.
500 /// This will draw borderline at background.
501 /// Note that, an image background may not have borderline if it uses a Border property.
505 /// Animatable - This property can be animated using <c>Animation</c> class.
508 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
509 [EditorBrowsable(EditorBrowsableState.Never)]
510 public float BorderlineWidth
514 return (float)GetValue(BorderlineWidthProperty);
518 SetValue(BorderlineWidthProperty, value);
519 NotifyPropertyChanged();
524 /// The color for the borderline of the View.
525 /// It is Color.Black by default.
529 /// Animatable - This property can be animated using <c>Animation</c> class.
532 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
533 [EditorBrowsable(EditorBrowsableState.Never)]
534 public Color BorderlineColor
538 return (Color)GetValue(BorderlineColorProperty);
542 SetValue(BorderlineColorProperty, value);
543 NotifyPropertyChanged();
548 /// The Relative offset for the borderline of the View.
549 /// recommand [-1.0f to 1.0f] range.
550 /// If -1.0f, borderline draw inside of View.
551 /// If 1.0f, borderline draw outside of View.
552 /// If 0.0f, borderline draw half at inside and half at outside.
553 /// It is 0.0f by default.
557 /// Animatable - This property can be animated using <c>Animation</c> class.
560 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
561 [EditorBrowsable(EditorBrowsableState.Never)]
562 public float BorderlineOffset
566 return (float)GetValue(BorderlineOffsetProperty);
570 SetValue(BorderlineOffsetProperty, value);
571 NotifyPropertyChanged();
576 /// The current state of the view.
578 /// <since_tizen> 3 </since_tizen>
583 return (States)GetValue(StateProperty);
587 SetValue(StateProperty, value);
588 NotifyPropertyChanged();
593 /// The current sub state of the view.
595 /// <since_tizen> 3 </since_tizen>
596 public States SubState
600 return (States)GetValue(SubStateProperty);
604 SetValue(SubStateProperty, value);
605 NotifyPropertyChanged();
610 /// Displays a tooltip
612 /// <since_tizen> 3 </since_tizen>
613 public Tizen.NUI.PropertyMap Tooltip
617 return (PropertyMap)GetValue(TooltipProperty);
621 SetValue(TooltipProperty, value);
622 NotifyPropertyChanged();
627 /// Displays a tooltip as a text.
629 /// <since_tizen> 3 </since_tizen>
630 public string TooltipText
634 using (var propertyValue = GetProperty(Property.TOOLTIP))
636 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
638 return retrivedValue;
640 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
641 return "error to get TooltipText";
646 var temp = new Tizen.NUI.PropertyValue(value);
647 SetProperty(View.Property.TOOLTIP, temp);
649 NotifyPropertyChanged();
654 /// The Child property of FlexContainer.<br />
655 /// The proportion of the free space in the container, the flex item will receive.<br />
656 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
658 /// <since_tizen> 3 </since_tizen>
659 [Obsolete("Deprecated in API8, will be removed in API10.")]
664 return (float)GetValue(FlexProperty);
668 SetValue(FlexProperty, value);
669 NotifyPropertyChanged();
674 /// The Child property of FlexContainer.<br />
675 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
677 /// <since_tizen> 3 </since_tizen>
678 [Obsolete("Deprecated in API8, will be removed in API10.")]
683 return (int)GetValue(AlignSelfProperty);
687 SetValue(AlignSelfProperty, value);
688 NotifyPropertyChanged();
693 /// The Child property of FlexContainer.<br />
694 /// The space around the flex item.<br />
697 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
699 /// <since_tizen> 3 </since_tizen>
700 [Obsolete("Deprecated in API8, will be removed in API10.")]
701 public Vector4 FlexMargin
705 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
706 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
710 SetValue(FlexMarginProperty, value);
711 NotifyPropertyChanged();
716 /// The top-left cell this child occupies, if not set, the first available cell is used.
719 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
720 /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
722 /// <since_tizen> 3 </since_tizen>
723 public Vector2 CellIndex
727 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
728 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
732 SetValue(CellIndexProperty, value);
733 NotifyPropertyChanged();
738 /// The number of rows this child occupies, if not set, the default value is 1.
741 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
743 /// <since_tizen> 3 </since_tizen>
748 return (float)GetValue(RowSpanProperty);
752 SetValue(RowSpanProperty, value);
753 NotifyPropertyChanged();
758 /// The number of columns this child occupies, if not set, the default value is 1.
761 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
763 /// <since_tizen> 3 </since_tizen>
764 public float ColumnSpan
768 return (float)GetValue(ColumnSpanProperty);
772 SetValue(ColumnSpanProperty, value);
773 NotifyPropertyChanged();
778 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
781 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
783 /// <since_tizen> 3 </since_tizen>
784 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
788 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
792 SetValue(CellHorizontalAlignmentProperty, value);
793 NotifyPropertyChanged();
798 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
801 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
803 /// <since_tizen> 3 </since_tizen>
804 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
808 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
812 SetValue(CellVerticalAlignmentProperty, value);
813 NotifyPropertyChanged();
818 /// The left focusable view.<br />
819 /// This will return null if not set.<br />
820 /// This will also return null if the specified left focusable view is not on a window.<br />
822 /// <since_tizen> 3 </since_tizen>
823 public View LeftFocusableView
825 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
828 return (View)GetValue(LeftFocusableViewProperty);
832 SetValue(LeftFocusableViewProperty, value);
833 NotifyPropertyChanged();
838 /// The right focusable view.<br />
839 /// This will return null if not set.<br />
840 /// This will also return null if the specified right focusable view is not on a window.<br />
842 /// <since_tizen> 3 </since_tizen>
843 public View RightFocusableView
845 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
848 return (View)GetValue(RightFocusableViewProperty);
852 SetValue(RightFocusableViewProperty, value);
853 NotifyPropertyChanged();
858 /// The up focusable view.<br />
859 /// This will return null if not set.<br />
860 /// This will also return null if the specified up focusable view is not on a window.<br />
862 /// <since_tizen> 3 </since_tizen>
863 public View UpFocusableView
865 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
868 return (View)GetValue(UpFocusableViewProperty);
872 SetValue(UpFocusableViewProperty, value);
873 NotifyPropertyChanged();
878 /// The down focusable view.<br />
879 /// This will return null if not set.<br />
880 /// This will also return null if the specified down focusable view is not on a window.<br />
882 /// <since_tizen> 3 </since_tizen>
883 public View DownFocusableView
885 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
888 return (View)GetValue(DownFocusableViewProperty);
892 SetValue(DownFocusableViewProperty, value);
893 NotifyPropertyChanged();
898 /// Whether the view should be focusable by keyboard navigation.
900 /// <since_tizen> 3 </since_tizen>
901 public bool Focusable
905 SetValue(FocusableProperty, value);
906 NotifyPropertyChanged();
910 return (bool)GetValue(FocusableProperty);
915 /// Whether this view can focus by touch.
916 /// If Focusable is false, FocusableInTouch is disabled.
917 /// If you want to have focus on touch, you need to set both Focusable and FocusableInTouch settings to true.
919 [EditorBrowsable(EditorBrowsableState.Never)]
920 public bool FocusableInTouch
924 SetValue(FocusableInTouchProperty, value);
925 NotifyPropertyChanged();
929 return (bool)GetValue(FocusableInTouchProperty);
934 /// Retrieves the position of the view.<br />
935 /// The coordinates are relative to the view's parent.<br />
937 /// <since_tizen> 3 </since_tizen>
938 public Position CurrentPosition
942 return GetCurrentPosition();
947 /// Sets the size of a view for the width and the height.<br />
948 /// Geometry can be scaled to fit within this area.<br />
949 /// This does not interfere with the view's scale factor.<br />
950 /// The views default depth is the minimum of width and height.<br />
953 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
954 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
956 /// <since_tizen> 3 </since_tizen>
961 Size2D temp = (Size2D)GetValue(Size2DProperty);
962 int width = temp.Width;
963 int height = temp.Height;
965 if (this.Layout == null)
967 if (width < 0) { width = 0; }
968 if (height < 0) { height = 0; }
971 return new Size2D(OnSize2DChanged, width, height);
975 SetValue(Size2DProperty, value);
977 NotifyPropertyChanged();
982 /// Retrieves the size of the view.<br />
983 /// The coordinates are relative to the view's parent.<br />
985 /// <since_tizen> 3 </since_tizen>
986 public Size2D CurrentSize
990 return GetCurrentSize();
995 /// Retrieves and sets the view's opacity.<br />
997 /// <since_tizen> 3 </since_tizen>
1002 return (float)GetValue(OpacityProperty);
1006 SetValue(OpacityProperty, value);
1007 NotifyPropertyChanged();
1012 /// Sets the position of the view for X and Y.<br />
1013 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1014 /// If the position inheritance is disabled, sets the world position.<br />
1017 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1018 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1020 /// <since_tizen> 3 </since_tizen>
1021 public Position2D Position2D
1025 Position2D temp = (Position2D)GetValue(Position2DProperty);
1026 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1030 SetValue(Position2DProperty, value);
1031 NotifyPropertyChanged();
1036 /// Retrieves the screen position of the view.<br />
1038 /// <since_tizen> 3 </since_tizen>
1039 public Vector2 ScreenPosition
1043 Vector2 temp = new Vector2(0.0f, 0.0f);
1044 var pValue = GetProperty(View.Property.ScreenPosition);
1052 /// Determines whether the pivot point should be used to determine the position of the view.
1053 /// This is false by default.
1055 /// <remarks>If false, then the top-left of the view is used for the position.
1056 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1058 /// <since_tizen> 3 </since_tizen>
1059 public bool PositionUsesPivotPoint
1063 return (bool)GetValue(PositionUsesPivotPointProperty);
1067 SetValue(PositionUsesPivotPointProperty, value);
1068 NotifyPropertyChanged();
1073 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1075 /// <since_tizen> 3 </since_tizen>
1076 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1078 "View view = new View(); " +
1079 "view.PivotPoint = PivotPoint.Center; " +
1080 "view.PositionUsesPivotPoint = true;" +
1081 " Deprecated in API5: Will be removed in API8")]
1082 [EditorBrowsable(EditorBrowsableState.Never)]
1083 public bool PositionUsesAnchorPoint
1088 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1089 pValue.Get(out temp);
1095 var temp = new Tizen.NUI.PropertyValue(value);
1096 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1098 NotifyPropertyChanged();
1103 /// Queries whether the view is connected to the stage.<br />
1104 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1106 /// <since_tizen> 3 </since_tizen>
1107 public bool IsOnWindow
1116 /// Gets the depth in the hierarchy for the view.
1118 /// <since_tizen> 3 </since_tizen>
1119 public int HierarchyDepth
1123 return GetHierarchyDepth();
1128 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1131 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1132 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1133 /// The values set by this property will likely change.
1135 /// <since_tizen> 3 </since_tizen>
1136 public int SiblingOrder
1140 return (int)GetValue(SiblingOrderProperty);
1144 SetValue(SiblingOrderProperty, value);
1146 LayoutGroup layout = Layout as LayoutGroup;
1147 layout?.ChangeLayoutSiblingOrder(value);
1149 NotifyPropertyChanged();
1154 /// Returns the natural size of the view.
1157 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1159 /// <since_tizen> 5 </since_tizen>
1160 public Vector3 NaturalSize
1164 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1165 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1171 /// Returns the natural size (Size2D) of the view.
1174 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1176 /// <since_tizen> 4 </since_tizen>
1177 public Size2D NaturalSize2D
1181 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1182 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1184 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1191 /// Gets or sets the origin of a view within its parent's area.<br />
1192 /// 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 />
1193 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1194 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1196 /// <pre>The view has been initialized.</pre>
1197 /// <since_tizen> 3 </since_tizen>
1198 public Position ParentOrigin
1202 Position tmp = (Position)GetValue(ParentOriginProperty);
1203 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1207 SetValue(ParentOriginProperty, value);
1208 NotifyPropertyChanged();
1213 /// Gets or sets the anchor-point of a view.<br />
1214 /// 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 />
1215 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1216 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1217 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1218 /// <pre>The view has been initialized.</pre>
1221 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1223 /// <since_tizen> 3 </since_tizen>
1224 public Position PivotPoint
1228 Position tmp = (Position)GetValue(PivotPointProperty);
1229 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1233 SetValue(PivotPointProperty, value);
1234 NotifyPropertyChanged();
1239 /// Gets or sets the size width of the view.
1243 /// Animatable - This property can be animated using <c>Animation</c> class.
1246 /// <since_tizen> 3 </since_tizen>
1247 public float SizeWidth
1251 return (float)GetValue(SizeWidthProperty);
1255 SetValue(SizeWidthProperty, value);
1256 NotifyPropertyChanged();
1261 /// Gets or sets the size height of the view.
1265 /// Animatable - This property can be animated using <c>Animation</c> class.
1268 /// <since_tizen> 3 </since_tizen>
1269 public float SizeHeight
1273 return (float)GetValue(SizeHeightProperty);
1277 SetValue(SizeHeightProperty, value);
1278 NotifyPropertyChanged();
1283 /// Gets or sets the position of the view.<br />
1284 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1285 /// If the position inheritance is disabled, sets the world position.<br />
1289 /// Animatable - This property can be animated using <c>Animation</c> class.
1291 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1293 /// <since_tizen> 3 </since_tizen>
1294 public Position Position
1298 Position tmp = (Position)GetValue(PositionProperty);
1299 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1303 SetValue(PositionProperty, value);
1304 NotifyPropertyChanged();
1309 /// Gets or sets the position X of the view.
1313 /// Animatable - This property can be animated using <c>Animation</c> class.
1316 /// <since_tizen> 3 </since_tizen>
1317 public float PositionX
1321 return (float)GetValue(PositionXProperty);
1325 SetValue(PositionXProperty, value);
1326 NotifyPropertyChanged();
1331 /// Gets or sets the position Y of the view.
1335 /// Animatable - This property can be animated using <c>Animation</c> class.
1338 /// <since_tizen> 3 </since_tizen>
1339 public float PositionY
1343 return (float)GetValue(PositionYProperty);
1347 SetValue(PositionYProperty, value);
1348 NotifyPropertyChanged();
1353 /// Gets or sets the position Z of the view.
1357 /// Animatable - This property can be animated using <c>Animation</c> class.
1360 /// <since_tizen> 3 </since_tizen>
1361 public float PositionZ
1365 return (float)GetValue(PositionZProperty);
1369 SetValue(PositionZProperty, value);
1370 NotifyPropertyChanged();
1375 /// Gets or sets the world position of the view.
1377 /// <since_tizen> 3 </since_tizen>
1378 public Vector3 WorldPosition
1382 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1383 var pValue = GetProperty(View.Property.WorldPosition);
1391 /// Gets or sets the orientation of the view.<br />
1392 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1396 /// This is an asynchronous method.
1399 /// Animatable - This property can be animated using <c>Animation</c> class.
1402 /// <since_tizen> 3 </since_tizen>
1403 public Rotation Orientation
1407 return (Rotation)GetValue(OrientationProperty);
1411 SetValue(OrientationProperty, value);
1412 NotifyPropertyChanged();
1417 /// Gets or sets the world orientation of the view.<br />
1419 /// <since_tizen> 3 </since_tizen>
1420 public Rotation WorldOrientation
1424 Rotation temp = new Rotation();
1425 var pValue = GetProperty(View.Property.WorldOrientation);
1433 /// Gets or sets the scale factor applied to the view.<br />
1437 /// Animatable - This property can be animated using <c>Animation</c> class.
1439 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1441 /// <since_tizen> 3 </since_tizen>
1442 public Vector3 Scale
1446 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1447 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1451 SetValue(ScaleProperty, value);
1452 NotifyPropertyChanged();
1457 /// Gets or sets the scale X factor applied to the view.
1461 /// Animatable - This property can be animated using <c>Animation</c> class.
1464 /// <since_tizen> 3 </since_tizen>
1469 return (float)GetValue(ScaleXProperty);
1473 SetValue(ScaleXProperty, value);
1474 NotifyPropertyChanged();
1479 /// Gets or sets the scale Y factor applied to the view.
1483 /// Animatable - This property can be animated using <c>Animation</c> class.
1486 /// <since_tizen> 3 </since_tizen>
1491 return (float)GetValue(ScaleYProperty);
1495 SetValue(ScaleYProperty, value);
1496 NotifyPropertyChanged();
1501 /// Gets or sets the scale Z factor applied to the view.
1505 /// Animatable - This property can be animated using <c>Animation</c> class.
1508 /// <since_tizen> 3 </since_tizen>
1513 return (float)GetValue(ScaleZProperty);
1517 SetValue(ScaleZProperty, value);
1518 NotifyPropertyChanged();
1523 /// Gets the world scale of the view.
1525 /// <since_tizen> 3 </since_tizen>
1526 public Vector3 WorldScale
1530 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1531 var pValue = GetProperty(View.Property.WorldScale);
1539 /// Retrieves the visibility flag of the view.
1543 /// If the view is not visible, then the view and its children will not be rendered.
1544 /// 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.
1547 /// Animatable - This property can be animated using <c>Animation</c> class.
1550 /// <since_tizen> 3 </since_tizen>
1551 public bool Visibility
1556 var pValue = GetProperty(View.Property.VISIBLE);
1557 pValue.Get(out temp);
1564 /// Gets the view's world color.
1566 /// <since_tizen> 3 </since_tizen>
1567 public Vector4 WorldColor
1571 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1572 var pValue = GetProperty(View.Property.WorldColor);
1580 /// Gets or sets the view's name.
1582 /// <since_tizen> 3 </since_tizen>
1587 return (string)GetValue(NameProperty);
1591 SetValue(NameProperty, value);
1592 NotifyPropertyChanged();
1597 /// Get the number of children held by the view.
1599 /// <since_tizen> 3 </since_tizen>
1600 public new uint ChildCount
1604 return Convert.ToUInt32(Children.Count);
1609 /// Gets the view's ID.
1612 /// <since_tizen> 3 </since_tizen>
1622 /// Gets or sets the status of whether the view should emit touch or hover signals.
1624 /// <since_tizen> 3 </since_tizen>
1625 public bool Sensitive
1629 return (bool)GetValue(SensitiveProperty);
1633 SetValue(SensitiveProperty, value);
1634 NotifyPropertyChanged();
1639 /// 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.
1641 /// <since_tizen> 3 </since_tizen>
1642 public bool LeaveRequired
1646 return (bool)GetValue(LeaveRequiredProperty);
1650 SetValue(LeaveRequiredProperty, value);
1651 NotifyPropertyChanged();
1656 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1658 /// <since_tizen> 3 </since_tizen>
1659 public bool InheritOrientation
1663 return (bool)GetValue(InheritOrientationProperty);
1667 SetValue(InheritOrientationProperty, value);
1668 NotifyPropertyChanged();
1673 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1675 /// <since_tizen> 3 </since_tizen>
1676 public bool InheritScale
1680 return (bool)GetValue(InheritScaleProperty);
1684 SetValue(InheritScaleProperty, value);
1685 NotifyPropertyChanged();
1690 /// Gets or sets the status of how the view and its children should be drawn.<br />
1691 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1692 /// 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 />
1693 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1694 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1695 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1697 /// <since_tizen> 3 </since_tizen>
1698 public DrawModeType DrawMode
1702 return (DrawModeType)GetValue(DrawModeProperty);
1706 SetValue(DrawModeProperty, value);
1707 NotifyPropertyChanged();
1712 /// Gets or sets the relative to parent size factor of the view.<br />
1713 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1714 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1717 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1719 /// <since_tizen> 3 </since_tizen>
1720 [Obsolete("Deprecated. Since Tizen.NUI.ResizePolicyType is deprecated, SizeModeFactor is no longer supported. Instead, please use parent view having Tizen.NUI.RelativeLayout as its Layout.")]
1721 public Vector3 SizeModeFactor
1725 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1726 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1730 SetValue(SizeModeFactorProperty, value);
1731 NotifyPropertyChanged();
1736 /// Gets or sets the width resize policy to be used.
1738 /// <since_tizen> 3 </since_tizen>
1739 [Obsolete("Deprecated. Please set Layout and use WidthSpecification instead.")]
1740 public ResizePolicyType WidthResizePolicy
1744 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1748 SetValue(WidthResizePolicyProperty, value);
1749 NotifyPropertyChanged();
1754 /// Gets or sets the height resize policy to be used.
1756 /// <since_tizen> 3 </since_tizen>
1757 [Obsolete("Deprecated. Please set Layout and use HeightSpecification instead.")]
1758 public ResizePolicyType HeightResizePolicy
1762 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1766 SetValue(HeightResizePolicyProperty, value);
1767 NotifyPropertyChanged();
1772 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1773 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1775 /// <since_tizen> 3 </since_tizen>
1776 public SizeScalePolicyType SizeScalePolicy
1780 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1784 SetValue(SizeScalePolicyProperty, value);
1785 NotifyPropertyChanged();
1790 /// Gets or sets the status of whether the width size is dependent on the height size.
1792 /// <since_tizen> 3 </since_tizen>
1793 public bool WidthForHeight
1797 return (bool)GetValue(WidthForHeightProperty);
1801 SetValue(WidthForHeightProperty, value);
1802 NotifyPropertyChanged();
1807 /// Gets or sets the status of whether the height size is dependent on the width size.
1809 /// <since_tizen> 3 </since_tizen>
1810 public bool HeightForWidth
1814 return (bool)GetValue(HeightForWidthProperty);
1818 SetValue(HeightForWidthProperty, value);
1819 NotifyPropertyChanged();
1824 /// Gets or sets the padding for use in layout.
1827 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1829 /// <since_tizen> 5 </since_tizen>
1830 public Extents Padding
1834 // If View has a Layout then padding in stored in the base Layout class
1837 return Layout.Padding;
1841 Extents temp = (Extents)GetValue(PaddingProperty);
1842 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1844 // Two return points to prevent creating a zeroed Extent native object before assignment
1848 Extents padding = value;
1851 // Layout set so store Padding in LayoutItem instead of in View.
1852 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1853 // the position and sizes measure in the Layouting.
1854 Layout.Padding = value;
1855 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1856 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1857 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1859 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1863 SetValue(PaddingProperty, padding);
1864 NotifyPropertyChanged();
1869 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1871 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1873 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1875 /// <since_tizen> 3 </since_tizen>
1876 public Size2D MinimumSize
1880 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1881 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1887 throw new ArgumentNullException(nameof(value));
1891 // Note: it only works if minimum size is >= than natural size.
1892 // To force the size it should be done through the width&height spec or Size2D.
1893 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1894 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1895 layout.RequestLayout();
1897 SetValue(MinimumSizeProperty, value);
1898 NotifyPropertyChanged();
1903 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1906 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1908 /// <since_tizen> 3 </since_tizen>
1909 public Size2D MaximumSize
1913 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1914 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1918 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1919 // MATCH_PARENT spec + parent container size can be used to limit
1922 layout.RequestLayout();
1924 SetValue(MaximumSizeProperty, value);
1925 NotifyPropertyChanged();
1930 /// Gets or sets whether a child view inherits it's parent's position.<br />
1931 /// Default is to inherit.<br />
1932 /// 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 />
1934 /// <since_tizen> 3 </since_tizen>
1935 public bool InheritPosition
1939 return (bool)GetValue(InheritPositionProperty);
1943 SetValue(InheritPositionProperty, value);
1944 NotifyPropertyChanged();
1949 /// Gets or sets the clipping behavior (mode) of it's children.
1951 /// <since_tizen> 3 </since_tizen>
1952 public ClippingModeType ClippingMode
1956 return (ClippingModeType)GetValue(ClippingModeProperty);
1960 SetValue(ClippingModeProperty, value);
1961 NotifyPropertyChanged();
1966 /// Gets the number of renderers held by the view.
1968 /// <since_tizen> 3 </since_tizen>
1969 public uint RendererCount
1973 return GetRendererCount();
1978 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1981 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1983 /// <since_tizen> 3 </since_tizen>
1984 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1986 "View view = new View(); " +
1987 "view.PivotPoint = PivotPoint.Center; " +
1988 "view.PositionUsesPivotPoint = true;")]
1989 [EditorBrowsable(EditorBrowsableState.Never)]
1990 public Position AnchorPoint
1994 Position temp = new Position(0.0f, 0.0f, 0.0f);
1995 var pValue = GetProperty(View.Property.AnchorPoint);
1998 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2004 var temp = new Tizen.NUI.PropertyValue(value);
2005 SetProperty(View.Property.AnchorPoint, temp);
2007 NotifyPropertyChanged();
2012 /// Sets the size of a view for the width, the height and the depth.<br />
2013 /// Geometry can be scaled to fit within this area.<br />
2014 /// This does not interfere with the view's scale factor.<br />
2015 /// The views default depth is the minimum of width and height.<br />
2019 /// Animatable - This property can be animated using <c>Animation</c> class.
2021 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2023 /// <since_tizen> 5 </since_tizen>
2028 Size tmp = (Size)GetValue(SizeProperty);
2029 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2033 SetValue(SizeProperty, value);
2034 NotifyPropertyChanged();
2039 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2041 /// <since_tizen> 3 </since_tizen>
2042 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2044 "Container parent = view.GetParent(); " +
2045 "View view = parent as View;")]
2046 [EditorBrowsable(EditorBrowsableState.Never)]
2047 public new View Parent
2052 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2053 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2054 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2056 if (basehandle is Layer layer)
2058 ret = new View(Layer.getCPtr(layer).Handle, false);
2059 NUILog.Error("This Parent property is deprecated, should do not be used");
2063 ret = basehandle as View;
2066 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2067 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2069 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2075 /// Gets/Sets whether inherit parent's the layout Direction.
2077 /// <since_tizen> 4 </since_tizen>
2078 public bool InheritLayoutDirection
2082 return (bool)GetValue(InheritLayoutDirectionProperty);
2086 SetValue(InheritLayoutDirectionProperty, value);
2087 NotifyPropertyChanged();
2092 /// Gets/Sets the layout Direction.
2094 /// <since_tizen> 4 </since_tizen>
2095 public ViewLayoutDirectionType LayoutDirection
2099 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2103 SetValue(LayoutDirectionProperty, value);
2104 NotifyPropertyChanged();
2105 layout?.RequestLayout();
2110 /// Gets or sets the Margin for use in layout.
2113 /// Margin property is supported by Layout algorithms and containers.
2114 /// Please Set Layout if you want to use Margin property.
2115 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2117 /// <since_tizen> 4 </since_tizen>
2118 public Extents Margin
2122 // If View has a Layout then margin is stored in Layout.
2125 return Layout.Margin;
2129 // If Layout not set then return margin stored in View.
2130 Extents temp = (Extents)GetValue(MarginProperty);
2131 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2133 // Two return points to prevent creating a zeroed Extent native object before assignment
2139 // Layout set so store Margin in LayoutItem instead of View.
2140 // If View stores the Margin too then the Legacy Size Negotiation will
2141 // overwrite the position and size values measured in the Layouting.
2142 Layout.Margin = value;
2143 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2144 layout?.RequestLayout();
2148 SetValue(MarginProperty, value);
2150 NotifyPropertyChanged();
2151 layout?.RequestLayout();
2156 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2160 /// // matchParentView matches its size to its parent size.
2161 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2162 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2164 /// // wrapContentView wraps its children with their desired size.
2165 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2166 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2168 /// // exactSizeView shows itself with an exact size.
2169 /// exactSizeView.WidthSpecification = 100;
2170 /// exactSizeView.HeightSpecification = 100;
2173 /// <since_tizen> 6 </since_tizen>
2174 public int WidthSpecification
2182 if (value == widthPolicy)
2185 widthPolicy = value;
2186 if (widthPolicy >= 0)
2188 if (heightPolicy >= 0) // Policy an exact value
2190 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2191 Size2D = new Size2D(widthPolicy, heightPolicy);
2194 layout?.RequestLayout();
2199 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2203 /// // matchParentView matches its size to its parent size.
2204 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2205 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2207 /// // wrapContentView wraps its children with their desired size.
2208 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2209 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2211 /// // exactSizeView shows itself with an exact size.
2212 /// exactSizeView.WidthSpecification = 100;
2213 /// exactSizeView.HeightSpecification = 100;
2216 /// <since_tizen> 6 </since_tizen>
2217 public int HeightSpecification
2221 return heightPolicy;
2225 if (value == heightPolicy)
2228 heightPolicy = value;
2229 if (heightPolicy >= 0)
2231 if (widthPolicy >= 0) // Policy an exact value
2233 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2234 Size2D = new Size2D(widthPolicy, heightPolicy);
2237 layout?.RequestLayout();
2242 /// Gets the List of transitions for this View.
2244 /// <since_tizen> 6 </since_tizen>
2245 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2249 if (layoutTransitions == null)
2251 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2253 return layoutTransitions;
2258 /// Sets a layout transitions for this View.
2260 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2262 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2264 /// <since_tizen> 6 </since_tizen>
2265 public LayoutTransition LayoutTransition
2269 return layoutTransition;
2275 throw new global::System.ArgumentNullException(nameof(value));
2277 if (layoutTransitions == null)
2279 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2282 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2284 AttachTransitionsToChildren(value);
2286 layoutTransition = value;
2291 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2294 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2296 /// <since_tizen> 4 </since_tizen>
2297 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2298 [EditorBrowsable(EditorBrowsableState.Never)]
2299 public Extents PaddingEX
2303 Extents temp = new Extents(0, 0, 0, 0);
2304 var pValue = GetProperty(View.Property.PADDING);
2307 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2313 var temp = new Tizen.NUI.PropertyValue(value);
2314 SetProperty(View.Property.PADDING, temp);
2316 NotifyPropertyChanged();
2317 layout?.RequestLayout();
2322 /// The Color of View. This is an RGBA value.
2326 /// Animatable - This property can be animated using <c>Animation</c> class.
2328 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2330 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2331 [EditorBrowsable(EditorBrowsableState.Never)]
2336 Color temp = (Color)GetValue(ColorProperty);
2337 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2341 SetValue(ColorProperty, value);
2342 NotifyPropertyChanged();
2347 /// Set the layout on this View. Replaces any existing Layout.
2350 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2352 /// <since_tizen> 6 </since_tizen>
2353 public LayoutItem Layout
2361 // Do nothing if layout provided is already set on this View.
2362 if (value == layout)
2367 LayoutingDisabled = false;
2370 // If new layout being set already has a owner then that owner receives a replacement default layout.
2371 // First check if the layout to be set already has a owner.
2372 if (value?.Owner != null)
2374 // Previous owner of the layout gets a default layout as a replacement.
2375 value.Owner.Layout = new AbsoluteLayout();
2377 // Copy Margin and Padding to replacement LayoutGroup.
2378 if (value.Owner.Layout != null)
2380 value.Owner.Layout.Margin = value.Margin;
2381 value.Owner.Layout.Padding = value.Padding;
2385 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2386 // View if no replacement. Previously margin and padding values would have been moved from
2387 // the View to the layout.
2388 if (layout != null) // Existing layout
2392 // Existing layout being replaced so copy over margin and padding values.
2393 value.Margin = layout.Margin;
2394 value.Padding = layout.Padding;
2398 // Layout not being replaced so restore margin and padding to View.
2399 SetValue(MarginProperty, layout.Margin);
2400 SetValue(PaddingProperty, layout.Padding);
2401 NotifyPropertyChanged();
2406 // First Layout to be added to the View hence copy
2408 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2411 Extents margin = Margin;
2412 Extents padding = Padding;
2413 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2415 // If View already has a margin set then store it in Layout instead.
2416 value.Margin = margin;
2417 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2418 NotifyPropertyChanged();
2421 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2423 // If View already has a padding set then store it in Layout instead.
2424 value.Padding = padding;
2426 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2427 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2428 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2430 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2431 NotifyPropertyChanged();
2437 // Remove existing layout from it's parent layout group.
2440 value.SetPositionByLayout = !excludeLayouting;
2442 // Set layout to this view
2448 /// The weight of the View, used to share available space in a layout with siblings.
2450 /// <since_tizen> 6 </since_tizen>
2460 layout?.RequestLayout();
2465 /// Whether to load the BackgroundImage synchronously.
2466 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2467 /// Note: For Normal Quad images only.
2469 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2470 [EditorBrowsable(EditorBrowsableState.Never)]
2471 public bool BackgroundImageSynchronosLoading
2475 return backgroundImageSynchronosLoading;
2479 backgroundImageSynchronosLoading = value;
2481 string bgUrl = null;
2482 var pValue = Background.Find(ImageVisualProperty.URL);
2483 pValue?.Get(out bgUrl);
2486 if (!string.IsNullOrEmpty(bgUrl))
2488 PropertyMap bgMap = this.Background;
2489 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2490 bgMap.Add("synchronousLoading", temp);
2497 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2498 [EditorBrowsable(EditorBrowsableState.Never)]
2499 public Vector2 UpdateSizeHint
2503 return (Vector2)GetValue(UpdateSizeHintProperty);
2507 SetValue(UpdateSizeHintProperty, value);
2508 NotifyPropertyChanged();
2513 /// Enable/Disable ControlState propagation for children.
2514 /// It is false by default.
2515 /// If the View needs to share ControlState with descendants, please set it true.
2516 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2518 [EditorBrowsable(EditorBrowsableState.Never)]
2519 public bool EnableControlStatePropagation
2521 get => themeData?.ControlStatePropagation ?? false;
2524 if (EnableControlStatePropagation == value) return;
2526 if (themeData == null) themeData = new ThemeData();
2528 themeData.ControlStatePropagation = value;
2530 foreach (View child in Children)
2532 child.EnableControlStatePropagation = value;
2538 /// By default, it is false in View, true in Control.
2539 /// Note that if the value is true, the View will be a touch receptor.
2541 [EditorBrowsable(EditorBrowsableState.Never)]
2542 public bool EnableControlState
2546 return (bool)GetValue(EnableControlStateProperty);
2550 SetValue(EnableControlStateProperty, value);
2555 /// Whether the actor grab all touches even if touch leaves its boundary.
2557 /// <returns>true, if it grab all touch after start</returns>
2558 [EditorBrowsable(EditorBrowsableState.Never)]
2559 public bool GrabTouchAfterLeave
2564 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2565 pValue.Get(out temp);
2571 var temp = new Tizen.NUI.PropertyValue(value);
2572 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2574 NotifyPropertyChanged();
2579 /// Determines which blend equation will be used to render renderers of this actor.
2581 /// <returns>blend equation enum currently assigned</returns>
2582 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2583 [EditorBrowsable(EditorBrowsableState.Never)]
2584 public BlendEquationType BlendEquation
2589 var pValue = GetProperty(View.Property.BlendEquation);
2590 pValue.Get(out temp);
2592 return (BlendEquationType)temp;
2596 var temp = new Tizen.NUI.PropertyValue((int)value);
2597 SetProperty(View.Property.BlendEquation, temp);
2599 NotifyPropertyChanged();
2604 /// If the value is true, the View will change its style as the theme changes.
2605 /// The default value is false in normal case but it can be true when the NUIApplication is created with <see cref="NUIApplication.ThemeOptions.ThemeChangeSensitive"/>.
2607 /// <since_tizen> 9 </since_tizen>
2608 public bool ThemeChangeSensitive
2610 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2611 set => SetValue(ThemeChangeSensitiveProperty, value);
2615 /// Create Style, it is abstract function and must be override.
2617 [EditorBrowsable(EditorBrowsableState.Never)]
2618 protected virtual ViewStyle CreateViewStyle()
2620 return new ViewStyle();
2624 /// Called after the View's ControlStates changed.
2626 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2627 [EditorBrowsable(EditorBrowsableState.Never)]
2628 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2634 [EditorBrowsable(EditorBrowsableState.Never)]
2635 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2637 if (string.IsNullOrEmpty(styleName)) ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(GetType()));
2638 else ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(styleName));
2642 /// Apply style instance to the view.
2643 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2645 /// <since_tizen> 9 </since_tizen>
2646 public virtual void ApplyStyle(ViewStyle viewStyle)
2648 if (viewStyle == null || themeData?.viewStyle == viewStyle) return;
2650 if (themeData == null) themeData = new ThemeData();
2652 themeData.viewStyle = viewStyle;
2654 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2660 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2662 if (bindablePropertyOfView == null)
2667 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2668 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2670 foreach (var sourceProperty in dirtyStyleProperties)
2672 var sourceValue = viewStyle.GetValue(sourceProperty);
2674 if (sourceValue == null)
2679 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2681 if (destinationProperty != null)
2683 SetValue(destinationProperty, sourceValue);
2689 /// Get whether the View is culled or not.
2690 /// True means that the View is out of the view frustum.
2693 /// Hidden-API (Inhouse-API).
2695 [EditorBrowsable(EditorBrowsableState.Never)]
2701 var pValue = GetProperty(View.Property.Culled);
2702 pValue.Get(out temp);
2709 /// Set or Get TransitionOptions for the page transition.
2710 /// This property is used to define how this view will be transitioned during Page switching.
2712 /// <since_tizen> 9 </since_tizen>
2713 public TransitionOptions TransitionOptions
2717 transitionOptions = value;
2721 return transitionOptions;