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 internal class ThemeData
53 public bool controlStatePropagation = false;
54 public ViewStyle viewStyle;
55 public bool themeChangeSensitive = false;
56 public ControlState controlStates = ControlState.Normal;
57 public ViewSelectorData selectorData;
62 RegisterPropertyGroup(PositionProperty, positionPropertyGroup);
63 RegisterPropertyGroup(Position2DProperty, positionPropertyGroup);
64 RegisterPropertyGroup(PositionXProperty, positionPropertyGroup);
65 RegisterPropertyGroup(PositionYProperty, positionPropertyGroup);
67 RegisterPropertyGroup(SizeProperty, sizePropertyGroup);
68 RegisterPropertyGroup(Size2DProperty, sizePropertyGroup);
69 RegisterPropertyGroup(SizeWidthProperty, sizePropertyGroup);
70 RegisterPropertyGroup(SizeHeightProperty, sizePropertyGroup);
72 RegisterPropertyGroup(ScaleProperty, scalePropertyGroup);
73 RegisterPropertyGroup(ScaleXProperty, scalePropertyGroup);
74 RegisterPropertyGroup(ScaleYProperty, scalePropertyGroup);
75 RegisterPropertyGroup(ScaleZProperty, scalePropertyGroup);
79 /// Creates a new instance of a view.
81 /// <since_tizen> 3 </since_tizen>
82 public View() : this(Interop.View.New(), true)
84 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
87 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
88 [EditorBrowsable(EditorBrowsableState.Never)]
89 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
94 /// Create a new instance of a View with setting the status of shown or hidden.
96 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
97 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
98 [EditorBrowsable(EditorBrowsableState.Never)]
99 public View(bool shown) : this(Interop.View.New(), true)
101 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
105 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
107 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
116 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
118 InitializeStyle(viewStyle);
121 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
125 PositionUsesPivotPoint = false;
128 onWindowSendEventCallback = SendViewAddedEventToWindow;
129 this.OnWindowSignal().Connect(onWindowSendEventCallback);
137 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
139 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
148 /// The event that is triggered when the View's ControlState is changed.
150 [EditorBrowsable(EditorBrowsableState.Never)]
151 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
153 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
157 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
159 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
160 [EditorBrowsable(EditorBrowsableState.Never)]
161 public bool LayoutSet
170 /// Flag to allow Layouting to be disabled for Views.
171 /// Once a View has a Layout set then any children added to Views from then on will receive
172 /// automatic Layouts.
174 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
175 [EditorBrowsable(EditorBrowsableState.Never)]
176 public static bool LayoutingDisabled { get; set; } = true;
179 /// The style instance applied to this view.
180 /// Note that please do not modify the ViewStyle.
181 /// Modifying ViewStyle will affect other views with same ViewStyle.
183 [EditorBrowsable(EditorBrowsableState.Never)]
184 protected ViewStyle ViewStyle
188 if (themeData == null) themeData = new ThemeData();
190 if (themeData.viewStyle == null)
192 ApplyStyle(CreateViewStyle());
194 return themeData.viewStyle;
199 /// Get/Set the control state.
200 /// Note that the ControlState only available for the classes derived from Control.
201 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
202 /// please set <see cref="EnableControlState"/> to true.
204 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
205 [EditorBrowsable(EditorBrowsableState.Never)]
206 public ControlState ControlState
210 return themeData == null ? ControlState.Normal : themeData.controlStates;
214 if (ControlState == value)
219 var prevState = ControlState;
221 if (themeData == null) themeData = new ThemeData();
222 themeData.controlStates = value;
224 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
226 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
228 if (themeData.controlStatePropagation)
230 foreach (View child in Children)
232 child.ControlState = value;
236 OnControlStateChanged(changeInfo);
238 ControlStateChangedEvent?.Invoke(this, changeInfo);
243 /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
245 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
246 [EditorBrowsable(EditorBrowsableState.Never)]
247 public bool ExcludeLayouting
251 return excludeLayouting;
255 excludeLayouting = value;
256 if (Layout != null && Layout.SetPositionByLayout == value)
258 Layout.SetPositionByLayout = !value;
259 Layout.RequestLayout();
264 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
265 [EditorBrowsable(EditorBrowsableState.Never)]
266 public bool IsResourcesCreated
270 return Application.Current.IsResourcesCreated;
274 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
275 [EditorBrowsable(EditorBrowsableState.Never)]
276 public ResourceDictionary XamlResources
280 return Application.Current.XamlResources;
284 Application.Current.XamlResources = value;
289 /// The StyleName, type string.
290 /// The value indicates DALi style name defined in json theme file.
292 /// <since_tizen> 3 </since_tizen>
293 public string StyleName
297 return (string)GetValue(StyleNameProperty);
301 SetValue(StyleNameProperty, value);
302 NotifyPropertyChanged();
307 /// The KeyInputFocus, type bool.
309 [EditorBrowsable(EditorBrowsableState.Never)]
310 public bool KeyInputFocus
314 return (bool)GetValue(KeyInputFocusProperty);
318 SetValue(KeyInputFocusProperty, value);
319 NotifyPropertyChanged();
324 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
328 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
331 /// Animatable - This property can be animated using <c>Animation</c> class.
333 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
337 /// <since_tizen> 3 </since_tizen>
338 public Color BackgroundColor
342 Color temp = (Color)GetValue(BackgroundColorProperty);
343 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
347 SetValue(BackgroundColorProperty, value);
348 NotifyPropertyChanged();
353 /// The mutually exclusive with "backgroundColor" and "background" type Map.
355 /// <since_tizen> 3 </since_tizen>
356 public string BackgroundImage
360 return (string)GetValue(BackgroundImageProperty);
364 SetValue(BackgroundImageProperty, value);
365 NotifyPropertyChanged();
370 /// Get or set the border of background image.
372 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
373 [EditorBrowsable(EditorBrowsableState.Never)]
374 public Rectangle BackgroundImageBorder
378 return (Rectangle)GetValue(BackgroundImageBorderProperty);
382 SetValue(BackgroundImageBorderProperty, value);
383 NotifyPropertyChanged();
388 /// The background of view.
390 /// <since_tizen> 3 </since_tizen>
391 public Tizen.NUI.PropertyMap Background
395 return (PropertyMap)GetValue(BackgroundProperty);
399 SetValue(BackgroundProperty, value);
400 NotifyPropertyChanged();
405 /// Describes a shadow as an image for a View.
406 /// It is null by default.
409 /// Getter returns copied instance of current shadow.
412 /// The mutually exclusive with "BoxShadow".
416 /// Animatable - This property can be animated using <c>Animation</c> class.
417 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
419 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
421 /// Animatable sub-property : Offset.
424 [EditorBrowsable(EditorBrowsableState.Never)]
425 public ImageShadow ImageShadow
429 return (ImageShadow)GetValue(ImageShadowProperty);
433 SetValue(ImageShadowProperty, value);
434 NotifyPropertyChanged();
439 /// Describes a box shaped shadow drawing for a View.
440 /// It is null by default.
443 /// The mutually exclusive with "ImageShadow".
447 /// Animatable - This property can be animated using <c>Animation</c> class.
448 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
450 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
452 /// Animatable sub-property : Offset, Color, BlurRadius.
455 /// <since_tizen> 9 </since_tizen>
456 public Shadow BoxShadow
460 return (Shadow)GetValue(BoxShadowProperty);
464 SetValue(BoxShadowProperty, value);
465 NotifyPropertyChanged();
470 /// The radius for the rounded corners of the View.
471 /// This will rounds background and shadow edges.
472 /// 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).
473 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
477 /// Animatable - This property can be animated using <c>Animation</c> class.
480 /// <since_tizen> 9 </since_tizen>
481 public Vector4 CornerRadius
485 return (Vector4)GetValue(CornerRadiusProperty);
489 SetValue(CornerRadiusProperty, value);
490 NotifyPropertyChanged();
495 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
496 /// It is absolute by default.
497 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
499 /// <since_tizen> 9 </since_tizen>
500 public VisualTransformPolicyType CornerRadiusPolicy
502 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
503 set => SetValue(CornerRadiusPolicyProperty, value);
507 /// The width for the borderline of the View.
508 /// This will draw borderline at background.
509 /// Note that, an image background may not have borderline if it uses a Border property.
513 /// Animatable - This property can be animated using <c>Animation</c> class.
516 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
517 [EditorBrowsable(EditorBrowsableState.Never)]
518 public float BorderlineWidth
522 return (float)GetValue(BorderlineWidthProperty);
526 SetValue(BorderlineWidthProperty, value);
527 NotifyPropertyChanged();
532 /// The color for the borderline of the View.
533 /// It is Color.Black by default.
537 /// Animatable - This property can be animated using <c>Animation</c> class.
540 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
541 [EditorBrowsable(EditorBrowsableState.Never)]
542 public Color BorderlineColor
546 return (Color)GetValue(BorderlineColorProperty);
550 SetValue(BorderlineColorProperty, value);
551 NotifyPropertyChanged();
556 /// The Relative offset for the borderline of the View.
557 /// recommand [-1.0f to 1.0f] range.
558 /// If -1.0f, borderline draw inside of View.
559 /// If 1.0f, borderline draw outside of View.
560 /// If 0.0f, borderline draw half at inside and half at outside.
561 /// It is 0.0f by default.
565 /// Animatable - This property can be animated using <c>Animation</c> class.
568 /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API.
569 [EditorBrowsable(EditorBrowsableState.Never)]
570 public float BorderlineOffset
574 return (float)GetValue(BorderlineOffsetProperty);
578 SetValue(BorderlineOffsetProperty, value);
579 NotifyPropertyChanged();
584 /// The current state of the view.
586 /// <since_tizen> 3 </since_tizen>
591 return (States)GetValue(StateProperty);
595 SetValue(StateProperty, value);
596 NotifyPropertyChanged();
601 /// The current sub state of the view.
603 /// <since_tizen> 3 </since_tizen>
604 public States SubState
608 return (States)GetValue(SubStateProperty);
612 SetValue(SubStateProperty, value);
613 NotifyPropertyChanged();
618 /// Displays a tooltip
620 /// <since_tizen> 3 </since_tizen>
621 public Tizen.NUI.PropertyMap Tooltip
625 return (PropertyMap)GetValue(TooltipProperty);
629 SetValue(TooltipProperty, value);
630 NotifyPropertyChanged();
635 /// Displays a tooltip as a text.
637 /// <since_tizen> 3 </since_tizen>
638 public string TooltipText
642 using (var propertyValue = GetProperty(Property.TOOLTIP))
644 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
646 return retrivedValue;
648 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
649 return "error to get TooltipText";
654 var temp = new Tizen.NUI.PropertyValue(value);
655 SetProperty(View.Property.TOOLTIP, temp);
657 NotifyPropertyChanged();
662 /// The Child property of FlexContainer.<br />
663 /// The proportion of the free space in the container, the flex item will receive.<br />
664 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
666 /// <since_tizen> 3 </since_tizen>
667 [Obsolete("Deprecated in API8, will be removed in API10.")]
672 return (float)GetValue(FlexProperty);
676 SetValue(FlexProperty, value);
677 NotifyPropertyChanged();
682 /// The Child property of FlexContainer.<br />
683 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
685 /// <since_tizen> 3 </since_tizen>
686 [Obsolete("Deprecated in API8, will be removed in API10.")]
691 return (int)GetValue(AlignSelfProperty);
695 SetValue(AlignSelfProperty, value);
696 NotifyPropertyChanged();
701 /// The Child property of FlexContainer.<br />
702 /// The space around the flex item.<br />
705 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
707 /// <since_tizen> 3 </since_tizen>
708 [Obsolete("Deprecated in API8, will be removed in API10.")]
709 public Vector4 FlexMargin
713 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
714 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
718 SetValue(FlexMarginProperty, value);
719 NotifyPropertyChanged();
724 /// The top-left cell this child occupies, if not set, the first available cell is used.
727 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
728 /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
730 /// <since_tizen> 3 </since_tizen>
731 public Vector2 CellIndex
735 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
736 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
740 SetValue(CellIndexProperty, value);
741 NotifyPropertyChanged();
746 /// The number of rows this child occupies, if not set, the default value is 1.
749 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
751 /// <since_tizen> 3 </since_tizen>
756 return (float)GetValue(RowSpanProperty);
760 SetValue(RowSpanProperty, value);
761 NotifyPropertyChanged();
766 /// The number of columns this child occupies, if not set, the default value is 1.
769 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
771 /// <since_tizen> 3 </since_tizen>
772 public float ColumnSpan
776 return (float)GetValue(ColumnSpanProperty);
780 SetValue(ColumnSpanProperty, value);
781 NotifyPropertyChanged();
786 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
789 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
791 /// <since_tizen> 3 </since_tizen>
792 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
796 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
800 SetValue(CellHorizontalAlignmentProperty, value);
801 NotifyPropertyChanged();
806 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
809 /// This property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
811 /// <since_tizen> 3 </since_tizen>
812 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
816 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
820 SetValue(CellVerticalAlignmentProperty, value);
821 NotifyPropertyChanged();
826 /// The left focusable view.<br />
827 /// This will return null if not set.<br />
828 /// This will also return null if the specified left focusable view is not on a window.<br />
830 /// <since_tizen> 3 </since_tizen>
831 public View LeftFocusableView
833 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
836 return (View)GetValue(LeftFocusableViewProperty);
840 SetValue(LeftFocusableViewProperty, value);
841 NotifyPropertyChanged();
846 /// The right focusable view.<br />
847 /// This will return null if not set.<br />
848 /// This will also return null if the specified right focusable view is not on a window.<br />
850 /// <since_tizen> 3 </since_tizen>
851 public View RightFocusableView
853 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
856 return (View)GetValue(RightFocusableViewProperty);
860 SetValue(RightFocusableViewProperty, value);
861 NotifyPropertyChanged();
866 /// The up focusable view.<br />
867 /// This will return null if not set.<br />
868 /// This will also return null if the specified up focusable view is not on a window.<br />
870 /// <since_tizen> 3 </since_tizen>
871 public View UpFocusableView
873 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
876 return (View)GetValue(UpFocusableViewProperty);
880 SetValue(UpFocusableViewProperty, value);
881 NotifyPropertyChanged();
886 /// The down focusable view.<br />
887 /// This will return null if not set.<br />
888 /// This will also return null if the specified down focusable view is not on a window.<br />
890 /// <since_tizen> 3 </since_tizen>
891 public View DownFocusableView
893 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
896 return (View)GetValue(DownFocusableViewProperty);
900 SetValue(DownFocusableViewProperty, value);
901 NotifyPropertyChanged();
906 /// Whether the view should be focusable by keyboard navigation.
908 /// <since_tizen> 3 </since_tizen>
909 public bool Focusable
913 SetValue(FocusableProperty, value);
914 NotifyPropertyChanged();
918 return (bool)GetValue(FocusableProperty);
923 /// Retrieves the position of the view.<br />
924 /// The coordinates are relative to the view's parent.<br />
926 /// <since_tizen> 3 </since_tizen>
927 public Position CurrentPosition
931 return GetCurrentPosition();
936 /// Sets the size of a view for the width and the height.<br />
937 /// Geometry can be scaled to fit within this area.<br />
938 /// This does not interfere with the view's scale factor.<br />
939 /// The views default depth is the minimum of width and height.<br />
942 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
943 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
945 /// <since_tizen> 3 </since_tizen>
950 Size2D temp = (Size2D)GetValue(Size2DProperty);
951 int width = temp.Width;
952 int height = temp.Height;
954 if (this.Layout == null)
956 if (width < 0) { width = 0; }
957 if (height < 0) { height = 0; }
960 return new Size2D(OnSize2DChanged, width, height);
964 SetValue(Size2DProperty, value);
966 NotifyPropertyChanged();
971 /// Retrieves the size of the view.<br />
972 /// The coordinates are relative to the view's parent.<br />
974 /// <since_tizen> 3 </since_tizen>
975 public Size2D CurrentSize
979 return GetCurrentSize();
984 /// Retrieves and sets the view's opacity.<br />
986 /// <since_tizen> 3 </since_tizen>
991 return (float)GetValue(OpacityProperty);
995 SetValue(OpacityProperty, value);
996 NotifyPropertyChanged();
1001 /// Sets the position of the view for X and Y.<br />
1002 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1003 /// If the position inheritance is disabled, sets the world position.<br />
1006 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1007 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1009 /// <since_tizen> 3 </since_tizen>
1010 public Position2D Position2D
1014 Position2D temp = (Position2D)GetValue(Position2DProperty);
1015 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1019 SetValue(Position2DProperty, value);
1020 NotifyPropertyChanged();
1025 /// Retrieves the screen position of the view.<br />
1027 /// <since_tizen> 3 </since_tizen>
1028 public Vector2 ScreenPosition
1032 Vector2 temp = new Vector2(0.0f, 0.0f);
1033 var pValue = GetProperty(View.Property.ScreenPosition);
1041 /// Determines whether the pivot point should be used to determine the position of the view.
1042 /// This is false by default.
1044 /// <remarks>If false, then the top-left of the view is used for the position.
1045 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1047 /// <since_tizen> 3 </since_tizen>
1048 public bool PositionUsesPivotPoint
1052 return (bool)GetValue(PositionUsesPivotPointProperty);
1056 SetValue(PositionUsesPivotPointProperty, value);
1057 NotifyPropertyChanged();
1062 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1064 /// <since_tizen> 3 </since_tizen>
1065 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1067 "View view = new View(); " +
1068 "view.PivotPoint = PivotPoint.Center; " +
1069 "view.PositionUsesPivotPoint = true;" +
1070 " Deprecated in API5: Will be removed in API8")]
1071 [EditorBrowsable(EditorBrowsableState.Never)]
1072 public bool PositionUsesAnchorPoint
1077 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1078 pValue.Get(out temp);
1084 var temp = new Tizen.NUI.PropertyValue(value);
1085 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1087 NotifyPropertyChanged();
1092 /// Queries whether the view is connected to the stage.<br />
1093 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1095 /// <since_tizen> 3 </since_tizen>
1096 public bool IsOnWindow
1105 /// Gets the depth in the hierarchy for the view.
1107 /// <since_tizen> 3 </since_tizen>
1108 public int HierarchyDepth
1112 return GetHierarchyDepth();
1117 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1120 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1121 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1122 /// The values set by this property will likely change.
1124 /// <since_tizen> 3 </since_tizen>
1125 public int SiblingOrder
1129 return (int)GetValue(SiblingOrderProperty);
1133 SetValue(SiblingOrderProperty, value);
1135 LayoutGroup layout = Layout as LayoutGroup;
1136 layout?.ChangeLayoutSiblingOrder(value);
1138 NotifyPropertyChanged();
1143 /// Returns the natural size of the view.
1146 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1148 /// <since_tizen> 5 </since_tizen>
1149 public Vector3 NaturalSize
1153 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1154 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1160 /// Returns the natural size (Size2D) of the view.
1163 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1165 /// <since_tizen> 4 </since_tizen>
1166 public Size2D NaturalSize2D
1170 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1171 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1173 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1180 /// Gets or sets the origin of a view within its parent's area.<br />
1181 /// 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 />
1182 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1183 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1185 /// <pre>The view has been initialized.</pre>
1186 /// <since_tizen> 3 </since_tizen>
1187 public Position ParentOrigin
1191 Position tmp = (Position)GetValue(ParentOriginProperty);
1192 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1196 SetValue(ParentOriginProperty, value);
1197 NotifyPropertyChanged();
1202 /// Gets or sets the anchor-point of a view.<br />
1203 /// 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 />
1204 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1205 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1206 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1207 /// <pre>The view has been initialized.</pre>
1210 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1212 /// <since_tizen> 3 </since_tizen>
1213 public Position PivotPoint
1217 Position tmp = (Position)GetValue(PivotPointProperty);
1218 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1222 SetValue(PivotPointProperty, value);
1223 NotifyPropertyChanged();
1228 /// Gets or sets the size width of the view.
1232 /// Animatable - This property can be animated using <c>Animation</c> class.
1235 /// <since_tizen> 3 </since_tizen>
1236 public float SizeWidth
1240 return (float)GetValue(SizeWidthProperty);
1244 SetValue(SizeWidthProperty, value);
1245 NotifyPropertyChanged();
1250 /// Gets or sets the size height of the view.
1254 /// Animatable - This property can be animated using <c>Animation</c> class.
1257 /// <since_tizen> 3 </since_tizen>
1258 public float SizeHeight
1262 return (float)GetValue(SizeHeightProperty);
1266 SetValue(SizeHeightProperty, value);
1267 NotifyPropertyChanged();
1272 /// Gets or sets the position of the view.<br />
1273 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1274 /// If the position inheritance is disabled, sets the world position.<br />
1278 /// Animatable - This property can be animated using <c>Animation</c> class.
1280 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1282 /// <since_tizen> 3 </since_tizen>
1283 public Position Position
1287 Position tmp = (Position)GetValue(PositionProperty);
1288 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1292 SetValue(PositionProperty, value);
1293 NotifyPropertyChanged();
1298 /// Gets or sets the position X of the view.
1302 /// Animatable - This property can be animated using <c>Animation</c> class.
1305 /// <since_tizen> 3 </since_tizen>
1306 public float PositionX
1310 return (float)GetValue(PositionXProperty);
1314 SetValue(PositionXProperty, value);
1315 NotifyPropertyChanged();
1320 /// Gets or sets the position Y of the view.
1324 /// Animatable - This property can be animated using <c>Animation</c> class.
1327 /// <since_tizen> 3 </since_tizen>
1328 public float PositionY
1332 return (float)GetValue(PositionYProperty);
1336 SetValue(PositionYProperty, value);
1337 NotifyPropertyChanged();
1342 /// Gets or sets the position Z of the view.
1346 /// Animatable - This property can be animated using <c>Animation</c> class.
1349 /// <since_tizen> 3 </since_tizen>
1350 public float PositionZ
1354 return (float)GetValue(PositionZProperty);
1358 SetValue(PositionZProperty, value);
1359 NotifyPropertyChanged();
1364 /// Gets or sets the world position of the view.
1366 /// <since_tizen> 3 </since_tizen>
1367 public Vector3 WorldPosition
1371 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1372 var pValue = GetProperty(View.Property.WorldPosition);
1380 /// Gets or sets the orientation of the view.<br />
1381 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1385 /// This is an asynchronous method.
1388 /// Animatable - This property can be animated using <c>Animation</c> class.
1391 /// <since_tizen> 3 </since_tizen>
1392 public Rotation Orientation
1396 return (Rotation)GetValue(OrientationProperty);
1400 SetValue(OrientationProperty, value);
1401 NotifyPropertyChanged();
1406 /// Gets or sets the world orientation of the view.<br />
1408 /// <since_tizen> 3 </since_tizen>
1409 public Rotation WorldOrientation
1413 Rotation temp = new Rotation();
1414 var pValue = GetProperty(View.Property.WorldOrientation);
1422 /// Gets or sets the scale factor applied to the view.<br />
1426 /// Animatable - This property can be animated using <c>Animation</c> class.
1428 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1430 /// <since_tizen> 3 </since_tizen>
1431 public Vector3 Scale
1435 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1436 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1440 SetValue(ScaleProperty, value);
1441 NotifyPropertyChanged();
1446 /// Gets or sets the scale X factor applied to the view.
1450 /// Animatable - This property can be animated using <c>Animation</c> class.
1453 /// <since_tizen> 3 </since_tizen>
1458 return (float)GetValue(ScaleXProperty);
1462 SetValue(ScaleXProperty, value);
1463 NotifyPropertyChanged();
1468 /// Gets or sets the scale Y factor applied to the view.
1472 /// Animatable - This property can be animated using <c>Animation</c> class.
1475 /// <since_tizen> 3 </since_tizen>
1480 return (float)GetValue(ScaleYProperty);
1484 SetValue(ScaleYProperty, value);
1485 NotifyPropertyChanged();
1490 /// Gets or sets the scale Z factor applied to the view.
1494 /// Animatable - This property can be animated using <c>Animation</c> class.
1497 /// <since_tizen> 3 </since_tizen>
1502 return (float)GetValue(ScaleZProperty);
1506 SetValue(ScaleZProperty, value);
1507 NotifyPropertyChanged();
1512 /// Gets the world scale of the view.
1514 /// <since_tizen> 3 </since_tizen>
1515 public Vector3 WorldScale
1519 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1520 var pValue = GetProperty(View.Property.WorldScale);
1528 /// Retrieves the visibility flag of the view.
1532 /// If the view is not visible, then the view and its children will not be rendered.
1533 /// 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.
1536 /// Animatable - This property can be animated using <c>Animation</c> class.
1539 /// <since_tizen> 3 </since_tizen>
1540 public bool Visibility
1545 var pValue = GetProperty(View.Property.VISIBLE);
1546 pValue.Get(out temp);
1553 /// Gets the view's world color.
1555 /// <since_tizen> 3 </since_tizen>
1556 public Vector4 WorldColor
1560 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1561 var pValue = GetProperty(View.Property.WorldColor);
1569 /// Gets or sets the view's name.
1571 /// <since_tizen> 3 </since_tizen>
1576 return (string)GetValue(NameProperty);
1580 SetValue(NameProperty, value);
1581 NotifyPropertyChanged();
1586 /// Get the number of children held by the view.
1588 /// <since_tizen> 3 </since_tizen>
1589 public new uint ChildCount
1593 return Convert.ToUInt32(Children.Count);
1598 /// Gets the view's ID.
1601 /// <since_tizen> 3 </since_tizen>
1611 /// Gets or sets the status of whether the view should emit touch or hover signals.
1613 /// <since_tizen> 3 </since_tizen>
1614 public bool Sensitive
1618 return (bool)GetValue(SensitiveProperty);
1622 SetValue(SensitiveProperty, value);
1623 NotifyPropertyChanged();
1628 /// 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.
1630 /// <since_tizen> 3 </since_tizen>
1631 public bool LeaveRequired
1635 return (bool)GetValue(LeaveRequiredProperty);
1639 SetValue(LeaveRequiredProperty, value);
1640 NotifyPropertyChanged();
1645 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1647 /// <since_tizen> 3 </since_tizen>
1648 public bool InheritOrientation
1652 return (bool)GetValue(InheritOrientationProperty);
1656 SetValue(InheritOrientationProperty, value);
1657 NotifyPropertyChanged();
1662 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1664 /// <since_tizen> 3 </since_tizen>
1665 public bool InheritScale
1669 return (bool)GetValue(InheritScaleProperty);
1673 SetValue(InheritScaleProperty, value);
1674 NotifyPropertyChanged();
1679 /// Gets or sets the status of how the view and its children should be drawn.<br />
1680 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1681 /// 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 />
1682 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1683 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1684 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1686 /// <since_tizen> 3 </since_tizen>
1687 public DrawModeType DrawMode
1691 return (DrawModeType)GetValue(DrawModeProperty);
1695 SetValue(DrawModeProperty, value);
1696 NotifyPropertyChanged();
1701 /// Gets or sets the relative to parent size factor of the view.<br />
1702 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1703 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1706 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1708 /// <since_tizen> 3 </since_tizen>
1709 [Obsolete("Deprecated. Since Tizen.NUI.ResizePolicyType is deprecated, SizeModeFactor is no longer supported. Instead, please use parent view having Tizen.NUI.RelativeLayout as its Layout.")]
1710 public Vector3 SizeModeFactor
1714 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1715 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1719 SetValue(SizeModeFactorProperty, value);
1720 NotifyPropertyChanged();
1725 /// Gets or sets the width resize policy to be used.
1727 /// <since_tizen> 3 </since_tizen>
1728 [Obsolete("Deprecated. Please set Layout and use WidthSpecification instead.")]
1729 public ResizePolicyType WidthResizePolicy
1733 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1737 SetValue(WidthResizePolicyProperty, value);
1738 NotifyPropertyChanged();
1743 /// Gets or sets the height resize policy to be used.
1745 /// <since_tizen> 3 </since_tizen>
1746 [Obsolete("Deprecated. Please set Layout and use HeightSpecification instead.")]
1747 public ResizePolicyType HeightResizePolicy
1751 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1755 SetValue(HeightResizePolicyProperty, value);
1756 NotifyPropertyChanged();
1761 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1762 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1764 /// <since_tizen> 3 </since_tizen>
1765 public SizeScalePolicyType SizeScalePolicy
1769 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1773 SetValue(SizeScalePolicyProperty, value);
1774 NotifyPropertyChanged();
1779 /// Gets or sets the status of whether the width size is dependent on the height size.
1781 /// <since_tizen> 3 </since_tizen>
1782 public bool WidthForHeight
1786 return (bool)GetValue(WidthForHeightProperty);
1790 SetValue(WidthForHeightProperty, value);
1791 NotifyPropertyChanged();
1796 /// Gets or sets the status of whether the height size is dependent on the width size.
1798 /// <since_tizen> 3 </since_tizen>
1799 public bool HeightForWidth
1803 return (bool)GetValue(HeightForWidthProperty);
1807 SetValue(HeightForWidthProperty, value);
1808 NotifyPropertyChanged();
1813 /// Gets or sets the padding for use in layout.
1816 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1818 /// <since_tizen> 5 </since_tizen>
1819 public Extents Padding
1823 // If View has a Layout then padding in stored in the base Layout class
1826 return Layout.Padding;
1830 Extents temp = (Extents)GetValue(PaddingProperty);
1831 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1833 // Two return points to prevent creating a zeroed Extent native object before assignment
1837 Extents padding = value;
1840 // Layout set so store Padding in LayoutItem instead of in View.
1841 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1842 // the position and sizes measure in the Layouting.
1843 Layout.Padding = value;
1844 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1845 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1846 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1848 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1852 SetValue(PaddingProperty, padding);
1853 NotifyPropertyChanged();
1858 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1860 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1862 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1864 /// <since_tizen> 3 </since_tizen>
1865 public Size2D MinimumSize
1869 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1870 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1876 throw new ArgumentNullException(nameof(value));
1880 // Note: it only works if minimum size is >= than natural size.
1881 // To force the size it should be done through the width&height spec or Size2D.
1882 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1883 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1884 layout.RequestLayout();
1886 SetValue(MinimumSizeProperty, value);
1887 NotifyPropertyChanged();
1892 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1895 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1897 /// <since_tizen> 3 </since_tizen>
1898 public Size2D MaximumSize
1902 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1903 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1907 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1908 // MATCH_PARENT spec + parent container size can be used to limit
1911 layout.RequestLayout();
1913 SetValue(MaximumSizeProperty, value);
1914 NotifyPropertyChanged();
1919 /// Gets or sets whether a child view inherits it's parent's position.<br />
1920 /// Default is to inherit.<br />
1921 /// 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 />
1923 /// <since_tizen> 3 </since_tizen>
1924 public bool InheritPosition
1928 return (bool)GetValue(InheritPositionProperty);
1932 SetValue(InheritPositionProperty, value);
1933 NotifyPropertyChanged();
1938 /// Gets or sets the clipping behavior (mode) of it's children.
1940 /// <since_tizen> 3 </since_tizen>
1941 public ClippingModeType ClippingMode
1945 return (ClippingModeType)GetValue(ClippingModeProperty);
1949 SetValue(ClippingModeProperty, value);
1950 NotifyPropertyChanged();
1955 /// Gets the number of renderers held by the view.
1957 /// <since_tizen> 3 </since_tizen>
1958 public uint RendererCount
1962 return GetRendererCount();
1967 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1970 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1972 /// <since_tizen> 3 </since_tizen>
1973 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1975 "View view = new View(); " +
1976 "view.PivotPoint = PivotPoint.Center; " +
1977 "view.PositionUsesPivotPoint = true;")]
1978 [EditorBrowsable(EditorBrowsableState.Never)]
1979 public Position AnchorPoint
1983 Position temp = new Position(0.0f, 0.0f, 0.0f);
1984 var pValue = GetProperty(View.Property.AnchorPoint);
1987 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1993 var temp = new Tizen.NUI.PropertyValue(value);
1994 SetProperty(View.Property.AnchorPoint, temp);
1996 NotifyPropertyChanged();
2001 /// Sets the size of a view for the width, the height and the depth.<br />
2002 /// Geometry can be scaled to fit within this area.<br />
2003 /// This does not interfere with the view's scale factor.<br />
2004 /// The views default depth is the minimum of width and height.<br />
2008 /// Animatable - This property can be animated using <c>Animation</c> class.
2010 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2012 /// <since_tizen> 5 </since_tizen>
2017 Size tmp = (Size)GetValue(SizeProperty);
2018 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2022 SetValue(SizeProperty, value);
2023 NotifyPropertyChanged();
2028 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2030 /// <since_tizen> 3 </since_tizen>
2031 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2033 "Container parent = view.GetParent(); " +
2034 "View view = parent as View;")]
2035 [EditorBrowsable(EditorBrowsableState.Never)]
2036 public new View Parent
2041 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2042 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2043 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2045 if (basehandle is Layer layer)
2047 ret = new View(Layer.getCPtr(layer).Handle, false);
2048 NUILog.Error("This Parent property is deprecated, should do not be used");
2052 ret = basehandle as View;
2055 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2056 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2058 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2064 /// Gets/Sets whether inherit parent's the layout Direction.
2066 /// <since_tizen> 4 </since_tizen>
2067 public bool InheritLayoutDirection
2071 return (bool)GetValue(InheritLayoutDirectionProperty);
2075 SetValue(InheritLayoutDirectionProperty, value);
2076 NotifyPropertyChanged();
2081 /// Gets/Sets the layout Direction.
2083 /// <since_tizen> 4 </since_tizen>
2084 public ViewLayoutDirectionType LayoutDirection
2088 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2092 SetValue(LayoutDirectionProperty, value);
2093 NotifyPropertyChanged();
2094 layout?.RequestLayout();
2099 /// Gets or sets the Margin for use in layout.
2102 /// Margin property is supported by Layout algorithms and containers.
2103 /// Please Set Layout if you want to use Margin property.
2104 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2106 /// <since_tizen> 4 </since_tizen>
2107 public Extents Margin
2111 // If View has a Layout then margin is stored in Layout.
2114 return Layout.Margin;
2118 // If Layout not set then return margin stored in View.
2119 Extents temp = (Extents)GetValue(MarginProperty);
2120 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2122 // Two return points to prevent creating a zeroed Extent native object before assignment
2128 // Layout set so store Margin in LayoutItem instead of View.
2129 // If View stores the Margin too then the Legacy Size Negotiation will
2130 // overwrite the position and size values measured in the Layouting.
2131 Layout.Margin = value;
2132 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2133 layout?.RequestLayout();
2137 SetValue(MarginProperty, value);
2139 NotifyPropertyChanged();
2140 layout?.RequestLayout();
2145 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2149 /// // matchParentView matches its size to its parent size.
2150 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2151 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2153 /// // wrapContentView wraps its children with their desired size.
2154 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2155 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2157 /// // exactSizeView shows itself with an exact size.
2158 /// exactSizeView.WidthSpecification = 100;
2159 /// exactSizeView.HeightSpecification = 100;
2162 /// <since_tizen> 6 </since_tizen>
2163 public int WidthSpecification
2171 if (value == widthPolicy)
2174 widthPolicy = value;
2175 if (widthPolicy >= 0)
2177 if (heightPolicy >= 0) // Policy an exact value
2179 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2180 Size2D = new Size2D(widthPolicy, heightPolicy);
2183 layout?.RequestLayout();
2188 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2192 /// // matchParentView matches its size to its parent size.
2193 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2194 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2196 /// // wrapContentView wraps its children with their desired size.
2197 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2198 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2200 /// // exactSizeView shows itself with an exact size.
2201 /// exactSizeView.WidthSpecification = 100;
2202 /// exactSizeView.HeightSpecification = 100;
2205 /// <since_tizen> 6 </since_tizen>
2206 public int HeightSpecification
2210 return heightPolicy;
2214 if (value == heightPolicy)
2217 heightPolicy = value;
2218 if (heightPolicy >= 0)
2220 if (widthPolicy >= 0) // Policy an exact value
2222 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2223 Size2D = new Size2D(widthPolicy, heightPolicy);
2226 layout?.RequestLayout();
2231 /// Gets the List of transitions for this View.
2233 /// <since_tizen> 6 </since_tizen>
2234 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2238 if (layoutTransitions == null)
2240 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2242 return layoutTransitions;
2247 /// Sets a layout transitions for this View.
2249 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2251 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2253 /// <since_tizen> 6 </since_tizen>
2254 public LayoutTransition LayoutTransition
2258 return layoutTransition;
2264 throw new global::System.ArgumentNullException(nameof(value));
2266 if (layoutTransitions == null)
2268 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2271 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2273 AttachTransitionsToChildren(value);
2275 layoutTransition = value;
2280 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2283 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2285 /// <since_tizen> 4 </since_tizen>
2286 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2287 [EditorBrowsable(EditorBrowsableState.Never)]
2288 public Extents PaddingEX
2292 Extents temp = new Extents(0, 0, 0, 0);
2293 var pValue = GetProperty(View.Property.PADDING);
2296 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2302 var temp = new Tizen.NUI.PropertyValue(value);
2303 SetProperty(View.Property.PADDING, temp);
2305 NotifyPropertyChanged();
2306 layout?.RequestLayout();
2311 /// The Color of View. This is an RGBA value.
2315 /// Animatable - This property can be animated using <c>Animation</c> class.
2317 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2319 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2320 [EditorBrowsable(EditorBrowsableState.Never)]
2325 Color temp = (Color)GetValue(ColorProperty);
2326 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2330 SetValue(ColorProperty, value);
2331 NotifyPropertyChanged();
2336 /// Set the layout on this View. Replaces any existing Layout.
2339 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2341 /// <since_tizen> 6 </since_tizen>
2342 public LayoutItem Layout
2350 // Do nothing if layout provided is already set on this View.
2351 if (value == layout)
2356 LayoutingDisabled = false;
2359 // If new layout being set already has a owner then that owner receives a replacement default layout.
2360 // First check if the layout to be set already has a owner.
2361 if (value?.Owner != null)
2363 // Previous owner of the layout gets a default layout as a replacement.
2364 value.Owner.Layout = new AbsoluteLayout();
2366 // Copy Margin and Padding to replacement LayoutGroup.
2367 if (value.Owner.Layout != null)
2369 value.Owner.Layout.Margin = value.Margin;
2370 value.Owner.Layout.Padding = value.Padding;
2374 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2375 // View if no replacement. Previously margin and padding values would have been moved from
2376 // the View to the layout.
2377 if (layout != null) // Existing layout
2381 // Existing layout being replaced so copy over margin and padding values.
2382 value.Margin = layout.Margin;
2383 value.Padding = layout.Padding;
2387 // Layout not being replaced so restore margin and padding to View.
2388 SetValue(MarginProperty, layout.Margin);
2389 SetValue(PaddingProperty, layout.Padding);
2390 NotifyPropertyChanged();
2395 // First Layout to be added to the View hence copy
2397 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2400 Extents margin = Margin;
2401 Extents padding = Padding;
2402 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2404 // If View already has a margin set then store it in Layout instead.
2405 value.Margin = margin;
2406 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2407 NotifyPropertyChanged();
2410 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2412 // If View already has a padding set then store it in Layout instead.
2413 value.Padding = padding;
2415 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2416 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2417 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2419 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2420 NotifyPropertyChanged();
2426 // Remove existing layout from it's parent layout group.
2429 value.SetPositionByLayout = !excludeLayouting;
2431 // Set layout to this view
2437 /// The weight of the View, used to share available space in a layout with siblings.
2439 /// <since_tizen> 6 </since_tizen>
2449 layout?.RequestLayout();
2454 /// Whether to load the BackgroundImage synchronously.
2455 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2456 /// Note: For Normal Quad images only.
2458 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2459 [EditorBrowsable(EditorBrowsableState.Never)]
2460 public bool BackgroundImageSynchronosLoading
2464 return backgroundImageSynchronosLoading;
2468 backgroundImageSynchronosLoading = value;
2470 string bgUrl = null;
2471 var pValue = Background.Find(ImageVisualProperty.URL);
2472 pValue?.Get(out bgUrl);
2475 if (!string.IsNullOrEmpty(bgUrl))
2477 PropertyMap bgMap = this.Background;
2478 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2479 bgMap.Add("synchronousLoading", temp);
2486 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2487 [EditorBrowsable(EditorBrowsableState.Never)]
2488 public Vector2 UpdateSizeHint
2492 return (Vector2)GetValue(UpdateSizeHintProperty);
2496 SetValue(UpdateSizeHintProperty, value);
2497 NotifyPropertyChanged();
2502 /// Enable/Disable ControlState propagation for children.
2503 /// It is false by default.
2504 /// If the View needs to share ControlState with descendants, please set it true.
2505 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2507 [EditorBrowsable(EditorBrowsableState.Never)]
2508 public bool EnableControlStatePropagation
2510 get => themeData?.controlStatePropagation ?? false;
2513 if (EnableControlStatePropagation == value) return;
2515 if (themeData == null) themeData = new ThemeData();
2517 themeData.controlStatePropagation = value;
2519 foreach (View child in Children)
2521 child.EnableControlStatePropagation = value;
2527 /// By default, it is false in View, true in Control.
2528 /// Note that if the value is true, the View will be a touch receptor.
2530 [EditorBrowsable(EditorBrowsableState.Never)]
2531 public bool EnableControlState
2535 return (bool)GetValue(EnableControlStateProperty);
2539 SetValue(EnableControlStateProperty, value);
2544 /// Whether the actor grab all touches even if touch leaves its boundary.
2546 /// <returns>true, if it grab all touch after start</returns>
2547 [EditorBrowsable(EditorBrowsableState.Never)]
2548 public bool GrabTouchAfterLeave
2553 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2554 pValue.Get(out temp);
2560 var temp = new Tizen.NUI.PropertyValue(value);
2561 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2563 NotifyPropertyChanged();
2568 /// Determines which blend equation will be used to render renderers of this actor.
2570 /// <returns>blend equation enum currently assigned</returns>
2571 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2572 [EditorBrowsable(EditorBrowsableState.Never)]
2573 public BlendEquationType BlendEquation
2578 var pValue = GetProperty(View.Property.BlendEquation);
2579 pValue.Get(out temp);
2581 return (BlendEquationType)temp;
2585 var temp = new Tizen.NUI.PropertyValue((int)value);
2586 SetProperty(View.Property.BlendEquation, temp);
2588 NotifyPropertyChanged();
2593 /// If the value is true, the View will change its style as the theme changes.
2594 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2596 /// <since_tizen> 9 </since_tizen>
2597 public bool ThemeChangeSensitive
2599 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2600 set => SetValue(ThemeChangeSensitiveProperty, value);
2604 /// Create Style, it is abstract function and must be override.
2606 [EditorBrowsable(EditorBrowsableState.Never)]
2607 protected virtual ViewStyle CreateViewStyle()
2609 return new ViewStyle();
2613 /// Called after the View's ControlStates changed.
2615 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2616 [EditorBrowsable(EditorBrowsableState.Never)]
2617 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2623 [EditorBrowsable(EditorBrowsableState.Never)]
2624 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2630 /// Apply style instance to the view.
2631 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2633 /// <since_tizen> 9 </since_tizen>
2634 public virtual void ApplyStyle(ViewStyle viewStyle)
2636 if (viewStyle == null || themeData?.viewStyle == viewStyle) return;
2638 if (themeData == null) themeData = new ThemeData();
2640 themeData.viewStyle = viewStyle;
2642 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2648 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2650 if (bindablePropertyOfView == null)
2655 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2656 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2658 foreach (var sourceProperty in dirtyStyleProperties)
2660 var sourceValue = viewStyle.GetValue(sourceProperty);
2662 if (sourceValue == null)
2667 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2669 if (destinationProperty != null)
2671 SetValue(destinationProperty, sourceValue);
2677 /// Get whether the View is culled or not.
2678 /// True means that the View is out of the view frustum.
2681 /// Hidden-API (Inhouse-API).
2683 [EditorBrowsable(EditorBrowsableState.Never)]
2689 var pValue = GetProperty(View.Property.Culled);
2690 pValue.Get(out temp);
2697 /// Set or Get TransitionOptions for the page transition.
2698 /// This property is used to define how this view will be transitioned during Page switching.
2700 /// <since_tizen> 9 </since_tizen>
2701 public TransitionOptions TransitionOptions
2705 transitionOptions = value;
2709 return transitionOptions;