2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.Binding;
22 using Tizen.NUI.Components;
24 namespace Tizen.NUI.BaseComponents
27 /// View is the base class for all views.
29 /// <since_tizen> 3 </since_tizen>
30 public partial class View : Container, IResourcesProvider
33 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
35 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
36 [EditorBrowsable(EditorBrowsableState.Never)]
37 public bool layoutSet = false;
40 /// Flag to allow Layouting to be disabled for Views.
41 /// Once a View has a Layout set then any children added to Views from then on will receive
42 /// automatic Layouts.
44 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
45 [EditorBrowsable(EditorBrowsableState.Never)]
46 public static bool layoutingDisabled{get; set;} = true;
48 private LayoutItem _layout; // Exclusive layout assigned to this View.
50 // List of transitions paired with the condition that uses the transition.
51 private Dictionary<TransitionCondition, TransitionList> _layoutTransitions;
52 private int _widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
53 private int _heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
54 private int _oldWidthPolicy = LayoutParamPolicies.MatchParent; // // Store Layout width to compare against later
55 private int _oldHeightPolicy = LayoutParamPolicies.MatchParent; // Store Layout height to compare against later
56 private float _weight = 0.0f; // Weighting of child View in a Layout
57 private MeasureSpecification _measureSpecificationWidth; // Layout width and internal Mode
58 private MeasureSpecification _measureSpecificationHeight; // Layout height and internal Mode
59 private bool _backgroundImageSynchronosLoading = false;
60 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
61 private string[] transitionNames;
62 private bool controlStatePropagation = false;
63 private ViewStyle viewStyle;
65 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
66 internal BackgroundExtraData backgroundExtraData;
70 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
71 [EditorBrowsable(EditorBrowsableState.Never)]
72 public ViewStyle ViewStyle
76 if (null == viewStyle)
78 ApplyStyle(GetViewStyle());
86 /// Creates a new instance of a view.
88 /// <since_tizen> 3 </since_tizen>
89 public View() : this(Interop.View.View_New(), true)
91 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
94 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
95 [EditorBrowsable(EditorBrowsableState.Never)]
96 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true)
98 ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
102 /// Create a new instance of a View with setting the status of shown or hidden.
104 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
105 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
106 [EditorBrowsable(EditorBrowsableState.Never)]
107 public View(bool shown) : this(Interop.View.View_New(), true)
109 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
115 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
124 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
126 ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
129 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
133 PositionUsesPivotPoint = false;
136 _onWindowSendEventCallback = SendViewAddedEventToWindow;
137 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
145 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
147 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
156 /// The event that is triggered when the View's ControlState is changed.
158 [EditorBrowsable(EditorBrowsableState.Never)]
159 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
161 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
163 private ControlState controlStates = ControlState.Normal;
165 /// Get/Set the control state.
167 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
168 [EditorBrowsable(EditorBrowsableState.Never)]
169 public ControlState ControlState
173 return controlStates;
177 if (controlStates == value)
182 var prevState = controlStates;
184 controlStates = value;
186 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
188 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
190 OnControlStateChanged(changeInfo);
192 if (controlStatePropagation)
194 foreach (View child in Children)
196 child.ControlState = value;
200 ControlStateChangedEvent?.Invoke(this, changeInfo);
204 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
205 [EditorBrowsable(EditorBrowsableState.Never)]
206 public bool IsResourcesCreated
210 return Application.Current.IsResourcesCreated;
214 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
215 [EditorBrowsable(EditorBrowsableState.Never)]
216 public ResourceDictionary XamlResources
220 return Application.Current.XamlResources;
224 Application.Current.XamlResources = value;
229 /// The StyleName, type string.
230 /// The value indicates DALi style name defined in json theme file.
232 /// <since_tizen> 3 </since_tizen>
233 public string StyleName
237 return (string)GetValue(StyleNameProperty);
241 SetValue(StyleNameProperty, value);
242 NotifyPropertyChanged();
247 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
250 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
252 /// <since_tizen> 3 </since_tizen>
253 public Color BackgroundColor
257 Color temp = (Color)GetValue(BackgroundColorProperty);
258 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
262 SetValue(BackgroundColorProperty, value);
263 if (selectorData != null)
265 selectorData.BackgroundImage.Reset(this);
266 selectorData.BackgroundColor.UpdateIfNeeds(this, value);
268 NotifyPropertyChanged();
273 /// The mutually exclusive with "backgroundColor" and "background" type Map.
275 /// <since_tizen> 3 </since_tizen>
276 public string BackgroundImage
280 return (string)GetValue(BackgroundImageProperty);
284 SetValue(BackgroundImageProperty, value);
285 if (selectorData != null)
287 selectorData.BackgroundColor.Reset(this);
288 selectorData.BackgroundImage.UpdateIfNeeds(this, value);
290 NotifyPropertyChanged();
295 /// Get or set the border of background image.
297 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
298 [EditorBrowsable(EditorBrowsableState.Never)]
299 public Rectangle BackgroundImageBorder
303 return (Rectangle)GetValue(BackgroundImageBorderProperty);
307 SetValue(BackgroundImageBorderProperty, value);
308 selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value);
309 NotifyPropertyChanged();
314 /// The background of view.
316 /// <since_tizen> 3 </since_tizen>
317 public Tizen.NUI.PropertyMap Background
321 return (PropertyMap)GetValue(BackgroundProperty);
325 SetValue(BackgroundProperty, value);
326 NotifyPropertyChanged();
331 /// Describes a shadow as an image for a View.
332 /// It is null by default.
335 /// Getter returns copied instance of current shadow.
338 /// The mutually exclusive with "BoxShadow".
340 [EditorBrowsable(EditorBrowsableState.Never)]
341 public ImageShadow ImageShadow
345 return (ImageShadow)GetValue(ImageShadowProperty);
349 SetValue(ImageShadowProperty, value);
350 if (selectorData != null)
352 selectorData.BoxShadow.Reset(this);
353 selectorData.ImageShadow.UpdateIfNeeds(this, value);
355 NotifyPropertyChanged();
360 /// Describes a box shaped shadow drawing for a View.
361 /// It is null by default.
364 /// Gettter returns copied instance of current shadow.
367 /// The mutually exclusive with "ImageShadow".
369 [EditorBrowsable(EditorBrowsableState.Never)]
370 public Shadow BoxShadow
374 return (Shadow)GetValue(BoxShadowProperty);
378 SetValue(BoxShadowProperty, value);
379 if (selectorData != null)
381 selectorData.ImageShadow.Reset(this);
382 selectorData.BoxShadow.UpdateIfNeeds(this, value);
384 NotifyPropertyChanged();
389 /// The radius for the rounded corners of the View.
390 /// This will rounds background and shadow edges.
391 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
393 [EditorBrowsable(EditorBrowsableState.Never)]
394 public float CornerRadius
398 return (float)GetValue(CornerRadiusProperty);
402 SetValue(CornerRadiusProperty, value);
403 selectorData?.CornerRadius.UpdateIfNeeds(this, value);
404 NotifyPropertyChanged();
409 /// The current state of the view.
411 /// <since_tizen> 3 </since_tizen>
416 return (States)GetValue(StateProperty);
420 SetValue(StateProperty, value);
421 NotifyPropertyChanged();
426 /// The current sub state of the view.
428 /// <since_tizen> 3 </since_tizen>
429 public States SubState
433 return (States)GetValue(SubStateProperty);
437 SetValue(SubStateProperty, value);
438 NotifyPropertyChanged();
443 /// Displays a tooltip
445 /// <since_tizen> 3 </since_tizen>
446 public Tizen.NUI.PropertyMap Tooltip
450 return (PropertyMap)GetValue(TooltipProperty);
454 SetValue(TooltipProperty, value);
455 NotifyPropertyChanged();
460 /// Displays a tooltip as a text.
462 /// <since_tizen> 3 </since_tizen>
463 public string TooltipText
467 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
468 NotifyPropertyChanged();
473 /// The Child property of FlexContainer.<br />
474 /// The proportion of the free space in the container, the flex item will receive.<br />
475 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
477 /// <since_tizen> 3 </since_tizen>
478 [Obsolete("Deprecated in API8, will be removed in API10.")]
483 return (float)GetValue(FlexProperty);
487 SetValue(FlexProperty, value);
488 NotifyPropertyChanged();
493 /// The Child property of FlexContainer.<br />
494 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
496 /// <since_tizen> 3 </since_tizen>
497 [Obsolete("Deprecated in API8, will be removed in API10.")]
502 return (int)GetValue(AlignSelfProperty);
506 SetValue(AlignSelfProperty, value);
507 NotifyPropertyChanged();
512 /// The Child property of FlexContainer.<br />
513 /// The space around the flex item.<br />
516 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
518 /// <since_tizen> 3 </since_tizen>
519 [Obsolete("Deprecated in API8, will be removed in API10.")]
520 public Vector4 FlexMargin
524 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
525 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
529 SetValue(FlexMarginProperty, value);
530 NotifyPropertyChanged();
535 /// The top-left cell this child occupies, if not set, the first available cell is used.
538 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
540 /// <since_tizen> 3 </since_tizen>
541 public Vector2 CellIndex
545 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
546 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
550 SetValue(CellIndexProperty, value);
551 NotifyPropertyChanged();
556 /// The number of rows this child occupies, if not set, the default value is 1.
558 /// <since_tizen> 3 </since_tizen>
563 return (float)GetValue(RowSpanProperty);
567 SetValue(RowSpanProperty, value);
568 NotifyPropertyChanged();
573 /// The number of columns this child occupies, if not set, the default value is 1.
575 /// <since_tizen> 3 </since_tizen>
576 public float ColumnSpan
580 return (float)GetValue(ColumnSpanProperty);
584 SetValue(ColumnSpanProperty, value);
585 NotifyPropertyChanged();
590 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
592 /// <since_tizen> 3 </since_tizen>
593 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
597 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
601 SetValue(CellHorizontalAlignmentProperty, value);
602 NotifyPropertyChanged();
607 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
609 /// <since_tizen> 3 </since_tizen>
610 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
614 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
618 SetValue(CellVerticalAlignmentProperty, value);
619 NotifyPropertyChanged();
624 /// The left focusable view.<br />
625 /// This will return null if not set.<br />
626 /// This will also return null if the specified left focusable view is not on a window.<br />
628 /// <since_tizen> 3 </since_tizen>
629 public View LeftFocusableView
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(LeftFocusableViewProperty);
638 SetValue(LeftFocusableViewProperty, value);
639 NotifyPropertyChanged();
644 /// The right focusable view.<br />
645 /// This will return null if not set.<br />
646 /// This will also return null if the specified right focusable view is not on a window.<br />
648 /// <since_tizen> 3 </since_tizen>
649 public View RightFocusableView
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(RightFocusableViewProperty);
658 SetValue(RightFocusableViewProperty, value);
659 NotifyPropertyChanged();
664 /// The up focusable view.<br />
665 /// This will return null if not set.<br />
666 /// This will also return null if the specified up focusable view is not on a window.<br />
668 /// <since_tizen> 3 </since_tizen>
669 public View UpFocusableView
671 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
674 return (View)GetValue(UpFocusableViewProperty);
678 SetValue(UpFocusableViewProperty, value);
679 NotifyPropertyChanged();
684 /// The down focusable view.<br />
685 /// This will return null if not set.<br />
686 /// This will also return null if the specified down focusable view is not on a window.<br />
688 /// <since_tizen> 3 </since_tizen>
689 public View DownFocusableView
691 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
694 return (View)GetValue(DownFocusableViewProperty);
698 SetValue(DownFocusableViewProperty, value);
699 NotifyPropertyChanged();
704 /// Whether the view should be focusable by keyboard navigation.
706 /// <since_tizen> 3 </since_tizen>
707 public bool Focusable
711 SetValue(FocusableProperty, value);
712 NotifyPropertyChanged();
716 return (bool)GetValue(FocusableProperty);
721 /// Retrieves the position of the view.<br />
722 /// The coordinates are relative to the view's parent.<br />
724 /// <since_tizen> 3 </since_tizen>
725 public Position CurrentPosition
729 return GetCurrentPosition();
734 /// Sets the size of a view for the width and the height.<br />
735 /// Geometry can be scaled to fit within this area.<br />
736 /// This does not interfere with the view's scale factor.<br />
737 /// The views default depth is the minimum of width and height.<br />
740 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
741 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
743 /// <since_tizen> 3 </since_tizen>
748 Size2D temp = (Size2D)GetValue(Size2DProperty);
750 if (this.Layout == null)
752 if (temp.Width < 0) { temp.Width = 0; }
753 if (temp.Height < 0) { temp.Height = 0; }
756 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
760 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
761 SetValue(Size2DProperty, value);
762 // Set Specification so when layouts measure this View it matches the value set here.
763 // All Views are currently Layouts.
764 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
765 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
766 _widthPolicy = value.Width;
767 _heightPolicy = value.Height;
768 _layout?.RequestLayout();
769 NotifyPropertyChanged();
774 /// Retrieves the size of the view.<br />
775 /// The coordinates are relative to the view's parent.<br />
777 /// <since_tizen> 3 </since_tizen>
778 public Size2D CurrentSize
782 return GetCurrentSize();
787 /// Retrieves and sets the view's opacity.<br />
789 /// <since_tizen> 3 </since_tizen>
794 return (float)GetValue(OpacityProperty);
798 SetValue(OpacityProperty, value);
799 selectorData?.Opacity.UpdateIfNeeds(this, value);
800 NotifyPropertyChanged();
805 /// Sets the position of the view for X and Y.<br />
806 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
807 /// If the position inheritance is disabled, sets the world position.<br />
810 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
811 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
813 /// <since_tizen> 3 </since_tizen>
814 public Position2D Position2D
818 Position2D temp = (Position2D)GetValue(Position2DProperty);
819 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
823 SetValue(Position2DProperty, value);
824 NotifyPropertyChanged();
829 /// Retrieves the screen postion of the view.<br />
831 /// <since_tizen> 3 </since_tizen>
832 public Vector2 ScreenPosition
836 Vector2 temp = new Vector2(0.0f, 0.0f);
837 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
843 /// Determines whether the pivot point should be used to determine the position of the view.
844 /// This is false by default.
846 /// <remarks>If false, then the top-left of the view is used for the position.
847 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
849 /// <since_tizen> 3 </since_tizen>
850 public bool PositionUsesPivotPoint
854 return (bool)GetValue(PositionUsesPivotPointProperty);
858 SetValue(PositionUsesPivotPointProperty, value);
859 NotifyPropertyChanged();
864 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
866 /// <since_tizen> 3 </since_tizen>
867 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
869 "View view = new View(); " +
870 "view.PivotPoint = PivotPoint.Center; " +
871 "view.PositionUsesPivotPoint = true;" +
872 " Deprecated in API5: Will be removed in API8")]
873 [EditorBrowsable(EditorBrowsableState.Never)]
874 public bool PositionUsesAnchorPoint
879 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
884 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
885 NotifyPropertyChanged();
890 /// Queries whether the view is connected to the stage.<br />
891 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
893 /// <since_tizen> 3 </since_tizen>
894 public bool IsOnWindow
903 /// Gets the depth in the hierarchy for the view.
905 /// <since_tizen> 3 </since_tizen>
906 public int HierarchyDepth
910 return GetHierarchyDepth();
915 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
918 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
919 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
920 /// The values set by this property will likely change.
922 /// <since_tizen> 3 </since_tizen>
923 public int SiblingOrder
927 return (int)GetValue(SiblingOrderProperty);
931 SetValue(SiblingOrderProperty, value);
933 LayoutGroup layout = Layout as LayoutGroup;
934 layout?.ChangeLayoutSiblingOrder(value);
936 NotifyPropertyChanged();
941 /// Returns the natural size of the view.
944 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
946 /// <since_tizen> 5 </since_tizen>
947 public Vector3 NaturalSize
951 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
952 if (NDalicPINVOKE.SWIGPendingException.Pending)
953 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
959 /// Returns the natural size (Size2D) of the view.
962 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
964 /// <since_tizen> 4 </since_tizen>
965 public Size2D NaturalSize2D
969 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
970 if (NDalicPINVOKE.SWIGPendingException.Pending)
971 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
973 return new Size2D((int)temp.Width, (int)temp.Height);
978 /// Gets or sets the origin of a view within its parent's area.<br />
979 /// 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 />
980 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
981 /// A view's position is the distance between this origin and the view's anchor-point.<br />
983 /// <pre>The view has been initialized.</pre>
984 /// <since_tizen> 3 </since_tizen>
985 public Position ParentOrigin
989 Position tmp = (Position)GetValue(ParentOriginProperty);
990 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
994 SetValue(ParentOriginProperty, value);
995 NotifyPropertyChanged();
1000 /// Gets or sets the anchor-point of a view.<br />
1001 /// 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 />
1002 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1003 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1004 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1005 /// <pre>The view has been initialized.</pre>
1008 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1010 /// <since_tizen> 3 </since_tizen>
1011 public Position PivotPoint
1015 Position tmp = (Position)GetValue(PivotPointProperty);
1016 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1020 SetValue(PivotPointProperty, value);
1021 NotifyPropertyChanged();
1026 /// Gets or sets the size width of the view.
1030 /// Animatable - This property can be animated using <c>Animation</c> class.
1033 /// <since_tizen> 3 </since_tizen>
1034 public float SizeWidth
1038 return (float)GetValue(SizeWidthProperty);
1042 SetValue(SizeWidthProperty, value);
1043 NotifyPropertyChanged();
1048 /// Gets or sets the size height of the view.
1052 /// Animatable - This property can be animated using <c>Animation</c> class.
1055 /// <since_tizen> 3 </since_tizen>
1056 public float SizeHeight
1060 return (float)GetValue(SizeHeightProperty);
1064 SetValue(SizeHeightProperty, 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 NotifyPropertyChanged();
1529 /// Gets or sets the height resize policy to be used.
1531 /// <since_tizen> 3 </since_tizen>
1532 public ResizePolicyType HeightResizePolicy
1536 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1540 SetValue(HeightResizePolicyProperty, value);
1541 NotifyPropertyChanged();
1546 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1547 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1549 /// <since_tizen> 3 </since_tizen>
1550 public SizeScalePolicyType SizeScalePolicy
1554 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1558 SetValue(SizeScalePolicyProperty, value);
1559 NotifyPropertyChanged();
1564 /// Gets or sets the status of whether the width size is dependent on the height size.
1566 /// <since_tizen> 3 </since_tizen>
1567 public bool WidthForHeight
1571 return (bool)GetValue(WidthForHeightProperty);
1575 SetValue(WidthForHeightProperty, value);
1576 NotifyPropertyChanged();
1581 /// Gets or sets the status of whether the height size is dependent on the width size.
1583 /// <since_tizen> 3 </since_tizen>
1584 public bool HeightForWidth
1588 return (bool)GetValue(HeightForWidthProperty);
1592 SetValue(HeightForWidthProperty, value);
1593 NotifyPropertyChanged();
1598 /// Gets or sets the padding for use in layout.
1601 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1603 /// <since_tizen> 5 </since_tizen>
1604 public Extents Padding
1608 // If View has a Layout then padding in stored in the base Layout class
1611 return Layout.Padding;
1615 Extents temp = (Extents)GetValue(PaddingProperty);
1616 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1618 // Two return points to prevent creating a zeroed Extent native object before assignment
1622 Extents padding = value;
1625 // Layout set so store Padding in LayoutItem instead of in View.
1626 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1627 // the position and sizes measure in the Layouting.
1628 Layout.Padding = value;
1629 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1630 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1631 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1633 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1637 SetValue(PaddingProperty, padding);
1638 NotifyPropertyChanged();
1643 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1646 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1648 /// <since_tizen> 3 </since_tizen>
1649 public Size2D MinimumSize
1653 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1654 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1658 if (_layout != null)
1660 // Note: it only works if minimum size is >= than natural size.
1661 // To force the size it should be done through the width&height spec or Size2D.
1662 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1663 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1664 _layout.RequestLayout();
1666 SetValue(MinimumSizeProperty, value);
1667 NotifyPropertyChanged();
1672 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1675 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1677 /// <since_tizen> 3 </since_tizen>
1678 public Size2D MaximumSize
1682 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1683 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1687 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1688 // MATCH_PARENT spec + parent container size can be used to limit
1689 if (_layout != null)
1691 _layout.RequestLayout();
1693 SetValue(MaximumSizeProperty, value);
1694 NotifyPropertyChanged();
1699 /// Gets or sets whether a child view inherits it's parent's position.<br />
1700 /// Default is to inherit.<br />
1701 /// 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 />
1703 /// <since_tizen> 3 </since_tizen>
1704 public bool InheritPosition
1708 return (bool)GetValue(InheritPositionProperty);
1712 SetValue(InheritPositionProperty, value);
1713 NotifyPropertyChanged();
1718 /// Gets or sets the clipping behavior (mode) of it's children.
1720 /// <since_tizen> 3 </since_tizen>
1721 public ClippingModeType ClippingMode
1725 return (ClippingModeType)GetValue(ClippingModeProperty);
1729 SetValue(ClippingModeProperty, value);
1730 NotifyPropertyChanged();
1735 /// Gets the number of renderers held by the view.
1737 /// <since_tizen> 3 </since_tizen>
1738 public uint RendererCount
1742 return GetRendererCount();
1747 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1750 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1752 /// <since_tizen> 3 </since_tizen>
1753 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1755 "View view = new View(); " +
1756 "view.PivotPoint = PivotPoint.Center; " +
1757 "view.PositionUsesPivotPoint = true;")]
1758 [EditorBrowsable(EditorBrowsableState.Never)]
1759 public Position AnchorPoint
1763 Position temp = new Position(0.0f, 0.0f, 0.0f);
1764 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1765 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1769 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1770 NotifyPropertyChanged();
1775 /// Sets the size of a view for the width, the height and the depth.<br />
1776 /// Geometry can be scaled to fit within this area.<br />
1777 /// This does not interfere with the view's scale factor.<br />
1778 /// The views default depth is the minimum of width and height.<br />
1782 /// Animatable - This property can be animated using <c>Animation</c> class.
1784 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1786 /// <since_tizen> 5 </since_tizen>
1791 Size tmp = (Size)GetValue(SizeProperty);
1792 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1796 SetValue(SizeProperty, value);
1797 NotifyPropertyChanged();
1802 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1804 /// <since_tizen> 3 </since_tizen>
1805 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1807 "Container parent = view.GetParent(); " +
1808 "View view = parent as View;")]
1809 [EditorBrowsable(EditorBrowsableState.Never)]
1810 public new View Parent
1815 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1816 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1817 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1819 if (basehandle is Layer layer)
1821 ret = new View(Layer.getCPtr(layer).Handle, false);
1822 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1826 ret = basehandle as View;
1829 Interop.BaseHandle.delete_BaseHandle(CPtr);
1830 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1832 if (NDalicPINVOKE.SWIGPendingException.Pending)
1833 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1839 /// Gets/Sets whether inherit parent's the layout Direction.
1841 /// <since_tizen> 4 </since_tizen>
1842 public bool InheritLayoutDirection
1846 return (bool)GetValue(InheritLayoutDirectionProperty);
1850 SetValue(InheritLayoutDirectionProperty, value);
1851 NotifyPropertyChanged();
1856 /// Gets/Sets the layout Direction.
1858 /// <since_tizen> 4 </since_tizen>
1859 public ViewLayoutDirectionType LayoutDirection
1863 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1867 SetValue(LayoutDirectionProperty, value);
1868 NotifyPropertyChanged();
1869 _layout?.RequestLayout();
1874 /// Gets or sets the Margin for use in layout.
1877 /// Margin property is supported by Layout algorithms and containers.
1878 /// Please Set Layout if you want to use Margin property.
1879 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1881 /// <since_tizen> 4 </since_tizen>
1882 public Extents Margin
1886 // If View has a Layout then margin is stored in Layout.
1889 return Layout.Margin;
1893 // If Layout not set then return margin stored in View.
1894 Extents temp = (Extents)GetValue(MarginProperty);
1895 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1897 // Two return points to prevent creating a zeroed Extent native object before assignment
1903 // Layout set so store Margin in LayoutItem instead of View.
1904 // If View stores the Margin too then the Legacy Size Negotiation will
1905 // overwrite the position and size values measured in the Layouting.
1906 Layout.Margin = value;
1907 SetValue(MarginProperty, new Extents(0,0,0,0));
1908 _layout?.RequestLayout();
1912 SetValue(MarginProperty, value);
1914 NotifyPropertyChanged();
1915 _layout?.RequestLayout();
1920 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1922 /// <since_tizen> 6 </since_tizen>
1923 public int WidthSpecification
1927 return _widthPolicy;
1931 _widthPolicy = value;
1932 if( _oldWidthPolicy != _widthPolicy )
1934 if (_widthPolicy >= 0)
1936 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1938 if(_heightPolicy>=0) // Policy an exact value
1940 Size2D.Width = _widthPolicy;
1944 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1945 // Size2D height will store the specification value (negative number) this will then be applied to the
1946 // HeightSpecification when the Size2D callback is invoked.
1947 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1950 _layout?.RequestLayout();
1951 _oldWidthPolicy = _widthPolicy;
1957 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1959 /// <since_tizen> 6 </since_tizen>
1960 public int HeightSpecification
1964 return _heightPolicy;
1968 _heightPolicy = value;
1969 if( _oldHeightPolicy != _heightPolicy )
1971 if (_heightPolicy >= 0)
1973 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1975 if(_widthPolicy>=0) // Policy an exact value
1977 Size2D.Height = _heightPolicy;
1981 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1982 // Size2D height will store the specification value (negative number) this will then be applied to the
1983 // HeightSpecification when the Size2D callback is invoked.
1984 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1988 _layout?.RequestLayout();
1989 _oldHeightPolicy = _heightPolicy;
1995 /// Gets the List of transitions for this View.
1997 /// <since_tizen> 6 </since_tizen>
1998 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2002 if (_layoutTransitions == null)
2004 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2006 return _layoutTransitions;
2011 /// Set a layout transitions for this View.
2014 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2016 /// <since_tizen> 6 </since_tizen>
2017 public LayoutTransition LayoutTransition
2021 if (_layoutTransitions == null)
2023 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2025 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2027 AttachTransitionsToChildren(value);
2032 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2035 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2037 /// <since_tizen> 4 </since_tizen>
2038 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2039 [EditorBrowsable(EditorBrowsableState.Never)]
2040 public Extents PaddingEX
2044 Extents temp = new Extents(0, 0, 0, 0);
2045 GetProperty(View.Property.PADDING).Get(temp);
2046 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2050 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2051 NotifyPropertyChanged();
2052 _layout?.RequestLayout();
2056 /// <since_tizen> 6 </since_tizen>
2057 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2058 [EditorBrowsable(EditorBrowsableState.Never)]
2059 public Style XamlStyle
2063 return (Style)GetValue(XamlStyleProperty);
2067 SetValue(XamlStyleProperty, value);
2072 /// The Color of View. This is an RGBA value.
2076 /// Animatable - This property can be animated using <c>Animation</c> class.
2078 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2080 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2081 [EditorBrowsable(EditorBrowsableState.Never)]
2086 Color temp = (Color)GetValue(ColorProperty);
2087 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2091 SetValue(ColorProperty, value);
2092 selectorData?.Color.UpdateIfNeeds(this, value);
2093 NotifyPropertyChanged();
2098 /// Set the layout on this View. Replaces any existing Layout.
2100 /// <since_tizen> 6 </since_tizen>
2101 public LayoutItem Layout
2109 // Do nothing if layout provided is already set on this View.
2110 if (value == _layout)
2115 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2116 layoutingDisabled = false;
2119 // If new layout being set already has a owner then that owner receives a replacement default layout.
2120 // First check if the layout to be set already has a owner.
2121 if (value?.Owner != null)
2123 // Previous owner of the layout gets a default layout as a replacement.
2124 value.Owner.Layout = new AbsoluteLayout();
2126 // Copy Margin and Padding to replacement LayoutGroup.
2127 if (value.Owner.Layout != null)
2129 value.Owner.Layout.Margin = value.Margin;
2130 value.Owner.Layout.Padding = value.Padding;
2134 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2135 // View if no replacement. Previously margin and padding values would have been moved from
2136 // the View to the layout.
2137 if (_layout != null ) // Existing layout
2141 // Existing layout being replaced so copy over margin and padding values.
2142 value.Margin = _layout.Margin;
2143 value.Padding = _layout.Padding;
2147 // Layout not being replaced so restore margin and padding to View.
2148 SetValue(MarginProperty, _layout.Margin);
2149 SetValue(PaddingProperty, _layout.Padding);
2150 NotifyPropertyChanged();
2155 // First Layout to be added to the View hence copy
2157 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2160 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2162 // If View already has a margin set then store it in Layout instead.
2163 value.Margin = Margin;
2164 SetValue(MarginProperty, new Extents(0,0,0,0));
2165 NotifyPropertyChanged();
2168 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2170 // If View already has a padding set then store it in Layout instead.
2171 value.Padding = Padding;
2172 SetValue(PaddingProperty, new Extents(0,0,0,0));
2173 NotifyPropertyChanged();
2178 // Remove existing layout from it's parent layout group.
2179 _layout?.Unparent();
2181 // Set layout to this view
2187 /// The weight of the View, used to share available space in a layout with siblings.
2189 /// <since_tizen> 6 </since_tizen>
2199 _layout?.RequestLayout();
2204 /// Whether to load the BackgroundImage synchronously.
2205 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2206 /// Note: For Normal Quad images only.
2208 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2209 [EditorBrowsable(EditorBrowsableState.Never)]
2210 public bool BackgroundImageSynchronosLoading
2214 return _backgroundImageSynchronosLoading;
2218 _backgroundImageSynchronosLoading = value;
2220 string bgUrl = null;
2221 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2223 if (!string.IsNullOrEmpty(bgUrl))
2225 PropertyMap bgMap = this.Background;
2226 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2232 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2233 [EditorBrowsable(EditorBrowsableState.Never)]
2234 public Vector2 UpdateSizeHint
2238 return (Vector2)GetValue(UpdateSizeHintProperty);
2242 SetValue(UpdateSizeHintProperty, value);
2243 NotifyPropertyChanged();
2247 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2248 [EditorBrowsable(EditorBrowsableState.Never)]
2249 public string[] TransitionNames
2253 return transitionNames;
2257 transitionNames = value;
2263 /// Enable/Disable ControlState propagation for children.
2264 /// It is false by default.
2265 /// If the View needs to share ControlState with descendants, please set it true.
2266 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2268 [EditorBrowsable(EditorBrowsableState.Never)]
2269 public bool EnableControlStatePropagation
2271 get => controlStatePropagation;
2274 controlStatePropagation = value;
2276 foreach (View child in Children)
2278 child.EnableControlStatePropagation = value;
2284 /// If this property is set to true, the View can have a touch related ControlState (such as Pressed) when touch.
2285 /// By default, it is false in View, true in Control.
2286 /// Note that if the value is true, the View will be a touch receptor.
2288 [EditorBrowsable(EditorBrowsableState.Never)]
2289 public bool EnableControlState
2293 return (bool)GetValue(EnableControlStateProperty);
2297 SetValue(EnableControlStateProperty, value);
2302 /// Whether the actor grab all touches even if touch leaves its boundary.
2304 /// <returns>true, if it grab all touch after start</returns>
2305 [EditorBrowsable(EditorBrowsableState.Never)]
2306 public bool GrabTouchAfterLeave
2311 GetProperty(View.Property.CaptureAllTouchAfterStart).Get(out temp);
2316 SetProperty(View.Property.CaptureAllTouchAfterStart, new Tizen.NUI.PropertyValue(value));
2317 NotifyPropertyChanged();
2322 /// Get Style, it is abstract function and must be override.
2324 /// <since_tizen> 6 </since_tizen>
2325 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2326 // TODO: It should be deprecated. please use CreateViewStyle instead.
2327 [EditorBrowsable(EditorBrowsableState.Never)]
2328 protected virtual ViewStyle GetViewStyle()
2330 return CreateViewStyle();
2334 /// Create Style, it is abstract function and must be override.
2336 [EditorBrowsable(EditorBrowsableState.Never)]
2337 protected virtual ViewStyle CreateViewStyle()
2339 return new ViewStyle();
2343 /// Called after the View's ControlStates changed.
2345 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2346 [EditorBrowsable(EditorBrowsableState.Never)]
2347 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2351 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2352 [EditorBrowsable(EditorBrowsableState.Never)]
2353 public virtual void ApplyStyle(ViewStyle viewStyle)
2355 if (null == viewStyle || this.viewStyle == viewStyle) return;
2357 this.viewStyle = viewStyle;
2359 Dictionary<string, BindableProperty> bindablePropertyOfView;
2360 Type viewType = GetType();
2362 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2363 Type styleType = viewStyle.GetType();
2365 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2366 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2368 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2370 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2372 BindableProperty viewProperty;
2373 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2375 if (null != viewProperty)
2377 object value = viewStyle.GetValue(keyValuePair.Value);
2381 SetValue(viewProperty, value);