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;
63 private bool controlStatePropagation = false;
65 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
70 /// The Style instance binded with this View.
72 [EditorBrowsable(EditorBrowsableState.Never)]
73 protected ViewStyle viewStyle;
75 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
76 [EditorBrowsable(EditorBrowsableState.Never)]
77 public ViewStyle ViewStyle
81 if (null == viewStyle)
83 ApplyStyle(GetViewStyle());
91 /// Creates a new instance of a view.
93 /// <since_tizen> 3 </since_tizen>
94 public View() : this(Interop.View.View_New(), true)
96 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
100 [EditorBrowsable(EditorBrowsableState.Never)]
101 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true)
103 this.ViewStyle.CopyFrom(viewStyle);
107 /// Create a new instance of a View with setting the status of shown or hidden.
109 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
110 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
111 [EditorBrowsable(EditorBrowsableState.Never)]
112 public View(bool shown) : this(Interop.View.View_New(), true)
114 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
118 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
126 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
129 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
131 if (this.viewStyle == null)
133 ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
137 this.viewStyle.CopyFrom(viewStyle);
141 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
145 PositionUsesPivotPoint = false;
148 _onWindowSendEventCallback = SendViewAddedEventToWindow;
149 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
157 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
159 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168 /// The delegate for ControlState changed event.
170 [EditorBrowsable(EditorBrowsableState.Never)]
171 public delegate void ControlStateChangesDelegate(View obj, ControlStateChangedInfo controlStateChangedInfo);
174 /// The event that is triggered when the View's ControlState is changed.
176 [EditorBrowsable(EditorBrowsableState.Never)]
177 public event ControlStateChangesDelegate ControlStateChangeEvent;
179 internal event ControlStateChangesDelegate ControlStateChangeEventInternal;
181 private ControlStates controlStates;
183 /// Get/Set the control state.
185 /// <since_tizen> 6 </since_tizen>
186 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
187 [EditorBrowsable(EditorBrowsableState.Never)]
188 public ControlStates ControlState
192 return controlStates;
196 SetControlState(value, null);
201 /// Set ControlState with specified change environment
203 /// <param name="state">New state value</param>
204 /// <param name="touchInfo">The touch information in case the state has changed by touching.</param>
205 /// <return>True, if the state changed successfully.</return>
206 internal bool SetControlState(ControlStates state, Touch touchInfo)
208 if (controlStates == state)
213 var prevState = controlStates;
215 controlStates = state;
217 var changeInfo = new ControlStateChangedInfo(prevState, state, ControlStateChangedInfo.InputMethodType.Touch, touchInfo);
219 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
221 OnControlStateChanged(changeInfo);
223 if (controlStatePropagation)
225 foreach (View child in Children)
227 child.SetControlState(state, touchInfo);
231 ControlStateChangeEvent?.Invoke(this, changeInfo);
236 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
237 [EditorBrowsable(EditorBrowsableState.Never)]
238 public bool IsResourcesCreated
242 return Application.Current.IsResourcesCreated;
246 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
247 [EditorBrowsable(EditorBrowsableState.Never)]
248 public ResourceDictionary XamlResources
252 return Application.Current.XamlResources;
256 Application.Current.XamlResources = value;
261 /// The StyleName, type string.
263 /// <since_tizen> 3 </since_tizen>
264 public string StyleName
268 return (string)GetValue(StyleNameProperty);
272 SetValue(StyleNameProperty, value);
273 NotifyPropertyChanged();
278 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
281 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
283 /// <since_tizen> 3 </since_tizen>
284 public Color BackgroundColor
288 Color temp = (Color)GetValue(BackgroundColorProperty);
289 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
293 SetValue(BackgroundColorProperty, value);
294 NotifyPropertyChanged();
299 /// The mutually exclusive with "backgroundColor" and "background" type Map.
301 /// <since_tizen> 3 </since_tizen>
302 public string BackgroundImage
306 return (string)GetValue(BackgroundImageProperty);
310 SetValue(BackgroundImageProperty, value);
311 NotifyPropertyChanged();
316 /// Get or set the border of background image.
318 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
319 [EditorBrowsable(EditorBrowsableState.Never)]
320 public Rectangle BackgroundImageBorder
324 return (Rectangle)GetValue(BackgroundImageBorderProperty);
328 SetValue(BackgroundImageBorderProperty, value);
329 NotifyPropertyChanged();
334 /// The background of view.
336 /// <since_tizen> 3 </since_tizen>
337 public Tizen.NUI.PropertyMap Background
341 return (PropertyMap)GetValue(BackgroundProperty);
345 SetValue(BackgroundProperty, value);
346 NotifyPropertyChanged();
351 /// Describes a shadow as an image for a View.
352 /// It is null by default.
355 /// Gettter returns copied instance of current shadow.
358 /// The mutually exclusive with "BoxShadow".
360 [EditorBrowsable(EditorBrowsableState.Never)]
361 public ImageShadow ImageShadow
365 return (ImageShadow)GetValue(ImageShadowProperty);
369 SetValue(ImageShadowProperty, value);
370 NotifyPropertyChanged();
375 /// Describes a box shaped shadow drawing for a View.
376 /// It is null by default.
379 /// Gettter returns copied instance of current shadow.
382 /// The mutually exclusive with "ImageShadow".
384 [EditorBrowsable(EditorBrowsableState.Never)]
385 public Shadow BoxShadow
389 return (Shadow)GetValue(BoxShadowProperty);
393 SetValue(BoxShadowProperty, value);
394 NotifyPropertyChanged();
399 /// The radius for the rounded corners of the View.
400 /// This will rounds background and shadow edges.
401 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
403 [EditorBrowsable(EditorBrowsableState.Never)]
404 public float CornerRadius
408 return (float)GetValue(CornerRadiusProperty);
412 SetValue(CornerRadiusProperty, value);
413 NotifyPropertyChanged();
418 /// The current state of the view.
420 /// <since_tizen> 3 </since_tizen>
425 return (States)GetValue(StateProperty);
429 SetValue(StateProperty, value);
430 NotifyPropertyChanged();
435 /// The current sub state of the view.
437 /// <since_tizen> 3 </since_tizen>
438 public States SubState
442 return (States)GetValue(SubStateProperty);
446 SetValue(SubStateProperty, value);
447 NotifyPropertyChanged();
452 /// Displays a tooltip
454 /// <since_tizen> 3 </since_tizen>
455 public Tizen.NUI.PropertyMap Tooltip
459 return (PropertyMap)GetValue(TooltipProperty);
463 SetValue(TooltipProperty, value);
464 NotifyPropertyChanged();
469 /// Displays a tooltip as a text.
471 /// <since_tizen> 3 </since_tizen>
472 public string TooltipText
476 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
477 NotifyPropertyChanged();
482 /// The Child property of FlexContainer.<br />
483 /// The proportion of the free space in the container, the flex item will receive.<br />
484 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
486 /// <since_tizen> 3 </since_tizen>
491 return (float)GetValue(FlexProperty);
495 SetValue(FlexProperty, value);
496 NotifyPropertyChanged();
501 /// The Child property of FlexContainer.<br />
502 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
504 /// <since_tizen> 3 </since_tizen>
509 return (int)GetValue(AlignSelfProperty);
513 SetValue(AlignSelfProperty, value);
514 NotifyPropertyChanged();
519 /// The Child property of FlexContainer.<br />
520 /// The space around the flex item.<br />
523 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
525 /// <since_tizen> 3 </since_tizen>
526 public Vector4 FlexMargin
530 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
531 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
535 SetValue(FlexMarginProperty, value);
536 NotifyPropertyChanged();
541 /// The top-left cell this child occupies, if not set, the first available cell is used.
544 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
546 /// <since_tizen> 3 </since_tizen>
547 public Vector2 CellIndex
551 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
552 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
556 SetValue(CellIndexProperty, value);
557 NotifyPropertyChanged();
562 /// The number of rows this child occupies, if not set, the default value is 1.
564 /// <since_tizen> 3 </since_tizen>
569 return (float)GetValue(RowSpanProperty);
573 SetValue(RowSpanProperty, value);
574 NotifyPropertyChanged();
579 /// The number of columns this child occupies, if not set, the default value is 1.
581 /// <since_tizen> 3 </since_tizen>
582 public float ColumnSpan
586 return (float)GetValue(ColumnSpanProperty);
590 SetValue(ColumnSpanProperty, value);
591 NotifyPropertyChanged();
596 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
598 /// <since_tizen> 3 </since_tizen>
599 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
603 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
607 SetValue(CellHorizontalAlignmentProperty, value);
608 NotifyPropertyChanged();
613 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
615 /// <since_tizen> 3 </since_tizen>
616 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
620 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
624 SetValue(CellVerticalAlignmentProperty, value);
625 NotifyPropertyChanged();
630 /// The left focusable view.<br />
631 /// This will return null if not set.<br />
632 /// This will also return null if the specified left focusable view is not on a window.<br />
634 /// <since_tizen> 3 </since_tizen>
635 public View LeftFocusableView
637 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
640 return (View)GetValue(LeftFocusableViewProperty);
644 SetValue(LeftFocusableViewProperty, value);
645 NotifyPropertyChanged();
650 /// The right focusable view.<br />
651 /// This will return null if not set.<br />
652 /// This will also return null if the specified right focusable view is not on a window.<br />
654 /// <since_tizen> 3 </since_tizen>
655 public View RightFocusableView
657 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
660 return (View)GetValue(RightFocusableViewProperty);
664 SetValue(RightFocusableViewProperty, value);
665 NotifyPropertyChanged();
670 /// The up focusable view.<br />
671 /// This will return null if not set.<br />
672 /// This will also return null if the specified up focusable view is not on a window.<br />
674 /// <since_tizen> 3 </since_tizen>
675 public View UpFocusableView
677 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
680 return (View)GetValue(UpFocusableViewProperty);
684 SetValue(UpFocusableViewProperty, value);
685 NotifyPropertyChanged();
690 /// The down focusable view.<br />
691 /// This will return null if not set.<br />
692 /// This will also return null if the specified down focusable view is not on a window.<br />
694 /// <since_tizen> 3 </since_tizen>
695 public View DownFocusableView
697 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
700 return (View)GetValue(DownFocusableViewProperty);
704 SetValue(DownFocusableViewProperty, value);
705 NotifyPropertyChanged();
710 /// Whether the view should be focusable by keyboard navigation.
712 /// <since_tizen> 3 </since_tizen>
713 public bool Focusable
717 SetValue(FocusableProperty, value);
718 NotifyPropertyChanged();
722 return (bool)GetValue(FocusableProperty);
727 /// Retrieves the position of the view.<br />
728 /// The coordinates are relative to the view's parent.<br />
730 /// <since_tizen> 3 </since_tizen>
731 public Position CurrentPosition
735 return GetCurrentPosition();
740 /// Sets the size of a view for the width and the height.<br />
741 /// Geometry can be scaled to fit within this area.<br />
742 /// This does not interfere with the view's scale factor.<br />
743 /// The views default depth is the minimum of width and height.<br />
746 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
747 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
749 /// <since_tizen> 3 </since_tizen>
754 Size2D temp = (Size2D)GetValue(Size2DProperty);
755 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
759 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
760 SetValue(Size2DProperty, value);
761 // Set Specification so when layouts measure this View it matches the value set here.
762 // All Views are currently Layouts.
763 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
764 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
765 _widthPolicy = value.Width;
766 _heightPolicy = value.Height;
767 _layout?.RequestLayout();
768 NotifyPropertyChanged();
773 /// Retrieves the size of the view.<br />
774 /// The coordinates are relative to the view's parent.<br />
776 /// <since_tizen> 3 </since_tizen>
777 public Size2D CurrentSize
781 return GetCurrentSize();
786 /// Retrieves and sets the view's opacity.<br />
788 /// <since_tizen> 3 </since_tizen>
793 return (float)GetValue(OpacityProperty);
797 SetValue(OpacityProperty, value);
798 NotifyPropertyChanged();
803 /// Sets the position of the view for X and Y.<br />
804 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
805 /// If the position inheritance is disabled, sets the world position.<br />
808 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
809 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
811 /// <since_tizen> 3 </since_tizen>
812 public Position2D Position2D
816 Position2D temp = (Position2D)GetValue(Position2DProperty);
817 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
821 SetValue(Position2DProperty, value);
822 NotifyPropertyChanged();
827 /// Retrieves the screen postion of the view.<br />
829 /// <since_tizen> 3 </since_tizen>
830 public Vector2 ScreenPosition
834 Vector2 temp = new Vector2(0.0f, 0.0f);
835 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
841 /// Determines whether the pivot point should be used to determine the position of the view.
842 /// This is true by default.
844 /// <remarks>If false, then the top-left of the view is used for the position.
845 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
847 /// <since_tizen> 3 </since_tizen>
848 public bool PositionUsesPivotPoint
852 return (bool)GetValue(PositionUsesPivotPointProperty);
856 SetValue(PositionUsesPivotPointProperty, value);
857 NotifyPropertyChanged();
862 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
864 /// <since_tizen> 3 </since_tizen>
865 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
867 "View view = new View(); " +
868 "view.PivotPoint = PivotPoint.Center; " +
869 "view.PositionUsesPivotPoint = true;" +
870 " Deprecated in API5: Will be removed in API8")]
871 [EditorBrowsable(EditorBrowsableState.Never)]
872 public bool PositionUsesAnchorPoint
877 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
882 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
883 NotifyPropertyChanged();
888 /// Queries whether the view is connected to the stage.<br />
889 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
891 /// <since_tizen> 3 </since_tizen>
892 public bool IsOnWindow
901 /// Gets the depth in the hierarchy for the view.
903 /// <since_tizen> 3 </since_tizen>
904 public int HierarchyDepth
908 return GetHierarchyDepth();
913 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
916 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
917 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
918 /// The values set by this property will likely change.
920 /// <since_tizen> 3 </since_tizen>
921 public int SiblingOrder
925 return (int)GetValue(SiblingOrderProperty);
929 SetValue(SiblingOrderProperty, value);
931 LayoutGroup layout = Layout as LayoutGroup;
932 layout?.ChangeLayoutSiblingOrder(value);
934 NotifyPropertyChanged();
939 /// Returns the natural size of the view.
942 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
944 /// <since_tizen> 5 </since_tizen>
945 public Vector3 NaturalSize
949 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
950 if (NDalicPINVOKE.SWIGPendingException.Pending)
951 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
957 /// Returns the natural size (Size2D) of the view.
960 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
962 /// <since_tizen> 4 </since_tizen>
963 public Size2D NaturalSize2D
967 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
968 if (NDalicPINVOKE.SWIGPendingException.Pending)
969 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
971 return new Size2D((int)temp.Width, (int)temp.Height);
976 /// Gets or sets the origin of a view within its parent's area.<br />
977 /// 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 />
978 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
979 /// A view's position is the distance between this origin and the view's anchor-point.<br />
981 /// <pre>The view has been initialized.</pre>
982 /// <since_tizen> 3 </since_tizen>
983 public Position ParentOrigin
987 Position tmp = (Position)GetValue(ParentOriginProperty);
988 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
992 SetValue(ParentOriginProperty, value);
993 NotifyPropertyChanged();
998 /// Gets or sets the anchor-point of a view.<br />
999 /// 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 />
1000 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1001 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1002 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1003 /// <pre>The view has been initialized.</pre>
1006 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1008 /// <since_tizen> 3 </since_tizen>
1009 public Position PivotPoint
1013 Position tmp = (Position)GetValue(PivotPointProperty);
1014 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1018 SetValue(PivotPointProperty, value);
1019 NotifyPropertyChanged();
1024 /// Gets or sets the size width of the view.
1028 /// Animatable - This property can be animated using <c>Animation</c> class.
1031 /// <since_tizen> 3 </since_tizen>
1032 public float SizeWidth
1036 return (float)GetValue(SizeWidthProperty);
1040 SetValue(SizeWidthProperty, value);
1041 WidthSpecification = (int)Math.Ceiling(value);
1042 NotifyPropertyChanged();
1047 /// Gets or sets the size height of the view.
1051 /// Animatable - This property can be animated using <c>Animation</c> class.
1054 /// <since_tizen> 3 </since_tizen>
1055 public float SizeHeight
1059 return (float)GetValue(SizeHeightProperty);
1063 SetValue(SizeHeightProperty, value);
1064 HeightSpecification = (int)Math.Ceiling(value);
1065 NotifyPropertyChanged();
1070 /// Gets or sets the position of the view.<br />
1071 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1072 /// If the position inheritance is disabled, sets the world position.<br />
1076 /// Animatable - This property can be animated using <c>Animation</c> class.
1078 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1080 /// <since_tizen> 3 </since_tizen>
1081 public Position Position
1085 Position tmp = (Position)GetValue(PositionProperty);
1086 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1090 SetValue(PositionProperty, value);
1091 NotifyPropertyChanged();
1096 /// Gets or sets the position X of the view.
1100 /// Animatable - This property can be animated using <c>Animation</c> class.
1103 /// <since_tizen> 3 </since_tizen>
1104 public float PositionX
1108 return (float)GetValue(PositionXProperty);
1112 SetValue(PositionXProperty, value);
1113 NotifyPropertyChanged();
1118 /// Gets or sets the position Y of the view.
1122 /// Animatable - This property can be animated using <c>Animation</c> class.
1125 /// <since_tizen> 3 </since_tizen>
1126 public float PositionY
1130 return (float)GetValue(PositionYProperty);
1134 SetValue(PositionYProperty, value);
1135 NotifyPropertyChanged();
1140 /// Gets or sets the position Z of the view.
1144 /// Animatable - This property can be animated using <c>Animation</c> class.
1147 /// <since_tizen> 3 </since_tizen>
1148 public float PositionZ
1152 return (float)GetValue(PositionZProperty);
1156 SetValue(PositionZProperty, value);
1157 NotifyPropertyChanged();
1162 /// Gets or sets the world position of the view.
1164 /// <since_tizen> 3 </since_tizen>
1165 public Vector3 WorldPosition
1169 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1170 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1176 /// Gets or sets the orientation of the view.<br />
1177 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1181 /// This is an asynchronous method.
1184 /// Animatable - This property can be animated using <c>Animation</c> class.
1187 /// <since_tizen> 3 </since_tizen>
1188 public Rotation Orientation
1192 return (Rotation)GetValue(OrientationProperty);
1196 SetValue(OrientationProperty, value);
1197 NotifyPropertyChanged();
1202 /// Gets or sets the world orientation of the view.<br />
1204 /// <since_tizen> 3 </since_tizen>
1205 public Rotation WorldOrientation
1209 Rotation temp = new Rotation();
1210 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1216 /// Gets or sets the scale factor applied to the view.<br />
1220 /// Animatable - This property can be animated using <c>Animation</c> class.
1222 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1224 /// <since_tizen> 3 </since_tizen>
1225 public Vector3 Scale
1229 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1230 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1234 SetValue(ScaleProperty, value);
1235 NotifyPropertyChanged();
1240 /// Gets or sets the scale X factor applied to the view.
1244 /// Animatable - This property can be animated using <c>Animation</c> class.
1247 /// <since_tizen> 3 </since_tizen>
1252 return (float)GetValue(ScaleXProperty);
1256 SetValue(ScaleXProperty, value);
1257 NotifyPropertyChanged();
1262 /// Gets or sets the scale Y factor applied to the view.
1266 /// Animatable - This property can be animated using <c>Animation</c> class.
1269 /// <since_tizen> 3 </since_tizen>
1274 return (float)GetValue(ScaleYProperty);
1278 SetValue(ScaleYProperty, value);
1279 NotifyPropertyChanged();
1284 /// Gets or sets the scale Z factor applied to the view.
1288 /// Animatable - This property can be animated using <c>Animation</c> class.
1291 /// <since_tizen> 3 </since_tizen>
1296 return (float)GetValue(ScaleZProperty);
1300 SetValue(ScaleZProperty, value);
1301 NotifyPropertyChanged();
1306 /// Gets the world scale of the view.
1308 /// <since_tizen> 3 </since_tizen>
1309 public Vector3 WorldScale
1313 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1314 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1320 /// Retrieves the visibility flag of the view.
1324 /// If the view is not visible, then the view and its children will not be rendered.
1325 /// 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.
1328 /// Animatable - This property can be animated using <c>Animation</c> class.
1331 /// <since_tizen> 3 </since_tizen>
1332 public bool Visibility
1337 GetProperty(View.Property.VISIBLE).Get(out temp);
1343 /// Gets the view's world color.
1345 /// <since_tizen> 3 </since_tizen>
1346 public Vector4 WorldColor
1350 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1351 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1357 /// Gets or sets the view's name.
1359 /// <since_tizen> 3 </since_tizen>
1364 return (string)GetValue(NameProperty);
1368 SetValue(NameProperty, value);
1369 NotifyPropertyChanged();
1374 /// Get the number of children held by the view.
1376 /// <since_tizen> 3 </since_tizen>
1377 public new uint ChildCount
1381 return GetChildCount();
1386 /// Gets the view's ID.
1389 /// <since_tizen> 3 </since_tizen>
1399 /// Gets or sets the status of whether the view should emit touch or hover signals.
1401 /// <since_tizen> 3 </since_tizen>
1402 public bool Sensitive
1406 return (bool)GetValue(SensitiveProperty);
1410 SetValue(SensitiveProperty, value);
1411 NotifyPropertyChanged();
1416 /// 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.
1418 /// <since_tizen> 3 </since_tizen>
1419 public bool LeaveRequired
1423 return (bool)GetValue(LeaveRequiredProperty);
1427 SetValue(LeaveRequiredProperty, value);
1428 NotifyPropertyChanged();
1433 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1435 /// <since_tizen> 3 </since_tizen>
1436 public bool InheritOrientation
1440 return (bool)GetValue(InheritOrientationProperty);
1444 SetValue(InheritOrientationProperty, value);
1445 NotifyPropertyChanged();
1450 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1452 /// <since_tizen> 3 </since_tizen>
1453 public bool InheritScale
1457 return (bool)GetValue(InheritScaleProperty);
1461 SetValue(InheritScaleProperty, value);
1462 NotifyPropertyChanged();
1467 /// Gets or sets the status of how the view and its children should be drawn.<br />
1468 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1469 /// 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 />
1470 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1471 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1472 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1474 /// <since_tizen> 3 </since_tizen>
1475 public DrawModeType DrawMode
1479 return (DrawModeType)GetValue(DrawModeProperty);
1483 SetValue(DrawModeProperty, value);
1484 NotifyPropertyChanged();
1489 /// Gets or sets the relative to parent size factor of the view.<br />
1490 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1491 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1494 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1496 /// <since_tizen> 3 </since_tizen>
1497 public Vector3 SizeModeFactor
1501 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1502 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1506 SetValue(SizeModeFactorProperty, value);
1507 NotifyPropertyChanged();
1512 /// Gets or sets the width resize policy to be used.
1514 /// <since_tizen> 3 </since_tizen>
1515 public ResizePolicyType WidthResizePolicy
1519 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1523 SetValue(WidthResizePolicyProperty, value);
1524 // Match ResizePolicy to new Layouting.
1525 // Parent relative policies can not be mapped at this point as parent size unknown.
1528 case ResizePolicyType.UseNaturalSize:
1530 WidthSpecification = LayoutParamPolicies.WrapContent;
1533 case ResizePolicyType.FillToParent:
1535 WidthSpecification = LayoutParamPolicies.MatchParent;
1538 case ResizePolicyType.FitToChildren:
1540 WidthSpecification = LayoutParamPolicies.WrapContent;
1546 NotifyPropertyChanged();
1551 /// Gets or sets the height resize policy to be used.
1553 /// <since_tizen> 3 </since_tizen>
1554 public ResizePolicyType HeightResizePolicy
1558 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1562 SetValue(HeightResizePolicyProperty, value);
1563 // Match ResizePolicy to new Layouting.
1564 // Parent relative policies can not be mapped at this point as parent size unknown.
1567 case ResizePolicyType.UseNaturalSize:
1569 HeightSpecification = LayoutParamPolicies.WrapContent;
1572 case ResizePolicyType.FillToParent:
1574 HeightSpecification = LayoutParamPolicies.MatchParent;
1577 case ResizePolicyType.FitToChildren:
1579 HeightSpecification = LayoutParamPolicies.WrapContent;
1585 NotifyPropertyChanged();
1590 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1591 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1593 /// <since_tizen> 3 </since_tizen>
1594 public SizeScalePolicyType SizeScalePolicy
1598 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1602 SetValue(SizeScalePolicyProperty, value);
1603 NotifyPropertyChanged();
1608 /// Gets or sets the status of whether the width size is dependent on the height size.
1610 /// <since_tizen> 3 </since_tizen>
1611 public bool WidthForHeight
1615 return (bool)GetValue(WidthForHeightProperty);
1619 SetValue(WidthForHeightProperty, value);
1620 NotifyPropertyChanged();
1625 /// Gets or sets the status of whether the height size is dependent on the width size.
1627 /// <since_tizen> 3 </since_tizen>
1628 public bool HeightForWidth
1632 return (bool)GetValue(HeightForWidthProperty);
1636 SetValue(HeightForWidthProperty, value);
1637 NotifyPropertyChanged();
1642 /// Gets or sets the padding for use in layout.
1645 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1647 /// <since_tizen> 5 </since_tizen>
1648 public Extents Padding
1652 // If View has a Layout then padding in stored in the base Layout class
1655 return Layout.Padding;
1659 Extents temp = (Extents)GetValue(PaddingProperty);
1660 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1662 // Two return points to prevent creating a zeroed Extent native object before assignment
1666 Extents padding = value;
1669 // Layout set so store Padding in LayoutItem instead of in View.
1670 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1671 // the position and sizes measure in the Layouting.
1672 Layout.Padding = value;
1673 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1674 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1675 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1677 padding = new Extents(0,0,0,0); // Reset value stored in View.
1679 _layout?.RequestLayout();
1681 SetValue(PaddingProperty, padding);
1682 NotifyPropertyChanged();
1683 _layout?.RequestLayout();
1688 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1691 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1693 /// <since_tizen> 3 </since_tizen>
1694 public Size2D MinimumSize
1698 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1699 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1703 if (_layout != null)
1705 // Note: it only works if minimum size is >= than natural size.
1706 // To force the size it should be done through the width&height spec or Size2D.
1707 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1708 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1709 _layout.RequestLayout();
1711 SetValue(MinimumSizeProperty, value);
1712 NotifyPropertyChanged();
1717 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1720 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1722 /// <since_tizen> 3 </since_tizen>
1723 public Size2D MaximumSize
1727 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1728 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1732 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1733 // MATCH_PARENT spec + parent container size can be used to limit
1734 if (_layout != null)
1736 // Note: it only works if minimum size is >= than natural size.
1737 // To force the size it should be done through the width&height spec or Size2D.
1738 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Width);
1739 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Height);
1740 _layout.RequestLayout();
1742 SetValue(MaximumSizeProperty, value);
1743 NotifyPropertyChanged();
1748 /// Gets or sets whether a child view inherits it's parent's position.<br />
1749 /// Default is to inherit.<br />
1750 /// 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 />
1752 /// <since_tizen> 3 </since_tizen>
1753 public bool InheritPosition
1757 return (bool)GetValue(InheritPositionProperty);
1761 SetValue(InheritPositionProperty, value);
1762 NotifyPropertyChanged();
1767 /// Gets or sets the clipping behavior (mode) of it's children.
1769 /// <since_tizen> 3 </since_tizen>
1770 public ClippingModeType ClippingMode
1774 return (ClippingModeType)GetValue(ClippingModeProperty);
1778 SetValue(ClippingModeProperty, value);
1779 NotifyPropertyChanged();
1784 /// Gets the number of renderers held by the view.
1786 /// <since_tizen> 3 </since_tizen>
1787 public uint RendererCount
1791 return GetRendererCount();
1796 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1799 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1801 /// <since_tizen> 3 </since_tizen>
1802 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1804 "View view = new View(); " +
1805 "view.PivotPoint = PivotPoint.Center; " +
1806 "view.PositionUsesPivotPoint = true;")]
1807 [EditorBrowsable(EditorBrowsableState.Never)]
1808 public Position AnchorPoint
1812 Position temp = new Position(0.0f, 0.0f, 0.0f);
1813 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1814 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1818 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1819 NotifyPropertyChanged();
1824 /// Sets the size of a view for the width, the height and the depth.<br />
1825 /// Geometry can be scaled to fit within this area.<br />
1826 /// This does not interfere with the view's scale factor.<br />
1827 /// The views default depth is the minimum of width and height.<br />
1831 /// Animatable - This property can be animated using <c>Animation</c> class.
1833 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1835 /// <since_tizen> 5 </since_tizen>
1840 Size tmp = (Size)GetValue(SizeProperty);
1841 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1845 SetValue(SizeProperty, value);
1846 // Set Specification so when layouts measure this View it matches the value set here.
1847 // All Views are currently Layouts.
1848 WidthSpecification = (int)Math.Ceiling(value.Width);
1849 HeightSpecification = (int)Math.Ceiling(value.Height);
1850 NotifyPropertyChanged();
1855 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1857 /// <since_tizen> 3 </since_tizen>
1858 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1860 "Container parent = view.GetParent(); " +
1861 "View view = parent as View;")]
1862 [EditorBrowsable(EditorBrowsableState.Never)]
1863 public new View Parent
1868 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1869 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1870 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1872 if (basehandle is Layer layer)
1874 ret = new View(Layer.getCPtr(layer).Handle, false);
1875 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1879 ret = basehandle as View;
1882 Interop.BaseHandle.delete_BaseHandle(CPtr);
1883 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1885 if (NDalicPINVOKE.SWIGPendingException.Pending)
1886 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1892 /// Gets/Sets whether inherit parent's the layout Direction.
1894 /// <since_tizen> 4 </since_tizen>
1895 public bool InheritLayoutDirection
1899 return (bool)GetValue(InheritLayoutDirectionProperty);
1903 SetValue(InheritLayoutDirectionProperty, value);
1904 NotifyPropertyChanged();
1909 /// Gets/Sets the layout Direction.
1911 /// <since_tizen> 4 </since_tizen>
1912 public ViewLayoutDirectionType LayoutDirection
1916 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1920 SetValue(LayoutDirectionProperty, value);
1921 NotifyPropertyChanged();
1922 _layout?.RequestLayout();
1927 /// Gets or sets the Margin for use in layout.
1930 /// Margin property is supported by Layout algorithms and containers.
1931 /// Please Set Layout if you want to use Margin property.
1932 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1934 /// <since_tizen> 4 </since_tizen>
1935 public Extents Margin
1939 // If View has a Layout then margin is stored in Layout.
1942 return Layout.Margin;
1946 // If Layout not set then return margin stored in View.
1947 Extents temp = (Extents)GetValue(MarginProperty);
1948 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1950 // Two return points to prevent creating a zeroed Extent native object before assignment
1956 // Layout set so store Margin in LayoutItem instead of View.
1957 // If View stores the Margin too then the Legacy Size Negotiation will
1958 // overwrite the position and size values measured in the Layouting.
1959 Layout.Margin = value;
1960 SetValue(MarginProperty, new Extents(0,0,0,0));
1961 _layout?.RequestLayout();
1965 SetValue(MarginProperty, value);
1967 NotifyPropertyChanged();
1968 _layout?.RequestLayout();
1973 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1975 /// <since_tizen> 6 </since_tizen>
1976 public int WidthSpecification
1980 return _widthPolicy;
1984 _widthPolicy = value;
1985 if( _oldWidthPolicy != _widthPolicy )
1987 if (_widthPolicy >= 0)
1989 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1991 if(_heightPolicy>=0) // Policy an exact value
1993 Size2D.Width = _widthPolicy;
1997 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1998 // Size2D height will store the specification value (negative number) this will then be applied to the
1999 // HeightSpecification when the Size2D callback is invoked.
2000 Size2D = new Size2D(_widthPolicy,_heightPolicy);
2003 _layout?.RequestLayout();
2004 _oldWidthPolicy = _widthPolicy;
2010 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2012 /// <since_tizen> 6 </since_tizen>
2013 public int HeightSpecification
2017 return _heightPolicy;
2021 _heightPolicy = value;
2022 if( _oldHeightPolicy != _heightPolicy )
2024 if (_heightPolicy >= 0)
2026 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
2028 if(_widthPolicy>=0) // Policy an exact value
2030 Size2D.Height = _heightPolicy;
2034 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
2035 // Size2D height will store the specification value (negative number) this will then be applied to the
2036 // HeightSpecification when the Size2D callback is invoked.
2037 Size2D = new Size2D(_widthPolicy,_heightPolicy);
2041 _layout?.RequestLayout();
2042 _oldHeightPolicy = _heightPolicy;
2048 /// Gets the List of transitions for this View.
2050 /// <since_tizen> 6 </since_tizen>
2051 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2055 if (_layoutTransitions == null)
2057 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2059 return _layoutTransitions;
2064 /// Set a layout transitions for this View.
2067 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2069 /// <since_tizen> 6 </since_tizen>
2070 public LayoutTransition LayoutTransition
2074 if (_layoutTransitions == null)
2076 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2078 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2080 AttachTransitionsToChildren(value);
2085 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2088 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2090 /// <since_tizen> 4 </since_tizen>
2091 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2092 [EditorBrowsable(EditorBrowsableState.Never)]
2093 public Extents PaddingEX
2097 Extents temp = new Extents(0, 0, 0, 0);
2098 GetProperty(View.Property.PADDING).Get(temp);
2099 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2103 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2104 NotifyPropertyChanged();
2105 _layout?.RequestLayout();
2109 /// <since_tizen> 6 </since_tizen>
2110 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2111 [EditorBrowsable(EditorBrowsableState.Never)]
2112 public Style XamlStyle
2116 return (Style)GetValue(XamlStyleProperty);
2120 SetValue(XamlStyleProperty, value);
2125 /// The Color of View. This is an RGBA value.
2129 /// Animatable - This property can be animated using <c>Animation</c> class.
2131 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2133 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2134 [EditorBrowsable(EditorBrowsableState.Never)]
2139 Color temp = (Color)GetValue(ColorProperty);
2140 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2144 SetValue(ColorProperty, value);
2145 NotifyPropertyChanged();
2150 /// Set the layout on this View. Replaces any existing Layout.
2152 /// <since_tizen> 6 </since_tizen>
2153 public LayoutItem Layout
2161 // Do nothing if layout provided is already set on this View.
2162 if (value == _layout)
2167 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2168 layoutingDisabled = false;
2171 // If new layout being set already has a owner then that owner receives a replacement default layout.
2172 // First check if the layout to be set already has a owner.
2173 if (value?.Owner != null)
2175 // Previous owner of the layout gets a default layout as a replacement.
2176 value.Owner.Layout = new AbsoluteLayout();
2178 // Copy Margin and Padding to replacement LayoutGroup.
2179 value.Owner.Layout.Margin = value.Margin;
2180 value.Owner.Layout.Padding = value.Padding;
2183 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2184 // View if no replacement. Previously margin and padding values would have been moved from
2185 // the View to the layout.
2186 if (_layout != null ) // Existing layout
2190 // Existing layout being replaced so copy over margin and padding values.
2191 value.Margin = _layout.Margin;
2192 value.Padding = _layout.Padding;
2196 // Layout not being replaced so restore margin and padding to View.
2197 SetValue(MarginProperty, _layout.Margin);
2198 SetValue(PaddingProperty, _layout.Padding);
2199 NotifyPropertyChanged();
2204 // First Layout to be added to the View hence copy
2206 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2209 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2211 // If View already has a margin set then store it in Layout instead.
2212 value.Margin = Margin;
2213 SetValue(MarginProperty, new Extents(0,0,0,0));
2214 NotifyPropertyChanged();
2217 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2219 // If View already has a padding set then store it in Layout instead.
2220 value.Padding = Padding;
2221 SetValue(PaddingProperty, new Extents(0,0,0,0));
2222 NotifyPropertyChanged();
2227 // Remove existing layout from it's parent layout group.
2228 _layout?.Unparent();
2230 // Set layout to this view
2236 /// The weight of the View, used to share available space in a layout with siblings.
2238 /// <since_tizen> 6 </since_tizen>
2248 _layout?.RequestLayout();
2253 /// Whether to load the BackgroundImage synchronously.
2254 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2255 /// Note: For Normal Quad images only.
2257 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2258 [EditorBrowsable(EditorBrowsableState.Never)]
2259 public bool BackgroundImageSynchronosLoading
2263 return _backgroundImageSynchronosLoading;
2267 _backgroundImageSynchronosLoading = value;
2270 Background.Find(Visual.Property.Type)?.Get(out visualType);
2271 if (visualType == (int)Visual.Type.Image)
2273 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2276 if (bgUrl.Length != 0)
2278 PropertyMap bgMap = this.Background;
2279 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2285 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2286 [EditorBrowsable(EditorBrowsableState.Never)]
2287 public Vector2 UpdateSizeHint
2291 return (Vector2)GetValue(UpdateSizeHintProperty);
2295 SetValue(UpdateSizeHintProperty, value);
2296 NotifyPropertyChanged();
2300 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2301 [EditorBrowsable(EditorBrowsableState.Never)]
2302 public string[] TransitionNames
2306 return transitionNames;
2310 transitionNames = value;
2316 /// Enable/Disable ControlState propagation for children.
2317 /// It is false by default.
2318 /// If the View needs to share ControlState with descendants, please set it true.
2319 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2321 [EditorBrowsable(EditorBrowsableState.Never)]
2322 public bool EnableControlStatePropagation
2324 get => controlStatePropagation;
2327 controlStatePropagation = value;
2329 foreach (View child in Children)
2331 child.EnableControlStatePropagation = value;
2337 /// Get Style, it is abstract function and must be override.
2339 /// <since_tizen> 6 </since_tizen>
2340 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2341 [EditorBrowsable(EditorBrowsableState.Never)]
2342 protected virtual ViewStyle GetViewStyle()
2344 return new ViewStyle();
2348 /// Called after the View's ControlStates changed.
2350 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2351 [EditorBrowsable(EditorBrowsableState.Never)]
2352 protected virtual void OnControlStateChanged(ControlStateChangedInfo controlStateChangedInfo)
2356 internal static readonly BindableProperty BackgroundImageSelectorProperty = BindableProperty.Create("BackgroundImageSelector", typeof(Selector<string>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2358 var view = (View)bindable;
2359 view.backgroundImageSelector.Clone((Selector<string>)newValue);
2361 defaultValueCreator: (bindable) =>
2363 var view = (View)bindable;
2364 return view.backgroundImageSelector;
2366 private TriggerableSelector<string> _backgroundImageSelector;
2367 private TriggerableSelector<string> backgroundImageSelector
2371 if (null == _backgroundImageSelector)
2373 _backgroundImageSelector = new TriggerableSelector<string>(this, BackgroundImageProperty);
2375 return _backgroundImageSelector;
2378 internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2380 var view = (View)bindable;
2381 view.backgroundColorSelector.Clone((Selector<Color>)newValue);
2383 defaultValueCreator: (bindable) =>
2385 var view = (View)bindable;
2386 return view.backgroundColorSelector;
2388 private TriggerableSelector<Color> _backgroundColorSelector;
2389 private TriggerableSelector<Color> backgroundColorSelector
2393 if (null == _backgroundColorSelector)
2395 _backgroundColorSelector = new TriggerableSelector<Color>(this, BackgroundColorProperty);
2397 return _backgroundColorSelector;
2401 internal static readonly BindableProperty ColorSelectorProperty = BindableProperty.Create("ColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2403 var view = (View)bindable;
2404 view.colorSelector.Clone((Selector<Color>)newValue);
2406 defaultValueCreator: (bindable) =>
2408 var view = (View)bindable;
2409 return view.colorSelector;
2412 private TriggerableSelector<Color> _colorSelector;
2413 private TriggerableSelector<Color> colorSelector
2417 if (null == _colorSelector)
2419 _colorSelector = new TriggerableSelector<Color>(this, ColorProperty);
2421 return _colorSelector;
2425 internal static readonly BindableProperty BackgroundImageBorderSelectorProperty = BindableProperty.Create("BackgroundImageBorderSelector", typeof(Selector<Rectangle>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2427 var view = (View)bindable;
2428 view.backgroundImageBorderSelector.Clone((Selector<Rectangle>)newValue);
2430 defaultValueCreator: (bindable) =>
2432 var view = (View)bindable;
2433 return view.backgroundImageBorderSelector;
2435 private TriggerableSelector<Rectangle> _backgroundImageBorderSelector;
2436 private TriggerableSelector<Rectangle> backgroundImageBorderSelector
2440 if (null == _backgroundImageBorderSelector)
2442 _backgroundImageBorderSelector = new TriggerableSelector<Rectangle>(this, BackgroundImageBorderProperty);
2444 return _backgroundImageBorderSelector;
2447 internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2449 var view = (View)bindable;
2450 view.opacitySelector.Clone((Selector<float?>)newValue);
2452 defaultValueCreator: (bindable) =>
2454 var view = (View)bindable;
2455 return view.opacitySelector;
2457 private TriggerableSelector<float?> _opacitySelector;
2458 private TriggerableSelector<float?> opacitySelector
2462 if (null == _opacitySelector)
2464 _opacitySelector = new TriggerableSelector<float?>(this, OpacityProperty);
2466 return _opacitySelector;
2470 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2471 [EditorBrowsable(EditorBrowsableState.Never)]
2472 public virtual void ApplyStyle(ViewStyle viewStyle)
2474 if (null == viewStyle)
2479 if (this.viewStyle == viewStyle)
2484 if (null != this.viewStyle)
2486 simpleBinding.Clear();
2489 this.viewStyle = viewStyle;
2491 Dictionary<string, BindableProperty> bindablePropertyOfView;
2492 Type viewType = GetType();
2494 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2495 Type styleType = viewStyle.GetType();
2497 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2498 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2500 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2502 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2504 BindableProperty viewProperty;
2505 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2507 if (null != viewProperty)
2509 object value = viewStyle.GetValue(keyValuePair.Value);
2513 SetValue(viewProperty, value);
2516 simpleBinding.Bind(viewStyle, keyValuePair.Value, this, viewProperty, BindingDirection.TwoWay);
2522 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2523 [EditorBrowsable(EditorBrowsableState.Never)]
2524 private BundledPipe simpleBinding = new BundledPipe();