2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.Binding;
22 using Tizen.NUI.Components;
24 namespace Tizen.NUI.BaseComponents
27 /// View is the base class for all views.
29 /// <since_tizen> 3 </since_tizen>
30 public partial class View : Container, IResourcesProvider
33 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
35 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
36 [EditorBrowsable(EditorBrowsableState.Never)]
37 public bool layoutSet = false;
40 /// Flag to allow Layouting to be disabled for Views.
41 /// Once a View has a Layout set then any children added to Views from then on will receive
42 /// automatic Layouts.
44 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
45 [EditorBrowsable(EditorBrowsableState.Never)]
46 public static bool layoutingDisabled{get; set;} = true;
48 private LayoutItem _layout; // Exclusive layout assigned to this View.
50 // List of transitions paired with the condition that uses the transition.
51 private Dictionary<TransitionCondition, TransitionList> _layoutTransitions;
52 private int _widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
53 private int _heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
54 private int _oldWidthPolicy = LayoutParamPolicies.MatchParent; // // Store Layout width to compare against later
55 private int _oldHeightPolicy = LayoutParamPolicies.MatchParent; // Store Layout height to compare against later
56 private float _weight = 0.0f; // Weighting of child View in a Layout
57 private MeasureSpecification _measureSpecificationWidth; // Layout width and internal Mode
58 private MeasureSpecification _measureSpecificationHeight; // Layout height and internal Mode
59 private bool _backgroundImageSynchronosLoading = false;
60 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
61 private string[] transitionNames;
62 private bool controlStatePropagation = false;
64 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
65 internal BackgroundExtraData backgroundExtraData;
70 /// The Style instance binded with this View.
72 [EditorBrowsable(EditorBrowsableState.Never)]
73 protected ViewStyle viewStyle;
75 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
76 [EditorBrowsable(EditorBrowsableState.Never)]
77 public ViewStyle ViewStyle
81 if (null == viewStyle)
83 ApplyStyle(GetViewStyle());
91 /// Creates a new instance of a view.
93 /// <since_tizen> 3 </since_tizen>
94 public View() : this(Interop.View.View_New(), true)
96 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
100 [EditorBrowsable(EditorBrowsableState.Never)]
101 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true)
103 this.ViewStyle.CopyFrom(viewStyle);
107 /// Create a new instance of a View with setting the status of shown or hidden.
109 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
110 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
111 [EditorBrowsable(EditorBrowsableState.Never)]
112 public View(bool shown) : this(Interop.View.View_New(), true)
114 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
118 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
126 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
129 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
131 if (this.viewStyle == null)
133 ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
137 this.viewStyle.CopyFrom(viewStyle);
141 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
145 PositionUsesPivotPoint = false;
148 _onWindowSendEventCallback = SendViewAddedEventToWindow;
149 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
157 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
159 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168 /// The event that is triggered when the View's ControlState is changed.
170 [EditorBrowsable(EditorBrowsableState.Never)]
171 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
173 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
175 private ControlStates controlStates;
177 /// Get/Set the control state.
179 /// <since_tizen> 6 </since_tizen>
180 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
181 [EditorBrowsable(EditorBrowsableState.Never)]
182 public ControlStates ControlState
186 return controlStates;
190 if (controlStates == value)
195 var prevState = controlStates;
197 controlStates = value;
199 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
201 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
203 OnControlStateChanged(changeInfo);
205 if (controlStatePropagation)
207 foreach (View child in Children)
209 child.ControlState = value;
213 ControlStateChangedEvent?.Invoke(this, changeInfo);
217 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
218 [EditorBrowsable(EditorBrowsableState.Never)]
219 public bool IsResourcesCreated
223 return Application.Current.IsResourcesCreated;
227 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
228 [EditorBrowsable(EditorBrowsableState.Never)]
229 public ResourceDictionary XamlResources
233 return Application.Current.XamlResources;
237 Application.Current.XamlResources = value;
242 /// The StyleName, type string.
244 /// <since_tizen> 3 </since_tizen>
245 public string StyleName
249 return (string)GetValue(StyleNameProperty);
253 SetValue(StyleNameProperty, value);
254 NotifyPropertyChanged();
259 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
262 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
264 /// <since_tizen> 3 </since_tizen>
265 public Color BackgroundColor
269 Color temp = (Color)GetValue(BackgroundColorProperty);
270 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
274 SetValue(BackgroundColorProperty, value);
275 NotifyPropertyChanged();
280 /// The mutually exclusive with "backgroundColor" and "background" type Map.
282 /// <since_tizen> 3 </since_tizen>
283 public string BackgroundImage
287 return (string)GetValue(BackgroundImageProperty);
291 SetValue(BackgroundImageProperty, value);
292 NotifyPropertyChanged();
297 /// Get or set the border of background image.
299 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
300 [EditorBrowsable(EditorBrowsableState.Never)]
301 public Rectangle BackgroundImageBorder
305 return (Rectangle)GetValue(BackgroundImageBorderProperty);
309 SetValue(BackgroundImageBorderProperty, value);
310 NotifyPropertyChanged();
315 /// The background of view.
317 /// <since_tizen> 3 </since_tizen>
318 public Tizen.NUI.PropertyMap Background
322 return (PropertyMap)GetValue(BackgroundProperty);
326 SetValue(BackgroundProperty, value);
327 NotifyPropertyChanged();
332 /// Describes a shadow as an image for a View.
333 /// It is null by default.
336 /// Gettter returns copied instance of current shadow.
339 /// The mutually exclusive with "BoxShadow".
341 [EditorBrowsable(EditorBrowsableState.Never)]
342 public ImageShadow ImageShadow
346 return (ImageShadow)GetValue(ImageShadowProperty);
350 SetValue(ImageShadowProperty, value);
351 NotifyPropertyChanged();
356 /// Describes a box shaped shadow drawing for a View.
357 /// It is null by default.
360 /// Gettter returns copied instance of current shadow.
363 /// The mutually exclusive with "ImageShadow".
365 [EditorBrowsable(EditorBrowsableState.Never)]
366 public Shadow BoxShadow
370 return (Shadow)GetValue(BoxShadowProperty);
374 SetValue(BoxShadowProperty, value);
375 NotifyPropertyChanged();
380 /// The radius for the rounded corners of the View.
381 /// This will rounds background and shadow edges.
382 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
384 [EditorBrowsable(EditorBrowsableState.Never)]
385 public float CornerRadius
389 return (float)GetValue(CornerRadiusProperty);
393 SetValue(CornerRadiusProperty, value);
394 NotifyPropertyChanged();
399 /// The current state of the view.
401 /// <since_tizen> 3 </since_tizen>
406 return (States)GetValue(StateProperty);
410 SetValue(StateProperty, value);
411 NotifyPropertyChanged();
416 /// The current sub state of the view.
418 /// <since_tizen> 3 </since_tizen>
419 public States SubState
423 return (States)GetValue(SubStateProperty);
427 SetValue(SubStateProperty, value);
428 NotifyPropertyChanged();
433 /// Displays a tooltip
435 /// <since_tizen> 3 </since_tizen>
436 public Tizen.NUI.PropertyMap Tooltip
440 return (PropertyMap)GetValue(TooltipProperty);
444 SetValue(TooltipProperty, value);
445 NotifyPropertyChanged();
450 /// Displays a tooltip as a text.
452 /// <since_tizen> 3 </since_tizen>
453 public string TooltipText
457 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
458 NotifyPropertyChanged();
463 /// The Child property of FlexContainer.<br />
464 /// The proportion of the free space in the container, the flex item will receive.<br />
465 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
467 /// <since_tizen> 3 </since_tizen>
472 return (float)GetValue(FlexProperty);
476 SetValue(FlexProperty, value);
477 NotifyPropertyChanged();
482 /// The Child property of FlexContainer.<br />
483 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
485 /// <since_tizen> 3 </since_tizen>
490 return (int)GetValue(AlignSelfProperty);
494 SetValue(AlignSelfProperty, value);
495 NotifyPropertyChanged();
500 /// The Child property of FlexContainer.<br />
501 /// The space around the flex item.<br />
504 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
506 /// <since_tizen> 3 </since_tizen>
507 public Vector4 FlexMargin
511 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
512 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
516 SetValue(FlexMarginProperty, value);
517 NotifyPropertyChanged();
522 /// The top-left cell this child occupies, if not set, the first available cell is used.
525 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
527 /// <since_tizen> 3 </since_tizen>
528 public Vector2 CellIndex
532 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
533 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
537 SetValue(CellIndexProperty, value);
538 NotifyPropertyChanged();
543 /// The number of rows this child occupies, if not set, the default value is 1.
545 /// <since_tizen> 3 </since_tizen>
550 return (float)GetValue(RowSpanProperty);
554 SetValue(RowSpanProperty, value);
555 NotifyPropertyChanged();
560 /// The number of columns this child occupies, if not set, the default value is 1.
562 /// <since_tizen> 3 </since_tizen>
563 public float ColumnSpan
567 return (float)GetValue(ColumnSpanProperty);
571 SetValue(ColumnSpanProperty, value);
572 NotifyPropertyChanged();
577 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
579 /// <since_tizen> 3 </since_tizen>
580 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
584 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
588 SetValue(CellHorizontalAlignmentProperty, value);
589 NotifyPropertyChanged();
594 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
596 /// <since_tizen> 3 </since_tizen>
597 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
601 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
605 SetValue(CellVerticalAlignmentProperty, value);
606 NotifyPropertyChanged();
611 /// The left focusable view.<br />
612 /// This will return null if not set.<br />
613 /// This will also return null if the specified left focusable view is not on a window.<br />
615 /// <since_tizen> 3 </since_tizen>
616 public View LeftFocusableView
618 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
621 return (View)GetValue(LeftFocusableViewProperty);
625 SetValue(LeftFocusableViewProperty, value);
626 NotifyPropertyChanged();
631 /// The right focusable view.<br />
632 /// This will return null if not set.<br />
633 /// This will also return null if the specified right focusable view is not on a window.<br />
635 /// <since_tizen> 3 </since_tizen>
636 public View RightFocusableView
638 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
641 return (View)GetValue(RightFocusableViewProperty);
645 SetValue(RightFocusableViewProperty, value);
646 NotifyPropertyChanged();
651 /// The up focusable view.<br />
652 /// This will return null if not set.<br />
653 /// This will also return null if the specified up focusable view is not on a window.<br />
655 /// <since_tizen> 3 </since_tizen>
656 public View UpFocusableView
658 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
661 return (View)GetValue(UpFocusableViewProperty);
665 SetValue(UpFocusableViewProperty, value);
666 NotifyPropertyChanged();
671 /// The down focusable view.<br />
672 /// This will return null if not set.<br />
673 /// This will also return null if the specified down focusable view is not on a window.<br />
675 /// <since_tizen> 3 </since_tizen>
676 public View DownFocusableView
678 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
681 return (View)GetValue(DownFocusableViewProperty);
685 SetValue(DownFocusableViewProperty, value);
686 NotifyPropertyChanged();
691 /// Whether the view should be focusable by keyboard navigation.
693 /// <since_tizen> 3 </since_tizen>
694 public bool Focusable
698 SetValue(FocusableProperty, value);
699 NotifyPropertyChanged();
703 return (bool)GetValue(FocusableProperty);
708 /// Retrieves the position of the view.<br />
709 /// The coordinates are relative to the view's parent.<br />
711 /// <since_tizen> 3 </since_tizen>
712 public Position CurrentPosition
716 return GetCurrentPosition();
721 /// Sets the size of a view for the width and the height.<br />
722 /// Geometry can be scaled to fit within this area.<br />
723 /// This does not interfere with the view's scale factor.<br />
724 /// The views default depth is the minimum of width and height.<br />
727 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
728 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
730 /// <since_tizen> 3 </since_tizen>
735 Size2D temp = (Size2D)GetValue(Size2DProperty);
736 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
740 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
741 SetValue(Size2DProperty, value);
742 // Set Specification so when layouts measure this View it matches the value set here.
743 // All Views are currently Layouts.
744 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
745 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
746 _widthPolicy = value.Width;
747 _heightPolicy = value.Height;
748 _layout?.RequestLayout();
749 NotifyPropertyChanged();
754 /// Retrieves the size of the view.<br />
755 /// The coordinates are relative to the view's parent.<br />
757 /// <since_tizen> 3 </since_tizen>
758 public Size2D CurrentSize
762 return GetCurrentSize();
767 /// Retrieves and sets the view's opacity.<br />
769 /// <since_tizen> 3 </since_tizen>
774 return (float)GetValue(OpacityProperty);
778 SetValue(OpacityProperty, value);
779 NotifyPropertyChanged();
784 /// Sets the position of the view for X and Y.<br />
785 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
786 /// If the position inheritance is disabled, sets the world position.<br />
789 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
790 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
792 /// <since_tizen> 3 </since_tizen>
793 public Position2D Position2D
797 Position2D temp = (Position2D)GetValue(Position2DProperty);
798 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
802 SetValue(Position2DProperty, value);
803 NotifyPropertyChanged();
808 /// Retrieves the screen postion of the view.<br />
810 /// <since_tizen> 3 </since_tizen>
811 public Vector2 ScreenPosition
815 Vector2 temp = new Vector2(0.0f, 0.0f);
816 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
822 /// Determines whether the pivot point should be used to determine the position of the view.
823 /// This is true by default.
825 /// <remarks>If false, then the top-left of the view is used for the position.
826 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
828 /// <since_tizen> 3 </since_tizen>
829 public bool PositionUsesPivotPoint
833 return (bool)GetValue(PositionUsesPivotPointProperty);
837 SetValue(PositionUsesPivotPointProperty, value);
838 NotifyPropertyChanged();
843 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
845 /// <since_tizen> 3 </since_tizen>
846 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
848 "View view = new View(); " +
849 "view.PivotPoint = PivotPoint.Center; " +
850 "view.PositionUsesPivotPoint = true;" +
851 " Deprecated in API5: Will be removed in API8")]
852 [EditorBrowsable(EditorBrowsableState.Never)]
853 public bool PositionUsesAnchorPoint
858 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
863 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
864 NotifyPropertyChanged();
869 /// Queries whether the view is connected to the stage.<br />
870 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
872 /// <since_tizen> 3 </since_tizen>
873 public bool IsOnWindow
882 /// Gets the depth in the hierarchy for the view.
884 /// <since_tizen> 3 </since_tizen>
885 public int HierarchyDepth
889 return GetHierarchyDepth();
894 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
897 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
898 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
899 /// The values set by this property will likely change.
901 /// <since_tizen> 3 </since_tizen>
902 public int SiblingOrder
906 return (int)GetValue(SiblingOrderProperty);
910 SetValue(SiblingOrderProperty, value);
912 LayoutGroup layout = Layout as LayoutGroup;
913 layout?.ChangeLayoutSiblingOrder(value);
915 NotifyPropertyChanged();
920 /// Returns the natural size of the view.
923 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
925 /// <since_tizen> 5 </since_tizen>
926 public Vector3 NaturalSize
930 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
931 if (NDalicPINVOKE.SWIGPendingException.Pending)
932 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
938 /// Returns the natural size (Size2D) of the view.
941 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
943 /// <since_tizen> 4 </since_tizen>
944 public Size2D NaturalSize2D
948 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
949 if (NDalicPINVOKE.SWIGPendingException.Pending)
950 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
952 return new Size2D((int)temp.Width, (int)temp.Height);
957 /// Gets or sets the origin of a view within its parent's area.<br />
958 /// 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 />
959 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
960 /// A view's position is the distance between this origin and the view's anchor-point.<br />
962 /// <pre>The view has been initialized.</pre>
963 /// <since_tizen> 3 </since_tizen>
964 public Position ParentOrigin
968 Position tmp = (Position)GetValue(ParentOriginProperty);
969 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
973 SetValue(ParentOriginProperty, value);
974 NotifyPropertyChanged();
979 /// Gets or sets the anchor-point of a view.<br />
980 /// 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 />
981 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
982 /// A view position is the distance between its parent-origin and this anchor-point.<br />
983 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
984 /// <pre>The view has been initialized.</pre>
987 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
989 /// <since_tizen> 3 </since_tizen>
990 public Position PivotPoint
994 Position tmp = (Position)GetValue(PivotPointProperty);
995 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
999 SetValue(PivotPointProperty, value);
1000 NotifyPropertyChanged();
1005 /// Gets or sets the size width of the view.
1009 /// Animatable - This property can be animated using <c>Animation</c> class.
1012 /// <since_tizen> 3 </since_tizen>
1013 public float SizeWidth
1017 return (float)GetValue(SizeWidthProperty);
1021 SetValue(SizeWidthProperty, value);
1022 WidthSpecification = (int)Math.Ceiling(value);
1023 NotifyPropertyChanged();
1028 /// Gets or sets the size height of the view.
1032 /// Animatable - This property can be animated using <c>Animation</c> class.
1035 /// <since_tizen> 3 </since_tizen>
1036 public float SizeHeight
1040 return (float)GetValue(SizeHeightProperty);
1044 SetValue(SizeHeightProperty, value);
1045 HeightSpecification = (int)Math.Ceiling(value);
1046 NotifyPropertyChanged();
1051 /// Gets or sets the position of the view.<br />
1052 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1053 /// If the position inheritance is disabled, sets the world position.<br />
1057 /// Animatable - This property can be animated using <c>Animation</c> class.
1059 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1061 /// <since_tizen> 3 </since_tizen>
1062 public Position Position
1066 Position tmp = (Position)GetValue(PositionProperty);
1067 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1071 SetValue(PositionProperty, value);
1072 NotifyPropertyChanged();
1077 /// Gets or sets the position X of the view.
1081 /// Animatable - This property can be animated using <c>Animation</c> class.
1084 /// <since_tizen> 3 </since_tizen>
1085 public float PositionX
1089 return (float)GetValue(PositionXProperty);
1093 SetValue(PositionXProperty, value);
1094 NotifyPropertyChanged();
1099 /// Gets or sets the position Y of the view.
1103 /// Animatable - This property can be animated using <c>Animation</c> class.
1106 /// <since_tizen> 3 </since_tizen>
1107 public float PositionY
1111 return (float)GetValue(PositionYProperty);
1115 SetValue(PositionYProperty, value);
1116 NotifyPropertyChanged();
1121 /// Gets or sets the position Z of the view.
1125 /// Animatable - This property can be animated using <c>Animation</c> class.
1128 /// <since_tizen> 3 </since_tizen>
1129 public float PositionZ
1133 return (float)GetValue(PositionZProperty);
1137 SetValue(PositionZProperty, value);
1138 NotifyPropertyChanged();
1143 /// Gets or sets the world position of the view.
1145 /// <since_tizen> 3 </since_tizen>
1146 public Vector3 WorldPosition
1150 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1151 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1157 /// Gets or sets the orientation of the view.<br />
1158 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1162 /// This is an asynchronous method.
1165 /// Animatable - This property can be animated using <c>Animation</c> class.
1168 /// <since_tizen> 3 </since_tizen>
1169 public Rotation Orientation
1173 return (Rotation)GetValue(OrientationProperty);
1177 SetValue(OrientationProperty, value);
1178 NotifyPropertyChanged();
1183 /// Gets or sets the world orientation of the view.<br />
1185 /// <since_tizen> 3 </since_tizen>
1186 public Rotation WorldOrientation
1190 Rotation temp = new Rotation();
1191 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1197 /// Gets or sets the scale factor applied to the view.<br />
1201 /// Animatable - This property can be animated using <c>Animation</c> class.
1203 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1205 /// <since_tizen> 3 </since_tizen>
1206 public Vector3 Scale
1210 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1211 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1215 SetValue(ScaleProperty, value);
1216 NotifyPropertyChanged();
1221 /// Gets or sets the scale X factor applied to the view.
1225 /// Animatable - This property can be animated using <c>Animation</c> class.
1228 /// <since_tizen> 3 </since_tizen>
1233 return (float)GetValue(ScaleXProperty);
1237 SetValue(ScaleXProperty, value);
1238 NotifyPropertyChanged();
1243 /// Gets or sets the scale Y factor applied to the view.
1247 /// Animatable - This property can be animated using <c>Animation</c> class.
1250 /// <since_tizen> 3 </since_tizen>
1255 return (float)GetValue(ScaleYProperty);
1259 SetValue(ScaleYProperty, value);
1260 NotifyPropertyChanged();
1265 /// Gets or sets the scale Z factor applied to the view.
1269 /// Animatable - This property can be animated using <c>Animation</c> class.
1272 /// <since_tizen> 3 </since_tizen>
1277 return (float)GetValue(ScaleZProperty);
1281 SetValue(ScaleZProperty, value);
1282 NotifyPropertyChanged();
1287 /// Gets the world scale of the view.
1289 /// <since_tizen> 3 </since_tizen>
1290 public Vector3 WorldScale
1294 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1295 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1301 /// Retrieves the visibility flag of the view.
1305 /// If the view is not visible, then the view and its children will not be rendered.
1306 /// 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.
1309 /// Animatable - This property can be animated using <c>Animation</c> class.
1312 /// <since_tizen> 3 </since_tizen>
1313 public bool Visibility
1318 GetProperty(View.Property.VISIBLE).Get(out temp);
1324 /// Gets the view's world color.
1326 /// <since_tizen> 3 </since_tizen>
1327 public Vector4 WorldColor
1331 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1332 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1338 /// Gets or sets the view's name.
1340 /// <since_tizen> 3 </since_tizen>
1345 return (string)GetValue(NameProperty);
1349 SetValue(NameProperty, value);
1350 NotifyPropertyChanged();
1355 /// Get the number of children held by the view.
1357 /// <since_tizen> 3 </since_tizen>
1358 public new uint ChildCount
1362 return GetChildCount();
1367 /// Gets the view's ID.
1370 /// <since_tizen> 3 </since_tizen>
1380 /// Gets or sets the status of whether the view should emit touch or hover signals.
1382 /// <since_tizen> 3 </since_tizen>
1383 public bool Sensitive
1387 return (bool)GetValue(SensitiveProperty);
1391 SetValue(SensitiveProperty, value);
1392 NotifyPropertyChanged();
1397 /// 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.
1399 /// <since_tizen> 3 </since_tizen>
1400 public bool LeaveRequired
1404 return (bool)GetValue(LeaveRequiredProperty);
1408 SetValue(LeaveRequiredProperty, value);
1409 NotifyPropertyChanged();
1414 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1416 /// <since_tizen> 3 </since_tizen>
1417 public bool InheritOrientation
1421 return (bool)GetValue(InheritOrientationProperty);
1425 SetValue(InheritOrientationProperty, value);
1426 NotifyPropertyChanged();
1431 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1433 /// <since_tizen> 3 </since_tizen>
1434 public bool InheritScale
1438 return (bool)GetValue(InheritScaleProperty);
1442 SetValue(InheritScaleProperty, value);
1443 NotifyPropertyChanged();
1448 /// Gets or sets the status of how the view and its children should be drawn.<br />
1449 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1450 /// 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 />
1451 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1452 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1453 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1455 /// <since_tizen> 3 </since_tizen>
1456 public DrawModeType DrawMode
1460 return (DrawModeType)GetValue(DrawModeProperty);
1464 SetValue(DrawModeProperty, value);
1465 NotifyPropertyChanged();
1470 /// Gets or sets the relative to parent size factor of the view.<br />
1471 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1472 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1475 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1477 /// <since_tizen> 3 </since_tizen>
1478 public Vector3 SizeModeFactor
1482 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1483 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1487 SetValue(SizeModeFactorProperty, value);
1488 NotifyPropertyChanged();
1493 /// Gets or sets the width resize policy to be used.
1495 /// <since_tizen> 3 </since_tizen>
1496 public ResizePolicyType WidthResizePolicy
1500 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1504 SetValue(WidthResizePolicyProperty, value);
1505 // Match ResizePolicy to new Layouting.
1506 // Parent relative policies can not be mapped at this point as parent size unknown.
1509 case ResizePolicyType.UseNaturalSize:
1511 WidthSpecification = LayoutParamPolicies.WrapContent;
1514 case ResizePolicyType.FillToParent:
1516 WidthSpecification = LayoutParamPolicies.MatchParent;
1519 case ResizePolicyType.FitToChildren:
1521 WidthSpecification = LayoutParamPolicies.WrapContent;
1527 NotifyPropertyChanged();
1532 /// Gets or sets the height resize policy to be used.
1534 /// <since_tizen> 3 </since_tizen>
1535 public ResizePolicyType HeightResizePolicy
1539 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1543 SetValue(HeightResizePolicyProperty, value);
1544 // Match ResizePolicy to new Layouting.
1545 // Parent relative policies can not be mapped at this point as parent size unknown.
1548 case ResizePolicyType.UseNaturalSize:
1550 HeightSpecification = LayoutParamPolicies.WrapContent;
1553 case ResizePolicyType.FillToParent:
1555 HeightSpecification = LayoutParamPolicies.MatchParent;
1558 case ResizePolicyType.FitToChildren:
1560 HeightSpecification = LayoutParamPolicies.WrapContent;
1566 NotifyPropertyChanged();
1571 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1572 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1574 /// <since_tizen> 3 </since_tizen>
1575 public SizeScalePolicyType SizeScalePolicy
1579 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1583 SetValue(SizeScalePolicyProperty, value);
1584 NotifyPropertyChanged();
1589 /// Gets or sets the status of whether the width size is dependent on the height size.
1591 /// <since_tizen> 3 </since_tizen>
1592 public bool WidthForHeight
1596 return (bool)GetValue(WidthForHeightProperty);
1600 SetValue(WidthForHeightProperty, value);
1601 NotifyPropertyChanged();
1606 /// Gets or sets the status of whether the height size is dependent on the width size.
1608 /// <since_tizen> 3 </since_tizen>
1609 public bool HeightForWidth
1613 return (bool)GetValue(HeightForWidthProperty);
1617 SetValue(HeightForWidthProperty, value);
1618 NotifyPropertyChanged();
1623 /// Gets or sets the padding for use in layout.
1626 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1628 /// <since_tizen> 5 </since_tizen>
1629 public Extents Padding
1633 // If View has a Layout then padding in stored in the base Layout class
1636 return Layout.Padding;
1640 Extents temp = (Extents)GetValue(PaddingProperty);
1641 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1643 // Two return points to prevent creating a zeroed Extent native object before assignment
1647 Extents padding = value;
1650 // Layout set so store Padding in LayoutItem instead of in View.
1651 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1652 // the position and sizes measure in the Layouting.
1653 Layout.Padding = value;
1654 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1655 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1656 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1658 padding = new Extents(0,0,0,0); // Reset value stored in View.
1660 _layout?.RequestLayout();
1662 SetValue(PaddingProperty, padding);
1663 NotifyPropertyChanged();
1664 _layout?.RequestLayout();
1669 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1672 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1674 /// <since_tizen> 3 </since_tizen>
1675 public Size2D MinimumSize
1679 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1680 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1684 if (_layout != null)
1686 // Note: it only works if minimum size is >= than natural size.
1687 // To force the size it should be done through the width&height spec or Size2D.
1688 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1689 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1690 _layout.RequestLayout();
1692 SetValue(MinimumSizeProperty, value);
1693 NotifyPropertyChanged();
1698 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1701 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1703 /// <since_tizen> 3 </since_tizen>
1704 public Size2D MaximumSize
1708 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1709 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1713 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1714 // MATCH_PARENT spec + parent container size can be used to limit
1715 if (_layout != null)
1717 // Note: it only works if minimum size is >= than natural size.
1718 // To force the size it should be done through the width&height spec or Size2D.
1719 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Width);
1720 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Height);
1721 _layout.RequestLayout();
1723 SetValue(MaximumSizeProperty, value);
1724 NotifyPropertyChanged();
1729 /// Gets or sets whether a child view inherits it's parent's position.<br />
1730 /// Default is to inherit.<br />
1731 /// 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 />
1733 /// <since_tizen> 3 </since_tizen>
1734 public bool InheritPosition
1738 return (bool)GetValue(InheritPositionProperty);
1742 SetValue(InheritPositionProperty, value);
1743 NotifyPropertyChanged();
1748 /// Gets or sets the clipping behavior (mode) of it's children.
1750 /// <since_tizen> 3 </since_tizen>
1751 public ClippingModeType ClippingMode
1755 return (ClippingModeType)GetValue(ClippingModeProperty);
1759 SetValue(ClippingModeProperty, value);
1760 NotifyPropertyChanged();
1765 /// Gets the number of renderers held by the view.
1767 /// <since_tizen> 3 </since_tizen>
1768 public uint RendererCount
1772 return GetRendererCount();
1777 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1780 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1782 /// <since_tizen> 3 </since_tizen>
1783 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1785 "View view = new View(); " +
1786 "view.PivotPoint = PivotPoint.Center; " +
1787 "view.PositionUsesPivotPoint = true;")]
1788 [EditorBrowsable(EditorBrowsableState.Never)]
1789 public Position AnchorPoint
1793 Position temp = new Position(0.0f, 0.0f, 0.0f);
1794 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1795 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1799 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1800 NotifyPropertyChanged();
1805 /// Sets the size of a view for the width, the height and the depth.<br />
1806 /// Geometry can be scaled to fit within this area.<br />
1807 /// This does not interfere with the view's scale factor.<br />
1808 /// The views default depth is the minimum of width and height.<br />
1812 /// Animatable - This property can be animated using <c>Animation</c> class.
1814 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1816 /// <since_tizen> 5 </since_tizen>
1821 Size tmp = (Size)GetValue(SizeProperty);
1822 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1826 SetValue(SizeProperty, value);
1827 // Set Specification so when layouts measure this View it matches the value set here.
1828 // All Views are currently Layouts.
1829 WidthSpecification = (int)Math.Ceiling(value.Width);
1830 HeightSpecification = (int)Math.Ceiling(value.Height);
1831 NotifyPropertyChanged();
1836 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1838 /// <since_tizen> 3 </since_tizen>
1839 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1841 "Container parent = view.GetParent(); " +
1842 "View view = parent as View;")]
1843 [EditorBrowsable(EditorBrowsableState.Never)]
1844 public new View Parent
1849 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1850 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1851 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1853 if (basehandle is Layer layer)
1855 ret = new View(Layer.getCPtr(layer).Handle, false);
1856 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1860 ret = basehandle as View;
1863 Interop.BaseHandle.delete_BaseHandle(CPtr);
1864 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1866 if (NDalicPINVOKE.SWIGPendingException.Pending)
1867 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1873 /// Gets/Sets whether inherit parent's the layout Direction.
1875 /// <since_tizen> 4 </since_tizen>
1876 public bool InheritLayoutDirection
1880 return (bool)GetValue(InheritLayoutDirectionProperty);
1884 SetValue(InheritLayoutDirectionProperty, value);
1885 NotifyPropertyChanged();
1890 /// Gets/Sets the layout Direction.
1892 /// <since_tizen> 4 </since_tizen>
1893 public ViewLayoutDirectionType LayoutDirection
1897 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1901 SetValue(LayoutDirectionProperty, value);
1902 NotifyPropertyChanged();
1903 _layout?.RequestLayout();
1908 /// Gets or sets the Margin for use in layout.
1911 /// Margin property is supported by Layout algorithms and containers.
1912 /// Please Set Layout if you want to use Margin property.
1913 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1915 /// <since_tizen> 4 </since_tizen>
1916 public Extents Margin
1920 // If View has a Layout then margin is stored in Layout.
1923 return Layout.Margin;
1927 // If Layout not set then return margin stored in View.
1928 Extents temp = (Extents)GetValue(MarginProperty);
1929 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1931 // Two return points to prevent creating a zeroed Extent native object before assignment
1937 // Layout set so store Margin in LayoutItem instead of View.
1938 // If View stores the Margin too then the Legacy Size Negotiation will
1939 // overwrite the position and size values measured in the Layouting.
1940 Layout.Margin = value;
1941 SetValue(MarginProperty, new Extents(0,0,0,0));
1942 _layout?.RequestLayout();
1946 SetValue(MarginProperty, value);
1948 NotifyPropertyChanged();
1949 _layout?.RequestLayout();
1954 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1956 /// <since_tizen> 6 </since_tizen>
1957 public int WidthSpecification
1961 return _widthPolicy;
1965 _widthPolicy = value;
1966 if( _oldWidthPolicy != _widthPolicy )
1968 if (_widthPolicy >= 0)
1970 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1972 if(_heightPolicy>=0) // Policy an exact value
1974 Size2D.Width = _widthPolicy;
1978 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1979 // Size2D height will store the specification value (negative number) this will then be applied to the
1980 // HeightSpecification when the Size2D callback is invoked.
1981 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1984 _layout?.RequestLayout();
1985 _oldWidthPolicy = _widthPolicy;
1991 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1993 /// <since_tizen> 6 </since_tizen>
1994 public int HeightSpecification
1998 return _heightPolicy;
2002 _heightPolicy = value;
2003 if( _oldHeightPolicy != _heightPolicy )
2005 if (_heightPolicy >= 0)
2007 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
2009 if(_widthPolicy>=0) // Policy an exact value
2011 Size2D.Height = _heightPolicy;
2015 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
2016 // Size2D height will store the specification value (negative number) this will then be applied to the
2017 // HeightSpecification when the Size2D callback is invoked.
2018 Size2D = new Size2D(_widthPolicy,_heightPolicy);
2022 _layout?.RequestLayout();
2023 _oldHeightPolicy = _heightPolicy;
2029 /// Gets the List of transitions for this View.
2031 /// <since_tizen> 6 </since_tizen>
2032 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2036 if (_layoutTransitions == null)
2038 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2040 return _layoutTransitions;
2045 /// Set a layout transitions for this View.
2048 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2050 /// <since_tizen> 6 </since_tizen>
2051 public LayoutTransition LayoutTransition
2055 if (_layoutTransitions == null)
2057 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2059 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2061 AttachTransitionsToChildren(value);
2066 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2069 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2071 /// <since_tizen> 4 </since_tizen>
2072 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2073 [EditorBrowsable(EditorBrowsableState.Never)]
2074 public Extents PaddingEX
2078 Extents temp = new Extents(0, 0, 0, 0);
2079 GetProperty(View.Property.PADDING).Get(temp);
2080 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2084 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2085 NotifyPropertyChanged();
2086 _layout?.RequestLayout();
2090 /// <since_tizen> 6 </since_tizen>
2091 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2092 [EditorBrowsable(EditorBrowsableState.Never)]
2093 public Style XamlStyle
2097 return (Style)GetValue(XamlStyleProperty);
2101 SetValue(XamlStyleProperty, value);
2106 /// The Color of View. This is an RGBA value.
2110 /// Animatable - This property can be animated using <c>Animation</c> class.
2112 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2114 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2115 [EditorBrowsable(EditorBrowsableState.Never)]
2120 Color temp = (Color)GetValue(ColorProperty);
2121 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2125 SetValue(ColorProperty, value);
2126 NotifyPropertyChanged();
2131 /// Set the layout on this View. Replaces any existing Layout.
2133 /// <since_tizen> 6 </since_tizen>
2134 public LayoutItem Layout
2142 // Do nothing if layout provided is already set on this View.
2143 if (value == _layout)
2148 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2149 layoutingDisabled = false;
2152 // If new layout being set already has a owner then that owner receives a replacement default layout.
2153 // First check if the layout to be set already has a owner.
2154 if (value?.Owner != null)
2156 // Previous owner of the layout gets a default layout as a replacement.
2157 value.Owner.Layout = new AbsoluteLayout();
2159 // Copy Margin and Padding to replacement LayoutGroup.
2160 value.Owner.Layout.Margin = value.Margin;
2161 value.Owner.Layout.Padding = value.Padding;
2164 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2165 // View if no replacement. Previously margin and padding values would have been moved from
2166 // the View to the layout.
2167 if (_layout != null ) // Existing layout
2171 // Existing layout being replaced so copy over margin and padding values.
2172 value.Margin = _layout.Margin;
2173 value.Padding = _layout.Padding;
2177 // Layout not being replaced so restore margin and padding to View.
2178 SetValue(MarginProperty, _layout.Margin);
2179 SetValue(PaddingProperty, _layout.Padding);
2180 NotifyPropertyChanged();
2185 // First Layout to be added to the View hence copy
2187 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2190 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2192 // If View already has a margin set then store it in Layout instead.
2193 value.Margin = Margin;
2194 SetValue(MarginProperty, new Extents(0,0,0,0));
2195 NotifyPropertyChanged();
2198 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2200 // If View already has a padding set then store it in Layout instead.
2201 value.Padding = Padding;
2202 SetValue(PaddingProperty, new Extents(0,0,0,0));
2203 NotifyPropertyChanged();
2208 // Remove existing layout from it's parent layout group.
2209 _layout?.Unparent();
2211 // Set layout to this view
2217 /// The weight of the View, used to share available space in a layout with siblings.
2219 /// <since_tizen> 6 </since_tizen>
2229 _layout?.RequestLayout();
2234 /// Whether to load the BackgroundImage synchronously.
2235 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2236 /// Note: For Normal Quad images only.
2238 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2239 [EditorBrowsable(EditorBrowsableState.Never)]
2240 public bool BackgroundImageSynchronosLoading
2244 return _backgroundImageSynchronosLoading;
2248 _backgroundImageSynchronosLoading = value;
2251 Background.Find(Visual.Property.Type)?.Get(out visualType);
2252 if (visualType == (int)Visual.Type.Image)
2254 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2257 if (bgUrl.Length != 0)
2259 PropertyMap bgMap = this.Background;
2260 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2266 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2267 [EditorBrowsable(EditorBrowsableState.Never)]
2268 public Vector2 UpdateSizeHint
2272 return (Vector2)GetValue(UpdateSizeHintProperty);
2276 SetValue(UpdateSizeHintProperty, value);
2277 NotifyPropertyChanged();
2281 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2282 [EditorBrowsable(EditorBrowsableState.Never)]
2283 public string[] TransitionNames
2287 return transitionNames;
2291 transitionNames = value;
2297 /// Enable/Disable ControlState propagation for children.
2298 /// It is false by default.
2299 /// If the View needs to share ControlState with descendants, please set it true.
2300 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2302 [EditorBrowsable(EditorBrowsableState.Never)]
2303 public bool EnableControlStatePropagation
2305 get => controlStatePropagation;
2308 controlStatePropagation = value;
2310 foreach (View child in Children)
2312 child.EnableControlStatePropagation = value;
2318 /// Get Style, it is abstract function and must be override.
2320 /// <since_tizen> 6 </since_tizen>
2321 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2322 [EditorBrowsable(EditorBrowsableState.Never)]
2323 protected virtual ViewStyle GetViewStyle()
2325 return new ViewStyle();
2329 /// Called after the View's ControlStates changed.
2331 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2332 [EditorBrowsable(EditorBrowsableState.Never)]
2333 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2337 internal static readonly BindableProperty BackgroundImageSelectorProperty = BindableProperty.Create("BackgroundImageSelector", typeof(Selector<string>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2339 var view = (View)bindable;
2340 view.backgroundImageSelector.Clone((Selector<string>)newValue);
2342 defaultValueCreator: (bindable) =>
2344 var view = (View)bindable;
2345 return view.backgroundImageSelector;
2347 private TriggerableSelector<string> _backgroundImageSelector;
2348 private TriggerableSelector<string> backgroundImageSelector
2352 if (null == _backgroundImageSelector)
2354 _backgroundImageSelector = new TriggerableSelector<string>(this, BackgroundImageProperty);
2356 return _backgroundImageSelector;
2359 internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2361 var view = (View)bindable;
2362 view.backgroundColorSelector.Clone((Selector<Color>)newValue);
2364 defaultValueCreator: (bindable) =>
2366 var view = (View)bindable;
2367 return view.backgroundColorSelector;
2369 private TriggerableSelector<Color> _backgroundColorSelector;
2370 private TriggerableSelector<Color> backgroundColorSelector
2374 if (null == _backgroundColorSelector)
2376 _backgroundColorSelector = new TriggerableSelector<Color>(this, BackgroundColorProperty);
2378 return _backgroundColorSelector;
2382 internal static readonly BindableProperty ColorSelectorProperty = BindableProperty.Create("ColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2384 var view = (View)bindable;
2385 view.colorSelector.Clone((Selector<Color>)newValue);
2387 defaultValueCreator: (bindable) =>
2389 var view = (View)bindable;
2390 return view.colorSelector;
2393 private TriggerableSelector<Color> _colorSelector;
2394 private TriggerableSelector<Color> colorSelector
2398 if (null == _colorSelector)
2400 _colorSelector = new TriggerableSelector<Color>(this, ColorProperty);
2402 return _colorSelector;
2406 internal static readonly BindableProperty BackgroundImageBorderSelectorProperty = BindableProperty.Create("BackgroundImageBorderSelector", typeof(Selector<Rectangle>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2408 var view = (View)bindable;
2409 view.backgroundImageBorderSelector.Clone((Selector<Rectangle>)newValue);
2411 defaultValueCreator: (bindable) =>
2413 var view = (View)bindable;
2414 return view.backgroundImageBorderSelector;
2416 private TriggerableSelector<Rectangle> _backgroundImageBorderSelector;
2417 private TriggerableSelector<Rectangle> backgroundImageBorderSelector
2421 if (null == _backgroundImageBorderSelector)
2423 _backgroundImageBorderSelector = new TriggerableSelector<Rectangle>(this, BackgroundImageBorderProperty);
2425 return _backgroundImageBorderSelector;
2428 internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2430 var view = (View)bindable;
2431 view.opacitySelector.Clone((Selector<float?>)newValue);
2433 defaultValueCreator: (bindable) =>
2435 var view = (View)bindable;
2436 return view.opacitySelector;
2438 private TriggerableSelector<float?> _opacitySelector;
2439 private TriggerableSelector<float?> opacitySelector
2443 if (null == _opacitySelector)
2445 _opacitySelector = new TriggerableSelector<float?>(this, OpacityProperty);
2447 return _opacitySelector;
2451 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2452 [EditorBrowsable(EditorBrowsableState.Never)]
2453 public virtual void ApplyStyle(ViewStyle viewStyle)
2455 if (null == viewStyle)
2460 if (this.viewStyle == viewStyle)
2465 if (null != this.viewStyle)
2467 simpleBinding.Clear();
2470 this.viewStyle = viewStyle;
2472 Dictionary<string, BindableProperty> bindablePropertyOfView;
2473 Type viewType = GetType();
2475 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2476 Type styleType = viewStyle.GetType();
2478 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2479 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2481 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2483 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2485 BindableProperty viewProperty;
2486 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2488 if (null != viewProperty)
2490 object value = viewStyle.GetValue(keyValuePair.Value);
2494 SetValue(viewProperty, value);
2497 simpleBinding.Bind(viewStyle, keyValuePair.Value, this, viewProperty, BindingDirection.TwoWay);
2503 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2504 [EditorBrowsable(EditorBrowsableState.Never)]
2505 private BundledPipe simpleBinding = new BundledPipe();