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;
70 private Constraint widthConstraint = null;
71 private Constraint heightConstraint = null;
75 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
76 [EditorBrowsable(EditorBrowsableState.Never)]
77 public ViewStyle ViewStyle
81 if (null == viewStyle)
83 ApplyStyle(GetViewStyle());
91 /// Creates a new instance of a view.
93 /// <since_tizen> 3 </since_tizen>
94 public View() : this(Interop.View.View_New(), true)
96 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
100 [EditorBrowsable(EditorBrowsableState.Never)]
101 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true, viewStyle)
106 /// Create a new instance of a View with setting the status of shown or hidden.
108 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
109 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
110 [EditorBrowsable(EditorBrowsableState.Never)]
111 public View(bool shown) : this(Interop.View.View_New(), true)
113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
125 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
128 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
130 if (!ThemeManager.ThemeApplied) return;
132 if (viewStyle == null) UpdateStyle(); // Use style in the current theme
133 else ApplyStyle(viewStyle.Clone()); // Use given style
136 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
140 PositionUsesPivotPoint = false;
143 _onWindowSendEventCallback = SendViewAddedEventToWindow;
144 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
152 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
154 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
163 /// The event that is triggered when the View's ControlState is changed.
165 [EditorBrowsable(EditorBrowsableState.Never)]
166 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
168 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
170 private ControlState controlStates = ControlState.Normal;
172 /// Get/Set the control state.
174 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
175 [EditorBrowsable(EditorBrowsableState.Never)]
176 public ControlState ControlState
180 return controlStates;
184 if (controlStates == value)
189 var prevState = controlStates;
191 controlStates = value;
193 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
195 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
197 if (controlStatePropagation)
199 foreach (View child in Children)
201 child.ControlState = value;
205 OnControlStateChanged(changeInfo);
207 ControlStateChangedEvent?.Invoke(this, changeInfo);
211 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
212 [EditorBrowsable(EditorBrowsableState.Never)]
213 public bool IsResourcesCreated
217 return Application.Current.IsResourcesCreated;
221 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
222 [EditorBrowsable(EditorBrowsableState.Never)]
223 public ResourceDictionary XamlResources
227 return Application.Current.XamlResources;
231 Application.Current.XamlResources = value;
236 /// The StyleName, type string.
237 /// The value indicates DALi style name defined in json theme file.
239 /// <since_tizen> 3 </since_tizen>
240 public string StyleName
244 return (string)GetValue(StyleNameProperty);
248 SetValue(StyleNameProperty, value);
249 NotifyPropertyChanged();
254 /// The KeyInputFocus, type bool.
256 [EditorBrowsable(EditorBrowsableState.Never)]
257 public bool KeyInputFocus
261 return (bool)GetValue(KeyInputFocusProperty);
265 SetValue(KeyInputFocusProperty, value);
266 NotifyPropertyChanged();
271 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
274 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
276 /// <since_tizen> 3 </since_tizen>
277 public Color BackgroundColor
281 Color temp = (Color)GetValue(BackgroundColorProperty);
282 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
286 SetValue(BackgroundColorProperty, value);
287 if (selectorData != null)
289 selectorData.BackgroundImage.Reset(this);
290 selectorData.BackgroundColor.UpdateIfNeeds(this, value);
292 NotifyPropertyChanged();
297 /// The mutually exclusive with "backgroundColor" and "background" type Map.
299 /// <since_tizen> 3 </since_tizen>
300 public string BackgroundImage
304 return (string)GetValue(BackgroundImageProperty);
308 SetValue(BackgroundImageProperty, value);
309 if (selectorData != null)
311 selectorData.BackgroundColor.Reset(this);
312 selectorData.BackgroundImage.UpdateIfNeeds(this, value);
314 NotifyPropertyChanged();
319 /// Get or set the border of background image.
321 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
322 [EditorBrowsable(EditorBrowsableState.Never)]
323 public Rectangle BackgroundImageBorder
327 return (Rectangle)GetValue(BackgroundImageBorderProperty);
331 SetValue(BackgroundImageBorderProperty, value);
332 selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value);
333 NotifyPropertyChanged();
338 /// The background of view.
340 /// <since_tizen> 3 </since_tizen>
341 public Tizen.NUI.PropertyMap Background
345 return (PropertyMap)GetValue(BackgroundProperty);
349 SetValue(BackgroundProperty, value);
350 NotifyPropertyChanged();
355 /// Describes a shadow as an image for a View.
356 /// It is null by default.
359 /// Getter returns copied instance of current shadow.
362 /// The mutually exclusive with "BoxShadow".
364 [EditorBrowsable(EditorBrowsableState.Never)]
365 public ImageShadow ImageShadow
369 return (ImageShadow)GetValue(ImageShadowProperty);
373 SetValue(ImageShadowProperty, value);
374 if (selectorData != null)
376 selectorData.BoxShadow.Reset(this);
377 selectorData.ImageShadow.UpdateIfNeeds(this, value);
379 NotifyPropertyChanged();
384 /// Describes a box shaped shadow drawing for a View.
385 /// It is null by default.
388 /// Gettter returns copied instance of current shadow.
391 /// The mutually exclusive with "ImageShadow".
393 [EditorBrowsable(EditorBrowsableState.Never)]
394 public Shadow BoxShadow
398 return (Shadow)GetValue(BoxShadowProperty);
402 SetValue(BoxShadowProperty, value);
403 if (selectorData != null)
405 selectorData.ImageShadow.Reset(this);
406 selectorData.BoxShadow.UpdateIfNeeds(this, value);
408 NotifyPropertyChanged();
413 /// The radius for the rounded corners of the View.
414 /// This will rounds background and shadow edges.
415 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
417 [EditorBrowsable(EditorBrowsableState.Never)]
418 public float CornerRadius
422 return (float)GetValue(CornerRadiusProperty);
426 SetValue(CornerRadiusProperty, value);
427 selectorData?.CornerRadius.UpdateIfNeeds(this, value);
428 NotifyPropertyChanged();
433 /// The current state of the view.
435 /// <since_tizen> 3 </since_tizen>
440 return (States)GetValue(StateProperty);
444 SetValue(StateProperty, value);
445 NotifyPropertyChanged();
450 /// The current sub state of the view.
452 /// <since_tizen> 3 </since_tizen>
453 public States SubState
457 return (States)GetValue(SubStateProperty);
461 SetValue(SubStateProperty, value);
462 NotifyPropertyChanged();
467 /// Displays a tooltip
469 /// <since_tizen> 3 </since_tizen>
470 public Tizen.NUI.PropertyMap Tooltip
474 return (PropertyMap)GetValue(TooltipProperty);
478 SetValue(TooltipProperty, value);
479 NotifyPropertyChanged();
484 /// Displays a tooltip as a text.
486 /// <since_tizen> 3 </since_tizen>
487 public string TooltipText
491 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
492 NotifyPropertyChanged();
497 /// The Child property of FlexContainer.<br />
498 /// The proportion of the free space in the container, the flex item will receive.<br />
499 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
501 /// <since_tizen> 3 </since_tizen>
502 [Obsolete("Deprecated in API8, will be removed in API10.")]
507 return (float)GetValue(FlexProperty);
511 SetValue(FlexProperty, value);
512 NotifyPropertyChanged();
517 /// The Child property of FlexContainer.<br />
518 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
520 /// <since_tizen> 3 </since_tizen>
521 [Obsolete("Deprecated in API8, will be removed in API10.")]
526 return (int)GetValue(AlignSelfProperty);
530 SetValue(AlignSelfProperty, value);
531 NotifyPropertyChanged();
536 /// The Child property of FlexContainer.<br />
537 /// The space around the flex item.<br />
540 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
542 /// <since_tizen> 3 </since_tizen>
543 [Obsolete("Deprecated in API8, will be removed in API10.")]
544 public Vector4 FlexMargin
548 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
549 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
553 SetValue(FlexMarginProperty, value);
554 NotifyPropertyChanged();
559 /// The top-left cell this child occupies, if not set, the first available cell is used.
562 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
564 /// <since_tizen> 3 </since_tizen>
565 public Vector2 CellIndex
569 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
570 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
574 SetValue(CellIndexProperty, value);
575 NotifyPropertyChanged();
580 /// The number of rows this child occupies, if not set, the default value is 1.
582 /// <since_tizen> 3 </since_tizen>
587 return (float)GetValue(RowSpanProperty);
591 SetValue(RowSpanProperty, value);
592 NotifyPropertyChanged();
597 /// The number of columns this child occupies, if not set, the default value is 1.
599 /// <since_tizen> 3 </since_tizen>
600 public float ColumnSpan
604 return (float)GetValue(ColumnSpanProperty);
608 SetValue(ColumnSpanProperty, value);
609 NotifyPropertyChanged();
614 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
616 /// <since_tizen> 3 </since_tizen>
617 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
621 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
625 SetValue(CellHorizontalAlignmentProperty, value);
626 NotifyPropertyChanged();
631 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
633 /// <since_tizen> 3 </since_tizen>
634 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
638 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
642 SetValue(CellVerticalAlignmentProperty, value);
643 NotifyPropertyChanged();
648 /// The left focusable view.<br />
649 /// This will return null if not set.<br />
650 /// This will also return null if the specified left focusable view is not on a window.<br />
652 /// <since_tizen> 3 </since_tizen>
653 public View LeftFocusableView
655 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
658 return (View)GetValue(LeftFocusableViewProperty);
662 SetValue(LeftFocusableViewProperty, value);
663 NotifyPropertyChanged();
668 /// The right focusable view.<br />
669 /// This will return null if not set.<br />
670 /// This will also return null if the specified right focusable view is not on a window.<br />
672 /// <since_tizen> 3 </since_tizen>
673 public View RightFocusableView
675 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
678 return (View)GetValue(RightFocusableViewProperty);
682 SetValue(RightFocusableViewProperty, value);
683 NotifyPropertyChanged();
688 /// The up focusable view.<br />
689 /// This will return null if not set.<br />
690 /// This will also return null if the specified up focusable view is not on a window.<br />
692 /// <since_tizen> 3 </since_tizen>
693 public View UpFocusableView
695 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
698 return (View)GetValue(UpFocusableViewProperty);
702 SetValue(UpFocusableViewProperty, value);
703 NotifyPropertyChanged();
708 /// The down focusable view.<br />
709 /// This will return null if not set.<br />
710 /// This will also return null if the specified down focusable view is not on a window.<br />
712 /// <since_tizen> 3 </since_tizen>
713 public View DownFocusableView
715 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
718 return (View)GetValue(DownFocusableViewProperty);
722 SetValue(DownFocusableViewProperty, value);
723 NotifyPropertyChanged();
728 /// Whether the view should be focusable by keyboard navigation.
730 /// <since_tizen> 3 </since_tizen>
731 public bool Focusable
735 SetValue(FocusableProperty, value);
736 NotifyPropertyChanged();
740 return (bool)GetValue(FocusableProperty);
745 /// Whether the children of this view can be focusable by keyboard navigation. If user sets this to false, the children of this actor view will not be focused.
746 /// Note : Default value is true.
748 [EditorBrowsable(EditorBrowsableState.Never)]
749 public bool FocusableChildren
753 SetValue(FocusableChildrenProperty, value);
754 NotifyPropertyChanged();
758 return (bool)GetValue(FocusableChildrenProperty);
763 /// Whether this view can focus by touch.
764 /// If Focusable is false, FocusableInTouch is disabled.
765 /// If you want to have focus on touch, you need to set both Focusable and FocusableInTouch settings to true.
767 [EditorBrowsable(EditorBrowsableState.Never)]
768 public bool FocusableInTouch
772 SetValue(FocusableInTouchProperty, value);
773 NotifyPropertyChanged();
777 return (bool)GetValue(FocusableInTouchProperty);
782 /// Retrieves the position of the view.<br />
783 /// The coordinates are relative to the view's parent.<br />
785 /// <since_tizen> 3 </since_tizen>
786 public Position CurrentPosition
790 return GetCurrentPosition();
795 /// Sets the size of a view for the width and the height.<br />
796 /// Geometry can be scaled to fit within this area.<br />
797 /// This does not interfere with the view's scale factor.<br />
798 /// The views default depth is the minimum of width and height.<br />
801 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
802 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
804 /// <since_tizen> 3 </since_tizen>
809 Size2D temp = (Size2D)GetValue(Size2DProperty);
810 int width = temp.Width;
811 int height = temp.Height;
813 if (this.Layout == null)
815 if (width < 0) { width = 0; }
816 if (height < 0) { height = 0; }
819 return new Size2D(OnSize2DChanged, width, height);
823 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
824 SetValue(Size2DProperty, value);
825 // Set Specification so when layouts measure this View it matches the value set here.
826 // All Views are currently Layouts.
827 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
828 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
829 _widthPolicy = value.Width;
830 _heightPolicy = value.Height;
832 _layout?.RequestLayout();
833 NotifyPropertyChanged();
838 /// Retrieves the size of the view.<br />
839 /// The coordinates are relative to the view's parent.<br />
841 /// <since_tizen> 3 </since_tizen>
842 public Size2D CurrentSize
846 return GetCurrentSize();
851 /// Retrieves and sets the view's opacity.<br />
853 /// <since_tizen> 3 </since_tizen>
858 return (float)GetValue(OpacityProperty);
862 SetValue(OpacityProperty, value);
863 selectorData?.Opacity.UpdateIfNeeds(this, value);
864 NotifyPropertyChanged();
869 /// Sets the position of the view for X and Y.<br />
870 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
871 /// If the position inheritance is disabled, sets the world position.<br />
874 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
875 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
877 /// <since_tizen> 3 </since_tizen>
878 public Position2D Position2D
882 Position2D temp = (Position2D)GetValue(Position2DProperty);
883 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
887 SetValue(Position2DProperty, value);
888 NotifyPropertyChanged();
893 /// Retrieves the screen postion of the view.<br />
895 /// <since_tizen> 3 </since_tizen>
896 public Vector2 ScreenPosition
900 Vector2 temp = new Vector2(0.0f, 0.0f);
901 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
907 /// Determines whether the pivot point should be used to determine the position of the view.
908 /// This is false by default.
910 /// <remarks>If false, then the top-left of the view is used for the position.
911 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
913 /// <since_tizen> 3 </since_tizen>
914 public bool PositionUsesPivotPoint
918 return (bool)GetValue(PositionUsesPivotPointProperty);
922 SetValue(PositionUsesPivotPointProperty, value);
923 NotifyPropertyChanged();
928 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
930 /// <since_tizen> 3 </since_tizen>
931 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
933 "View view = new View(); " +
934 "view.PivotPoint = PivotPoint.Center; " +
935 "view.PositionUsesPivotPoint = true;" +
936 " Deprecated in API5: Will be removed in API8")]
937 [EditorBrowsable(EditorBrowsableState.Never)]
938 public bool PositionUsesAnchorPoint
943 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
948 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
949 NotifyPropertyChanged();
954 /// Queries whether the view is connected to the stage.<br />
955 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
957 /// <since_tizen> 3 </since_tizen>
958 public bool IsOnWindow
967 /// Gets the depth in the hierarchy for the view.
969 /// <since_tizen> 3 </since_tizen>
970 public int HierarchyDepth
974 return GetHierarchyDepth();
979 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
982 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
983 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
984 /// The values set by this property will likely change.
986 /// <since_tizen> 3 </since_tizen>
987 public int SiblingOrder
991 return (int)GetValue(SiblingOrderProperty);
995 SetValue(SiblingOrderProperty, value);
997 LayoutGroup layout = Layout as LayoutGroup;
998 layout?.ChangeLayoutSiblingOrder(value);
1000 NotifyPropertyChanged();
1005 /// Returns the natural size of the view.
1008 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1010 /// <since_tizen> 5 </since_tizen>
1011 public Vector3 NaturalSize
1015 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
1016 if (NDalicPINVOKE.SWIGPendingException.Pending)
1017 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1023 /// Returns the natural size (Size2D) of the view.
1026 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1028 /// <since_tizen> 4 </since_tizen>
1029 public Size2D NaturalSize2D
1033 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
1034 if (NDalicPINVOKE.SWIGPendingException.Pending)
1035 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1037 return new Size2D((int)temp.Width, (int)temp.Height);
1042 /// Gets or sets the origin of a view within its parent's area.<br />
1043 /// 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 />
1044 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1045 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1047 /// <pre>The view has been initialized.</pre>
1048 /// <since_tizen> 3 </since_tizen>
1049 public Position ParentOrigin
1053 Position tmp = (Position)GetValue(ParentOriginProperty);
1054 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1058 SetValue(ParentOriginProperty, value);
1059 NotifyPropertyChanged();
1064 /// Gets or sets the anchor-point of a view.<br />
1065 /// 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 />
1066 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1067 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1068 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1069 /// <pre>The view has been initialized.</pre>
1072 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1074 /// <since_tizen> 3 </since_tizen>
1075 public Position PivotPoint
1079 Position tmp = (Position)GetValue(PivotPointProperty);
1080 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1084 SetValue(PivotPointProperty, value);
1085 NotifyPropertyChanged();
1090 /// Gets or sets the size width of the view.
1094 /// Animatable - This property can be animated using <c>Animation</c> class.
1097 /// <since_tizen> 3 </since_tizen>
1098 public float SizeWidth
1102 return (float)GetValue(SizeWidthProperty);
1106 SetValue(SizeWidthProperty, value);
1107 NotifyPropertyChanged();
1112 /// Gets or sets the size height of the view.
1116 /// Animatable - This property can be animated using <c>Animation</c> class.
1119 /// <since_tizen> 3 </since_tizen>
1120 public float SizeHeight
1124 return (float)GetValue(SizeHeightProperty);
1128 SetValue(SizeHeightProperty, value);
1129 NotifyPropertyChanged();
1134 /// Gets or sets the position of the view.<br />
1135 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1136 /// If the position inheritance is disabled, sets the world position.<br />
1140 /// Animatable - This property can be animated using <c>Animation</c> class.
1142 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1144 /// <since_tizen> 3 </since_tizen>
1145 public Position Position
1149 Position tmp = (Position)GetValue(PositionProperty);
1150 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1154 SetValue(PositionProperty, value);
1155 NotifyPropertyChanged();
1160 /// Gets or sets the position X of the view.
1164 /// Animatable - This property can be animated using <c>Animation</c> class.
1167 /// <since_tizen> 3 </since_tizen>
1168 public float PositionX
1172 return (float)GetValue(PositionXProperty);
1176 SetValue(PositionXProperty, value);
1177 NotifyPropertyChanged();
1182 /// Gets or sets the position Y of the view.
1186 /// Animatable - This property can be animated using <c>Animation</c> class.
1189 /// <since_tizen> 3 </since_tizen>
1190 public float PositionY
1194 return (float)GetValue(PositionYProperty);
1198 SetValue(PositionYProperty, value);
1199 NotifyPropertyChanged();
1204 /// Gets or sets the position Z of the view.
1208 /// Animatable - This property can be animated using <c>Animation</c> class.
1211 /// <since_tizen> 3 </since_tizen>
1212 public float PositionZ
1216 return (float)GetValue(PositionZProperty);
1220 SetValue(PositionZProperty, value);
1221 NotifyPropertyChanged();
1226 /// Gets or sets the world position of the view.
1228 /// <since_tizen> 3 </since_tizen>
1229 public Vector3 WorldPosition
1233 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1234 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1240 /// Gets or sets the orientation of the view.<br />
1241 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1245 /// This is an asynchronous method.
1248 /// Animatable - This property can be animated using <c>Animation</c> class.
1251 /// <since_tizen> 3 </since_tizen>
1252 public Rotation Orientation
1256 return (Rotation)GetValue(OrientationProperty);
1260 SetValue(OrientationProperty, value);
1261 NotifyPropertyChanged();
1266 /// Gets or sets the world orientation of the view.<br />
1268 /// <since_tizen> 3 </since_tizen>
1269 public Rotation WorldOrientation
1273 Rotation temp = new Rotation();
1274 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1280 /// Gets or sets the scale factor applied to the view.<br />
1284 /// Animatable - This property can be animated using <c>Animation</c> class.
1286 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1288 /// <since_tizen> 3 </since_tizen>
1289 public Vector3 Scale
1293 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1294 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1298 SetValue(ScaleProperty, value);
1299 NotifyPropertyChanged();
1304 /// Gets or sets the scale X factor applied to the view.
1308 /// Animatable - This property can be animated using <c>Animation</c> class.
1311 /// <since_tizen> 3 </since_tizen>
1316 return (float)GetValue(ScaleXProperty);
1320 SetValue(ScaleXProperty, value);
1321 NotifyPropertyChanged();
1326 /// Gets or sets the scale Y factor applied to the view.
1330 /// Animatable - This property can be animated using <c>Animation</c> class.
1333 /// <since_tizen> 3 </since_tizen>
1338 return (float)GetValue(ScaleYProperty);
1342 SetValue(ScaleYProperty, value);
1343 NotifyPropertyChanged();
1348 /// Gets or sets the scale Z factor applied to the view.
1352 /// Animatable - This property can be animated using <c>Animation</c> class.
1355 /// <since_tizen> 3 </since_tizen>
1360 return (float)GetValue(ScaleZProperty);
1364 SetValue(ScaleZProperty, value);
1365 NotifyPropertyChanged();
1370 /// Gets the world scale of the view.
1372 /// <since_tizen> 3 </since_tizen>
1373 public Vector3 WorldScale
1377 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1378 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1384 /// Retrieves the visibility flag of the view.
1388 /// If the view is not visible, then the view and its children will not be rendered.
1389 /// 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.
1392 /// Animatable - This property can be animated using <c>Animation</c> class.
1395 /// <since_tizen> 3 </since_tizen>
1396 public bool Visibility
1401 GetProperty(View.Property.VISIBLE).Get(out temp);
1407 /// Gets the view's world color.
1409 /// <since_tizen> 3 </since_tizen>
1410 public Vector4 WorldColor
1414 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1415 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1421 /// Gets or sets the view's name.
1423 /// <since_tizen> 3 </since_tizen>
1428 return (string)GetValue(NameProperty);
1432 SetValue(NameProperty, value);
1433 NotifyPropertyChanged();
1438 /// Get the number of children held by the view.
1440 /// <since_tizen> 3 </since_tizen>
1441 public new uint ChildCount
1445 return GetChildCount();
1450 /// Gets the view's ID.
1453 /// <since_tizen> 3 </since_tizen>
1463 /// Gets or sets the status of whether the view should emit touch or hover signals.
1465 /// <since_tizen> 3 </since_tizen>
1466 public bool Sensitive
1470 return (bool)GetValue(SensitiveProperty);
1474 SetValue(SensitiveProperty, value);
1475 NotifyPropertyChanged();
1480 /// 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.
1482 /// <since_tizen> 3 </since_tizen>
1483 public bool LeaveRequired
1487 return (bool)GetValue(LeaveRequiredProperty);
1491 SetValue(LeaveRequiredProperty, value);
1492 NotifyPropertyChanged();
1497 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1499 /// <since_tizen> 3 </since_tizen>
1500 public bool InheritOrientation
1504 return (bool)GetValue(InheritOrientationProperty);
1508 SetValue(InheritOrientationProperty, value);
1509 NotifyPropertyChanged();
1514 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1516 /// <since_tizen> 3 </since_tizen>
1517 public bool InheritScale
1521 return (bool)GetValue(InheritScaleProperty);
1525 SetValue(InheritScaleProperty, value);
1526 NotifyPropertyChanged();
1531 /// Gets or sets the status of how the view and its children should be drawn.<br />
1532 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1533 /// 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 />
1534 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1535 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1536 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1538 /// <since_tizen> 3 </since_tizen>
1539 public DrawModeType DrawMode
1543 return (DrawModeType)GetValue(DrawModeProperty);
1547 SetValue(DrawModeProperty, value);
1548 NotifyPropertyChanged();
1553 /// Gets or sets the relative to parent size factor of the view.<br />
1554 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1555 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1558 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1560 /// <since_tizen> 3 </since_tizen>
1561 public Vector3 SizeModeFactor
1565 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1566 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1570 SetValue(SizeModeFactorProperty, value);
1571 NotifyPropertyChanged();
1576 /// Gets or sets the width resize policy to be used.
1578 /// <since_tizen> 3 </since_tizen>
1579 public ResizePolicyType WidthResizePolicy
1583 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1587 SetValue(WidthResizePolicyProperty, value);
1588 NotifyPropertyChanged();
1593 /// Gets or sets the height resize policy to be used.
1595 /// <since_tizen> 3 </since_tizen>
1596 public ResizePolicyType HeightResizePolicy
1600 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1604 SetValue(HeightResizePolicyProperty, value);
1605 NotifyPropertyChanged();
1610 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1611 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1613 /// <since_tizen> 3 </since_tizen>
1614 public SizeScalePolicyType SizeScalePolicy
1618 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1622 SetValue(SizeScalePolicyProperty, value);
1623 NotifyPropertyChanged();
1628 /// Gets or sets the status of whether the width size is dependent on the height size.
1630 /// <since_tizen> 3 </since_tizen>
1631 public bool WidthForHeight
1635 return (bool)GetValue(WidthForHeightProperty);
1639 SetValue(WidthForHeightProperty, value);
1640 NotifyPropertyChanged();
1645 /// Gets or sets the status of whether the height size is dependent on the width size.
1647 /// <since_tizen> 3 </since_tizen>
1648 public bool HeightForWidth
1652 return (bool)GetValue(HeightForWidthProperty);
1656 SetValue(HeightForWidthProperty, value);
1657 NotifyPropertyChanged();
1662 /// Gets or sets the padding for use in layout.
1665 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1667 /// <since_tizen> 5 </since_tizen>
1668 public Extents Padding
1672 // If View has a Layout then padding in stored in the base Layout class
1675 return Layout.Padding;
1679 Extents temp = (Extents)GetValue(PaddingProperty);
1680 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1682 // Two return points to prevent creating a zeroed Extent native object before assignment
1686 Extents padding = value;
1689 // Layout set so store Padding in LayoutItem instead of in View.
1690 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1691 // the position and sizes measure in the Layouting.
1692 Layout.Padding = value;
1693 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1694 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1695 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1697 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1701 SetValue(PaddingProperty, padding);
1702 NotifyPropertyChanged();
1707 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1710 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1712 /// <since_tizen> 3 </since_tizen>
1713 public Size2D MinimumSize
1717 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1718 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1722 if (_layout != null)
1724 // Note: it only works if minimum size is >= than natural size.
1725 // To force the size it should be done through the width&height spec or Size2D.
1726 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1727 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1728 _layout.RequestLayout();
1730 SetValue(MinimumSizeProperty, value);
1731 NotifyPropertyChanged();
1736 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1739 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1741 /// <since_tizen> 3 </since_tizen>
1742 public Size2D MaximumSize
1746 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1747 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1751 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1752 // MATCH_PARENT spec + parent container size can be used to limit
1753 if (_layout != null)
1755 _layout.RequestLayout();
1757 SetValue(MaximumSizeProperty, value);
1758 NotifyPropertyChanged();
1763 /// Gets or sets whether a child view inherits it's parent's position.<br />
1764 /// Default is to inherit.<br />
1765 /// 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 />
1767 /// <since_tizen> 3 </since_tizen>
1768 public bool InheritPosition
1772 return (bool)GetValue(InheritPositionProperty);
1776 SetValue(InheritPositionProperty, value);
1777 NotifyPropertyChanged();
1782 /// Gets or sets the clipping behavior (mode) of it's children.
1784 /// <since_tizen> 3 </since_tizen>
1785 public ClippingModeType ClippingMode
1789 return (ClippingModeType)GetValue(ClippingModeProperty);
1793 SetValue(ClippingModeProperty, value);
1794 NotifyPropertyChanged();
1799 /// Gets the number of renderers held by the view.
1801 /// <since_tizen> 3 </since_tizen>
1802 public uint RendererCount
1806 return GetRendererCount();
1811 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1814 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1816 /// <since_tizen> 3 </since_tizen>
1817 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1819 "View view = new View(); " +
1820 "view.PivotPoint = PivotPoint.Center; " +
1821 "view.PositionUsesPivotPoint = true;")]
1822 [EditorBrowsable(EditorBrowsableState.Never)]
1823 public Position AnchorPoint
1827 Position temp = new Position(0.0f, 0.0f, 0.0f);
1828 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1829 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1833 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1834 NotifyPropertyChanged();
1839 /// Sets the size of a view for the width, the height and the depth.<br />
1840 /// Geometry can be scaled to fit within this area.<br />
1841 /// This does not interfere with the view's scale factor.<br />
1842 /// The views default depth is the minimum of width and height.<br />
1846 /// Animatable - This property can be animated using <c>Animation</c> class.
1848 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1850 /// <since_tizen> 5 </since_tizen>
1855 Size tmp = (Size)GetValue(SizeProperty);
1856 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1860 SetValue(SizeProperty, value);
1861 NotifyPropertyChanged();
1866 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1868 /// <since_tizen> 3 </since_tizen>
1869 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1871 "Container parent = view.GetParent(); " +
1872 "View view = parent as View;")]
1873 [EditorBrowsable(EditorBrowsableState.Never)]
1874 public new View Parent
1879 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1880 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1881 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1883 if (basehandle is Layer layer)
1885 ret = new View(Layer.getCPtr(layer).Handle, false);
1886 NUILog.Error("This Parent property is deprecated, should do not be used");
1890 ret = basehandle as View;
1893 Interop.BaseHandle.delete_BaseHandle(CPtr);
1894 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1896 if (NDalicPINVOKE.SWIGPendingException.Pending)
1897 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1903 /// Gets/Sets whether inherit parent's the layout Direction.
1905 /// <since_tizen> 4 </since_tizen>
1906 public bool InheritLayoutDirection
1910 return (bool)GetValue(InheritLayoutDirectionProperty);
1914 SetValue(InheritLayoutDirectionProperty, value);
1915 NotifyPropertyChanged();
1920 /// Gets/Sets the layout Direction.
1922 /// <since_tizen> 4 </since_tizen>
1923 public ViewLayoutDirectionType LayoutDirection
1927 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1931 SetValue(LayoutDirectionProperty, value);
1932 NotifyPropertyChanged();
1933 _layout?.RequestLayout();
1938 /// Gets or sets the Margin for use in layout.
1941 /// Margin property is supported by Layout algorithms and containers.
1942 /// Please Set Layout if you want to use Margin property.
1943 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1945 /// <since_tizen> 4 </since_tizen>
1946 public Extents Margin
1950 // If View has a Layout then margin is stored in Layout.
1953 return Layout.Margin;
1957 // If Layout not set then return margin stored in View.
1958 Extents temp = (Extents)GetValue(MarginProperty);
1959 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1961 // Two return points to prevent creating a zeroed Extent native object before assignment
1967 // Layout set so store Margin in LayoutItem instead of View.
1968 // If View stores the Margin too then the Legacy Size Negotiation will
1969 // overwrite the position and size values measured in the Layouting.
1970 Layout.Margin = value;
1971 SetValue(MarginProperty, new Extents(0,0,0,0));
1972 _layout?.RequestLayout();
1976 SetValue(MarginProperty, value);
1978 NotifyPropertyChanged();
1979 _layout?.RequestLayout();
1984 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1986 /// <since_tizen> 6 </since_tizen>
1987 public int WidthSpecification
1991 return _widthPolicy;
1995 _widthPolicy = value;
1996 if( _oldWidthPolicy != _widthPolicy )
1998 if (_widthPolicy >= 0)
2000 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
2002 if(_heightPolicy>=0) // Policy an exact value
2004 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2005 Size2D = new Size2D(_widthPolicy,_heightPolicy);
2008 _layout?.RequestLayout();
2009 _oldWidthPolicy = _widthPolicy;
2015 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2017 /// <since_tizen> 6 </since_tizen>
2018 public int HeightSpecification
2022 return _heightPolicy;
2026 _heightPolicy = value;
2027 if( _oldHeightPolicy != _heightPolicy )
2029 if (_heightPolicy >= 0)
2031 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
2033 if(_widthPolicy>=0) // Policy an exact value
2035 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2036 Size2D = new Size2D(_widthPolicy,_heightPolicy);
2040 _layout?.RequestLayout();
2041 _oldHeightPolicy = _heightPolicy;
2047 /// Gets the List of transitions for this View.
2049 /// <since_tizen> 6 </since_tizen>
2050 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2054 if (_layoutTransitions == null)
2056 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2058 return _layoutTransitions;
2063 /// Set a layout transitions for this View.
2066 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2068 /// <since_tizen> 6 </since_tizen>
2069 public LayoutTransition LayoutTransition
2073 if (_layoutTransitions == null)
2075 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2077 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2079 AttachTransitionsToChildren(value);
2084 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2087 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2089 /// <since_tizen> 4 </since_tizen>
2090 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2091 [EditorBrowsable(EditorBrowsableState.Never)]
2092 public Extents PaddingEX
2096 Extents temp = new Extents(0, 0, 0, 0);
2097 GetProperty(View.Property.PADDING).Get(temp);
2098 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2102 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2103 NotifyPropertyChanged();
2104 _layout?.RequestLayout();
2108 /// <since_tizen> 6 </since_tizen>
2109 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2110 [EditorBrowsable(EditorBrowsableState.Never)]
2111 public Style XamlStyle
2115 return (Style)GetValue(XamlStyleProperty);
2119 SetValue(XamlStyleProperty, value);
2124 /// The Color of View. This is an RGBA value.
2128 /// Animatable - This property can be animated using <c>Animation</c> class.
2130 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2132 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2133 [EditorBrowsable(EditorBrowsableState.Never)]
2138 Color temp = (Color)GetValue(ColorProperty);
2139 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2143 SetValue(ColorProperty, value);
2144 selectorData?.Color.UpdateIfNeeds(this, value);
2145 NotifyPropertyChanged();
2150 /// Set the layout on this View. Replaces any existing Layout.
2152 /// <since_tizen> 6 </since_tizen>
2153 public LayoutItem Layout
2161 // Do nothing if layout provided is already set on this View.
2162 if (value == _layout)
2167 layoutingDisabled = false;
2170 // If new layout being set already has a owner then that owner receives a replacement default layout.
2171 // First check if the layout to be set already has a owner.
2172 if (value?.Owner != null)
2174 // Previous owner of the layout gets a default layout as a replacement.
2175 value.Owner.Layout = new AbsoluteLayout();
2177 // Copy Margin and Padding to replacement LayoutGroup.
2178 if (value.Owner.Layout != null)
2180 value.Owner.Layout.Margin = value.Margin;
2181 value.Owner.Layout.Padding = value.Padding;
2185 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2186 // View if no replacement. Previously margin and padding values would have been moved from
2187 // the View to the layout.
2188 if (_layout != null ) // Existing layout
2192 // Existing layout being replaced so copy over margin and padding values.
2193 value.Margin = _layout.Margin;
2194 value.Padding = _layout.Padding;
2198 // Layout not being replaced so restore margin and padding to View.
2199 SetValue(MarginProperty, _layout.Margin);
2200 SetValue(PaddingProperty, _layout.Padding);
2201 NotifyPropertyChanged();
2206 // First Layout to be added to the View hence copy
2207 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2210 if (Margin.Top != 0 || Margin.Bottom != 0 || Margin.Start != 0 || Margin.End != 0)
2212 // If View already has a margin set then store it in Layout instead.
2213 value.Margin = Margin;
2214 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2215 NotifyPropertyChanged();
2218 if (Padding.Top != 0 || Padding.Bottom != 0 || Padding.Start != 0 || Padding.End != 0)
2220 // If View already has a padding set then store it in Layout instead.
2221 value.Padding = Padding;
2222 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2223 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2224 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType())) // If a Layout container of some kind.
2226 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2227 NotifyPropertyChanged();
2233 // Remove existing layout from it's parent layout group.
2234 _layout?.Unparent();
2236 // Set layout to this view
2242 /// The weight of the View, used to share available space in a layout with siblings.
2244 /// <since_tizen> 6 </since_tizen>
2254 _layout?.RequestLayout();
2259 /// Whether to load the BackgroundImage synchronously.
2260 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2261 /// Note: For Normal Quad images only.
2263 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2264 [EditorBrowsable(EditorBrowsableState.Never)]
2265 public bool BackgroundImageSynchronosLoading
2269 return _backgroundImageSynchronosLoading;
2273 _backgroundImageSynchronosLoading = value;
2275 string bgUrl = null;
2276 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2278 if (!string.IsNullOrEmpty(bgUrl))
2280 PropertyMap bgMap = this.Background;
2281 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2287 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2288 [EditorBrowsable(EditorBrowsableState.Never)]
2289 public Vector2 UpdateSizeHint
2293 return (Vector2)GetValue(UpdateSizeHintProperty);
2297 SetValue(UpdateSizeHintProperty, value);
2298 NotifyPropertyChanged();
2302 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2303 [EditorBrowsable(EditorBrowsableState.Never)]
2304 public string[] TransitionNames
2308 return transitionNames;
2312 transitionNames = value;
2318 /// Enable/Disable ControlState propagation for children.
2319 /// It is false by default.
2320 /// If the View needs to share ControlState with descendants, please set it true.
2321 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2323 [EditorBrowsable(EditorBrowsableState.Never)]
2324 public bool EnableControlStatePropagation
2326 get => controlStatePropagation;
2329 controlStatePropagation = value;
2331 foreach (View child in Children)
2333 child.EnableControlStatePropagation = value;
2339 /// If this property is set to true, the View can have a touch related ControlState (such as Pressed) when touch.
2340 /// By default, it is false in View, true in Control.
2341 /// Note that if the value is true, the View will be a touch receptor.
2343 [EditorBrowsable(EditorBrowsableState.Never)]
2344 public bool EnableControlState
2348 return (bool)GetValue(EnableControlStateProperty);
2352 SetValue(EnableControlStateProperty, value);
2357 /// Whether the actor grab all touches even if touch leaves its boundary.
2359 /// <returns>true, if it grab all touch after start</returns>
2360 [EditorBrowsable(EditorBrowsableState.Never)]
2361 public bool GrabTouchAfterLeave
2366 GetProperty(View.Property.CaptureAllTouchAfterStart).Get(out temp);
2371 SetProperty(View.Property.CaptureAllTouchAfterStart, new Tizen.NUI.PropertyValue(value));
2372 NotifyPropertyChanged();
2377 /// If the value is true, the View will change its style as the theme changes.
2378 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2380 [EditorBrowsable(EditorBrowsableState.Never)]
2381 public bool ThemeChangeSensitive
2383 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2384 set => SetValue(ThemeChangeSensitiveProperty, value);
2388 /// Get Style, it is abstract function and must be override.
2390 /// <since_tizen> 6 </since_tizen>
2391 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2392 // TODO: It should be deprecated. please use CreateViewStyle instead.
2393 [EditorBrowsable(EditorBrowsableState.Never)]
2394 protected virtual ViewStyle GetViewStyle()
2396 return CreateViewStyle();
2400 /// Create Style, it is abstract function and must be override.
2402 [EditorBrowsable(EditorBrowsableState.Never)]
2403 protected virtual ViewStyle CreateViewStyle()
2405 return new ViewStyle();
2409 /// Called after the View's ControlStates changed.
2411 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2412 [EditorBrowsable(EditorBrowsableState.Never)]
2413 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2419 [EditorBrowsable(EditorBrowsableState.Never)]
2420 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2425 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2426 [EditorBrowsable(EditorBrowsableState.Never)]
2427 public virtual void ApplyStyle(ViewStyle viewStyle)
2429 if (null == viewStyle || this.viewStyle == viewStyle) return;
2431 this.viewStyle = viewStyle;
2433 Dictionary<string, BindableProperty> bindablePropertyOfView;
2434 Type viewType = GetType();
2436 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2437 Type styleType = viewStyle.GetType();
2439 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2440 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2442 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2444 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2446 BindableProperty viewProperty;
2447 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2449 if (null != viewProperty && viewProperty != StyleNameProperty)
2451 object value = viewStyle.GetValue(keyValuePair.Value);
2455 SetValue(viewProperty, value);