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;
64 private bool themeChangeSensitive = false;
66 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
67 internal BackgroundExtraData backgroundExtraData;
71 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
72 [EditorBrowsable(EditorBrowsableState.Never)]
73 public ViewStyle ViewStyle
77 if (null == viewStyle)
79 ApplyStyle(GetViewStyle());
87 /// Creates a new instance of a view.
89 /// <since_tizen> 3 </since_tizen>
90 public View() : this(Interop.View.View_New(), true)
92 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
95 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
96 [EditorBrowsable(EditorBrowsableState.Never)]
97 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true, viewStyle)
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 if (!ThemeManager.ThemeApplied) return;
128 if (viewStyle == null) UpdateStyle(); // Use style in the current theme
129 else ApplyStyle(viewStyle.Clone()); // Use given style
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();
159 /// The event that is triggered when the View's ControlState is changed.
161 [EditorBrowsable(EditorBrowsableState.Never)]
162 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
164 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
166 private ControlState controlStates = ControlState.Normal;
168 /// Get/Set the control state.
170 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
171 [EditorBrowsable(EditorBrowsableState.Never)]
172 public ControlState ControlState
176 return controlStates;
180 if (controlStates == value)
185 var prevState = controlStates;
187 controlStates = value;
189 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
191 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
193 if (controlStatePropagation)
195 foreach (View child in Children)
197 child.ControlState = value;
201 OnControlStateChanged(changeInfo);
203 ControlStateChangedEvent?.Invoke(this, changeInfo);
207 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
208 [EditorBrowsable(EditorBrowsableState.Never)]
209 public bool IsResourcesCreated
213 return Application.Current.IsResourcesCreated;
217 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
218 [EditorBrowsable(EditorBrowsableState.Never)]
219 public ResourceDictionary XamlResources
223 return Application.Current.XamlResources;
227 Application.Current.XamlResources = value;
232 /// The StyleName, type string.
233 /// The value indicates DALi style name defined in json theme file.
235 /// <since_tizen> 3 </since_tizen>
236 public string StyleName
240 return (string)GetValue(StyleNameProperty);
244 SetValue(StyleNameProperty, value);
245 NotifyPropertyChanged();
250 /// The KeyInputFocus, type bool.
252 [EditorBrowsable(EditorBrowsableState.Never)]
253 public bool KeyInputFocus
257 return (bool)GetValue(KeyInputFocusProperty);
261 SetValue(KeyInputFocusProperty, value);
262 NotifyPropertyChanged();
267 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
270 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
272 /// <since_tizen> 3 </since_tizen>
273 public Color BackgroundColor
277 Color temp = (Color)GetValue(BackgroundColorProperty);
278 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
282 SetValue(BackgroundColorProperty, value);
283 if (selectorData != null)
285 selectorData.BackgroundImage.Reset(this);
286 selectorData.BackgroundColor.UpdateIfNeeds(this, value);
288 NotifyPropertyChanged();
293 /// The mutually exclusive with "backgroundColor" and "background" type Map.
295 /// <since_tizen> 3 </since_tizen>
296 public string BackgroundImage
300 return (string)GetValue(BackgroundImageProperty);
304 SetValue(BackgroundImageProperty, value);
305 if (selectorData != null)
307 selectorData.BackgroundColor.Reset(this);
308 selectorData.BackgroundImage.UpdateIfNeeds(this, value);
310 NotifyPropertyChanged();
315 /// Get or set the border of background image.
317 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
318 [EditorBrowsable(EditorBrowsableState.Never)]
319 public Rectangle BackgroundImageBorder
323 return (Rectangle)GetValue(BackgroundImageBorderProperty);
327 SetValue(BackgroundImageBorderProperty, value);
328 selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value);
329 NotifyPropertyChanged();
334 /// The background of view.
336 /// <since_tizen> 3 </since_tizen>
337 public Tizen.NUI.PropertyMap Background
341 return (PropertyMap)GetValue(BackgroundProperty);
345 SetValue(BackgroundProperty, value);
346 NotifyPropertyChanged();
351 /// Describes a shadow as an image for a View.
352 /// It is null by default.
355 /// Getter returns copied instance of current shadow.
358 /// The mutually exclusive with "BoxShadow".
360 [EditorBrowsable(EditorBrowsableState.Never)]
361 public ImageShadow ImageShadow
365 return (ImageShadow)GetValue(ImageShadowProperty);
369 SetValue(ImageShadowProperty, value);
370 if (selectorData != null)
372 selectorData.BoxShadow.Reset(this);
373 selectorData.ImageShadow.UpdateIfNeeds(this, value);
375 NotifyPropertyChanged();
380 /// Describes a box shaped shadow drawing for a View.
381 /// It is null by default.
384 /// Gettter returns copied instance of current shadow.
387 /// The mutually exclusive with "ImageShadow".
389 [EditorBrowsable(EditorBrowsableState.Never)]
390 public Shadow BoxShadow
394 return (Shadow)GetValue(BoxShadowProperty);
398 SetValue(BoxShadowProperty, value);
399 if (selectorData != null)
401 selectorData.ImageShadow.Reset(this);
402 selectorData.BoxShadow.UpdateIfNeeds(this, value);
404 NotifyPropertyChanged();
409 /// The radius for the rounded corners of the View.
410 /// This will rounds background and shadow edges.
411 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
413 [EditorBrowsable(EditorBrowsableState.Never)]
414 public float CornerRadius
418 return (float)GetValue(CornerRadiusProperty);
422 SetValue(CornerRadiusProperty, value);
423 selectorData?.CornerRadius.UpdateIfNeeds(this, value);
424 NotifyPropertyChanged();
429 /// The current state of the view.
431 /// <since_tizen> 3 </since_tizen>
436 return (States)GetValue(StateProperty);
440 SetValue(StateProperty, value);
441 NotifyPropertyChanged();
446 /// The current sub state of the view.
448 /// <since_tizen> 3 </since_tizen>
449 public States SubState
453 return (States)GetValue(SubStateProperty);
457 SetValue(SubStateProperty, value);
458 NotifyPropertyChanged();
463 /// Displays a tooltip
465 /// <since_tizen> 3 </since_tizen>
466 public Tizen.NUI.PropertyMap Tooltip
470 return (PropertyMap)GetValue(TooltipProperty);
474 SetValue(TooltipProperty, value);
475 NotifyPropertyChanged();
480 /// Displays a tooltip as a text.
482 /// <since_tizen> 3 </since_tizen>
483 public string TooltipText
487 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
488 NotifyPropertyChanged();
493 /// The Child property of FlexContainer.<br />
494 /// The proportion of the free space in the container, the flex item will receive.<br />
495 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
497 /// <since_tizen> 3 </since_tizen>
498 [Obsolete("Deprecated in API8, will be removed in API10.")]
503 return (float)GetValue(FlexProperty);
507 SetValue(FlexProperty, value);
508 NotifyPropertyChanged();
513 /// The Child property of FlexContainer.<br />
514 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
516 /// <since_tizen> 3 </since_tizen>
517 [Obsolete("Deprecated in API8, will be removed in API10.")]
522 return (int)GetValue(AlignSelfProperty);
526 SetValue(AlignSelfProperty, value);
527 NotifyPropertyChanged();
532 /// The Child property of FlexContainer.<br />
533 /// The space around the flex item.<br />
536 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
538 /// <since_tizen> 3 </since_tizen>
539 [Obsolete("Deprecated in API8, will be removed in API10.")]
540 public Vector4 FlexMargin
544 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
545 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
549 SetValue(FlexMarginProperty, value);
550 NotifyPropertyChanged();
555 /// The top-left cell this child occupies, if not set, the first available cell is used.
558 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
560 /// <since_tizen> 3 </since_tizen>
561 public Vector2 CellIndex
565 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
566 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
570 SetValue(CellIndexProperty, value);
571 NotifyPropertyChanged();
576 /// The number of rows this child occupies, if not set, the default value is 1.
578 /// <since_tizen> 3 </since_tizen>
583 return (float)GetValue(RowSpanProperty);
587 SetValue(RowSpanProperty, value);
588 NotifyPropertyChanged();
593 /// The number of columns this child occupies, if not set, the default value is 1.
595 /// <since_tizen> 3 </since_tizen>
596 public float ColumnSpan
600 return (float)GetValue(ColumnSpanProperty);
604 SetValue(ColumnSpanProperty, value);
605 NotifyPropertyChanged();
610 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
612 /// <since_tizen> 3 </since_tizen>
613 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
617 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
621 SetValue(CellHorizontalAlignmentProperty, value);
622 NotifyPropertyChanged();
627 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
629 /// <since_tizen> 3 </since_tizen>
630 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
634 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
638 SetValue(CellVerticalAlignmentProperty, value);
639 NotifyPropertyChanged();
644 /// The left focusable view.<br />
645 /// This will return null if not set.<br />
646 /// This will also return null if the specified left focusable view is not on a window.<br />
648 /// <since_tizen> 3 </since_tizen>
649 public View LeftFocusableView
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(LeftFocusableViewProperty);
658 SetValue(LeftFocusableViewProperty, value);
659 NotifyPropertyChanged();
664 /// The right focusable view.<br />
665 /// This will return null if not set.<br />
666 /// This will also return null if the specified right focusable view is not on a window.<br />
668 /// <since_tizen> 3 </since_tizen>
669 public View RightFocusableView
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(RightFocusableViewProperty);
678 SetValue(RightFocusableViewProperty, value);
679 NotifyPropertyChanged();
684 /// The up focusable view.<br />
685 /// This will return null if not set.<br />
686 /// This will also return null if the specified up focusable view is not on a window.<br />
688 /// <since_tizen> 3 </since_tizen>
689 public View UpFocusableView
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(UpFocusableViewProperty);
698 SetValue(UpFocusableViewProperty, value);
699 NotifyPropertyChanged();
704 /// The down focusable view.<br />
705 /// This will return null if not set.<br />
706 /// This will also return null if the specified down focusable view is not on a window.<br />
708 /// <since_tizen> 3 </since_tizen>
709 public View DownFocusableView
711 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
714 return (View)GetValue(DownFocusableViewProperty);
718 SetValue(DownFocusableViewProperty, value);
719 NotifyPropertyChanged();
724 /// Whether the view should be focusable by keyboard navigation.
726 /// <since_tizen> 3 </since_tizen>
727 public bool Focusable
731 SetValue(FocusableProperty, value);
732 NotifyPropertyChanged();
736 return (bool)GetValue(FocusableProperty);
741 /// Retrieves the position of the view.<br />
742 /// The coordinates are relative to the view's parent.<br />
744 /// <since_tizen> 3 </since_tizen>
745 public Position CurrentPosition
749 return GetCurrentPosition();
754 /// Sets the size of a view for the width and the height.<br />
755 /// Geometry can be scaled to fit within this area.<br />
756 /// This does not interfere with the view's scale factor.<br />
757 /// The views default depth is the minimum of width and height.<br />
760 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
761 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
763 /// <since_tizen> 3 </since_tizen>
768 Size2D temp = (Size2D)GetValue(Size2DProperty);
769 int width = temp.Width;
770 int height = temp.Height;
772 if (this.Layout == null)
774 if (width < 0) { width = 0; }
775 if (height < 0) { height = 0; }
778 return new Size2D(OnSize2DChanged, width, height);
782 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
783 SetValue(Size2DProperty, value);
784 // Set Specification so when layouts measure this View it matches the value set here.
785 // All Views are currently Layouts.
786 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
787 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
788 _widthPolicy = value.Width;
789 _heightPolicy = value.Height;
791 _layout?.RequestLayout();
792 NotifyPropertyChanged();
797 /// Retrieves the size of the view.<br />
798 /// The coordinates are relative to the view's parent.<br />
800 /// <since_tizen> 3 </since_tizen>
801 public Size2D CurrentSize
805 return GetCurrentSize();
810 /// Retrieves and sets the view's opacity.<br />
812 /// <since_tizen> 3 </since_tizen>
817 return (float)GetValue(OpacityProperty);
821 SetValue(OpacityProperty, value);
822 selectorData?.Opacity.UpdateIfNeeds(this, value);
823 NotifyPropertyChanged();
828 /// Sets the position of the view for X and Y.<br />
829 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
830 /// If the position inheritance is disabled, sets the world position.<br />
833 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
834 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
836 /// <since_tizen> 3 </since_tizen>
837 public Position2D Position2D
841 Position2D temp = (Position2D)GetValue(Position2DProperty);
842 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
846 SetValue(Position2DProperty, value);
847 NotifyPropertyChanged();
852 /// Retrieves the screen postion of the view.<br />
854 /// <since_tizen> 3 </since_tizen>
855 public Vector2 ScreenPosition
859 Vector2 temp = new Vector2(0.0f, 0.0f);
860 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
866 /// Determines whether the pivot point should be used to determine the position of the view.
867 /// This is false by default.
869 /// <remarks>If false, then the top-left of the view is used for the position.
870 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
872 /// <since_tizen> 3 </since_tizen>
873 public bool PositionUsesPivotPoint
877 return (bool)GetValue(PositionUsesPivotPointProperty);
881 SetValue(PositionUsesPivotPointProperty, value);
882 NotifyPropertyChanged();
887 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
889 /// <since_tizen> 3 </since_tizen>
890 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
892 "View view = new View(); " +
893 "view.PivotPoint = PivotPoint.Center; " +
894 "view.PositionUsesPivotPoint = true;" +
895 " Deprecated in API5: Will be removed in API8")]
896 [EditorBrowsable(EditorBrowsableState.Never)]
897 public bool PositionUsesAnchorPoint
902 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
907 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
908 NotifyPropertyChanged();
913 /// Queries whether the view is connected to the stage.<br />
914 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
916 /// <since_tizen> 3 </since_tizen>
917 public bool IsOnWindow
926 /// Gets the depth in the hierarchy for the view.
928 /// <since_tizen> 3 </since_tizen>
929 public int HierarchyDepth
933 return GetHierarchyDepth();
938 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
941 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
942 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
943 /// The values set by this property will likely change.
945 /// <since_tizen> 3 </since_tizen>
946 public int SiblingOrder
950 return (int)GetValue(SiblingOrderProperty);
954 SetValue(SiblingOrderProperty, value);
956 LayoutGroup layout = Layout as LayoutGroup;
957 layout?.ChangeLayoutSiblingOrder(value);
959 NotifyPropertyChanged();
964 /// Returns the natural size of the view.
967 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
969 /// <since_tizen> 5 </since_tizen>
970 public Vector3 NaturalSize
974 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
975 if (NDalicPINVOKE.SWIGPendingException.Pending)
976 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
982 /// Returns the natural size (Size2D) of the view.
985 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
987 /// <since_tizen> 4 </since_tizen>
988 public Size2D NaturalSize2D
992 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
993 if (NDalicPINVOKE.SWIGPendingException.Pending)
994 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
996 return new Size2D((int)temp.Width, (int)temp.Height);
1001 /// Gets or sets the origin of a view within its parent's area.<br />
1002 /// 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 />
1003 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1004 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1006 /// <pre>The view has been initialized.</pre>
1007 /// <since_tizen> 3 </since_tizen>
1008 public Position ParentOrigin
1012 Position tmp = (Position)GetValue(ParentOriginProperty);
1013 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1017 SetValue(ParentOriginProperty, value);
1018 NotifyPropertyChanged();
1023 /// Gets or sets the anchor-point of a view.<br />
1024 /// 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 />
1025 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1026 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1027 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1028 /// <pre>The view has been initialized.</pre>
1031 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1033 /// <since_tizen> 3 </since_tizen>
1034 public Position PivotPoint
1038 Position tmp = (Position)GetValue(PivotPointProperty);
1039 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1043 SetValue(PivotPointProperty, value);
1044 NotifyPropertyChanged();
1049 /// Gets or sets the size width of the view.
1053 /// Animatable - This property can be animated using <c>Animation</c> class.
1056 /// <since_tizen> 3 </since_tizen>
1057 public float SizeWidth
1061 return (float)GetValue(SizeWidthProperty);
1065 SetValue(SizeWidthProperty, value);
1066 NotifyPropertyChanged();
1071 /// Gets or sets the size height of the view.
1075 /// Animatable - This property can be animated using <c>Animation</c> class.
1078 /// <since_tizen> 3 </since_tizen>
1079 public float SizeHeight
1083 return (float)GetValue(SizeHeightProperty);
1087 SetValue(SizeHeightProperty, value);
1088 NotifyPropertyChanged();
1093 /// Gets or sets the position of the view.<br />
1094 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1095 /// If the position inheritance is disabled, sets the world position.<br />
1099 /// Animatable - This property can be animated using <c>Animation</c> class.
1101 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1103 /// <since_tizen> 3 </since_tizen>
1104 public Position Position
1108 Position tmp = (Position)GetValue(PositionProperty);
1109 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1113 SetValue(PositionProperty, value);
1114 NotifyPropertyChanged();
1119 /// Gets or sets the position X of the view.
1123 /// Animatable - This property can be animated using <c>Animation</c> class.
1126 /// <since_tizen> 3 </since_tizen>
1127 public float PositionX
1131 return (float)GetValue(PositionXProperty);
1135 SetValue(PositionXProperty, value);
1136 NotifyPropertyChanged();
1141 /// Gets or sets the position Y of the view.
1145 /// Animatable - This property can be animated using <c>Animation</c> class.
1148 /// <since_tizen> 3 </since_tizen>
1149 public float PositionY
1153 return (float)GetValue(PositionYProperty);
1157 SetValue(PositionYProperty, value);
1158 NotifyPropertyChanged();
1163 /// Gets or sets the position Z of the view.
1167 /// Animatable - This property can be animated using <c>Animation</c> class.
1170 /// <since_tizen> 3 </since_tizen>
1171 public float PositionZ
1175 return (float)GetValue(PositionZProperty);
1179 SetValue(PositionZProperty, value);
1180 NotifyPropertyChanged();
1185 /// Gets or sets the world position of the view.
1187 /// <since_tizen> 3 </since_tizen>
1188 public Vector3 WorldPosition
1192 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1193 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1199 /// Gets or sets the orientation of the view.<br />
1200 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1204 /// This is an asynchronous method.
1207 /// Animatable - This property can be animated using <c>Animation</c> class.
1210 /// <since_tizen> 3 </since_tizen>
1211 public Rotation Orientation
1215 return (Rotation)GetValue(OrientationProperty);
1219 SetValue(OrientationProperty, value);
1220 NotifyPropertyChanged();
1225 /// Gets or sets the world orientation of the view.<br />
1227 /// <since_tizen> 3 </since_tizen>
1228 public Rotation WorldOrientation
1232 Rotation temp = new Rotation();
1233 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1239 /// Gets or sets the scale factor applied to the view.<br />
1243 /// Animatable - This property can be animated using <c>Animation</c> class.
1245 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1247 /// <since_tizen> 3 </since_tizen>
1248 public Vector3 Scale
1252 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1253 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1257 SetValue(ScaleProperty, value);
1258 NotifyPropertyChanged();
1263 /// Gets or sets the scale X factor applied to the view.
1267 /// Animatable - This property can be animated using <c>Animation</c> class.
1270 /// <since_tizen> 3 </since_tizen>
1275 return (float)GetValue(ScaleXProperty);
1279 SetValue(ScaleXProperty, value);
1280 NotifyPropertyChanged();
1285 /// Gets or sets the scale Y factor applied to the view.
1289 /// Animatable - This property can be animated using <c>Animation</c> class.
1292 /// <since_tizen> 3 </since_tizen>
1297 return (float)GetValue(ScaleYProperty);
1301 SetValue(ScaleYProperty, value);
1302 NotifyPropertyChanged();
1307 /// Gets or sets the scale Z factor applied to the view.
1311 /// Animatable - This property can be animated using <c>Animation</c> class.
1314 /// <since_tizen> 3 </since_tizen>
1319 return (float)GetValue(ScaleZProperty);
1323 SetValue(ScaleZProperty, value);
1324 NotifyPropertyChanged();
1329 /// Gets the world scale of the view.
1331 /// <since_tizen> 3 </since_tizen>
1332 public Vector3 WorldScale
1336 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1337 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1343 /// Retrieves the visibility flag of the view.
1347 /// If the view is not visible, then the view and its children will not be rendered.
1348 /// 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.
1351 /// Animatable - This property can be animated using <c>Animation</c> class.
1354 /// <since_tizen> 3 </since_tizen>
1355 public bool Visibility
1360 GetProperty(View.Property.VISIBLE).Get(out temp);
1366 /// Gets the view's world color.
1368 /// <since_tizen> 3 </since_tizen>
1369 public Vector4 WorldColor
1373 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1374 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1380 /// Gets or sets the view's name.
1382 /// <since_tizen> 3 </since_tizen>
1387 return (string)GetValue(NameProperty);
1391 SetValue(NameProperty, value);
1392 NotifyPropertyChanged();
1397 /// Get the number of children held by the view.
1399 /// <since_tizen> 3 </since_tizen>
1400 public new uint ChildCount
1404 return GetChildCount();
1409 /// Gets the view's ID.
1412 /// <since_tizen> 3 </since_tizen>
1422 /// Gets or sets the status of whether the view should emit touch or hover signals.
1424 /// <since_tizen> 3 </since_tizen>
1425 public bool Sensitive
1429 return (bool)GetValue(SensitiveProperty);
1433 SetValue(SensitiveProperty, value);
1434 NotifyPropertyChanged();
1439 /// 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.
1441 /// <since_tizen> 3 </since_tizen>
1442 public bool LeaveRequired
1446 return (bool)GetValue(LeaveRequiredProperty);
1450 SetValue(LeaveRequiredProperty, value);
1451 NotifyPropertyChanged();
1456 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1458 /// <since_tizen> 3 </since_tizen>
1459 public bool InheritOrientation
1463 return (bool)GetValue(InheritOrientationProperty);
1467 SetValue(InheritOrientationProperty, value);
1468 NotifyPropertyChanged();
1473 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1475 /// <since_tizen> 3 </since_tizen>
1476 public bool InheritScale
1480 return (bool)GetValue(InheritScaleProperty);
1484 SetValue(InheritScaleProperty, value);
1485 NotifyPropertyChanged();
1490 /// Gets or sets the status of how the view and its children should be drawn.<br />
1491 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1492 /// 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 />
1493 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1494 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1495 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1497 /// <since_tizen> 3 </since_tizen>
1498 public DrawModeType DrawMode
1502 return (DrawModeType)GetValue(DrawModeProperty);
1506 SetValue(DrawModeProperty, value);
1507 NotifyPropertyChanged();
1512 /// Gets or sets the relative to parent size factor of the view.<br />
1513 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1514 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1517 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1519 /// <since_tizen> 3 </since_tizen>
1520 public Vector3 SizeModeFactor
1524 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1525 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1529 SetValue(SizeModeFactorProperty, value);
1530 NotifyPropertyChanged();
1535 /// Gets or sets the width resize policy to be used.
1537 /// <since_tizen> 3 </since_tizen>
1538 public ResizePolicyType WidthResizePolicy
1542 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1546 SetValue(WidthResizePolicyProperty, value);
1547 NotifyPropertyChanged();
1552 /// Gets or sets the height resize policy to be used.
1554 /// <since_tizen> 3 </since_tizen>
1555 public ResizePolicyType HeightResizePolicy
1559 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1563 SetValue(HeightResizePolicyProperty, value);
1564 NotifyPropertyChanged();
1569 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1570 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1572 /// <since_tizen> 3 </since_tizen>
1573 public SizeScalePolicyType SizeScalePolicy
1577 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1581 SetValue(SizeScalePolicyProperty, value);
1582 NotifyPropertyChanged();
1587 /// Gets or sets the status of whether the width size is dependent on the height size.
1589 /// <since_tizen> 3 </since_tizen>
1590 public bool WidthForHeight
1594 return (bool)GetValue(WidthForHeightProperty);
1598 SetValue(WidthForHeightProperty, value);
1599 NotifyPropertyChanged();
1604 /// Gets or sets the status of whether the height size is dependent on the width size.
1606 /// <since_tizen> 3 </since_tizen>
1607 public bool HeightForWidth
1611 return (bool)GetValue(HeightForWidthProperty);
1615 SetValue(HeightForWidthProperty, value);
1616 NotifyPropertyChanged();
1621 /// Gets or sets the padding for use in layout.
1624 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1626 /// <since_tizen> 5 </since_tizen>
1627 public Extents Padding
1631 // If View has a Layout then padding in stored in the base Layout class
1634 return Layout.Padding;
1638 Extents temp = (Extents)GetValue(PaddingProperty);
1639 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1641 // Two return points to prevent creating a zeroed Extent native object before assignment
1645 Extents padding = value;
1648 // Layout set so store Padding in LayoutItem instead of in View.
1649 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1650 // the position and sizes measure in the Layouting.
1651 Layout.Padding = value;
1652 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1653 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1654 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1656 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1660 SetValue(PaddingProperty, padding);
1661 NotifyPropertyChanged();
1666 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1669 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1671 /// <since_tizen> 3 </since_tizen>
1672 public Size2D MinimumSize
1676 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1677 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1681 if (_layout != null)
1683 // Note: it only works if minimum size is >= than natural size.
1684 // To force the size it should be done through the width&height spec or Size2D.
1685 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1686 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1687 _layout.RequestLayout();
1689 SetValue(MinimumSizeProperty, value);
1690 NotifyPropertyChanged();
1695 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1698 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1700 /// <since_tizen> 3 </since_tizen>
1701 public Size2D MaximumSize
1705 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1706 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1710 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1711 // MATCH_PARENT spec + parent container size can be used to limit
1712 if (_layout != null)
1714 _layout.RequestLayout();
1716 SetValue(MaximumSizeProperty, value);
1717 NotifyPropertyChanged();
1722 /// Gets or sets whether a child view inherits it's parent's position.<br />
1723 /// Default is to inherit.<br />
1724 /// 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 />
1726 /// <since_tizen> 3 </since_tizen>
1727 public bool InheritPosition
1731 return (bool)GetValue(InheritPositionProperty);
1735 SetValue(InheritPositionProperty, value);
1736 NotifyPropertyChanged();
1741 /// Gets or sets the clipping behavior (mode) of it's children.
1743 /// <since_tizen> 3 </since_tizen>
1744 public ClippingModeType ClippingMode
1748 return (ClippingModeType)GetValue(ClippingModeProperty);
1752 SetValue(ClippingModeProperty, value);
1753 NotifyPropertyChanged();
1758 /// Gets the number of renderers held by the view.
1760 /// <since_tizen> 3 </since_tizen>
1761 public uint RendererCount
1765 return GetRendererCount();
1770 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1773 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1775 /// <since_tizen> 3 </since_tizen>
1776 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1778 "View view = new View(); " +
1779 "view.PivotPoint = PivotPoint.Center; " +
1780 "view.PositionUsesPivotPoint = true;")]
1781 [EditorBrowsable(EditorBrowsableState.Never)]
1782 public Position AnchorPoint
1786 Position temp = new Position(0.0f, 0.0f, 0.0f);
1787 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1788 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1792 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1793 NotifyPropertyChanged();
1798 /// Sets the size of a view for the width, the height and the depth.<br />
1799 /// Geometry can be scaled to fit within this area.<br />
1800 /// This does not interfere with the view's scale factor.<br />
1801 /// The views default depth is the minimum of width and height.<br />
1805 /// Animatable - This property can be animated using <c>Animation</c> class.
1807 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1809 /// <since_tizen> 5 </since_tizen>
1814 Size tmp = (Size)GetValue(SizeProperty);
1815 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1819 SetValue(SizeProperty, value);
1820 NotifyPropertyChanged();
1825 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1827 /// <since_tizen> 3 </since_tizen>
1828 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1830 "Container parent = view.GetParent(); " +
1831 "View view = parent as View;")]
1832 [EditorBrowsable(EditorBrowsableState.Never)]
1833 public new View Parent
1838 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1839 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1840 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1842 if (basehandle is Layer layer)
1844 ret = new View(Layer.getCPtr(layer).Handle, false);
1845 NUILog.Error("This Parent property is deprecated, should do not be used");
1849 ret = basehandle as View;
1852 Interop.BaseHandle.delete_BaseHandle(CPtr);
1853 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1855 if (NDalicPINVOKE.SWIGPendingException.Pending)
1856 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1862 /// Gets/Sets whether inherit parent's the layout Direction.
1864 /// <since_tizen> 4 </since_tizen>
1865 public bool InheritLayoutDirection
1869 return (bool)GetValue(InheritLayoutDirectionProperty);
1873 SetValue(InheritLayoutDirectionProperty, value);
1874 NotifyPropertyChanged();
1879 /// Gets/Sets the layout Direction.
1881 /// <since_tizen> 4 </since_tizen>
1882 public ViewLayoutDirectionType LayoutDirection
1886 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1890 SetValue(LayoutDirectionProperty, value);
1891 NotifyPropertyChanged();
1892 _layout?.RequestLayout();
1897 /// Gets or sets the Margin for use in layout.
1900 /// Margin property is supported by Layout algorithms and containers.
1901 /// Please Set Layout if you want to use Margin property.
1902 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1904 /// <since_tizen> 4 </since_tizen>
1905 public Extents Margin
1909 // If View has a Layout then margin is stored in Layout.
1912 return Layout.Margin;
1916 // If Layout not set then return margin stored in View.
1917 Extents temp = (Extents)GetValue(MarginProperty);
1918 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1920 // Two return points to prevent creating a zeroed Extent native object before assignment
1926 // Layout set so store Margin in LayoutItem instead of View.
1927 // If View stores the Margin too then the Legacy Size Negotiation will
1928 // overwrite the position and size values measured in the Layouting.
1929 Layout.Margin = value;
1930 SetValue(MarginProperty, new Extents(0,0,0,0));
1931 _layout?.RequestLayout();
1935 SetValue(MarginProperty, value);
1937 NotifyPropertyChanged();
1938 _layout?.RequestLayout();
1943 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1945 /// <since_tizen> 6 </since_tizen>
1946 public int WidthSpecification
1950 return _widthPolicy;
1954 _widthPolicy = value;
1955 if( _oldWidthPolicy != _widthPolicy )
1957 if (_widthPolicy >= 0)
1959 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1961 if(_heightPolicy>=0) // Policy an exact value
1963 // Create Size2D only both _widthPolicy and _heightPolicy are set.
1964 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1967 _layout?.RequestLayout();
1968 _oldWidthPolicy = _widthPolicy;
1974 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1976 /// <since_tizen> 6 </since_tizen>
1977 public int HeightSpecification
1981 return _heightPolicy;
1985 _heightPolicy = value;
1986 if( _oldHeightPolicy != _heightPolicy )
1988 if (_heightPolicy >= 0)
1990 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1992 if(_widthPolicy>=0) // Policy an exact value
1994 // Create Size2D only both _widthPolicy and _heightPolicy are set.
1995 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1999 _layout?.RequestLayout();
2000 _oldHeightPolicy = _heightPolicy;
2006 /// Gets the List of transitions for this View.
2008 /// <since_tizen> 6 </since_tizen>
2009 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2013 if (_layoutTransitions == null)
2015 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2017 return _layoutTransitions;
2022 /// Set a layout transitions for this View.
2025 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2027 /// <since_tizen> 6 </since_tizen>
2028 public LayoutTransition LayoutTransition
2032 if (_layoutTransitions == null)
2034 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2036 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2038 AttachTransitionsToChildren(value);
2043 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2046 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2048 /// <since_tizen> 4 </since_tizen>
2049 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2050 [EditorBrowsable(EditorBrowsableState.Never)]
2051 public Extents PaddingEX
2055 Extents temp = new Extents(0, 0, 0, 0);
2056 GetProperty(View.Property.PADDING).Get(temp);
2057 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2061 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2062 NotifyPropertyChanged();
2063 _layout?.RequestLayout();
2067 /// <since_tizen> 6 </since_tizen>
2068 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2069 [EditorBrowsable(EditorBrowsableState.Never)]
2070 public Style XamlStyle
2074 return (Style)GetValue(XamlStyleProperty);
2078 SetValue(XamlStyleProperty, value);
2083 /// The Color of View. This is an RGBA value.
2087 /// Animatable - This property can be animated using <c>Animation</c> class.
2089 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2091 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2092 [EditorBrowsable(EditorBrowsableState.Never)]
2097 Color temp = (Color)GetValue(ColorProperty);
2098 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2102 SetValue(ColorProperty, value);
2103 selectorData?.Color.UpdateIfNeeds(this, value);
2104 NotifyPropertyChanged();
2109 /// Set the layout on this View. Replaces any existing Layout.
2111 /// <since_tizen> 6 </since_tizen>
2112 public LayoutItem Layout
2120 // Do nothing if layout provided is already set on this View.
2121 if (value == _layout)
2126 layoutingDisabled = false;
2129 // If new layout being set already has a owner then that owner receives a replacement default layout.
2130 // First check if the layout to be set already has a owner.
2131 if (value?.Owner != null)
2133 // Previous owner of the layout gets a default layout as a replacement.
2134 value.Owner.Layout = new AbsoluteLayout();
2136 // Copy Margin and Padding to replacement LayoutGroup.
2137 if (value.Owner.Layout != null)
2139 value.Owner.Layout.Margin = value.Margin;
2140 value.Owner.Layout.Padding = value.Padding;
2144 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2145 // View if no replacement. Previously margin and padding values would have been moved from
2146 // the View to the layout.
2147 if (_layout != null ) // Existing layout
2151 // Existing layout being replaced so copy over margin and padding values.
2152 value.Margin = _layout.Margin;
2153 value.Padding = _layout.Padding;
2157 // Layout not being replaced so restore margin and padding to View.
2158 SetValue(MarginProperty, _layout.Margin);
2159 SetValue(PaddingProperty, _layout.Padding);
2160 NotifyPropertyChanged();
2165 // First Layout to be added to the View hence copy
2166 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2169 if (Margin.Top != 0 || Margin.Bottom != 0 || Margin.Start != 0 || Margin.End != 0)
2171 // If View already has a margin set then store it in Layout instead.
2172 value.Margin = Margin;
2173 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2174 NotifyPropertyChanged();
2177 if (Padding.Top != 0 || Padding.Bottom != 0 || Padding.Start != 0 || Padding.End != 0)
2179 // If View already has a padding set then store it in Layout instead.
2180 value.Padding = Padding;
2181 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2182 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2183 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType())) // If a Layout container of some kind.
2185 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2186 NotifyPropertyChanged();
2192 // Remove existing layout from it's parent layout group.
2193 _layout?.Unparent();
2195 // Set layout to this view
2201 /// The weight of the View, used to share available space in a layout with siblings.
2203 /// <since_tizen> 6 </since_tizen>
2213 _layout?.RequestLayout();
2218 /// Whether to load the BackgroundImage synchronously.
2219 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2220 /// Note: For Normal Quad images only.
2222 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2223 [EditorBrowsable(EditorBrowsableState.Never)]
2224 public bool BackgroundImageSynchronosLoading
2228 return _backgroundImageSynchronosLoading;
2232 _backgroundImageSynchronosLoading = value;
2234 string bgUrl = null;
2235 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2237 if (!string.IsNullOrEmpty(bgUrl))
2239 PropertyMap bgMap = this.Background;
2240 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2246 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2247 [EditorBrowsable(EditorBrowsableState.Never)]
2248 public Vector2 UpdateSizeHint
2252 return (Vector2)GetValue(UpdateSizeHintProperty);
2256 SetValue(UpdateSizeHintProperty, value);
2257 NotifyPropertyChanged();
2261 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2262 [EditorBrowsable(EditorBrowsableState.Never)]
2263 public string[] TransitionNames
2267 return transitionNames;
2271 transitionNames = value;
2277 /// Enable/Disable ControlState propagation for children.
2278 /// It is false by default.
2279 /// If the View needs to share ControlState with descendants, please set it true.
2280 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2282 [EditorBrowsable(EditorBrowsableState.Never)]
2283 public bool EnableControlStatePropagation
2285 get => controlStatePropagation;
2288 controlStatePropagation = value;
2290 foreach (View child in Children)
2292 child.EnableControlStatePropagation = value;
2298 /// If this property is set to true, the View can have a touch related ControlState (such as Pressed) when touch.
2299 /// By default, it is false in View, true in Control.
2300 /// Note that if the value is true, the View will be a touch receptor.
2302 [EditorBrowsable(EditorBrowsableState.Never)]
2303 public bool EnableControlState
2307 return (bool)GetValue(EnableControlStateProperty);
2311 SetValue(EnableControlStateProperty, value);
2316 /// Whether the actor grab all touches even if touch leaves its boundary.
2318 /// <returns>true, if it grab all touch after start</returns>
2319 [EditorBrowsable(EditorBrowsableState.Never)]
2320 public bool GrabTouchAfterLeave
2325 GetProperty(View.Property.CaptureAllTouchAfterStart).Get(out temp);
2330 SetProperty(View.Property.CaptureAllTouchAfterStart, new Tizen.NUI.PropertyValue(value));
2331 NotifyPropertyChanged();
2336 /// If the value is true, the View will change its style as the theme changes.
2337 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2339 [EditorBrowsable(EditorBrowsableState.Never)]
2340 public bool ThemeChangeSensitive
2342 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2343 set => SetValue(ThemeChangeSensitiveProperty, value);
2347 /// Get Style, it is abstract function and must be override.
2349 /// <since_tizen> 6 </since_tizen>
2350 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2351 // TODO: It should be deprecated. please use CreateViewStyle instead.
2352 [EditorBrowsable(EditorBrowsableState.Never)]
2353 protected virtual ViewStyle GetViewStyle()
2355 return CreateViewStyle();
2359 /// Create Style, it is abstract function and must be override.
2361 [EditorBrowsable(EditorBrowsableState.Never)]
2362 protected virtual ViewStyle CreateViewStyle()
2364 return new ViewStyle();
2368 /// Called after the View's ControlStates changed.
2370 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2371 [EditorBrowsable(EditorBrowsableState.Never)]
2372 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2378 [EditorBrowsable(EditorBrowsableState.Never)]
2379 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2384 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2385 [EditorBrowsable(EditorBrowsableState.Never)]
2386 public virtual void ApplyStyle(ViewStyle viewStyle)
2388 if (null == viewStyle || this.viewStyle == viewStyle) return;
2390 this.viewStyle = viewStyle;
2392 Dictionary<string, BindableProperty> bindablePropertyOfView;
2393 Type viewType = GetType();
2395 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2396 Type styleType = viewStyle.GetType();
2398 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2399 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2401 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2403 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2405 BindableProperty viewProperty;
2406 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2408 if (null != viewProperty && viewProperty != StyleNameProperty)
2410 object value = viewStyle.GetValue(keyValuePair.Value);
2414 SetValue(viewProperty, value);