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 Rectangle backgroundImageBorder;
64 private CloneableViewSelector<ImageShadow> imageShadow;
66 private CloneableViewSelector<Shadow> boxShadow;
68 private ViewSelector<float?> cornerRadius;
70 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
74 private 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();
127 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
129 if (this.viewStyle == null)
131 ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
135 this.viewStyle.CopyFrom(viewStyle);
139 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
143 PositionUsesPivotPoint = false;
146 _onWindowSendEventCallback = SendViewAddedEventToWindow;
147 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
155 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
157 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
165 internal delegate void ControlStateChangesDelegate(View obj, ControlStates state);
166 internal event ControlStateChangesDelegate ControlStateChangeEvent;
168 private ControlStates controlStates;
170 /// Get/Set the control state.
172 /// <since_tizen> 6 </since_tizen>
173 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
174 [EditorBrowsable(EditorBrowsableState.Never)]
175 public ControlStates ControlState
179 return controlStates;
183 SetControlState(value, null);
188 /// Set ControlState with specified change environment
190 /// <param name="state">New state value</param>
191 /// <param name="touchInfo">The touch information in case the state has changed by touching.</param>
192 /// <return>True, if the state changed successfully.</return>
193 internal bool SetControlState(ControlStates state, Touch touchInfo)
195 if (controlStates == state)
200 var prevState = controlStates;
202 controlStates = state;
204 ControlStateChangeEvent?.Invoke(this, state);
206 if (OnControlStateChanged(prevState, touchInfo))
208 foreach (View child in Children)
210 child.SetControlState(state, touchInfo);
217 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
218 [EditorBrowsable(EditorBrowsableState.Never)]
219 public bool IsResourcesCreated
223 return Application.Current.IsResourcesCreated;
227 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
228 [EditorBrowsable(EditorBrowsableState.Never)]
229 public ResourceDictionary XamlResources
233 return Application.Current.XamlResources;
237 Application.Current.XamlResources = value;
242 /// The StyleName, type string.
244 /// <since_tizen> 3 </since_tizen>
245 public string StyleName
249 return (string)GetValue(StyleNameProperty);
253 SetValue(StyleNameProperty, value);
254 NotifyPropertyChanged();
259 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
262 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
264 /// <since_tizen> 3 </since_tizen>
265 public Color BackgroundColor
269 Color temp = (Color)GetValue(BackgroundColorProperty);
270 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
274 SetValue(BackgroundColorProperty, value);
275 NotifyPropertyChanged();
280 /// The mutually exclusive with "backgroundColor" and "background" type Map.
282 /// <since_tizen> 3 </since_tizen>
283 public string BackgroundImage
287 return (string)GetValue(BackgroundImageProperty);
291 SetValue(BackgroundImageProperty, value);
292 NotifyPropertyChanged();
297 /// Get or set the border of background image.
299 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
300 [EditorBrowsable(EditorBrowsableState.Never)]
301 public Rectangle BackgroundImageBorder
305 return (Rectangle)GetValue(BackgroundImageBorderProperty);
309 SetValue(BackgroundImageBorderProperty, value);
310 NotifyPropertyChanged();
315 /// The background of view.
317 /// <since_tizen> 3 </since_tizen>
318 public Tizen.NUI.PropertyMap Background
322 return (PropertyMap)GetValue(BackgroundProperty);
326 SetValue(BackgroundProperty, value);
327 NotifyPropertyChanged();
332 /// Describes a shadow as an image for a View.
333 /// It is null by default.
336 /// The mutually exclusive with "BoxShadow".
338 [EditorBrowsable(EditorBrowsableState.Never)]
339 public ImageShadow ImageShadow
343 var value = (ImageShadow)GetValue(ImageShadowProperty);
344 return value == null ? null : new ImageShadow(value, OnImageShadowChanged);
348 SetValue(ImageShadowProperty, value);
349 NotifyPropertyChanged();
354 /// Describes a box shaped shadow drawing for a View.
355 /// It is null by default.
358 /// The mutually exclusive with "ImageShadow".
360 [EditorBrowsable(EditorBrowsableState.Never)]
361 public Shadow BoxShadow
365 var value = (Shadow)GetValue(BoxShadowProperty);
366 return value == null ? null : new Shadow(value, OnBoxShadowChanged);
370 SetValue(BoxShadowProperty, value);
371 NotifyPropertyChanged();
376 /// The radius for the rounded corners of the View.
377 /// This will rounds background and shadow edges.
378 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
380 [EditorBrowsable(EditorBrowsableState.Never)]
381 public float CornerRadius
385 float? value = (float?)GetValue(CornerRadiusProperty);
390 SetValue(CornerRadiusProperty, value);
391 NotifyPropertyChanged();
396 /// The current state of the view.
398 /// <since_tizen> 3 </since_tizen>
403 return (States)GetValue(StateProperty);
407 SetValue(StateProperty, value);
408 NotifyPropertyChanged();
413 /// The current sub state of the view.
415 /// <since_tizen> 3 </since_tizen>
416 public States SubState
420 return (States)GetValue(SubStateProperty);
424 SetValue(SubStateProperty, value);
425 NotifyPropertyChanged();
430 /// Displays a tooltip
432 /// <since_tizen> 3 </since_tizen>
433 public Tizen.NUI.PropertyMap Tooltip
437 return (PropertyMap)GetValue(TooltipProperty);
441 SetValue(TooltipProperty, value);
442 NotifyPropertyChanged();
447 /// Displays a tooltip as a text.
449 /// <since_tizen> 3 </since_tizen>
450 public string TooltipText
454 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
455 NotifyPropertyChanged();
460 /// The Child property of FlexContainer.<br />
461 /// The proportion of the free space in the container, the flex item will receive.<br />
462 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
464 /// <since_tizen> 3 </since_tizen>
469 return (float)GetValue(FlexProperty);
473 SetValue(FlexProperty, value);
474 NotifyPropertyChanged();
479 /// The Child property of FlexContainer.<br />
480 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
482 /// <since_tizen> 3 </since_tizen>
487 return (int)GetValue(AlignSelfProperty);
491 SetValue(AlignSelfProperty, value);
492 NotifyPropertyChanged();
497 /// The Child property of FlexContainer.<br />
498 /// The space around the flex item.<br />
501 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
503 /// <since_tizen> 3 </since_tizen>
504 public Vector4 FlexMargin
508 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
509 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
513 SetValue(FlexMarginProperty, value);
514 NotifyPropertyChanged();
519 /// The top-left cell this child occupies, if not set, the first available cell is used.
522 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
524 /// <since_tizen> 3 </since_tizen>
525 public Vector2 CellIndex
529 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
530 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
534 SetValue(CellIndexProperty, value);
535 NotifyPropertyChanged();
540 /// The number of rows this child occupies, if not set, the default value is 1.
542 /// <since_tizen> 3 </since_tizen>
547 return (float)GetValue(RowSpanProperty);
551 SetValue(RowSpanProperty, value);
552 NotifyPropertyChanged();
557 /// The number of columns this child occupies, if not set, the default value is 1.
559 /// <since_tizen> 3 </since_tizen>
560 public float ColumnSpan
564 return (float)GetValue(ColumnSpanProperty);
568 SetValue(ColumnSpanProperty, value);
569 NotifyPropertyChanged();
574 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
576 /// <since_tizen> 3 </since_tizen>
577 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
581 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
585 SetValue(CellHorizontalAlignmentProperty, value);
586 NotifyPropertyChanged();
591 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
593 /// <since_tizen> 3 </since_tizen>
594 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
598 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
602 SetValue(CellVerticalAlignmentProperty, value);
603 NotifyPropertyChanged();
608 /// The left focusable view.<br />
609 /// This will return null if not set.<br />
610 /// This will also return null if the specified left focusable view is not on a window.<br />
612 /// <since_tizen> 3 </since_tizen>
613 public View LeftFocusableView
615 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
618 return (View)GetValue(LeftFocusableViewProperty);
622 SetValue(LeftFocusableViewProperty, value);
623 NotifyPropertyChanged();
628 /// The right focusable view.<br />
629 /// This will return null if not set.<br />
630 /// This will also return null if the specified right focusable view is not on a window.<br />
632 /// <since_tizen> 3 </since_tizen>
633 public View RightFocusableView
635 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
638 return (View)GetValue(RightFocusableViewProperty);
642 SetValue(RightFocusableViewProperty, value);
643 NotifyPropertyChanged();
648 /// The up focusable view.<br />
649 /// This will return null if not set.<br />
650 /// This will also return null if the specified up focusable view is not on a window.<br />
652 /// <since_tizen> 3 </since_tizen>
653 public View UpFocusableView
655 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
658 return (View)GetValue(UpFocusableViewProperty);
662 SetValue(UpFocusableViewProperty, value);
663 NotifyPropertyChanged();
668 /// The down focusable view.<br />
669 /// This will return null if not set.<br />
670 /// This will also return null if the specified down focusable view is not on a window.<br />
672 /// <since_tizen> 3 </since_tizen>
673 public View DownFocusableView
675 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
678 return (View)GetValue(DownFocusableViewProperty);
682 SetValue(DownFocusableViewProperty, value);
683 NotifyPropertyChanged();
688 /// Whether the view should be focusable by keyboard navigation.
690 /// <since_tizen> 3 </since_tizen>
691 public bool Focusable
695 SetValue(FocusableProperty, value);
696 NotifyPropertyChanged();
700 return (bool)GetValue(FocusableProperty);
705 /// Retrieves the position of the view.<br />
706 /// The coordinates are relative to the view's parent.<br />
708 /// <since_tizen> 3 </since_tizen>
709 public Position CurrentPosition
713 return GetCurrentPosition();
718 /// Sets the size of a view for the width and the height.<br />
719 /// Geometry can be scaled to fit within this area.<br />
720 /// This does not interfere with the view's scale factor.<br />
721 /// The views default depth is the minimum of width and height.<br />
724 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
725 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
727 /// <since_tizen> 3 </since_tizen>
732 Size2D temp = (Size2D)GetValue(Size2DProperty);
733 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
737 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
738 SetValue(Size2DProperty, value);
739 // Set Specification so when layouts measure this View it matches the value set here.
740 // All Views are currently Layouts.
741 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
742 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
743 _widthPolicy = value.Width;
744 _heightPolicy = value.Height;
745 _layout?.RequestLayout();
746 NotifyPropertyChanged();
751 /// Retrieves the size of the view.<br />
752 /// The coordinates are relative to the view's parent.<br />
754 /// <since_tizen> 3 </since_tizen>
755 public Size2D CurrentSize
759 return GetCurrentSize();
764 /// Retrieves and sets the view's opacity.<br />
766 /// <since_tizen> 3 </since_tizen>
771 return (float)GetValue(OpacityProperty);
775 SetValue(OpacityProperty, value);
776 NotifyPropertyChanged();
781 /// Sets the position of the view for X and Y.<br />
782 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
783 /// If the position inheritance is disabled, sets the world position.<br />
786 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
787 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
789 /// <since_tizen> 3 </since_tizen>
790 public Position2D Position2D
794 Position2D temp = (Position2D)GetValue(Position2DProperty);
795 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
799 SetValue(Position2DProperty, value);
800 NotifyPropertyChanged();
805 /// Retrieves the screen postion of the view.<br />
807 /// <since_tizen> 3 </since_tizen>
808 public Vector2 ScreenPosition
812 Vector2 temp = new Vector2(0.0f, 0.0f);
813 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
819 /// Determines whether the pivot point should be used to determine the position of the view.
820 /// This is true by default.
822 /// <remarks>If false, then the top-left of the view is used for the position.
823 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
825 /// <since_tizen> 3 </since_tizen>
826 public bool PositionUsesPivotPoint
830 return (bool)GetValue(PositionUsesPivotPointProperty);
834 SetValue(PositionUsesPivotPointProperty, value);
835 NotifyPropertyChanged();
840 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
842 /// <since_tizen> 3 </since_tizen>
843 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
845 "View view = new View(); " +
846 "view.PivotPoint = PivotPoint.Center; " +
847 "view.PositionUsesPivotPoint = true;" +
848 " Deprecated in API5: Will be removed in API8")]
849 [EditorBrowsable(EditorBrowsableState.Never)]
850 public bool PositionUsesAnchorPoint
855 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
860 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
861 NotifyPropertyChanged();
866 /// Queries whether the view is connected to the stage.<br />
867 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
869 /// <since_tizen> 3 </since_tizen>
870 public bool IsOnWindow
879 /// Gets the depth in the hierarchy for the view.
881 /// <since_tizen> 3 </since_tizen>
882 public int HierarchyDepth
886 return GetHierarchyDepth();
891 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
894 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
895 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
896 /// The values set by this property will likely change.
898 /// <since_tizen> 3 </since_tizen>
899 public int SiblingOrder
903 return (int)GetValue(SiblingOrderProperty);
907 SetValue(SiblingOrderProperty, value);
909 LayoutGroup layout = Layout as LayoutGroup;
910 layout?.ChangeLayoutSiblingOrder(value);
912 NotifyPropertyChanged();
917 /// Returns the natural size of the view.
920 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
922 /// <since_tizen> 5 </since_tizen>
923 public Vector3 NaturalSize
927 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
928 if (NDalicPINVOKE.SWIGPendingException.Pending)
929 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
935 /// Returns the natural size (Size2D) of the view.
938 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
940 /// <since_tizen> 4 </since_tizen>
941 public Size2D NaturalSize2D
945 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
946 if (NDalicPINVOKE.SWIGPendingException.Pending)
947 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
949 return new Size2D((int)temp.Width, (int)temp.Height);
954 /// Gets or sets the origin of a view within its parent's area.<br />
955 /// 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 />
956 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
957 /// A view's position is the distance between this origin and the view's anchor-point.<br />
959 /// <pre>The view has been initialized.</pre>
960 /// <since_tizen> 3 </since_tizen>
961 public Position ParentOrigin
965 Position tmp = (Position)GetValue(ParentOriginProperty);
966 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
970 SetValue(ParentOriginProperty, value);
971 NotifyPropertyChanged();
976 /// Gets or sets the anchor-point of a view.<br />
977 /// 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 />
978 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
979 /// A view position is the distance between its parent-origin and this anchor-point.<br />
980 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
981 /// <pre>The view has been initialized.</pre>
984 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
986 /// <since_tizen> 3 </since_tizen>
987 public Position PivotPoint
991 Position tmp = (Position)GetValue(PivotPointProperty);
992 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
996 SetValue(PivotPointProperty, value);
997 NotifyPropertyChanged();
1002 /// Gets or sets the size width of the view.
1006 /// Animatable - This property can be animated using <c>Animation</c> class.
1009 /// <since_tizen> 3 </since_tizen>
1010 public float SizeWidth
1014 return (float)GetValue(SizeWidthProperty);
1018 SetValue(SizeWidthProperty, value);
1019 WidthSpecification = (int)Math.Ceiling(value);
1020 NotifyPropertyChanged();
1025 /// Gets or sets the size height of the view.
1029 /// Animatable - This property can be animated using <c>Animation</c> class.
1032 /// <since_tizen> 3 </since_tizen>
1033 public float SizeHeight
1037 return (float)GetValue(SizeHeightProperty);
1041 SetValue(SizeHeightProperty, value);
1042 HeightSpecification = (int)Math.Ceiling(value);
1043 NotifyPropertyChanged();
1048 /// Gets or sets the position of the view.<br />
1049 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1050 /// If the position inheritance is disabled, sets the world position.<br />
1054 /// Animatable - This property can be animated using <c>Animation</c> class.
1056 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1058 /// <since_tizen> 3 </since_tizen>
1059 public Position Position
1063 Position tmp = (Position)GetValue(PositionProperty);
1064 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1068 SetValue(PositionProperty, value);
1069 NotifyPropertyChanged();
1074 /// Gets or sets the position X of the view.
1078 /// Animatable - This property can be animated using <c>Animation</c> class.
1081 /// <since_tizen> 3 </since_tizen>
1082 public float PositionX
1086 return (float)GetValue(PositionXProperty);
1090 SetValue(PositionXProperty, value);
1091 NotifyPropertyChanged();
1096 /// Gets or sets the position Y of the view.
1100 /// Animatable - This property can be animated using <c>Animation</c> class.
1103 /// <since_tizen> 3 </since_tizen>
1104 public float PositionY
1108 return (float)GetValue(PositionYProperty);
1112 SetValue(PositionYProperty, value);
1113 NotifyPropertyChanged();
1118 /// Gets or sets the position Z of the view.
1122 /// Animatable - This property can be animated using <c>Animation</c> class.
1125 /// <since_tizen> 3 </since_tizen>
1126 public float PositionZ
1130 return (float)GetValue(PositionZProperty);
1134 SetValue(PositionZProperty, value);
1135 NotifyPropertyChanged();
1140 /// Gets or sets the world position of the view.
1142 /// <since_tizen> 3 </since_tizen>
1143 public Vector3 WorldPosition
1147 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1148 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1154 /// Gets or sets the orientation of the view.<br />
1155 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1159 /// This is an asynchronous method.
1162 /// Animatable - This property can be animated using <c>Animation</c> class.
1165 /// <since_tizen> 3 </since_tizen>
1166 public Rotation Orientation
1170 return (Rotation)GetValue(OrientationProperty);
1174 SetValue(OrientationProperty, value);
1175 NotifyPropertyChanged();
1180 /// Gets or sets the world orientation of the view.<br />
1182 /// <since_tizen> 3 </since_tizen>
1183 public Rotation WorldOrientation
1187 Rotation temp = new Rotation();
1188 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1194 /// Gets or sets the scale factor applied to the view.<br />
1198 /// Animatable - This property can be animated using <c>Animation</c> class.
1200 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1202 /// <since_tizen> 3 </since_tizen>
1203 public Vector3 Scale
1207 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1208 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1212 SetValue(ScaleProperty, value);
1213 NotifyPropertyChanged();
1218 /// Gets or sets the scale X factor applied to the view.
1222 /// Animatable - This property can be animated using <c>Animation</c> class.
1225 /// <since_tizen> 3 </since_tizen>
1230 return (float)GetValue(ScaleXProperty);
1234 SetValue(ScaleXProperty, value);
1235 NotifyPropertyChanged();
1240 /// Gets or sets the scale Y factor applied to the view.
1244 /// Animatable - This property can be animated using <c>Animation</c> class.
1247 /// <since_tizen> 3 </since_tizen>
1252 return (float)GetValue(ScaleYProperty);
1256 SetValue(ScaleYProperty, value);
1257 NotifyPropertyChanged();
1262 /// Gets or sets the scale Z factor applied to the view.
1266 /// Animatable - This property can be animated using <c>Animation</c> class.
1269 /// <since_tizen> 3 </since_tizen>
1274 return (float)GetValue(ScaleZProperty);
1278 SetValue(ScaleZProperty, value);
1279 NotifyPropertyChanged();
1284 /// Gets the world scale of the view.
1286 /// <since_tizen> 3 </since_tizen>
1287 public Vector3 WorldScale
1291 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1292 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1298 /// Retrieves the visibility flag of the view.
1302 /// If the view is not visible, then the view and its children will not be rendered.
1303 /// 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.
1306 /// Animatable - This property can be animated using <c>Animation</c> class.
1309 /// <since_tizen> 3 </since_tizen>
1310 public bool Visibility
1315 GetProperty(View.Property.VISIBLE).Get(out temp);
1321 /// Gets the view's world color.
1323 /// <since_tizen> 3 </since_tizen>
1324 public Vector4 WorldColor
1328 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1329 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1335 /// Gets or sets the view's name.
1337 /// <since_tizen> 3 </since_tizen>
1342 return (string)GetValue(NameProperty);
1346 SetValue(NameProperty, value);
1347 NotifyPropertyChanged();
1352 /// Get the number of children held by the view.
1354 /// <since_tizen> 3 </since_tizen>
1355 public new uint ChildCount
1359 return GetChildCount();
1364 /// Gets the view's ID.
1367 /// <since_tizen> 3 </since_tizen>
1377 /// Gets or sets the status of whether the view should emit touch or hover signals.
1379 /// <since_tizen> 3 </since_tizen>
1380 public bool Sensitive
1384 return (bool)GetValue(SensitiveProperty);
1388 SetValue(SensitiveProperty, value);
1389 NotifyPropertyChanged();
1394 /// 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.
1396 /// <since_tizen> 3 </since_tizen>
1397 public bool LeaveRequired
1401 return (bool)GetValue(LeaveRequiredProperty);
1405 SetValue(LeaveRequiredProperty, value);
1406 NotifyPropertyChanged();
1411 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1413 /// <since_tizen> 3 </since_tizen>
1414 public bool InheritOrientation
1418 return (bool)GetValue(InheritOrientationProperty);
1422 SetValue(InheritOrientationProperty, value);
1423 NotifyPropertyChanged();
1428 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1430 /// <since_tizen> 3 </since_tizen>
1431 public bool InheritScale
1435 return (bool)GetValue(InheritScaleProperty);
1439 SetValue(InheritScaleProperty, value);
1440 NotifyPropertyChanged();
1445 /// Gets or sets the status of how the view and its children should be drawn.<br />
1446 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1447 /// 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 />
1448 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1449 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1450 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1452 /// <since_tizen> 3 </since_tizen>
1453 public DrawModeType DrawMode
1457 return (DrawModeType)GetValue(DrawModeProperty);
1461 SetValue(DrawModeProperty, value);
1462 NotifyPropertyChanged();
1467 /// Gets or sets the relative to parent size factor of the view.<br />
1468 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1469 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1472 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1474 /// <since_tizen> 3 </since_tizen>
1475 public Vector3 SizeModeFactor
1479 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1480 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1484 SetValue(SizeModeFactorProperty, value);
1485 NotifyPropertyChanged();
1490 /// Gets or sets the width resize policy to be used.
1492 /// <since_tizen> 3 </since_tizen>
1493 public ResizePolicyType WidthResizePolicy
1497 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1501 SetValue(WidthResizePolicyProperty, value);
1502 // Match ResizePolicy to new Layouting.
1503 // Parent relative policies can not be mapped at this point as parent size unknown.
1506 case ResizePolicyType.UseNaturalSize:
1508 WidthSpecification = LayoutParamPolicies.WrapContent;
1511 case ResizePolicyType.FillToParent:
1513 WidthSpecification = LayoutParamPolicies.MatchParent;
1516 case ResizePolicyType.FitToChildren:
1518 WidthSpecification = LayoutParamPolicies.WrapContent;
1524 NotifyPropertyChanged();
1529 /// Gets or sets the height resize policy to be used.
1531 /// <since_tizen> 3 </since_tizen>
1532 public ResizePolicyType HeightResizePolicy
1536 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1540 SetValue(HeightResizePolicyProperty, value);
1541 // Match ResizePolicy to new Layouting.
1542 // Parent relative policies can not be mapped at this point as parent size unknown.
1545 case ResizePolicyType.UseNaturalSize:
1547 HeightSpecification = LayoutParamPolicies.WrapContent;
1550 case ResizePolicyType.FillToParent:
1552 HeightSpecification = LayoutParamPolicies.MatchParent;
1555 case ResizePolicyType.FitToChildren:
1557 HeightSpecification = LayoutParamPolicies.WrapContent;
1563 NotifyPropertyChanged();
1568 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1569 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1571 /// <since_tizen> 3 </since_tizen>
1572 public SizeScalePolicyType SizeScalePolicy
1576 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1580 SetValue(SizeScalePolicyProperty, value);
1581 NotifyPropertyChanged();
1586 /// Gets or sets the status of whether the width size is dependent on the height size.
1588 /// <since_tizen> 3 </since_tizen>
1589 public bool WidthForHeight
1593 return (bool)GetValue(WidthForHeightProperty);
1597 SetValue(WidthForHeightProperty, value);
1598 NotifyPropertyChanged();
1603 /// Gets or sets the status of whether the height size is dependent on the width size.
1605 /// <since_tizen> 3 </since_tizen>
1606 public bool HeightForWidth
1610 return (bool)GetValue(HeightForWidthProperty);
1614 SetValue(HeightForWidthProperty, value);
1615 NotifyPropertyChanged();
1620 /// Gets or sets the padding for use in layout.
1623 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1625 /// <since_tizen> 5 </since_tizen>
1626 public Extents Padding
1630 // If View has a Layout then padding in stored in the base Layout class
1633 return Layout.Padding;
1637 Extents temp = (Extents)GetValue(PaddingProperty);
1638 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1640 // Two return points to prevent creating a zeroed Extent native object before assignment
1644 Extents padding = value;
1647 // Layout set so store Padding in LayoutItem instead of in View.
1648 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1649 // the position and sizes measure in the Layouting.
1650 Layout.Padding = value;
1651 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1652 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1653 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1655 padding = new Extents(0,0,0,0); // Reset value stored in View.
1657 _layout?.RequestLayout();
1659 SetValue(PaddingProperty, padding);
1660 NotifyPropertyChanged();
1661 _layout?.RequestLayout();
1666 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1669 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1671 /// <since_tizen> 3 </since_tizen>
1672 public Size2D MinimumSize
1676 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1677 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1681 if (_layout != null)
1683 // Note: it only works if minimum size is >= than natural size.
1684 // To force the size it should be done through the width&height spec or Size2D.
1685 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1686 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1687 _layout.RequestLayout();
1689 SetValue(MinimumSizeProperty, value);
1690 NotifyPropertyChanged();
1695 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1698 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1700 /// <since_tizen> 3 </since_tizen>
1701 public Size2D MaximumSize
1705 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1706 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1710 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1711 // MATCH_PARENT spec + parent container size can be used to limit
1712 if (_layout != null)
1714 // Note: it only works if minimum size is >= than natural size.
1715 // To force the size it should be done through the width&height spec or Size2D.
1716 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Width);
1717 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Height);
1718 _layout.RequestLayout();
1720 SetValue(MaximumSizeProperty, value);
1721 NotifyPropertyChanged();
1726 /// Gets or sets whether a child view inherits it's parent's position.<br />
1727 /// Default is to inherit.<br />
1728 /// 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 />
1730 /// <since_tizen> 3 </since_tizen>
1731 public bool InheritPosition
1735 return (bool)GetValue(InheritPositionProperty);
1739 SetValue(InheritPositionProperty, value);
1740 NotifyPropertyChanged();
1745 /// Gets or sets the clipping behavior (mode) of it's children.
1747 /// <since_tizen> 3 </since_tizen>
1748 public ClippingModeType ClippingMode
1752 return (ClippingModeType)GetValue(ClippingModeProperty);
1756 SetValue(ClippingModeProperty, value);
1757 NotifyPropertyChanged();
1762 /// Gets the number of renderers held by the view.
1764 /// <since_tizen> 3 </since_tizen>
1765 public uint RendererCount
1769 return GetRendererCount();
1774 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1777 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1779 /// <since_tizen> 3 </since_tizen>
1780 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1782 "View view = new View(); " +
1783 "view.PivotPoint = PivotPoint.Center; " +
1784 "view.PositionUsesPivotPoint = true;")]
1785 [EditorBrowsable(EditorBrowsableState.Never)]
1786 public Position AnchorPoint
1790 Position temp = new Position(0.0f, 0.0f, 0.0f);
1791 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1792 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1796 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1797 NotifyPropertyChanged();
1802 /// Sets the size of a view for the width, the height and the depth.<br />
1803 /// Geometry can be scaled to fit within this area.<br />
1804 /// This does not interfere with the view's scale factor.<br />
1805 /// The views default depth is the minimum of width and height.<br />
1809 /// Animatable - This property can be animated using <c>Animation</c> class.
1811 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1813 /// <since_tizen> 5 </since_tizen>
1818 Size tmp = (Size)GetValue(SizeProperty);
1819 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1823 SetValue(SizeProperty, value);
1824 // Set Specification so when layouts measure this View it matches the value set here.
1825 // All Views are currently Layouts.
1826 WidthSpecification = (int)Math.Ceiling(value.Width);
1827 HeightSpecification = (int)Math.Ceiling(value.Height);
1828 NotifyPropertyChanged();
1833 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1835 /// <since_tizen> 3 </since_tizen>
1836 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1838 "Container parent = view.GetParent(); " +
1839 "View view = parent as View;")]
1840 [EditorBrowsable(EditorBrowsableState.Never)]
1841 public new View Parent
1846 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1847 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1848 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1850 if (basehandle is Layer layer)
1852 ret = new View(Layer.getCPtr(layer).Handle, false);
1853 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1857 ret = basehandle as View;
1860 Interop.BaseHandle.delete_BaseHandle(CPtr);
1861 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1863 if (NDalicPINVOKE.SWIGPendingException.Pending)
1864 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1870 /// Gets/Sets whether inherit parent's the layout Direction.
1872 /// <since_tizen> 4 </since_tizen>
1873 public bool InheritLayoutDirection
1877 return (bool)GetValue(InheritLayoutDirectionProperty);
1881 SetValue(InheritLayoutDirectionProperty, value);
1882 NotifyPropertyChanged();
1887 /// Gets/Sets the layout Direction.
1889 /// <since_tizen> 4 </since_tizen>
1890 public ViewLayoutDirectionType LayoutDirection
1894 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1898 SetValue(LayoutDirectionProperty, value);
1899 NotifyPropertyChanged();
1900 _layout?.RequestLayout();
1905 /// Gets or sets the Margin for use in layout.
1908 /// Margin property is supported by Layout algorithms and containers.
1909 /// Please Set Layout if you want to use Margin property.
1910 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1912 /// <since_tizen> 4 </since_tizen>
1913 public Extents Margin
1917 // If View has a Layout then margin is stored in Layout.
1920 return Layout.Margin;
1924 // If Layout not set then return margin stored in View.
1925 Extents temp = (Extents)GetValue(MarginProperty);
1926 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1928 // Two return points to prevent creating a zeroed Extent native object before assignment
1934 // Layout set so store Margin in LayoutItem instead of View.
1935 // If View stores the Margin too then the Legacy Size Negotiation will
1936 // overwrite the position and size values measured in the Layouting.
1937 Layout.Margin = value;
1938 SetValue(MarginProperty, new Extents(0,0,0,0));
1939 _layout?.RequestLayout();
1943 SetValue(MarginProperty, value);
1945 NotifyPropertyChanged();
1946 _layout?.RequestLayout();
1951 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1953 /// <since_tizen> 6 </since_tizen>
1954 public int WidthSpecification
1958 return _widthPolicy;
1962 _widthPolicy = value;
1963 if( _oldWidthPolicy != _widthPolicy )
1965 if (_widthPolicy >= 0)
1967 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1969 if(_heightPolicy>=0) // Policy an exact value
1971 Size2D.Width = _widthPolicy;
1975 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1976 // Size2D height will store the specification value (negative number) this will then be applied to the
1977 // HeightSpecification when the Size2D callback is invoked.
1978 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1981 _layout?.RequestLayout();
1982 _oldWidthPolicy = _widthPolicy;
1988 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1990 /// <since_tizen> 6 </since_tizen>
1991 public int HeightSpecification
1995 return _heightPolicy;
1999 _heightPolicy = value;
2000 if( _oldHeightPolicy != _heightPolicy )
2002 if (_heightPolicy >= 0)
2004 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
2006 if(_widthPolicy>=0) // Policy an exact value
2008 Size2D.Height = _heightPolicy;
2012 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
2013 // Size2D height will store the specification value (negative number) this will then be applied to the
2014 // HeightSpecification when the Size2D callback is invoked.
2015 Size2D = new Size2D(_widthPolicy,_heightPolicy);
2019 _layout?.RequestLayout();
2020 _oldHeightPolicy = _heightPolicy;
2026 /// Gets the List of transitions for this View.
2028 /// <since_tizen> 6 </since_tizen>
2029 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2033 if (_layoutTransitions == null)
2035 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2037 return _layoutTransitions;
2042 /// Set a layout transitions for this View.
2045 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2047 /// <since_tizen> 6 </since_tizen>
2048 public LayoutTransition LayoutTransition
2052 if (_layoutTransitions == null)
2054 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2056 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2058 AttachTransitionsToChildren(value);
2063 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2066 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2068 /// <since_tizen> 4 </since_tizen>
2069 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2070 [EditorBrowsable(EditorBrowsableState.Never)]
2071 public Extents PaddingEX
2075 Extents temp = new Extents(0, 0, 0, 0);
2076 GetProperty(View.Property.PADDING).Get(temp);
2077 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2081 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2082 NotifyPropertyChanged();
2083 _layout?.RequestLayout();
2087 /// <since_tizen> 6 </since_tizen>
2088 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2089 [EditorBrowsable(EditorBrowsableState.Never)]
2090 public Style XamlStyle
2094 return (Style)GetValue(XamlStyleProperty);
2098 SetValue(XamlStyleProperty, value);
2103 /// The Color of View. This is an RGBA value.
2107 /// Animatable - This property can be animated using <c>Animation</c> class.
2109 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2111 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2112 [EditorBrowsable(EditorBrowsableState.Never)]
2117 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
2118 GetProperty(Interop.ActorProperty.Actor_Property_COLOR_get()).Get(temp);
2119 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2128 /// Set the layout on this View. Replaces any existing Layout.
2130 /// <since_tizen> 6 </since_tizen>
2131 public LayoutItem Layout
2139 // Do nothing if layout provided is already set on this View.
2140 if (value == _layout)
2145 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2146 layoutingDisabled = false;
2149 // If new layout being set already has a owner then that owner receives a replacement default layout.
2150 // First check if the layout to be set already has a owner.
2151 if (value?.Owner != null)
2153 // Previous owner of the layout gets a default layout as a replacement.
2154 value.Owner.Layout = new LayoutGroup();
2156 // Copy Margin and Padding to replacement LayoutGroup.
2157 value.Owner.Layout.Margin = value.Margin;
2158 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 // Set layout to this view
2214 /// The weight of the View, used to share available space in a layout with siblings.
2216 /// <since_tizen> 6 </since_tizen>
2226 _layout?.RequestLayout();
2231 /// Whether to load the BackgroundImage synchronously.
2232 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2233 /// Note: For Normal Quad images only.
2235 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2236 [EditorBrowsable(EditorBrowsableState.Never)]
2237 public bool BackgroundImageSynchronosLoading
2241 return _backgroundImageSynchronosLoading;
2245 _backgroundImageSynchronosLoading = value;
2248 Background.Find(Visual.Property.Type)?.Get(out visualType);
2249 if (visualType == (int)Visual.Type.Image)
2251 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2254 if (bgUrl.Length != 0)
2256 PropertyMap bgMap = this.Background;
2257 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2263 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2264 [EditorBrowsable(EditorBrowsableState.Never)]
2265 public Vector2 UpdateSizeHint
2269 return (Vector2)GetValue(UpdateSizeHintProperty);
2273 SetValue(UpdateSizeHintProperty, value);
2274 NotifyPropertyChanged();
2278 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2279 [EditorBrowsable(EditorBrowsableState.Never)]
2280 public string[] TransitionNames
2284 return transitionNames;
2288 transitionNames = value;
2294 /// Get Style, it is abstract function and must be override.
2296 /// <since_tizen> 6 </since_tizen>
2297 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2298 [EditorBrowsable(EditorBrowsableState.Never)]
2299 protected virtual ViewStyle GetViewStyle()
2301 return new ViewStyle();
2305 /// Called after the View's ControlStates changed.
2307 /// <param name="previousState">The previous state value</param>
2308 /// <param name="touchInfo">The touch information in case the state has changed by touching.</param>
2309 /// <return>True if it needs to apply the state to children recursively.</return>
2310 [EditorBrowsable(EditorBrowsableState.Never)]
2311 protected virtual bool OnControlStateChanged(ControlStates previousState, Touch touchInfo)
2313 //If need to apply the state to all child, return true;
2317 internal static readonly BindableProperty BackgroundImageSelectorProperty = BindableProperty.Create("BackgroundImageSelector", typeof(Selector<string>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2319 var view = (View)bindable;
2320 view.backgroundImageSelector.Clone((Selector<string>)newValue);
2322 defaultValueCreator: (bindable) =>
2324 var view = (View)bindable;
2325 return view.backgroundImageSelector;
2327 private TriggerableSelector<string> _backgroundImageSelector;
2328 private TriggerableSelector<string> backgroundImageSelector
2332 if (null == _backgroundImageSelector)
2334 _backgroundImageSelector = new TriggerableSelector<string>(this, BackgroundImageProperty);
2336 return _backgroundImageSelector;
2339 internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2341 var view = (View)bindable;
2342 view.backgroundColorSelector.Clone((Selector<Color>)newValue);
2344 defaultValueCreator: (bindable) =>
2346 var view = (View)bindable;
2347 return view.backgroundColorSelector;
2349 private TriggerableSelector<Color> _backgroundColorSelector;
2350 private TriggerableSelector<Color> backgroundColorSelector
2354 if (null == _backgroundColorSelector)
2356 _backgroundColorSelector = new TriggerableSelector<Color>(this, BackgroundColorProperty);
2358 return _backgroundColorSelector;
2361 internal static readonly BindableProperty BackgroundImageBorderSelectorProperty = BindableProperty.Create("BackgroundImageBorderSelector", typeof(Selector<Rectangle>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2363 var view = (View)bindable;
2364 view.backgroundImageBorderSelector.Clone((Selector<Rectangle>)newValue);
2366 defaultValueCreator: (bindable) =>
2368 var view = (View)bindable;
2369 return view.backgroundImageBorderSelector;
2371 private TriggerableSelector<Rectangle> _backgroundImageBorderSelector;
2372 private TriggerableSelector<Rectangle> backgroundImageBorderSelector
2376 if (null == _backgroundImageBorderSelector)
2378 _backgroundImageBorderSelector = new TriggerableSelector<Rectangle>(this, BackgroundImageBorderProperty);
2380 return _backgroundImageBorderSelector;
2383 internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2385 var view = (View)bindable;
2386 view.opacitySelector.Clone((Selector<float?>)newValue);
2388 defaultValueCreator: (bindable) =>
2390 var view = (View)bindable;
2391 return view.opacitySelector;
2393 private TriggerableSelector<float?> _opacitySelector;
2394 private TriggerableSelector<float?> opacitySelector
2398 if (null == _opacitySelector)
2400 _opacitySelector = new TriggerableSelector<float?>(this, OpacityProperty);
2402 return _opacitySelector;
2406 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2407 [EditorBrowsable(EditorBrowsableState.Never)]
2408 public virtual void ApplyStyle(ViewStyle viewStyle)
2410 if (null == viewStyle)
2415 if (this.viewStyle == viewStyle)
2420 if (null != this.viewStyle)
2422 simpleBinding.Clear();
2425 this.viewStyle = viewStyle;
2427 Dictionary<string, BindableProperty> bindablePropertyOfView;
2428 Type viewType = GetType();
2430 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2431 Type styleType = viewStyle.GetType();
2433 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2434 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2436 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2438 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2440 BindableProperty viewProperty;
2441 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2443 if (null != viewProperty)
2445 object value = viewStyle.GetValue(keyValuePair.Value);
2449 SetValue(viewProperty, value);
2452 simpleBinding.Bind(viewStyle, keyValuePair.Value, this, viewProperty, BindingDirection.TwoWay);
2458 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2459 [EditorBrowsable(EditorBrowsableState.Never)]
2460 private BundledPipe simpleBinding = new BundledPipe();