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;
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 this.OnWindowSignal().Connect(onWindowSendEventCallback);
131 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
133 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
142 /// The event that is triggered when the View's ControlState is changed.
144 [EditorBrowsable(EditorBrowsableState.Never)]
145 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
147 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
151 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
153 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
154 [EditorBrowsable(EditorBrowsableState.Never)]
155 public bool LayoutSet
164 /// Flag to allow Layouting to be disabled for Views.
165 /// Once a View has a Layout set then any children added to Views from then on will receive
166 /// automatic Layouts.
168 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
169 [EditorBrowsable(EditorBrowsableState.Never)]
170 public static bool LayoutingDisabled { get; set; } = true;
173 /// Deprecate. Please do not use this.
174 /// The style instance applied to this view.
175 /// Note that please do not modify the ViewStyle.
176 /// Modifying ViewStyle will affect other views with same ViewStyle.
178 [EditorBrowsable(EditorBrowsableState.Never)]
179 protected ViewStyle ViewStyle
183 if (themeData == null) themeData = new ThemeData();
185 if (themeData.viewStyle == null)
187 ApplyStyle(CreateViewStyle());
189 return themeData.viewStyle;
194 /// Get/Set the control state.
195 /// Note that the ControlState only available for the classes derived from Control.
196 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
197 /// please set <see cref="EnableControlState"/> to true.
199 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
200 [EditorBrowsable(EditorBrowsableState.Never)]
201 public ControlState ControlState
205 return themeData == null ? ControlState.Normal : themeData.controlStates;
209 if (ControlState == value)
214 var prevState = ControlState;
216 if (themeData == null) themeData = new ThemeData();
217 themeData.controlStates = value;
219 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
221 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
223 if (themeData.ControlStatePropagation)
225 foreach (View child in Children)
227 child.ControlState = value;
231 OnControlStateChanged(changeInfo);
233 ControlStateChangedEvent?.Invoke(this, changeInfo);
238 /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
240 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
241 [EditorBrowsable(EditorBrowsableState.Never)]
242 public bool ExcludeLayouting
246 return excludeLayouting;
250 excludeLayouting = value;
251 if (Layout != null && Layout.SetPositionByLayout == value)
253 Layout.SetPositionByLayout = !value;
254 Layout.RequestLayout();
259 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
260 [EditorBrowsable(EditorBrowsableState.Never)]
261 public bool IsResourcesCreated
265 return Application.Current.IsResourcesCreated;
269 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
270 [EditorBrowsable(EditorBrowsableState.Never)]
271 public ResourceDictionary XamlResources
275 return Application.Current.XamlResources;
279 Application.Current.XamlResources = value;
284 /// The StyleName, type string.
285 /// The value indicates DALi style name defined in json theme file.
287 /// <since_tizen> 3 </since_tizen>
288 public string StyleName
292 return (string)GetValue(StyleNameProperty);
296 SetValue(StyleNameProperty, value);
297 NotifyPropertyChanged();
302 /// The KeyInputFocus, type bool.
304 [EditorBrowsable(EditorBrowsableState.Never)]
305 public bool KeyInputFocus
309 return (bool)GetValue(KeyInputFocusProperty);
313 SetValue(KeyInputFocusProperty, value);
314 NotifyPropertyChanged();
319 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
323 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
326 /// Animatable - This property can be animated using <c>Animation</c> class.
328 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
332 /// <since_tizen> 3 </since_tizen>
333 public Color BackgroundColor
337 Color temp = (Color)GetValue(BackgroundColorProperty);
338 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
342 SetValue(BackgroundColorProperty, value);
343 NotifyPropertyChanged();
348 /// The mutually exclusive with "backgroundColor" and "background" type Map.
350 /// <since_tizen> 3 </since_tizen>
351 public string BackgroundImage
355 return (string)GetValue(BackgroundImageProperty);
359 SetValue(BackgroundImageProperty, value);
360 NotifyPropertyChanged();
365 /// Get or set the border of background image.
367 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
368 [EditorBrowsable(EditorBrowsableState.Never)]
369 public Rectangle BackgroundImageBorder
373 return (Rectangle)GetValue(BackgroundImageBorderProperty);
377 SetValue(BackgroundImageBorderProperty, value);
378 NotifyPropertyChanged();
383 /// The background of view.
385 /// <since_tizen> 3 </since_tizen>
386 public Tizen.NUI.PropertyMap Background
390 return (PropertyMap)GetValue(BackgroundProperty);
394 SetValue(BackgroundProperty, value);
395 NotifyPropertyChanged();
400 /// Describes a shadow as an image for a View.
401 /// It is null by default.
404 /// Getter returns copied instance of current shadow.
407 /// The mutually exclusive with "BoxShadow".
411 /// Animatable - This property can be animated using <c>Animation</c> class.
412 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
414 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
416 /// Animatable sub-property : Offset.
419 [EditorBrowsable(EditorBrowsableState.Never)]
420 public ImageShadow ImageShadow
424 return (ImageShadow)GetValue(ImageShadowProperty);
428 SetValue(ImageShadowProperty, value);
429 NotifyPropertyChanged();
434 /// Describes a box shaped shadow drawing for a View.
435 /// It is null by default.
438 /// The mutually exclusive with "ImageShadow".
442 /// Animatable - This property can be animated using <c>Animation</c> class.
443 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
445 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
447 /// Animatable sub-property : Offset, Color, BlurRadius.
450 /// <since_tizen> 9 </since_tizen>
451 public Shadow BoxShadow
455 return (Shadow)GetValue(BoxShadowProperty);
459 SetValue(BoxShadowProperty, value);
460 NotifyPropertyChanged();
465 /// The radius for the rounded corners of the View.
466 /// This will rounds background and shadow edges.
467 /// 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).
468 /// Each radius will clamp internally to the half of smaller of the view's width or height.
469 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
473 /// Animatable - This property can be animated using <c>Animation</c> class.
475 /// animation.AnimateTo(view, "CornerRadius", new Vector4(10, 10, 10, 10));
479 /// <since_tizen> 9 </since_tizen>
480 public Vector4 CornerRadius
484 return (Vector4)GetValue(CornerRadiusProperty);
488 SetValue(CornerRadiusProperty, value);
489 NotifyPropertyChanged();
494 /// Whether the CornerRadius property value is relative (percentage [0.0f to 0.5f] of the view size) or absolute (in world units).
495 /// It is absolute by default.
496 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
498 /// <since_tizen> 9 </since_tizen>
499 public VisualTransformPolicyType CornerRadiusPolicy
501 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
502 set => SetValue(CornerRadiusPolicyProperty, value);
506 /// The width for the borderline of the View.
507 /// Note that, an image background may not have borderline if it uses a Border property.
511 /// Animatable - This property can be animated using <c>Animation</c> class.
513 /// animation.AnimateTo(view, "BorderlineWidth", 100.0f);
517 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
518 [EditorBrowsable(EditorBrowsableState.Never)]
519 public float BorderlineWidth
523 return (float)GetValue(BorderlineWidthProperty);
527 SetValue(BorderlineWidthProperty, value);
528 NotifyPropertyChanged();
533 /// The color for the borderline of the View.
534 /// It is Color.Black by default.
538 /// Animatable - This property can be animated using <c>Animation</c> class.
540 /// animation.AnimateTo(view, "BorderlineColor", new Color(r, g, b, a));
544 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
545 [EditorBrowsable(EditorBrowsableState.Never)]
546 public Color BorderlineColor
550 return (Color)GetValue(BorderlineColorProperty);
554 SetValue(BorderlineColorProperty, value);
555 NotifyPropertyChanged();
560 /// The Relative offset for the borderline of the View.
561 /// recommand [-1.0f to 1.0f] range.
562 /// If -1.0f, borderline draw inside of View.
563 /// If 1.0f, borderline draw outside of View.
564 /// If 0.0f, borderline draw half at inside and half at outside.
565 /// It is 0.0f by default.
569 /// Animatable - This property can be animated using <c>Animation</c> class.
571 /// animation.AnimateTo(view, "BorderlineOffset", -1.0f);
575 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
576 [EditorBrowsable(EditorBrowsableState.Never)]
577 public float BorderlineOffset
581 return (float)GetValue(BorderlineOffsetProperty);
585 SetValue(BorderlineOffsetProperty, value);
586 NotifyPropertyChanged();
591 /// The current state of the view.
593 /// <since_tizen> 3 </since_tizen>
598 return (States)GetValue(StateProperty);
602 SetValue(StateProperty, value);
603 NotifyPropertyChanged();
608 /// The current sub state of the view.
610 /// <since_tizen> 3 </since_tizen>
611 public States SubState
615 return (States)GetValue(SubStateProperty);
619 SetValue(SubStateProperty, value);
620 NotifyPropertyChanged();
625 /// Displays a tooltip
627 /// <since_tizen> 3 </since_tizen>
628 public Tizen.NUI.PropertyMap Tooltip
632 return (PropertyMap)GetValue(TooltipProperty);
636 SetValue(TooltipProperty, value);
637 NotifyPropertyChanged();
642 /// Displays a tooltip as a text.
644 /// <since_tizen> 3 </since_tizen>
645 public string TooltipText
649 using (var propertyValue = GetProperty(Property.TOOLTIP))
651 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
653 return retrivedValue;
655 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
656 return "error to get TooltipText";
661 var temp = new Tizen.NUI.PropertyValue(value);
662 SetProperty(View.Property.TOOLTIP, temp);
664 NotifyPropertyChanged();
669 /// The Child property of FlexContainer.<br />
670 /// The proportion of the free space in the container, the flex item will receive.<br />
671 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
673 /// <since_tizen> 3 </since_tizen>
674 [Obsolete("Deprecated in API8, will be removed in API10.")]
679 return (float)GetValue(FlexProperty);
683 SetValue(FlexProperty, value);
684 NotifyPropertyChanged();
689 /// The Child property of FlexContainer.<br />
690 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
692 /// <since_tizen> 3 </since_tizen>
693 [Obsolete("Deprecated in API8, will be removed in API10.")]
698 return (int)GetValue(AlignSelfProperty);
702 SetValue(AlignSelfProperty, value);
703 NotifyPropertyChanged();
708 /// The Child property of FlexContainer.<br />
709 /// The space around the flex item.<br />
712 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
714 /// <since_tizen> 3 </since_tizen>
715 [Obsolete("Deprecated in API8, will be removed in API10.")]
716 public Vector4 FlexMargin
720 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
721 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
725 SetValue(FlexMarginProperty, value);
726 NotifyPropertyChanged();
731 /// The top-left cell this child occupies, if not set, the first available cell is used.
734 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
735 /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
737 /// <since_tizen> 3 </since_tizen>
738 public Vector2 CellIndex
742 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
743 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
747 SetValue(CellIndexProperty, value);
748 NotifyPropertyChanged();
753 /// The number of rows this child occupies, if not set, the default value is 1.
756 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
758 /// <since_tizen> 3 </since_tizen>
763 return (float)GetValue(RowSpanProperty);
767 SetValue(RowSpanProperty, value);
768 NotifyPropertyChanged();
773 /// The number of columns this child occupies, if not set, the default value is 1.
776 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
778 /// <since_tizen> 3 </since_tizen>
779 public float ColumnSpan
783 return (float)GetValue(ColumnSpanProperty);
787 SetValue(ColumnSpanProperty, value);
788 NotifyPropertyChanged();
793 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
796 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
798 /// <since_tizen> 3 </since_tizen>
799 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
803 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
807 SetValue(CellHorizontalAlignmentProperty, value);
808 NotifyPropertyChanged();
813 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
816 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
818 /// <since_tizen> 3 </since_tizen>
819 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
823 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
827 SetValue(CellVerticalAlignmentProperty, value);
828 NotifyPropertyChanged();
833 /// The left focusable view.<br />
834 /// This will return null if not set.<br />
835 /// This will also return null if the specified left focusable view is not on a window.<br />
837 /// <since_tizen> 3 </since_tizen>
838 public View LeftFocusableView
840 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
843 return (View)GetValue(LeftFocusableViewProperty);
847 SetValue(LeftFocusableViewProperty, value);
848 NotifyPropertyChanged();
853 /// The right focusable view.<br />
854 /// This will return null if not set.<br />
855 /// This will also return null if the specified right focusable view is not on a window.<br />
857 /// <since_tizen> 3 </since_tizen>
858 public View RightFocusableView
860 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
863 return (View)GetValue(RightFocusableViewProperty);
867 SetValue(RightFocusableViewProperty, value);
868 NotifyPropertyChanged();
873 /// The up focusable view.<br />
874 /// This will return null if not set.<br />
875 /// This will also return null if the specified up focusable view is not on a window.<br />
877 /// <since_tizen> 3 </since_tizen>
878 public View UpFocusableView
880 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
883 return (View)GetValue(UpFocusableViewProperty);
887 SetValue(UpFocusableViewProperty, value);
888 NotifyPropertyChanged();
893 /// The down focusable view.<br />
894 /// This will return null if not set.<br />
895 /// This will also return null if the specified down focusable view is not on a window.<br />
897 /// <since_tizen> 3 </since_tizen>
898 public View DownFocusableView
900 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
903 return (View)GetValue(DownFocusableViewProperty);
907 SetValue(DownFocusableViewProperty, value);
908 NotifyPropertyChanged();
913 /// Whether the view should be focusable by keyboard navigation.
915 /// <since_tizen> 3 </since_tizen>
916 public bool Focusable
920 SetValue(FocusableProperty, value);
921 NotifyPropertyChanged();
925 return (bool)GetValue(FocusableProperty);
930 /// 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.
931 /// Note : Default value is true.
933 [EditorBrowsable(EditorBrowsableState.Never)]
934 public bool FocusableChildren
938 SetValue(FocusableChildrenProperty, value);
939 NotifyPropertyChanged();
943 return (bool)GetValue(FocusableChildrenProperty);
948 /// Whether this view can focus by touch.
949 /// If Focusable is false, FocusableInTouch is disabled.
950 /// If you want to have focus on touch, you need to set both Focusable and FocusableInTouch settings to true.
952 [EditorBrowsable(EditorBrowsableState.Never)]
953 public bool FocusableInTouch
957 SetValue(FocusableInTouchProperty, value);
958 NotifyPropertyChanged();
962 return (bool)GetValue(FocusableInTouchProperty);
967 /// Retrieves the position of the view.<br />
968 /// The coordinates are relative to the view's parent.<br />
970 /// <since_tizen> 3 </since_tizen>
971 public Position CurrentPosition
975 return GetCurrentPosition();
980 /// Sets the size of a view for the width and the height.<br />
981 /// Geometry can be scaled to fit within this area.<br />
982 /// This does not interfere with the view's scale factor.<br />
983 /// The views default depth is the minimum of width and height.<br />
986 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
987 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
989 /// <since_tizen> 3 </since_tizen>
994 Size2D temp = (Size2D)GetValue(Size2DProperty);
995 int width = temp.Width;
996 int height = temp.Height;
998 if (this.Layout == null)
1000 if (width < 0) { width = 0; }
1001 if (height < 0) { height = 0; }
1004 return new Size2D(OnSize2DChanged, width, height);
1008 SetValue(Size2DProperty, value);
1010 NotifyPropertyChanged();
1015 /// Retrieves the size of the view.<br />
1016 /// The coordinates are relative to the view's parent.<br />
1018 /// <since_tizen> 3 </since_tizen>
1019 public Size2D CurrentSize
1023 return GetCurrentSize();
1028 /// Retrieves and sets the view's opacity.<br />
1032 /// Animatable - This property can be animated using <c>Animation</c> class.
1034 /// animation.AnimateTo(view, "Opacity", 0.5f);
1038 /// <since_tizen> 3 </since_tizen>
1039 public float Opacity
1043 return (float)GetValue(OpacityProperty);
1047 SetValue(OpacityProperty, value);
1048 NotifyPropertyChanged();
1053 /// Sets the position of the view for X and Y.<br />
1054 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1055 /// If the position inheritance is disabled, sets the world position.<br />
1058 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1059 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1061 /// <since_tizen> 3 </since_tizen>
1062 public Position2D Position2D
1066 Position2D temp = (Position2D)GetValue(Position2DProperty);
1067 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1071 SetValue(Position2DProperty, value);
1072 NotifyPropertyChanged();
1077 /// Retrieves the screen position of the view.<br />
1079 /// <since_tizen> 3 </since_tizen>
1080 public Vector2 ScreenPosition
1084 Vector2 temp = new Vector2(0.0f, 0.0f);
1085 var pValue = GetProperty(View.Property.ScreenPosition);
1093 /// Determines whether the pivot point should be used to determine the position of the view.
1094 /// This is false by default.
1096 /// <remarks>If false, then the top-left of the view is used for the position.
1097 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1099 /// <since_tizen> 3 </since_tizen>
1100 public bool PositionUsesPivotPoint
1104 return (bool)GetValue(PositionUsesPivotPointProperty);
1108 SetValue(PositionUsesPivotPointProperty, value);
1109 NotifyPropertyChanged();
1114 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1116 /// <since_tizen> 3 </since_tizen>
1117 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1119 "View view = new View(); " +
1120 "view.PivotPoint = PivotPoint.Center; " +
1121 "view.PositionUsesPivotPoint = true;" +
1122 " Deprecated in API5: Will be removed in API8")]
1123 [EditorBrowsable(EditorBrowsableState.Never)]
1124 public bool PositionUsesAnchorPoint
1129 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1130 pValue.Get(out temp);
1136 var temp = new Tizen.NUI.PropertyValue(value);
1137 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1139 NotifyPropertyChanged();
1144 /// Queries whether the view is connected to the stage.<br />
1145 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1147 /// <since_tizen> 3 </since_tizen>
1148 public bool IsOnWindow
1157 /// Gets the depth in the hierarchy for the view.
1159 /// <since_tizen> 3 </since_tizen>
1160 public int HierarchyDepth
1164 return GetHierarchyDepth();
1169 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1172 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1173 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1174 /// The values set by this property will likely change.
1176 /// <since_tizen> 3 </since_tizen>
1177 public int SiblingOrder
1181 return (int)GetValue(SiblingOrderProperty);
1185 SetValue(SiblingOrderProperty, value);
1187 LayoutGroup layout = Layout as LayoutGroup;
1188 layout?.ChangeLayoutSiblingOrder(value);
1190 NotifyPropertyChanged();
1195 /// Returns the natural size of the view.
1198 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1200 /// <since_tizen> 5 </since_tizen>
1201 public Vector3 NaturalSize
1205 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1206 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1212 /// Returns the natural size (Size2D) of the view.
1215 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1217 /// <since_tizen> 4 </since_tizen>
1218 public Size2D NaturalSize2D
1222 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1223 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1225 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1232 /// Gets or sets the origin of a view within its parent's area.<br />
1233 /// 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 />
1234 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1235 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1237 /// <pre>The view has been initialized.</pre>
1238 /// <since_tizen> 3 </since_tizen>
1239 public Position ParentOrigin
1243 Position tmp = (Position)GetValue(ParentOriginProperty);
1244 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1248 SetValue(ParentOriginProperty, value);
1249 NotifyPropertyChanged();
1254 /// Gets or sets the anchor-point of a view.<br />
1255 /// 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 />
1256 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1257 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1258 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1259 /// <pre>The view has been initialized.</pre>
1262 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1264 /// <since_tizen> 3 </since_tizen>
1265 public Position PivotPoint
1269 Position tmp = (Position)GetValue(PivotPointProperty);
1270 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1274 SetValue(PivotPointProperty, value);
1275 NotifyPropertyChanged();
1280 /// Gets or sets the size width of the view.
1284 /// Animatable - This property can be animated using <c>Animation</c> class.
1286 /// animation.AnimateTo(view, "SizeWidth", 500.0f);
1290 /// <since_tizen> 3 </since_tizen>
1291 public float SizeWidth
1295 return (float)GetValue(SizeWidthProperty);
1299 SetValue(SizeWidthProperty, value);
1300 NotifyPropertyChanged();
1305 /// Gets or sets the size height of the view.
1309 /// Animatable - This property can be animated using <c>Animation</c> class.
1312 /// animation.AnimateTo(view, "SizeHeight", 500.0f);
1315 /// <since_tizen> 3 </since_tizen>
1316 public float SizeHeight
1320 return (float)GetValue(SizeHeightProperty);
1324 SetValue(SizeHeightProperty, value);
1325 NotifyPropertyChanged();
1330 /// Gets or sets the position of the view.<br />
1331 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1332 /// If the position inheritance is disabled, sets the world position.<br />
1336 /// Animatable - This property can be animated using <c>Animation</c> class.
1338 /// animation.AnimateTo(view, "Position", new Position(50, 0));
1341 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1343 /// <since_tizen> 3 </since_tizen>
1344 public Position Position
1348 Position tmp = (Position)GetValue(PositionProperty);
1349 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1353 SetValue(PositionProperty, value);
1354 NotifyPropertyChanged();
1359 /// Gets or sets the position X of the view.
1363 /// Animatable - This property can be animated using <c>Animation</c> class.
1365 /// animation.AnimateTo(view, "PositionX", 50.0f);
1369 /// <since_tizen> 3 </since_tizen>
1370 public float PositionX
1374 return (float)GetValue(PositionXProperty);
1378 SetValue(PositionXProperty, value);
1379 NotifyPropertyChanged();
1384 /// Gets or sets the position Y of the view.
1388 /// Animatable - This property can be animated using <c>Animation</c> class.
1390 /// animation.AnimateTo(view, "PositionY", 50.0f);
1394 /// <since_tizen> 3 </since_tizen>
1395 public float PositionY
1399 return (float)GetValue(PositionYProperty);
1403 SetValue(PositionYProperty, value);
1404 NotifyPropertyChanged();
1409 /// Gets or sets the position Z of the view.
1413 /// Animatable - This property can be animated using <c>Animation</c> class.
1415 /// animation.AnimateTo(view, "PositionZ", 50.0f);
1419 /// <since_tizen> 3 </since_tizen>
1420 public float PositionZ
1424 return (float)GetValue(PositionZProperty);
1428 SetValue(PositionZProperty, value);
1429 NotifyPropertyChanged();
1434 /// Gets or sets the world position of the view.
1436 /// <since_tizen> 3 </since_tizen>
1437 public Vector3 WorldPosition
1441 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1442 var pValue = GetProperty(View.Property.WorldPosition);
1450 /// Gets or sets the orientation of the view.<br />
1451 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1455 /// This is an asynchronous method.
1458 /// Animatable - This property can be animated using <c>Animation</c> class.
1460 /// animation.AnimateTo(view, "Orientation", new Rotation(new Radian((float)Math.PI), Vector3.XAxis));
1464 /// <since_tizen> 3 </since_tizen>
1465 public Rotation Orientation
1469 return (Rotation)GetValue(OrientationProperty);
1473 SetValue(OrientationProperty, value);
1474 NotifyPropertyChanged();
1479 /// Gets or sets the world orientation of the view.<br />
1481 /// <since_tizen> 3 </since_tizen>
1482 public Rotation WorldOrientation
1486 Rotation temp = new Rotation();
1487 var pValue = GetProperty(View.Property.WorldOrientation);
1495 /// Gets or sets the scale factor applied to the view.<br />
1499 /// Animatable - This property can be animated using <c>Animation</c> class.
1501 /// animation.AnimateTo(view, "Scale", new Vector3(1.5f, 1.5f, 1.0f));
1504 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1506 /// <since_tizen> 3 </since_tizen>
1507 public Vector3 Scale
1511 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1512 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1516 SetValue(ScaleProperty, value);
1517 NotifyPropertyChanged();
1522 /// Gets or sets the scale X factor applied to the view.
1526 /// Animatable - This property can be animated using <c>Animation</c> class.
1528 /// animation.AnimateTo(view, "ScaleX", 1.5f);
1532 /// <since_tizen> 3 </since_tizen>
1537 return (float)GetValue(ScaleXProperty);
1541 SetValue(ScaleXProperty, value);
1542 NotifyPropertyChanged();
1547 /// Gets or sets the scale Y factor applied to the view.
1551 /// Animatable - This property can be animated using <c>Animation</c> class.
1553 /// animation.AnimateTo(view, "ScaleY", 1.5f);
1557 /// <since_tizen> 3 </since_tizen>
1562 return (float)GetValue(ScaleYProperty);
1566 SetValue(ScaleYProperty, value);
1567 NotifyPropertyChanged();
1572 /// Gets or sets the scale Z factor applied to the view.
1576 /// Animatable - This property can be animated using <c>Animation</c> class.
1578 /// animation.AnimateTo(view, "ScaleZ", 1.5f);
1582 /// <since_tizen> 3 </since_tizen>
1587 return (float)GetValue(ScaleZProperty);
1591 SetValue(ScaleZProperty, value);
1592 NotifyPropertyChanged();
1597 /// Gets the world scale of the view.
1599 /// <since_tizen> 3 </since_tizen>
1600 public Vector3 WorldScale
1604 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1605 var pValue = GetProperty(View.Property.WorldScale);
1613 /// Retrieves the visibility flag of the view.
1617 /// If the view is not visible, then the view and its children will not be rendered.
1618 /// 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.
1621 /// Animatable - This property can be animated using <c>Animation</c> class.
1623 /// animation.AnimateTo(view, "Visibility", false);
1627 /// <since_tizen> 3 </since_tizen>
1628 public bool Visibility
1633 var pValue = GetProperty(View.Property.VISIBLE);
1634 pValue.Get(out temp);
1641 /// Gets the view's world color.
1643 /// <since_tizen> 3 </since_tizen>
1644 public Vector4 WorldColor
1648 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1649 var pValue = GetProperty(View.Property.WorldColor);
1657 /// Gets or sets the view's name.
1659 /// <since_tizen> 3 </since_tizen>
1664 return (string)GetValue(NameProperty);
1668 SetValue(NameProperty, value);
1669 NotifyPropertyChanged();
1674 /// Get the number of children held by the view.
1676 /// <since_tizen> 3 </since_tizen>
1677 public new uint ChildCount
1681 return Convert.ToUInt32(Children.Count);
1686 /// Gets the view's ID.
1689 /// <since_tizen> 3 </since_tizen>
1699 /// Gets or sets the status of whether the view should emit touch or hover signals.
1700 /// If a View is made insensitive, then the View and its children are not hittable.
1702 /// <since_tizen> 3 </since_tizen>
1703 public bool Sensitive
1707 return (bool)GetValue(SensitiveProperty);
1711 SetValue(SensitiveProperty, value);
1712 NotifyPropertyChanged();
1717 /// 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.
1719 /// <since_tizen> 3 </since_tizen>
1720 public bool LeaveRequired
1724 return (bool)GetValue(LeaveRequiredProperty);
1728 SetValue(LeaveRequiredProperty, value);
1729 NotifyPropertyChanged();
1734 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1736 /// <since_tizen> 3 </since_tizen>
1737 public bool InheritOrientation
1741 return (bool)GetValue(InheritOrientationProperty);
1745 SetValue(InheritOrientationProperty, value);
1746 NotifyPropertyChanged();
1751 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1753 /// <since_tizen> 3 </since_tizen>
1754 public bool InheritScale
1758 return (bool)GetValue(InheritScaleProperty);
1762 SetValue(InheritScaleProperty, value);
1763 NotifyPropertyChanged();
1768 /// Gets or sets the status of how the view and its children should be drawn.<br />
1769 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1770 /// 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 />
1771 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1772 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1773 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1775 /// <since_tizen> 3 </since_tizen>
1776 public DrawModeType DrawMode
1780 return (DrawModeType)GetValue(DrawModeProperty);
1784 SetValue(DrawModeProperty, value);
1785 NotifyPropertyChanged();
1790 /// Gets or sets the relative to parent size factor of the view.<br />
1791 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1792 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1795 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1797 /// <since_tizen> 3 </since_tizen>
1798 public Vector3 SizeModeFactor
1802 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1803 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1807 SetValue(SizeModeFactorProperty, value);
1808 NotifyPropertyChanged();
1813 /// Gets or sets the width resize policy to be used.
1815 /// <since_tizen> 3 </since_tizen>
1816 public ResizePolicyType WidthResizePolicy
1820 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1824 SetValue(WidthResizePolicyProperty, value);
1825 NotifyPropertyChanged();
1830 /// Gets or sets the height resize policy to be used.
1832 /// <since_tizen> 3 </since_tizen>
1833 public ResizePolicyType HeightResizePolicy
1837 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1841 SetValue(HeightResizePolicyProperty, value);
1842 NotifyPropertyChanged();
1847 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1848 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1850 /// <since_tizen> 3 </since_tizen>
1851 public SizeScalePolicyType SizeScalePolicy
1855 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1859 SetValue(SizeScalePolicyProperty, value);
1860 NotifyPropertyChanged();
1865 /// Gets or sets the status of whether the width size is dependent on the height size.
1867 /// <since_tizen> 3 </since_tizen>
1868 public bool WidthForHeight
1872 return (bool)GetValue(WidthForHeightProperty);
1876 SetValue(WidthForHeightProperty, value);
1877 NotifyPropertyChanged();
1882 /// Gets or sets the status of whether the height size is dependent on the width size.
1884 /// <since_tizen> 3 </since_tizen>
1885 public bool HeightForWidth
1889 return (bool)GetValue(HeightForWidthProperty);
1893 SetValue(HeightForWidthProperty, value);
1894 NotifyPropertyChanged();
1899 /// Gets or sets the padding for use in layout.
1902 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1904 /// <since_tizen> 5 </since_tizen>
1905 public Extents Padding
1909 // If View has a Layout then padding in stored in the base Layout class
1912 return Layout.Padding;
1916 Extents temp = (Extents)GetValue(PaddingProperty);
1917 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1919 // Two return points to prevent creating a zeroed Extent native object before assignment
1923 Extents padding = value;
1926 // Layout set so store Padding in LayoutItem instead of in View.
1927 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1928 // the position and sizes measure in the Layouting.
1929 Layout.Padding = value;
1930 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1931 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1932 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1934 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1938 SetValue(PaddingProperty, padding);
1939 NotifyPropertyChanged();
1944 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1946 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1948 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1950 /// <since_tizen> 3 </since_tizen>
1951 public Size2D MinimumSize
1955 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1956 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1962 throw new ArgumentNullException(nameof(value));
1966 // Note: it only works if minimum size is >= than natural size.
1967 // To force the size it should be done through the width&height spec or Size2D.
1968 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1969 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1970 layout.RequestLayout();
1972 SetValue(MinimumSizeProperty, value);
1973 NotifyPropertyChanged();
1978 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1981 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1983 /// <since_tizen> 3 </since_tizen>
1984 public Size2D MaximumSize
1988 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1989 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1993 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1994 // MATCH_PARENT spec + parent container size can be used to limit
1997 layout.RequestLayout();
1999 SetValue(MaximumSizeProperty, value);
2000 NotifyPropertyChanged();
2005 /// Gets or sets whether a child view inherits it's parent's position.<br />
2006 /// Default is to inherit.<br />
2007 /// 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 />
2009 /// <since_tizen> 3 </since_tizen>
2010 public bool InheritPosition
2014 return (bool)GetValue(InheritPositionProperty);
2018 SetValue(InheritPositionProperty, value);
2019 NotifyPropertyChanged();
2024 /// Gets or sets the clipping behavior (mode) of it's children.
2026 /// <since_tizen> 3 </since_tizen>
2027 public ClippingModeType ClippingMode
2031 return (ClippingModeType)GetValue(ClippingModeProperty);
2035 SetValue(ClippingModeProperty, value);
2036 NotifyPropertyChanged();
2041 /// Gets the number of renderers held by the view.
2043 /// <since_tizen> 3 </since_tizen>
2044 public uint RendererCount
2048 return GetRendererCount();
2053 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2056 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2058 /// <since_tizen> 3 </since_tizen>
2059 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2061 "View view = new View(); " +
2062 "view.PivotPoint = PivotPoint.Center; " +
2063 "view.PositionUsesPivotPoint = true;")]
2064 [EditorBrowsable(EditorBrowsableState.Never)]
2065 public Position AnchorPoint
2069 Position temp = new Position(0.0f, 0.0f, 0.0f);
2070 var pValue = GetProperty(View.Property.AnchorPoint);
2073 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2079 var temp = new Tizen.NUI.PropertyValue(value);
2080 SetProperty(View.Property.AnchorPoint, temp);
2082 NotifyPropertyChanged();
2087 /// Sets the size of a view for the width, the height and the depth.<br />
2088 /// Geometry can be scaled to fit within this area.<br />
2089 /// This does not interfere with the view's scale factor.<br />
2090 /// The views default depth is the minimum of width and height.<br />
2094 /// Animatable - This property can be animated using <c>Animation</c> class.
2096 /// animation.AnimateTo(view, "Size", new Size(100, 100));
2099 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2101 /// <since_tizen> 5 </since_tizen>
2106 Size tmp = (Size)GetValue(SizeProperty);
2107 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2111 SetValue(SizeProperty, value);
2112 NotifyPropertyChanged();
2117 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2119 /// <since_tizen> 3 </since_tizen>
2120 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2122 "Container parent = view.GetParent(); " +
2123 "View view = parent as View;")]
2124 [EditorBrowsable(EditorBrowsableState.Never)]
2125 public new View Parent
2130 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2131 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2132 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2134 if (basehandle is Layer layer)
2136 ret = new View(Layer.getCPtr(layer).Handle, false);
2137 NUILog.Error("This Parent property is deprecated, should do not be used");
2141 ret = basehandle as View;
2144 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2145 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2147 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2153 /// Gets/Sets whether inherit parent's the layout Direction.
2155 /// <since_tizen> 4 </since_tizen>
2156 public bool InheritLayoutDirection
2160 return (bool)GetValue(InheritLayoutDirectionProperty);
2164 SetValue(InheritLayoutDirectionProperty, value);
2165 NotifyPropertyChanged();
2170 /// Gets/Sets the layout Direction.
2172 /// <since_tizen> 4 </since_tizen>
2173 public ViewLayoutDirectionType LayoutDirection
2177 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2181 SetValue(LayoutDirectionProperty, value);
2182 NotifyPropertyChanged();
2183 layout?.RequestLayout();
2188 /// Gets or sets the Margin for use in layout.
2191 /// Margin property is supported by Layout algorithms and containers.
2192 /// Please Set Layout if you want to use Margin property.
2193 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2195 /// <since_tizen> 4 </since_tizen>
2196 public Extents Margin
2200 // If View has a Layout then margin is stored in Layout.
2203 return Layout.Margin;
2207 // If Layout not set then return margin stored in View.
2208 Extents temp = (Extents)GetValue(MarginProperty);
2209 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2211 // Two return points to prevent creating a zeroed Extent native object before assignment
2217 // Layout set so store Margin in LayoutItem instead of View.
2218 // If View stores the Margin too then the Legacy Size Negotiation will
2219 // overwrite the position and size values measured in the Layouting.
2220 Layout.Margin = value;
2221 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2222 layout?.RequestLayout();
2226 SetValue(MarginProperty, value);
2228 NotifyPropertyChanged();
2229 layout?.RequestLayout();
2234 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2238 /// // matchParentView matches its size to its parent size.
2239 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2240 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2242 /// // wrapContentView wraps its children with their desired size.
2243 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2244 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2246 /// // exactSizeView shows itself with an exact size.
2247 /// exactSizeView.WidthSpecification = 100;
2248 /// exactSizeView.HeightSpecification = 100;
2251 /// <since_tizen> 6 </since_tizen>
2252 public int WidthSpecification
2260 if (value == widthPolicy)
2263 widthPolicy = value;
2264 if (widthPolicy >= 0)
2266 if (heightPolicy >= 0) // Policy an exact value
2268 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2269 Size2D = new Size2D(widthPolicy, heightPolicy);
2272 layout?.RequestLayout();
2277 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2281 /// // matchParentView matches its size to its parent size.
2282 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2283 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2285 /// // wrapContentView wraps its children with their desired size.
2286 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2287 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2289 /// // exactSizeView shows itself with an exact size.
2290 /// exactSizeView.WidthSpecification = 100;
2291 /// exactSizeView.HeightSpecification = 100;
2294 /// <since_tizen> 6 </since_tizen>
2295 public int HeightSpecification
2299 return heightPolicy;
2303 if (value == heightPolicy)
2306 heightPolicy = value;
2307 if (heightPolicy >= 0)
2309 if (widthPolicy >= 0) // Policy an exact value
2311 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2312 Size2D = new Size2D(widthPolicy, heightPolicy);
2315 layout?.RequestLayout();
2320 /// Gets the List of transitions for this View.
2322 /// <since_tizen> 6 </since_tizen>
2323 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2327 if (layoutTransitions == null)
2329 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2331 return layoutTransitions;
2336 /// Sets a layout transitions for this View.
2338 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2340 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2342 /// <since_tizen> 6 </since_tizen>
2343 public LayoutTransition LayoutTransition
2347 return layoutTransition;
2353 throw new global::System.ArgumentNullException(nameof(value));
2355 if (layoutTransitions == null)
2357 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2360 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2362 AttachTransitionsToChildren(value);
2364 layoutTransition = value;
2369 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2372 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2374 /// <since_tizen> 4 </since_tizen>
2375 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2376 [EditorBrowsable(EditorBrowsableState.Never)]
2377 public Extents PaddingEX
2381 Extents temp = new Extents(0, 0, 0, 0);
2382 var pValue = GetProperty(View.Property.PADDING);
2385 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2391 var temp = new Tizen.NUI.PropertyValue(value);
2392 SetProperty(View.Property.PADDING, temp);
2394 NotifyPropertyChanged();
2395 layout?.RequestLayout();
2399 [EditorBrowsable(EditorBrowsableState.Never)]
2400 public XamlStyle XamlStyle
2404 return (XamlStyle)GetValue(XamlStyleProperty);
2408 SetValue(XamlStyleProperty, value);
2413 /// The Color of View. This is an RGBA value.
2417 /// Animatable - This property can be animated using <c>Animation</c> class.
2419 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2421 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2422 [EditorBrowsable(EditorBrowsableState.Never)]
2427 Color temp = (Color)GetValue(ColorProperty);
2428 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2432 SetValue(ColorProperty, value);
2433 NotifyPropertyChanged();
2438 /// Set the layout on this View. Replaces any existing Layout.
2441 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2443 /// <since_tizen> 6 </since_tizen>
2444 public LayoutItem Layout
2452 // Do nothing if layout provided is already set on this View.
2453 if (value == layout)
2458 LayoutingDisabled = false;
2461 // If new layout being set already has a owner then that owner receives a replacement default layout.
2462 // First check if the layout to be set already has a owner.
2463 if (value?.Owner != null)
2465 // Previous owner of the layout gets a default layout as a replacement.
2466 value.Owner.Layout = new AbsoluteLayout();
2468 // Copy Margin and Padding to replacement LayoutGroup.
2469 if (value.Owner.Layout != null)
2471 value.Owner.Layout.Margin = value.Margin;
2472 value.Owner.Layout.Padding = value.Padding;
2476 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2477 // View if no replacement. Previously margin and padding values would have been moved from
2478 // the View to the layout.
2479 if (layout != null) // Existing layout
2483 // Existing layout being replaced so copy over margin and padding values.
2484 value.Margin = layout.Margin;
2485 value.Padding = layout.Padding;
2489 // Layout not being replaced so restore margin and padding to View.
2490 SetValue(MarginProperty, layout.Margin);
2491 SetValue(PaddingProperty, layout.Padding);
2492 NotifyPropertyChanged();
2497 // First Layout to be added to the View hence copy
2499 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2502 Extents margin = Margin;
2503 Extents padding = Padding;
2504 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2506 // If View already has a margin set then store it in Layout instead.
2507 value.Margin = margin;
2508 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2509 NotifyPropertyChanged();
2512 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2514 // If View already has a padding set then store it in Layout instead.
2515 value.Padding = padding;
2517 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2518 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2519 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2521 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2522 NotifyPropertyChanged();
2528 // Remove existing layout from it's parent layout group.
2531 value.SetPositionByLayout = !excludeLayouting;
2533 // Set layout to this view
2539 /// The weight of the View, used to share available space in a layout with siblings.
2541 /// <since_tizen> 6 </since_tizen>
2551 layout?.RequestLayout();
2556 /// Whether to load the BackgroundImage synchronously.
2557 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2558 /// Note: For Normal Quad images only.
2560 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2561 [EditorBrowsable(EditorBrowsableState.Never)]
2562 public bool BackgroundImageSynchronosLoading
2566 return backgroundImageSynchronosLoading;
2570 backgroundImageSynchronosLoading = value;
2572 string bgUrl = null;
2573 var pValue = Background.Find(ImageVisualProperty.URL);
2574 pValue?.Get(out bgUrl);
2577 if (!string.IsNullOrEmpty(bgUrl))
2579 PropertyMap bgMap = this.Background;
2580 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2581 bgMap.Add("synchronousLoading", temp);
2588 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2589 [EditorBrowsable(EditorBrowsableState.Never)]
2590 public Vector2 UpdateSizeHint
2594 return (Vector2)GetValue(UpdateSizeHintProperty);
2598 SetValue(UpdateSizeHintProperty, value);
2599 NotifyPropertyChanged();
2604 /// Enable/Disable ControlState propagation for children.
2605 /// It is false by default.
2606 /// If the View needs to share ControlState with descendants, please set it true.
2607 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2609 [EditorBrowsable(EditorBrowsableState.Never)]
2610 public bool EnableControlStatePropagation
2612 get => themeData?.ControlStatePropagation ?? false;
2615 if (EnableControlStatePropagation == value) return;
2617 if (themeData == null) themeData = new ThemeData();
2619 themeData.ControlStatePropagation = value;
2621 foreach (View child in Children)
2623 child.EnableControlStatePropagation = value;
2629 /// By default, it is false in View, true in Control.
2630 /// Note that if the value is true, the View will be a touch receptor.
2632 [EditorBrowsable(EditorBrowsableState.Never)]
2633 public bool EnableControlState
2637 return (bool)GetValue(EnableControlStateProperty);
2641 SetValue(EnableControlStateProperty, value);
2646 /// Whether the actor grab all touches even if touch leaves its boundary.
2648 /// <returns>true, if it grab all touch after start</returns>
2649 [EditorBrowsable(EditorBrowsableState.Never)]
2650 public bool GrabTouchAfterLeave
2655 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2656 pValue.Get(out temp);
2662 var temp = new Tizen.NUI.PropertyValue(value);
2663 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2665 NotifyPropertyChanged();
2670 /// Determines which blend equation will be used to render renderers of this actor.
2672 /// <returns>blend equation enum currently assigned</returns>
2673 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2674 [EditorBrowsable(EditorBrowsableState.Never)]
2675 public BlendEquationType BlendEquation
2680 var pValue = GetProperty(View.Property.BlendEquation);
2681 pValue.Get(out temp);
2683 return (BlendEquationType)temp;
2687 var temp = new Tizen.NUI.PropertyValue((int)value);
2688 SetProperty(View.Property.BlendEquation, temp);
2690 NotifyPropertyChanged();
2695 /// If the value is true, the View will change its style as the theme changes.
2696 /// The default value is false in normal case but it can be true when the NUIApplication is created with <see cref="NUIApplication.ThemeOptions.ThemeChangeSensitive"/>.
2698 /// <since_tizen> 9 </since_tizen>
2699 public bool ThemeChangeSensitive
2701 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2702 set => SetValue(ThemeChangeSensitiveProperty, value);
2706 /// Create Style, it is abstract function and must be override.
2708 [EditorBrowsable(EditorBrowsableState.Never)]
2709 protected virtual ViewStyle CreateViewStyle()
2711 return new ViewStyle();
2715 /// Called after the View's ControlStates changed.
2717 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2718 [EditorBrowsable(EditorBrowsableState.Never)]
2719 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2725 [EditorBrowsable(EditorBrowsableState.Never)]
2726 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2728 if (string.IsNullOrEmpty(styleName)) ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(GetType()));
2729 else ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(styleName));
2733 /// Apply style instance to the view.
2734 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2736 /// <since_tizen> 9 </since_tizen>
2737 public virtual void ApplyStyle(ViewStyle viewStyle)
2739 if (viewStyle == null || themeData?.viewStyle == viewStyle) return;
2741 if (themeData == null) themeData = new ThemeData();
2743 themeData.viewStyle = viewStyle;
2745 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2751 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2753 if (bindablePropertyOfView == null)
2758 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2759 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2761 foreach (var sourceProperty in dirtyStyleProperties)
2763 var sourceValue = viewStyle.GetValue(sourceProperty);
2765 if (sourceValue == null)
2770 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2772 if (destinationProperty != null)
2774 SetValue(destinationProperty, sourceValue);
2780 /// Get whether the View is culled or not.
2781 /// True means that the View is out of the view frustum.
2784 /// Hidden-API (Inhouse-API).
2786 [EditorBrowsable(EditorBrowsableState.Never)]
2792 var pValue = GetProperty(View.Property.Culled);
2793 pValue.Get(out temp);
2800 /// Set or Get TransitionOptions for the page transition.
2801 /// This property is used to define how this view will be transitioned during Page switching.
2803 /// <since_tizen> 9 </since_tizen>
2804 public TransitionOptions TransitionOptions
2808 transitionOptions = value;
2812 return transitionOptions;