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 (bool)GetValue(ExcludeLayoutingProperty);
251 SetValue(ExcludeLayoutingProperty, value);
252 NotifyPropertyChanged();
256 private bool InternalExcludeLayouting
260 return excludeLayouting;
264 excludeLayouting = value;
265 if (Layout != null && Layout.SetPositionByLayout == value)
267 Layout.SetPositionByLayout = !value;
268 Layout.RequestLayout();
273 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
274 [EditorBrowsable(EditorBrowsableState.Never)]
275 public bool IsResourcesCreated
279 return Application.Current.IsResourcesCreated;
283 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
284 [EditorBrowsable(EditorBrowsableState.Never)]
285 public ResourceDictionary XamlResources
289 return Application.Current.XamlResources;
293 Application.Current.XamlResources = value;
298 /// The StyleName, type string.
299 /// The value indicates DALi style name defined in json theme file.
301 /// <since_tizen> 3 </since_tizen>
302 public string StyleName
306 return (string)GetValue(StyleNameProperty);
310 SetValue(StyleNameProperty, value);
311 NotifyPropertyChanged();
316 /// The KeyInputFocus, type bool.
318 [EditorBrowsable(EditorBrowsableState.Never)]
319 public bool KeyInputFocus
323 return (bool)GetValue(KeyInputFocusProperty);
327 SetValue(KeyInputFocusProperty, value);
328 NotifyPropertyChanged();
333 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
337 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
340 /// Animatable - This property can be animated using <c>Animation</c> class.
342 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
346 /// <since_tizen> 3 </since_tizen>
347 public Color BackgroundColor
351 Color temp = (Color)GetValue(BackgroundColorProperty);
352 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
356 SetValue(BackgroundColorProperty, value);
357 NotifyPropertyChanged();
362 /// The mutually exclusive with "backgroundColor" and "background" type Map.
364 /// <since_tizen> 3 </since_tizen>
365 public string BackgroundImage
369 return (string)GetValue(BackgroundImageProperty);
373 SetValue(BackgroundImageProperty, value);
374 NotifyPropertyChanged();
379 /// Get or set the border of background image.
381 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
382 [EditorBrowsable(EditorBrowsableState.Never)]
383 public Rectangle BackgroundImageBorder
387 return (Rectangle)GetValue(BackgroundImageBorderProperty);
391 SetValue(BackgroundImageBorderProperty, value);
392 NotifyPropertyChanged();
397 /// The background of view.
399 /// <since_tizen> 3 </since_tizen>
400 public Tizen.NUI.PropertyMap Background
404 return (PropertyMap)GetValue(BackgroundProperty);
408 SetValue(BackgroundProperty, value);
409 NotifyPropertyChanged();
414 /// Describes a shadow as an image for a View.
415 /// It is null by default.
418 /// Getter returns copied instance of current shadow.
421 /// The mutually exclusive with "BoxShadow".
425 /// Animatable - This property can be animated using <c>Animation</c> class.
426 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
428 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
430 /// Animatable sub-property : Offset.
433 [EditorBrowsable(EditorBrowsableState.Never)]
434 public ImageShadow ImageShadow
438 return (ImageShadow)GetValue(ImageShadowProperty);
442 SetValue(ImageShadowProperty, value);
443 NotifyPropertyChanged();
448 /// Describes a box shaped shadow drawing for a View.
449 /// It is null by default.
452 /// The mutually exclusive with "ImageShadow".
456 /// Animatable - This property can be animated using <c>Animation</c> class.
457 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
459 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
461 /// Animatable sub-property : Offset, Color, BlurRadius.
464 /// <since_tizen> 9 </since_tizen>
465 public Shadow BoxShadow
469 return (Shadow)GetValue(BoxShadowProperty);
473 SetValue(BoxShadowProperty, value);
474 NotifyPropertyChanged();
479 /// The radius for the rounded corners of the View.
480 /// This will rounds background and shadow edges.
481 /// 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).
482 /// Each radius will clamp internally to the half of smaller of the view's width or height.
483 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
487 /// Animatable - This property can be animated using <c>Animation</c> class.
489 /// animation.AnimateTo(view, "CornerRadius", new Vector4(10, 10, 10, 10));
493 /// <since_tizen> 9 </since_tizen>
494 public Vector4 CornerRadius
498 return (Vector4)GetValue(CornerRadiusProperty);
502 SetValue(CornerRadiusProperty, value);
503 NotifyPropertyChanged();
508 /// Whether the CornerRadius property value is relative (percentage [0.0f to 0.5f] of the view size) or absolute (in world units).
509 /// It is absolute by default.
510 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
512 /// <since_tizen> 9 </since_tizen>
513 public VisualTransformPolicyType CornerRadiusPolicy
515 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
516 set => SetValue(CornerRadiusPolicyProperty, value);
520 /// The width for the borderline of the View.
521 /// Note that, an image background may not have borderline if it uses a Border property.
525 /// Animatable - This property can be animated using <c>Animation</c> class.
527 /// animation.AnimateTo(view, "BorderlineWidth", 100.0f);
531 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
532 [EditorBrowsable(EditorBrowsableState.Never)]
533 public float BorderlineWidth
537 return (float)GetValue(BorderlineWidthProperty);
541 SetValue(BorderlineWidthProperty, value);
542 NotifyPropertyChanged();
547 /// The color for the borderline of the View.
548 /// It is Color.Black by default.
552 /// Animatable - This property can be animated using <c>Animation</c> class.
554 /// animation.AnimateTo(view, "BorderlineColor", new Color(r, g, b, a));
558 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
559 [EditorBrowsable(EditorBrowsableState.Never)]
560 public Color BorderlineColor
564 return (Color)GetValue(BorderlineColorProperty);
568 SetValue(BorderlineColorProperty, value);
569 NotifyPropertyChanged();
574 /// The Relative offset for the borderline of the View.
575 /// recommand [-1.0f to 1.0f] range.
576 /// If -1.0f, borderline draw inside of View.
577 /// If 1.0f, borderline draw outside of View.
578 /// If 0.0f, borderline draw half at inside and half at outside.
579 /// It is 0.0f by default.
583 /// Animatable - This property can be animated using <c>Animation</c> class.
585 /// animation.AnimateTo(view, "BorderlineOffset", -1.0f);
589 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
590 [EditorBrowsable(EditorBrowsableState.Never)]
591 public float BorderlineOffset
595 return (float)GetValue(BorderlineOffsetProperty);
599 SetValue(BorderlineOffsetProperty, value);
600 NotifyPropertyChanged();
605 /// The current state of the view.
607 /// <since_tizen> 3 </since_tizen>
612 return (States)GetValue(StateProperty);
616 SetValue(StateProperty, value);
617 NotifyPropertyChanged();
622 /// The current sub state of the view.
624 /// <since_tizen> 3 </since_tizen>
625 public States SubState
629 return (States)GetValue(SubStateProperty);
633 SetValue(SubStateProperty, value);
634 NotifyPropertyChanged();
639 /// Displays a tooltip
641 /// <since_tizen> 3 </since_tizen>
642 public Tizen.NUI.PropertyMap Tooltip
646 return (PropertyMap)GetValue(TooltipProperty);
650 SetValue(TooltipProperty, value);
651 NotifyPropertyChanged();
656 /// Displays a tooltip as a text.
658 /// <since_tizen> 3 </since_tizen>
659 public string TooltipText
663 return GetValue(TooltipTextProperty) as string;
667 SetValue(TooltipTextProperty, value);
671 private string InternalTooltipText
675 using (var propertyValue = GetProperty(Property.TOOLTIP))
677 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
679 return retrivedValue;
681 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
682 return "error to get TooltipText";
687 var temp = new Tizen.NUI.PropertyValue(value);
688 SetProperty(View.Property.TOOLTIP, temp);
690 NotifyPropertyChanged();
695 /// The Child property of FlexContainer.<br />
696 /// The proportion of the free space in the container, the flex item will receive.<br />
697 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
699 /// <since_tizen> 3 </since_tizen>
700 [Obsolete("Deprecated in API8, will be removed in API10.")]
705 return (float)GetValue(FlexProperty);
709 SetValue(FlexProperty, value);
710 NotifyPropertyChanged();
715 /// The Child property of FlexContainer.<br />
716 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
718 /// <since_tizen> 3 </since_tizen>
719 [Obsolete("Deprecated in API8, will be removed in API10.")]
724 return (int)GetValue(AlignSelfProperty);
728 SetValue(AlignSelfProperty, value);
729 NotifyPropertyChanged();
734 /// The Child property of FlexContainer.<br />
735 /// The space around the flex item.<br />
738 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
740 /// <since_tizen> 3 </since_tizen>
741 [Obsolete("Deprecated in API8, will be removed in API10.")]
742 public Vector4 FlexMargin
746 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
747 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
751 SetValue(FlexMarginProperty, value);
752 NotifyPropertyChanged();
757 /// The top-left cell this child occupies, if not set, the first available cell is used.
760 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
761 /// Also, 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 Vector2 CellIndex
768 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
769 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
773 SetValue(CellIndexProperty, value);
774 NotifyPropertyChanged();
779 /// The number of rows this child occupies, if not set, the default value is 1.
782 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
784 /// <since_tizen> 3 </since_tizen>
789 return (float)GetValue(RowSpanProperty);
793 SetValue(RowSpanProperty, value);
794 NotifyPropertyChanged();
799 /// The number of columns this child occupies, if not set, the default value is 1.
802 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
804 /// <since_tizen> 3 </since_tizen>
805 public float ColumnSpan
809 return (float)GetValue(ColumnSpanProperty);
813 SetValue(ColumnSpanProperty, value);
814 NotifyPropertyChanged();
819 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
822 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
824 /// <since_tizen> 3 </since_tizen>
825 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
829 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
833 SetValue(CellHorizontalAlignmentProperty, value);
834 NotifyPropertyChanged();
839 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
842 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
844 /// <since_tizen> 3 </since_tizen>
845 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
849 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
853 SetValue(CellVerticalAlignmentProperty, value);
854 NotifyPropertyChanged();
859 /// The left focusable view.<br />
860 /// This will return null if not set.<br />
861 /// This will also return null if the specified left focusable view is not on a window.<br />
863 /// <since_tizen> 3 </since_tizen>
864 public View LeftFocusableView
866 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
869 return (View)GetValue(LeftFocusableViewProperty);
873 SetValue(LeftFocusableViewProperty, value);
874 NotifyPropertyChanged();
879 /// The right focusable view.<br />
880 /// This will return null if not set.<br />
881 /// This will also return null if the specified right focusable view is not on a window.<br />
883 /// <since_tizen> 3 </since_tizen>
884 public View RightFocusableView
886 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
889 return (View)GetValue(RightFocusableViewProperty);
893 SetValue(RightFocusableViewProperty, value);
894 NotifyPropertyChanged();
899 /// The up focusable view.<br />
900 /// This will return null if not set.<br />
901 /// This will also return null if the specified up focusable view is not on a window.<br />
903 /// <since_tizen> 3 </since_tizen>
904 public View UpFocusableView
906 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
909 return (View)GetValue(UpFocusableViewProperty);
913 SetValue(UpFocusableViewProperty, value);
914 NotifyPropertyChanged();
919 /// The down focusable view.<br />
920 /// This will return null if not set.<br />
921 /// This will also return null if the specified down focusable view is not on a window.<br />
923 /// <since_tizen> 3 </since_tizen>
924 public View DownFocusableView
926 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
929 return (View)GetValue(DownFocusableViewProperty);
933 SetValue(DownFocusableViewProperty, value);
934 NotifyPropertyChanged();
939 /// Whether the view should be focusable by keyboard navigation.
941 /// <since_tizen> 3 </since_tizen>
942 public bool Focusable
946 SetValue(FocusableProperty, value);
947 NotifyPropertyChanged();
951 return (bool)GetValue(FocusableProperty);
956 /// 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.
957 /// Note : Default value is true.
959 [EditorBrowsable(EditorBrowsableState.Never)]
960 public bool FocusableChildren
964 SetValue(FocusableChildrenProperty, value);
965 NotifyPropertyChanged();
969 return (bool)GetValue(FocusableChildrenProperty);
974 /// Whether this view can focus by touch.
975 /// If Focusable is false, FocusableInTouch is disabled.
976 /// If you want to have focus on touch, you need to set both Focusable and FocusableInTouch settings to true.
978 [EditorBrowsable(EditorBrowsableState.Never)]
979 public bool FocusableInTouch
983 SetValue(FocusableInTouchProperty, value);
984 NotifyPropertyChanged();
988 return (bool)GetValue(FocusableInTouchProperty);
993 /// Retrieves the position of the view.<br />
994 /// The coordinates are relative to the view's parent.<br />
996 /// <since_tizen> 3 </since_tizen>
997 public Position CurrentPosition
1001 return GetCurrentPosition();
1006 /// Sets the size of a view for the width and the height.<br />
1007 /// Geometry can be scaled to fit within this area.<br />
1008 /// This does not interfere with the view's scale factor.<br />
1009 /// The views default depth is the minimum of width and height.<br />
1012 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
1013 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
1015 /// <since_tizen> 3 </since_tizen>
1016 public Size2D Size2D
1020 Size2D temp = (Size2D)GetValue(Size2DProperty);
1021 int width = temp.Width;
1022 int height = temp.Height;
1024 if (this.Layout == null)
1026 if (width < 0) { width = 0; }
1027 if (height < 0) { height = 0; }
1030 return new Size2D(OnSize2DChanged, width, height);
1034 SetValue(Size2DProperty, value);
1036 NotifyPropertyChanged();
1041 /// Retrieves the size of the view.<br />
1042 /// The coordinates are relative to the view's parent.<br />
1044 /// <since_tizen> 3 </since_tizen>
1045 public Size2D CurrentSize
1049 return GetCurrentSize();
1054 /// Retrieves and sets the view's opacity.<br />
1058 /// Animatable - This property can be animated using <c>Animation</c> class.
1060 /// animation.AnimateTo(view, "Opacity", 0.5f);
1064 /// <since_tizen> 3 </since_tizen>
1065 public float Opacity
1069 return (float)GetValue(OpacityProperty);
1073 SetValue(OpacityProperty, value);
1074 NotifyPropertyChanged();
1079 /// Sets the position of the view for X and Y.<br />
1080 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1081 /// If the position inheritance is disabled, sets the world position.<br />
1084 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1085 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1087 /// <since_tizen> 3 </since_tizen>
1088 public Position2D Position2D
1092 Position2D temp = (Position2D)GetValue(Position2DProperty);
1093 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1097 SetValue(Position2DProperty, value);
1098 NotifyPropertyChanged();
1103 /// Retrieves the screen position of the view.<br />
1105 /// <since_tizen> 3 </since_tizen>
1106 public Vector2 ScreenPosition
1110 Vector2 temp = new Vector2(0.0f, 0.0f);
1111 var pValue = GetProperty(View.Property.ScreenPosition);
1119 /// Determines whether the pivot point should be used to determine the position of the view.
1120 /// This is false by default.
1122 /// <remarks>If false, then the top-left of the view is used for the position.
1123 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1125 /// <since_tizen> 3 </since_tizen>
1126 public bool PositionUsesPivotPoint
1130 return (bool)GetValue(PositionUsesPivotPointProperty);
1134 SetValue(PositionUsesPivotPointProperty, value);
1135 NotifyPropertyChanged();
1140 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1142 /// <since_tizen> 3 </since_tizen>
1143 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1145 "View view = new View(); " +
1146 "view.PivotPoint = PivotPoint.Center; " +
1147 "view.PositionUsesPivotPoint = true;" +
1148 " Deprecated in API5: Will be removed in API8")]
1149 [EditorBrowsable(EditorBrowsableState.Never)]
1150 public bool PositionUsesAnchorPoint
1154 return (bool)GetValue(PositionUsesAnchorPointProperty);
1158 SetValue(PositionUsesAnchorPointProperty, value);
1162 private bool InternalPositionUsesAnchorPoint
1167 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1168 pValue.Get(out temp);
1174 var temp = new Tizen.NUI.PropertyValue(value);
1175 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1177 NotifyPropertyChanged();
1182 /// Queries whether the view is connected to the stage.<br />
1183 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1185 /// <since_tizen> 3 </since_tizen>
1186 public bool IsOnWindow
1195 /// Gets the depth in the hierarchy for the view.
1197 /// <since_tizen> 3 </since_tizen>
1198 public int HierarchyDepth
1202 return GetHierarchyDepth();
1207 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1210 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1211 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1212 /// The values set by this property will likely change.
1214 /// <since_tizen> 3 </since_tizen>
1215 public int SiblingOrder
1219 return (int)GetValue(SiblingOrderProperty);
1223 SetValue(SiblingOrderProperty, value);
1225 LayoutGroup layout = Layout as LayoutGroup;
1226 layout?.ChangeLayoutSiblingOrder(value);
1228 NotifyPropertyChanged();
1233 /// Returns the natural size of the view.
1236 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1238 /// <since_tizen> 5 </since_tizen>
1239 public Vector3 NaturalSize
1243 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1250 /// Returns the natural size (Size2D) of the view.
1253 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1255 /// <since_tizen> 4 </since_tizen>
1256 public Size2D NaturalSize2D
1260 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1261 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1263 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1270 /// Gets or sets the origin of a view within its parent's area.<br />
1271 /// 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 />
1272 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1273 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1275 /// <pre>The view has been initialized.</pre>
1276 /// <since_tizen> 3 </since_tizen>
1277 public Position ParentOrigin
1281 Position tmp = (Position)GetValue(ParentOriginProperty);
1282 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1286 SetValue(ParentOriginProperty, value);
1287 NotifyPropertyChanged();
1292 /// Gets or sets the anchor-point of a view.<br />
1293 /// 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 />
1294 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1295 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1296 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1297 /// <pre>The view has been initialized.</pre>
1300 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1302 /// <since_tizen> 3 </since_tizen>
1303 public Position PivotPoint
1307 Position tmp = (Position)GetValue(PivotPointProperty);
1308 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1312 SetValue(PivotPointProperty, value);
1313 NotifyPropertyChanged();
1318 /// Gets or sets the size width of the view.
1322 /// Animatable - This property can be animated using <c>Animation</c> class.
1324 /// animation.AnimateTo(view, "SizeWidth", 500.0f);
1328 /// <since_tizen> 3 </since_tizen>
1329 public float SizeWidth
1333 return (float)GetValue(SizeWidthProperty);
1337 SetValue(SizeWidthProperty, value);
1338 NotifyPropertyChanged();
1343 /// Gets or sets the size height of the view.
1347 /// Animatable - This property can be animated using <c>Animation</c> class.
1350 /// animation.AnimateTo(view, "SizeHeight", 500.0f);
1353 /// <since_tizen> 3 </since_tizen>
1354 public float SizeHeight
1358 return (float)GetValue(SizeHeightProperty);
1362 SetValue(SizeHeightProperty, value);
1363 NotifyPropertyChanged();
1368 /// Gets or sets the position of the view.<br />
1369 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1370 /// If the position inheritance is disabled, sets the world position.<br />
1374 /// Animatable - This property can be animated using <c>Animation</c> class.
1376 /// animation.AnimateTo(view, "Position", new Position(50, 0));
1379 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1381 /// <since_tizen> 3 </since_tizen>
1382 public Position Position
1386 Position tmp = (Position)GetValue(PositionProperty);
1387 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1391 SetValue(PositionProperty, value);
1392 NotifyPropertyChanged();
1397 /// Gets or sets the position X of the view.
1401 /// Animatable - This property can be animated using <c>Animation</c> class.
1403 /// animation.AnimateTo(view, "PositionX", 50.0f);
1407 /// <since_tizen> 3 </since_tizen>
1408 public float PositionX
1412 return (float)GetValue(PositionXProperty);
1416 SetValue(PositionXProperty, value);
1417 NotifyPropertyChanged();
1422 /// Gets or sets the position Y of the view.
1426 /// Animatable - This property can be animated using <c>Animation</c> class.
1428 /// animation.AnimateTo(view, "PositionY", 50.0f);
1432 /// <since_tizen> 3 </since_tizen>
1433 public float PositionY
1437 return (float)GetValue(PositionYProperty);
1441 SetValue(PositionYProperty, value);
1442 NotifyPropertyChanged();
1447 /// Gets or sets the position Z of the view.
1451 /// Animatable - This property can be animated using <c>Animation</c> class.
1453 /// animation.AnimateTo(view, "PositionZ", 50.0f);
1457 /// <since_tizen> 3 </since_tizen>
1458 public float PositionZ
1462 return (float)GetValue(PositionZProperty);
1466 SetValue(PositionZProperty, value);
1467 NotifyPropertyChanged();
1472 /// Gets or sets the world position of the view.
1474 /// <since_tizen> 3 </since_tizen>
1475 public Vector3 WorldPosition
1479 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1480 var pValue = GetProperty(View.Property.WorldPosition);
1488 /// Gets or sets the orientation of the view.<br />
1489 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1493 /// This is an asynchronous method.
1496 /// Animatable - This property can be animated using <c>Animation</c> class.
1498 /// animation.AnimateTo(view, "Orientation", new Rotation(new Radian((float)Math.PI), Vector3.XAxis));
1502 /// <since_tizen> 3 </since_tizen>
1503 public Rotation Orientation
1507 return (Rotation)GetValue(OrientationProperty);
1511 SetValue(OrientationProperty, value);
1512 NotifyPropertyChanged();
1517 /// Gets or sets the world orientation of the view.<br />
1519 /// <since_tizen> 3 </since_tizen>
1520 public Rotation WorldOrientation
1524 Rotation temp = new Rotation();
1525 var pValue = GetProperty(View.Property.WorldOrientation);
1533 /// Gets or sets the scale factor applied to the view.<br />
1537 /// Animatable - This property can be animated using <c>Animation</c> class.
1539 /// animation.AnimateTo(view, "Scale", new Vector3(1.5f, 1.5f, 1.0f));
1542 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1544 /// <since_tizen> 3 </since_tizen>
1545 public Vector3 Scale
1549 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1550 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1554 SetValue(ScaleProperty, value);
1555 NotifyPropertyChanged();
1560 /// Gets or sets the scale X factor applied to the view.
1564 /// Animatable - This property can be animated using <c>Animation</c> class.
1566 /// animation.AnimateTo(view, "ScaleX", 1.5f);
1570 /// <since_tizen> 3 </since_tizen>
1575 return (float)GetValue(ScaleXProperty);
1579 SetValue(ScaleXProperty, value);
1580 NotifyPropertyChanged();
1585 /// Gets or sets the scale Y factor applied to the view.
1589 /// Animatable - This property can be animated using <c>Animation</c> class.
1591 /// animation.AnimateTo(view, "ScaleY", 1.5f);
1595 /// <since_tizen> 3 </since_tizen>
1600 return (float)GetValue(ScaleYProperty);
1604 SetValue(ScaleYProperty, value);
1605 NotifyPropertyChanged();
1610 /// Gets or sets the scale Z factor applied to the view.
1614 /// Animatable - This property can be animated using <c>Animation</c> class.
1616 /// animation.AnimateTo(view, "ScaleZ", 1.5f);
1620 /// <since_tizen> 3 </since_tizen>
1625 return (float)GetValue(ScaleZProperty);
1629 SetValue(ScaleZProperty, value);
1630 NotifyPropertyChanged();
1635 /// Gets the world scale of the view.
1637 /// <since_tizen> 3 </since_tizen>
1638 public Vector3 WorldScale
1642 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1643 var pValue = GetProperty(View.Property.WorldScale);
1651 /// Retrieves the visibility flag of the view.
1655 /// If the view is not visible, then the view and its children will not be rendered.
1656 /// 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.
1659 /// Animatable - This property can be animated using <c>Animation</c> class.
1661 /// animation.AnimateTo(view, "Visibility", false);
1665 /// <since_tizen> 3 </since_tizen>
1666 public bool Visibility
1671 var pValue = GetProperty(View.Property.VISIBLE);
1672 pValue.Get(out temp);
1679 /// Gets the view's world color.
1681 /// <since_tizen> 3 </since_tizen>
1682 public Vector4 WorldColor
1686 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1687 var pValue = GetProperty(View.Property.WorldColor);
1695 /// Gets or sets the view's name.
1697 /// <since_tizen> 3 </since_tizen>
1702 return (string)GetValue(NameProperty);
1706 SetValue(NameProperty, value);
1707 NotifyPropertyChanged();
1712 /// Get the number of children held by the view.
1714 /// <since_tizen> 3 </since_tizen>
1715 public new uint ChildCount
1719 return Convert.ToUInt32(Children.Count);
1724 /// Gets the view's ID.
1727 /// <since_tizen> 3 </since_tizen>
1737 /// Gets or sets the status of whether the view should emit touch or hover signals.
1738 /// If a View is made insensitive, then the View and its children are not hittable.
1740 /// <since_tizen> 3 </since_tizen>
1741 public bool Sensitive
1745 return (bool)GetValue(SensitiveProperty);
1749 SetValue(SensitiveProperty, value);
1750 NotifyPropertyChanged();
1755 /// 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.
1757 /// <since_tizen> 3 </since_tizen>
1758 public bool LeaveRequired
1762 return (bool)GetValue(LeaveRequiredProperty);
1766 SetValue(LeaveRequiredProperty, value);
1767 NotifyPropertyChanged();
1772 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1774 /// <since_tizen> 3 </since_tizen>
1775 public bool InheritOrientation
1779 return (bool)GetValue(InheritOrientationProperty);
1783 SetValue(InheritOrientationProperty, value);
1784 NotifyPropertyChanged();
1789 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1791 /// <since_tizen> 3 </since_tizen>
1792 public bool InheritScale
1796 return (bool)GetValue(InheritScaleProperty);
1800 SetValue(InheritScaleProperty, value);
1801 NotifyPropertyChanged();
1806 /// Gets or sets the status of how the view and its children should be drawn.<br />
1807 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1808 /// 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 />
1809 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1810 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1811 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1813 /// <since_tizen> 3 </since_tizen>
1814 public DrawModeType DrawMode
1818 return (DrawModeType)GetValue(DrawModeProperty);
1822 SetValue(DrawModeProperty, value);
1823 NotifyPropertyChanged();
1828 /// Gets or sets the relative to parent size factor of the view.<br />
1829 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1830 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1833 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1835 /// <since_tizen> 3 </since_tizen>
1836 public Vector3 SizeModeFactor
1840 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1841 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1845 SetValue(SizeModeFactorProperty, value);
1846 NotifyPropertyChanged();
1851 /// Gets or sets the width resize policy to be used.
1853 /// <since_tizen> 3 </since_tizen>
1854 public ResizePolicyType WidthResizePolicy
1858 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1862 SetValue(WidthResizePolicyProperty, value);
1863 NotifyPropertyChanged();
1868 /// Gets or sets the height resize policy to be used.
1870 /// <since_tizen> 3 </since_tizen>
1871 public ResizePolicyType HeightResizePolicy
1875 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1879 SetValue(HeightResizePolicyProperty, value);
1880 NotifyPropertyChanged();
1885 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1886 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1888 /// <since_tizen> 3 </since_tizen>
1889 public SizeScalePolicyType SizeScalePolicy
1893 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1897 SetValue(SizeScalePolicyProperty, value);
1898 NotifyPropertyChanged();
1903 /// Gets or sets the status of whether the width size is dependent on the height size.
1905 /// <since_tizen> 3 </since_tizen>
1906 public bool WidthForHeight
1910 return (bool)GetValue(WidthForHeightProperty);
1914 SetValue(WidthForHeightProperty, value);
1915 NotifyPropertyChanged();
1920 /// Gets or sets the status of whether the height size is dependent on the width size.
1922 /// <since_tizen> 3 </since_tizen>
1923 public bool HeightForWidth
1927 return (bool)GetValue(HeightForWidthProperty);
1931 SetValue(HeightForWidthProperty, value);
1932 NotifyPropertyChanged();
1937 /// Gets or sets the padding for use in layout.
1940 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1942 /// <since_tizen> 5 </since_tizen>
1943 public Extents Padding
1947 // If View has a Layout then padding in stored in the base Layout class
1950 return Layout.Padding;
1954 Extents temp = (Extents)GetValue(PaddingProperty);
1955 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1957 // Two return points to prevent creating a zeroed Extent native object before assignment
1961 Extents padding = value;
1964 // Layout set so store Padding in LayoutItem instead of in View.
1965 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1966 // the position and sizes measure in the Layouting.
1967 Layout.Padding = value;
1968 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1969 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1970 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1972 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1976 SetValue(PaddingProperty, padding);
1977 NotifyPropertyChanged();
1982 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1984 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1986 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1988 /// <since_tizen> 3 </since_tizen>
1989 public Size2D MinimumSize
1993 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1994 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
2000 throw new ArgumentNullException(nameof(value));
2004 // Note: it only works if minimum size is >= than natural size.
2005 // To force the size it should be done through the width&height spec or Size2D.
2006 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
2007 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
2008 layout.RequestLayout();
2010 SetValue(MinimumSizeProperty, value);
2011 NotifyPropertyChanged();
2016 /// Gets or sets the maximum size the view can be assigned in size negotiation.
2019 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
2021 /// <since_tizen> 3 </since_tizen>
2022 public Size2D MaximumSize
2026 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
2027 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
2031 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
2032 // MATCH_PARENT spec + parent container size can be used to limit
2035 layout.RequestLayout();
2037 SetValue(MaximumSizeProperty, value);
2038 NotifyPropertyChanged();
2043 /// Gets or sets whether a child view inherits it's parent's position.<br />
2044 /// Default is to inherit.<br />
2045 /// 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 />
2047 /// <since_tizen> 3 </since_tizen>
2048 public bool InheritPosition
2052 return (bool)GetValue(InheritPositionProperty);
2056 SetValue(InheritPositionProperty, value);
2057 NotifyPropertyChanged();
2062 /// Gets or sets the clipping behavior (mode) of it's children.
2064 /// <since_tizen> 3 </since_tizen>
2065 public ClippingModeType ClippingMode
2069 return (ClippingModeType)GetValue(ClippingModeProperty);
2073 SetValue(ClippingModeProperty, value);
2074 NotifyPropertyChanged();
2079 /// Gets the number of renderers held by the view.
2081 /// <since_tizen> 3 </since_tizen>
2082 public uint RendererCount
2086 return GetRendererCount();
2091 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2094 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2096 /// <since_tizen> 3 </since_tizen>
2097 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2099 "View view = new View(); " +
2100 "view.PivotPoint = PivotPoint.Center; " +
2101 "view.PositionUsesPivotPoint = true;")]
2102 [EditorBrowsable(EditorBrowsableState.Never)]
2103 public Position AnchorPoint
2107 return GetValue(AnchorPointProperty) as Position;
2111 SetValue(AnchorPointProperty, value);
2115 private Position InternalAnchorPoint
2119 Position temp = new Position(0.0f, 0.0f, 0.0f);
2120 var pValue = GetProperty(View.Property.AnchorPoint);
2123 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2129 var temp = new Tizen.NUI.PropertyValue(value);
2130 SetProperty(View.Property.AnchorPoint, temp);
2132 NotifyPropertyChanged();
2137 /// Sets the size of a view for the width, the height and the depth.<br />
2138 /// Geometry can be scaled to fit within this area.<br />
2139 /// This does not interfere with the view's scale factor.<br />
2140 /// The views default depth is the minimum of width and height.<br />
2144 /// Animatable - This property can be animated using <c>Animation</c> class.
2146 /// animation.AnimateTo(view, "Size", new Size(100, 100));
2149 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2151 /// <since_tizen> 5 </since_tizen>
2156 Size tmp = (Size)GetValue(SizeProperty);
2157 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2161 SetValue(SizeProperty, value);
2162 NotifyPropertyChanged();
2167 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2169 /// <since_tizen> 3 </since_tizen>
2170 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2172 "Container parent = view.GetParent(); " +
2173 "View view = parent as View;")]
2174 [EditorBrowsable(EditorBrowsableState.Never)]
2175 public new View Parent
2180 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2181 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2182 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2184 if (basehandle is Layer layer)
2186 ret = new View(Layer.getCPtr(layer).Handle, false);
2187 NUILog.Error("This Parent property is deprecated, should do not be used");
2191 ret = basehandle as View;
2194 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2195 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2197 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2203 /// Gets/Sets whether inherit parent's the layout Direction.
2205 /// <since_tizen> 4 </since_tizen>
2206 public bool InheritLayoutDirection
2210 return (bool)GetValue(InheritLayoutDirectionProperty);
2214 SetValue(InheritLayoutDirectionProperty, value);
2215 NotifyPropertyChanged();
2220 /// Gets/Sets the layout Direction.
2222 /// <since_tizen> 4 </since_tizen>
2223 public ViewLayoutDirectionType LayoutDirection
2227 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2231 SetValue(LayoutDirectionProperty, value);
2232 NotifyPropertyChanged();
2233 layout?.RequestLayout();
2238 /// Gets or sets the Margin for use in layout.
2241 /// Margin property is supported by Layout algorithms and containers.
2242 /// Please Set Layout if you want to use Margin property.
2243 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2245 /// <since_tizen> 4 </since_tizen>
2246 public Extents Margin
2250 // If View has a Layout then margin is stored in Layout.
2253 return Layout.Margin;
2257 // If Layout not set then return margin stored in View.
2258 Extents temp = (Extents)GetValue(MarginProperty);
2259 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2261 // Two return points to prevent creating a zeroed Extent native object before assignment
2267 // Layout set so store Margin in LayoutItem instead of View.
2268 // If View stores the Margin too then the Legacy Size Negotiation will
2269 // overwrite the position and size values measured in the Layouting.
2270 Layout.Margin = value;
2271 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2272 layout?.RequestLayout();
2276 SetValue(MarginProperty, value);
2278 NotifyPropertyChanged();
2279 layout?.RequestLayout();
2284 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2288 /// // matchParentView matches its size to its parent size.
2289 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2290 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2292 /// // wrapContentView wraps its children with their desired size.
2293 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2294 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2296 /// // exactSizeView shows itself with an exact size.
2297 /// exactSizeView.WidthSpecification = 100;
2298 /// exactSizeView.HeightSpecification = 100;
2301 /// <since_tizen> 6 </since_tizen>
2302 public int WidthSpecification
2306 return (int)GetValue(WidthSpecificationProperty);
2310 SetValue(WidthSpecificationProperty, value);
2311 NotifyPropertyChanged();
2315 private int InternalWidthSpecification
2323 if (value == widthPolicy)
2326 widthPolicy = value;
2327 if (widthPolicy >= 0)
2329 if (heightPolicy >= 0) // Policy an exact value
2331 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2332 Size2D = new Size2D(widthPolicy, heightPolicy);
2335 layout?.RequestLayout();
2340 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2344 /// // matchParentView matches its size to its parent size.
2345 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2346 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2348 /// // wrapContentView wraps its children with their desired size.
2349 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2350 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2352 /// // exactSizeView shows itself with an exact size.
2353 /// exactSizeView.WidthSpecification = 100;
2354 /// exactSizeView.HeightSpecification = 100;
2357 /// <since_tizen> 6 </since_tizen>
2358 public int HeightSpecification
2362 return (int)GetValue(HeightSpecificationProperty);
2366 SetValue(HeightSpecificationProperty, value);
2367 NotifyPropertyChanged();
2371 private int InternalHeightSpecification
2375 return heightPolicy;
2379 if (value == heightPolicy)
2382 heightPolicy = value;
2383 if (heightPolicy >= 0)
2385 if (widthPolicy >= 0) // Policy an exact value
2387 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2388 Size2D = new Size2D(widthPolicy, heightPolicy);
2391 layout?.RequestLayout();
2396 /// Gets the List of transitions for this View.
2398 /// <since_tizen> 6 </since_tizen>
2399 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2403 if (layoutTransitions == null)
2405 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2407 return layoutTransitions;
2412 /// Sets a layout transitions for this View.
2414 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2416 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2418 /// <since_tizen> 6 </since_tizen>
2419 public LayoutTransition LayoutTransition
2423 return GetValue(LayoutTransitionProperty) as LayoutTransition;
2427 SetValue(LayoutTransitionProperty, value);
2428 NotifyPropertyChanged();
2432 private LayoutTransition InternalLayoutTransition
2436 return layoutTransition;
2442 throw new global::System.ArgumentNullException(nameof(value));
2444 if (layoutTransitions == null)
2446 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2449 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2451 AttachTransitionsToChildren(value);
2453 layoutTransition = value;
2458 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2461 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2463 /// <since_tizen> 4 </since_tizen>
2464 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2465 [EditorBrowsable(EditorBrowsableState.Never)]
2466 public Extents PaddingEX
2470 return GetValue(PaddingEXProperty) as Extents;
2474 SetValue(PaddingEXProperty, value);
2478 private Extents InternalPaddingEX
2482 Extents temp = new Extents(0, 0, 0, 0);
2483 var pValue = GetProperty(View.Property.PADDING);
2486 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2492 var temp = new Tizen.NUI.PropertyValue(value);
2493 SetProperty(View.Property.PADDING, temp);
2495 NotifyPropertyChanged();
2496 layout?.RequestLayout();
2500 [EditorBrowsable(EditorBrowsableState.Never)]
2501 public XamlStyle XamlStyle
2505 return (XamlStyle)GetValue(XamlStyleProperty);
2509 SetValue(XamlStyleProperty, value);
2514 /// The Color of View. This is an RGBA value.
2518 /// Animatable - This property can be animated using <c>Animation</c> class.
2520 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2522 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2523 [EditorBrowsable(EditorBrowsableState.Never)]
2528 Color temp = (Color)GetValue(ColorProperty);
2529 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2533 SetValue(ColorProperty, value);
2534 NotifyPropertyChanged();
2539 /// Set the layout on this View. Replaces any existing Layout.
2542 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2544 /// <since_tizen> 6 </since_tizen>
2545 public LayoutItem Layout
2549 return GetValue(LayoutProperty) as LayoutItem;
2553 SetValue(LayoutProperty, value);
2557 private LayoutItem InternalLayout
2565 // Do nothing if layout provided is already set on this View.
2566 if (value == layout)
2571 LayoutingDisabled = false;
2574 // If new layout being set already has a owner then that owner receives a replacement default layout.
2575 // First check if the layout to be set already has a owner.
2576 if (value?.Owner != null)
2578 // Previous owner of the layout gets a default layout as a replacement.
2579 value.Owner.Layout = new AbsoluteLayout()
2581 // Copy Margin and Padding to replacement LayoutGroup.
2582 Margin = value.Margin,
2583 Padding = value.Padding,
2587 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2588 // View if no replacement. Previously margin and padding values would have been moved from
2589 // the View to the layout.
2590 if (layout != null) // Existing layout
2594 // Existing layout being replaced so copy over margin and padding values.
2595 value.Margin = layout.Margin;
2596 value.Padding = layout.Padding;
2597 value.SetPositionByLayout = !excludeLayouting;
2601 // Layout not being replaced so restore margin and padding to View.
2602 SetValue(MarginProperty, layout.Margin);
2603 SetValue(PaddingProperty, layout.Padding);
2604 NotifyPropertyChanged();
2609 // First Layout to be added to the View hence copy
2611 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2614 Extents margin = Margin;
2615 Extents padding = Padding;
2616 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2618 // If View already has a margin set then store it in Layout instead.
2619 value.Margin = margin;
2620 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2621 NotifyPropertyChanged();
2624 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2626 // If View already has a padding set then store it in Layout instead.
2627 value.Padding = padding;
2629 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2630 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2631 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2633 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2634 NotifyPropertyChanged();
2638 value.SetPositionByLayout = !excludeLayouting;
2642 // Remove existing layout from it's parent layout group.
2645 // Set layout to this view
2651 /// The weight of the View, used to share available space in a layout with siblings.
2653 /// <since_tizen> 6 </since_tizen>
2663 layout?.RequestLayout();
2668 /// Whether to load the BackgroundImage synchronously.
2669 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2670 /// Note: For Normal Quad images only.
2672 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2673 [EditorBrowsable(EditorBrowsableState.Never)]
2674 public bool BackgroundImageSynchronosLoading
2678 return (bool)GetValue(BackgroundImageSynchronosLoadingProperty);
2682 SetValue(BackgroundImageSynchronosLoadingProperty, value);
2683 NotifyPropertyChanged();
2687 private bool InternalBackgroundImageSynchronosLoading
2691 return BackgroundImageSynchronousLoading;
2695 BackgroundImageSynchronousLoading = value;
2700 /// Whether to load the BackgroundImage synchronously.
2701 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2702 /// Note: For Normal Quad images only.
2704 /// This will be public opened in tizen_7.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2705 [EditorBrowsable(EditorBrowsableState.Never)]
2706 public bool BackgroundImageSynchronousLoading
2710 return (bool)GetValue(BackgroundImageSynchronousLoadingProperty);
2714 SetValue(BackgroundImageSynchronousLoadingProperty, value);
2715 NotifyPropertyChanged();
2719 private bool InternalBackgroundImageSynchronousLoading
2723 return backgroundImageSynchronousLoading;
2727 backgroundImageSynchronousLoading = value;
2729 string bgUrl = null;
2730 var pValue = Background.Find(ImageVisualProperty.URL);
2731 pValue?.Get(out bgUrl);
2734 if (!string.IsNullOrEmpty(bgUrl))
2736 PropertyMap bgMap = this.Background;
2737 var temp = new PropertyValue(backgroundImageSynchronousLoading);
2738 bgMap.Add("synchronousLoading", temp);
2745 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2746 [EditorBrowsable(EditorBrowsableState.Never)]
2747 public Vector2 UpdateSizeHint
2751 return (Vector2)GetValue(UpdateSizeHintProperty);
2755 SetValue(UpdateSizeHintProperty, value);
2756 NotifyPropertyChanged();
2761 /// Enable/Disable ControlState propagation for children.
2762 /// It is false by default.
2763 /// If the View needs to share ControlState with descendants, please set it true.
2764 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2766 [EditorBrowsable(EditorBrowsableState.Never)]
2767 public bool EnableControlStatePropagation
2771 return (bool)GetValue(EnableControlStatePropagationProperty);
2775 SetValue(EnableControlStatePropagationProperty, value);
2776 NotifyPropertyChanged();
2780 private bool InternalEnableControlStatePropagation
2782 get => themeData?.ControlStatePropagation ?? false;
2785 if (InternalEnableControlStatePropagation == value) return;
2787 if (themeData == null) themeData = new ThemeData();
2789 themeData.ControlStatePropagation = value;
2791 foreach (View child in Children)
2793 child.EnableControlStatePropagation = value;
2799 /// By default, it is false in View, true in Control.
2800 /// Note that if the value is true, the View will be a touch receptor.
2802 [EditorBrowsable(EditorBrowsableState.Never)]
2803 public bool EnableControlState
2807 return (bool)GetValue(EnableControlStateProperty);
2811 SetValue(EnableControlStateProperty, value);
2816 /// Whether the actor grab all touches even if touch leaves its boundary.
2818 /// <returns>true, if it grab all touch after start</returns>
2819 [EditorBrowsable(EditorBrowsableState.Never)]
2820 public bool GrabTouchAfterLeave
2824 return (bool)GetValue(GrabTouchAfterLeaveProperty);
2828 SetValue(GrabTouchAfterLeaveProperty, value);
2832 private bool InternalGrabTouchAfterLeave
2837 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2838 pValue.Get(out temp);
2844 var temp = new Tizen.NUI.PropertyValue(value);
2845 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2847 NotifyPropertyChanged();
2852 /// Determines which blend equation will be used to render renderers of this actor.
2854 /// <returns>blend equation enum currently assigned</returns>
2855 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2856 [EditorBrowsable(EditorBrowsableState.Never)]
2857 public BlendEquationType BlendEquation
2861 return (BlendEquationType)GetValue(BlendEquationProperty);
2865 SetValue(BlendEquationProperty, value);
2869 private BlendEquationType InternalBlendEquation
2874 var pValue = GetProperty(View.Property.BlendEquation);
2875 pValue.Get(out temp);
2877 return (BlendEquationType)temp;
2881 var temp = new Tizen.NUI.PropertyValue((int)value);
2882 SetProperty(View.Property.BlendEquation, temp);
2884 NotifyPropertyChanged();
2889 /// If the value is true, the View will change its style as the theme changes.
2890 /// The default value is false in normal case but it can be true when the NUIApplication is created with <see cref="NUIApplication.ThemeOptions.ThemeChangeSensitive"/>.
2892 /// <since_tizen> 9 </since_tizen>
2893 public bool ThemeChangeSensitive
2895 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2896 set => SetValue(ThemeChangeSensitiveProperty, value);
2900 /// Create Style, it is abstract function and must be override.
2902 [EditorBrowsable(EditorBrowsableState.Never)]
2903 protected virtual ViewStyle CreateViewStyle()
2905 return new ViewStyle();
2909 /// Called after the View's ControlStates changed.
2911 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2912 [EditorBrowsable(EditorBrowsableState.Never)]
2913 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2919 [EditorBrowsable(EditorBrowsableState.Never)]
2920 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2922 if (string.IsNullOrEmpty(styleName)) ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(GetType()));
2923 else ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(styleName));
2927 /// Apply style instance to the view.
2928 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2930 /// <since_tizen> 9 </since_tizen>
2931 public virtual void ApplyStyle(ViewStyle viewStyle)
2933 if (viewStyle == null || themeData?.viewStyle == viewStyle) return;
2935 if (themeData == null) themeData = new ThemeData();
2937 themeData.viewStyle = viewStyle;
2939 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2945 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2947 if (bindablePropertyOfView == null)
2952 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2953 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2955 foreach (var sourceProperty in dirtyStyleProperties)
2957 var sourceValue = viewStyle.GetValue(sourceProperty);
2959 if (sourceValue == null)
2964 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2966 if (destinationProperty != null)
2968 SetValue(destinationProperty, sourceValue);
2974 /// Get whether the View is culled or not.
2975 /// True means that the View is out of the view frustum.
2978 /// Hidden-API (Inhouse-API).
2980 [EditorBrowsable(EditorBrowsableState.Never)]
2986 var pValue = GetProperty(View.Property.Culled);
2987 pValue.Get(out temp);
2994 /// Set or Get TransitionOptions for the page transition.
2995 /// This property is used to define how this view will be transitioned during Page switching.
2997 /// <since_tizen> 9 </since_tizen>
2998 public TransitionOptions TransitionOptions
3002 return GetValue(TransitionOptionsProperty) as TransitionOptions;
3006 SetValue(TransitionOptionsProperty, value);
3007 NotifyPropertyChanged();
3011 private TransitionOptions InternalTransitionOptions
3015 transitionOptions = value;
3019 return transitionOptions;