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.
475 /// <since_tizen> 9 </since_tizen>
476 public Vector4 CornerRadius
480 return (Vector4)GetValue(CornerRadiusProperty);
484 SetValue(CornerRadiusProperty, value);
485 NotifyPropertyChanged();
490 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
491 /// It is absolute by default.
492 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
494 /// <since_tizen> 9 </since_tizen>
495 public VisualTransformPolicyType CornerRadiusPolicy
497 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
498 set => SetValue(CornerRadiusPolicyProperty, value);
502 /// The width for the borderline of the View.
503 /// This will draw borderline at background.
504 /// Note that, an image background may not have borderline if it uses a Border property.
508 /// Animatable - This property can be animated using <c>Animation</c> class.
511 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
512 [EditorBrowsable(EditorBrowsableState.Never)]
513 public float BorderlineWidth
517 return (float)GetValue(BorderlineWidthProperty);
521 SetValue(BorderlineWidthProperty, value);
522 NotifyPropertyChanged();
527 /// The color for the borderline of the View.
528 /// It is Color.Black by default.
532 /// Animatable - This property can be animated using <c>Animation</c> class.
535 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
536 [EditorBrowsable(EditorBrowsableState.Never)]
537 public Color BorderlineColor
541 return (Color)GetValue(BorderlineColorProperty);
545 SetValue(BorderlineColorProperty, value);
546 NotifyPropertyChanged();
551 /// The Relative offset for the borderline of the View.
552 /// recommand [-1.0f to 1.0f] range.
553 /// If -1.0f, borderline draw inside of View.
554 /// If 1.0f, borderline draw outside of View.
555 /// If 0.0f, borderline draw half at inside and half at outside.
556 /// It is 0.0f by default.
560 /// Animatable - This property can be animated using <c>Animation</c> class.
563 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
564 [EditorBrowsable(EditorBrowsableState.Never)]
565 public float BorderlineOffset
569 return (float)GetValue(BorderlineOffsetProperty);
573 SetValue(BorderlineOffsetProperty, value);
574 NotifyPropertyChanged();
579 /// The current state of the view.
581 /// <since_tizen> 3 </since_tizen>
586 return (States)GetValue(StateProperty);
590 SetValue(StateProperty, value);
591 NotifyPropertyChanged();
596 /// The current sub state of the view.
598 /// <since_tizen> 3 </since_tizen>
599 public States SubState
603 return (States)GetValue(SubStateProperty);
607 SetValue(SubStateProperty, value);
608 NotifyPropertyChanged();
613 /// Displays a tooltip
615 /// <since_tizen> 3 </since_tizen>
616 public Tizen.NUI.PropertyMap Tooltip
620 return (PropertyMap)GetValue(TooltipProperty);
624 SetValue(TooltipProperty, value);
625 NotifyPropertyChanged();
630 /// Displays a tooltip as a text.
632 /// <since_tizen> 3 </since_tizen>
633 public string TooltipText
637 using (var propertyValue = GetProperty(Property.TOOLTIP))
639 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
641 return retrivedValue;
643 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
644 return "error to get TooltipText";
649 var temp = new Tizen.NUI.PropertyValue(value);
650 SetProperty(View.Property.TOOLTIP, temp);
652 NotifyPropertyChanged();
657 /// The Child property of FlexContainer.<br />
658 /// The proportion of the free space in the container, the flex item will receive.<br />
659 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
661 /// <since_tizen> 3 </since_tizen>
662 [Obsolete("Deprecated in API8, will be removed in API10.")]
667 return (float)GetValue(FlexProperty);
671 SetValue(FlexProperty, value);
672 NotifyPropertyChanged();
677 /// The Child property of FlexContainer.<br />
678 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
680 /// <since_tizen> 3 </since_tizen>
681 [Obsolete("Deprecated in API8, will be removed in API10.")]
686 return (int)GetValue(AlignSelfProperty);
690 SetValue(AlignSelfProperty, value);
691 NotifyPropertyChanged();
696 /// The Child property of FlexContainer.<br />
697 /// The space around the flex item.<br />
700 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
702 /// <since_tizen> 3 </since_tizen>
703 [Obsolete("Deprecated in API8, will be removed in API10.")]
704 public Vector4 FlexMargin
708 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
709 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
713 SetValue(FlexMarginProperty, value);
714 NotifyPropertyChanged();
719 /// The top-left cell this child occupies, if not set, the first available cell is used.
722 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
723 /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
725 /// <since_tizen> 3 </since_tizen>
726 public Vector2 CellIndex
730 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
731 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
735 SetValue(CellIndexProperty, value);
736 NotifyPropertyChanged();
741 /// The number of rows this child occupies, if not set, the default value is 1.
744 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
746 /// <since_tizen> 3 </since_tizen>
751 return (float)GetValue(RowSpanProperty);
755 SetValue(RowSpanProperty, value);
756 NotifyPropertyChanged();
761 /// The number of columns this child occupies, if not set, the default value is 1.
764 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
766 /// <since_tizen> 3 </since_tizen>
767 public float ColumnSpan
771 return (float)GetValue(ColumnSpanProperty);
775 SetValue(ColumnSpanProperty, value);
776 NotifyPropertyChanged();
781 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
784 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
786 /// <since_tizen> 3 </since_tizen>
787 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
791 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
795 SetValue(CellHorizontalAlignmentProperty, value);
796 NotifyPropertyChanged();
801 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
804 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
806 /// <since_tizen> 3 </since_tizen>
807 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
811 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
815 SetValue(CellVerticalAlignmentProperty, value);
816 NotifyPropertyChanged();
821 /// The left focusable view.<br />
822 /// This will return null if not set.<br />
823 /// This will also return null if the specified left focusable view is not on a window.<br />
825 /// <since_tizen> 3 </since_tizen>
826 public View LeftFocusableView
828 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
831 return (View)GetValue(LeftFocusableViewProperty);
835 SetValue(LeftFocusableViewProperty, value);
836 NotifyPropertyChanged();
841 /// The right focusable view.<br />
842 /// This will return null if not set.<br />
843 /// This will also return null if the specified right focusable view is not on a window.<br />
845 /// <since_tizen> 3 </since_tizen>
846 public View RightFocusableView
848 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
851 return (View)GetValue(RightFocusableViewProperty);
855 SetValue(RightFocusableViewProperty, value);
856 NotifyPropertyChanged();
861 /// The up focusable view.<br />
862 /// This will return null if not set.<br />
863 /// This will also return null if the specified up focusable view is not on a window.<br />
865 /// <since_tizen> 3 </since_tizen>
866 public View UpFocusableView
868 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
871 return (View)GetValue(UpFocusableViewProperty);
875 SetValue(UpFocusableViewProperty, value);
876 NotifyPropertyChanged();
881 /// The down focusable view.<br />
882 /// This will return null if not set.<br />
883 /// This will also return null if the specified down focusable view is not on a window.<br />
885 /// <since_tizen> 3 </since_tizen>
886 public View DownFocusableView
888 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
891 return (View)GetValue(DownFocusableViewProperty);
895 SetValue(DownFocusableViewProperty, value);
896 NotifyPropertyChanged();
901 /// Whether the view should be focusable by keyboard navigation.
903 /// <since_tizen> 3 </since_tizen>
904 public bool Focusable
908 SetValue(FocusableProperty, value);
909 NotifyPropertyChanged();
913 return (bool)GetValue(FocusableProperty);
918 /// Whether this view can focus by touch.
919 /// If Focusable is false, FocusableInTouch is disabled.
920 /// If you want to have focus on touch, you need to set both Focusable and FocusableInTouch settings to true.
922 [EditorBrowsable(EditorBrowsableState.Never)]
923 public bool FocusableInTouch
927 SetValue(FocusableInTouchProperty, value);
928 NotifyPropertyChanged();
932 return (bool)GetValue(FocusableInTouchProperty);
937 /// Retrieves the position of the view.<br />
938 /// The coordinates are relative to the view's parent.<br />
940 /// <since_tizen> 3 </since_tizen>
941 public Position CurrentPosition
945 return GetCurrentPosition();
950 /// Sets the size of a view for the width and the height.<br />
951 /// Geometry can be scaled to fit within this area.<br />
952 /// This does not interfere with the view's scale factor.<br />
953 /// The views default depth is the minimum of width and height.<br />
956 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
957 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
959 /// <since_tizen> 3 </since_tizen>
964 Size2D temp = (Size2D)GetValue(Size2DProperty);
965 int width = temp.Width;
966 int height = temp.Height;
968 if (this.Layout == null)
970 if (width < 0) { width = 0; }
971 if (height < 0) { height = 0; }
974 return new Size2D(OnSize2DChanged, width, height);
978 SetValue(Size2DProperty, value);
980 NotifyPropertyChanged();
985 /// Retrieves the size of the view.<br />
986 /// The coordinates are relative to the view's parent.<br />
988 /// <since_tizen> 3 </since_tizen>
989 public Size2D CurrentSize
993 return GetCurrentSize();
998 /// Retrieves and sets the view's opacity.<br />
1000 /// <since_tizen> 3 </since_tizen>
1001 public float Opacity
1005 return (float)GetValue(OpacityProperty);
1009 SetValue(OpacityProperty, value);
1010 NotifyPropertyChanged();
1015 /// Sets the position of the view for X and Y.<br />
1016 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1017 /// If the position inheritance is disabled, sets the world position.<br />
1020 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1021 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1023 /// <since_tizen> 3 </since_tizen>
1024 public Position2D Position2D
1028 Position2D temp = (Position2D)GetValue(Position2DProperty);
1029 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1033 SetValue(Position2DProperty, value);
1034 NotifyPropertyChanged();
1039 /// Retrieves the screen position of the view.<br />
1041 /// <since_tizen> 3 </since_tizen>
1042 public Vector2 ScreenPosition
1046 Vector2 temp = new Vector2(0.0f, 0.0f);
1047 var pValue = GetProperty(View.Property.ScreenPosition);
1055 /// Determines whether the pivot point should be used to determine the position of the view.
1056 /// This is false by default.
1058 /// <remarks>If false, then the top-left of the view is used for the position.
1059 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1061 /// <since_tizen> 3 </since_tizen>
1062 public bool PositionUsesPivotPoint
1066 return (bool)GetValue(PositionUsesPivotPointProperty);
1070 SetValue(PositionUsesPivotPointProperty, value);
1071 NotifyPropertyChanged();
1076 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1078 /// <since_tizen> 3 </since_tizen>
1079 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1081 "View view = new View(); " +
1082 "view.PivotPoint = PivotPoint.Center; " +
1083 "view.PositionUsesPivotPoint = true;" +
1084 " Deprecated in API5: Will be removed in API8")]
1085 [EditorBrowsable(EditorBrowsableState.Never)]
1086 public bool PositionUsesAnchorPoint
1091 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1092 pValue.Get(out temp);
1098 var temp = new Tizen.NUI.PropertyValue(value);
1099 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1101 NotifyPropertyChanged();
1106 /// Queries whether the view is connected to the stage.<br />
1107 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1109 /// <since_tizen> 3 </since_tizen>
1110 public bool IsOnWindow
1119 /// Gets the depth in the hierarchy for the view.
1121 /// <since_tizen> 3 </since_tizen>
1122 public int HierarchyDepth
1126 return GetHierarchyDepth();
1131 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1134 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1135 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1136 /// The values set by this property will likely change.
1138 /// <since_tizen> 3 </since_tizen>
1139 public int SiblingOrder
1143 return (int)GetValue(SiblingOrderProperty);
1147 SetValue(SiblingOrderProperty, value);
1149 LayoutGroup layout = Layout as LayoutGroup;
1150 layout?.ChangeLayoutSiblingOrder(value);
1152 NotifyPropertyChanged();
1157 /// Returns the natural size of the view.
1160 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1162 /// <since_tizen> 5 </since_tizen>
1163 public Vector3 NaturalSize
1167 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1168 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1174 /// Returns the natural size (Size2D) of the view.
1177 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1179 /// <since_tizen> 4 </since_tizen>
1180 public Size2D NaturalSize2D
1184 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1185 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1187 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1194 /// Gets or sets the origin of a view within its parent's area.<br />
1195 /// 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 />
1196 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1197 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1199 /// <pre>The view has been initialized.</pre>
1200 /// <since_tizen> 3 </since_tizen>
1201 public Position ParentOrigin
1205 Position tmp = (Position)GetValue(ParentOriginProperty);
1206 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1210 SetValue(ParentOriginProperty, value);
1211 NotifyPropertyChanged();
1216 /// Gets or sets the anchor-point of a view.<br />
1217 /// 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 />
1218 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1219 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1220 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1221 /// <pre>The view has been initialized.</pre>
1224 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1226 /// <since_tizen> 3 </since_tizen>
1227 public Position PivotPoint
1231 Position tmp = (Position)GetValue(PivotPointProperty);
1232 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1236 SetValue(PivotPointProperty, value);
1237 NotifyPropertyChanged();
1242 /// Gets or sets the size width of the view.
1246 /// Animatable - This property can be animated using <c>Animation</c> class.
1249 /// <since_tizen> 3 </since_tizen>
1250 public float SizeWidth
1254 return (float)GetValue(SizeWidthProperty);
1258 SetValue(SizeWidthProperty, value);
1259 NotifyPropertyChanged();
1264 /// Gets or sets the size height of the view.
1268 /// Animatable - This property can be animated using <c>Animation</c> class.
1271 /// <since_tizen> 3 </since_tizen>
1272 public float SizeHeight
1276 return (float)GetValue(SizeHeightProperty);
1280 SetValue(SizeHeightProperty, value);
1281 NotifyPropertyChanged();
1286 /// Gets or sets the position of the view.<br />
1287 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1288 /// If the position inheritance is disabled, sets the world position.<br />
1292 /// Animatable - This property can be animated using <c>Animation</c> class.
1294 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1296 /// <since_tizen> 3 </since_tizen>
1297 public Position Position
1301 Position tmp = (Position)GetValue(PositionProperty);
1302 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1306 SetValue(PositionProperty, value);
1307 NotifyPropertyChanged();
1312 /// Gets or sets the position X of the view.
1316 /// Animatable - This property can be animated using <c>Animation</c> class.
1319 /// <since_tizen> 3 </since_tizen>
1320 public float PositionX
1324 return (float)GetValue(PositionXProperty);
1328 SetValue(PositionXProperty, value);
1329 NotifyPropertyChanged();
1334 /// Gets or sets the position Y of the view.
1338 /// Animatable - This property can be animated using <c>Animation</c> class.
1341 /// <since_tizen> 3 </since_tizen>
1342 public float PositionY
1346 return (float)GetValue(PositionYProperty);
1350 SetValue(PositionYProperty, value);
1351 NotifyPropertyChanged();
1356 /// Gets or sets the position Z of the view.
1360 /// Animatable - This property can be animated using <c>Animation</c> class.
1363 /// <since_tizen> 3 </since_tizen>
1364 public float PositionZ
1368 return (float)GetValue(PositionZProperty);
1372 SetValue(PositionZProperty, value);
1373 NotifyPropertyChanged();
1378 /// Gets or sets the world position of the view.
1380 /// <since_tizen> 3 </since_tizen>
1381 public Vector3 WorldPosition
1385 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1386 var pValue = GetProperty(View.Property.WorldPosition);
1394 /// Gets or sets the orientation of the view.<br />
1395 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1399 /// This is an asynchronous method.
1402 /// Animatable - This property can be animated using <c>Animation</c> class.
1405 /// <since_tizen> 3 </since_tizen>
1406 public Rotation Orientation
1410 return (Rotation)GetValue(OrientationProperty);
1414 SetValue(OrientationProperty, value);
1415 NotifyPropertyChanged();
1420 /// Gets or sets the world orientation of the view.<br />
1422 /// <since_tizen> 3 </since_tizen>
1423 public Rotation WorldOrientation
1427 Rotation temp = new Rotation();
1428 var pValue = GetProperty(View.Property.WorldOrientation);
1436 /// Gets or sets the scale factor applied to the view.<br />
1440 /// Animatable - This property can be animated using <c>Animation</c> class.
1442 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1444 /// <since_tizen> 3 </since_tizen>
1445 public Vector3 Scale
1449 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1450 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1454 SetValue(ScaleProperty, value);
1455 NotifyPropertyChanged();
1460 /// Gets or sets the scale X factor applied to the view.
1464 /// Animatable - This property can be animated using <c>Animation</c> class.
1467 /// <since_tizen> 3 </since_tizen>
1472 return (float)GetValue(ScaleXProperty);
1476 SetValue(ScaleXProperty, value);
1477 NotifyPropertyChanged();
1482 /// Gets or sets the scale Y factor applied to the view.
1486 /// Animatable - This property can be animated using <c>Animation</c> class.
1489 /// <since_tizen> 3 </since_tizen>
1494 return (float)GetValue(ScaleYProperty);
1498 SetValue(ScaleYProperty, value);
1499 NotifyPropertyChanged();
1504 /// Gets or sets the scale Z factor applied to the view.
1508 /// Animatable - This property can be animated using <c>Animation</c> class.
1511 /// <since_tizen> 3 </since_tizen>
1516 return (float)GetValue(ScaleZProperty);
1520 SetValue(ScaleZProperty, value);
1521 NotifyPropertyChanged();
1526 /// Gets the world scale of the view.
1528 /// <since_tizen> 3 </since_tizen>
1529 public Vector3 WorldScale
1533 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1534 var pValue = GetProperty(View.Property.WorldScale);
1542 /// Retrieves the visibility flag of the view.
1546 /// If the view is not visible, then the view and its children will not be rendered.
1547 /// 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.
1550 /// Animatable - This property can be animated using <c>Animation</c> class.
1553 /// <since_tizen> 3 </since_tizen>
1554 public bool Visibility
1559 var pValue = GetProperty(View.Property.VISIBLE);
1560 pValue.Get(out temp);
1567 /// Gets the view's world color.
1569 /// <since_tizen> 3 </since_tizen>
1570 public Vector4 WorldColor
1574 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1575 var pValue = GetProperty(View.Property.WorldColor);
1583 /// Gets or sets the view's name.
1585 /// <since_tizen> 3 </since_tizen>
1590 return (string)GetValue(NameProperty);
1594 SetValue(NameProperty, value);
1595 NotifyPropertyChanged();
1600 /// Get the number of children held by the view.
1602 /// <since_tizen> 3 </since_tizen>
1603 public new uint ChildCount
1607 return Convert.ToUInt32(Children.Count);
1612 /// Gets the view's ID.
1615 /// <since_tizen> 3 </since_tizen>
1625 /// Gets or sets the status of whether the view should emit touch or hover signals.
1627 /// <since_tizen> 3 </since_tizen>
1628 public bool Sensitive
1632 return (bool)GetValue(SensitiveProperty);
1636 SetValue(SensitiveProperty, value);
1637 NotifyPropertyChanged();
1642 /// 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.
1644 /// <since_tizen> 3 </since_tizen>
1645 public bool LeaveRequired
1649 return (bool)GetValue(LeaveRequiredProperty);
1653 SetValue(LeaveRequiredProperty, value);
1654 NotifyPropertyChanged();
1659 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1661 /// <since_tizen> 3 </since_tizen>
1662 public bool InheritOrientation
1666 return (bool)GetValue(InheritOrientationProperty);
1670 SetValue(InheritOrientationProperty, value);
1671 NotifyPropertyChanged();
1676 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1678 /// <since_tizen> 3 </since_tizen>
1679 public bool InheritScale
1683 return (bool)GetValue(InheritScaleProperty);
1687 SetValue(InheritScaleProperty, value);
1688 NotifyPropertyChanged();
1693 /// Gets or sets the status of how the view and its children should be drawn.<br />
1694 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1695 /// 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 />
1696 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1697 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1698 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1700 /// <since_tizen> 3 </since_tizen>
1701 public DrawModeType DrawMode
1705 return (DrawModeType)GetValue(DrawModeProperty);
1709 SetValue(DrawModeProperty, value);
1710 NotifyPropertyChanged();
1715 /// Gets or sets the relative to parent size factor of the view.<br />
1716 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1717 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1720 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1722 /// <since_tizen> 3 </since_tizen>
1723 public Vector3 SizeModeFactor
1727 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1728 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1732 SetValue(SizeModeFactorProperty, value);
1733 NotifyPropertyChanged();
1738 /// Gets or sets the width resize policy to be used.
1740 /// <since_tizen> 3 </since_tizen>
1741 public ResizePolicyType WidthResizePolicy
1745 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1749 SetValue(WidthResizePolicyProperty, value);
1750 NotifyPropertyChanged();
1755 /// Gets or sets the height resize policy to be used.
1757 /// <since_tizen> 3 </since_tizen>
1758 public ResizePolicyType HeightResizePolicy
1762 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1766 SetValue(HeightResizePolicyProperty, value);
1767 NotifyPropertyChanged();
1772 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1773 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1775 /// <since_tizen> 3 </since_tizen>
1776 public SizeScalePolicyType SizeScalePolicy
1780 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1784 SetValue(SizeScalePolicyProperty, value);
1785 NotifyPropertyChanged();
1790 /// Gets or sets the status of whether the width size is dependent on the height size.
1792 /// <since_tizen> 3 </since_tizen>
1793 public bool WidthForHeight
1797 return (bool)GetValue(WidthForHeightProperty);
1801 SetValue(WidthForHeightProperty, value);
1802 NotifyPropertyChanged();
1807 /// Gets or sets the status of whether the height size is dependent on the width size.
1809 /// <since_tizen> 3 </since_tizen>
1810 public bool HeightForWidth
1814 return (bool)GetValue(HeightForWidthProperty);
1818 SetValue(HeightForWidthProperty, value);
1819 NotifyPropertyChanged();
1824 /// Gets or sets the padding for use in layout.
1827 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1829 /// <since_tizen> 5 </since_tizen>
1830 public Extents Padding
1834 // If View has a Layout then padding in stored in the base Layout class
1837 return Layout.Padding;
1841 Extents temp = (Extents)GetValue(PaddingProperty);
1842 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1844 // Two return points to prevent creating a zeroed Extent native object before assignment
1848 Extents padding = value;
1851 // Layout set so store Padding in LayoutItem instead of in View.
1852 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1853 // the position and sizes measure in the Layouting.
1854 Layout.Padding = value;
1855 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1856 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1857 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1859 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1863 SetValue(PaddingProperty, padding);
1864 NotifyPropertyChanged();
1869 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1871 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1873 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1875 /// <since_tizen> 3 </since_tizen>
1876 public Size2D MinimumSize
1880 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1881 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1887 throw new ArgumentNullException(nameof(value));
1891 // Note: it only works if minimum size is >= than natural size.
1892 // To force the size it should be done through the width&height spec or Size2D.
1893 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1894 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1895 layout.RequestLayout();
1897 SetValue(MinimumSizeProperty, value);
1898 NotifyPropertyChanged();
1903 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1906 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1908 /// <since_tizen> 3 </since_tizen>
1909 public Size2D MaximumSize
1913 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1914 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1918 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1919 // MATCH_PARENT spec + parent container size can be used to limit
1922 layout.RequestLayout();
1924 SetValue(MaximumSizeProperty, value);
1925 NotifyPropertyChanged();
1930 /// Gets or sets whether a child view inherits it's parent's position.<br />
1931 /// Default is to inherit.<br />
1932 /// Switching this off means that using position sets the view's world position, i.e., translates from the world origin (0,0,0) to the pivot point of the view.<br />
1934 /// <since_tizen> 3 </since_tizen>
1935 public bool InheritPosition
1939 return (bool)GetValue(InheritPositionProperty);
1943 SetValue(InheritPositionProperty, value);
1944 NotifyPropertyChanged();
1949 /// Gets or sets the clipping behavior (mode) of it's children.
1951 /// <since_tizen> 3 </since_tizen>
1952 public ClippingModeType ClippingMode
1956 return (ClippingModeType)GetValue(ClippingModeProperty);
1960 SetValue(ClippingModeProperty, value);
1961 NotifyPropertyChanged();
1966 /// Gets the number of renderers held by the view.
1968 /// <since_tizen> 3 </since_tizen>
1969 public uint RendererCount
1973 return GetRendererCount();
1978 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1981 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1983 /// <since_tizen> 3 </since_tizen>
1984 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1986 "View view = new View(); " +
1987 "view.PivotPoint = PivotPoint.Center; " +
1988 "view.PositionUsesPivotPoint = true;")]
1989 [EditorBrowsable(EditorBrowsableState.Never)]
1990 public Position AnchorPoint
1994 Position temp = new Position(0.0f, 0.0f, 0.0f);
1995 var pValue = GetProperty(View.Property.AnchorPoint);
1998 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2004 var temp = new Tizen.NUI.PropertyValue(value);
2005 SetProperty(View.Property.AnchorPoint, temp);
2007 NotifyPropertyChanged();
2012 /// Sets the size of a view for the width, the height and the depth.<br />
2013 /// Geometry can be scaled to fit within this area.<br />
2014 /// This does not interfere with the view's scale factor.<br />
2015 /// The views default depth is the minimum of width and height.<br />
2019 /// Animatable - This property can be animated using <c>Animation</c> class.
2021 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2023 /// <since_tizen> 5 </since_tizen>
2028 Size tmp = (Size)GetValue(SizeProperty);
2029 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2033 SetValue(SizeProperty, value);
2034 NotifyPropertyChanged();
2039 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2041 /// <since_tizen> 3 </since_tizen>
2042 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2044 "Container parent = view.GetParent(); " +
2045 "View view = parent as View;")]
2046 [EditorBrowsable(EditorBrowsableState.Never)]
2047 public new View Parent
2052 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2053 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2054 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2056 if (basehandle is Layer layer)
2058 ret = new View(Layer.getCPtr(layer).Handle, false);
2059 NUILog.Error("This Parent property is deprecated, should do not be used");
2063 ret = basehandle as View;
2066 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2067 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2069 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2075 /// Gets/Sets whether inherit parent's the layout Direction.
2077 /// <since_tizen> 4 </since_tizen>
2078 public bool InheritLayoutDirection
2082 return (bool)GetValue(InheritLayoutDirectionProperty);
2086 SetValue(InheritLayoutDirectionProperty, value);
2087 NotifyPropertyChanged();
2092 /// Gets/Sets the layout Direction.
2094 /// <since_tizen> 4 </since_tizen>
2095 public ViewLayoutDirectionType LayoutDirection
2099 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2103 SetValue(LayoutDirectionProperty, value);
2104 NotifyPropertyChanged();
2105 layout?.RequestLayout();
2110 /// Gets or sets the Margin for use in layout.
2113 /// Margin property is supported by Layout algorithms and containers.
2114 /// Please Set Layout if you want to use Margin property.
2115 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2117 /// <since_tizen> 4 </since_tizen>
2118 public Extents Margin
2122 // If View has a Layout then margin is stored in Layout.
2125 return Layout.Margin;
2129 // If Layout not set then return margin stored in View.
2130 Extents temp = (Extents)GetValue(MarginProperty);
2131 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2133 // Two return points to prevent creating a zeroed Extent native object before assignment
2139 // Layout set so store Margin in LayoutItem instead of View.
2140 // If View stores the Margin too then the Legacy Size Negotiation will
2141 // overwrite the position and size values measured in the Layouting.
2142 Layout.Margin = value;
2143 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2144 layout?.RequestLayout();
2148 SetValue(MarginProperty, value);
2150 NotifyPropertyChanged();
2151 layout?.RequestLayout();
2156 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2160 /// // matchParentView matches its size to its parent size.
2161 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2162 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2164 /// // wrapContentView wraps its children with their desired size.
2165 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2166 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2168 /// // exactSizeView shows itself with an exact size.
2169 /// exactSizeView.WidthSpecification = 100;
2170 /// exactSizeView.HeightSpecification = 100;
2173 /// <since_tizen> 6 </since_tizen>
2174 public int WidthSpecification
2182 if (value == widthPolicy)
2185 widthPolicy = value;
2186 if (widthPolicy >= 0)
2188 if (heightPolicy >= 0) // Policy an exact value
2190 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2191 Size2D = new Size2D(widthPolicy, heightPolicy);
2194 layout?.RequestLayout();
2199 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2203 /// // matchParentView matches its size to its parent size.
2204 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2205 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2207 /// // wrapContentView wraps its children with their desired size.
2208 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2209 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2211 /// // exactSizeView shows itself with an exact size.
2212 /// exactSizeView.WidthSpecification = 100;
2213 /// exactSizeView.HeightSpecification = 100;
2216 /// <since_tizen> 6 </since_tizen>
2217 public int HeightSpecification
2221 return heightPolicy;
2225 if (value == heightPolicy)
2228 heightPolicy = value;
2229 if (heightPolicy >= 0)
2231 if (widthPolicy >= 0) // Policy an exact value
2233 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2234 Size2D = new Size2D(widthPolicy, heightPolicy);
2237 layout?.RequestLayout();
2242 /// Gets the List of transitions for this View.
2244 /// <since_tizen> 6 </since_tizen>
2245 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2249 if (layoutTransitions == null)
2251 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2253 return layoutTransitions;
2258 /// Sets a layout transitions for this View.
2260 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2262 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2264 /// <since_tizen> 6 </since_tizen>
2265 public LayoutTransition LayoutTransition
2269 return layoutTransition;
2275 throw new global::System.ArgumentNullException(nameof(value));
2277 if (layoutTransitions == null)
2279 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2282 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2284 AttachTransitionsToChildren(value);
2286 layoutTransition = value;
2291 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2294 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2296 /// <since_tizen> 4 </since_tizen>
2297 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2298 [EditorBrowsable(EditorBrowsableState.Never)]
2299 public Extents PaddingEX
2303 Extents temp = new Extents(0, 0, 0, 0);
2304 var pValue = GetProperty(View.Property.PADDING);
2307 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2313 var temp = new Tizen.NUI.PropertyValue(value);
2314 SetProperty(View.Property.PADDING, temp);
2316 NotifyPropertyChanged();
2317 layout?.RequestLayout();
2322 /// The Color of View. This is an RGBA value.
2326 /// Animatable - This property can be animated using <c>Animation</c> class.
2328 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2330 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2331 [EditorBrowsable(EditorBrowsableState.Never)]
2336 Color temp = (Color)GetValue(ColorProperty);
2337 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2341 SetValue(ColorProperty, value);
2342 NotifyPropertyChanged();
2347 /// Set the layout on this View. Replaces any existing Layout.
2350 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2352 /// <since_tizen> 6 </since_tizen>
2353 public LayoutItem Layout
2361 // Do nothing if layout provided is already set on this View.
2362 if (value == layout)
2367 LayoutingDisabled = false;
2370 // If new layout being set already has a owner then that owner receives a replacement default layout.
2371 // First check if the layout to be set already has a owner.
2372 if (value?.Owner != null)
2374 // Previous owner of the layout gets a default layout as a replacement.
2375 value.Owner.Layout = new AbsoluteLayout();
2377 // Copy Margin and Padding to replacement LayoutGroup.
2378 if (value.Owner.Layout != null)
2380 value.Owner.Layout.Margin = value.Margin;
2381 value.Owner.Layout.Padding = value.Padding;
2385 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2386 // View if no replacement. Previously margin and padding values would have been moved from
2387 // the View to the layout.
2388 if (layout != null) // Existing layout
2392 // Existing layout being replaced so copy over margin and padding values.
2393 value.Margin = layout.Margin;
2394 value.Padding = layout.Padding;
2398 // Layout not being replaced so restore margin and padding to View.
2399 SetValue(MarginProperty, layout.Margin);
2400 SetValue(PaddingProperty, layout.Padding);
2401 NotifyPropertyChanged();
2406 // First Layout to be added to the View hence copy
2408 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2411 Extents margin = Margin;
2412 Extents padding = Padding;
2413 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2415 // If View already has a margin set then store it in Layout instead.
2416 value.Margin = margin;
2417 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2418 NotifyPropertyChanged();
2421 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2423 // If View already has a padding set then store it in Layout instead.
2424 value.Padding = padding;
2426 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2427 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2428 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2430 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2431 NotifyPropertyChanged();
2437 // Remove existing layout from it's parent layout group.
2440 value.SetPositionByLayout = !excludeLayouting;
2442 // Set layout to this view
2448 /// The weight of the View, used to share available space in a layout with siblings.
2450 /// <since_tizen> 6 </since_tizen>
2460 layout?.RequestLayout();
2465 /// Whether to load the BackgroundImage synchronously.
2466 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2467 /// Note: For Normal Quad images only.
2469 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2470 [EditorBrowsable(EditorBrowsableState.Never)]
2471 public bool BackgroundImageSynchronosLoading
2475 return backgroundImageSynchronosLoading;
2479 backgroundImageSynchronosLoading = value;
2481 string bgUrl = null;
2482 var pValue = Background.Find(ImageVisualProperty.URL);
2483 pValue?.Get(out bgUrl);
2486 if (!string.IsNullOrEmpty(bgUrl))
2488 PropertyMap bgMap = this.Background;
2489 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2490 bgMap.Add("synchronousLoading", temp);
2497 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2498 [EditorBrowsable(EditorBrowsableState.Never)]
2499 public Vector2 UpdateSizeHint
2503 return (Vector2)GetValue(UpdateSizeHintProperty);
2507 SetValue(UpdateSizeHintProperty, value);
2508 NotifyPropertyChanged();
2513 /// Enable/Disable ControlState propagation for children.
2514 /// It is false by default.
2515 /// If the View needs to share ControlState with descendants, please set it true.
2516 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2518 [EditorBrowsable(EditorBrowsableState.Never)]
2519 public bool EnableControlStatePropagation
2521 get => themeData?.ControlStatePropagation ?? false;
2524 if (EnableControlStatePropagation == value) return;
2526 if (themeData == null) themeData = new ThemeData();
2528 themeData.ControlStatePropagation = value;
2530 foreach (View child in Children)
2532 child.EnableControlStatePropagation = value;
2538 /// By default, it is false in View, true in Control.
2539 /// Note that if the value is true, the View will be a touch receptor.
2541 [EditorBrowsable(EditorBrowsableState.Never)]
2542 public bool EnableControlState
2546 return (bool)GetValue(EnableControlStateProperty);
2550 SetValue(EnableControlStateProperty, value);
2555 /// Whether the actor grab all touches even if touch leaves its boundary.
2557 /// <returns>true, if it grab all touch after start</returns>
2558 [EditorBrowsable(EditorBrowsableState.Never)]
2559 public bool GrabTouchAfterLeave
2564 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2565 pValue.Get(out temp);
2571 var temp = new Tizen.NUI.PropertyValue(value);
2572 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2574 NotifyPropertyChanged();
2579 /// Determines which blend equation will be used to render renderers of this actor.
2581 /// <returns>blend equation enum currently assigned</returns>
2582 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2583 [EditorBrowsable(EditorBrowsableState.Never)]
2584 public BlendEquationType BlendEquation
2589 var pValue = GetProperty(View.Property.BlendEquation);
2590 pValue.Get(out temp);
2592 return (BlendEquationType)temp;
2596 var temp = new Tizen.NUI.PropertyValue((int)value);
2597 SetProperty(View.Property.BlendEquation, temp);
2599 NotifyPropertyChanged();
2604 /// If the value is true, the View will change its style as the theme changes.
2605 /// The default value is false in normal case but it can be true when the NUIApplication is created with <see cref="NUIApplication.ThemeOptions.ThemeChangeSensitive"/>.
2607 /// <since_tizen> 9 </since_tizen>
2608 public bool ThemeChangeSensitive
2610 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2611 set => SetValue(ThemeChangeSensitiveProperty, value);
2615 /// Create Style, it is abstract function and must be override.
2617 [EditorBrowsable(EditorBrowsableState.Never)]
2618 protected virtual ViewStyle CreateViewStyle()
2620 return new ViewStyle();
2624 /// Called after the View's ControlStates changed.
2626 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2627 [EditorBrowsable(EditorBrowsableState.Never)]
2628 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2634 [EditorBrowsable(EditorBrowsableState.Never)]
2635 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2637 if (string.IsNullOrEmpty(styleName)) ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(GetType()));
2638 else ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(styleName));
2642 /// Apply style instance to the view.
2643 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2645 /// <since_tizen> 9 </since_tizen>
2646 public virtual void ApplyStyle(ViewStyle viewStyle)
2648 if (viewStyle == null || themeData?.viewStyle == viewStyle) return;
2650 if (themeData == null) themeData = new ThemeData();
2652 themeData.viewStyle = viewStyle;
2654 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2660 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2662 if (bindablePropertyOfView == null)
2667 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2668 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2670 foreach (var sourceProperty in dirtyStyleProperties)
2672 var sourceValue = viewStyle.GetValue(sourceProperty);
2674 if (sourceValue == null)
2679 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2681 if (destinationProperty != null)
2683 SetValue(destinationProperty, sourceValue);
2689 /// Get whether the View is culled or not.
2690 /// True means that the View is out of the view frustum.
2693 /// Hidden-API (Inhouse-API).
2695 [EditorBrowsable(EditorBrowsableState.Never)]
2701 var pValue = GetProperty(View.Property.Culled);
2702 pValue.Get(out temp);
2709 /// Set or Get TransitionOptions for the page transition.
2710 /// This property is used to define how this view will be transitioned during Page switching.
2712 /// <since_tizen> 9 </since_tizen>
2713 public TransitionOptions TransitionOptions
2717 transitionOptions = value;
2721 return transitionOptions;