2 * Copyright(c) 2020 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;
65 private bool excludeLayouting = false;
67 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
68 internal BackgroundExtraData backgroundExtraData;
72 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
73 [EditorBrowsable(EditorBrowsableState.Never)]
74 public ViewStyle ViewStyle
78 if (null == viewStyle)
80 ApplyStyle(GetViewStyle());
88 /// Creates a new instance of a view.
90 /// <since_tizen> 3 </since_tizen>
91 public View() : this(Interop.View.View_New(), true)
93 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
97 [EditorBrowsable(EditorBrowsableState.Never)]
98 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true, viewStyle)
103 /// Create a new instance of a View with setting the status of shown or hidden.
105 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
106 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
107 [EditorBrowsable(EditorBrowsableState.Never)]
108 public View(bool shown) : this(Interop.View.View_New(), true)
110 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
114 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
122 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
125 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
127 if (!ThemeManager.ThemeApplied) return;
129 if (viewStyle == null) UpdateStyle(); // Use style in the current theme
130 else ApplyStyle(viewStyle.Clone()); // Use given style
133 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
137 PositionUsesPivotPoint = false;
140 //ToDo: this has memory leak and this is not used currently. will be fixed soon by using Event subscribing pattern.
141 //_onWindowSendEventCallback = SendViewAddedEventToWindow;
142 //this.OnWindowSignal().Connect(_onWindowSendEventCallback);
150 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
152 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161 /// The event that is triggered when the View's ControlState is changed.
163 [EditorBrowsable(EditorBrowsableState.Never)]
164 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
166 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
168 private ControlState controlStates = ControlState.Normal;
170 /// Get/Set the control state.
172 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
173 [EditorBrowsable(EditorBrowsableState.Never)]
174 public ControlState ControlState
178 return controlStates;
182 if (controlStates == value)
187 var prevState = controlStates;
189 controlStates = value;
191 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
193 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
195 if (controlStatePropagation)
197 foreach (View child in Children)
199 child.ControlState = value;
203 OnControlStateChanged(changeInfo);
205 ControlStateChangedEvent?.Invoke(this, changeInfo);
209 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
210 [EditorBrowsable(EditorBrowsableState.Never)]
211 public bool ExcludeLayouting
215 return excludeLayouting;
219 excludeLayouting = value;
220 if (Layout != null && Layout.SetPositionByLayout == value)
222 Layout.SetPositionByLayout = !value;
223 Layout.RequestLayout();
228 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
229 [EditorBrowsable(EditorBrowsableState.Never)]
230 public bool IsResourcesCreated
234 return Application.Current.IsResourcesCreated;
238 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
239 [EditorBrowsable(EditorBrowsableState.Never)]
240 public ResourceDictionary XamlResources
244 return Application.Current.XamlResources;
248 Application.Current.XamlResources = value;
253 /// The StyleName, type string.
254 /// The value indicates DALi style name defined in json theme file.
256 /// <since_tizen> 3 </since_tizen>
257 public string StyleName
261 return (string)GetValue(StyleNameProperty);
265 SetValue(StyleNameProperty, value);
266 NotifyPropertyChanged();
271 /// The KeyInputFocus, type bool.
273 [EditorBrowsable(EditorBrowsableState.Never)]
274 public bool KeyInputFocus
278 return (bool)GetValue(KeyInputFocusProperty);
282 SetValue(KeyInputFocusProperty, value);
283 NotifyPropertyChanged();
288 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
291 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
293 /// <since_tizen> 3 </since_tizen>
294 public Color BackgroundColor
298 Color temp = (Color)GetValue(BackgroundColorProperty);
299 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
303 SetValue(BackgroundColorProperty, value);
304 if (selectorData != null)
306 selectorData.BackgroundImage.Reset(this);
307 selectorData.BackgroundColor.UpdateIfNeeds(this, value);
309 NotifyPropertyChanged();
314 /// The mutually exclusive with "backgroundColor" and "background" type Map.
316 /// <since_tizen> 3 </since_tizen>
317 public string BackgroundImage
321 return (string)GetValue(BackgroundImageProperty);
325 SetValue(BackgroundImageProperty, value);
326 if (selectorData != null)
328 selectorData.BackgroundColor.Reset(this);
329 selectorData.BackgroundImage.UpdateIfNeeds(this, value);
331 NotifyPropertyChanged();
336 /// Get or set the border of background image.
338 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
339 [EditorBrowsable(EditorBrowsableState.Never)]
340 public Rectangle BackgroundImageBorder
344 return (Rectangle)GetValue(BackgroundImageBorderProperty);
348 SetValue(BackgroundImageBorderProperty, value);
349 selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value);
350 NotifyPropertyChanged();
355 /// The background of view.
357 /// <since_tizen> 3 </since_tizen>
358 public Tizen.NUI.PropertyMap Background
362 return (PropertyMap)GetValue(BackgroundProperty);
366 SetValue(BackgroundProperty, value);
367 NotifyPropertyChanged();
372 /// Describes a shadow as an image for a View.
373 /// It is null by default.
376 /// Getter returns copied instance of current shadow.
379 /// The mutually exclusive with "BoxShadow".
381 [EditorBrowsable(EditorBrowsableState.Never)]
382 public ImageShadow ImageShadow
386 return (ImageShadow)GetValue(ImageShadowProperty);
390 SetValue(ImageShadowProperty, value);
391 if (selectorData != null)
393 selectorData.BoxShadow.Reset(this);
394 selectorData.ImageShadow.UpdateIfNeeds(this, value);
396 NotifyPropertyChanged();
401 /// Describes a box shaped shadow drawing for a View.
402 /// It is null by default.
405 /// Gettter returns copied instance of current shadow.
408 /// The mutually exclusive with "ImageShadow".
410 [EditorBrowsable(EditorBrowsableState.Never)]
411 public Shadow BoxShadow
415 return (Shadow)GetValue(BoxShadowProperty);
419 SetValue(BoxShadowProperty, value);
420 if (selectorData != null)
422 selectorData.ImageShadow.Reset(this);
423 selectorData.BoxShadow.UpdateIfNeeds(this, value);
425 NotifyPropertyChanged();
430 /// The radius for the rounded corners of the View.
431 /// This will rounds background and shadow edges.
432 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
434 [EditorBrowsable(EditorBrowsableState.Never)]
435 public float CornerRadius
439 return (float)GetValue(CornerRadiusProperty);
443 SetValue(CornerRadiusProperty, value);
444 selectorData?.CornerRadius.UpdateIfNeeds(this, value);
445 NotifyPropertyChanged();
450 /// The current state of the view.
452 /// <since_tizen> 3 </since_tizen>
457 return (States)GetValue(StateProperty);
461 SetValue(StateProperty, value);
462 NotifyPropertyChanged();
467 /// The current sub state of the view.
469 /// <since_tizen> 3 </since_tizen>
470 public States SubState
474 return (States)GetValue(SubStateProperty);
478 SetValue(SubStateProperty, value);
479 NotifyPropertyChanged();
484 /// Displays a tooltip
486 /// <since_tizen> 3 </since_tizen>
487 public Tizen.NUI.PropertyMap Tooltip
491 return (PropertyMap)GetValue(TooltipProperty);
495 SetValue(TooltipProperty, value);
496 NotifyPropertyChanged();
501 /// Displays a tooltip as a text.
503 /// <since_tizen> 3 </since_tizen>
504 public string TooltipText
508 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
509 NotifyPropertyChanged();
514 /// The Child property of FlexContainer.<br />
515 /// The proportion of the free space in the container, the flex item will receive.<br />
516 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
518 /// <since_tizen> 3 </since_tizen>
519 [Obsolete("Deprecated in API8, will be removed in API10.")]
524 return (float)GetValue(FlexProperty);
528 SetValue(FlexProperty, value);
529 NotifyPropertyChanged();
534 /// The Child property of FlexContainer.<br />
535 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
537 /// <since_tizen> 3 </since_tizen>
538 [Obsolete("Deprecated in API8, will be removed in API10.")]
543 return (int)GetValue(AlignSelfProperty);
547 SetValue(AlignSelfProperty, value);
548 NotifyPropertyChanged();
553 /// The Child property of FlexContainer.<br />
554 /// The space around the flex item.<br />
557 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
559 /// <since_tizen> 3 </since_tizen>
560 [Obsolete("Deprecated in API8, will be removed in API10.")]
561 public Vector4 FlexMargin
565 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
566 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
570 SetValue(FlexMarginProperty, value);
571 NotifyPropertyChanged();
576 /// The top-left cell this child occupies, if not set, the first available cell is used.
579 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
581 /// <since_tizen> 3 </since_tizen>
582 public Vector2 CellIndex
586 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
587 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
591 SetValue(CellIndexProperty, value);
592 NotifyPropertyChanged();
597 /// The number of rows this child occupies, if not set, the default value is 1.
599 /// <since_tizen> 3 </since_tizen>
604 return (float)GetValue(RowSpanProperty);
608 SetValue(RowSpanProperty, value);
609 NotifyPropertyChanged();
614 /// The number of columns this child occupies, if not set, the default value is 1.
616 /// <since_tizen> 3 </since_tizen>
617 public float ColumnSpan
621 return (float)GetValue(ColumnSpanProperty);
625 SetValue(ColumnSpanProperty, value);
626 NotifyPropertyChanged();
631 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
633 /// <since_tizen> 3 </since_tizen>
634 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
638 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
642 SetValue(CellHorizontalAlignmentProperty, value);
643 NotifyPropertyChanged();
648 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
650 /// <since_tizen> 3 </since_tizen>
651 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
655 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
659 SetValue(CellVerticalAlignmentProperty, value);
660 NotifyPropertyChanged();
665 /// The left focusable view.<br />
666 /// This will return null if not set.<br />
667 /// This will also return null if the specified left focusable view is not on a window.<br />
669 /// <since_tizen> 3 </since_tizen>
670 public View LeftFocusableView
672 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
675 return (View)GetValue(LeftFocusableViewProperty);
679 SetValue(LeftFocusableViewProperty, value);
680 NotifyPropertyChanged();
685 /// The right focusable view.<br />
686 /// This will return null if not set.<br />
687 /// This will also return null if the specified right focusable view is not on a window.<br />
689 /// <since_tizen> 3 </since_tizen>
690 public View RightFocusableView
692 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
695 return (View)GetValue(RightFocusableViewProperty);
699 SetValue(RightFocusableViewProperty, value);
700 NotifyPropertyChanged();
705 /// The up focusable view.<br />
706 /// This will return null if not set.<br />
707 /// This will also return null if the specified up focusable view is not on a window.<br />
709 /// <since_tizen> 3 </since_tizen>
710 public View UpFocusableView
712 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
715 return (View)GetValue(UpFocusableViewProperty);
719 SetValue(UpFocusableViewProperty, value);
720 NotifyPropertyChanged();
725 /// The down focusable view.<br />
726 /// This will return null if not set.<br />
727 /// This will also return null if the specified down focusable view is not on a window.<br />
729 /// <since_tizen> 3 </since_tizen>
730 public View DownFocusableView
732 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
735 return (View)GetValue(DownFocusableViewProperty);
739 SetValue(DownFocusableViewProperty, value);
740 NotifyPropertyChanged();
745 /// Whether the view should be focusable by keyboard navigation.
747 /// <since_tizen> 3 </since_tizen>
748 public bool Focusable
752 SetValue(FocusableProperty, value);
753 NotifyPropertyChanged();
757 return (bool)GetValue(FocusableProperty);
762 /// Retrieves the position of the view.<br />
763 /// The coordinates are relative to the view's parent.<br />
765 /// <since_tizen> 3 </since_tizen>
766 public Position CurrentPosition
770 return GetCurrentPosition();
775 /// Sets the size of a view for the width and the height.<br />
776 /// Geometry can be scaled to fit within this area.<br />
777 /// This does not interfere with the view's scale factor.<br />
778 /// The views default depth is the minimum of width and height.<br />
781 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
782 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
784 /// <since_tizen> 3 </since_tizen>
789 Size2D temp = (Size2D)GetValue(Size2DProperty);
790 int width = temp.Width;
791 int height = temp.Height;
793 if (this.Layout == null)
795 if (width < 0) { width = 0; }
796 if (height < 0) { height = 0; }
799 return new Size2D(OnSize2DChanged, width, height);
803 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
804 SetValue(Size2DProperty, value);
805 // Set Specification so when layouts measure this View it matches the value set here.
806 // All Views are currently Layouts.
807 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
808 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
809 _widthPolicy = value.Width;
810 _heightPolicy = value.Height;
812 _layout?.RequestLayout();
813 NotifyPropertyChanged();
818 /// Retrieves the size of the view.<br />
819 /// The coordinates are relative to the view's parent.<br />
821 /// <since_tizen> 3 </since_tizen>
822 public Size2D CurrentSize
826 return GetCurrentSize();
831 /// Retrieves and sets the view's opacity.<br />
833 /// <since_tizen> 3 </since_tizen>
838 return (float)GetValue(OpacityProperty);
842 SetValue(OpacityProperty, value);
843 selectorData?.Opacity.UpdateIfNeeds(this, value);
844 NotifyPropertyChanged();
849 /// Sets the position of the view for X and Y.<br />
850 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
851 /// If the position inheritance is disabled, sets the world position.<br />
854 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
855 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
857 /// <since_tizen> 3 </since_tizen>
858 public Position2D Position2D
862 Position2D temp = (Position2D)GetValue(Position2DProperty);
863 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
867 SetValue(Position2DProperty, value);
868 NotifyPropertyChanged();
873 /// Retrieves the screen postion of the view.<br />
875 /// <since_tizen> 3 </since_tizen>
876 public Vector2 ScreenPosition
880 Vector2 temp = new Vector2(0.0f, 0.0f);
881 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
887 /// Determines whether the pivot point should be used to determine the position of the view.
888 /// This is false by default.
890 /// <remarks>If false, then the top-left of the view is used for the position.
891 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
893 /// <since_tizen> 3 </since_tizen>
894 public bool PositionUsesPivotPoint
898 return (bool)GetValue(PositionUsesPivotPointProperty);
902 SetValue(PositionUsesPivotPointProperty, value);
903 NotifyPropertyChanged();
908 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
910 /// <since_tizen> 3 </since_tizen>
911 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
913 "View view = new View(); " +
914 "view.PivotPoint = PivotPoint.Center; " +
915 "view.PositionUsesPivotPoint = true;" +
916 " Deprecated in API5: Will be removed in API8")]
917 [EditorBrowsable(EditorBrowsableState.Never)]
918 public bool PositionUsesAnchorPoint
923 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
928 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
929 NotifyPropertyChanged();
934 /// Queries whether the view is connected to the stage.<br />
935 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
937 /// <since_tizen> 3 </since_tizen>
938 public bool IsOnWindow
947 /// Gets the depth in the hierarchy for the view.
949 /// <since_tizen> 3 </since_tizen>
950 public int HierarchyDepth
954 return GetHierarchyDepth();
959 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
962 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
963 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
964 /// The values set by this property will likely change.
966 /// <since_tizen> 3 </since_tizen>
967 public int SiblingOrder
971 return (int)GetValue(SiblingOrderProperty);
975 SetValue(SiblingOrderProperty, value);
977 LayoutGroup layout = Layout as LayoutGroup;
978 layout?.ChangeLayoutSiblingOrder(value);
980 NotifyPropertyChanged();
985 /// Returns the natural size of the view.
988 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
990 /// <since_tizen> 5 </since_tizen>
991 public Vector3 NaturalSize
995 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
996 if (NDalicPINVOKE.SWIGPendingException.Pending)
997 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1003 /// Returns the natural size (Size2D) of the view.
1006 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1008 /// <since_tizen> 4 </since_tizen>
1009 public Size2D NaturalSize2D
1013 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
1014 if (NDalicPINVOKE.SWIGPendingException.Pending)
1015 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1017 return new Size2D((int)temp.Width, (int)temp.Height);
1022 /// Gets or sets the origin of a view within its parent's area.<br />
1023 /// 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 />
1024 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1025 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1027 /// <pre>The view has been initialized.</pre>
1028 /// <since_tizen> 3 </since_tizen>
1029 public Position ParentOrigin
1033 Position tmp = (Position)GetValue(ParentOriginProperty);
1034 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1038 SetValue(ParentOriginProperty, value);
1039 NotifyPropertyChanged();
1044 /// Gets or sets the anchor-point of a view.<br />
1045 /// 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 />
1046 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1047 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1048 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1049 /// <pre>The view has been initialized.</pre>
1052 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1054 /// <since_tizen> 3 </since_tizen>
1055 public Position PivotPoint
1059 Position tmp = (Position)GetValue(PivotPointProperty);
1060 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1064 SetValue(PivotPointProperty, value);
1065 NotifyPropertyChanged();
1070 /// Gets or sets the size width of the view.
1074 /// Animatable - This property can be animated using <c>Animation</c> class.
1077 /// <since_tizen> 3 </since_tizen>
1078 public float SizeWidth
1082 return (float)GetValue(SizeWidthProperty);
1086 SetValue(SizeWidthProperty, value);
1087 NotifyPropertyChanged();
1092 /// Gets or sets the size height of the view.
1096 /// Animatable - This property can be animated using <c>Animation</c> class.
1099 /// <since_tizen> 3 </since_tizen>
1100 public float SizeHeight
1104 return (float)GetValue(SizeHeightProperty);
1108 SetValue(SizeHeightProperty, value);
1109 NotifyPropertyChanged();
1114 /// Gets or sets the position of the view.<br />
1115 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1116 /// If the position inheritance is disabled, sets the world position.<br />
1120 /// Animatable - This property can be animated using <c>Animation</c> class.
1122 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1124 /// <since_tizen> 3 </since_tizen>
1125 public Position Position
1129 Position tmp = (Position)GetValue(PositionProperty);
1130 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1134 SetValue(PositionProperty, value);
1135 NotifyPropertyChanged();
1140 /// Gets or sets the position X of the view.
1144 /// Animatable - This property can be animated using <c>Animation</c> class.
1147 /// <since_tizen> 3 </since_tizen>
1148 public float PositionX
1152 return (float)GetValue(PositionXProperty);
1156 SetValue(PositionXProperty, value);
1157 NotifyPropertyChanged();
1162 /// Gets or sets the position Y of the view.
1166 /// Animatable - This property can be animated using <c>Animation</c> class.
1169 /// <since_tizen> 3 </since_tizen>
1170 public float PositionY
1174 return (float)GetValue(PositionYProperty);
1178 SetValue(PositionYProperty, value);
1179 NotifyPropertyChanged();
1184 /// Gets or sets the position Z of the view.
1188 /// Animatable - This property can be animated using <c>Animation</c> class.
1191 /// <since_tizen> 3 </since_tizen>
1192 public float PositionZ
1196 return (float)GetValue(PositionZProperty);
1200 SetValue(PositionZProperty, value);
1201 NotifyPropertyChanged();
1206 /// Gets or sets the world position of the view.
1208 /// <since_tizen> 3 </since_tizen>
1209 public Vector3 WorldPosition
1213 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1214 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1220 /// Gets or sets the orientation of the view.<br />
1221 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1225 /// This is an asynchronous method.
1228 /// Animatable - This property can be animated using <c>Animation</c> class.
1231 /// <since_tizen> 3 </since_tizen>
1232 public Rotation Orientation
1236 return (Rotation)GetValue(OrientationProperty);
1240 SetValue(OrientationProperty, value);
1241 NotifyPropertyChanged();
1246 /// Gets or sets the world orientation of the view.<br />
1248 /// <since_tizen> 3 </since_tizen>
1249 public Rotation WorldOrientation
1253 Rotation temp = new Rotation();
1254 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1260 /// Gets or sets the scale factor applied to the view.<br />
1264 /// Animatable - This property can be animated using <c>Animation</c> class.
1266 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1268 /// <since_tizen> 3 </since_tizen>
1269 public Vector3 Scale
1273 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1274 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1278 SetValue(ScaleProperty, value);
1279 NotifyPropertyChanged();
1284 /// Gets or sets the scale X factor applied to the view.
1288 /// Animatable - This property can be animated using <c>Animation</c> class.
1291 /// <since_tizen> 3 </since_tizen>
1296 return (float)GetValue(ScaleXProperty);
1300 SetValue(ScaleXProperty, value);
1301 NotifyPropertyChanged();
1306 /// Gets or sets the scale Y factor applied to the view.
1310 /// Animatable - This property can be animated using <c>Animation</c> class.
1313 /// <since_tizen> 3 </since_tizen>
1318 return (float)GetValue(ScaleYProperty);
1322 SetValue(ScaleYProperty, value);
1323 NotifyPropertyChanged();
1328 /// Gets or sets the scale Z factor applied to the view.
1332 /// Animatable - This property can be animated using <c>Animation</c> class.
1335 /// <since_tizen> 3 </since_tizen>
1340 return (float)GetValue(ScaleZProperty);
1344 SetValue(ScaleZProperty, value);
1345 NotifyPropertyChanged();
1350 /// Gets the world scale of the view.
1352 /// <since_tizen> 3 </since_tizen>
1353 public Vector3 WorldScale
1357 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1358 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1364 /// Retrieves the visibility flag of the view.
1368 /// If the view is not visible, then the view and its children will not be rendered.
1369 /// 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.
1372 /// Animatable - This property can be animated using <c>Animation</c> class.
1375 /// <since_tizen> 3 </since_tizen>
1376 public bool Visibility
1381 GetProperty(View.Property.VISIBLE).Get(out temp);
1387 /// Gets the view's world color.
1389 /// <since_tizen> 3 </since_tizen>
1390 public Vector4 WorldColor
1394 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1395 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1401 /// Gets or sets the view's name.
1403 /// <since_tizen> 3 </since_tizen>
1408 return (string)GetValue(NameProperty);
1412 SetValue(NameProperty, value);
1413 NotifyPropertyChanged();
1418 /// Get the number of children held by the view.
1420 /// <since_tizen> 3 </since_tizen>
1421 public new uint ChildCount
1425 return GetChildCount();
1430 /// Gets the view's ID.
1433 /// <since_tizen> 3 </since_tizen>
1443 /// Gets or sets the status of whether the view should emit touch or hover signals.
1445 /// <since_tizen> 3 </since_tizen>
1446 public bool Sensitive
1450 return (bool)GetValue(SensitiveProperty);
1454 SetValue(SensitiveProperty, value);
1455 NotifyPropertyChanged();
1460 /// 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.
1462 /// <since_tizen> 3 </since_tizen>
1463 public bool LeaveRequired
1467 return (bool)GetValue(LeaveRequiredProperty);
1471 SetValue(LeaveRequiredProperty, value);
1472 NotifyPropertyChanged();
1477 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1479 /// <since_tizen> 3 </since_tizen>
1480 public bool InheritOrientation
1484 return (bool)GetValue(InheritOrientationProperty);
1488 SetValue(InheritOrientationProperty, value);
1489 NotifyPropertyChanged();
1494 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1496 /// <since_tizen> 3 </since_tizen>
1497 public bool InheritScale
1501 return (bool)GetValue(InheritScaleProperty);
1505 SetValue(InheritScaleProperty, value);
1506 NotifyPropertyChanged();
1511 /// Gets or sets the status of how the view and its children should be drawn.<br />
1512 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1513 /// 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 />
1514 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1515 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1516 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1518 /// <since_tizen> 3 </since_tizen>
1519 public DrawModeType DrawMode
1523 return (DrawModeType)GetValue(DrawModeProperty);
1527 SetValue(DrawModeProperty, value);
1528 NotifyPropertyChanged();
1533 /// Gets or sets the relative to parent size factor of the view.<br />
1534 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1535 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1538 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1540 /// <since_tizen> 3 </since_tizen>
1541 public Vector3 SizeModeFactor
1545 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1546 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1550 SetValue(SizeModeFactorProperty, value);
1551 NotifyPropertyChanged();
1556 /// Gets or sets the width resize policy to be used.
1558 /// <since_tizen> 3 </since_tizen>
1559 public ResizePolicyType WidthResizePolicy
1563 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1567 SetValue(WidthResizePolicyProperty, value);
1568 NotifyPropertyChanged();
1573 /// Gets or sets the height resize policy to be used.
1575 /// <since_tizen> 3 </since_tizen>
1576 public ResizePolicyType HeightResizePolicy
1580 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1584 SetValue(HeightResizePolicyProperty, value);
1585 NotifyPropertyChanged();
1590 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1591 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1593 /// <since_tizen> 3 </since_tizen>
1594 public SizeScalePolicyType SizeScalePolicy
1598 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1602 SetValue(SizeScalePolicyProperty, value);
1603 NotifyPropertyChanged();
1608 /// Gets or sets the status of whether the width size is dependent on the height size.
1610 /// <since_tizen> 3 </since_tizen>
1611 public bool WidthForHeight
1615 return (bool)GetValue(WidthForHeightProperty);
1619 SetValue(WidthForHeightProperty, value);
1620 NotifyPropertyChanged();
1625 /// Gets or sets the status of whether the height size is dependent on the width size.
1627 /// <since_tizen> 3 </since_tizen>
1628 public bool HeightForWidth
1632 return (bool)GetValue(HeightForWidthProperty);
1636 SetValue(HeightForWidthProperty, value);
1637 NotifyPropertyChanged();
1642 /// Gets or sets the padding for use in layout.
1645 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1647 /// <since_tizen> 5 </since_tizen>
1648 public Extents Padding
1652 // If View has a Layout then padding in stored in the base Layout class
1655 return Layout.Padding;
1659 Extents temp = (Extents)GetValue(PaddingProperty);
1660 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1662 // Two return points to prevent creating a zeroed Extent native object before assignment
1666 Extents padding = value;
1669 // Layout set so store Padding in LayoutItem instead of in View.
1670 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1671 // the position and sizes measure in the Layouting.
1672 Layout.Padding = value;
1673 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1674 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1675 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1677 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1681 SetValue(PaddingProperty, padding);
1682 NotifyPropertyChanged();
1687 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1689 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1691 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1693 /// <since_tizen> 3 </since_tizen>
1694 public Size2D MinimumSize
1698 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1699 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1705 throw new ArgumentNullException(nameof(value));
1707 if (_layout != null)
1709 // Note: it only works if minimum size is >= than natural size.
1710 // To force the size it should be done through the width&height spec or Size2D.
1711 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1712 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1713 _layout.RequestLayout();
1715 SetValue(MinimumSizeProperty, value);
1716 NotifyPropertyChanged();
1721 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1724 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1726 /// <since_tizen> 3 </since_tizen>
1727 public Size2D MaximumSize
1731 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1732 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1736 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1737 // MATCH_PARENT spec + parent container size can be used to limit
1738 if (_layout != null)
1740 _layout.RequestLayout();
1742 SetValue(MaximumSizeProperty, value);
1743 NotifyPropertyChanged();
1748 /// Gets or sets whether a child view inherits it's parent's position.<br />
1749 /// Default is to inherit.<br />
1750 /// 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 />
1752 /// <since_tizen> 3 </since_tizen>
1753 public bool InheritPosition
1757 return (bool)GetValue(InheritPositionProperty);
1761 SetValue(InheritPositionProperty, value);
1762 NotifyPropertyChanged();
1767 /// Gets or sets the clipping behavior (mode) of it's children.
1769 /// <since_tizen> 3 </since_tizen>
1770 public ClippingModeType ClippingMode
1774 return (ClippingModeType)GetValue(ClippingModeProperty);
1778 SetValue(ClippingModeProperty, value);
1779 NotifyPropertyChanged();
1784 /// Gets the number of renderers held by the view.
1786 /// <since_tizen> 3 </since_tizen>
1787 public uint RendererCount
1791 return GetRendererCount();
1796 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1799 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1801 /// <since_tizen> 3 </since_tizen>
1802 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1804 "View view = new View(); " +
1805 "view.PivotPoint = PivotPoint.Center; " +
1806 "view.PositionUsesPivotPoint = true;")]
1807 [EditorBrowsable(EditorBrowsableState.Never)]
1808 public Position AnchorPoint
1812 Position temp = new Position(0.0f, 0.0f, 0.0f);
1813 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1814 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1818 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1819 NotifyPropertyChanged();
1824 /// Sets the size of a view for the width, the height and the depth.<br />
1825 /// Geometry can be scaled to fit within this area.<br />
1826 /// This does not interfere with the view's scale factor.<br />
1827 /// The views default depth is the minimum of width and height.<br />
1831 /// Animatable - This property can be animated using <c>Animation</c> class.
1833 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1835 /// <since_tizen> 5 </since_tizen>
1840 Size tmp = (Size)GetValue(SizeProperty);
1841 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1845 SetValue(SizeProperty, value);
1846 NotifyPropertyChanged();
1851 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1853 /// <since_tizen> 3 </since_tizen>
1854 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1856 "Container parent = view.GetParent(); " +
1857 "View view = parent as View;")]
1858 [EditorBrowsable(EditorBrowsableState.Never)]
1859 public new View Parent
1864 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1865 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1866 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1868 if (basehandle is Layer layer)
1870 ret = new View(Layer.getCPtr(layer).Handle, false);
1871 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1875 ret = basehandle as View;
1878 Interop.BaseHandle.delete_BaseHandle(CPtr);
1879 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1881 if (NDalicPINVOKE.SWIGPendingException.Pending)
1882 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1888 /// Gets/Sets whether inherit parent's the layout Direction.
1890 /// <since_tizen> 4 </since_tizen>
1891 public bool InheritLayoutDirection
1895 return (bool)GetValue(InheritLayoutDirectionProperty);
1899 SetValue(InheritLayoutDirectionProperty, value);
1900 NotifyPropertyChanged();
1905 /// Gets/Sets the layout Direction.
1907 /// <since_tizen> 4 </since_tizen>
1908 public ViewLayoutDirectionType LayoutDirection
1912 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1916 SetValue(LayoutDirectionProperty, value);
1917 NotifyPropertyChanged();
1918 _layout?.RequestLayout();
1923 /// Gets or sets the Margin for use in layout.
1926 /// Margin property is supported by Layout algorithms and containers.
1927 /// Please Set Layout if you want to use Margin property.
1928 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1930 /// <since_tizen> 4 </since_tizen>
1931 public Extents Margin
1935 // If View has a Layout then margin is stored in Layout.
1938 return Layout.Margin;
1942 // If Layout not set then return margin stored in View.
1943 Extents temp = (Extents)GetValue(MarginProperty);
1944 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1946 // Two return points to prevent creating a zeroed Extent native object before assignment
1952 // Layout set so store Margin in LayoutItem instead of View.
1953 // If View stores the Margin too then the Legacy Size Negotiation will
1954 // overwrite the position and size values measured in the Layouting.
1955 Layout.Margin = value;
1956 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
1957 _layout?.RequestLayout();
1961 SetValue(MarginProperty, value);
1963 NotifyPropertyChanged();
1964 _layout?.RequestLayout();
1969 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1971 /// <since_tizen> 6 </since_tizen>
1972 public int WidthSpecification
1976 return _widthPolicy;
1980 _widthPolicy = value;
1981 if (_oldWidthPolicy != _widthPolicy)
1983 if (_widthPolicy >= 0)
1985 _measureSpecificationWidth = new MeasureSpecification(new LayoutLength(value), MeasureSpecification.ModeType.Exactly);
1987 if (_heightPolicy >= 0) // Policy an exact value
1989 // Create Size2D only both _widthPolicy and _heightPolicy are set.
1990 Size2D = new Size2D(_widthPolicy, _heightPolicy);
1993 _layout?.RequestLayout();
1994 _oldWidthPolicy = _widthPolicy;
2000 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2002 /// <since_tizen> 6 </since_tizen>
2003 public int HeightSpecification
2007 return _heightPolicy;
2011 _heightPolicy = value;
2012 if (_oldHeightPolicy != _heightPolicy)
2014 if (_heightPolicy >= 0)
2016 _measureSpecificationHeight = new MeasureSpecification(new LayoutLength(value), MeasureSpecification.ModeType.Exactly);
2018 if (_widthPolicy >= 0) // Policy an exact value
2020 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2021 Size2D = new Size2D(_widthPolicy, _heightPolicy);
2025 _layout?.RequestLayout();
2026 _oldHeightPolicy = _heightPolicy;
2032 /// Gets the List of transitions for this View.
2034 /// <since_tizen> 6 </since_tizen>
2035 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2039 if (_layoutTransitions == null)
2041 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2043 return _layoutTransitions;
2048 /// Set a layout transitions for this View.
2050 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2052 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2054 /// <since_tizen> 6 </since_tizen>
2055 public LayoutTransition LayoutTransition
2061 throw new global::System.ArgumentNullException(nameof(value));
2063 if (_layoutTransitions == null)
2065 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2068 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions, value.Condition, value, true);
2070 AttachTransitionsToChildren(value);
2075 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2078 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2080 /// <since_tizen> 4 </since_tizen>
2081 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2082 [EditorBrowsable(EditorBrowsableState.Never)]
2083 public Extents PaddingEX
2087 Extents temp = new Extents(0, 0, 0, 0);
2088 GetProperty(View.Property.PADDING).Get(temp);
2089 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2093 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2094 NotifyPropertyChanged();
2095 _layout?.RequestLayout();
2100 /// The Color of View. This is an RGBA value.
2104 /// Animatable - This property can be animated using <c>Animation</c> class.
2106 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2108 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2109 [EditorBrowsable(EditorBrowsableState.Never)]
2114 Color temp = (Color)GetValue(ColorProperty);
2115 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2119 SetValue(ColorProperty, value);
2120 selectorData?.Color.UpdateIfNeeds(this, value);
2121 NotifyPropertyChanged();
2126 /// Set the layout on this View. Replaces any existing Layout.
2128 /// <since_tizen> 6 </since_tizen>
2129 public LayoutItem Layout
2137 // Do nothing if layout provided is already set on this View.
2138 if (value == _layout)
2143 layoutingDisabled = false;
2146 // If new layout being set already has a owner then that owner receives a replacement default layout.
2147 // First check if the layout to be set already has a owner.
2148 if (value?.Owner != null)
2150 // Previous owner of the layout gets a default layout as a replacement.
2151 value.Owner.Layout = new AbsoluteLayout();
2153 // Copy Margin and Padding to replacement LayoutGroup.
2154 if (value.Owner.Layout != null)
2156 value.Owner.Layout.Margin = value.Margin;
2157 value.Owner.Layout.Padding = value.Padding;
2161 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2162 // View if no replacement. Previously margin and padding values would have been moved from
2163 // the View to the layout.
2164 if (_layout != null) // Existing layout
2168 // Existing layout being replaced so copy over margin and padding values.
2169 value.Margin = _layout.Margin;
2170 value.Padding = _layout.Padding;
2174 // Layout not being replaced so restore margin and padding to View.
2175 SetValue(MarginProperty, _layout.Margin);
2176 SetValue(PaddingProperty, _layout.Padding);
2177 NotifyPropertyChanged();
2182 // First Layout to be added to the View hence copy
2184 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2187 if (Margin.Top != 0 || Margin.Bottom != 0 || Margin.Start != 0 || Margin.End != 0)
2189 // If View already has a margin set then store it in Layout instead.
2190 value.Margin = Margin;
2191 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2192 NotifyPropertyChanged();
2195 if (Padding.Top != 0 || Padding.Bottom != 0 || Padding.Start != 0 || Padding.End != 0)
2197 // If View already has a padding set then store it in Layout instead.
2198 value.Padding = Padding;
2199 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2200 NotifyPropertyChanged();
2205 // Remove existing layout from it's parent layout group.
2206 _layout?.Unparent();
2208 value.SetPositionByLayout = !excludeLayouting;
2210 // Set layout to this view
2216 /// The weight of the View, used to share available space in a layout with siblings.
2218 /// <since_tizen> 6 </since_tizen>
2228 _layout?.RequestLayout();
2233 /// Whether to load the BackgroundImage synchronously.
2234 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2235 /// Note: For Normal Quad images only.
2237 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2238 [EditorBrowsable(EditorBrowsableState.Never)]
2239 public bool BackgroundImageSynchronosLoading
2243 return _backgroundImageSynchronosLoading;
2247 _backgroundImageSynchronosLoading = value;
2249 string bgUrl = null;
2250 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2252 if (!string.IsNullOrEmpty(bgUrl))
2254 PropertyMap bgMap = this.Background;
2255 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2261 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2262 [EditorBrowsable(EditorBrowsableState.Never)]
2263 public Vector2 UpdateSizeHint
2267 return (Vector2)GetValue(UpdateSizeHintProperty);
2271 SetValue(UpdateSizeHintProperty, value);
2272 NotifyPropertyChanged();
2276 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2277 [EditorBrowsable(EditorBrowsableState.Never)]
2278 public string[] TransitionNames
2282 return transitionNames;
2286 transitionNames = value;
2292 /// Enable/Disable ControlState propagation for children.
2293 /// It is false by default.
2294 /// If the View needs to share ControlState with descendants, please set it true.
2295 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2297 [EditorBrowsable(EditorBrowsableState.Never)]
2298 public bool EnableControlStatePropagation
2300 get => controlStatePropagation;
2303 controlStatePropagation = value;
2305 foreach (View child in Children)
2307 child.EnableControlStatePropagation = value;
2313 /// If this property is set to true, the View can have a touch related ControlState (such as Pressed) when touch.
2314 /// By default, it is false in View, true in Control.
2315 /// Note that if the value is true, the View will be a touch receptor.
2317 [EditorBrowsable(EditorBrowsableState.Never)]
2318 public bool EnableControlState
2322 return (bool)GetValue(EnableControlStateProperty);
2326 SetValue(EnableControlStateProperty, value);
2331 /// Whether the actor grab all touches even if touch leaves its boundary.
2333 /// <returns>true, if it grab all touch after start</returns>
2334 [EditorBrowsable(EditorBrowsableState.Never)]
2335 public bool GrabTouchAfterLeave
2340 GetProperty(View.Property.CaptureAllTouchAfterStart).Get(out temp);
2345 SetProperty(View.Property.CaptureAllTouchAfterStart, new Tizen.NUI.PropertyValue(value));
2346 NotifyPropertyChanged();
2351 /// Determines which blend equation will be used to render renderers of this actor.
2353 /// <returns>blend equation enum currently assigned</returns>
2354 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2355 [EditorBrowsable(EditorBrowsableState.Never)]
2356 public BlendEquationType BlendEquation
2361 GetProperty(View.Property.BlendEquation).Get(out temp);
2362 return (BlendEquationType)temp;
2366 SetProperty(View.Property.BlendEquation, new Tizen.NUI.PropertyValue((int)value));
2367 NotifyPropertyChanged();
2372 /// If the value is true, the View will change its style as the theme changes.
2373 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2375 [EditorBrowsable(EditorBrowsableState.Never)]
2376 public bool ThemeChangeSensitive
2378 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2379 set => SetValue(ThemeChangeSensitiveProperty, value);
2383 /// Get Style, it is abstract function and must be override.
2385 /// <since_tizen> 6 </since_tizen>
2386 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2387 // TODO: It should be deprecated. please use CreateViewStyle instead.
2388 [EditorBrowsable(EditorBrowsableState.Never)]
2389 protected virtual ViewStyle GetViewStyle()
2391 return CreateViewStyle();
2395 /// Create Style, it is abstract function and must be override.
2397 [EditorBrowsable(EditorBrowsableState.Never)]
2398 protected virtual ViewStyle CreateViewStyle()
2400 return new ViewStyle();
2404 /// Called after the View's ControlStates changed.
2406 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2407 [EditorBrowsable(EditorBrowsableState.Never)]
2408 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2414 [EditorBrowsable(EditorBrowsableState.Never)]
2415 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2420 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2421 [EditorBrowsable(EditorBrowsableState.Never)]
2422 public virtual void ApplyStyle(ViewStyle viewStyle)
2424 if (null == viewStyle || this.viewStyle == viewStyle) return;
2426 this.viewStyle = viewStyle;
2428 Dictionary<string, BindableProperty> bindablePropertyOfView;
2429 Type viewType = GetType();
2431 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2432 Type styleType = viewStyle.GetType();
2434 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2435 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2437 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2439 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2441 BindableProperty viewProperty;
2442 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2444 if (null != viewProperty && viewProperty != StyleNameProperty)
2446 object value = viewStyle.GetValue(keyValuePair.Value);
2450 SetValue(viewProperty, value);