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;
64 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
65 internal BackgroundExtraData backgroundExtraData;
70 /// The Style instance binded with this View.
72 [EditorBrowsable(EditorBrowsableState.Never)]
73 protected ViewStyle viewStyle;
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)
103 this.ViewStyle.CopyFrom(viewStyle);
107 /// Create a new instance of a View with setting the status of shown or hidden.
109 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
110 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
111 [EditorBrowsable(EditorBrowsableState.Never)]
112 public View(bool shown) : this(Interop.View.View_New(), true)
114 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
118 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
126 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
129 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
131 if (this.viewStyle == null)
133 ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
137 this.viewStyle.CopyFrom(viewStyle);
141 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
145 PositionUsesPivotPoint = false;
148 _onWindowSendEventCallback = SendViewAddedEventToWindow;
149 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
157 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
159 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168 /// The delegate for ControlState changed event.
170 [EditorBrowsable(EditorBrowsableState.Never)]
171 public delegate void ControlStateChangesDelegate(View obj, ControlStateChangedInfo controlStateChangedInfo);
174 /// The event that is triggered when the View's ControlState is changed.
176 [EditorBrowsable(EditorBrowsableState.Never)]
177 public event ControlStateChangesDelegate ControlStateChangeEvent;
179 internal event ControlStateChangesDelegate ControlStateChangeEventInternal;
181 private ControlStates controlStates;
183 /// Get/Set the control state.
185 /// <since_tizen> 6 </since_tizen>
186 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
187 [EditorBrowsable(EditorBrowsableState.Never)]
188 public ControlStates ControlState
192 return controlStates;
196 SetControlState(value, ControlStateChangedInfo.InputMethodType.None, null);
200 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
201 [EditorBrowsable(EditorBrowsableState.Never)]
202 public bool IsResourcesCreated
206 return Application.Current.IsResourcesCreated;
210 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
211 [EditorBrowsable(EditorBrowsableState.Never)]
212 public ResourceDictionary XamlResources
216 return Application.Current.XamlResources;
220 Application.Current.XamlResources = value;
225 /// The StyleName, type string.
227 /// <since_tizen> 3 </since_tizen>
228 public string StyleName
232 return (string)GetValue(StyleNameProperty);
236 SetValue(StyleNameProperty, value);
237 NotifyPropertyChanged();
242 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
245 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
247 /// <since_tizen> 3 </since_tizen>
248 public Color BackgroundColor
252 Color temp = (Color)GetValue(BackgroundColorProperty);
253 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
257 SetValue(BackgroundColorProperty, value);
258 NotifyPropertyChanged();
263 /// The mutually exclusive with "backgroundColor" and "background" type Map.
265 /// <since_tizen> 3 </since_tizen>
266 public string BackgroundImage
270 return (string)GetValue(BackgroundImageProperty);
274 SetValue(BackgroundImageProperty, value);
275 NotifyPropertyChanged();
280 /// Get or set the border of background image.
282 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
283 [EditorBrowsable(EditorBrowsableState.Never)]
284 public Rectangle BackgroundImageBorder
288 return (Rectangle)GetValue(BackgroundImageBorderProperty);
292 SetValue(BackgroundImageBorderProperty, value);
293 NotifyPropertyChanged();
298 /// The background of view.
300 /// <since_tizen> 3 </since_tizen>
301 public Tizen.NUI.PropertyMap Background
305 return (PropertyMap)GetValue(BackgroundProperty);
309 SetValue(BackgroundProperty, value);
310 NotifyPropertyChanged();
315 /// Describes a shadow as an image for a View.
316 /// It is null by default.
319 /// Gettter returns copied instance of current shadow.
322 /// The mutually exclusive with "BoxShadow".
324 [EditorBrowsable(EditorBrowsableState.Never)]
325 public ImageShadow ImageShadow
329 return (ImageShadow)GetValue(ImageShadowProperty);
333 SetValue(ImageShadowProperty, value);
334 NotifyPropertyChanged();
339 /// Describes a box shaped shadow drawing for a View.
340 /// It is null by default.
343 /// Gettter returns copied instance of current shadow.
346 /// The mutually exclusive with "ImageShadow".
348 [EditorBrowsable(EditorBrowsableState.Never)]
349 public Shadow BoxShadow
353 return (Shadow)GetValue(BoxShadowProperty);
357 SetValue(BoxShadowProperty, value);
358 NotifyPropertyChanged();
363 /// The radius for the rounded corners of the View.
364 /// This will rounds background and shadow edges.
365 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
367 [EditorBrowsable(EditorBrowsableState.Never)]
368 public float CornerRadius
372 return (float)GetValue(CornerRadiusProperty);
376 SetValue(CornerRadiusProperty, value);
377 NotifyPropertyChanged();
382 /// The current state of the view.
384 /// <since_tizen> 3 </since_tizen>
389 return (States)GetValue(StateProperty);
393 SetValue(StateProperty, value);
394 NotifyPropertyChanged();
399 /// The current sub state of the view.
401 /// <since_tizen> 3 </since_tizen>
402 public States SubState
406 return (States)GetValue(SubStateProperty);
410 SetValue(SubStateProperty, value);
411 NotifyPropertyChanged();
416 /// Displays a tooltip
418 /// <since_tizen> 3 </since_tizen>
419 public Tizen.NUI.PropertyMap Tooltip
423 return (PropertyMap)GetValue(TooltipProperty);
427 SetValue(TooltipProperty, value);
428 NotifyPropertyChanged();
433 /// Displays a tooltip as a text.
435 /// <since_tizen> 3 </since_tizen>
436 public string TooltipText
440 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
441 NotifyPropertyChanged();
446 /// The Child property of FlexContainer.<br />
447 /// The proportion of the free space in the container, the flex item will receive.<br />
448 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
450 /// <since_tizen> 3 </since_tizen>
455 return (float)GetValue(FlexProperty);
459 SetValue(FlexProperty, value);
460 NotifyPropertyChanged();
465 /// The Child property of FlexContainer.<br />
466 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
468 /// <since_tizen> 3 </since_tizen>
473 return (int)GetValue(AlignSelfProperty);
477 SetValue(AlignSelfProperty, value);
478 NotifyPropertyChanged();
483 /// The Child property of FlexContainer.<br />
484 /// The space around the flex item.<br />
487 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
489 /// <since_tizen> 3 </since_tizen>
490 public Vector4 FlexMargin
494 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
495 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
499 SetValue(FlexMarginProperty, value);
500 NotifyPropertyChanged();
505 /// The top-left cell this child occupies, if not set, the first available cell is used.
508 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
510 /// <since_tizen> 3 </since_tizen>
511 public Vector2 CellIndex
515 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
516 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
520 SetValue(CellIndexProperty, value);
521 NotifyPropertyChanged();
526 /// The number of rows this child occupies, if not set, the default value is 1.
528 /// <since_tizen> 3 </since_tizen>
533 return (float)GetValue(RowSpanProperty);
537 SetValue(RowSpanProperty, value);
538 NotifyPropertyChanged();
543 /// The number of columns this child occupies, if not set, the default value is 1.
545 /// <since_tizen> 3 </since_tizen>
546 public float ColumnSpan
550 return (float)GetValue(ColumnSpanProperty);
554 SetValue(ColumnSpanProperty, value);
555 NotifyPropertyChanged();
560 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
562 /// <since_tizen> 3 </since_tizen>
563 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
567 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
571 SetValue(CellHorizontalAlignmentProperty, value);
572 NotifyPropertyChanged();
577 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
579 /// <since_tizen> 3 </since_tizen>
580 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
584 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
588 SetValue(CellVerticalAlignmentProperty, value);
589 NotifyPropertyChanged();
594 /// The left focusable view.<br />
595 /// This will return null if not set.<br />
596 /// This will also return null if the specified left focusable view is not on a window.<br />
598 /// <since_tizen> 3 </since_tizen>
599 public View LeftFocusableView
601 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
604 return (View)GetValue(LeftFocusableViewProperty);
608 SetValue(LeftFocusableViewProperty, value);
609 NotifyPropertyChanged();
614 /// The right focusable view.<br />
615 /// This will return null if not set.<br />
616 /// This will also return null if the specified right focusable view is not on a window.<br />
618 /// <since_tizen> 3 </since_tizen>
619 public View RightFocusableView
621 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
624 return (View)GetValue(RightFocusableViewProperty);
628 SetValue(RightFocusableViewProperty, value);
629 NotifyPropertyChanged();
634 /// The up focusable view.<br />
635 /// This will return null if not set.<br />
636 /// This will also return null if the specified up focusable view is not on a window.<br />
638 /// <since_tizen> 3 </since_tizen>
639 public View UpFocusableView
641 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
644 return (View)GetValue(UpFocusableViewProperty);
648 SetValue(UpFocusableViewProperty, value);
649 NotifyPropertyChanged();
654 /// The down focusable view.<br />
655 /// This will return null if not set.<br />
656 /// This will also return null if the specified down focusable view is not on a window.<br />
658 /// <since_tizen> 3 </since_tizen>
659 public View DownFocusableView
661 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
664 return (View)GetValue(DownFocusableViewProperty);
668 SetValue(DownFocusableViewProperty, value);
669 NotifyPropertyChanged();
674 /// Whether the view should be focusable by keyboard navigation.
676 /// <since_tizen> 3 </since_tizen>
677 public bool Focusable
681 SetValue(FocusableProperty, value);
682 NotifyPropertyChanged();
686 return (bool)GetValue(FocusableProperty);
691 /// Retrieves the position of the view.<br />
692 /// The coordinates are relative to the view's parent.<br />
694 /// <since_tizen> 3 </since_tizen>
695 public Position CurrentPosition
699 return GetCurrentPosition();
704 /// Sets the size of a view for the width and the height.<br />
705 /// Geometry can be scaled to fit within this area.<br />
706 /// This does not interfere with the view's scale factor.<br />
707 /// The views default depth is the minimum of width and height.<br />
710 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
711 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
713 /// <since_tizen> 3 </since_tizen>
718 Size2D temp = (Size2D)GetValue(Size2DProperty);
719 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
723 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
724 SetValue(Size2DProperty, value);
725 // Set Specification so when layouts measure this View it matches the value set here.
726 // All Views are currently Layouts.
727 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
728 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
729 _widthPolicy = value.Width;
730 _heightPolicy = value.Height;
731 _layout?.RequestLayout();
732 NotifyPropertyChanged();
737 /// Retrieves the size of the view.<br />
738 /// The coordinates are relative to the view's parent.<br />
740 /// <since_tizen> 3 </since_tizen>
741 public Size2D CurrentSize
745 return GetCurrentSize();
750 /// Retrieves and sets the view's opacity.<br />
752 /// <since_tizen> 3 </since_tizen>
757 return (float)GetValue(OpacityProperty);
761 SetValue(OpacityProperty, value);
762 NotifyPropertyChanged();
767 /// Sets the position of the view for X and Y.<br />
768 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
769 /// If the position inheritance is disabled, sets the world position.<br />
772 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
773 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
775 /// <since_tizen> 3 </since_tizen>
776 public Position2D Position2D
780 Position2D temp = (Position2D)GetValue(Position2DProperty);
781 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
785 SetValue(Position2DProperty, value);
786 NotifyPropertyChanged();
791 /// Retrieves the screen postion of the view.<br />
793 /// <since_tizen> 3 </since_tizen>
794 public Vector2 ScreenPosition
798 Vector2 temp = new Vector2(0.0f, 0.0f);
799 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
805 /// Determines whether the pivot point should be used to determine the position of the view.
806 /// This is true by default.
808 /// <remarks>If false, then the top-left of the view is used for the position.
809 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
811 /// <since_tizen> 3 </since_tizen>
812 public bool PositionUsesPivotPoint
816 return (bool)GetValue(PositionUsesPivotPointProperty);
820 SetValue(PositionUsesPivotPointProperty, value);
821 NotifyPropertyChanged();
826 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
828 /// <since_tizen> 3 </since_tizen>
829 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
831 "View view = new View(); " +
832 "view.PivotPoint = PivotPoint.Center; " +
833 "view.PositionUsesPivotPoint = true;" +
834 " Deprecated in API5: Will be removed in API8")]
835 [EditorBrowsable(EditorBrowsableState.Never)]
836 public bool PositionUsesAnchorPoint
841 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
846 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
847 NotifyPropertyChanged();
852 /// Queries whether the view is connected to the stage.<br />
853 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
855 /// <since_tizen> 3 </since_tizen>
856 public bool IsOnWindow
865 /// Gets the depth in the hierarchy for the view.
867 /// <since_tizen> 3 </since_tizen>
868 public int HierarchyDepth
872 return GetHierarchyDepth();
877 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
880 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
881 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
882 /// The values set by this property will likely change.
884 /// <since_tizen> 3 </since_tizen>
885 public int SiblingOrder
889 return (int)GetValue(SiblingOrderProperty);
893 SetValue(SiblingOrderProperty, value);
895 LayoutGroup layout = Layout as LayoutGroup;
896 layout?.ChangeLayoutSiblingOrder(value);
898 NotifyPropertyChanged();
903 /// Returns the natural size of the view.
906 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
908 /// <since_tizen> 5 </since_tizen>
909 public Vector3 NaturalSize
913 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
914 if (NDalicPINVOKE.SWIGPendingException.Pending)
915 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
921 /// Returns the natural size (Size2D) of the view.
924 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
926 /// <since_tizen> 4 </since_tizen>
927 public Size2D NaturalSize2D
931 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
932 if (NDalicPINVOKE.SWIGPendingException.Pending)
933 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
935 return new Size2D((int)temp.Width, (int)temp.Height);
940 /// Gets or sets the origin of a view within its parent's area.<br />
941 /// 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 />
942 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
943 /// A view's position is the distance between this origin and the view's anchor-point.<br />
945 /// <pre>The view has been initialized.</pre>
946 /// <since_tizen> 3 </since_tizen>
947 public Position ParentOrigin
951 Position tmp = (Position)GetValue(ParentOriginProperty);
952 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
956 SetValue(ParentOriginProperty, value);
957 NotifyPropertyChanged();
962 /// Gets or sets the anchor-point of a view.<br />
963 /// 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 />
964 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
965 /// A view position is the distance between its parent-origin and this anchor-point.<br />
966 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
967 /// <pre>The view has been initialized.</pre>
970 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
972 /// <since_tizen> 3 </since_tizen>
973 public Position PivotPoint
977 Position tmp = (Position)GetValue(PivotPointProperty);
978 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
982 SetValue(PivotPointProperty, value);
983 NotifyPropertyChanged();
988 /// Gets or sets the size width of the view.
992 /// Animatable - This property can be animated using <c>Animation</c> class.
995 /// <since_tizen> 3 </since_tizen>
996 public float SizeWidth
1000 return (float)GetValue(SizeWidthProperty);
1004 SetValue(SizeWidthProperty, value);
1005 WidthSpecification = (int)Math.Ceiling(value);
1006 NotifyPropertyChanged();
1011 /// Gets or sets the size height of the view.
1015 /// Animatable - This property can be animated using <c>Animation</c> class.
1018 /// <since_tizen> 3 </since_tizen>
1019 public float SizeHeight
1023 return (float)GetValue(SizeHeightProperty);
1027 SetValue(SizeHeightProperty, value);
1028 HeightSpecification = (int)Math.Ceiling(value);
1029 NotifyPropertyChanged();
1034 /// Gets or sets the position of the view.<br />
1035 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1036 /// If the position inheritance is disabled, sets the world position.<br />
1040 /// Animatable - This property can be animated using <c>Animation</c> class.
1042 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1044 /// <since_tizen> 3 </since_tizen>
1045 public Position Position
1049 Position tmp = (Position)GetValue(PositionProperty);
1050 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1054 SetValue(PositionProperty, value);
1055 NotifyPropertyChanged();
1060 /// Gets or sets the position X of the view.
1064 /// Animatable - This property can be animated using <c>Animation</c> class.
1067 /// <since_tizen> 3 </since_tizen>
1068 public float PositionX
1072 return (float)GetValue(PositionXProperty);
1076 SetValue(PositionXProperty, value);
1077 NotifyPropertyChanged();
1082 /// Gets or sets the position Y of the view.
1086 /// Animatable - This property can be animated using <c>Animation</c> class.
1089 /// <since_tizen> 3 </since_tizen>
1090 public float PositionY
1094 return (float)GetValue(PositionYProperty);
1098 SetValue(PositionYProperty, value);
1099 NotifyPropertyChanged();
1104 /// Gets or sets the position Z of the view.
1108 /// Animatable - This property can be animated using <c>Animation</c> class.
1111 /// <since_tizen> 3 </since_tizen>
1112 public float PositionZ
1116 return (float)GetValue(PositionZProperty);
1120 SetValue(PositionZProperty, value);
1121 NotifyPropertyChanged();
1126 /// Gets or sets the world position of the view.
1128 /// <since_tizen> 3 </since_tizen>
1129 public Vector3 WorldPosition
1133 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1134 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1140 /// Gets or sets the orientation of the view.<br />
1141 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1145 /// This is an asynchronous method.
1148 /// Animatable - This property can be animated using <c>Animation</c> class.
1151 /// <since_tizen> 3 </since_tizen>
1152 public Rotation Orientation
1156 return (Rotation)GetValue(OrientationProperty);
1160 SetValue(OrientationProperty, value);
1161 NotifyPropertyChanged();
1166 /// Gets or sets the world orientation of the view.<br />
1168 /// <since_tizen> 3 </since_tizen>
1169 public Rotation WorldOrientation
1173 Rotation temp = new Rotation();
1174 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1180 /// Gets or sets the scale factor applied to the view.<br />
1184 /// Animatable - This property can be animated using <c>Animation</c> class.
1186 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1188 /// <since_tizen> 3 </since_tizen>
1189 public Vector3 Scale
1193 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1194 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1198 SetValue(ScaleProperty, value);
1199 NotifyPropertyChanged();
1204 /// Gets or sets the scale X factor applied to the view.
1208 /// Animatable - This property can be animated using <c>Animation</c> class.
1211 /// <since_tizen> 3 </since_tizen>
1216 return (float)GetValue(ScaleXProperty);
1220 SetValue(ScaleXProperty, value);
1221 NotifyPropertyChanged();
1226 /// Gets or sets the scale Y factor applied to the view.
1230 /// Animatable - This property can be animated using <c>Animation</c> class.
1233 /// <since_tizen> 3 </since_tizen>
1238 return (float)GetValue(ScaleYProperty);
1242 SetValue(ScaleYProperty, value);
1243 NotifyPropertyChanged();
1248 /// Gets or sets the scale Z factor applied to the view.
1252 /// Animatable - This property can be animated using <c>Animation</c> class.
1255 /// <since_tizen> 3 </since_tizen>
1260 return (float)GetValue(ScaleZProperty);
1264 SetValue(ScaleZProperty, value);
1265 NotifyPropertyChanged();
1270 /// Gets the world scale of the view.
1272 /// <since_tizen> 3 </since_tizen>
1273 public Vector3 WorldScale
1277 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1278 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1284 /// Retrieves the visibility flag of the view.
1288 /// If the view is not visible, then the view and its children will not be rendered.
1289 /// 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.
1292 /// Animatable - This property can be animated using <c>Animation</c> class.
1295 /// <since_tizen> 3 </since_tizen>
1296 public bool Visibility
1301 GetProperty(View.Property.VISIBLE).Get(out temp);
1307 /// Gets the view's world color.
1309 /// <since_tizen> 3 </since_tizen>
1310 public Vector4 WorldColor
1314 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1315 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1321 /// Gets or sets the view's name.
1323 /// <since_tizen> 3 </since_tizen>
1328 return (string)GetValue(NameProperty);
1332 SetValue(NameProperty, value);
1333 NotifyPropertyChanged();
1338 /// Get the number of children held by the view.
1340 /// <since_tizen> 3 </since_tizen>
1341 public new uint ChildCount
1345 return GetChildCount();
1350 /// Gets the view's ID.
1353 /// <since_tizen> 3 </since_tizen>
1363 /// Gets or sets the status of whether the view should emit touch or hover signals.
1365 /// <since_tizen> 3 </since_tizen>
1366 public bool Sensitive
1370 return (bool)GetValue(SensitiveProperty);
1374 SetValue(SensitiveProperty, value);
1375 NotifyPropertyChanged();
1380 /// 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.
1382 /// <since_tizen> 3 </since_tizen>
1383 public bool LeaveRequired
1387 return (bool)GetValue(LeaveRequiredProperty);
1391 SetValue(LeaveRequiredProperty, value);
1392 NotifyPropertyChanged();
1397 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1399 /// <since_tizen> 3 </since_tizen>
1400 public bool InheritOrientation
1404 return (bool)GetValue(InheritOrientationProperty);
1408 SetValue(InheritOrientationProperty, value);
1409 NotifyPropertyChanged();
1414 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1416 /// <since_tizen> 3 </since_tizen>
1417 public bool InheritScale
1421 return (bool)GetValue(InheritScaleProperty);
1425 SetValue(InheritScaleProperty, value);
1426 NotifyPropertyChanged();
1431 /// Gets or sets the status of how the view and its children should be drawn.<br />
1432 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1433 /// 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 />
1434 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1435 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1436 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1438 /// <since_tizen> 3 </since_tizen>
1439 public DrawModeType DrawMode
1443 return (DrawModeType)GetValue(DrawModeProperty);
1447 SetValue(DrawModeProperty, value);
1448 NotifyPropertyChanged();
1453 /// Gets or sets the relative to parent size factor of the view.<br />
1454 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1455 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1458 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1460 /// <since_tizen> 3 </since_tizen>
1461 public Vector3 SizeModeFactor
1465 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1466 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1470 SetValue(SizeModeFactorProperty, value);
1471 NotifyPropertyChanged();
1476 /// Gets or sets the width resize policy to be used.
1478 /// <since_tizen> 3 </since_tizen>
1479 public ResizePolicyType WidthResizePolicy
1483 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1487 SetValue(WidthResizePolicyProperty, value);
1488 // Match ResizePolicy to new Layouting.
1489 // Parent relative policies can not be mapped at this point as parent size unknown.
1492 case ResizePolicyType.UseNaturalSize:
1494 WidthSpecification = LayoutParamPolicies.WrapContent;
1497 case ResizePolicyType.FillToParent:
1499 WidthSpecification = LayoutParamPolicies.MatchParent;
1502 case ResizePolicyType.FitToChildren:
1504 WidthSpecification = LayoutParamPolicies.WrapContent;
1510 NotifyPropertyChanged();
1515 /// Gets or sets the height resize policy to be used.
1517 /// <since_tizen> 3 </since_tizen>
1518 public ResizePolicyType HeightResizePolicy
1522 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1526 SetValue(HeightResizePolicyProperty, value);
1527 // Match ResizePolicy to new Layouting.
1528 // Parent relative policies can not be mapped at this point as parent size unknown.
1531 case ResizePolicyType.UseNaturalSize:
1533 HeightSpecification = LayoutParamPolicies.WrapContent;
1536 case ResizePolicyType.FillToParent:
1538 HeightSpecification = LayoutParamPolicies.MatchParent;
1541 case ResizePolicyType.FitToChildren:
1543 HeightSpecification = LayoutParamPolicies.WrapContent;
1549 NotifyPropertyChanged();
1554 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1555 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1557 /// <since_tizen> 3 </since_tizen>
1558 public SizeScalePolicyType SizeScalePolicy
1562 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1566 SetValue(SizeScalePolicyProperty, value);
1567 NotifyPropertyChanged();
1572 /// Gets or sets the status of whether the width size is dependent on the height size.
1574 /// <since_tizen> 3 </since_tizen>
1575 public bool WidthForHeight
1579 return (bool)GetValue(WidthForHeightProperty);
1583 SetValue(WidthForHeightProperty, value);
1584 NotifyPropertyChanged();
1589 /// Gets or sets the status of whether the height size is dependent on the width size.
1591 /// <since_tizen> 3 </since_tizen>
1592 public bool HeightForWidth
1596 return (bool)GetValue(HeightForWidthProperty);
1600 SetValue(HeightForWidthProperty, value);
1601 NotifyPropertyChanged();
1606 /// Gets or sets the padding for use in layout.
1609 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1611 /// <since_tizen> 5 </since_tizen>
1612 public Extents Padding
1616 // If View has a Layout then padding in stored in the base Layout class
1619 return Layout.Padding;
1623 Extents temp = (Extents)GetValue(PaddingProperty);
1624 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1626 // Two return points to prevent creating a zeroed Extent native object before assignment
1630 Extents padding = value;
1633 // Layout set so store Padding in LayoutItem instead of in View.
1634 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1635 // the position and sizes measure in the Layouting.
1636 Layout.Padding = value;
1637 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1638 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1639 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1641 padding = new Extents(0,0,0,0); // Reset value stored in View.
1643 _layout?.RequestLayout();
1645 SetValue(PaddingProperty, padding);
1646 NotifyPropertyChanged();
1647 _layout?.RequestLayout();
1652 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1655 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1657 /// <since_tizen> 3 </since_tizen>
1658 public Size2D MinimumSize
1662 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1663 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1667 if (_layout != null)
1669 // Note: it only works if minimum size is >= than natural size.
1670 // To force the size it should be done through the width&height spec or Size2D.
1671 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1672 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1673 _layout.RequestLayout();
1675 SetValue(MinimumSizeProperty, value);
1676 NotifyPropertyChanged();
1681 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1684 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1686 /// <since_tizen> 3 </since_tizen>
1687 public Size2D MaximumSize
1691 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1692 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1696 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1697 // MATCH_PARENT spec + parent container size can be used to limit
1698 if (_layout != null)
1700 // Note: it only works if minimum size is >= than natural size.
1701 // To force the size it should be done through the width&height spec or Size2D.
1702 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Width);
1703 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Height);
1704 _layout.RequestLayout();
1706 SetValue(MaximumSizeProperty, value);
1707 NotifyPropertyChanged();
1712 /// Gets or sets whether a child view inherits it's parent's position.<br />
1713 /// Default is to inherit.<br />
1714 /// 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 />
1716 /// <since_tizen> 3 </since_tizen>
1717 public bool InheritPosition
1721 return (bool)GetValue(InheritPositionProperty);
1725 SetValue(InheritPositionProperty, value);
1726 NotifyPropertyChanged();
1731 /// Gets or sets the clipping behavior (mode) of it's children.
1733 /// <since_tizen> 3 </since_tizen>
1734 public ClippingModeType ClippingMode
1738 return (ClippingModeType)GetValue(ClippingModeProperty);
1742 SetValue(ClippingModeProperty, value);
1743 NotifyPropertyChanged();
1748 /// Gets the number of renderers held by the view.
1750 /// <since_tizen> 3 </since_tizen>
1751 public uint RendererCount
1755 return GetRendererCount();
1760 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1763 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1765 /// <since_tizen> 3 </since_tizen>
1766 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1768 "View view = new View(); " +
1769 "view.PivotPoint = PivotPoint.Center; " +
1770 "view.PositionUsesPivotPoint = true;")]
1771 [EditorBrowsable(EditorBrowsableState.Never)]
1772 public Position AnchorPoint
1776 Position temp = new Position(0.0f, 0.0f, 0.0f);
1777 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1778 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1782 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1783 NotifyPropertyChanged();
1788 /// Sets the size of a view for the width, the height and the depth.<br />
1789 /// Geometry can be scaled to fit within this area.<br />
1790 /// This does not interfere with the view's scale factor.<br />
1791 /// The views default depth is the minimum of width and height.<br />
1795 /// Animatable - This property can be animated using <c>Animation</c> class.
1797 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1799 /// <since_tizen> 5 </since_tizen>
1804 Size tmp = (Size)GetValue(SizeProperty);
1805 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1809 SetValue(SizeProperty, value);
1810 // Set Specification so when layouts measure this View it matches the value set here.
1811 // All Views are currently Layouts.
1812 WidthSpecification = (int)Math.Ceiling(value.Width);
1813 HeightSpecification = (int)Math.Ceiling(value.Height);
1814 NotifyPropertyChanged();
1819 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1821 /// <since_tizen> 3 </since_tizen>
1822 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1824 "Container parent = view.GetParent(); " +
1825 "View view = parent as View;")]
1826 [EditorBrowsable(EditorBrowsableState.Never)]
1827 public new View Parent
1832 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1833 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1834 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1836 if (basehandle is Layer layer)
1838 ret = new View(Layer.getCPtr(layer).Handle, false);
1839 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1843 ret = basehandle as View;
1846 Interop.BaseHandle.delete_BaseHandle(CPtr);
1847 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1849 if (NDalicPINVOKE.SWIGPendingException.Pending)
1850 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1856 /// Gets/Sets whether inherit parent's the layout Direction.
1858 /// <since_tizen> 4 </since_tizen>
1859 public bool InheritLayoutDirection
1863 return (bool)GetValue(InheritLayoutDirectionProperty);
1867 SetValue(InheritLayoutDirectionProperty, value);
1868 NotifyPropertyChanged();
1873 /// Gets/Sets the layout Direction.
1875 /// <since_tizen> 4 </since_tizen>
1876 public ViewLayoutDirectionType LayoutDirection
1880 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1884 SetValue(LayoutDirectionProperty, value);
1885 NotifyPropertyChanged();
1886 _layout?.RequestLayout();
1891 /// Gets or sets the Margin for use in layout.
1894 /// Margin property is supported by Layout algorithms and containers.
1895 /// Please Set Layout if you want to use Margin property.
1896 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1898 /// <since_tizen> 4 </since_tizen>
1899 public Extents Margin
1903 // If View has a Layout then margin is stored in Layout.
1906 return Layout.Margin;
1910 // If Layout not set then return margin stored in View.
1911 Extents temp = (Extents)GetValue(MarginProperty);
1912 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1914 // Two return points to prevent creating a zeroed Extent native object before assignment
1920 // Layout set so store Margin in LayoutItem instead of View.
1921 // If View stores the Margin too then the Legacy Size Negotiation will
1922 // overwrite the position and size values measured in the Layouting.
1923 Layout.Margin = value;
1924 SetValue(MarginProperty, new Extents(0,0,0,0));
1925 _layout?.RequestLayout();
1929 SetValue(MarginProperty, value);
1931 NotifyPropertyChanged();
1932 _layout?.RequestLayout();
1937 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1939 /// <since_tizen> 6 </since_tizen>
1940 public int WidthSpecification
1944 return _widthPolicy;
1948 _widthPolicy = value;
1949 if( _oldWidthPolicy != _widthPolicy )
1951 if (_widthPolicy >= 0)
1953 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1955 if(_heightPolicy>=0) // Policy an exact value
1957 Size2D.Width = _widthPolicy;
1961 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1962 // Size2D height will store the specification value (negative number) this will then be applied to the
1963 // HeightSpecification when the Size2D callback is invoked.
1964 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1967 _layout?.RequestLayout();
1968 _oldWidthPolicy = _widthPolicy;
1974 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1976 /// <since_tizen> 6 </since_tizen>
1977 public int HeightSpecification
1981 return _heightPolicy;
1985 _heightPolicy = value;
1986 if( _oldHeightPolicy != _heightPolicy )
1988 if (_heightPolicy >= 0)
1990 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1992 if(_widthPolicy>=0) // Policy an exact value
1994 Size2D.Height = _heightPolicy;
1998 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1999 // Size2D height will store the specification value (negative number) this will then be applied to the
2000 // HeightSpecification when the Size2D callback is invoked.
2001 Size2D = new Size2D(_widthPolicy,_heightPolicy);
2005 _layout?.RequestLayout();
2006 _oldHeightPolicy = _heightPolicy;
2012 /// Gets the List of transitions for this View.
2014 /// <since_tizen> 6 </since_tizen>
2015 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2019 if (_layoutTransitions == null)
2021 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2023 return _layoutTransitions;
2028 /// Set a layout transitions for this View.
2031 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2033 /// <since_tizen> 6 </since_tizen>
2034 public LayoutTransition LayoutTransition
2038 if (_layoutTransitions == null)
2040 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2042 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2044 AttachTransitionsToChildren(value);
2049 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2052 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2054 /// <since_tizen> 4 </since_tizen>
2055 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2056 [EditorBrowsable(EditorBrowsableState.Never)]
2057 public Extents PaddingEX
2061 Extents temp = new Extents(0, 0, 0, 0);
2062 GetProperty(View.Property.PADDING).Get(temp);
2063 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2067 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2068 NotifyPropertyChanged();
2069 _layout?.RequestLayout();
2073 /// <since_tizen> 6 </since_tizen>
2074 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2075 [EditorBrowsable(EditorBrowsableState.Never)]
2076 public Style XamlStyle
2080 return (Style)GetValue(XamlStyleProperty);
2084 SetValue(XamlStyleProperty, value);
2089 /// The Color of View. This is an RGBA value.
2093 /// Animatable - This property can be animated using <c>Animation</c> class.
2095 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2097 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2098 [EditorBrowsable(EditorBrowsableState.Never)]
2103 Color temp = (Color)GetValue(ColorProperty);
2104 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2108 SetValue(ColorProperty, value);
2109 NotifyPropertyChanged();
2114 /// Set the layout on this View. Replaces any existing Layout.
2116 /// <since_tizen> 6 </since_tizen>
2117 public LayoutItem Layout
2125 // Do nothing if layout provided is already set on this View.
2126 if (value == _layout)
2131 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2132 layoutingDisabled = false;
2135 // If new layout being set already has a owner then that owner receives a replacement default layout.
2136 // First check if the layout to be set already has a owner.
2137 if (value?.Owner != null)
2139 // Previous owner of the layout gets a default layout as a replacement.
2140 value.Owner.Layout = new AbsoluteLayout();
2142 // Copy Margin and Padding to replacement LayoutGroup.
2143 value.Owner.Layout.Margin = value.Margin;
2144 value.Owner.Layout.Padding = value.Padding;
2147 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2148 // View if no replacement. Previously margin and padding values would have been moved from
2149 // the View to the layout.
2150 if (_layout != null ) // Existing layout
2154 // Existing layout being replaced so copy over margin and padding values.
2155 value.Margin = _layout.Margin;
2156 value.Padding = _layout.Padding;
2160 // Layout not being replaced so restore margin and padding to View.
2161 SetValue(MarginProperty, _layout.Margin);
2162 SetValue(PaddingProperty, _layout.Padding);
2163 NotifyPropertyChanged();
2168 // First Layout to be added to the View hence copy
2170 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2173 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2175 // If View already has a margin set then store it in Layout instead.
2176 value.Margin = Margin;
2177 SetValue(MarginProperty, new Extents(0,0,0,0));
2178 NotifyPropertyChanged();
2181 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2183 // If View already has a padding set then store it in Layout instead.
2184 value.Padding = Padding;
2185 SetValue(PaddingProperty, new Extents(0,0,0,0));
2186 NotifyPropertyChanged();
2191 // Remove existing layout from it's parent layout group.
2192 _layout?.Unparent();
2194 // Set layout to this view
2200 /// The weight of the View, used to share available space in a layout with siblings.
2202 /// <since_tizen> 6 </since_tizen>
2212 _layout?.RequestLayout();
2217 /// Whether to load the BackgroundImage synchronously.
2218 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2219 /// Note: For Normal Quad images only.
2221 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2222 [EditorBrowsable(EditorBrowsableState.Never)]
2223 public bool BackgroundImageSynchronosLoading
2227 return _backgroundImageSynchronosLoading;
2231 _backgroundImageSynchronosLoading = value;
2234 Background.Find(Visual.Property.Type)?.Get(out visualType);
2235 if (visualType == (int)Visual.Type.Image)
2237 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2240 if (bgUrl.Length != 0)
2242 PropertyMap bgMap = this.Background;
2243 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2249 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2250 [EditorBrowsable(EditorBrowsableState.Never)]
2251 public Vector2 UpdateSizeHint
2255 return (Vector2)GetValue(UpdateSizeHintProperty);
2259 SetValue(UpdateSizeHintProperty, value);
2260 NotifyPropertyChanged();
2264 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2265 [EditorBrowsable(EditorBrowsableState.Never)]
2266 public string[] TransitionNames
2270 return transitionNames;
2274 transitionNames = value;
2280 /// Enable/Disable ControlState propagation for children.
2281 /// It is false by default.
2282 /// If the View needs to share ControlState with descendants, please set it true.
2283 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2285 [EditorBrowsable(EditorBrowsableState.Never)]
2286 public bool EnableControlStatePropagation
2288 get => controlStatePropagation;
2291 controlStatePropagation = value;
2293 foreach (View child in Children)
2295 child.EnableControlStatePropagation = value;
2301 /// Get Style, it is abstract function and must be override.
2303 /// <since_tizen> 6 </since_tizen>
2304 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2305 [EditorBrowsable(EditorBrowsableState.Never)]
2306 protected virtual ViewStyle GetViewStyle()
2308 return new ViewStyle();
2312 /// Set ControlState with specified inpu environment
2314 /// <param name="state">New state value</param>
2315 /// <param name="inputMethod">Indicates the input method that triggered this change.</param>
2316 /// <param name="inputData">The input method data that depends on the inputMethod.</param>
2317 /// <return>True, if the state changed successfully.</return>
2318 [EditorBrowsable(EditorBrowsableState.Never)]
2319 protected bool SetControlState(ControlStates state, ControlStateChangedInfo.InputMethodType inputMethod, object inputData)
2321 if (controlStates == state)
2326 var prevState = controlStates;
2328 controlStates = state;
2330 var changeInfo = new ControlStateChangedInfo(prevState, state, inputMethod, inputData);
2332 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
2334 OnControlStateChanged(changeInfo);
2336 if (controlStatePropagation)
2338 foreach (View child in Children)
2340 child.SetControlState(state, inputMethod, inputData);
2344 ControlStateChangeEvent?.Invoke(this, changeInfo);
2350 /// Called after the View's ControlStates changed.
2352 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2353 [EditorBrowsable(EditorBrowsableState.Never)]
2354 protected virtual void OnControlStateChanged(ControlStateChangedInfo controlStateChangedInfo)
2358 internal static readonly BindableProperty BackgroundImageSelectorProperty = BindableProperty.Create("BackgroundImageSelector", typeof(Selector<string>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2360 var view = (View)bindable;
2361 view.backgroundImageSelector.Clone((Selector<string>)newValue);
2363 defaultValueCreator: (bindable) =>
2365 var view = (View)bindable;
2366 return view.backgroundImageSelector;
2368 private TriggerableSelector<string> _backgroundImageSelector;
2369 private TriggerableSelector<string> backgroundImageSelector
2373 if (null == _backgroundImageSelector)
2375 _backgroundImageSelector = new TriggerableSelector<string>(this, BackgroundImageProperty);
2377 return _backgroundImageSelector;
2380 internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2382 var view = (View)bindable;
2383 view.backgroundColorSelector.Clone((Selector<Color>)newValue);
2385 defaultValueCreator: (bindable) =>
2387 var view = (View)bindable;
2388 return view.backgroundColorSelector;
2390 private TriggerableSelector<Color> _backgroundColorSelector;
2391 private TriggerableSelector<Color> backgroundColorSelector
2395 if (null == _backgroundColorSelector)
2397 _backgroundColorSelector = new TriggerableSelector<Color>(this, BackgroundColorProperty);
2399 return _backgroundColorSelector;
2403 internal static readonly BindableProperty ColorSelectorProperty = BindableProperty.Create("ColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2405 var view = (View)bindable;
2406 view.colorSelector.Clone((Selector<Color>)newValue);
2408 defaultValueCreator: (bindable) =>
2410 var view = (View)bindable;
2411 return view.colorSelector;
2414 private TriggerableSelector<Color> _colorSelector;
2415 private TriggerableSelector<Color> colorSelector
2419 if (null == _colorSelector)
2421 _colorSelector = new TriggerableSelector<Color>(this, ColorProperty);
2423 return _colorSelector;
2427 internal static readonly BindableProperty BackgroundImageBorderSelectorProperty = BindableProperty.Create("BackgroundImageBorderSelector", typeof(Selector<Rectangle>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2429 var view = (View)bindable;
2430 view.backgroundImageBorderSelector.Clone((Selector<Rectangle>)newValue);
2432 defaultValueCreator: (bindable) =>
2434 var view = (View)bindable;
2435 return view.backgroundImageBorderSelector;
2437 private TriggerableSelector<Rectangle> _backgroundImageBorderSelector;
2438 private TriggerableSelector<Rectangle> backgroundImageBorderSelector
2442 if (null == _backgroundImageBorderSelector)
2444 _backgroundImageBorderSelector = new TriggerableSelector<Rectangle>(this, BackgroundImageBorderProperty);
2446 return _backgroundImageBorderSelector;
2449 internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2451 var view = (View)bindable;
2452 view.opacitySelector.Clone((Selector<float?>)newValue);
2454 defaultValueCreator: (bindable) =>
2456 var view = (View)bindable;
2457 return view.opacitySelector;
2459 private TriggerableSelector<float?> _opacitySelector;
2460 private TriggerableSelector<float?> opacitySelector
2464 if (null == _opacitySelector)
2466 _opacitySelector = new TriggerableSelector<float?>(this, OpacityProperty);
2468 return _opacitySelector;
2472 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2473 [EditorBrowsable(EditorBrowsableState.Never)]
2474 public virtual void ApplyStyle(ViewStyle viewStyle)
2476 if (null == viewStyle)
2481 if (this.viewStyle == viewStyle)
2486 if (null != this.viewStyle)
2488 simpleBinding.Clear();
2491 this.viewStyle = viewStyle;
2493 Dictionary<string, BindableProperty> bindablePropertyOfView;
2494 Type viewType = GetType();
2496 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2497 Type styleType = viewStyle.GetType();
2499 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2500 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2502 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2504 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2506 BindableProperty viewProperty;
2507 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2509 if (null != viewProperty)
2511 object value = viewStyle.GetValue(keyValuePair.Value);
2515 SetValue(viewProperty, value);
2518 simpleBinding.Bind(viewStyle, keyValuePair.Value, this, viewProperty, BindingDirection.TwoWay);
2524 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2525 [EditorBrowsable(EditorBrowsableState.Never)]
2526 private BundledPipe simpleBinding = new BundledPipe();