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 BackgroundExtraData backgroundExtraData;
64 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
69 /// The Style instance binded with this View.
71 [EditorBrowsable(EditorBrowsableState.Never)]
72 protected ViewStyle viewStyle;
74 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
75 [EditorBrowsable(EditorBrowsableState.Never)]
76 public ViewStyle ViewStyle
80 if (null == viewStyle)
82 ApplyStyle(GetViewStyle());
90 /// Creates a new instance of a view.
92 /// <since_tizen> 3 </since_tizen>
93 public View() : this(Interop.View.View_New(), true)
95 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
98 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
99 [EditorBrowsable(EditorBrowsableState.Never)]
100 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true)
102 this.ViewStyle.CopyFrom(viewStyle);
106 /// Create a new instance of a View with setting the status of shown or hidden.
108 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
109 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
110 [EditorBrowsable(EditorBrowsableState.Never)]
111 public View(bool shown) : this(Interop.View.View_New(), true)
113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
125 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
128 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
130 if (this.viewStyle == null)
132 ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
136 this.viewStyle.CopyFrom(viewStyle);
140 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
144 PositionUsesPivotPoint = false;
147 _onWindowSendEventCallback = SendViewAddedEventToWindow;
148 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
156 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
158 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166 internal delegate void ControlStateChangesDelegate(View obj, ControlStateChagedInfo controlStateChangedInfo);
167 internal event ControlStateChangesDelegate ControlStateChangeEvent;
169 private ControlStates controlStates;
171 /// Get/Set the control state.
173 /// <since_tizen> 6 </since_tizen>
174 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
175 [EditorBrowsable(EditorBrowsableState.Never)]
176 public ControlStates ControlState
180 return controlStates;
184 SetControlState(value, null);
189 /// Set ControlState with specified change environment
191 /// <param name="state">New state value</param>
192 /// <param name="touchInfo">The touch information in case the state has changed by touching.</param>
193 /// <return>True, if the state changed successfully.</return>
194 internal bool SetControlState(ControlStates state, Touch touchInfo)
196 if (controlStates == state)
201 var prevState = controlStates;
203 controlStates = state;
205 var changeInfo = new ControlStateChagedInfo(prevState, state, touchInfo);
207 ControlStateChangeEvent?.Invoke(this, changeInfo);
209 if (OnControlStateChanged(changeInfo))
211 foreach (View child in Children)
213 child.SetControlState(state, touchInfo);
220 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
221 [EditorBrowsable(EditorBrowsableState.Never)]
222 public bool IsResourcesCreated
226 return Application.Current.IsResourcesCreated;
230 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
231 [EditorBrowsable(EditorBrowsableState.Never)]
232 public ResourceDictionary XamlResources
236 return Application.Current.XamlResources;
240 Application.Current.XamlResources = value;
245 /// The StyleName, type string.
247 /// <since_tizen> 3 </since_tizen>
248 public string StyleName
252 return (string)GetValue(StyleNameProperty);
256 SetValue(StyleNameProperty, value);
257 NotifyPropertyChanged();
262 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
265 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
267 /// <since_tizen> 3 </since_tizen>
268 public Color BackgroundColor
272 Color temp = (Color)GetValue(BackgroundColorProperty);
273 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
277 SetValue(BackgroundColorProperty, value);
278 NotifyPropertyChanged();
283 /// The mutually exclusive with "backgroundColor" and "background" type Map.
285 /// <since_tizen> 3 </since_tizen>
286 public string BackgroundImage
290 return (string)GetValue(BackgroundImageProperty);
294 SetValue(BackgroundImageProperty, value);
295 NotifyPropertyChanged();
300 /// Get or set the border of background image.
302 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
303 [EditorBrowsable(EditorBrowsableState.Never)]
304 public Rectangle BackgroundImageBorder
308 return (Rectangle)GetValue(BackgroundImageBorderProperty);
312 SetValue(BackgroundImageBorderProperty, value);
313 NotifyPropertyChanged();
318 /// The background of view.
320 /// <since_tizen> 3 </since_tizen>
321 public Tizen.NUI.PropertyMap Background
325 return (PropertyMap)GetValue(BackgroundProperty);
329 SetValue(BackgroundProperty, value);
330 NotifyPropertyChanged();
335 /// Describes a shadow as an image for a View.
336 /// It is null by default.
339 /// Gettter returns copied instance of current shadow.
342 /// The mutually exclusive with "BoxShadow".
344 [EditorBrowsable(EditorBrowsableState.Never)]
345 public ImageShadow ImageShadow
349 return (ImageShadow)GetValue(ImageShadowProperty);
353 SetValue(ImageShadowProperty, value);
354 NotifyPropertyChanged();
359 /// Describes a box shaped shadow drawing for a View.
360 /// It is null by default.
363 /// Gettter returns copied instance of current shadow.
366 /// The mutually exclusive with "ImageShadow".
368 [EditorBrowsable(EditorBrowsableState.Never)]
369 public Shadow BoxShadow
373 return (Shadow)GetValue(BoxShadowProperty);
377 SetValue(BoxShadowProperty, value);
378 NotifyPropertyChanged();
383 /// The radius for the rounded corners of the View.
384 /// This will rounds background and shadow edges.
385 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
387 [EditorBrowsable(EditorBrowsableState.Never)]
388 public float CornerRadius
392 return (float)GetValue(CornerRadiusProperty);
396 SetValue(CornerRadiusProperty, value);
397 NotifyPropertyChanged();
402 /// The current state of the view.
404 /// <since_tizen> 3 </since_tizen>
409 return (States)GetValue(StateProperty);
413 SetValue(StateProperty, value);
414 NotifyPropertyChanged();
419 /// The current sub state of the view.
421 /// <since_tizen> 3 </since_tizen>
422 public States SubState
426 return (States)GetValue(SubStateProperty);
430 SetValue(SubStateProperty, value);
431 NotifyPropertyChanged();
436 /// Displays a tooltip
438 /// <since_tizen> 3 </since_tizen>
439 public Tizen.NUI.PropertyMap Tooltip
443 return (PropertyMap)GetValue(TooltipProperty);
447 SetValue(TooltipProperty, value);
448 NotifyPropertyChanged();
453 /// Displays a tooltip as a text.
455 /// <since_tizen> 3 </since_tizen>
456 public string TooltipText
460 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
461 NotifyPropertyChanged();
466 /// The Child property of FlexContainer.<br />
467 /// The proportion of the free space in the container, the flex item will receive.<br />
468 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
470 /// <since_tizen> 3 </since_tizen>
475 return (float)GetValue(FlexProperty);
479 SetValue(FlexProperty, value);
480 NotifyPropertyChanged();
485 /// The Child property of FlexContainer.<br />
486 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
488 /// <since_tizen> 3 </since_tizen>
493 return (int)GetValue(AlignSelfProperty);
497 SetValue(AlignSelfProperty, value);
498 NotifyPropertyChanged();
503 /// The Child property of FlexContainer.<br />
504 /// The space around the flex item.<br />
507 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
509 /// <since_tizen> 3 </since_tizen>
510 public Vector4 FlexMargin
514 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
515 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
519 SetValue(FlexMarginProperty, value);
520 NotifyPropertyChanged();
525 /// The top-left cell this child occupies, if not set, the first available cell is used.
528 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
530 /// <since_tizen> 3 </since_tizen>
531 public Vector2 CellIndex
535 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
536 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
540 SetValue(CellIndexProperty, value);
541 NotifyPropertyChanged();
546 /// The number of rows this child occupies, if not set, the default value is 1.
548 /// <since_tizen> 3 </since_tizen>
553 return (float)GetValue(RowSpanProperty);
557 SetValue(RowSpanProperty, value);
558 NotifyPropertyChanged();
563 /// The number of columns this child occupies, if not set, the default value is 1.
565 /// <since_tizen> 3 </since_tizen>
566 public float ColumnSpan
570 return (float)GetValue(ColumnSpanProperty);
574 SetValue(ColumnSpanProperty, value);
575 NotifyPropertyChanged();
580 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
582 /// <since_tizen> 3 </since_tizen>
583 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
587 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
591 SetValue(CellHorizontalAlignmentProperty, value);
592 NotifyPropertyChanged();
597 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
599 /// <since_tizen> 3 </since_tizen>
600 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
604 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
608 SetValue(CellVerticalAlignmentProperty, value);
609 NotifyPropertyChanged();
614 /// The left focusable view.<br />
615 /// This will return null if not set.<br />
616 /// This will also return null if the specified left focusable view is not on a window.<br />
618 /// <since_tizen> 3 </since_tizen>
619 public View LeftFocusableView
621 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
624 return (View)GetValue(LeftFocusableViewProperty);
628 SetValue(LeftFocusableViewProperty, value);
629 NotifyPropertyChanged();
634 /// The right focusable view.<br />
635 /// This will return null if not set.<br />
636 /// This will also return null if the specified right focusable view is not on a window.<br />
638 /// <since_tizen> 3 </since_tizen>
639 public View RightFocusableView
641 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
644 return (View)GetValue(RightFocusableViewProperty);
648 SetValue(RightFocusableViewProperty, value);
649 NotifyPropertyChanged();
654 /// The up focusable view.<br />
655 /// This will return null if not set.<br />
656 /// This will also return null if the specified up focusable view is not on a window.<br />
658 /// <since_tizen> 3 </since_tizen>
659 public View UpFocusableView
661 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
664 return (View)GetValue(UpFocusableViewProperty);
668 SetValue(UpFocusableViewProperty, value);
669 NotifyPropertyChanged();
674 /// The down focusable view.<br />
675 /// This will return null if not set.<br />
676 /// This will also return null if the specified down focusable view is not on a window.<br />
678 /// <since_tizen> 3 </since_tizen>
679 public View DownFocusableView
681 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
684 return (View)GetValue(DownFocusableViewProperty);
688 SetValue(DownFocusableViewProperty, value);
689 NotifyPropertyChanged();
694 /// Whether the view should be focusable by keyboard navigation.
696 /// <since_tizen> 3 </since_tizen>
697 public bool Focusable
701 SetValue(FocusableProperty, value);
702 NotifyPropertyChanged();
706 return (bool)GetValue(FocusableProperty);
711 /// Retrieves the position of the view.<br />
712 /// The coordinates are relative to the view's parent.<br />
714 /// <since_tizen> 3 </since_tizen>
715 public Position CurrentPosition
719 return GetCurrentPosition();
724 /// Sets the size of a view for the width and the height.<br />
725 /// Geometry can be scaled to fit within this area.<br />
726 /// This does not interfere with the view's scale factor.<br />
727 /// The views default depth is the minimum of width and height.<br />
730 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
731 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
733 /// <since_tizen> 3 </since_tizen>
738 Size2D temp = (Size2D)GetValue(Size2DProperty);
739 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
743 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
744 SetValue(Size2DProperty, value);
745 // Set Specification so when layouts measure this View it matches the value set here.
746 // All Views are currently Layouts.
747 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
748 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
749 _widthPolicy = value.Width;
750 _heightPolicy = value.Height;
751 _layout?.RequestLayout();
752 NotifyPropertyChanged();
757 /// Retrieves the size of the view.<br />
758 /// The coordinates are relative to the view's parent.<br />
760 /// <since_tizen> 3 </since_tizen>
761 public Size2D CurrentSize
765 return GetCurrentSize();
770 /// Retrieves and sets the view's opacity.<br />
772 /// <since_tizen> 3 </since_tizen>
777 return (float)GetValue(OpacityProperty);
781 SetValue(OpacityProperty, value);
782 NotifyPropertyChanged();
787 /// Sets the position of the view for X and Y.<br />
788 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
789 /// If the position inheritance is disabled, sets the world position.<br />
792 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
793 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
795 /// <since_tizen> 3 </since_tizen>
796 public Position2D Position2D
800 Position2D temp = (Position2D)GetValue(Position2DProperty);
801 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
805 SetValue(Position2DProperty, value);
806 NotifyPropertyChanged();
811 /// Retrieves the screen postion of the view.<br />
813 /// <since_tizen> 3 </since_tizen>
814 public Vector2 ScreenPosition
818 Vector2 temp = new Vector2(0.0f, 0.0f);
819 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
825 /// Determines whether the pivot point should be used to determine the position of the view.
826 /// This is true by default.
828 /// <remarks>If false, then the top-left of the view is used for the position.
829 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
831 /// <since_tizen> 3 </since_tizen>
832 public bool PositionUsesPivotPoint
836 return (bool)GetValue(PositionUsesPivotPointProperty);
840 SetValue(PositionUsesPivotPointProperty, value);
841 NotifyPropertyChanged();
846 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
848 /// <since_tizen> 3 </since_tizen>
849 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
851 "View view = new View(); " +
852 "view.PivotPoint = PivotPoint.Center; " +
853 "view.PositionUsesPivotPoint = true;" +
854 " Deprecated in API5: Will be removed in API8")]
855 [EditorBrowsable(EditorBrowsableState.Never)]
856 public bool PositionUsesAnchorPoint
861 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
866 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
867 NotifyPropertyChanged();
872 /// Queries whether the view is connected to the stage.<br />
873 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
875 /// <since_tizen> 3 </since_tizen>
876 public bool IsOnWindow
885 /// Gets the depth in the hierarchy for the view.
887 /// <since_tizen> 3 </since_tizen>
888 public int HierarchyDepth
892 return GetHierarchyDepth();
897 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
900 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
901 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
902 /// The values set by this property will likely change.
904 /// <since_tizen> 3 </since_tizen>
905 public int SiblingOrder
909 return (int)GetValue(SiblingOrderProperty);
913 SetValue(SiblingOrderProperty, value);
915 LayoutGroup layout = Layout as LayoutGroup;
916 layout?.ChangeLayoutSiblingOrder(value);
918 NotifyPropertyChanged();
923 /// Returns the natural size of the view.
926 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
928 /// <since_tizen> 5 </since_tizen>
929 public Vector3 NaturalSize
933 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
934 if (NDalicPINVOKE.SWIGPendingException.Pending)
935 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
941 /// Returns the natural size (Size2D) of the view.
944 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
946 /// <since_tizen> 4 </since_tizen>
947 public Size2D NaturalSize2D
951 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
952 if (NDalicPINVOKE.SWIGPendingException.Pending)
953 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
955 return new Size2D((int)temp.Width, (int)temp.Height);
960 /// Gets or sets the origin of a view within its parent's area.<br />
961 /// 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 />
962 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
963 /// A view's position is the distance between this origin and the view's anchor-point.<br />
965 /// <pre>The view has been initialized.</pre>
966 /// <since_tizen> 3 </since_tizen>
967 public Position ParentOrigin
971 Position tmp = (Position)GetValue(ParentOriginProperty);
972 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
976 SetValue(ParentOriginProperty, value);
977 NotifyPropertyChanged();
982 /// Gets or sets the anchor-point of a view.<br />
983 /// 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 />
984 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
985 /// A view position is the distance between its parent-origin and this anchor-point.<br />
986 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
987 /// <pre>The view has been initialized.</pre>
990 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
992 /// <since_tizen> 3 </since_tizen>
993 public Position PivotPoint
997 Position tmp = (Position)GetValue(PivotPointProperty);
998 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1002 SetValue(PivotPointProperty, value);
1003 NotifyPropertyChanged();
1008 /// Gets or sets the size width of the view.
1012 /// Animatable - This property can be animated using <c>Animation</c> class.
1015 /// <since_tizen> 3 </since_tizen>
1016 public float SizeWidth
1020 return (float)GetValue(SizeWidthProperty);
1024 SetValue(SizeWidthProperty, value);
1025 WidthSpecification = (int)Math.Ceiling(value);
1026 NotifyPropertyChanged();
1031 /// Gets or sets the size height of the view.
1035 /// Animatable - This property can be animated using <c>Animation</c> class.
1038 /// <since_tizen> 3 </since_tizen>
1039 public float SizeHeight
1043 return (float)GetValue(SizeHeightProperty);
1047 SetValue(SizeHeightProperty, value);
1048 HeightSpecification = (int)Math.Ceiling(value);
1049 NotifyPropertyChanged();
1054 /// Gets or sets the position of the view.<br />
1055 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1056 /// If the position inheritance is disabled, sets the world position.<br />
1060 /// Animatable - This property can be animated using <c>Animation</c> class.
1062 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1064 /// <since_tizen> 3 </since_tizen>
1065 public Position Position
1069 Position tmp = (Position)GetValue(PositionProperty);
1070 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1074 SetValue(PositionProperty, value);
1075 NotifyPropertyChanged();
1080 /// Gets or sets the position X of the view.
1084 /// Animatable - This property can be animated using <c>Animation</c> class.
1087 /// <since_tizen> 3 </since_tizen>
1088 public float PositionX
1092 return (float)GetValue(PositionXProperty);
1096 SetValue(PositionXProperty, value);
1097 NotifyPropertyChanged();
1102 /// Gets or sets the position Y of the view.
1106 /// Animatable - This property can be animated using <c>Animation</c> class.
1109 /// <since_tizen> 3 </since_tizen>
1110 public float PositionY
1114 return (float)GetValue(PositionYProperty);
1118 SetValue(PositionYProperty, value);
1119 NotifyPropertyChanged();
1124 /// Gets or sets the position Z of the view.
1128 /// Animatable - This property can be animated using <c>Animation</c> class.
1131 /// <since_tizen> 3 </since_tizen>
1132 public float PositionZ
1136 return (float)GetValue(PositionZProperty);
1140 SetValue(PositionZProperty, value);
1141 NotifyPropertyChanged();
1146 /// Gets or sets the world position of the view.
1148 /// <since_tizen> 3 </since_tizen>
1149 public Vector3 WorldPosition
1153 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1154 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1160 /// Gets or sets the orientation of the view.<br />
1161 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1165 /// This is an asynchronous method.
1168 /// Animatable - This property can be animated using <c>Animation</c> class.
1171 /// <since_tizen> 3 </since_tizen>
1172 public Rotation Orientation
1176 return (Rotation)GetValue(OrientationProperty);
1180 SetValue(OrientationProperty, value);
1181 NotifyPropertyChanged();
1186 /// Gets or sets the world orientation of the view.<br />
1188 /// <since_tizen> 3 </since_tizen>
1189 public Rotation WorldOrientation
1193 Rotation temp = new Rotation();
1194 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1200 /// Gets or sets the scale factor applied to the view.<br />
1204 /// Animatable - This property can be animated using <c>Animation</c> class.
1206 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1208 /// <since_tizen> 3 </since_tizen>
1209 public Vector3 Scale
1213 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1214 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1218 SetValue(ScaleProperty, value);
1219 NotifyPropertyChanged();
1224 /// Gets or sets the scale X factor applied to the view.
1228 /// Animatable - This property can be animated using <c>Animation</c> class.
1231 /// <since_tizen> 3 </since_tizen>
1236 return (float)GetValue(ScaleXProperty);
1240 SetValue(ScaleXProperty, value);
1241 NotifyPropertyChanged();
1246 /// Gets or sets the scale Y factor applied to the view.
1250 /// Animatable - This property can be animated using <c>Animation</c> class.
1253 /// <since_tizen> 3 </since_tizen>
1258 return (float)GetValue(ScaleYProperty);
1262 SetValue(ScaleYProperty, value);
1263 NotifyPropertyChanged();
1268 /// Gets or sets the scale Z factor applied to the view.
1272 /// Animatable - This property can be animated using <c>Animation</c> class.
1275 /// <since_tizen> 3 </since_tizen>
1280 return (float)GetValue(ScaleZProperty);
1284 SetValue(ScaleZProperty, value);
1285 NotifyPropertyChanged();
1290 /// Gets the world scale of the view.
1292 /// <since_tizen> 3 </since_tizen>
1293 public Vector3 WorldScale
1297 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1298 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1304 /// Retrieves the visibility flag of the view.
1308 /// If the view is not visible, then the view and its children will not be rendered.
1309 /// 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.
1312 /// Animatable - This property can be animated using <c>Animation</c> class.
1315 /// <since_tizen> 3 </since_tizen>
1316 public bool Visibility
1321 GetProperty(View.Property.VISIBLE).Get(out temp);
1327 /// Gets the view's world color.
1329 /// <since_tizen> 3 </since_tizen>
1330 public Vector4 WorldColor
1334 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1335 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1341 /// Gets or sets the view's name.
1343 /// <since_tizen> 3 </since_tizen>
1348 return (string)GetValue(NameProperty);
1352 SetValue(NameProperty, value);
1353 NotifyPropertyChanged();
1358 /// Get the number of children held by the view.
1360 /// <since_tizen> 3 </since_tizen>
1361 public new uint ChildCount
1365 return GetChildCount();
1370 /// Gets the view's ID.
1373 /// <since_tizen> 3 </since_tizen>
1383 /// Gets or sets the status of whether the view should emit touch or hover signals.
1385 /// <since_tizen> 3 </since_tizen>
1386 public bool Sensitive
1390 return (bool)GetValue(SensitiveProperty);
1394 SetValue(SensitiveProperty, value);
1395 NotifyPropertyChanged();
1400 /// 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.
1402 /// <since_tizen> 3 </since_tizen>
1403 public bool LeaveRequired
1407 return (bool)GetValue(LeaveRequiredProperty);
1411 SetValue(LeaveRequiredProperty, value);
1412 NotifyPropertyChanged();
1417 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1419 /// <since_tizen> 3 </since_tizen>
1420 public bool InheritOrientation
1424 return (bool)GetValue(InheritOrientationProperty);
1428 SetValue(InheritOrientationProperty, value);
1429 NotifyPropertyChanged();
1434 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1436 /// <since_tizen> 3 </since_tizen>
1437 public bool InheritScale
1441 return (bool)GetValue(InheritScaleProperty);
1445 SetValue(InheritScaleProperty, value);
1446 NotifyPropertyChanged();
1451 /// Gets or sets the status of how the view and its children should be drawn.<br />
1452 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1453 /// 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 />
1454 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1455 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1456 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1458 /// <since_tizen> 3 </since_tizen>
1459 public DrawModeType DrawMode
1463 return (DrawModeType)GetValue(DrawModeProperty);
1467 SetValue(DrawModeProperty, value);
1468 NotifyPropertyChanged();
1473 /// Gets or sets the relative to parent size factor of the view.<br />
1474 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1475 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1478 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1480 /// <since_tizen> 3 </since_tizen>
1481 public Vector3 SizeModeFactor
1485 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1486 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1490 SetValue(SizeModeFactorProperty, value);
1491 NotifyPropertyChanged();
1496 /// Gets or sets the width resize policy to be used.
1498 /// <since_tizen> 3 </since_tizen>
1499 public ResizePolicyType WidthResizePolicy
1503 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1507 SetValue(WidthResizePolicyProperty, value);
1508 // Match ResizePolicy to new Layouting.
1509 // Parent relative policies can not be mapped at this point as parent size unknown.
1512 case ResizePolicyType.UseNaturalSize:
1514 WidthSpecification = LayoutParamPolicies.WrapContent;
1517 case ResizePolicyType.FillToParent:
1519 WidthSpecification = LayoutParamPolicies.MatchParent;
1522 case ResizePolicyType.FitToChildren:
1524 WidthSpecification = LayoutParamPolicies.WrapContent;
1530 NotifyPropertyChanged();
1535 /// Gets or sets the height resize policy to be used.
1537 /// <since_tizen> 3 </since_tizen>
1538 public ResizePolicyType HeightResizePolicy
1542 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1546 SetValue(HeightResizePolicyProperty, value);
1547 // Match ResizePolicy to new Layouting.
1548 // Parent relative policies can not be mapped at this point as parent size unknown.
1551 case ResizePolicyType.UseNaturalSize:
1553 HeightSpecification = LayoutParamPolicies.WrapContent;
1556 case ResizePolicyType.FillToParent:
1558 HeightSpecification = LayoutParamPolicies.MatchParent;
1561 case ResizePolicyType.FitToChildren:
1563 HeightSpecification = LayoutParamPolicies.WrapContent;
1569 NotifyPropertyChanged();
1574 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1575 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1577 /// <since_tizen> 3 </since_tizen>
1578 public SizeScalePolicyType SizeScalePolicy
1582 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1586 SetValue(SizeScalePolicyProperty, value);
1587 NotifyPropertyChanged();
1592 /// Gets or sets the status of whether the width size is dependent on the height size.
1594 /// <since_tizen> 3 </since_tizen>
1595 public bool WidthForHeight
1599 return (bool)GetValue(WidthForHeightProperty);
1603 SetValue(WidthForHeightProperty, value);
1604 NotifyPropertyChanged();
1609 /// Gets or sets the status of whether the height size is dependent on the width size.
1611 /// <since_tizen> 3 </since_tizen>
1612 public bool HeightForWidth
1616 return (bool)GetValue(HeightForWidthProperty);
1620 SetValue(HeightForWidthProperty, value);
1621 NotifyPropertyChanged();
1626 /// Gets or sets the padding for use in layout.
1629 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1631 /// <since_tizen> 5 </since_tizen>
1632 public Extents Padding
1636 // If View has a Layout then padding in stored in the base Layout class
1639 return Layout.Padding;
1643 Extents temp = (Extents)GetValue(PaddingProperty);
1644 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1646 // Two return points to prevent creating a zeroed Extent native object before assignment
1650 Extents padding = value;
1653 // Layout set so store Padding in LayoutItem instead of in View.
1654 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1655 // the position and sizes measure in the Layouting.
1656 Layout.Padding = value;
1657 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1658 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1659 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1661 padding = new Extents(0,0,0,0); // Reset value stored in View.
1663 _layout?.RequestLayout();
1665 SetValue(PaddingProperty, padding);
1666 NotifyPropertyChanged();
1667 _layout?.RequestLayout();
1672 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1675 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1677 /// <since_tizen> 3 </since_tizen>
1678 public Size2D MinimumSize
1682 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1683 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1687 if (_layout != null)
1689 // Note: it only works if minimum size is >= than natural size.
1690 // To force the size it should be done through the width&height spec or Size2D.
1691 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1692 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1693 _layout.RequestLayout();
1695 SetValue(MinimumSizeProperty, value);
1696 NotifyPropertyChanged();
1701 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1704 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1706 /// <since_tizen> 3 </since_tizen>
1707 public Size2D MaximumSize
1711 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1712 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1716 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1717 // MATCH_PARENT spec + parent container size can be used to limit
1718 if (_layout != null)
1720 // Note: it only works if minimum size is >= than natural size.
1721 // To force the size it should be done through the width&height spec or Size2D.
1722 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Width);
1723 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Height);
1724 _layout.RequestLayout();
1726 SetValue(MaximumSizeProperty, value);
1727 NotifyPropertyChanged();
1732 /// Gets or sets whether a child view inherits it's parent's position.<br />
1733 /// Default is to inherit.<br />
1734 /// 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 />
1736 /// <since_tizen> 3 </since_tizen>
1737 public bool InheritPosition
1741 return (bool)GetValue(InheritPositionProperty);
1745 SetValue(InheritPositionProperty, value);
1746 NotifyPropertyChanged();
1751 /// Gets or sets the clipping behavior (mode) of it's children.
1753 /// <since_tizen> 3 </since_tizen>
1754 public ClippingModeType ClippingMode
1758 return (ClippingModeType)GetValue(ClippingModeProperty);
1762 SetValue(ClippingModeProperty, value);
1763 NotifyPropertyChanged();
1768 /// Gets the number of renderers held by the view.
1770 /// <since_tizen> 3 </since_tizen>
1771 public uint RendererCount
1775 return GetRendererCount();
1780 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1783 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1785 /// <since_tizen> 3 </since_tizen>
1786 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1788 "View view = new View(); " +
1789 "view.PivotPoint = PivotPoint.Center; " +
1790 "view.PositionUsesPivotPoint = true;")]
1791 [EditorBrowsable(EditorBrowsableState.Never)]
1792 public Position AnchorPoint
1796 Position temp = new Position(0.0f, 0.0f, 0.0f);
1797 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1798 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1802 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1803 NotifyPropertyChanged();
1808 /// Sets the size of a view for the width, the height and the depth.<br />
1809 /// Geometry can be scaled to fit within this area.<br />
1810 /// This does not interfere with the view's scale factor.<br />
1811 /// The views default depth is the minimum of width and height.<br />
1815 /// Animatable - This property can be animated using <c>Animation</c> class.
1817 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1819 /// <since_tizen> 5 </since_tizen>
1824 Size tmp = (Size)GetValue(SizeProperty);
1825 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1829 SetValue(SizeProperty, value);
1830 // Set Specification so when layouts measure this View it matches the value set here.
1831 // All Views are currently Layouts.
1832 WidthSpecification = (int)Math.Ceiling(value.Width);
1833 HeightSpecification = (int)Math.Ceiling(value.Height);
1834 NotifyPropertyChanged();
1839 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1841 /// <since_tizen> 3 </since_tizen>
1842 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1844 "Container parent = view.GetParent(); " +
1845 "View view = parent as View;")]
1846 [EditorBrowsable(EditorBrowsableState.Never)]
1847 public new View Parent
1852 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1853 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1854 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1856 if (basehandle is Layer layer)
1858 ret = new View(Layer.getCPtr(layer).Handle, false);
1859 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1863 ret = basehandle as View;
1866 Interop.BaseHandle.delete_BaseHandle(CPtr);
1867 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1869 if (NDalicPINVOKE.SWIGPendingException.Pending)
1870 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1876 /// Gets/Sets whether inherit parent's the layout Direction.
1878 /// <since_tizen> 4 </since_tizen>
1879 public bool InheritLayoutDirection
1883 return (bool)GetValue(InheritLayoutDirectionProperty);
1887 SetValue(InheritLayoutDirectionProperty, value);
1888 NotifyPropertyChanged();
1893 /// Gets/Sets the layout Direction.
1895 /// <since_tizen> 4 </since_tizen>
1896 public ViewLayoutDirectionType LayoutDirection
1900 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1904 SetValue(LayoutDirectionProperty, value);
1905 NotifyPropertyChanged();
1906 _layout?.RequestLayout();
1911 /// Gets or sets the Margin for use in layout.
1914 /// Margin property is supported by Layout algorithms and containers.
1915 /// Please Set Layout if you want to use Margin property.
1916 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1918 /// <since_tizen> 4 </since_tizen>
1919 public Extents Margin
1923 // If View has a Layout then margin is stored in Layout.
1926 return Layout.Margin;
1930 // If Layout not set then return margin stored in View.
1931 Extents temp = (Extents)GetValue(MarginProperty);
1932 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1934 // Two return points to prevent creating a zeroed Extent native object before assignment
1940 // Layout set so store Margin in LayoutItem instead of View.
1941 // If View stores the Margin too then the Legacy Size Negotiation will
1942 // overwrite the position and size values measured in the Layouting.
1943 Layout.Margin = value;
1944 SetValue(MarginProperty, new Extents(0,0,0,0));
1945 _layout?.RequestLayout();
1949 SetValue(MarginProperty, value);
1951 NotifyPropertyChanged();
1952 _layout?.RequestLayout();
1957 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1959 /// <since_tizen> 6 </since_tizen>
1960 public int WidthSpecification
1964 return _widthPolicy;
1968 _widthPolicy = value;
1969 if( _oldWidthPolicy != _widthPolicy )
1971 if (_widthPolicy >= 0)
1973 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1975 if(_heightPolicy>=0) // Policy an exact value
1977 Size2D.Width = _widthPolicy;
1981 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1982 // Size2D height will store the specification value (negative number) this will then be applied to the
1983 // HeightSpecification when the Size2D callback is invoked.
1984 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1987 _layout?.RequestLayout();
1988 _oldWidthPolicy = _widthPolicy;
1994 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1996 /// <since_tizen> 6 </since_tizen>
1997 public int HeightSpecification
2001 return _heightPolicy;
2005 _heightPolicy = value;
2006 if( _oldHeightPolicy != _heightPolicy )
2008 if (_heightPolicy >= 0)
2010 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
2012 if(_widthPolicy>=0) // Policy an exact value
2014 Size2D.Height = _heightPolicy;
2018 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
2019 // Size2D height will store the specification value (negative number) this will then be applied to the
2020 // HeightSpecification when the Size2D callback is invoked.
2021 Size2D = new Size2D(_widthPolicy,_heightPolicy);
2025 _layout?.RequestLayout();
2026 _oldHeightPolicy = _heightPolicy;
2032 /// Gets the List of transitions for this View.
2034 /// <since_tizen> 6 </since_tizen>
2035 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2039 if (_layoutTransitions == null)
2041 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2043 return _layoutTransitions;
2048 /// Set a layout transitions for this View.
2051 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2053 /// <since_tizen> 6 </since_tizen>
2054 public LayoutTransition LayoutTransition
2058 if (_layoutTransitions == null)
2060 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2062 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2064 AttachTransitionsToChildren(value);
2069 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2072 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2074 /// <since_tizen> 4 </since_tizen>
2075 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2076 [EditorBrowsable(EditorBrowsableState.Never)]
2077 public Extents PaddingEX
2081 Extents temp = new Extents(0, 0, 0, 0);
2082 GetProperty(View.Property.PADDING).Get(temp);
2083 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2087 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2088 NotifyPropertyChanged();
2089 _layout?.RequestLayout();
2093 /// <since_tizen> 6 </since_tizen>
2094 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2095 [EditorBrowsable(EditorBrowsableState.Never)]
2096 public Style XamlStyle
2100 return (Style)GetValue(XamlStyleProperty);
2104 SetValue(XamlStyleProperty, value);
2109 /// The Color of View. This is an RGBA value.
2113 /// Animatable - This property can be animated using <c>Animation</c> class.
2115 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2117 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2118 [EditorBrowsable(EditorBrowsableState.Never)]
2123 Color temp = (Color)GetValue(ColorProperty);
2124 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2128 SetValue(ColorProperty, value);
2129 NotifyPropertyChanged();
2134 /// Set the layout on this View. Replaces any existing Layout.
2136 /// <since_tizen> 6 </since_tizen>
2137 public LayoutItem Layout
2145 // Do nothing if layout provided is already set on this View.
2146 if (value == _layout)
2151 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2152 layoutingDisabled = false;
2155 // If new layout being set already has a owner then that owner receives a replacement default layout.
2156 // First check if the layout to be set already has a owner.
2157 if (value?.Owner != null)
2159 // Previous owner of the layout gets a default layout as a replacement.
2160 value.Owner.Layout = new AbsoluteLayout();
2162 // Copy Margin and Padding to replacement LayoutGroup.
2163 value.Owner.Layout.Margin = value.Margin;
2164 value.Owner.Layout.Padding = value.Padding;
2167 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2168 // View if no replacement. Previously margin and padding values would have been moved from
2169 // the View to the layout.
2170 if (_layout != null ) // Existing layout
2174 // Existing layout being replaced so copy over margin and padding values.
2175 value.Margin = _layout.Margin;
2176 value.Padding = _layout.Padding;
2180 // Layout not being replaced so restore margin and padding to View.
2181 SetValue(MarginProperty, _layout.Margin);
2182 SetValue(PaddingProperty, _layout.Padding);
2183 NotifyPropertyChanged();
2188 // First Layout to be added to the View hence copy
2190 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2193 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2195 // If View already has a margin set then store it in Layout instead.
2196 value.Margin = Margin;
2197 SetValue(MarginProperty, new Extents(0,0,0,0));
2198 NotifyPropertyChanged();
2201 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2203 // If View already has a padding set then store it in Layout instead.
2204 value.Padding = Padding;
2205 SetValue(PaddingProperty, new Extents(0,0,0,0));
2206 NotifyPropertyChanged();
2211 // Remove existing layout from it's parent layout group.
2212 _layout?.Unparent();
2214 // Set layout to this view
2220 /// The weight of the View, used to share available space in a layout with siblings.
2222 /// <since_tizen> 6 </since_tizen>
2232 _layout?.RequestLayout();
2237 /// Whether to load the BackgroundImage synchronously.
2238 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2239 /// Note: For Normal Quad images only.
2241 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2242 [EditorBrowsable(EditorBrowsableState.Never)]
2243 public bool BackgroundImageSynchronosLoading
2247 return _backgroundImageSynchronosLoading;
2251 _backgroundImageSynchronosLoading = value;
2254 Background.Find(Visual.Property.Type)?.Get(out visualType);
2255 if (visualType == (int)Visual.Type.Image)
2257 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2260 if (bgUrl.Length != 0)
2262 PropertyMap bgMap = this.Background;
2263 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2269 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2270 [EditorBrowsable(EditorBrowsableState.Never)]
2271 public Vector2 UpdateSizeHint
2275 return (Vector2)GetValue(UpdateSizeHintProperty);
2279 SetValue(UpdateSizeHintProperty, value);
2280 NotifyPropertyChanged();
2284 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2285 [EditorBrowsable(EditorBrowsableState.Never)]
2286 public string[] TransitionNames
2290 return transitionNames;
2294 transitionNames = value;
2300 /// Get Style, it is abstract function and must be override.
2302 /// <since_tizen> 6 </since_tizen>
2303 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2304 [EditorBrowsable(EditorBrowsableState.Never)]
2305 protected virtual ViewStyle GetViewStyle()
2307 return new ViewStyle();
2311 /// Called after the View's ControlStates changed.
2313 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2314 /// <return>True if it needs to apply the state to children recursively.</return>
2315 [EditorBrowsable(EditorBrowsableState.Never)]
2316 protected virtual bool OnControlStateChanged(ControlStateChagedInfo controlStateChangedInfo)
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;
2367 internal static readonly BindableProperty ColorSelectorProperty = BindableProperty.Create("ColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2369 var view = (View)bindable;
2370 view.colorSelector.Clone((Selector<Color>)newValue);
2372 defaultValueCreator: (bindable) =>
2374 var view = (View)bindable;
2375 return view.colorSelector;
2378 private TriggerableSelector<Color> _colorSelector;
2379 private TriggerableSelector<Color> colorSelector
2383 if (null == _colorSelector)
2385 _colorSelector = new TriggerableSelector<Color>(this, ColorProperty);
2387 return _colorSelector;
2391 internal static readonly BindableProperty BackgroundImageBorderSelectorProperty = BindableProperty.Create("BackgroundImageBorderSelector", typeof(Selector<Rectangle>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2393 var view = (View)bindable;
2394 view.backgroundImageBorderSelector.Clone((Selector<Rectangle>)newValue);
2396 defaultValueCreator: (bindable) =>
2398 var view = (View)bindable;
2399 return view.backgroundImageBorderSelector;
2401 private TriggerableSelector<Rectangle> _backgroundImageBorderSelector;
2402 private TriggerableSelector<Rectangle> backgroundImageBorderSelector
2406 if (null == _backgroundImageBorderSelector)
2408 _backgroundImageBorderSelector = new TriggerableSelector<Rectangle>(this, BackgroundImageBorderProperty);
2410 return _backgroundImageBorderSelector;
2413 internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2415 var view = (View)bindable;
2416 view.opacitySelector.Clone((Selector<float?>)newValue);
2418 defaultValueCreator: (bindable) =>
2420 var view = (View)bindable;
2421 return view.opacitySelector;
2423 private TriggerableSelector<float?> _opacitySelector;
2424 private TriggerableSelector<float?> opacitySelector
2428 if (null == _opacitySelector)
2430 _opacitySelector = new TriggerableSelector<float?>(this, OpacityProperty);
2432 return _opacitySelector;
2436 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2437 [EditorBrowsable(EditorBrowsableState.Never)]
2438 public virtual void ApplyStyle(ViewStyle viewStyle)
2440 if (null == viewStyle)
2445 if (this.viewStyle == viewStyle)
2450 if (null != this.viewStyle)
2452 simpleBinding.Clear();
2455 this.viewStyle = viewStyle;
2457 Dictionary<string, BindableProperty> bindablePropertyOfView;
2458 Type viewType = GetType();
2460 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2461 Type styleType = viewStyle.GetType();
2463 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2464 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2466 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2468 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2470 BindableProperty viewProperty;
2471 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2473 if (null != viewProperty)
2475 object value = viewStyle.GetValue(keyValuePair.Value);
2479 SetValue(viewProperty, value);
2482 simpleBinding.Bind(viewStyle, keyValuePair.Value, this, viewProperty, BindingDirection.TwoWay);
2488 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2489 [EditorBrowsable(EditorBrowsableState.Never)]
2490 private BundledPipe simpleBinding = new BundledPipe();