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 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
472 /// Animatable - This property can be animated using <c>Animation</c> class.
474 /// animation.AnimateTo(view, "CornerRadius", new Vector4(10, 10, 10, 10));
478 /// <since_tizen> 9 </since_tizen>
479 public Vector4 CornerRadius
483 return (Vector4)GetValue(CornerRadiusProperty);
487 SetValue(CornerRadiusProperty, value);
488 NotifyPropertyChanged();
493 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
494 /// It is absolute by default.
495 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
497 /// <since_tizen> 9 </since_tizen>
498 public VisualTransformPolicyType CornerRadiusPolicy
500 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
501 set => SetValue(CornerRadiusPolicyProperty, value);
505 /// The width for the borderline of the View.
506 /// This will draw borderline at background.
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.
514 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
515 [EditorBrowsable(EditorBrowsableState.Never)]
516 public float BorderlineWidth
520 return (float)GetValue(BorderlineWidthProperty);
524 SetValue(BorderlineWidthProperty, value);
525 NotifyPropertyChanged();
530 /// The color for the borderline of the View.
531 /// It is Color.Black by default.
535 /// Animatable - This property can be animated using <c>Animation</c> class.
538 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
539 [EditorBrowsable(EditorBrowsableState.Never)]
540 public Color BorderlineColor
544 return (Color)GetValue(BorderlineColorProperty);
548 SetValue(BorderlineColorProperty, value);
549 NotifyPropertyChanged();
554 /// The Relative offset for the borderline of the View.
555 /// recommand [-1.0f to 1.0f] range.
556 /// If -1.0f, borderline draw inside of View.
557 /// If 1.0f, borderline draw outside of View.
558 /// If 0.0f, borderline draw half at inside and half at outside.
559 /// It is 0.0f by default.
563 /// Animatable - This property can be animated using <c>Animation</c> class.
566 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
567 [EditorBrowsable(EditorBrowsableState.Never)]
568 public float BorderlineOffset
572 return (float)GetValue(BorderlineOffsetProperty);
576 SetValue(BorderlineOffsetProperty, value);
577 NotifyPropertyChanged();
582 /// The current state of the view.
584 /// <since_tizen> 3 </since_tizen>
589 return (States)GetValue(StateProperty);
593 SetValue(StateProperty, value);
594 NotifyPropertyChanged();
599 /// The current sub state of the view.
601 /// <since_tizen> 3 </since_tizen>
602 public States SubState
606 return (States)GetValue(SubStateProperty);
610 SetValue(SubStateProperty, value);
611 NotifyPropertyChanged();
616 /// Displays a tooltip
618 /// <since_tizen> 3 </since_tizen>
619 public Tizen.NUI.PropertyMap Tooltip
623 return (PropertyMap)GetValue(TooltipProperty);
627 SetValue(TooltipProperty, value);
628 NotifyPropertyChanged();
633 /// Displays a tooltip as a text.
635 /// <since_tizen> 3 </since_tizen>
636 public string TooltipText
640 using (var propertyValue = GetProperty(Property.TOOLTIP))
642 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
644 return retrivedValue;
646 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
647 return "error to get TooltipText";
652 var temp = new Tizen.NUI.PropertyValue(value);
653 SetProperty(View.Property.TOOLTIP, temp);
655 NotifyPropertyChanged();
660 /// The Child property of FlexContainer.<br />
661 /// The proportion of the free space in the container, the flex item will receive.<br />
662 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
664 /// <since_tizen> 3 </since_tizen>
665 [Obsolete("Deprecated in API8, will be removed in API10.")]
670 return (float)GetValue(FlexProperty);
674 SetValue(FlexProperty, value);
675 NotifyPropertyChanged();
680 /// The Child property of FlexContainer.<br />
681 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
683 /// <since_tizen> 3 </since_tizen>
684 [Obsolete("Deprecated in API8, will be removed in API10.")]
689 return (int)GetValue(AlignSelfProperty);
693 SetValue(AlignSelfProperty, value);
694 NotifyPropertyChanged();
699 /// The Child property of FlexContainer.<br />
700 /// The space around the flex item.<br />
703 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
705 /// <since_tizen> 3 </since_tizen>
706 [Obsolete("Deprecated in API8, will be removed in API10.")]
707 public Vector4 FlexMargin
711 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
712 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
716 SetValue(FlexMarginProperty, value);
717 NotifyPropertyChanged();
722 /// The top-left cell this child occupies, if not set, the first available cell is used.
725 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
726 /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
728 /// <since_tizen> 3 </since_tizen>
729 public Vector2 CellIndex
733 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
734 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
738 SetValue(CellIndexProperty, value);
739 NotifyPropertyChanged();
744 /// The number of rows this child occupies, if not set, the default value is 1.
747 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
749 /// <since_tizen> 3 </since_tizen>
754 return (float)GetValue(RowSpanProperty);
758 SetValue(RowSpanProperty, value);
759 NotifyPropertyChanged();
764 /// The number of columns this child occupies, if not set, the default value is 1.
767 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
769 /// <since_tizen> 3 </since_tizen>
770 public float ColumnSpan
774 return (float)GetValue(ColumnSpanProperty);
778 SetValue(ColumnSpanProperty, value);
779 NotifyPropertyChanged();
784 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
787 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
789 /// <since_tizen> 3 </since_tizen>
790 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
794 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
798 SetValue(CellHorizontalAlignmentProperty, value);
799 NotifyPropertyChanged();
804 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
807 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
809 /// <since_tizen> 3 </since_tizen>
810 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
814 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
818 SetValue(CellVerticalAlignmentProperty, value);
819 NotifyPropertyChanged();
824 /// The left focusable view.<br />
825 /// This will return null if not set.<br />
826 /// This will also return null if the specified left focusable view is not on a window.<br />
828 /// <since_tizen> 3 </since_tizen>
829 public View LeftFocusableView
831 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
834 return (View)GetValue(LeftFocusableViewProperty);
838 SetValue(LeftFocusableViewProperty, value);
839 NotifyPropertyChanged();
844 /// The right focusable view.<br />
845 /// This will return null if not set.<br />
846 /// This will also return null if the specified right focusable view is not on a window.<br />
848 /// <since_tizen> 3 </since_tizen>
849 public View RightFocusableView
851 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
854 return (View)GetValue(RightFocusableViewProperty);
858 SetValue(RightFocusableViewProperty, value);
859 NotifyPropertyChanged();
864 /// The up focusable view.<br />
865 /// This will return null if not set.<br />
866 /// This will also return null if the specified up focusable view is not on a window.<br />
868 /// <since_tizen> 3 </since_tizen>
869 public View UpFocusableView
871 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
874 return (View)GetValue(UpFocusableViewProperty);
878 SetValue(UpFocusableViewProperty, value);
879 NotifyPropertyChanged();
884 /// The down focusable view.<br />
885 /// This will return null if not set.<br />
886 /// This will also return null if the specified down focusable view is not on a window.<br />
888 /// <since_tizen> 3 </since_tizen>
889 public View DownFocusableView
891 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
894 return (View)GetValue(DownFocusableViewProperty);
898 SetValue(DownFocusableViewProperty, value);
899 NotifyPropertyChanged();
904 /// Whether the view should be focusable by keyboard navigation.
906 /// <since_tizen> 3 </since_tizen>
907 public bool Focusable
911 SetValue(FocusableProperty, value);
912 NotifyPropertyChanged();
916 return (bool)GetValue(FocusableProperty);
921 /// Whether this view can focus by touch.
922 /// If Focusable is false, FocusableInTouch is disabled.
923 /// If you want to have focus on touch, you need to set both Focusable and FocusableInTouch settings to true.
925 [EditorBrowsable(EditorBrowsableState.Never)]
926 public bool FocusableInTouch
930 SetValue(FocusableInTouchProperty, value);
931 NotifyPropertyChanged();
935 return (bool)GetValue(FocusableInTouchProperty);
940 /// Retrieves the position of the view.<br />
941 /// The coordinates are relative to the view's parent.<br />
943 /// <since_tizen> 3 </since_tizen>
944 public Position CurrentPosition
948 return GetCurrentPosition();
953 /// Sets the size of a view for the width and the height.<br />
954 /// Geometry can be scaled to fit within this area.<br />
955 /// This does not interfere with the view's scale factor.<br />
956 /// The views default depth is the minimum of width and height.<br />
959 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
960 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
962 /// <since_tizen> 3 </since_tizen>
967 Size2D temp = (Size2D)GetValue(Size2DProperty);
968 int width = temp.Width;
969 int height = temp.Height;
971 if (this.Layout == null)
973 if (width < 0) { width = 0; }
974 if (height < 0) { height = 0; }
977 return new Size2D(OnSize2DChanged, width, height);
981 SetValue(Size2DProperty, value);
983 NotifyPropertyChanged();
988 /// Retrieves the size of the view.<br />
989 /// The coordinates are relative to the view's parent.<br />
991 /// <since_tizen> 3 </since_tizen>
992 public Size2D CurrentSize
996 return GetCurrentSize();
1001 /// Retrieves and sets the view's opacity.<br />
1005 /// Animatable - This property can be animated using <c>Animation</c> class.
1007 /// animation.AnimateTo(view, "Opacity", 0.5f);
1011 /// <since_tizen> 3 </since_tizen>
1012 public float Opacity
1016 return (float)GetValue(OpacityProperty);
1020 SetValue(OpacityProperty, value);
1021 NotifyPropertyChanged();
1026 /// Sets the position of the view for X and Y.<br />
1027 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1028 /// If the position inheritance is disabled, sets the world position.<br />
1031 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1032 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1034 /// <since_tizen> 3 </since_tizen>
1035 public Position2D Position2D
1039 Position2D temp = (Position2D)GetValue(Position2DProperty);
1040 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1044 SetValue(Position2DProperty, value);
1045 NotifyPropertyChanged();
1050 /// Retrieves the screen position of the view.<br />
1052 /// <since_tizen> 3 </since_tizen>
1053 public Vector2 ScreenPosition
1057 Vector2 temp = new Vector2(0.0f, 0.0f);
1058 var pValue = GetProperty(View.Property.ScreenPosition);
1066 /// Determines whether the pivot point should be used to determine the position of the view.
1067 /// This is false by default.
1069 /// <remarks>If false, then the top-left of the view is used for the position.
1070 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1072 /// <since_tizen> 3 </since_tizen>
1073 public bool PositionUsesPivotPoint
1077 return (bool)GetValue(PositionUsesPivotPointProperty);
1081 SetValue(PositionUsesPivotPointProperty, value);
1082 NotifyPropertyChanged();
1087 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1089 /// <since_tizen> 3 </since_tizen>
1090 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1092 "View view = new View(); " +
1093 "view.PivotPoint = PivotPoint.Center; " +
1094 "view.PositionUsesPivotPoint = true;" +
1095 " Deprecated in API5: Will be removed in API8")]
1096 [EditorBrowsable(EditorBrowsableState.Never)]
1097 public bool PositionUsesAnchorPoint
1102 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1103 pValue.Get(out temp);
1109 var temp = new Tizen.NUI.PropertyValue(value);
1110 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1112 NotifyPropertyChanged();
1117 /// Queries whether the view is connected to the stage.<br />
1118 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1120 /// <since_tizen> 3 </since_tizen>
1121 public bool IsOnWindow
1130 /// Gets the depth in the hierarchy for the view.
1132 /// <since_tizen> 3 </since_tizen>
1133 public int HierarchyDepth
1137 return GetHierarchyDepth();
1142 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1145 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1146 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1147 /// The values set by this property will likely change.
1149 /// <since_tizen> 3 </since_tizen>
1150 public int SiblingOrder
1154 return (int)GetValue(SiblingOrderProperty);
1158 SetValue(SiblingOrderProperty, value);
1160 LayoutGroup layout = Layout as LayoutGroup;
1161 layout?.ChangeLayoutSiblingOrder(value);
1163 NotifyPropertyChanged();
1168 /// Returns the natural size of the view.
1171 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1173 /// <since_tizen> 5 </since_tizen>
1174 public Vector3 NaturalSize
1178 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1179 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1185 /// Returns the natural size (Size2D) of the view.
1188 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1190 /// <since_tizen> 4 </since_tizen>
1191 public Size2D NaturalSize2D
1195 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1196 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1198 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1205 /// Gets or sets the origin of a view within its parent's area.<br />
1206 /// 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 />
1207 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1208 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1210 /// <pre>The view has been initialized.</pre>
1211 /// <since_tizen> 3 </since_tizen>
1212 public Position ParentOrigin
1216 Position tmp = (Position)GetValue(ParentOriginProperty);
1217 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1221 SetValue(ParentOriginProperty, value);
1222 NotifyPropertyChanged();
1227 /// Gets or sets the anchor-point of a view.<br />
1228 /// 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 />
1229 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1230 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1231 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1232 /// <pre>The view has been initialized.</pre>
1235 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1237 /// <since_tizen> 3 </since_tizen>
1238 public Position PivotPoint
1242 Position tmp = (Position)GetValue(PivotPointProperty);
1243 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1247 SetValue(PivotPointProperty, value);
1248 NotifyPropertyChanged();
1253 /// Gets or sets the size width of the view.
1257 /// Animatable - This property can be animated using <c>Animation</c> class.
1259 /// animation.AnimateTo(view, "SizeWidth", 500.0f);
1263 /// <since_tizen> 3 </since_tizen>
1264 public float SizeWidth
1268 return (float)GetValue(SizeWidthProperty);
1272 SetValue(SizeWidthProperty, value);
1273 NotifyPropertyChanged();
1278 /// Gets or sets the size height of the view.
1282 /// Animatable - This property can be animated using <c>Animation</c> class.
1285 /// animation.AnimateTo(view, "SizeHeight", 500.0f);
1288 /// <since_tizen> 3 </since_tizen>
1289 public float SizeHeight
1293 return (float)GetValue(SizeHeightProperty);
1297 SetValue(SizeHeightProperty, value);
1298 NotifyPropertyChanged();
1303 /// Gets or sets the position of the view.<br />
1304 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1305 /// If the position inheritance is disabled, sets the world position.<br />
1309 /// Animatable - This property can be animated using <c>Animation</c> class.
1311 /// animation.AnimateTo(view, "Position", new Position(50, 0));
1314 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1316 /// <since_tizen> 3 </since_tizen>
1317 public Position Position
1321 Position tmp = (Position)GetValue(PositionProperty);
1322 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1326 SetValue(PositionProperty, value);
1327 NotifyPropertyChanged();
1332 /// Gets or sets the position X of the view.
1336 /// Animatable - This property can be animated using <c>Animation</c> class.
1338 /// animation.AnimateTo(view, "PositionX", 50.0f);
1342 /// <since_tizen> 3 </since_tizen>
1343 public float PositionX
1347 return (float)GetValue(PositionXProperty);
1351 SetValue(PositionXProperty, value);
1352 NotifyPropertyChanged();
1357 /// Gets or sets the position Y of the view.
1361 /// Animatable - This property can be animated using <c>Animation</c> class.
1363 /// animation.AnimateTo(view, "PositionY", 50.0f);
1367 /// <since_tizen> 3 </since_tizen>
1368 public float PositionY
1372 return (float)GetValue(PositionYProperty);
1376 SetValue(PositionYProperty, value);
1377 NotifyPropertyChanged();
1382 /// Gets or sets the position Z of the view.
1386 /// Animatable - This property can be animated using <c>Animation</c> class.
1388 /// animation.AnimateTo(view, "PositionZ", 50.0f);
1392 /// <since_tizen> 3 </since_tizen>
1393 public float PositionZ
1397 return (float)GetValue(PositionZProperty);
1401 SetValue(PositionZProperty, value);
1402 NotifyPropertyChanged();
1407 /// Gets or sets the world position of the view.
1409 /// <since_tizen> 3 </since_tizen>
1410 public Vector3 WorldPosition
1414 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1415 var pValue = GetProperty(View.Property.WorldPosition);
1423 /// Gets or sets the orientation of the view.<br />
1424 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1428 /// This is an asynchronous method.
1431 /// Animatable - This property can be animated using <c>Animation</c> class.
1433 /// animation.AnimateTo(view, "Orientation", new Rotation(new Radian((float)Math.PI), Vector3.XAxis));
1437 /// <since_tizen> 3 </since_tizen>
1438 public Rotation Orientation
1442 return (Rotation)GetValue(OrientationProperty);
1446 SetValue(OrientationProperty, value);
1447 NotifyPropertyChanged();
1452 /// Gets or sets the world orientation of the view.<br />
1454 /// <since_tizen> 3 </since_tizen>
1455 public Rotation WorldOrientation
1459 Rotation temp = new Rotation();
1460 var pValue = GetProperty(View.Property.WorldOrientation);
1468 /// Gets or sets the scale factor applied to the view.<br />
1472 /// Animatable - This property can be animated using <c>Animation</c> class.
1474 /// animation.AnimateTo(view, "Scale", new Vector3(1.5f, 1.5f, 1.0f));
1477 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1479 /// <since_tizen> 3 </since_tizen>
1480 public Vector3 Scale
1484 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1485 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1489 SetValue(ScaleProperty, value);
1490 NotifyPropertyChanged();
1495 /// Gets or sets the scale X factor applied to the view.
1499 /// Animatable - This property can be animated using <c>Animation</c> class.
1501 /// animation.AnimateTo(view, "ScaleX", 1.5f);
1505 /// <since_tizen> 3 </since_tizen>
1510 return (float)GetValue(ScaleXProperty);
1514 SetValue(ScaleXProperty, value);
1515 NotifyPropertyChanged();
1520 /// Gets or sets the scale Y factor applied to the view.
1524 /// Animatable - This property can be animated using <c>Animation</c> class.
1526 /// animation.AnimateTo(view, "ScaleY", 1.5f);
1530 /// <since_tizen> 3 </since_tizen>
1535 return (float)GetValue(ScaleYProperty);
1539 SetValue(ScaleYProperty, value);
1540 NotifyPropertyChanged();
1545 /// Gets or sets the scale Z factor applied to the view.
1549 /// Animatable - This property can be animated using <c>Animation</c> class.
1551 /// animation.AnimateTo(view, "ScaleZ", 1.5f);
1555 /// <since_tizen> 3 </since_tizen>
1560 return (float)GetValue(ScaleZProperty);
1564 SetValue(ScaleZProperty, value);
1565 NotifyPropertyChanged();
1570 /// Gets the world scale of the view.
1572 /// <since_tizen> 3 </since_tizen>
1573 public Vector3 WorldScale
1577 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1578 var pValue = GetProperty(View.Property.WorldScale);
1586 /// Retrieves the visibility flag of the view.
1590 /// If the view is not visible, then the view and its children will not be rendered.
1591 /// 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.
1594 /// Animatable - This property can be animated using <c>Animation</c> class.
1596 /// animation.AnimateTo(view, "Visibility", false);
1600 /// <since_tizen> 3 </since_tizen>
1601 public bool Visibility
1606 var pValue = GetProperty(View.Property.VISIBLE);
1607 pValue.Get(out temp);
1614 /// Gets the view's world color.
1616 /// <since_tizen> 3 </since_tizen>
1617 public Vector4 WorldColor
1621 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1622 var pValue = GetProperty(View.Property.WorldColor);
1630 /// Gets or sets the view's name.
1632 /// <since_tizen> 3 </since_tizen>
1637 return (string)GetValue(NameProperty);
1641 SetValue(NameProperty, value);
1642 NotifyPropertyChanged();
1647 /// Get the number of children held by the view.
1649 /// <since_tizen> 3 </since_tizen>
1650 public new uint ChildCount
1654 return Convert.ToUInt32(Children.Count);
1659 /// Gets the view's ID.
1662 /// <since_tizen> 3 </since_tizen>
1672 /// Gets or sets the status of whether the view should emit touch or hover signals.
1674 /// <since_tizen> 3 </since_tizen>
1675 public bool Sensitive
1679 return (bool)GetValue(SensitiveProperty);
1683 SetValue(SensitiveProperty, value);
1684 NotifyPropertyChanged();
1689 /// 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.
1691 /// <since_tizen> 3 </since_tizen>
1692 public bool LeaveRequired
1696 return (bool)GetValue(LeaveRequiredProperty);
1700 SetValue(LeaveRequiredProperty, value);
1701 NotifyPropertyChanged();
1706 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1708 /// <since_tizen> 3 </since_tizen>
1709 public bool InheritOrientation
1713 return (bool)GetValue(InheritOrientationProperty);
1717 SetValue(InheritOrientationProperty, value);
1718 NotifyPropertyChanged();
1723 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1725 /// <since_tizen> 3 </since_tizen>
1726 public bool InheritScale
1730 return (bool)GetValue(InheritScaleProperty);
1734 SetValue(InheritScaleProperty, value);
1735 NotifyPropertyChanged();
1740 /// Gets or sets the status of how the view and its children should be drawn.<br />
1741 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1742 /// 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 />
1743 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1744 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1745 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1747 /// <since_tizen> 3 </since_tizen>
1748 public DrawModeType DrawMode
1752 return (DrawModeType)GetValue(DrawModeProperty);
1756 SetValue(DrawModeProperty, value);
1757 NotifyPropertyChanged();
1762 /// Gets or sets the relative to parent size factor of the view.<br />
1763 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1764 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1767 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1769 /// <since_tizen> 3 </since_tizen>
1770 public Vector3 SizeModeFactor
1774 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1775 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1779 SetValue(SizeModeFactorProperty, value);
1780 NotifyPropertyChanged();
1785 /// Gets or sets the width resize policy to be used.
1787 /// <since_tizen> 3 </since_tizen>
1788 public ResizePolicyType WidthResizePolicy
1792 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1796 SetValue(WidthResizePolicyProperty, value);
1797 NotifyPropertyChanged();
1802 /// Gets or sets the height resize policy to be used.
1804 /// <since_tizen> 3 </since_tizen>
1805 public ResizePolicyType HeightResizePolicy
1809 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1813 SetValue(HeightResizePolicyProperty, value);
1814 NotifyPropertyChanged();
1819 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1820 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1822 /// <since_tizen> 3 </since_tizen>
1823 public SizeScalePolicyType SizeScalePolicy
1827 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1831 SetValue(SizeScalePolicyProperty, value);
1832 NotifyPropertyChanged();
1837 /// Gets or sets the status of whether the width size is dependent on the height size.
1839 /// <since_tizen> 3 </since_tizen>
1840 public bool WidthForHeight
1844 return (bool)GetValue(WidthForHeightProperty);
1848 SetValue(WidthForHeightProperty, value);
1849 NotifyPropertyChanged();
1854 /// Gets or sets the status of whether the height size is dependent on the width size.
1856 /// <since_tizen> 3 </since_tizen>
1857 public bool HeightForWidth
1861 return (bool)GetValue(HeightForWidthProperty);
1865 SetValue(HeightForWidthProperty, value);
1866 NotifyPropertyChanged();
1871 /// Gets or sets the padding for use in layout.
1874 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1876 /// <since_tizen> 5 </since_tizen>
1877 public Extents Padding
1881 // If View has a Layout then padding in stored in the base Layout class
1884 return Layout.Padding;
1888 Extents temp = (Extents)GetValue(PaddingProperty);
1889 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1891 // Two return points to prevent creating a zeroed Extent native object before assignment
1895 Extents padding = value;
1898 // Layout set so store Padding in LayoutItem instead of in View.
1899 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1900 // the position and sizes measure in the Layouting.
1901 Layout.Padding = value;
1902 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1903 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1904 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1906 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1910 SetValue(PaddingProperty, padding);
1911 NotifyPropertyChanged();
1916 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1918 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1920 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1922 /// <since_tizen> 3 </since_tizen>
1923 public Size2D MinimumSize
1927 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1928 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1934 throw new ArgumentNullException(nameof(value));
1938 // Note: it only works if minimum size is >= than natural size.
1939 // To force the size it should be done through the width&height spec or Size2D.
1940 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1941 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1942 layout.RequestLayout();
1944 SetValue(MinimumSizeProperty, value);
1945 NotifyPropertyChanged();
1950 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1953 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1955 /// <since_tizen> 3 </since_tizen>
1956 public Size2D MaximumSize
1960 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1961 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1965 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1966 // MATCH_PARENT spec + parent container size can be used to limit
1969 layout.RequestLayout();
1971 SetValue(MaximumSizeProperty, value);
1972 NotifyPropertyChanged();
1977 /// Gets or sets whether a child view inherits it's parent's position.<br />
1978 /// Default is to inherit.<br />
1979 /// 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 />
1981 /// <since_tizen> 3 </since_tizen>
1982 public bool InheritPosition
1986 return (bool)GetValue(InheritPositionProperty);
1990 SetValue(InheritPositionProperty, value);
1991 NotifyPropertyChanged();
1996 /// Gets or sets the clipping behavior (mode) of it's children.
1998 /// <since_tizen> 3 </since_tizen>
1999 public ClippingModeType ClippingMode
2003 return (ClippingModeType)GetValue(ClippingModeProperty);
2007 SetValue(ClippingModeProperty, value);
2008 NotifyPropertyChanged();
2013 /// Gets the number of renderers held by the view.
2015 /// <since_tizen> 3 </since_tizen>
2016 public uint RendererCount
2020 return GetRendererCount();
2025 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2028 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2030 /// <since_tizen> 3 </since_tizen>
2031 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2033 "View view = new View(); " +
2034 "view.PivotPoint = PivotPoint.Center; " +
2035 "view.PositionUsesPivotPoint = true;")]
2036 [EditorBrowsable(EditorBrowsableState.Never)]
2037 public Position AnchorPoint
2041 Position temp = new Position(0.0f, 0.0f, 0.0f);
2042 var pValue = GetProperty(View.Property.AnchorPoint);
2045 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2051 var temp = new Tizen.NUI.PropertyValue(value);
2052 SetProperty(View.Property.AnchorPoint, temp);
2054 NotifyPropertyChanged();
2059 /// Sets the size of a view for the width, the height and the depth.<br />
2060 /// Geometry can be scaled to fit within this area.<br />
2061 /// This does not interfere with the view's scale factor.<br />
2062 /// The views default depth is the minimum of width and height.<br />
2066 /// Animatable - This property can be animated using <c>Animation</c> class.
2068 /// animation.AnimateTo(view, "Size", new Size(100, 100));
2071 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2073 /// <since_tizen> 5 </since_tizen>
2078 Size tmp = (Size)GetValue(SizeProperty);
2079 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2083 SetValue(SizeProperty, value);
2084 NotifyPropertyChanged();
2089 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2091 /// <since_tizen> 3 </since_tizen>
2092 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2094 "Container parent = view.GetParent(); " +
2095 "View view = parent as View;")]
2096 [EditorBrowsable(EditorBrowsableState.Never)]
2097 public new View Parent
2102 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2103 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2104 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2106 if (basehandle is Layer layer)
2108 ret = new View(Layer.getCPtr(layer).Handle, false);
2109 NUILog.Error("This Parent property is deprecated, should do not be used");
2113 ret = basehandle as View;
2116 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2117 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2125 /// Gets/Sets whether inherit parent's the layout Direction.
2127 /// <since_tizen> 4 </since_tizen>
2128 public bool InheritLayoutDirection
2132 return (bool)GetValue(InheritLayoutDirectionProperty);
2136 SetValue(InheritLayoutDirectionProperty, value);
2137 NotifyPropertyChanged();
2142 /// Gets/Sets the layout Direction.
2144 /// <since_tizen> 4 </since_tizen>
2145 public ViewLayoutDirectionType LayoutDirection
2149 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2153 SetValue(LayoutDirectionProperty, value);
2154 NotifyPropertyChanged();
2155 layout?.RequestLayout();
2160 /// Gets or sets the Margin for use in layout.
2163 /// Margin property is supported by Layout algorithms and containers.
2164 /// Please Set Layout if you want to use Margin property.
2165 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2167 /// <since_tizen> 4 </since_tizen>
2168 public Extents Margin
2172 // If View has a Layout then margin is stored in Layout.
2175 return Layout.Margin;
2179 // If Layout not set then return margin stored in View.
2180 Extents temp = (Extents)GetValue(MarginProperty);
2181 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2183 // Two return points to prevent creating a zeroed Extent native object before assignment
2189 // Layout set so store Margin in LayoutItem instead of View.
2190 // If View stores the Margin too then the Legacy Size Negotiation will
2191 // overwrite the position and size values measured in the Layouting.
2192 Layout.Margin = value;
2193 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2194 layout?.RequestLayout();
2198 SetValue(MarginProperty, value);
2200 NotifyPropertyChanged();
2201 layout?.RequestLayout();
2206 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2210 /// // matchParentView matches its size to its parent size.
2211 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2212 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2214 /// // wrapContentView wraps its children with their desired size.
2215 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2216 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2218 /// // exactSizeView shows itself with an exact size.
2219 /// exactSizeView.WidthSpecification = 100;
2220 /// exactSizeView.HeightSpecification = 100;
2223 /// <since_tizen> 6 </since_tizen>
2224 public int WidthSpecification
2232 if (value == widthPolicy)
2235 widthPolicy = value;
2236 if (widthPolicy >= 0)
2238 if (heightPolicy >= 0) // Policy an exact value
2240 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2241 Size2D = new Size2D(widthPolicy, heightPolicy);
2244 layout?.RequestLayout();
2249 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2253 /// // matchParentView matches its size to its parent size.
2254 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2255 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2257 /// // wrapContentView wraps its children with their desired size.
2258 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2259 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2261 /// // exactSizeView shows itself with an exact size.
2262 /// exactSizeView.WidthSpecification = 100;
2263 /// exactSizeView.HeightSpecification = 100;
2266 /// <since_tizen> 6 </since_tizen>
2267 public int HeightSpecification
2271 return heightPolicy;
2275 if (value == heightPolicy)
2278 heightPolicy = value;
2279 if (heightPolicy >= 0)
2281 if (widthPolicy >= 0) // Policy an exact value
2283 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2284 Size2D = new Size2D(widthPolicy, heightPolicy);
2287 layout?.RequestLayout();
2292 /// Gets the List of transitions for this View.
2294 /// <since_tizen> 6 </since_tizen>
2295 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2299 if (layoutTransitions == null)
2301 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2303 return layoutTransitions;
2308 /// Sets a layout transitions for this View.
2310 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2312 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2314 /// <since_tizen> 6 </since_tizen>
2315 public LayoutTransition LayoutTransition
2319 return layoutTransition;
2325 throw new global::System.ArgumentNullException(nameof(value));
2327 if (layoutTransitions == null)
2329 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2332 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2334 AttachTransitionsToChildren(value);
2336 layoutTransition = value;
2341 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2344 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2346 /// <since_tizen> 4 </since_tizen>
2347 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2348 [EditorBrowsable(EditorBrowsableState.Never)]
2349 public Extents PaddingEX
2353 Extents temp = new Extents(0, 0, 0, 0);
2354 var pValue = GetProperty(View.Property.PADDING);
2357 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2363 var temp = new Tizen.NUI.PropertyValue(value);
2364 SetProperty(View.Property.PADDING, temp);
2366 NotifyPropertyChanged();
2367 layout?.RequestLayout();
2372 /// The Color of View. This is an RGBA value.
2376 /// Animatable - This property can be animated using <c>Animation</c> class.
2378 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2380 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2381 [EditorBrowsable(EditorBrowsableState.Never)]
2386 Color temp = (Color)GetValue(ColorProperty);
2387 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2391 SetValue(ColorProperty, value);
2392 NotifyPropertyChanged();
2397 /// Set the layout on this View. Replaces any existing Layout.
2400 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2402 /// <since_tizen> 6 </since_tizen>
2403 public LayoutItem Layout
2411 // Do nothing if layout provided is already set on this View.
2412 if (value == layout)
2417 LayoutingDisabled = false;
2420 // If new layout being set already has a owner then that owner receives a replacement default layout.
2421 // First check if the layout to be set already has a owner.
2422 if (value?.Owner != null)
2424 // Previous owner of the layout gets a default layout as a replacement.
2425 value.Owner.Layout = new AbsoluteLayout();
2427 // Copy Margin and Padding to replacement LayoutGroup.
2428 if (value.Owner.Layout != null)
2430 value.Owner.Layout.Margin = value.Margin;
2431 value.Owner.Layout.Padding = value.Padding;
2435 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2436 // View if no replacement. Previously margin and padding values would have been moved from
2437 // the View to the layout.
2438 if (layout != null) // Existing layout
2442 // Existing layout being replaced so copy over margin and padding values.
2443 value.Margin = layout.Margin;
2444 value.Padding = layout.Padding;
2448 // Layout not being replaced so restore margin and padding to View.
2449 SetValue(MarginProperty, layout.Margin);
2450 SetValue(PaddingProperty, layout.Padding);
2451 NotifyPropertyChanged();
2456 // First Layout to be added to the View hence copy
2458 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2461 Extents margin = Margin;
2462 Extents padding = Padding;
2463 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2465 // If View already has a margin set then store it in Layout instead.
2466 value.Margin = margin;
2467 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2468 NotifyPropertyChanged();
2471 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2473 // If View already has a padding set then store it in Layout instead.
2474 value.Padding = padding;
2476 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2477 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2478 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2480 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2481 NotifyPropertyChanged();
2487 // Remove existing layout from it's parent layout group.
2490 value.SetPositionByLayout = !excludeLayouting;
2492 // Set layout to this view
2498 /// The weight of the View, used to share available space in a layout with siblings.
2500 /// <since_tizen> 6 </since_tizen>
2510 layout?.RequestLayout();
2515 /// Whether to load the BackgroundImage synchronously.
2516 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2517 /// Note: For Normal Quad images only.
2519 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2520 [EditorBrowsable(EditorBrowsableState.Never)]
2521 public bool BackgroundImageSynchronosLoading
2525 return backgroundImageSynchronosLoading;
2529 backgroundImageSynchronosLoading = value;
2531 string bgUrl = null;
2532 var pValue = Background.Find(ImageVisualProperty.URL);
2533 pValue?.Get(out bgUrl);
2536 if (!string.IsNullOrEmpty(bgUrl))
2538 PropertyMap bgMap = this.Background;
2539 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2540 bgMap.Add("synchronousLoading", temp);
2547 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2548 [EditorBrowsable(EditorBrowsableState.Never)]
2549 public Vector2 UpdateSizeHint
2553 return (Vector2)GetValue(UpdateSizeHintProperty);
2557 SetValue(UpdateSizeHintProperty, value);
2558 NotifyPropertyChanged();
2563 /// Enable/Disable ControlState propagation for children.
2564 /// It is false by default.
2565 /// If the View needs to share ControlState with descendants, please set it true.
2566 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2568 [EditorBrowsable(EditorBrowsableState.Never)]
2569 public bool EnableControlStatePropagation
2571 get => themeData?.ControlStatePropagation ?? false;
2574 if (EnableControlStatePropagation == value) return;
2576 if (themeData == null) themeData = new ThemeData();
2578 themeData.ControlStatePropagation = value;
2580 foreach (View child in Children)
2582 child.EnableControlStatePropagation = value;
2588 /// By default, it is false in View, true in Control.
2589 /// Note that if the value is true, the View will be a touch receptor.
2591 [EditorBrowsable(EditorBrowsableState.Never)]
2592 public bool EnableControlState
2596 return (bool)GetValue(EnableControlStateProperty);
2600 SetValue(EnableControlStateProperty, value);
2605 /// Whether the actor grab all touches even if touch leaves its boundary.
2607 /// <returns>true, if it grab all touch after start</returns>
2608 [EditorBrowsable(EditorBrowsableState.Never)]
2609 public bool GrabTouchAfterLeave
2614 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2615 pValue.Get(out temp);
2621 var temp = new Tizen.NUI.PropertyValue(value);
2622 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2624 NotifyPropertyChanged();
2629 /// Determines which blend equation will be used to render renderers of this actor.
2631 /// <returns>blend equation enum currently assigned</returns>
2632 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2633 [EditorBrowsable(EditorBrowsableState.Never)]
2634 public BlendEquationType BlendEquation
2639 var pValue = GetProperty(View.Property.BlendEquation);
2640 pValue.Get(out temp);
2642 return (BlendEquationType)temp;
2646 var temp = new Tizen.NUI.PropertyValue((int)value);
2647 SetProperty(View.Property.BlendEquation, temp);
2649 NotifyPropertyChanged();
2654 /// If the value is true, the View will change its style as the theme changes.
2655 /// The default value is false in normal case but it can be true when the NUIApplication is created with <see cref="NUIApplication.ThemeOptions.ThemeChangeSensitive"/>.
2657 /// <since_tizen> 9 </since_tizen>
2658 public bool ThemeChangeSensitive
2660 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2661 set => SetValue(ThemeChangeSensitiveProperty, value);
2665 /// Create Style, it is abstract function and must be override.
2667 [EditorBrowsable(EditorBrowsableState.Never)]
2668 protected virtual ViewStyle CreateViewStyle()
2670 return new ViewStyle();
2674 /// Called after the View's ControlStates changed.
2676 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2677 [EditorBrowsable(EditorBrowsableState.Never)]
2678 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2684 [EditorBrowsable(EditorBrowsableState.Never)]
2685 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2687 if (string.IsNullOrEmpty(styleName)) ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(GetType()));
2688 else ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(styleName));
2692 /// Apply style instance to the view.
2693 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2695 /// <since_tizen> 9 </since_tizen>
2696 public virtual void ApplyStyle(ViewStyle viewStyle)
2698 if (viewStyle == null || themeData?.viewStyle == viewStyle) return;
2700 if (themeData == null) themeData = new ThemeData();
2702 themeData.viewStyle = viewStyle;
2704 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2710 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2712 if (bindablePropertyOfView == null)
2717 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2718 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2720 foreach (var sourceProperty in dirtyStyleProperties)
2722 var sourceValue = viewStyle.GetValue(sourceProperty);
2724 if (sourceValue == null)
2729 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2731 if (destinationProperty != null)
2733 SetValue(destinationProperty, sourceValue);
2739 /// Get whether the View is culled or not.
2740 /// True means that the View is out of the view frustum.
2743 /// Hidden-API (Inhouse-API).
2745 [EditorBrowsable(EditorBrowsableState.Never)]
2751 var pValue = GetProperty(View.Property.Culled);
2752 pValue.Get(out temp);
2759 /// Set or Get TransitionOptions for the page transition.
2760 /// This property is used to define how this view will be transitioned during Page switching.
2762 /// <since_tizen> 9 </since_tizen>
2763 public TransitionOptions TransitionOptions
2767 transitionOptions = value;
2771 return transitionOptions;