2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.Binding;
22 using Tizen.NUI.Components;
24 namespace Tizen.NUI.BaseComponents
27 /// View is the base class for all views.
29 /// <since_tizen> 3 </since_tizen>
30 public partial class View : Container, IResourcesProvider
33 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
35 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
36 [EditorBrowsable(EditorBrowsableState.Never)]
37 public bool layoutSet = false;
40 /// Flag to allow Layouting to be disabled for Views.
41 /// Once a View has a Layout set then any children added to Views from then on will receive
42 /// automatic Layouts.
44 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
45 [EditorBrowsable(EditorBrowsableState.Never)]
46 public static bool layoutingDisabled{get; set;} = true;
48 private LayoutItem _layout; // Exclusive layout assigned to this View.
50 // List of transitions paired with the condition that uses the transition.
51 private Dictionary<TransitionCondition, TransitionList> _layoutTransitions;
52 private int _widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
53 private int _heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
54 private int _oldWidthPolicy = LayoutParamPolicies.MatchParent; // // Store Layout width to compare against later
55 private int _oldHeightPolicy = LayoutParamPolicies.MatchParent; // Store Layout height to compare against later
56 private float _weight = 0.0f; // Weighting of child View in a Layout
57 private MeasureSpecification _measureSpecificationWidth; // Layout width and internal Mode
58 private MeasureSpecification _measureSpecificationHeight; // Layout height and internal Mode
59 private bool _backgroundImageSynchronosLoading = false;
60 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
61 private string[] transitionNames;
62 private Rectangle backgroundImageBorder;
64 private CloneableViewSelector<ImageShadow> imageShadow;
66 private CloneableViewSelector<Shadow> boxShadow;
68 private ViewSelector<float?> cornerRadius;
70 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
74 private ViewStyle viewStyle;
75 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
76 [EditorBrowsable(EditorBrowsableState.Never)]
77 public ViewStyle ViewStyle
81 if (null == viewStyle)
83 ApplyStyle(GetViewStyle());
91 /// Creates a new instance of a view.
93 /// <since_tizen> 3 </since_tizen>
94 public View() : this(Interop.View.View_New(), true)
96 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
100 [EditorBrowsable(EditorBrowsableState.Never)]
101 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true)
103 this.ViewStyle.CopyFrom(viewStyle);
107 /// Create a new instance of a View with setting the status of shown or hidden.
109 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
110 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
111 [EditorBrowsable(EditorBrowsableState.Never)]
112 public View(bool shown) : this(Interop.View.View_New(), true)
114 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
118 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
127 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
129 this.ViewStyle.CopyFrom(viewStyle);
132 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
136 PositionUsesPivotPoint = false;
139 _onWindowSendEventCallback = SendViewAddedEventToWindow;
140 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
148 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
150 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
158 internal delegate void ControlStateChangesDelegate(View obj, ControlStates state);
159 internal event ControlStateChangesDelegate ControlStateChangeEvent;
161 private ControlStates controlStates;
163 /// Get/Set the control state.
165 /// <since_tizen> 6 </since_tizen>
166 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
167 [EditorBrowsable(EditorBrowsableState.Never)]
168 public ControlStates ControlState
172 return controlStates;
176 if (controlStates != value)
178 controlStates = value;
180 ControlStateChangeEvent?.Invoke(this, value);
182 if (true == OnControlStateChanged(value))
184 foreach (View child in Children)
186 child.ControlState = value;
193 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
194 [EditorBrowsable(EditorBrowsableState.Never)]
195 public bool IsResourcesCreated
199 return Application.Current.IsResourcesCreated;
203 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
204 [EditorBrowsable(EditorBrowsableState.Never)]
205 public ResourceDictionary XamlResources
209 return Application.Current.XamlResources;
213 Application.Current.XamlResources = value;
218 /// The StyleName, type string.
220 /// <since_tizen> 3 </since_tizen>
221 public string StyleName
225 return (string)GetValue(StyleNameProperty);
229 SetValue(StyleNameProperty, value);
230 NotifyPropertyChanged();
235 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
238 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
240 /// <since_tizen> 3 </since_tizen>
241 public Color BackgroundColor
245 Color temp = (Color)GetValue(BackgroundColorProperty);
246 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
250 SetValue(BackgroundColorProperty, value);
251 NotifyPropertyChanged();
256 /// The mutually exclusive with "backgroundColor" and "background" type Map.
258 /// <since_tizen> 3 </since_tizen>
259 public string BackgroundImage
263 return (string)GetValue(BackgroundImageProperty);
267 SetValue(BackgroundImageProperty, value);
268 NotifyPropertyChanged();
273 /// Get or set the border of background image.
275 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
276 [EditorBrowsable(EditorBrowsableState.Never)]
277 public Rectangle BackgroundImageBorder
281 return (Rectangle)GetValue(BackgroundImageBorderProperty);
285 SetValue(BackgroundImageBorderProperty, value);
286 NotifyPropertyChanged();
291 /// The background of view.
293 /// <since_tizen> 3 </since_tizen>
294 public Tizen.NUI.PropertyMap Background
298 return (PropertyMap)GetValue(BackgroundProperty);
302 SetValue(BackgroundProperty, value);
303 NotifyPropertyChanged();
308 /// Describes a shadow as an image for a View.
309 /// It is null by default.
312 /// The mutually exclusive with "BoxShadow".
314 [EditorBrowsable(EditorBrowsableState.Never)]
315 public ImageShadow ImageShadow
319 var value = (ImageShadow)GetValue(ImageShadowProperty);
320 return value == null ? null : new ImageShadow(value, OnImageShadowChanged);
324 SetValue(ImageShadowProperty, value);
325 NotifyPropertyChanged();
330 /// Describes a box shaped shadow drawing for a View.
331 /// It is null by default.
334 /// The mutually exclusive with "ImageShadow".
336 [EditorBrowsable(EditorBrowsableState.Never)]
337 public Shadow BoxShadow
341 var value = (Shadow)GetValue(BoxShadowProperty);
342 return value == null ? null : new Shadow(value, OnBoxShadowChanged);
346 SetValue(BoxShadowProperty, value);
347 NotifyPropertyChanged();
352 /// The radius for the rounded corners of the View.
353 /// This will rounds background and shadow edges.
354 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
356 [EditorBrowsable(EditorBrowsableState.Never)]
357 public float CornerRadius
361 float? value = (float?)GetValue(CornerRadiusProperty);
366 SetValue(CornerRadiusProperty, value);
367 NotifyPropertyChanged();
372 /// The current state of the view.
374 /// <since_tizen> 3 </since_tizen>
379 return (States)GetValue(StateProperty);
383 SetValue(StateProperty, value);
384 NotifyPropertyChanged();
389 /// The current sub state of the view.
391 /// <since_tizen> 3 </since_tizen>
392 public States SubState
396 return (States)GetValue(SubStateProperty);
400 SetValue(SubStateProperty, value);
401 NotifyPropertyChanged();
406 /// Displays a tooltip
408 /// <since_tizen> 3 </since_tizen>
409 public Tizen.NUI.PropertyMap Tooltip
413 return (PropertyMap)GetValue(TooltipProperty);
417 SetValue(TooltipProperty, value);
418 NotifyPropertyChanged();
423 /// Displays a tooltip as a text.
425 /// <since_tizen> 3 </since_tizen>
426 public string TooltipText
430 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
431 NotifyPropertyChanged();
436 /// The Child property of FlexContainer.<br />
437 /// The proportion of the free space in the container, the flex item will receive.<br />
438 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
440 /// <since_tizen> 3 </since_tizen>
445 return (float)GetValue(FlexProperty);
449 SetValue(FlexProperty, value);
450 NotifyPropertyChanged();
455 /// The Child property of FlexContainer.<br />
456 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
458 /// <since_tizen> 3 </since_tizen>
463 return (int)GetValue(AlignSelfProperty);
467 SetValue(AlignSelfProperty, value);
468 NotifyPropertyChanged();
473 /// The Child property of FlexContainer.<br />
474 /// The space around the flex item.<br />
477 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
479 /// <since_tizen> 3 </since_tizen>
480 public Vector4 FlexMargin
484 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
485 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
489 SetValue(FlexMarginProperty, value);
490 NotifyPropertyChanged();
495 /// The top-left cell this child occupies, if not set, the first available cell is used.
498 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
500 /// <since_tizen> 3 </since_tizen>
501 public Vector2 CellIndex
505 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
506 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
510 SetValue(CellIndexProperty, value);
511 NotifyPropertyChanged();
516 /// The number of rows this child occupies, if not set, the default value is 1.
518 /// <since_tizen> 3 </since_tizen>
523 return (float)GetValue(RowSpanProperty);
527 SetValue(RowSpanProperty, value);
528 NotifyPropertyChanged();
533 /// The number of columns this child occupies, if not set, the default value is 1.
535 /// <since_tizen> 3 </since_tizen>
536 public float ColumnSpan
540 return (float)GetValue(ColumnSpanProperty);
544 SetValue(ColumnSpanProperty, value);
545 NotifyPropertyChanged();
550 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
552 /// <since_tizen> 3 </since_tizen>
553 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
557 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
561 SetValue(CellHorizontalAlignmentProperty, value);
562 NotifyPropertyChanged();
567 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
569 /// <since_tizen> 3 </since_tizen>
570 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
574 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
578 SetValue(CellVerticalAlignmentProperty, value);
579 NotifyPropertyChanged();
584 /// The left focusable view.<br />
585 /// This will return null if not set.<br />
586 /// This will also return null if the specified left focusable view is not on a window.<br />
588 /// <since_tizen> 3 </since_tizen>
589 public View LeftFocusableView
591 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
594 return (View)GetValue(LeftFocusableViewProperty);
598 SetValue(LeftFocusableViewProperty, value);
599 NotifyPropertyChanged();
604 /// The right focusable view.<br />
605 /// This will return null if not set.<br />
606 /// This will also return null if the specified right focusable view is not on a window.<br />
608 /// <since_tizen> 3 </since_tizen>
609 public View RightFocusableView
611 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
614 return (View)GetValue(RightFocusableViewProperty);
618 SetValue(RightFocusableViewProperty, value);
619 NotifyPropertyChanged();
624 /// The up focusable view.<br />
625 /// This will return null if not set.<br />
626 /// This will also return null if the specified up focusable view is not on a window.<br />
628 /// <since_tizen> 3 </since_tizen>
629 public View UpFocusableView
631 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
634 return (View)GetValue(UpFocusableViewProperty);
638 SetValue(UpFocusableViewProperty, value);
639 NotifyPropertyChanged();
644 /// The down focusable view.<br />
645 /// This will return null if not set.<br />
646 /// This will also return null if the specified down focusable view is not on a window.<br />
648 /// <since_tizen> 3 </since_tizen>
649 public View DownFocusableView
651 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
654 return (View)GetValue(DownFocusableViewProperty);
658 SetValue(DownFocusableViewProperty, value);
659 NotifyPropertyChanged();
664 /// Whether the view should be focusable by keyboard navigation.
666 /// <since_tizen> 3 </since_tizen>
667 public bool Focusable
671 SetValue(FocusableProperty, value);
672 NotifyPropertyChanged();
676 return (bool)GetValue(FocusableProperty);
681 /// Retrieves the position of the view.<br />
682 /// The coordinates are relative to the view's parent.<br />
684 /// <since_tizen> 3 </since_tizen>
685 public Position CurrentPosition
689 return GetCurrentPosition();
694 /// Sets the size of a view for the width and the height.<br />
695 /// Geometry can be scaled to fit within this area.<br />
696 /// This does not interfere with the view's scale factor.<br />
697 /// The views default depth is the minimum of width and height.<br />
700 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
701 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
703 /// <since_tizen> 3 </since_tizen>
708 Size2D temp = (Size2D)GetValue(Size2DProperty);
709 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
713 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
714 SetValue(Size2DProperty, value);
715 // Set Specification so when layouts measure this View it matches the value set here.
716 // All Views are currently Layouts.
717 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
718 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
719 _widthPolicy = value.Width;
720 _heightPolicy = value.Height;
721 _layout?.RequestLayout();
722 NotifyPropertyChanged();
727 /// Retrieves the size of the view.<br />
728 /// The coordinates are relative to the view's parent.<br />
730 /// <since_tizen> 3 </since_tizen>
731 public Size2D CurrentSize
735 return GetCurrentSize();
740 /// Retrieves and sets the view's opacity.<br />
742 /// <since_tizen> 3 </since_tizen>
747 return (float)GetValue(OpacityProperty);
751 SetValue(OpacityProperty, value);
752 NotifyPropertyChanged();
757 /// Sets the position of the view for X and Y.<br />
758 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
759 /// If the position inheritance is disabled, sets the world position.<br />
762 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
763 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
765 /// <since_tizen> 3 </since_tizen>
766 public Position2D Position2D
770 Position2D temp = (Position2D)GetValue(Position2DProperty);
771 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
775 SetValue(Position2DProperty, value);
776 NotifyPropertyChanged();
781 /// Retrieves the screen postion of the view.<br />
783 /// <since_tizen> 3 </since_tizen>
784 public Vector2 ScreenPosition
788 Vector2 temp = new Vector2(0.0f, 0.0f);
789 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
795 /// Determines whether the pivot point should be used to determine the position of the view.
796 /// This is true by default.
798 /// <remarks>If false, then the top-left of the view is used for the position.
799 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
801 /// <since_tizen> 3 </since_tizen>
802 public bool PositionUsesPivotPoint
806 return (bool)GetValue(PositionUsesPivotPointProperty);
810 SetValue(PositionUsesPivotPointProperty, value);
811 NotifyPropertyChanged();
816 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
818 /// <since_tizen> 3 </since_tizen>
819 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
821 "View view = new View(); " +
822 "view.PivotPoint = PivotPoint.Center; " +
823 "view.PositionUsesPivotPoint = true;" +
824 " Deprecated in API5: Will be removed in API8")]
825 [EditorBrowsable(EditorBrowsableState.Never)]
826 public bool PositionUsesAnchorPoint
831 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
836 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
837 NotifyPropertyChanged();
842 /// Queries whether the view is connected to the stage.<br />
843 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
845 /// <since_tizen> 3 </since_tizen>
846 public bool IsOnWindow
855 /// Gets the depth in the hierarchy for the view.
857 /// <since_tizen> 3 </since_tizen>
858 public int HierarchyDepth
862 return GetHierarchyDepth();
867 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
870 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
871 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
872 /// The values set by this property will likely change.
874 /// <since_tizen> 3 </since_tizen>
875 public int SiblingOrder
879 return (int)GetValue(SiblingOrderProperty);
883 SetValue(SiblingOrderProperty, value);
885 LayoutGroup layout = Layout as LayoutGroup;
886 layout?.ChangeLayoutSiblingOrder(value);
888 NotifyPropertyChanged();
893 /// Returns the natural size of the view.
896 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
898 /// <since_tizen> 5 </since_tizen>
899 public Vector3 NaturalSize
903 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
904 if (NDalicPINVOKE.SWIGPendingException.Pending)
905 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
911 /// Returns the natural size (Size2D) of the view.
914 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
916 /// <since_tizen> 4 </since_tizen>
917 public Size2D NaturalSize2D
921 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
922 if (NDalicPINVOKE.SWIGPendingException.Pending)
923 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
925 return new Size2D((int)temp.Width, (int)temp.Height);
930 /// Gets or sets the origin of a view within its parent's area.<br />
931 /// 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 />
932 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
933 /// A view's position is the distance between this origin and the view's anchor-point.<br />
935 /// <pre>The view has been initialized.</pre>
936 /// <since_tizen> 3 </since_tizen>
937 public Position ParentOrigin
941 Position tmp = (Position)GetValue(ParentOriginProperty);
942 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
946 SetValue(ParentOriginProperty, value);
947 NotifyPropertyChanged();
952 /// Gets or sets the anchor-point of a view.<br />
953 /// 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 />
954 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
955 /// A view position is the distance between its parent-origin and this anchor-point.<br />
956 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
957 /// <pre>The view has been initialized.</pre>
960 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
962 /// <since_tizen> 3 </since_tizen>
963 public Position PivotPoint
967 Position tmp = (Position)GetValue(PivotPointProperty);
968 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
972 SetValue(PivotPointProperty, value);
973 NotifyPropertyChanged();
978 /// Gets or sets the size width of the view.
982 /// Animatable - This property can be animated using <c>Animation</c> class.
985 /// <since_tizen> 3 </since_tizen>
986 public float SizeWidth
990 return (float)GetValue(SizeWidthProperty);
994 SetValue(SizeWidthProperty, value);
995 WidthSpecification = (int)Math.Ceiling(value);
996 NotifyPropertyChanged();
1001 /// Gets or sets the size height of the view.
1005 /// Animatable - This property can be animated using <c>Animation</c> class.
1008 /// <since_tizen> 3 </since_tizen>
1009 public float SizeHeight
1013 return (float)GetValue(SizeHeightProperty);
1017 SetValue(SizeHeightProperty, value);
1018 HeightSpecification = (int)Math.Ceiling(value);
1019 NotifyPropertyChanged();
1024 /// Gets or sets the position of the view.<br />
1025 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1026 /// If the position inheritance is disabled, sets the world position.<br />
1030 /// Animatable - This property can be animated using <c>Animation</c> class.
1032 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1034 /// <since_tizen> 3 </since_tizen>
1035 public Position Position
1039 Position tmp = (Position)GetValue(PositionProperty);
1040 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1044 SetValue(PositionProperty, value);
1045 NotifyPropertyChanged();
1050 /// Gets or sets the position X of the view.
1054 /// Animatable - This property can be animated using <c>Animation</c> class.
1057 /// <since_tizen> 3 </since_tizen>
1058 public float PositionX
1062 return (float)GetValue(PositionXProperty);
1066 SetValue(PositionXProperty, value);
1067 NotifyPropertyChanged();
1072 /// Gets or sets the position Y of the view.
1076 /// Animatable - This property can be animated using <c>Animation</c> class.
1079 /// <since_tizen> 3 </since_tizen>
1080 public float PositionY
1084 return (float)GetValue(PositionYProperty);
1088 SetValue(PositionYProperty, value);
1089 NotifyPropertyChanged();
1094 /// Gets or sets the position Z of the view.
1098 /// Animatable - This property can be animated using <c>Animation</c> class.
1101 /// <since_tizen> 3 </since_tizen>
1102 public float PositionZ
1106 return (float)GetValue(PositionZProperty);
1110 SetValue(PositionZProperty, value);
1111 NotifyPropertyChanged();
1116 /// Gets or sets the world position of the view.
1118 /// <since_tizen> 3 </since_tizen>
1119 public Vector3 WorldPosition
1123 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1124 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1130 /// Gets or sets the orientation of the view.<br />
1131 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1135 /// This is an asynchronous method.
1138 /// Animatable - This property can be animated using <c>Animation</c> class.
1141 /// <since_tizen> 3 </since_tizen>
1142 public Rotation Orientation
1146 return (Rotation)GetValue(OrientationProperty);
1150 SetValue(OrientationProperty, value);
1151 NotifyPropertyChanged();
1156 /// Gets or sets the world orientation of the view.<br />
1158 /// <since_tizen> 3 </since_tizen>
1159 public Rotation WorldOrientation
1163 Rotation temp = new Rotation();
1164 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1170 /// Gets or sets the scale factor applied to the view.<br />
1174 /// Animatable - This property can be animated using <c>Animation</c> class.
1176 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1178 /// <since_tizen> 3 </since_tizen>
1179 public Vector3 Scale
1183 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1184 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1188 SetValue(ScaleProperty, value);
1189 NotifyPropertyChanged();
1194 /// Gets or sets the scale X factor applied to the view.
1198 /// Animatable - This property can be animated using <c>Animation</c> class.
1201 /// <since_tizen> 3 </since_tizen>
1206 return (float)GetValue(ScaleXProperty);
1210 SetValue(ScaleXProperty, value);
1211 NotifyPropertyChanged();
1216 /// Gets or sets the scale Y factor applied to the view.
1220 /// Animatable - This property can be animated using <c>Animation</c> class.
1223 /// <since_tizen> 3 </since_tizen>
1228 return (float)GetValue(ScaleYProperty);
1232 SetValue(ScaleYProperty, value);
1233 NotifyPropertyChanged();
1238 /// Gets or sets the scale Z factor applied to the view.
1242 /// Animatable - This property can be animated using <c>Animation</c> class.
1245 /// <since_tizen> 3 </since_tizen>
1250 return (float)GetValue(ScaleZProperty);
1254 SetValue(ScaleZProperty, value);
1255 NotifyPropertyChanged();
1260 /// Gets the world scale of the view.
1262 /// <since_tizen> 3 </since_tizen>
1263 public Vector3 WorldScale
1267 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1268 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1274 /// Retrieves the visibility flag of the view.
1278 /// If the view is not visible, then the view and its children will not be rendered.
1279 /// 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.
1282 /// Animatable - This property can be animated using <c>Animation</c> class.
1285 /// <since_tizen> 3 </since_tizen>
1286 public bool Visibility
1291 GetProperty(View.Property.VISIBLE).Get(out temp);
1297 /// Gets the view's world color.
1299 /// <since_tizen> 3 </since_tizen>
1300 public Vector4 WorldColor
1304 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1305 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1311 /// Gets or sets the view's name.
1313 /// <since_tizen> 3 </since_tizen>
1318 return (string)GetValue(NameProperty);
1322 SetValue(NameProperty, value);
1323 NotifyPropertyChanged();
1328 /// Get the number of children held by the view.
1330 /// <since_tizen> 3 </since_tizen>
1331 public new uint ChildCount
1335 return GetChildCount();
1340 /// Gets the view's ID.
1343 /// <since_tizen> 3 </since_tizen>
1353 /// Gets or sets the status of whether the view should emit touch or hover signals.
1355 /// <since_tizen> 3 </since_tizen>
1356 public bool Sensitive
1360 return (bool)GetValue(SensitiveProperty);
1364 SetValue(SensitiveProperty, value);
1365 NotifyPropertyChanged();
1370 /// 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.
1372 /// <since_tizen> 3 </since_tizen>
1373 public bool LeaveRequired
1377 return (bool)GetValue(LeaveRequiredProperty);
1381 SetValue(LeaveRequiredProperty, value);
1382 NotifyPropertyChanged();
1387 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1389 /// <since_tizen> 3 </since_tizen>
1390 public bool InheritOrientation
1394 return (bool)GetValue(InheritOrientationProperty);
1398 SetValue(InheritOrientationProperty, value);
1399 NotifyPropertyChanged();
1404 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1406 /// <since_tizen> 3 </since_tizen>
1407 public bool InheritScale
1411 return (bool)GetValue(InheritScaleProperty);
1415 SetValue(InheritScaleProperty, value);
1416 NotifyPropertyChanged();
1421 /// Gets or sets the status of how the view and its children should be drawn.<br />
1422 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1423 /// 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 />
1424 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1425 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1426 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1428 /// <since_tizen> 3 </since_tizen>
1429 public DrawModeType DrawMode
1433 return (DrawModeType)GetValue(DrawModeProperty);
1437 SetValue(DrawModeProperty, value);
1438 NotifyPropertyChanged();
1443 /// Gets or sets the relative to parent size factor of the view.<br />
1444 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1445 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1448 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1450 /// <since_tizen> 3 </since_tizen>
1451 public Vector3 SizeModeFactor
1455 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1456 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1460 SetValue(SizeModeFactorProperty, value);
1461 NotifyPropertyChanged();
1466 /// Gets or sets the width resize policy to be used.
1468 /// <since_tizen> 3 </since_tizen>
1469 public ResizePolicyType WidthResizePolicy
1473 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1477 SetValue(WidthResizePolicyProperty, value);
1478 // Match ResizePolicy to new Layouting.
1479 // Parent relative policies can not be mapped at this point as parent size unknown.
1482 case ResizePolicyType.UseNaturalSize:
1484 WidthSpecification = LayoutParamPolicies.WrapContent;
1487 case ResizePolicyType.FillToParent:
1489 WidthSpecification = LayoutParamPolicies.MatchParent;
1492 case ResizePolicyType.FitToChildren:
1494 WidthSpecification = LayoutParamPolicies.WrapContent;
1500 NotifyPropertyChanged();
1505 /// Gets or sets the height resize policy to be used.
1507 /// <since_tizen> 3 </since_tizen>
1508 public ResizePolicyType HeightResizePolicy
1512 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1516 SetValue(HeightResizePolicyProperty, value);
1517 // Match ResizePolicy to new Layouting.
1518 // Parent relative policies can not be mapped at this point as parent size unknown.
1521 case ResizePolicyType.UseNaturalSize:
1523 HeightSpecification = LayoutParamPolicies.WrapContent;
1526 case ResizePolicyType.FillToParent:
1528 HeightSpecification = LayoutParamPolicies.MatchParent;
1531 case ResizePolicyType.FitToChildren:
1533 HeightSpecification = LayoutParamPolicies.WrapContent;
1539 NotifyPropertyChanged();
1544 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1545 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1547 /// <since_tizen> 3 </since_tizen>
1548 public SizeScalePolicyType SizeScalePolicy
1552 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1556 SetValue(SizeScalePolicyProperty, value);
1557 NotifyPropertyChanged();
1562 /// Gets or sets the status of whether the width size is dependent on the height size.
1564 /// <since_tizen> 3 </since_tizen>
1565 public bool WidthForHeight
1569 return (bool)GetValue(WidthForHeightProperty);
1573 SetValue(WidthForHeightProperty, value);
1574 NotifyPropertyChanged();
1579 /// Gets or sets the status of whether the height size is dependent on the width size.
1581 /// <since_tizen> 3 </since_tizen>
1582 public bool HeightForWidth
1586 return (bool)GetValue(HeightForWidthProperty);
1590 SetValue(HeightForWidthProperty, value);
1591 NotifyPropertyChanged();
1596 /// Gets or sets the padding for use in layout.
1599 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1601 /// <since_tizen> 5 </since_tizen>
1602 public Extents Padding
1606 // If View has a Layout then padding in stored in the base Layout class
1609 return Layout.Padding;
1613 Extents temp = (Extents)GetValue(PaddingProperty);
1614 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1616 // Two return points to prevent creating a zeroed Extent native object before assignment
1620 Extents padding = value;
1623 // Layout set so store Padding in LayoutItem instead of in View.
1624 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1625 // the position and sizes measure in the Layouting.
1626 Layout.Padding = value;
1627 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1628 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1629 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1631 padding = new Extents(0,0,0,0); // Reset value stored in View.
1633 _layout?.RequestLayout();
1635 SetValue(PaddingProperty, padding);
1636 NotifyPropertyChanged();
1637 _layout?.RequestLayout();
1642 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1645 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1647 /// <since_tizen> 3 </since_tizen>
1648 public Size2D MinimumSize
1652 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1653 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1657 if (_layout != null)
1659 // Note: it only works if minimum size is >= than natural size.
1660 // To force the size it should be done through the width&height spec or Size2D.
1661 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1662 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1663 _layout.RequestLayout();
1665 SetValue(MinimumSizeProperty, value);
1666 NotifyPropertyChanged();
1671 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1674 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1676 /// <since_tizen> 3 </since_tizen>
1677 public Size2D MaximumSize
1681 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1682 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1686 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1687 // MATCH_PARENT spec + parent container size can be used to limit
1688 if (_layout != null)
1690 // Note: it only works if minimum size is >= than natural size.
1691 // To force the size it should be done through the width&height spec or Size2D.
1692 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Width);
1693 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Height);
1694 _layout.RequestLayout();
1696 SetValue(MaximumSizeProperty, value);
1697 NotifyPropertyChanged();
1702 /// Gets or sets whether a child view inherits it's parent's position.<br />
1703 /// Default is to inherit.<br />
1704 /// 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 />
1706 /// <since_tizen> 3 </since_tizen>
1707 public bool InheritPosition
1711 return (bool)GetValue(InheritPositionProperty);
1715 SetValue(InheritPositionProperty, value);
1716 NotifyPropertyChanged();
1721 /// Gets or sets the clipping behavior (mode) of it's children.
1723 /// <since_tizen> 3 </since_tizen>
1724 public ClippingModeType ClippingMode
1728 return (ClippingModeType)GetValue(ClippingModeProperty);
1732 SetValue(ClippingModeProperty, value);
1733 NotifyPropertyChanged();
1738 /// Gets the number of renderers held by the view.
1740 /// <since_tizen> 3 </since_tizen>
1741 public uint RendererCount
1745 return GetRendererCount();
1750 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1753 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1755 /// <since_tizen> 3 </since_tizen>
1756 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1758 "View view = new View(); " +
1759 "view.PivotPoint = PivotPoint.Center; " +
1760 "view.PositionUsesPivotPoint = true;")]
1761 [EditorBrowsable(EditorBrowsableState.Never)]
1762 public Position AnchorPoint
1766 Position temp = new Position(0.0f, 0.0f, 0.0f);
1767 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1768 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1772 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1773 NotifyPropertyChanged();
1778 /// Sets the size of a view for the width, the height and the depth.<br />
1779 /// Geometry can be scaled to fit within this area.<br />
1780 /// This does not interfere with the view's scale factor.<br />
1781 /// The views default depth is the minimum of width and height.<br />
1785 /// Animatable - This property can be animated using <c>Animation</c> class.
1787 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1789 /// <since_tizen> 5 </since_tizen>
1794 Size tmp = (Size)GetValue(SizeProperty);
1795 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1799 SetValue(SizeProperty, value);
1800 // Set Specification so when layouts measure this View it matches the value set here.
1801 // All Views are currently Layouts.
1802 WidthSpecification = (int)Math.Ceiling(value.Width);
1803 HeightSpecification = (int)Math.Ceiling(value.Height);
1804 NotifyPropertyChanged();
1809 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1811 /// <since_tizen> 3 </since_tizen>
1812 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1814 "Container parent = view.GetParent(); " +
1815 "View view = parent as View;")]
1816 [EditorBrowsable(EditorBrowsableState.Never)]
1817 public new View Parent
1822 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1823 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1824 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1826 if (basehandle is Layer layer)
1828 ret = new View(Layer.getCPtr(layer).Handle, false);
1829 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1833 ret = basehandle as View;
1836 Interop.BaseHandle.delete_BaseHandle(CPtr);
1837 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1839 if (NDalicPINVOKE.SWIGPendingException.Pending)
1840 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1846 /// Gets/Sets whether inherit parent's the layout Direction.
1848 /// <since_tizen> 4 </since_tizen>
1849 public bool InheritLayoutDirection
1853 return (bool)GetValue(InheritLayoutDirectionProperty);
1857 SetValue(InheritLayoutDirectionProperty, value);
1858 NotifyPropertyChanged();
1863 /// Gets/Sets the layout Direction.
1865 /// <since_tizen> 4 </since_tizen>
1866 public ViewLayoutDirectionType LayoutDirection
1870 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1874 SetValue(LayoutDirectionProperty, value);
1875 NotifyPropertyChanged();
1876 _layout?.RequestLayout();
1881 /// Gets or sets the Margin for use in layout.
1884 /// Margin property is supported by Layout algorithms and containers.
1885 /// Please Set Layout if you want to use Margin property.
1886 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1888 /// <since_tizen> 4 </since_tizen>
1889 public Extents Margin
1893 // If View has a Layout then margin is stored in Layout.
1896 return Layout.Margin;
1900 // If Layout not set then return margin stored in View.
1901 Extents temp = (Extents)GetValue(MarginProperty);
1902 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1904 // Two return points to prevent creating a zeroed Extent native object before assignment
1910 // Layout set so store Margin in LayoutItem instead of View.
1911 // If View stores the Margin too then the Legacy Size Negotiation will
1912 // overwrite the position and size values measured in the Layouting.
1913 Layout.Margin = value;
1914 SetValue(MarginProperty, new Extents(0,0,0,0));
1915 _layout?.RequestLayout();
1919 SetValue(MarginProperty, value);
1921 NotifyPropertyChanged();
1922 _layout?.RequestLayout();
1927 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1929 /// <since_tizen> 6 </since_tizen>
1930 public int WidthSpecification
1934 return _widthPolicy;
1938 _widthPolicy = value;
1939 if( _oldWidthPolicy != _widthPolicy )
1941 if (_widthPolicy >= 0)
1943 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1945 if(_heightPolicy>=0) // Policy an exact value
1947 Size2D.Width = _widthPolicy;
1951 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1952 // Size2D height will store the specification value (negative number) this will then be applied to the
1953 // HeightSpecification when the Size2D callback is invoked.
1954 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1957 _layout?.RequestLayout();
1958 _oldWidthPolicy = _widthPolicy;
1964 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1966 /// <since_tizen> 6 </since_tizen>
1967 public int HeightSpecification
1971 return _heightPolicy;
1975 _heightPolicy = value;
1976 if( _oldHeightPolicy != _heightPolicy )
1978 if (_heightPolicy >= 0)
1980 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1982 if(_widthPolicy>=0) // Policy an exact value
1984 Size2D.Height = _heightPolicy;
1988 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1989 // Size2D height will store the specification value (negative number) this will then be applied to the
1990 // HeightSpecification when the Size2D callback is invoked.
1991 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1995 _layout?.RequestLayout();
1996 _oldHeightPolicy = _heightPolicy;
2002 /// Gets the List of transitions for this View.
2004 /// <since_tizen> 6 </since_tizen>
2005 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2009 if (_layoutTransitions == null)
2011 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2013 return _layoutTransitions;
2018 /// Set a layout transitions for this View.
2021 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2023 /// <since_tizen> 6 </since_tizen>
2024 public LayoutTransition LayoutTransition
2028 if (_layoutTransitions == null)
2030 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2032 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2034 AttachTransitionsToChildren(value);
2039 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2042 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2044 /// <since_tizen> 4 </since_tizen>
2045 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2046 [EditorBrowsable(EditorBrowsableState.Never)]
2047 public Extents PaddingEX
2051 Extents temp = new Extents(0, 0, 0, 0);
2052 GetProperty(View.Property.PADDING).Get(temp);
2053 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2057 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2058 NotifyPropertyChanged();
2059 _layout?.RequestLayout();
2063 /// <since_tizen> 6 </since_tizen>
2064 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2065 [EditorBrowsable(EditorBrowsableState.Never)]
2066 public Style XamlStyle
2070 return (Style)GetValue(XamlStyleProperty);
2074 SetValue(XamlStyleProperty, value);
2079 /// The Color of View. This is an RGBA value.
2083 /// Animatable - This property can be animated using <c>Animation</c> class.
2085 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2087 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2088 [EditorBrowsable(EditorBrowsableState.Never)]
2093 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
2094 GetProperty(Interop.ActorProperty.Actor_Property_COLOR_get()).Get(temp);
2095 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2104 /// Set the layout on this View. Replaces any existing Layout.
2106 /// <since_tizen> 6 </since_tizen>
2107 public LayoutItem Layout
2115 // Do nothing if layout provided is already set on this View.
2116 if (value == _layout)
2121 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2122 layoutingDisabled = false;
2125 // If new layout being set already has a owner then that owner receives a replacement default layout.
2126 // First check if the layout to be set already has a owner.
2127 if (value?.Owner != null)
2129 // Previous owner of the layout gets a default layout as a replacement.
2130 value.Owner.Layout = new LayoutGroup();
2132 // Copy Margin and Padding to replacement LayoutGroup.
2133 value.Owner.Layout.Margin = value.Margin;
2134 value.Owner.Layout.Padding = value.Padding;
2137 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2138 // View if no replacement. Previously margin and padding values would have been moved from
2139 // the View to the layout.
2140 if (_layout != null ) // Existing layout
2144 // Existing layout being replaced so copy over margin and padding values.
2145 value.Margin = _layout.Margin;
2146 value.Padding = _layout.Padding;
2150 // Layout not being replaced so restore margin and padding to View.
2151 SetValue(MarginProperty, _layout.Margin);
2152 SetValue(PaddingProperty, _layout.Padding);
2153 NotifyPropertyChanged();
2158 // First Layout to be added to the View hence copy
2160 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2163 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2165 // If View already has a margin set then store it in Layout instead.
2166 value.Margin = Margin;
2167 SetValue(MarginProperty, new Extents(0,0,0,0));
2168 NotifyPropertyChanged();
2171 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2173 // If View already has a padding set then store it in Layout instead.
2174 value.Padding = Padding;
2175 SetValue(PaddingProperty, new Extents(0,0,0,0));
2176 NotifyPropertyChanged();
2181 // Remove existing layout from it's parent layout group.
2182 _layout?.Unparent();
2184 // Set layout to this view
2190 /// The weight of the View, used to share available space in a layout with siblings.
2192 /// <since_tizen> 6 </since_tizen>
2202 _layout?.RequestLayout();
2207 /// Whether to load the BackgroundImage synchronously.
2208 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2209 /// Note: For Normal Quad images only.
2211 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2212 [EditorBrowsable(EditorBrowsableState.Never)]
2213 public bool BackgroundImageSynchronosLoading
2217 return _backgroundImageSynchronosLoading;
2221 _backgroundImageSynchronosLoading = value;
2224 Background.Find(Visual.Property.Type)?.Get(out visualType);
2225 if (visualType == (int)Visual.Type.Image)
2227 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2230 if (bgUrl.Length != 0)
2232 PropertyMap bgMap = this.Background;
2233 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2239 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2240 [EditorBrowsable(EditorBrowsableState.Never)]
2241 public Vector2 UpdateSizeHint
2245 return (Vector2)GetValue(UpdateSizeHintProperty);
2249 SetValue(UpdateSizeHintProperty, value);
2250 NotifyPropertyChanged();
2254 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2255 [EditorBrowsable(EditorBrowsableState.Never)]
2256 public string[] TransitionNames
2260 return transitionNames;
2264 transitionNames = value;
2270 /// Get Style, it is abstract function and must be override.
2272 /// <since_tizen> 6 </since_tizen>
2273 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2274 [EditorBrowsable(EditorBrowsableState.Never)]
2275 protected virtual ViewStyle GetViewStyle()
2277 return new ViewStyle();
2280 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2281 [EditorBrowsable(EditorBrowsableState.Never)]
2282 protected virtual bool OnControlStateChanged(ControlStates currentState)
2284 //If need to apply the state to all child, return true;
2287 internal static readonly BindableProperty BackgroundImageSelectorProperty = BindableProperty.Create("BackgroundImageSelector", typeof(Selector<string>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2289 var view = (View)bindable;
2290 view.backgroundImageSelector.Clone((Selector<string>)newValue);
2292 defaultValueCreator: (bindable) =>
2294 var view = (View)bindable;
2295 return view.backgroundImageSelector;
2297 private TriggerableSelector<string> _backgroundImageSelector;
2298 private TriggerableSelector<string> backgroundImageSelector
2302 if (null == _backgroundImageSelector)
2304 _backgroundImageSelector = new TriggerableSelector<string>(this, BackgroundImageProperty);
2306 return _backgroundImageSelector;
2309 internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2311 var view = (View)bindable;
2312 view.backgroundColorSelector.Clone((Selector<Color>)newValue);
2314 defaultValueCreator: (bindable) =>
2316 var view = (View)bindable;
2317 return view.backgroundColorSelector;
2319 private TriggerableSelector<Color> _backgroundColorSelector;
2320 private TriggerableSelector<Color> backgroundColorSelector
2324 if (null == _backgroundColorSelector)
2326 _backgroundColorSelector = new TriggerableSelector<Color>(this, BackgroundColorProperty);
2328 return _backgroundColorSelector;
2331 internal static readonly BindableProperty BackgroundImageBorderSelectorProperty = BindableProperty.Create("BackgroundImageBorderSelector", typeof(Selector<Rectangle>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2333 var view = (View)bindable;
2334 view.backgroundImageBorderSelector.Clone((Selector<Rectangle>)newValue);
2336 defaultValueCreator: (bindable) =>
2338 var view = (View)bindable;
2339 return view.backgroundImageBorderSelector;
2341 private TriggerableSelector<Rectangle> _backgroundImageBorderSelector;
2342 private TriggerableSelector<Rectangle> backgroundImageBorderSelector
2346 if (null == _backgroundImageBorderSelector)
2348 _backgroundImageBorderSelector = new TriggerableSelector<Rectangle>(this, BackgroundImageBorderProperty);
2350 return _backgroundImageBorderSelector;
2353 internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2355 var view = (View)bindable;
2356 view.opacitySelector.Clone((Selector<float?>)newValue);
2358 defaultValueCreator: (bindable) =>
2360 var view = (View)bindable;
2361 return view.opacitySelector;
2363 private TriggerableSelector<float?> _opacitySelector;
2364 private TriggerableSelector<float?> opacitySelector
2368 if (null == _opacitySelector)
2370 _opacitySelector = new TriggerableSelector<float?>(this, OpacityProperty);
2372 return _opacitySelector;
2376 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2377 [EditorBrowsable(EditorBrowsableState.Never)]
2378 public virtual void ApplyStyle(ViewStyle viewStyle)
2380 if (null == viewStyle)
2385 if (this.viewStyle == viewStyle)
2390 if (null != this.viewStyle)
2392 simpleBinding.Clear();
2395 this.viewStyle = viewStyle;
2397 Dictionary<string, BindableProperty> bindablePropertyOfView;
2398 Type viewType = GetType();
2400 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2401 Type styleType = viewStyle.GetType();
2403 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2404 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2406 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2408 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2410 BindableProperty viewProperty;
2411 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2413 if (null != viewProperty)
2415 object value = viewStyle.GetValue(keyValuePair.Value);
2419 SetValue(viewProperty, value);
2422 simpleBinding.Bind(viewStyle, keyValuePair.Value, this, viewProperty, BindingDirection.TwoWay);
2428 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2429 [EditorBrowsable(EditorBrowsableState.Never)]
2430 private BundledPipe simpleBinding = new BundledPipe();