2 * Copyright(c) 2019 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;
22 using Tizen.NUI.Components;
24 namespace Tizen.NUI.BaseComponents
27 /// View is the base class for all views.
29 /// <since_tizen> 3 </since_tizen>
30 public partial class View : Container, IResourcesProvider
33 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
35 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
36 [EditorBrowsable(EditorBrowsableState.Never)]
37 public bool layoutSet = false;
40 /// Flag to allow Layouting to be disabled for Views.
41 /// Once a View has a Layout set then any children added to Views from then on will receive
42 /// automatic Layouts.
44 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
45 [EditorBrowsable(EditorBrowsableState.Never)]
46 public static bool layoutingDisabled{get; set;} = true;
48 private LayoutItem _layout; // Exclusive layout assigned to this View.
50 // List of transitions paired with the condition that uses the transition.
51 private Dictionary<TransitionCondition, TransitionList> _layoutTransitions;
52 private int _widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
53 private int _heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
54 private int _oldWidthPolicy = LayoutParamPolicies.MatchParent; // // Store Layout width to compare against later
55 private int _oldHeightPolicy = LayoutParamPolicies.MatchParent; // Store Layout height to compare against later
56 private float _weight = 0.0f; // Weighting of child View in a Layout
57 private MeasureSpecification _measureSpecificationWidth; // Layout width and internal Mode
58 private MeasureSpecification _measureSpecificationHeight; // Layout height and internal Mode
59 private bool _backgroundImageSynchronosLoading = false;
60 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
61 private string[] transitionNames;
62 private bool controlStatePropagation = false;
63 private ViewStyle viewStyle;
64 private bool themeChangeSensitive = false;
66 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
67 internal BackgroundExtraData backgroundExtraData;
71 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
72 [EditorBrowsable(EditorBrowsableState.Never)]
73 public ViewStyle ViewStyle
77 if (null == viewStyle)
79 ApplyStyle(GetViewStyle());
87 /// Creates a new instance of a view.
89 /// <since_tizen> 3 </since_tizen>
90 public View() : this(Interop.View.View_New(), true)
92 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
95 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
96 [EditorBrowsable(EditorBrowsableState.Never)]
97 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true, viewStyle)
102 /// Create a new instance of a View with setting the status of shown or hidden.
104 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
105 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
106 [EditorBrowsable(EditorBrowsableState.Never)]
107 public View(bool shown) : this(Interop.View.View_New(), true)
109 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
115 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
124 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
126 ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle?.Clone());
129 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
133 PositionUsesPivotPoint = false;
136 _onWindowSendEventCallback = SendViewAddedEventToWindow;
137 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
145 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
147 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
156 /// The event that is triggered when the View's ControlState is changed.
158 [EditorBrowsable(EditorBrowsableState.Never)]
159 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
161 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
163 private ControlState controlStates = ControlState.Normal;
165 /// Get/Set the control state.
167 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
168 [EditorBrowsable(EditorBrowsableState.Never)]
169 public ControlState ControlState
173 return controlStates;
177 if (controlStates == value)
182 var prevState = controlStates;
184 controlStates = value;
186 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
188 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
190 if (controlStatePropagation)
192 foreach (View child in Children)
194 child.ControlState = value;
198 OnControlStateChanged(changeInfo);
200 ControlStateChangedEvent?.Invoke(this, changeInfo);
204 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
205 [EditorBrowsable(EditorBrowsableState.Never)]
206 public bool IsResourcesCreated
210 return Application.Current.IsResourcesCreated;
214 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
215 [EditorBrowsable(EditorBrowsableState.Never)]
216 public ResourceDictionary XamlResources
220 return Application.Current.XamlResources;
224 Application.Current.XamlResources = value;
229 /// The StyleName, type string.
230 /// The value indicates DALi style name defined in json theme file.
232 /// <since_tizen> 3 </since_tizen>
233 public string StyleName
237 return (string)GetValue(StyleNameProperty);
241 SetValue(StyleNameProperty, value);
242 NotifyPropertyChanged();
247 /// The KeyInputFocus, type bool.
249 [EditorBrowsable(EditorBrowsableState.Never)]
250 public bool KeyInputFocus
254 return (bool)GetValue(KeyInputFocusProperty);
258 SetValue(KeyInputFocusProperty, value);
259 NotifyPropertyChanged();
264 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
267 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
269 /// <since_tizen> 3 </since_tizen>
270 public Color BackgroundColor
274 Color temp = (Color)GetValue(BackgroundColorProperty);
275 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
279 SetValue(BackgroundColorProperty, value);
280 if (selectorData != null)
282 selectorData.BackgroundImage.Reset(this);
283 selectorData.BackgroundColor.UpdateIfNeeds(this, value);
285 NotifyPropertyChanged();
290 /// The mutually exclusive with "backgroundColor" and "background" type Map.
292 /// <since_tizen> 3 </since_tizen>
293 public string BackgroundImage
297 return (string)GetValue(BackgroundImageProperty);
301 SetValue(BackgroundImageProperty, value);
302 if (selectorData != null)
304 selectorData.BackgroundColor.Reset(this);
305 selectorData.BackgroundImage.UpdateIfNeeds(this, value);
307 NotifyPropertyChanged();
312 /// Get or set the border of background image.
314 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
315 [EditorBrowsable(EditorBrowsableState.Never)]
316 public Rectangle BackgroundImageBorder
320 return (Rectangle)GetValue(BackgroundImageBorderProperty);
324 SetValue(BackgroundImageBorderProperty, value);
325 selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value);
326 NotifyPropertyChanged();
331 /// The background of view.
333 /// <since_tizen> 3 </since_tizen>
334 public Tizen.NUI.PropertyMap Background
338 return (PropertyMap)GetValue(BackgroundProperty);
342 SetValue(BackgroundProperty, value);
343 NotifyPropertyChanged();
348 /// Describes a shadow as an image for a View.
349 /// It is null by default.
352 /// Getter returns copied instance of current shadow.
355 /// The mutually exclusive with "BoxShadow".
357 [EditorBrowsable(EditorBrowsableState.Never)]
358 public ImageShadow ImageShadow
362 return (ImageShadow)GetValue(ImageShadowProperty);
366 SetValue(ImageShadowProperty, value);
367 if (selectorData != null)
369 selectorData.BoxShadow.Reset(this);
370 selectorData.ImageShadow.UpdateIfNeeds(this, value);
372 NotifyPropertyChanged();
377 /// Describes a box shaped shadow drawing for a View.
378 /// It is null by default.
381 /// Gettter returns copied instance of current shadow.
384 /// The mutually exclusive with "ImageShadow".
386 [EditorBrowsable(EditorBrowsableState.Never)]
387 public Shadow BoxShadow
391 return (Shadow)GetValue(BoxShadowProperty);
395 SetValue(BoxShadowProperty, value);
396 if (selectorData != null)
398 selectorData.ImageShadow.Reset(this);
399 selectorData.BoxShadow.UpdateIfNeeds(this, value);
401 NotifyPropertyChanged();
406 /// The radius for the rounded corners of the View.
407 /// This will rounds background and shadow edges.
408 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
410 [EditorBrowsable(EditorBrowsableState.Never)]
411 public float CornerRadius
415 return (float)GetValue(CornerRadiusProperty);
419 SetValue(CornerRadiusProperty, value);
420 selectorData?.CornerRadius.UpdateIfNeeds(this, value);
421 NotifyPropertyChanged();
426 /// The current state of the view.
428 /// <since_tizen> 3 </since_tizen>
433 return (States)GetValue(StateProperty);
437 SetValue(StateProperty, value);
438 NotifyPropertyChanged();
443 /// The current sub state of the view.
445 /// <since_tizen> 3 </since_tizen>
446 public States SubState
450 return (States)GetValue(SubStateProperty);
454 SetValue(SubStateProperty, value);
455 NotifyPropertyChanged();
460 /// Displays a tooltip
462 /// <since_tizen> 3 </since_tizen>
463 public Tizen.NUI.PropertyMap Tooltip
467 return (PropertyMap)GetValue(TooltipProperty);
471 SetValue(TooltipProperty, value);
472 NotifyPropertyChanged();
477 /// Displays a tooltip as a text.
479 /// <since_tizen> 3 </since_tizen>
480 public string TooltipText
484 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
485 NotifyPropertyChanged();
490 /// The Child property of FlexContainer.<br />
491 /// The proportion of the free space in the container, the flex item will receive.<br />
492 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
494 /// <since_tizen> 3 </since_tizen>
495 [Obsolete("Deprecated in API8, will be removed in API10.")]
500 return (float)GetValue(FlexProperty);
504 SetValue(FlexProperty, value);
505 NotifyPropertyChanged();
510 /// The Child property of FlexContainer.<br />
511 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
513 /// <since_tizen> 3 </since_tizen>
514 [Obsolete("Deprecated in API8, will be removed in API10.")]
519 return (int)GetValue(AlignSelfProperty);
523 SetValue(AlignSelfProperty, value);
524 NotifyPropertyChanged();
529 /// The Child property of FlexContainer.<br />
530 /// The space around the flex item.<br />
533 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
535 /// <since_tizen> 3 </since_tizen>
536 [Obsolete("Deprecated in API8, will be removed in API10.")]
537 public Vector4 FlexMargin
541 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
542 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
546 SetValue(FlexMarginProperty, value);
547 NotifyPropertyChanged();
552 /// The top-left cell this child occupies, if not set, the first available cell is used.
555 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
557 /// <since_tizen> 3 </since_tizen>
558 public Vector2 CellIndex
562 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
563 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
567 SetValue(CellIndexProperty, value);
568 NotifyPropertyChanged();
573 /// The number of rows this child occupies, if not set, the default value is 1.
575 /// <since_tizen> 3 </since_tizen>
580 return (float)GetValue(RowSpanProperty);
584 SetValue(RowSpanProperty, value);
585 NotifyPropertyChanged();
590 /// The number of columns this child occupies, if not set, the default value is 1.
592 /// <since_tizen> 3 </since_tizen>
593 public float ColumnSpan
597 return (float)GetValue(ColumnSpanProperty);
601 SetValue(ColumnSpanProperty, value);
602 NotifyPropertyChanged();
607 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
609 /// <since_tizen> 3 </since_tizen>
610 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
614 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
618 SetValue(CellHorizontalAlignmentProperty, value);
619 NotifyPropertyChanged();
624 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
626 /// <since_tizen> 3 </since_tizen>
627 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
631 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
635 SetValue(CellVerticalAlignmentProperty, value);
636 NotifyPropertyChanged();
641 /// The left focusable view.<br />
642 /// This will return null if not set.<br />
643 /// This will also return null if the specified left focusable view is not on a window.<br />
645 /// <since_tizen> 3 </since_tizen>
646 public View LeftFocusableView
648 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
651 return (View)GetValue(LeftFocusableViewProperty);
655 SetValue(LeftFocusableViewProperty, value);
656 NotifyPropertyChanged();
661 /// The right focusable view.<br />
662 /// This will return null if not set.<br />
663 /// This will also return null if the specified right focusable view is not on a window.<br />
665 /// <since_tizen> 3 </since_tizen>
666 public View RightFocusableView
668 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
671 return (View)GetValue(RightFocusableViewProperty);
675 SetValue(RightFocusableViewProperty, value);
676 NotifyPropertyChanged();
681 /// The up focusable view.<br />
682 /// This will return null if not set.<br />
683 /// This will also return null if the specified up focusable view is not on a window.<br />
685 /// <since_tizen> 3 </since_tizen>
686 public View UpFocusableView
688 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
691 return (View)GetValue(UpFocusableViewProperty);
695 SetValue(UpFocusableViewProperty, value);
696 NotifyPropertyChanged();
701 /// The down focusable view.<br />
702 /// This will return null if not set.<br />
703 /// This will also return null if the specified down focusable view is not on a window.<br />
705 /// <since_tizen> 3 </since_tizen>
706 public View DownFocusableView
708 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
711 return (View)GetValue(DownFocusableViewProperty);
715 SetValue(DownFocusableViewProperty, value);
716 NotifyPropertyChanged();
721 /// Whether the view should be focusable by keyboard navigation.
723 /// <since_tizen> 3 </since_tizen>
724 public bool Focusable
728 SetValue(FocusableProperty, value);
729 NotifyPropertyChanged();
733 return (bool)GetValue(FocusableProperty);
738 /// Retrieves the position of the view.<br />
739 /// The coordinates are relative to the view's parent.<br />
741 /// <since_tizen> 3 </since_tizen>
742 public Position CurrentPosition
746 return GetCurrentPosition();
751 /// Sets the size of a view for the width and the height.<br />
752 /// Geometry can be scaled to fit within this area.<br />
753 /// This does not interfere with the view's scale factor.<br />
754 /// The views default depth is the minimum of width and height.<br />
757 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
758 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
760 /// <since_tizen> 3 </since_tizen>
765 Size2D temp = (Size2D)GetValue(Size2DProperty);
767 if (this.Layout == null)
769 if (temp.Width < 0) { temp.Width = 0; }
770 if (temp.Height < 0) { temp.Height = 0; }
773 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
777 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
778 SetValue(Size2DProperty, value);
779 // Set Specification so when layouts measure this View it matches the value set here.
780 // All Views are currently Layouts.
781 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
782 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
783 _widthPolicy = value.Width;
784 _heightPolicy = value.Height;
786 _layout?.RequestLayout();
787 NotifyPropertyChanged();
792 /// Retrieves the size of the view.<br />
793 /// The coordinates are relative to the view's parent.<br />
795 /// <since_tizen> 3 </since_tizen>
796 public Size2D CurrentSize
800 return GetCurrentSize();
805 /// Retrieves and sets the view's opacity.<br />
807 /// <since_tizen> 3 </since_tizen>
812 return (float)GetValue(OpacityProperty);
816 SetValue(OpacityProperty, value);
817 selectorData?.Opacity.UpdateIfNeeds(this, value);
818 NotifyPropertyChanged();
823 /// Sets the position of the view for X and Y.<br />
824 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
825 /// If the position inheritance is disabled, sets the world position.<br />
828 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
829 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
831 /// <since_tizen> 3 </since_tizen>
832 public Position2D Position2D
836 Position2D temp = (Position2D)GetValue(Position2DProperty);
837 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
841 SetValue(Position2DProperty, value);
842 NotifyPropertyChanged();
847 /// Retrieves the screen postion of the view.<br />
849 /// <since_tizen> 3 </since_tizen>
850 public Vector2 ScreenPosition
854 Vector2 temp = new Vector2(0.0f, 0.0f);
855 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
861 /// Determines whether the pivot point should be used to determine the position of the view.
862 /// This is false by default.
864 /// <remarks>If false, then the top-left of the view is used for the position.
865 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
867 /// <since_tizen> 3 </since_tizen>
868 public bool PositionUsesPivotPoint
872 return (bool)GetValue(PositionUsesPivotPointProperty);
876 SetValue(PositionUsesPivotPointProperty, value);
877 NotifyPropertyChanged();
882 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
884 /// <since_tizen> 3 </since_tizen>
885 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
887 "View view = new View(); " +
888 "view.PivotPoint = PivotPoint.Center; " +
889 "view.PositionUsesPivotPoint = true;" +
890 " Deprecated in API5: Will be removed in API8")]
891 [EditorBrowsable(EditorBrowsableState.Never)]
892 public bool PositionUsesAnchorPoint
897 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
902 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
903 NotifyPropertyChanged();
908 /// Queries whether the view is connected to the stage.<br />
909 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
911 /// <since_tizen> 3 </since_tizen>
912 public bool IsOnWindow
921 /// Gets the depth in the hierarchy for the view.
923 /// <since_tizen> 3 </since_tizen>
924 public int HierarchyDepth
928 return GetHierarchyDepth();
933 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
936 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
937 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
938 /// The values set by this property will likely change.
940 /// <since_tizen> 3 </since_tizen>
941 public int SiblingOrder
945 return (int)GetValue(SiblingOrderProperty);
949 SetValue(SiblingOrderProperty, value);
951 LayoutGroup layout = Layout as LayoutGroup;
952 layout?.ChangeLayoutSiblingOrder(value);
954 NotifyPropertyChanged();
959 /// Returns the natural size of the view.
962 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
964 /// <since_tizen> 5 </since_tizen>
965 public Vector3 NaturalSize
969 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
970 if (NDalicPINVOKE.SWIGPendingException.Pending)
971 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
977 /// Returns the natural size (Size2D) of the view.
980 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
982 /// <since_tizen> 4 </since_tizen>
983 public Size2D NaturalSize2D
987 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
988 if (NDalicPINVOKE.SWIGPendingException.Pending)
989 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
991 return new Size2D((int)temp.Width, (int)temp.Height);
996 /// Gets or sets the origin of a view within its parent's area.<br />
997 /// 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 />
998 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
999 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1001 /// <pre>The view has been initialized.</pre>
1002 /// <since_tizen> 3 </since_tizen>
1003 public Position ParentOrigin
1007 Position tmp = (Position)GetValue(ParentOriginProperty);
1008 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1012 SetValue(ParentOriginProperty, value);
1013 NotifyPropertyChanged();
1018 /// Gets or sets the anchor-point of a view.<br />
1019 /// 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 />
1020 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1021 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1022 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1023 /// <pre>The view has been initialized.</pre>
1026 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1028 /// <since_tizen> 3 </since_tizen>
1029 public Position PivotPoint
1033 Position tmp = (Position)GetValue(PivotPointProperty);
1034 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1038 SetValue(PivotPointProperty, value);
1039 NotifyPropertyChanged();
1044 /// Gets or sets the size width of the view.
1048 /// Animatable - This property can be animated using <c>Animation</c> class.
1051 /// <since_tizen> 3 </since_tizen>
1052 public float SizeWidth
1056 return (float)GetValue(SizeWidthProperty);
1060 SetValue(SizeWidthProperty, value);
1061 NotifyPropertyChanged();
1066 /// Gets or sets the size height of the view.
1070 /// Animatable - This property can be animated using <c>Animation</c> class.
1073 /// <since_tizen> 3 </since_tizen>
1074 public float SizeHeight
1078 return (float)GetValue(SizeHeightProperty);
1082 SetValue(SizeHeightProperty, value);
1083 NotifyPropertyChanged();
1088 /// Gets or sets the position of the view.<br />
1089 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1090 /// If the position inheritance is disabled, sets the world position.<br />
1094 /// Animatable - This property can be animated using <c>Animation</c> class.
1096 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1098 /// <since_tizen> 3 </since_tizen>
1099 public Position Position
1103 Position tmp = (Position)GetValue(PositionProperty);
1104 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1108 SetValue(PositionProperty, value);
1109 NotifyPropertyChanged();
1114 /// Gets or sets the position X of the view.
1118 /// Animatable - This property can be animated using <c>Animation</c> class.
1121 /// <since_tizen> 3 </since_tizen>
1122 public float PositionX
1126 return (float)GetValue(PositionXProperty);
1130 SetValue(PositionXProperty, value);
1131 NotifyPropertyChanged();
1136 /// Gets or sets the position Y of the view.
1140 /// Animatable - This property can be animated using <c>Animation</c> class.
1143 /// <since_tizen> 3 </since_tizen>
1144 public float PositionY
1148 return (float)GetValue(PositionYProperty);
1152 SetValue(PositionYProperty, value);
1153 NotifyPropertyChanged();
1158 /// Gets or sets the position Z of the view.
1162 /// Animatable - This property can be animated using <c>Animation</c> class.
1165 /// <since_tizen> 3 </since_tizen>
1166 public float PositionZ
1170 return (float)GetValue(PositionZProperty);
1174 SetValue(PositionZProperty, value);
1175 NotifyPropertyChanged();
1180 /// Gets or sets the world position of the view.
1182 /// <since_tizen> 3 </since_tizen>
1183 public Vector3 WorldPosition
1187 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1188 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1194 /// Gets or sets the orientation of the view.<br />
1195 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1199 /// This is an asynchronous method.
1202 /// Animatable - This property can be animated using <c>Animation</c> class.
1205 /// <since_tizen> 3 </since_tizen>
1206 public Rotation Orientation
1210 return (Rotation)GetValue(OrientationProperty);
1214 SetValue(OrientationProperty, value);
1215 NotifyPropertyChanged();
1220 /// Gets or sets the world orientation of the view.<br />
1222 /// <since_tizen> 3 </since_tizen>
1223 public Rotation WorldOrientation
1227 Rotation temp = new Rotation();
1228 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1234 /// Gets or sets the scale factor applied to the view.<br />
1238 /// Animatable - This property can be animated using <c>Animation</c> class.
1240 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1242 /// <since_tizen> 3 </since_tizen>
1243 public Vector3 Scale
1247 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1248 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1252 SetValue(ScaleProperty, value);
1253 NotifyPropertyChanged();
1258 /// Gets or sets the scale X factor applied to the view.
1262 /// Animatable - This property can be animated using <c>Animation</c> class.
1265 /// <since_tizen> 3 </since_tizen>
1270 return (float)GetValue(ScaleXProperty);
1274 SetValue(ScaleXProperty, value);
1275 NotifyPropertyChanged();
1280 /// Gets or sets the scale Y factor applied to the view.
1284 /// Animatable - This property can be animated using <c>Animation</c> class.
1287 /// <since_tizen> 3 </since_tizen>
1292 return (float)GetValue(ScaleYProperty);
1296 SetValue(ScaleYProperty, value);
1297 NotifyPropertyChanged();
1302 /// Gets or sets the scale Z factor applied to the view.
1306 /// Animatable - This property can be animated using <c>Animation</c> class.
1309 /// <since_tizen> 3 </since_tizen>
1314 return (float)GetValue(ScaleZProperty);
1318 SetValue(ScaleZProperty, value);
1319 NotifyPropertyChanged();
1324 /// Gets the world scale of the view.
1326 /// <since_tizen> 3 </since_tizen>
1327 public Vector3 WorldScale
1331 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1332 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1338 /// Retrieves the visibility flag of the view.
1342 /// If the view is not visible, then the view and its children will not be rendered.
1343 /// 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.
1346 /// Animatable - This property can be animated using <c>Animation</c> class.
1349 /// <since_tizen> 3 </since_tizen>
1350 public bool Visibility
1355 GetProperty(View.Property.VISIBLE).Get(out temp);
1361 /// Gets the view's world color.
1363 /// <since_tizen> 3 </since_tizen>
1364 public Vector4 WorldColor
1368 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1369 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1375 /// Gets or sets the view's name.
1377 /// <since_tizen> 3 </since_tizen>
1382 return (string)GetValue(NameProperty);
1386 SetValue(NameProperty, value);
1387 NotifyPropertyChanged();
1392 /// Get the number of children held by the view.
1394 /// <since_tizen> 3 </since_tizen>
1395 public new uint ChildCount
1399 return GetChildCount();
1404 /// Gets the view's ID.
1407 /// <since_tizen> 3 </since_tizen>
1417 /// Gets or sets the status of whether the view should emit touch or hover signals.
1419 /// <since_tizen> 3 </since_tizen>
1420 public bool Sensitive
1424 return (bool)GetValue(SensitiveProperty);
1428 SetValue(SensitiveProperty, value);
1429 NotifyPropertyChanged();
1434 /// 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.
1436 /// <since_tizen> 3 </since_tizen>
1437 public bool LeaveRequired
1441 return (bool)GetValue(LeaveRequiredProperty);
1445 SetValue(LeaveRequiredProperty, value);
1446 NotifyPropertyChanged();
1451 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1453 /// <since_tizen> 3 </since_tizen>
1454 public bool InheritOrientation
1458 return (bool)GetValue(InheritOrientationProperty);
1462 SetValue(InheritOrientationProperty, value);
1463 NotifyPropertyChanged();
1468 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1470 /// <since_tizen> 3 </since_tizen>
1471 public bool InheritScale
1475 return (bool)GetValue(InheritScaleProperty);
1479 SetValue(InheritScaleProperty, value);
1480 NotifyPropertyChanged();
1485 /// Gets or sets the status of how the view and its children should be drawn.<br />
1486 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1487 /// 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 />
1488 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1489 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1490 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1492 /// <since_tizen> 3 </since_tizen>
1493 public DrawModeType DrawMode
1497 return (DrawModeType)GetValue(DrawModeProperty);
1501 SetValue(DrawModeProperty, value);
1502 NotifyPropertyChanged();
1507 /// Gets or sets the relative to parent size factor of the view.<br />
1508 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1509 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1512 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1514 /// <since_tizen> 3 </since_tizen>
1515 public Vector3 SizeModeFactor
1519 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1520 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1524 SetValue(SizeModeFactorProperty, value);
1525 NotifyPropertyChanged();
1530 /// Gets or sets the width resize policy to be used.
1532 /// <since_tizen> 3 </since_tizen>
1533 public ResizePolicyType WidthResizePolicy
1537 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1541 SetValue(WidthResizePolicyProperty, value);
1542 NotifyPropertyChanged();
1547 /// Gets or sets the height resize policy to be used.
1549 /// <since_tizen> 3 </since_tizen>
1550 public ResizePolicyType HeightResizePolicy
1554 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1558 SetValue(HeightResizePolicyProperty, value);
1559 NotifyPropertyChanged();
1564 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1565 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1567 /// <since_tizen> 3 </since_tizen>
1568 public SizeScalePolicyType SizeScalePolicy
1572 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1576 SetValue(SizeScalePolicyProperty, value);
1577 NotifyPropertyChanged();
1582 /// Gets or sets the status of whether the width size is dependent on the height size.
1584 /// <since_tizen> 3 </since_tizen>
1585 public bool WidthForHeight
1589 return (bool)GetValue(WidthForHeightProperty);
1593 SetValue(WidthForHeightProperty, value);
1594 NotifyPropertyChanged();
1599 /// Gets or sets the status of whether the height size is dependent on the width size.
1601 /// <since_tizen> 3 </since_tizen>
1602 public bool HeightForWidth
1606 return (bool)GetValue(HeightForWidthProperty);
1610 SetValue(HeightForWidthProperty, value);
1611 NotifyPropertyChanged();
1616 /// Gets or sets the padding for use in layout.
1619 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1621 /// <since_tizen> 5 </since_tizen>
1622 public Extents Padding
1626 // If View has a Layout then padding in stored in the base Layout class
1629 return Layout.Padding;
1633 Extents temp = (Extents)GetValue(PaddingProperty);
1634 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1636 // Two return points to prevent creating a zeroed Extent native object before assignment
1640 Extents padding = value;
1643 // Layout set so store Padding in LayoutItem instead of in View.
1644 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1645 // the position and sizes measure in the Layouting.
1646 Layout.Padding = value;
1647 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1648 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1649 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1651 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1655 SetValue(PaddingProperty, padding);
1656 NotifyPropertyChanged();
1661 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1664 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1666 /// <since_tizen> 3 </since_tizen>
1667 public Size2D MinimumSize
1671 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1672 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1676 if (_layout != null)
1678 // Note: it only works if minimum size is >= than natural size.
1679 // To force the size it should be done through the width&height spec or Size2D.
1680 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1681 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1682 _layout.RequestLayout();
1684 SetValue(MinimumSizeProperty, value);
1685 NotifyPropertyChanged();
1690 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1693 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1695 /// <since_tizen> 3 </since_tizen>
1696 public Size2D MaximumSize
1700 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1701 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1705 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1706 // MATCH_PARENT spec + parent container size can be used to limit
1707 if (_layout != null)
1709 _layout.RequestLayout();
1711 SetValue(MaximumSizeProperty, value);
1712 NotifyPropertyChanged();
1717 /// Gets or sets whether a child view inherits it's parent's position.<br />
1718 /// Default is to inherit.<br />
1719 /// 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 />
1721 /// <since_tizen> 3 </since_tizen>
1722 public bool InheritPosition
1726 return (bool)GetValue(InheritPositionProperty);
1730 SetValue(InheritPositionProperty, value);
1731 NotifyPropertyChanged();
1736 /// Gets or sets the clipping behavior (mode) of it's children.
1738 /// <since_tizen> 3 </since_tizen>
1739 public ClippingModeType ClippingMode
1743 return (ClippingModeType)GetValue(ClippingModeProperty);
1747 SetValue(ClippingModeProperty, value);
1748 NotifyPropertyChanged();
1753 /// Gets the number of renderers held by the view.
1755 /// <since_tizen> 3 </since_tizen>
1756 public uint RendererCount
1760 return GetRendererCount();
1765 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1768 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1770 /// <since_tizen> 3 </since_tizen>
1771 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1773 "View view = new View(); " +
1774 "view.PivotPoint = PivotPoint.Center; " +
1775 "view.PositionUsesPivotPoint = true;")]
1776 [EditorBrowsable(EditorBrowsableState.Never)]
1777 public Position AnchorPoint
1781 Position temp = new Position(0.0f, 0.0f, 0.0f);
1782 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1783 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1787 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1788 NotifyPropertyChanged();
1793 /// Sets the size of a view for the width, the height and the depth.<br />
1794 /// Geometry can be scaled to fit within this area.<br />
1795 /// This does not interfere with the view's scale factor.<br />
1796 /// The views default depth is the minimum of width and height.<br />
1800 /// Animatable - This property can be animated using <c>Animation</c> class.
1802 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1804 /// <since_tizen> 5 </since_tizen>
1809 Size tmp = (Size)GetValue(SizeProperty);
1810 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1814 SetValue(SizeProperty, value);
1815 NotifyPropertyChanged();
1820 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1822 /// <since_tizen> 3 </since_tizen>
1823 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1825 "Container parent = view.GetParent(); " +
1826 "View view = parent as View;")]
1827 [EditorBrowsable(EditorBrowsableState.Never)]
1828 public new View Parent
1833 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1834 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1835 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1837 if (basehandle is Layer layer)
1839 ret = new View(Layer.getCPtr(layer).Handle, false);
1840 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1844 ret = basehandle as View;
1847 Interop.BaseHandle.delete_BaseHandle(CPtr);
1848 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1850 if (NDalicPINVOKE.SWIGPendingException.Pending)
1851 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1857 /// Gets/Sets whether inherit parent's the layout Direction.
1859 /// <since_tizen> 4 </since_tizen>
1860 public bool InheritLayoutDirection
1864 return (bool)GetValue(InheritLayoutDirectionProperty);
1868 SetValue(InheritLayoutDirectionProperty, value);
1869 NotifyPropertyChanged();
1874 /// Gets/Sets the layout Direction.
1876 /// <since_tizen> 4 </since_tizen>
1877 public ViewLayoutDirectionType LayoutDirection
1881 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1885 SetValue(LayoutDirectionProperty, value);
1886 NotifyPropertyChanged();
1887 _layout?.RequestLayout();
1892 /// Gets or sets the Margin for use in layout.
1895 /// Margin property is supported by Layout algorithms and containers.
1896 /// Please Set Layout if you want to use Margin property.
1897 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1899 /// <since_tizen> 4 </since_tizen>
1900 public Extents Margin
1904 // If View has a Layout then margin is stored in Layout.
1907 return Layout.Margin;
1911 // If Layout not set then return margin stored in View.
1912 Extents temp = (Extents)GetValue(MarginProperty);
1913 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1915 // Two return points to prevent creating a zeroed Extent native object before assignment
1921 // Layout set so store Margin in LayoutItem instead of View.
1922 // If View stores the Margin too then the Legacy Size Negotiation will
1923 // overwrite the position and size values measured in the Layouting.
1924 Layout.Margin = value;
1925 SetValue(MarginProperty, new Extents(0,0,0,0));
1926 _layout?.RequestLayout();
1930 SetValue(MarginProperty, value);
1932 NotifyPropertyChanged();
1933 _layout?.RequestLayout();
1938 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1940 /// <since_tizen> 6 </since_tizen>
1941 public int WidthSpecification
1945 return _widthPolicy;
1949 _widthPolicy = value;
1950 if( _oldWidthPolicy != _widthPolicy )
1952 if (_widthPolicy >= 0)
1954 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1956 if(_heightPolicy>=0) // Policy an exact value
1958 // Create Size2D only both _widthPolicy and _heightPolicy are set.
1959 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1962 _layout?.RequestLayout();
1963 _oldWidthPolicy = _widthPolicy;
1969 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1971 /// <since_tizen> 6 </since_tizen>
1972 public int HeightSpecification
1976 return _heightPolicy;
1980 _heightPolicy = value;
1981 if( _oldHeightPolicy != _heightPolicy )
1983 if (_heightPolicy >= 0)
1985 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1987 if(_widthPolicy>=0) // Policy an exact value
1989 // Create Size2D only both _widthPolicy and _heightPolicy are set.
1990 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1994 _layout?.RequestLayout();
1995 _oldHeightPolicy = _heightPolicy;
2001 /// Gets the List of transitions for this View.
2003 /// <since_tizen> 6 </since_tizen>
2004 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2008 if (_layoutTransitions == null)
2010 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2012 return _layoutTransitions;
2017 /// Set a layout transitions for this View.
2020 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2022 /// <since_tizen> 6 </since_tizen>
2023 public LayoutTransition LayoutTransition
2027 if (_layoutTransitions == null)
2029 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2031 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2033 AttachTransitionsToChildren(value);
2038 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2041 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2043 /// <since_tizen> 4 </since_tizen>
2044 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2045 [EditorBrowsable(EditorBrowsableState.Never)]
2046 public Extents PaddingEX
2050 Extents temp = new Extents(0, 0, 0, 0);
2051 GetProperty(View.Property.PADDING).Get(temp);
2052 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2056 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2057 NotifyPropertyChanged();
2058 _layout?.RequestLayout();
2062 /// <since_tizen> 6 </since_tizen>
2063 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2064 [EditorBrowsable(EditorBrowsableState.Never)]
2065 public Style XamlStyle
2069 return (Style)GetValue(XamlStyleProperty);
2073 SetValue(XamlStyleProperty, value);
2078 /// The Color of View. This is an RGBA value.
2082 /// Animatable - This property can be animated using <c>Animation</c> class.
2084 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2086 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2087 [EditorBrowsable(EditorBrowsableState.Never)]
2092 Color temp = (Color)GetValue(ColorProperty);
2093 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2097 SetValue(ColorProperty, value);
2098 selectorData?.Color.UpdateIfNeeds(this, value);
2099 NotifyPropertyChanged();
2104 /// Set the layout on this View. Replaces any existing Layout.
2106 /// <since_tizen> 6 </since_tizen>
2107 public LayoutItem Layout
2115 // Do nothing if layout provided is already set on this View.
2116 if (value == _layout)
2121 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2122 layoutingDisabled = false;
2125 // If new layout being set already has a owner then that owner receives a replacement default layout.
2126 // First check if the layout to be set already has a owner.
2127 if (value?.Owner != null)
2129 // Previous owner of the layout gets a default layout as a replacement.
2130 value.Owner.Layout = new AbsoluteLayout();
2132 // Copy Margin and Padding to replacement LayoutGroup.
2133 if (value.Owner.Layout != null)
2135 value.Owner.Layout.Margin = value.Margin;
2136 value.Owner.Layout.Padding = value.Padding;
2140 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2141 // View if no replacement. Previously margin and padding values would have been moved from
2142 // the View to the layout.
2143 if (_layout != null ) // Existing layout
2147 // Existing layout being replaced so copy over margin and padding values.
2148 value.Margin = _layout.Margin;
2149 value.Padding = _layout.Padding;
2153 // Layout not being replaced so restore margin and padding to View.
2154 SetValue(MarginProperty, _layout.Margin);
2155 SetValue(PaddingProperty, _layout.Padding);
2156 NotifyPropertyChanged();
2161 // First Layout to be added to the View hence copy
2163 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2166 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2168 // If View already has a margin set then store it in Layout instead.
2169 value.Margin = Margin;
2170 SetValue(MarginProperty, new Extents(0,0,0,0));
2171 NotifyPropertyChanged();
2174 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2176 // If View already has a padding set then store it in Layout instead.
2177 value.Padding = Padding;
2178 SetValue(PaddingProperty, new Extents(0,0,0,0));
2179 NotifyPropertyChanged();
2184 // Remove existing layout from it's parent layout group.
2185 _layout?.Unparent();
2187 // Set layout to this view
2193 /// The weight of the View, used to share available space in a layout with siblings.
2195 /// <since_tizen> 6 </since_tizen>
2205 _layout?.RequestLayout();
2210 /// Whether to load the BackgroundImage synchronously.
2211 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2212 /// Note: For Normal Quad images only.
2214 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2215 [EditorBrowsable(EditorBrowsableState.Never)]
2216 public bool BackgroundImageSynchronosLoading
2220 return _backgroundImageSynchronosLoading;
2224 _backgroundImageSynchronosLoading = value;
2226 string bgUrl = null;
2227 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2229 if (!string.IsNullOrEmpty(bgUrl))
2231 PropertyMap bgMap = this.Background;
2232 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2238 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2239 [EditorBrowsable(EditorBrowsableState.Never)]
2240 public Vector2 UpdateSizeHint
2244 return (Vector2)GetValue(UpdateSizeHintProperty);
2248 SetValue(UpdateSizeHintProperty, value);
2249 NotifyPropertyChanged();
2253 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2254 [EditorBrowsable(EditorBrowsableState.Never)]
2255 public string[] TransitionNames
2259 return transitionNames;
2263 transitionNames = value;
2269 /// Enable/Disable ControlState propagation for children.
2270 /// It is false by default.
2271 /// If the View needs to share ControlState with descendants, please set it true.
2272 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2274 [EditorBrowsable(EditorBrowsableState.Never)]
2275 public bool EnableControlStatePropagation
2277 get => controlStatePropagation;
2280 controlStatePropagation = value;
2282 foreach (View child in Children)
2284 child.EnableControlStatePropagation = value;
2290 /// If this property is set to true, the View can have a touch related ControlState (such as Pressed) when touch.
2291 /// By default, it is false in View, true in Control.
2292 /// Note that if the value is true, the View will be a touch receptor.
2294 [EditorBrowsable(EditorBrowsableState.Never)]
2295 public bool EnableControlState
2299 return (bool)GetValue(EnableControlStateProperty);
2303 SetValue(EnableControlStateProperty, value);
2308 /// Whether the actor grab all touches even if touch leaves its boundary.
2310 /// <returns>true, if it grab all touch after start</returns>
2311 [EditorBrowsable(EditorBrowsableState.Never)]
2312 public bool GrabTouchAfterLeave
2317 GetProperty(View.Property.CaptureAllTouchAfterStart).Get(out temp);
2322 SetProperty(View.Property.CaptureAllTouchAfterStart, new Tizen.NUI.PropertyValue(value));
2323 NotifyPropertyChanged();
2328 /// If the value is true, the View will change its style as the theme changes.
2329 /// It is false by default, unless it is Control instance created with specified style name.
2331 [EditorBrowsable(EditorBrowsableState.Never)]
2332 public bool ThemeChangeSensitive
2334 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2335 set => SetValue(ThemeChangeSensitiveProperty, value);
2339 /// Get Style, it is abstract function and must be override.
2341 /// <since_tizen> 6 </since_tizen>
2342 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2343 // TODO: It should be deprecated. please use CreateViewStyle instead.
2344 [EditorBrowsable(EditorBrowsableState.Never)]
2345 protected virtual ViewStyle GetViewStyle()
2347 return CreateViewStyle();
2351 /// Create Style, it is abstract function and must be override.
2353 [EditorBrowsable(EditorBrowsableState.Never)]
2354 protected virtual ViewStyle CreateViewStyle()
2356 return new ViewStyle();
2360 /// Called after the View's ControlStates changed.
2362 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2363 [EditorBrowsable(EditorBrowsableState.Never)]
2364 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2370 [EditorBrowsable(EditorBrowsableState.Never)]
2371 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2373 ViewStyle newStyle = ThemeManager.GetStyle(GetType());
2375 if (newStyle != null && viewStyle?.GetType() == newStyle.GetType())
2377 ApplyStyle(newStyle);
2381 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2382 [EditorBrowsable(EditorBrowsableState.Never)]
2383 public virtual void ApplyStyle(ViewStyle viewStyle)
2385 if (null == viewStyle || this.viewStyle == viewStyle) return;
2387 this.viewStyle = viewStyle;
2389 Dictionary<string, BindableProperty> bindablePropertyOfView;
2390 Type viewType = GetType();
2392 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2393 Type styleType = viewStyle.GetType();
2395 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2396 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2398 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2400 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2402 BindableProperty viewProperty;
2403 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2405 if (null != viewProperty)
2407 object value = viewStyle.GetValue(keyValuePair.Value);
2411 SetValue(viewProperty, value);