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.
75 /// The Style instance binded with this View.
77 [EditorBrowsable(EditorBrowsableState.Never)]
78 protected ViewStyle viewStyle;
80 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
81 [EditorBrowsable(EditorBrowsableState.Never)]
82 public ViewStyle ViewStyle
86 if (null == viewStyle)
88 ApplyStyle(GetViewStyle());
96 /// Creates a new instance of a view.
98 /// <since_tizen> 3 </since_tizen>
99 public View() : this(Interop.View.View_New(), true)
101 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
105 [EditorBrowsable(EditorBrowsableState.Never)]
106 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true)
108 this.ViewStyle.CopyFrom(viewStyle);
112 /// Create a new instance of a View with setting the status of shown or hidden.
114 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
115 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
116 [EditorBrowsable(EditorBrowsableState.Never)]
117 public View(bool shown) : this(Interop.View.View_New(), true)
119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
125 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
132 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
134 if (this.viewStyle == null)
136 ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
140 this.viewStyle.CopyFrom(viewStyle);
144 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
148 PositionUsesPivotPoint = false;
151 _onWindowSendEventCallback = SendViewAddedEventToWindow;
152 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
160 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
162 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
170 internal delegate void ControlStateChangesDelegate(View obj, ControlStates state);
171 internal event ControlStateChangesDelegate ControlStateChangeEvent;
173 private ControlStates controlStates;
175 /// Get/Set the control state.
177 /// <since_tizen> 6 </since_tizen>
178 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
179 [EditorBrowsable(EditorBrowsableState.Never)]
180 public ControlStates ControlState
184 return controlStates;
188 SetControlState(value, null);
193 /// Set ControlState with specified change environment
195 /// <param name="state">New state value</param>
196 /// <param name="touchInfo">The touch information in case the state has changed by touching.</param>
197 /// <return>True, if the state changed successfully.</return>
198 internal bool SetControlState(ControlStates state, Touch touchInfo)
200 if (controlStates == state)
205 var prevState = controlStates;
207 controlStates = state;
209 ControlStateChangeEvent?.Invoke(this, state);
211 if (OnControlStateChanged(prevState, touchInfo))
213 foreach (View child in Children)
215 child.SetControlState(state, touchInfo);
222 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
223 [EditorBrowsable(EditorBrowsableState.Never)]
224 public bool IsResourcesCreated
228 return Application.Current.IsResourcesCreated;
232 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
233 [EditorBrowsable(EditorBrowsableState.Never)]
234 public ResourceDictionary XamlResources
238 return Application.Current.XamlResources;
242 Application.Current.XamlResources = value;
247 /// The StyleName, type string.
249 /// <since_tizen> 3 </since_tizen>
250 public string StyleName
254 return (string)GetValue(StyleNameProperty);
258 SetValue(StyleNameProperty, value);
259 NotifyPropertyChanged();
264 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
267 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
269 /// <since_tizen> 3 </since_tizen>
270 public Color BackgroundColor
274 Color temp = (Color)GetValue(BackgroundColorProperty);
275 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
279 SetValue(BackgroundColorProperty, value);
280 NotifyPropertyChanged();
285 /// The mutually exclusive with "backgroundColor" and "background" type Map.
287 /// <since_tizen> 3 </since_tizen>
288 public string BackgroundImage
292 return (string)GetValue(BackgroundImageProperty);
296 SetValue(BackgroundImageProperty, value);
297 NotifyPropertyChanged();
302 /// Get or set the border of background image.
304 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
305 [EditorBrowsable(EditorBrowsableState.Never)]
306 public Rectangle BackgroundImageBorder
310 return (Rectangle)GetValue(BackgroundImageBorderProperty);
314 SetValue(BackgroundImageBorderProperty, value);
315 NotifyPropertyChanged();
320 /// The background of view.
322 /// <since_tizen> 3 </since_tizen>
323 public Tizen.NUI.PropertyMap Background
327 return (PropertyMap)GetValue(BackgroundProperty);
331 SetValue(BackgroundProperty, value);
332 NotifyPropertyChanged();
337 /// Describes a shadow as an image for a View.
338 /// It is null by default.
341 /// The mutually exclusive with "BoxShadow".
343 [EditorBrowsable(EditorBrowsableState.Never)]
344 public ImageShadow ImageShadow
348 var value = (ImageShadow)GetValue(ImageShadowProperty);
349 return value == null ? null : new ImageShadow(value, OnImageShadowChanged);
353 SetValue(ImageShadowProperty, value);
354 NotifyPropertyChanged();
359 /// Describes a box shaped shadow drawing for a View.
360 /// It is null by default.
363 /// The mutually exclusive with "ImageShadow".
365 [EditorBrowsable(EditorBrowsableState.Never)]
366 public Shadow BoxShadow
370 var value = (Shadow)GetValue(BoxShadowProperty);
371 return value == null ? null : new Shadow(value, OnBoxShadowChanged);
375 SetValue(BoxShadowProperty, value);
376 NotifyPropertyChanged();
381 /// The radius for the rounded corners of the View.
382 /// This will rounds background and shadow edges.
383 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
385 [EditorBrowsable(EditorBrowsableState.Never)]
386 public float CornerRadius
390 float? value = (float?)GetValue(CornerRadiusProperty);
395 SetValue(CornerRadiusProperty, value);
396 NotifyPropertyChanged();
401 /// The current state of the view.
403 /// <since_tizen> 3 </since_tizen>
408 return (States)GetValue(StateProperty);
412 SetValue(StateProperty, value);
413 NotifyPropertyChanged();
418 /// The current sub state of the view.
420 /// <since_tizen> 3 </since_tizen>
421 public States SubState
425 return (States)GetValue(SubStateProperty);
429 SetValue(SubStateProperty, value);
430 NotifyPropertyChanged();
435 /// Displays a tooltip
437 /// <since_tizen> 3 </since_tizen>
438 public Tizen.NUI.PropertyMap Tooltip
442 return (PropertyMap)GetValue(TooltipProperty);
446 SetValue(TooltipProperty, value);
447 NotifyPropertyChanged();
452 /// Displays a tooltip as a text.
454 /// <since_tizen> 3 </since_tizen>
455 public string TooltipText
459 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
460 NotifyPropertyChanged();
465 /// The Child property of FlexContainer.<br />
466 /// The proportion of the free space in the container, the flex item will receive.<br />
467 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
469 /// <since_tizen> 3 </since_tizen>
474 return (float)GetValue(FlexProperty);
478 SetValue(FlexProperty, value);
479 NotifyPropertyChanged();
484 /// The Child property of FlexContainer.<br />
485 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
487 /// <since_tizen> 3 </since_tizen>
492 return (int)GetValue(AlignSelfProperty);
496 SetValue(AlignSelfProperty, value);
497 NotifyPropertyChanged();
502 /// The Child property of FlexContainer.<br />
503 /// The space around the flex item.<br />
506 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
508 /// <since_tizen> 3 </since_tizen>
509 public Vector4 FlexMargin
513 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
514 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
518 SetValue(FlexMarginProperty, value);
519 NotifyPropertyChanged();
524 /// The top-left cell this child occupies, if not set, the first available cell is used.
527 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
529 /// <since_tizen> 3 </since_tizen>
530 public Vector2 CellIndex
534 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
535 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
539 SetValue(CellIndexProperty, value);
540 NotifyPropertyChanged();
545 /// The number of rows this child occupies, if not set, the default value is 1.
547 /// <since_tizen> 3 </since_tizen>
552 return (float)GetValue(RowSpanProperty);
556 SetValue(RowSpanProperty, value);
557 NotifyPropertyChanged();
562 /// The number of columns this child occupies, if not set, the default value is 1.
564 /// <since_tizen> 3 </since_tizen>
565 public float ColumnSpan
569 return (float)GetValue(ColumnSpanProperty);
573 SetValue(ColumnSpanProperty, value);
574 NotifyPropertyChanged();
579 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
581 /// <since_tizen> 3 </since_tizen>
582 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
586 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
590 SetValue(CellHorizontalAlignmentProperty, value);
591 NotifyPropertyChanged();
596 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
598 /// <since_tizen> 3 </since_tizen>
599 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
603 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
607 SetValue(CellVerticalAlignmentProperty, value);
608 NotifyPropertyChanged();
613 /// The left focusable view.<br />
614 /// This will return null if not set.<br />
615 /// This will also return null if the specified left focusable view is not on a window.<br />
617 /// <since_tizen> 3 </since_tizen>
618 public View LeftFocusableView
620 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
623 return (View)GetValue(LeftFocusableViewProperty);
627 SetValue(LeftFocusableViewProperty, value);
628 NotifyPropertyChanged();
633 /// The right focusable view.<br />
634 /// This will return null if not set.<br />
635 /// This will also return null if the specified right focusable view is not on a window.<br />
637 /// <since_tizen> 3 </since_tizen>
638 public View RightFocusableView
640 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
643 return (View)GetValue(RightFocusableViewProperty);
647 SetValue(RightFocusableViewProperty, value);
648 NotifyPropertyChanged();
653 /// The up focusable view.<br />
654 /// This will return null if not set.<br />
655 /// This will also return null if the specified up focusable view is not on a window.<br />
657 /// <since_tizen> 3 </since_tizen>
658 public View UpFocusableView
660 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
663 return (View)GetValue(UpFocusableViewProperty);
667 SetValue(UpFocusableViewProperty, value);
668 NotifyPropertyChanged();
673 /// The down focusable view.<br />
674 /// This will return null if not set.<br />
675 /// This will also return null if the specified down focusable view is not on a window.<br />
677 /// <since_tizen> 3 </since_tizen>
678 public View DownFocusableView
680 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
683 return (View)GetValue(DownFocusableViewProperty);
687 SetValue(DownFocusableViewProperty, value);
688 NotifyPropertyChanged();
693 /// Whether the view should be focusable by keyboard navigation.
695 /// <since_tizen> 3 </since_tizen>
696 public bool Focusable
700 SetValue(FocusableProperty, value);
701 NotifyPropertyChanged();
705 return (bool)GetValue(FocusableProperty);
710 /// Retrieves the position of the view.<br />
711 /// The coordinates are relative to the view's parent.<br />
713 /// <since_tizen> 3 </since_tizen>
714 public Position CurrentPosition
718 return GetCurrentPosition();
723 /// Sets the size of a view for the width and the height.<br />
724 /// Geometry can be scaled to fit within this area.<br />
725 /// This does not interfere with the view's scale factor.<br />
726 /// The views default depth is the minimum of width and height.<br />
729 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
730 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
732 /// <since_tizen> 3 </since_tizen>
737 Size2D temp = (Size2D)GetValue(Size2DProperty);
738 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
742 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
743 SetValue(Size2DProperty, value);
744 // Set Specification so when layouts measure this View it matches the value set here.
745 // All Views are currently Layouts.
746 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
747 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
748 _widthPolicy = value.Width;
749 _heightPolicy = value.Height;
750 _layout?.RequestLayout();
751 NotifyPropertyChanged();
756 /// Retrieves the size of the view.<br />
757 /// The coordinates are relative to the view's parent.<br />
759 /// <since_tizen> 3 </since_tizen>
760 public Size2D CurrentSize
764 return GetCurrentSize();
769 /// Retrieves and sets the view's opacity.<br />
771 /// <since_tizen> 3 </since_tizen>
776 return (float)GetValue(OpacityProperty);
780 SetValue(OpacityProperty, value);
781 NotifyPropertyChanged();
786 /// Sets the position of the view for X and Y.<br />
787 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
788 /// If the position inheritance is disabled, sets the world position.<br />
791 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
792 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
794 /// <since_tizen> 3 </since_tizen>
795 public Position2D Position2D
799 Position2D temp = (Position2D)GetValue(Position2DProperty);
800 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
804 SetValue(Position2DProperty, value);
805 NotifyPropertyChanged();
810 /// Retrieves the screen postion of the view.<br />
812 /// <since_tizen> 3 </since_tizen>
813 public Vector2 ScreenPosition
817 Vector2 temp = new Vector2(0.0f, 0.0f);
818 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
824 /// Determines whether the pivot point should be used to determine the position of the view.
825 /// This is true by default.
827 /// <remarks>If false, then the top-left of the view is used for the position.
828 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
830 /// <since_tizen> 3 </since_tizen>
831 public bool PositionUsesPivotPoint
835 return (bool)GetValue(PositionUsesPivotPointProperty);
839 SetValue(PositionUsesPivotPointProperty, value);
840 NotifyPropertyChanged();
845 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
847 /// <since_tizen> 3 </since_tizen>
848 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
850 "View view = new View(); " +
851 "view.PivotPoint = PivotPoint.Center; " +
852 "view.PositionUsesPivotPoint = true;" +
853 " Deprecated in API5: Will be removed in API8")]
854 [EditorBrowsable(EditorBrowsableState.Never)]
855 public bool PositionUsesAnchorPoint
860 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
865 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
866 NotifyPropertyChanged();
871 /// Queries whether the view is connected to the stage.<br />
872 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
874 /// <since_tizen> 3 </since_tizen>
875 public bool IsOnWindow
884 /// Gets the depth in the hierarchy for the view.
886 /// <since_tizen> 3 </since_tizen>
887 public int HierarchyDepth
891 return GetHierarchyDepth();
896 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
899 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
900 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
901 /// The values set by this property will likely change.
903 /// <since_tizen> 3 </since_tizen>
904 public int SiblingOrder
908 return (int)GetValue(SiblingOrderProperty);
912 SetValue(SiblingOrderProperty, value);
914 LayoutGroup layout = Layout as LayoutGroup;
915 layout?.ChangeLayoutSiblingOrder(value);
917 NotifyPropertyChanged();
922 /// Returns the natural size of the view.
925 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
927 /// <since_tizen> 5 </since_tizen>
928 public Vector3 NaturalSize
932 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
933 if (NDalicPINVOKE.SWIGPendingException.Pending)
934 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
940 /// Returns the natural size (Size2D) of the view.
943 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
945 /// <since_tizen> 4 </since_tizen>
946 public Size2D NaturalSize2D
950 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
951 if (NDalicPINVOKE.SWIGPendingException.Pending)
952 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
954 return new Size2D((int)temp.Width, (int)temp.Height);
959 /// Gets or sets the origin of a view within its parent's area.<br />
960 /// 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 />
961 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
962 /// A view's position is the distance between this origin and the view's anchor-point.<br />
964 /// <pre>The view has been initialized.</pre>
965 /// <since_tizen> 3 </since_tizen>
966 public Position ParentOrigin
970 Position tmp = (Position)GetValue(ParentOriginProperty);
971 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
975 SetValue(ParentOriginProperty, value);
976 NotifyPropertyChanged();
981 /// Gets or sets the anchor-point of a view.<br />
982 /// 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 />
983 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
984 /// A view position is the distance between its parent-origin and this anchor-point.<br />
985 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
986 /// <pre>The view has been initialized.</pre>
989 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
991 /// <since_tizen> 3 </since_tizen>
992 public Position PivotPoint
996 Position tmp = (Position)GetValue(PivotPointProperty);
997 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1001 SetValue(PivotPointProperty, value);
1002 NotifyPropertyChanged();
1007 /// Gets or sets the size width of the view.
1011 /// Animatable - This property can be animated using <c>Animation</c> class.
1014 /// <since_tizen> 3 </since_tizen>
1015 public float SizeWidth
1019 return (float)GetValue(SizeWidthProperty);
1023 SetValue(SizeWidthProperty, value);
1024 WidthSpecification = (int)Math.Ceiling(value);
1025 NotifyPropertyChanged();
1030 /// Gets or sets the size height of the view.
1034 /// Animatable - This property can be animated using <c>Animation</c> class.
1037 /// <since_tizen> 3 </since_tizen>
1038 public float SizeHeight
1042 return (float)GetValue(SizeHeightProperty);
1046 SetValue(SizeHeightProperty, value);
1047 HeightSpecification = (int)Math.Ceiling(value);
1048 NotifyPropertyChanged();
1053 /// Gets or sets the position of the view.<br />
1054 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1055 /// If the position inheritance is disabled, sets the world position.<br />
1059 /// Animatable - This property can be animated using <c>Animation</c> class.
1061 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1063 /// <since_tizen> 3 </since_tizen>
1064 public Position Position
1068 Position tmp = (Position)GetValue(PositionProperty);
1069 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1073 SetValue(PositionProperty, value);
1074 NotifyPropertyChanged();
1079 /// Gets or sets the position X of the view.
1083 /// Animatable - This property can be animated using <c>Animation</c> class.
1086 /// <since_tizen> 3 </since_tizen>
1087 public float PositionX
1091 return (float)GetValue(PositionXProperty);
1095 SetValue(PositionXProperty, value);
1096 NotifyPropertyChanged();
1101 /// Gets or sets the position Y of the view.
1105 /// Animatable - This property can be animated using <c>Animation</c> class.
1108 /// <since_tizen> 3 </since_tizen>
1109 public float PositionY
1113 return (float)GetValue(PositionYProperty);
1117 SetValue(PositionYProperty, value);
1118 NotifyPropertyChanged();
1123 /// Gets or sets the position Z of the view.
1127 /// Animatable - This property can be animated using <c>Animation</c> class.
1130 /// <since_tizen> 3 </since_tizen>
1131 public float PositionZ
1135 return (float)GetValue(PositionZProperty);
1139 SetValue(PositionZProperty, value);
1140 NotifyPropertyChanged();
1145 /// Gets or sets the world position of the view.
1147 /// <since_tizen> 3 </since_tizen>
1148 public Vector3 WorldPosition
1152 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1153 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1159 /// Gets or sets the orientation of the view.<br />
1160 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1164 /// This is an asynchronous method.
1167 /// Animatable - This property can be animated using <c>Animation</c> class.
1170 /// <since_tizen> 3 </since_tizen>
1171 public Rotation Orientation
1175 return (Rotation)GetValue(OrientationProperty);
1179 SetValue(OrientationProperty, value);
1180 NotifyPropertyChanged();
1185 /// Gets or sets the world orientation of the view.<br />
1187 /// <since_tizen> 3 </since_tizen>
1188 public Rotation WorldOrientation
1192 Rotation temp = new Rotation();
1193 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1199 /// Gets or sets the scale factor applied to the view.<br />
1203 /// Animatable - This property can be animated using <c>Animation</c> class.
1205 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1207 /// <since_tizen> 3 </since_tizen>
1208 public Vector3 Scale
1212 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1213 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1217 SetValue(ScaleProperty, value);
1218 NotifyPropertyChanged();
1223 /// Gets or sets the scale X factor applied to the view.
1227 /// Animatable - This property can be animated using <c>Animation</c> class.
1230 /// <since_tizen> 3 </since_tizen>
1235 return (float)GetValue(ScaleXProperty);
1239 SetValue(ScaleXProperty, value);
1240 NotifyPropertyChanged();
1245 /// Gets or sets the scale Y factor applied to the view.
1249 /// Animatable - This property can be animated using <c>Animation</c> class.
1252 /// <since_tizen> 3 </since_tizen>
1257 return (float)GetValue(ScaleYProperty);
1261 SetValue(ScaleYProperty, value);
1262 NotifyPropertyChanged();
1267 /// Gets or sets the scale Z factor applied to the view.
1271 /// Animatable - This property can be animated using <c>Animation</c> class.
1274 /// <since_tizen> 3 </since_tizen>
1279 return (float)GetValue(ScaleZProperty);
1283 SetValue(ScaleZProperty, value);
1284 NotifyPropertyChanged();
1289 /// Gets the world scale of the view.
1291 /// <since_tizen> 3 </since_tizen>
1292 public Vector3 WorldScale
1296 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1297 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1303 /// Retrieves the visibility flag of the view.
1307 /// If the view is not visible, then the view and its children will not be rendered.
1308 /// 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.
1311 /// Animatable - This property can be animated using <c>Animation</c> class.
1314 /// <since_tizen> 3 </since_tizen>
1315 public bool Visibility
1320 GetProperty(View.Property.VISIBLE).Get(out temp);
1326 /// Gets the view's world color.
1328 /// <since_tizen> 3 </since_tizen>
1329 public Vector4 WorldColor
1333 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1334 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1340 /// Gets or sets the view's name.
1342 /// <since_tizen> 3 </since_tizen>
1347 return (string)GetValue(NameProperty);
1351 SetValue(NameProperty, value);
1352 NotifyPropertyChanged();
1357 /// Get the number of children held by the view.
1359 /// <since_tizen> 3 </since_tizen>
1360 public new uint ChildCount
1364 return GetChildCount();
1369 /// Gets the view's ID.
1372 /// <since_tizen> 3 </since_tizen>
1382 /// Gets or sets the status of whether the view should emit touch or hover signals.
1384 /// <since_tizen> 3 </since_tizen>
1385 public bool Sensitive
1389 return (bool)GetValue(SensitiveProperty);
1393 SetValue(SensitiveProperty, value);
1394 NotifyPropertyChanged();
1399 /// 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.
1401 /// <since_tizen> 3 </since_tizen>
1402 public bool LeaveRequired
1406 return (bool)GetValue(LeaveRequiredProperty);
1410 SetValue(LeaveRequiredProperty, value);
1411 NotifyPropertyChanged();
1416 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1418 /// <since_tizen> 3 </since_tizen>
1419 public bool InheritOrientation
1423 return (bool)GetValue(InheritOrientationProperty);
1427 SetValue(InheritOrientationProperty, value);
1428 NotifyPropertyChanged();
1433 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1435 /// <since_tizen> 3 </since_tizen>
1436 public bool InheritScale
1440 return (bool)GetValue(InheritScaleProperty);
1444 SetValue(InheritScaleProperty, value);
1445 NotifyPropertyChanged();
1450 /// Gets or sets the status of how the view and its children should be drawn.<br />
1451 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1452 /// 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 />
1453 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1454 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1455 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1457 /// <since_tizen> 3 </since_tizen>
1458 public DrawModeType DrawMode
1462 return (DrawModeType)GetValue(DrawModeProperty);
1466 SetValue(DrawModeProperty, value);
1467 NotifyPropertyChanged();
1472 /// Gets or sets the relative to parent size factor of the view.<br />
1473 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1474 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1477 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1479 /// <since_tizen> 3 </since_tizen>
1480 public Vector3 SizeModeFactor
1484 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1485 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1489 SetValue(SizeModeFactorProperty, value);
1490 NotifyPropertyChanged();
1495 /// Gets or sets the width resize policy to be used.
1497 /// <since_tizen> 3 </since_tizen>
1498 public ResizePolicyType WidthResizePolicy
1502 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1506 SetValue(WidthResizePolicyProperty, value);
1507 // Match ResizePolicy to new Layouting.
1508 // Parent relative policies can not be mapped at this point as parent size unknown.
1511 case ResizePolicyType.UseNaturalSize:
1513 WidthSpecification = LayoutParamPolicies.WrapContent;
1516 case ResizePolicyType.FillToParent:
1518 WidthSpecification = LayoutParamPolicies.MatchParent;
1521 case ResizePolicyType.FitToChildren:
1523 WidthSpecification = LayoutParamPolicies.WrapContent;
1529 NotifyPropertyChanged();
1534 /// Gets or sets the height resize policy to be used.
1536 /// <since_tizen> 3 </since_tizen>
1537 public ResizePolicyType HeightResizePolicy
1541 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1545 SetValue(HeightResizePolicyProperty, value);
1546 // Match ResizePolicy to new Layouting.
1547 // Parent relative policies can not be mapped at this point as parent size unknown.
1550 case ResizePolicyType.UseNaturalSize:
1552 HeightSpecification = LayoutParamPolicies.WrapContent;
1555 case ResizePolicyType.FillToParent:
1557 HeightSpecification = LayoutParamPolicies.MatchParent;
1560 case ResizePolicyType.FitToChildren:
1562 HeightSpecification = LayoutParamPolicies.WrapContent;
1568 NotifyPropertyChanged();
1573 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1574 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1576 /// <since_tizen> 3 </since_tizen>
1577 public SizeScalePolicyType SizeScalePolicy
1581 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1585 SetValue(SizeScalePolicyProperty, value);
1586 NotifyPropertyChanged();
1591 /// Gets or sets the status of whether the width size is dependent on the height size.
1593 /// <since_tizen> 3 </since_tizen>
1594 public bool WidthForHeight
1598 return (bool)GetValue(WidthForHeightProperty);
1602 SetValue(WidthForHeightProperty, value);
1603 NotifyPropertyChanged();
1608 /// Gets or sets the status of whether the height size is dependent on the width size.
1610 /// <since_tizen> 3 </since_tizen>
1611 public bool HeightForWidth
1615 return (bool)GetValue(HeightForWidthProperty);
1619 SetValue(HeightForWidthProperty, value);
1620 NotifyPropertyChanged();
1625 /// Gets or sets the padding for use in layout.
1628 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1630 /// <since_tizen> 5 </since_tizen>
1631 public Extents Padding
1635 // If View has a Layout then padding in stored in the base Layout class
1638 return Layout.Padding;
1642 Extents temp = (Extents)GetValue(PaddingProperty);
1643 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1645 // Two return points to prevent creating a zeroed Extent native object before assignment
1649 Extents padding = value;
1652 // Layout set so store Padding in LayoutItem instead of in View.
1653 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1654 // the position and sizes measure in the Layouting.
1655 Layout.Padding = value;
1656 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1657 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1658 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1660 padding = new Extents(0,0,0,0); // Reset value stored in View.
1662 _layout?.RequestLayout();
1664 SetValue(PaddingProperty, padding);
1665 NotifyPropertyChanged();
1666 _layout?.RequestLayout();
1671 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1674 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1676 /// <since_tizen> 3 </since_tizen>
1677 public Size2D MinimumSize
1681 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1682 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1686 if (_layout != null)
1688 // Note: it only works if minimum size is >= than natural size.
1689 // To force the size it should be done through the width&height spec or Size2D.
1690 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1691 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1692 _layout.RequestLayout();
1694 SetValue(MinimumSizeProperty, value);
1695 NotifyPropertyChanged();
1700 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1703 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1705 /// <since_tizen> 3 </since_tizen>
1706 public Size2D MaximumSize
1710 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1711 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1715 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1716 // MATCH_PARENT spec + parent container size can be used to limit
1717 if (_layout != null)
1719 // Note: it only works if minimum size is >= than natural size.
1720 // To force the size it should be done through the width&height spec or Size2D.
1721 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Width);
1722 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Height);
1723 _layout.RequestLayout();
1725 SetValue(MaximumSizeProperty, value);
1726 NotifyPropertyChanged();
1731 /// Gets or sets whether a child view inherits it's parent's position.<br />
1732 /// Default is to inherit.<br />
1733 /// 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 />
1735 /// <since_tizen> 3 </since_tizen>
1736 public bool InheritPosition
1740 return (bool)GetValue(InheritPositionProperty);
1744 SetValue(InheritPositionProperty, value);
1745 NotifyPropertyChanged();
1750 /// Gets or sets the clipping behavior (mode) of it's children.
1752 /// <since_tizen> 3 </since_tizen>
1753 public ClippingModeType ClippingMode
1757 return (ClippingModeType)GetValue(ClippingModeProperty);
1761 SetValue(ClippingModeProperty, value);
1762 NotifyPropertyChanged();
1767 /// Gets the number of renderers held by the view.
1769 /// <since_tizen> 3 </since_tizen>
1770 public uint RendererCount
1774 return GetRendererCount();
1779 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1782 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1784 /// <since_tizen> 3 </since_tizen>
1785 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1787 "View view = new View(); " +
1788 "view.PivotPoint = PivotPoint.Center; " +
1789 "view.PositionUsesPivotPoint = true;")]
1790 [EditorBrowsable(EditorBrowsableState.Never)]
1791 public Position AnchorPoint
1795 Position temp = new Position(0.0f, 0.0f, 0.0f);
1796 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1797 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1801 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1802 NotifyPropertyChanged();
1807 /// Sets the size of a view for the width, the height and the depth.<br />
1808 /// Geometry can be scaled to fit within this area.<br />
1809 /// This does not interfere with the view's scale factor.<br />
1810 /// The views default depth is the minimum of width and height.<br />
1814 /// Animatable - This property can be animated using <c>Animation</c> class.
1816 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1818 /// <since_tizen> 5 </since_tizen>
1823 Size tmp = (Size)GetValue(SizeProperty);
1824 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1828 SetValue(SizeProperty, value);
1829 // Set Specification so when layouts measure this View it matches the value set here.
1830 // All Views are currently Layouts.
1831 WidthSpecification = (int)Math.Ceiling(value.Width);
1832 HeightSpecification = (int)Math.Ceiling(value.Height);
1833 NotifyPropertyChanged();
1838 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1840 /// <since_tizen> 3 </since_tizen>
1841 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1843 "Container parent = view.GetParent(); " +
1844 "View view = parent as View;")]
1845 [EditorBrowsable(EditorBrowsableState.Never)]
1846 public new View Parent
1851 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1852 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1853 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1855 if (basehandle is Layer layer)
1857 ret = new View(Layer.getCPtr(layer).Handle, false);
1858 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1862 ret = basehandle as View;
1865 Interop.BaseHandle.delete_BaseHandle(CPtr);
1866 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1868 if (NDalicPINVOKE.SWIGPendingException.Pending)
1869 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1875 /// Gets/Sets whether inherit parent's the layout Direction.
1877 /// <since_tizen> 4 </since_tizen>
1878 public bool InheritLayoutDirection
1882 return (bool)GetValue(InheritLayoutDirectionProperty);
1886 SetValue(InheritLayoutDirectionProperty, value);
1887 NotifyPropertyChanged();
1892 /// Gets/Sets the layout Direction.
1894 /// <since_tizen> 4 </since_tizen>
1895 public ViewLayoutDirectionType LayoutDirection
1899 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1903 SetValue(LayoutDirectionProperty, value);
1904 NotifyPropertyChanged();
1905 _layout?.RequestLayout();
1910 /// Gets or sets the Margin for use in layout.
1913 /// Margin property is supported by Layout algorithms and containers.
1914 /// Please Set Layout if you want to use Margin property.
1915 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1917 /// <since_tizen> 4 </since_tizen>
1918 public Extents Margin
1922 // If View has a Layout then margin is stored in Layout.
1925 return Layout.Margin;
1929 // If Layout not set then return margin stored in View.
1930 Extents temp = (Extents)GetValue(MarginProperty);
1931 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1933 // Two return points to prevent creating a zeroed Extent native object before assignment
1939 // Layout set so store Margin in LayoutItem instead of View.
1940 // If View stores the Margin too then the Legacy Size Negotiation will
1941 // overwrite the position and size values measured in the Layouting.
1942 Layout.Margin = value;
1943 SetValue(MarginProperty, new Extents(0,0,0,0));
1944 _layout?.RequestLayout();
1948 SetValue(MarginProperty, value);
1950 NotifyPropertyChanged();
1951 _layout?.RequestLayout();
1956 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1958 /// <since_tizen> 6 </since_tizen>
1959 public int WidthSpecification
1963 return _widthPolicy;
1967 _widthPolicy = value;
1968 if( _oldWidthPolicy != _widthPolicy )
1970 if (_widthPolicy >= 0)
1972 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1974 if(_heightPolicy>=0) // Policy an exact value
1976 Size2D.Width = _widthPolicy;
1980 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1981 // Size2D height will store the specification value (negative number) this will then be applied to the
1982 // HeightSpecification when the Size2D callback is invoked.
1983 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1986 _layout?.RequestLayout();
1987 _oldWidthPolicy = _widthPolicy;
1993 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1995 /// <since_tizen> 6 </since_tizen>
1996 public int HeightSpecification
2000 return _heightPolicy;
2004 _heightPolicy = value;
2005 if( _oldHeightPolicy != _heightPolicy )
2007 if (_heightPolicy >= 0)
2009 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
2011 if(_widthPolicy>=0) // Policy an exact value
2013 Size2D.Height = _heightPolicy;
2017 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
2018 // Size2D height will store the specification value (negative number) this will then be applied to the
2019 // HeightSpecification when the Size2D callback is invoked.
2020 Size2D = new Size2D(_widthPolicy,_heightPolicy);
2024 _layout?.RequestLayout();
2025 _oldHeightPolicy = _heightPolicy;
2031 /// Gets the List of transitions for this View.
2033 /// <since_tizen> 6 </since_tizen>
2034 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2038 if (_layoutTransitions == null)
2040 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2042 return _layoutTransitions;
2047 /// Set a layout transitions for this View.
2050 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2052 /// <since_tizen> 6 </since_tizen>
2053 public LayoutTransition LayoutTransition
2057 if (_layoutTransitions == null)
2059 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2061 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2063 AttachTransitionsToChildren(value);
2068 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2071 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2073 /// <since_tizen> 4 </since_tizen>
2074 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2075 [EditorBrowsable(EditorBrowsableState.Never)]
2076 public Extents PaddingEX
2080 Extents temp = new Extents(0, 0, 0, 0);
2081 GetProperty(View.Property.PADDING).Get(temp);
2082 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2086 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2087 NotifyPropertyChanged();
2088 _layout?.RequestLayout();
2092 /// <since_tizen> 6 </since_tizen>
2093 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2094 [EditorBrowsable(EditorBrowsableState.Never)]
2095 public Style XamlStyle
2099 return (Style)GetValue(XamlStyleProperty);
2103 SetValue(XamlStyleProperty, value);
2108 /// The Color of View. This is an RGBA value.
2112 /// Animatable - This property can be animated using <c>Animation</c> class.
2114 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2116 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2117 [EditorBrowsable(EditorBrowsableState.Never)]
2122 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
2123 GetProperty(Interop.ActorProperty.Actor_Property_COLOR_get()).Get(temp);
2124 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2133 /// Set the layout on this View. Replaces any existing Layout.
2135 /// <since_tizen> 6 </since_tizen>
2136 public LayoutItem Layout
2144 // Do nothing if layout provided is already set on this View.
2145 if (value == _layout)
2150 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2151 layoutingDisabled = false;
2154 // If new layout being set already has a owner then that owner receives a replacement default layout.
2155 // First check if the layout to be set already has a owner.
2156 if (value?.Owner != null)
2158 // Previous owner of the layout gets a default layout as a replacement.
2159 value.Owner.Layout = new LayoutGroup();
2161 // Copy Margin and Padding to replacement LayoutGroup.
2162 value.Owner.Layout.Margin = value.Margin;
2163 value.Owner.Layout.Padding = value.Padding;
2166 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2167 // View if no replacement. Previously margin and padding values would have been moved from
2168 // the View to the layout.
2169 if (_layout != null ) // Existing layout
2173 // Existing layout being replaced so copy over margin and padding values.
2174 value.Margin = _layout.Margin;
2175 value.Padding = _layout.Padding;
2179 // Layout not being replaced so restore margin and padding to View.
2180 SetValue(MarginProperty, _layout.Margin);
2181 SetValue(PaddingProperty, _layout.Padding);
2182 NotifyPropertyChanged();
2187 // First Layout to be added to the View hence copy
2189 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2192 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2194 // If View already has a margin set then store it in Layout instead.
2195 value.Margin = Margin;
2196 SetValue(MarginProperty, new Extents(0,0,0,0));
2197 NotifyPropertyChanged();
2200 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2202 // If View already has a padding set then store it in Layout instead.
2203 value.Padding = Padding;
2204 SetValue(PaddingProperty, new Extents(0,0,0,0));
2205 NotifyPropertyChanged();
2210 // Remove existing layout from it's parent layout group.
2211 _layout?.Unparent();
2213 // Set layout to this view
2219 /// The weight of the View, used to share available space in a layout with siblings.
2221 /// <since_tizen> 6 </since_tizen>
2231 _layout?.RequestLayout();
2236 /// Whether to load the BackgroundImage synchronously.
2237 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2238 /// Note: For Normal Quad images only.
2240 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2241 [EditorBrowsable(EditorBrowsableState.Never)]
2242 public bool BackgroundImageSynchronosLoading
2246 return _backgroundImageSynchronosLoading;
2250 _backgroundImageSynchronosLoading = value;
2253 Background.Find(Visual.Property.Type)?.Get(out visualType);
2254 if (visualType == (int)Visual.Type.Image)
2256 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2259 if (bgUrl.Length != 0)
2261 PropertyMap bgMap = this.Background;
2262 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2268 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2269 [EditorBrowsable(EditorBrowsableState.Never)]
2270 public Vector2 UpdateSizeHint
2274 return (Vector2)GetValue(UpdateSizeHintProperty);
2278 SetValue(UpdateSizeHintProperty, value);
2279 NotifyPropertyChanged();
2283 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2284 [EditorBrowsable(EditorBrowsableState.Never)]
2285 public string[] TransitionNames
2289 return transitionNames;
2293 transitionNames = value;
2299 /// Get Style, it is abstract function and must be override.
2301 /// <since_tizen> 6 </since_tizen>
2302 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2303 [EditorBrowsable(EditorBrowsableState.Never)]
2304 protected virtual ViewStyle GetViewStyle()
2306 return new ViewStyle();
2310 /// Called after the View's ControlStates changed.
2312 /// <param name="previousState">The previous state value</param>
2313 /// <param name="touchInfo">The touch information in case the state has changed by touching.</param>
2314 /// <return>True if it needs to apply the state to children recursively.</return>
2315 [EditorBrowsable(EditorBrowsableState.Never)]
2316 protected virtual bool OnControlStateChanged(ControlStates previousState, Touch touchInfo)
2318 //If need to apply the state to all child, return true;
2322 internal static readonly BindableProperty BackgroundImageSelectorProperty = BindableProperty.Create("BackgroundImageSelector", typeof(Selector<string>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2324 var view = (View)bindable;
2325 view.backgroundImageSelector.Clone((Selector<string>)newValue);
2327 defaultValueCreator: (bindable) =>
2329 var view = (View)bindable;
2330 return view.backgroundImageSelector;
2332 private TriggerableSelector<string> _backgroundImageSelector;
2333 private TriggerableSelector<string> backgroundImageSelector
2337 if (null == _backgroundImageSelector)
2339 _backgroundImageSelector = new TriggerableSelector<string>(this, BackgroundImageProperty);
2341 return _backgroundImageSelector;
2344 internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2346 var view = (View)bindable;
2347 view.backgroundColorSelector.Clone((Selector<Color>)newValue);
2349 defaultValueCreator: (bindable) =>
2351 var view = (View)bindable;
2352 return view.backgroundColorSelector;
2354 private TriggerableSelector<Color> _backgroundColorSelector;
2355 private TriggerableSelector<Color> backgroundColorSelector
2359 if (null == _backgroundColorSelector)
2361 _backgroundColorSelector = new TriggerableSelector<Color>(this, BackgroundColorProperty);
2363 return _backgroundColorSelector;
2366 internal static readonly BindableProperty BackgroundImageBorderSelectorProperty = BindableProperty.Create("BackgroundImageBorderSelector", typeof(Selector<Rectangle>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2368 var view = (View)bindable;
2369 view.backgroundImageBorderSelector.Clone((Selector<Rectangle>)newValue);
2371 defaultValueCreator: (bindable) =>
2373 var view = (View)bindable;
2374 return view.backgroundImageBorderSelector;
2376 private TriggerableSelector<Rectangle> _backgroundImageBorderSelector;
2377 private TriggerableSelector<Rectangle> backgroundImageBorderSelector
2381 if (null == _backgroundImageBorderSelector)
2383 _backgroundImageBorderSelector = new TriggerableSelector<Rectangle>(this, BackgroundImageBorderProperty);
2385 return _backgroundImageBorderSelector;
2388 internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2390 var view = (View)bindable;
2391 view.opacitySelector.Clone((Selector<float?>)newValue);
2393 defaultValueCreator: (bindable) =>
2395 var view = (View)bindable;
2396 return view.opacitySelector;
2398 private TriggerableSelector<float?> _opacitySelector;
2399 private TriggerableSelector<float?> opacitySelector
2403 if (null == _opacitySelector)
2405 _opacitySelector = new TriggerableSelector<float?>(this, OpacityProperty);
2407 return _opacitySelector;
2411 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2412 [EditorBrowsable(EditorBrowsableState.Never)]
2413 public virtual void ApplyStyle(ViewStyle viewStyle)
2415 if (null == viewStyle)
2420 if (this.viewStyle == viewStyle)
2425 if (null != this.viewStyle)
2427 simpleBinding.Clear();
2430 this.viewStyle = viewStyle;
2432 Dictionary<string, BindableProperty> bindablePropertyOfView;
2433 Type viewType = GetType();
2435 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2436 Type styleType = viewStyle.GetType();
2438 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2439 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2441 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2443 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2445 BindableProperty viewProperty;
2446 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2448 if (null != viewProperty)
2450 object value = viewStyle.GetValue(keyValuePair.Value);
2454 SetValue(viewProperty, value);
2457 simpleBinding.Bind(viewStyle, keyValuePair.Value, this, viewProperty, BindingDirection.TwoWay);
2463 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2464 [EditorBrowsable(EditorBrowsableState.Never)]
2465 private BundledPipe simpleBinding = new BundledPipe();