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 //ToDo: this has memory leak and this is not used currently. will be fixed soon by using Event subscribing pattern.
140 //_onWindowSendEventCallback = SendViewAddedEventToWindow;
141 //this.OnWindowSignal().Connect(_onWindowSendEventCallback);
149 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
151 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
160 /// The event that is triggered when the View's ControlState is changed.
162 [EditorBrowsable(EditorBrowsableState.Never)]
163 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
165 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
167 private ControlState controlStates = ControlState.Normal;
169 /// Get/Set the control state.
171 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
172 [EditorBrowsable(EditorBrowsableState.Never)]
173 public ControlState ControlState
177 return controlStates;
181 if (controlStates == value)
186 var prevState = controlStates;
188 controlStates = value;
190 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
192 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
194 if (controlStatePropagation)
196 foreach (View child in Children)
198 child.ControlState = value;
202 OnControlStateChanged(changeInfo);
204 ControlStateChangedEvent?.Invoke(this, changeInfo);
208 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
209 [EditorBrowsable(EditorBrowsableState.Never)]
210 public bool IsResourcesCreated
214 return Application.Current.IsResourcesCreated;
218 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
219 [EditorBrowsable(EditorBrowsableState.Never)]
220 public ResourceDictionary XamlResources
224 return Application.Current.XamlResources;
228 Application.Current.XamlResources = value;
233 /// The StyleName, type string.
234 /// The value indicates DALi style name defined in json theme file.
236 /// <since_tizen> 3 </since_tizen>
237 public string StyleName
241 return (string)GetValue(StyleNameProperty);
245 SetValue(StyleNameProperty, value);
246 NotifyPropertyChanged();
251 /// The KeyInputFocus, type bool.
253 [EditorBrowsable(EditorBrowsableState.Never)]
254 public bool KeyInputFocus
258 return (bool)GetValue(KeyInputFocusProperty);
262 SetValue(KeyInputFocusProperty, value);
263 NotifyPropertyChanged();
268 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
271 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
273 /// <since_tizen> 3 </since_tizen>
274 public Color BackgroundColor
278 Color temp = (Color)GetValue(BackgroundColorProperty);
279 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
283 SetValue(BackgroundColorProperty, value);
284 if (selectorData != null)
286 selectorData.BackgroundImage.Reset(this);
287 selectorData.BackgroundColor.UpdateIfNeeds(this, value);
289 NotifyPropertyChanged();
294 /// The mutually exclusive with "backgroundColor" and "background" type Map.
296 /// <since_tizen> 3 </since_tizen>
297 public string BackgroundImage
301 return (string)GetValue(BackgroundImageProperty);
305 SetValue(BackgroundImageProperty, value);
306 if (selectorData != null)
308 selectorData.BackgroundColor.Reset(this);
309 selectorData.BackgroundImage.UpdateIfNeeds(this, value);
311 NotifyPropertyChanged();
316 /// Get or set the border of background image.
318 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
319 [EditorBrowsable(EditorBrowsableState.Never)]
320 public Rectangle BackgroundImageBorder
324 return (Rectangle)GetValue(BackgroundImageBorderProperty);
328 SetValue(BackgroundImageBorderProperty, value);
329 selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value);
330 NotifyPropertyChanged();
335 /// The background of view.
337 /// <since_tizen> 3 </since_tizen>
338 public Tizen.NUI.PropertyMap Background
342 return (PropertyMap)GetValue(BackgroundProperty);
346 SetValue(BackgroundProperty, value);
347 NotifyPropertyChanged();
352 /// Describes a shadow as an image for a View.
353 /// It is null by default.
356 /// Getter returns copied instance of current shadow.
359 /// The mutually exclusive with "BoxShadow".
361 [EditorBrowsable(EditorBrowsableState.Never)]
362 public ImageShadow ImageShadow
366 return (ImageShadow)GetValue(ImageShadowProperty);
370 SetValue(ImageShadowProperty, value);
371 if (selectorData != null)
373 selectorData.BoxShadow.Reset(this);
374 selectorData.ImageShadow.UpdateIfNeeds(this, value);
376 NotifyPropertyChanged();
381 /// Describes a box shaped shadow drawing for a View.
382 /// It is null by default.
385 /// Gettter returns copied instance of current shadow.
388 /// The mutually exclusive with "ImageShadow".
390 [EditorBrowsable(EditorBrowsableState.Never)]
391 public Shadow BoxShadow
395 return (Shadow)GetValue(BoxShadowProperty);
399 SetValue(BoxShadowProperty, value);
400 if (selectorData != null)
402 selectorData.ImageShadow.Reset(this);
403 selectorData.BoxShadow.UpdateIfNeeds(this, value);
405 NotifyPropertyChanged();
410 /// The radius for the rounded corners of the View.
411 /// This will rounds background and shadow edges.
412 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
414 [EditorBrowsable(EditorBrowsableState.Never)]
415 public float CornerRadius
419 return (float)GetValue(CornerRadiusProperty);
423 SetValue(CornerRadiusProperty, value);
424 selectorData?.CornerRadius.UpdateIfNeeds(this, value);
425 NotifyPropertyChanged();
430 /// The current state of the view.
432 /// <since_tizen> 3 </since_tizen>
437 return (States)GetValue(StateProperty);
441 SetValue(StateProperty, value);
442 NotifyPropertyChanged();
447 /// The current sub state of the view.
449 /// <since_tizen> 3 </since_tizen>
450 public States SubState
454 return (States)GetValue(SubStateProperty);
458 SetValue(SubStateProperty, value);
459 NotifyPropertyChanged();
464 /// Displays a tooltip
466 /// <since_tizen> 3 </since_tizen>
467 public Tizen.NUI.PropertyMap Tooltip
471 return (PropertyMap)GetValue(TooltipProperty);
475 SetValue(TooltipProperty, value);
476 NotifyPropertyChanged();
481 /// Displays a tooltip as a text.
483 /// <since_tizen> 3 </since_tizen>
484 public string TooltipText
488 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
489 NotifyPropertyChanged();
494 /// The Child property of FlexContainer.<br />
495 /// The proportion of the free space in the container, the flex item will receive.<br />
496 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
498 /// <since_tizen> 3 </since_tizen>
499 [Obsolete("Deprecated in API8, will be removed in API10.")]
504 return (float)GetValue(FlexProperty);
508 SetValue(FlexProperty, value);
509 NotifyPropertyChanged();
514 /// The Child property of FlexContainer.<br />
515 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
517 /// <since_tizen> 3 </since_tizen>
518 [Obsolete("Deprecated in API8, will be removed in API10.")]
523 return (int)GetValue(AlignSelfProperty);
527 SetValue(AlignSelfProperty, value);
528 NotifyPropertyChanged();
533 /// The Child property of FlexContainer.<br />
534 /// The space around the flex item.<br />
537 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
539 /// <since_tizen> 3 </since_tizen>
540 [Obsolete("Deprecated in API8, will be removed in API10.")]
541 public Vector4 FlexMargin
545 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
546 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
550 SetValue(FlexMarginProperty, value);
551 NotifyPropertyChanged();
556 /// The top-left cell this child occupies, if not set, the first available cell is used.
559 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
561 /// <since_tizen> 3 </since_tizen>
562 public Vector2 CellIndex
566 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
567 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
571 SetValue(CellIndexProperty, value);
572 NotifyPropertyChanged();
577 /// The number of rows this child occupies, if not set, the default value is 1.
579 /// <since_tizen> 3 </since_tizen>
584 return (float)GetValue(RowSpanProperty);
588 SetValue(RowSpanProperty, value);
589 NotifyPropertyChanged();
594 /// The number of columns this child occupies, if not set, the default value is 1.
596 /// <since_tizen> 3 </since_tizen>
597 public float ColumnSpan
601 return (float)GetValue(ColumnSpanProperty);
605 SetValue(ColumnSpanProperty, value);
606 NotifyPropertyChanged();
611 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
613 /// <since_tizen> 3 </since_tizen>
614 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
618 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
622 SetValue(CellHorizontalAlignmentProperty, value);
623 NotifyPropertyChanged();
628 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
630 /// <since_tizen> 3 </since_tizen>
631 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
635 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
639 SetValue(CellVerticalAlignmentProperty, value);
640 NotifyPropertyChanged();
645 /// The left focusable view.<br />
646 /// This will return null if not set.<br />
647 /// This will also return null if the specified left focusable view is not on a window.<br />
649 /// <since_tizen> 3 </since_tizen>
650 public View LeftFocusableView
652 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
655 return (View)GetValue(LeftFocusableViewProperty);
659 SetValue(LeftFocusableViewProperty, value);
660 NotifyPropertyChanged();
665 /// The right focusable view.<br />
666 /// This will return null if not set.<br />
667 /// This will also return null if the specified right focusable view is not on a window.<br />
669 /// <since_tizen> 3 </since_tizen>
670 public View RightFocusableView
672 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
675 return (View)GetValue(RightFocusableViewProperty);
679 SetValue(RightFocusableViewProperty, value);
680 NotifyPropertyChanged();
685 /// The up focusable view.<br />
686 /// This will return null if not set.<br />
687 /// This will also return null if the specified up focusable view is not on a window.<br />
689 /// <since_tizen> 3 </since_tizen>
690 public View UpFocusableView
692 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
695 return (View)GetValue(UpFocusableViewProperty);
699 SetValue(UpFocusableViewProperty, value);
700 NotifyPropertyChanged();
705 /// The down focusable view.<br />
706 /// This will return null if not set.<br />
707 /// This will also return null if the specified down focusable view is not on a window.<br />
709 /// <since_tizen> 3 </since_tizen>
710 public View DownFocusableView
712 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
715 return (View)GetValue(DownFocusableViewProperty);
719 SetValue(DownFocusableViewProperty, value);
720 NotifyPropertyChanged();
725 /// Whether the view should be focusable by keyboard navigation.
727 /// <since_tizen> 3 </since_tizen>
728 public bool Focusable
732 SetValue(FocusableProperty, value);
733 NotifyPropertyChanged();
737 return (bool)GetValue(FocusableProperty);
742 /// Retrieves the position of the view.<br />
743 /// The coordinates are relative to the view's parent.<br />
745 /// <since_tizen> 3 </since_tizen>
746 public Position CurrentPosition
750 return GetCurrentPosition();
755 /// Sets the size of a view for the width and the height.<br />
756 /// Geometry can be scaled to fit within this area.<br />
757 /// This does not interfere with the view's scale factor.<br />
758 /// The views default depth is the minimum of width and height.<br />
761 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
762 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
764 /// <since_tizen> 3 </since_tizen>
769 Size2D temp = (Size2D)GetValue(Size2DProperty);
770 int width = temp.Width;
771 int height = temp.Height;
773 if (this.Layout == null)
775 if (width < 0) { width = 0; }
776 if (height < 0) { height = 0; }
779 return new Size2D(OnSize2DChanged, width, height);
783 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
784 SetValue(Size2DProperty, value);
785 // Set Specification so when layouts measure this View it matches the value set here.
786 // All Views are currently Layouts.
787 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
788 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
789 _widthPolicy = value.Width;
790 _heightPolicy = value.Height;
792 _layout?.RequestLayout();
793 NotifyPropertyChanged();
798 /// Retrieves the size of the view.<br />
799 /// The coordinates are relative to the view's parent.<br />
801 /// <since_tizen> 3 </since_tizen>
802 public Size2D CurrentSize
806 return GetCurrentSize();
811 /// Retrieves and sets the view's opacity.<br />
813 /// <since_tizen> 3 </since_tizen>
818 return (float)GetValue(OpacityProperty);
822 SetValue(OpacityProperty, value);
823 selectorData?.Opacity.UpdateIfNeeds(this, value);
824 NotifyPropertyChanged();
829 /// Sets the position of the view for X and Y.<br />
830 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
831 /// If the position inheritance is disabled, sets the world position.<br />
834 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
835 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
837 /// <since_tizen> 3 </since_tizen>
838 public Position2D Position2D
842 Position2D temp = (Position2D)GetValue(Position2DProperty);
843 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
847 SetValue(Position2DProperty, value);
848 NotifyPropertyChanged();
853 /// Retrieves the screen postion of the view.<br />
855 /// <since_tizen> 3 </since_tizen>
856 public Vector2 ScreenPosition
860 Vector2 temp = new Vector2(0.0f, 0.0f);
861 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
867 /// Determines whether the pivot point should be used to determine the position of the view.
868 /// This is false by default.
870 /// <remarks>If false, then the top-left of the view is used for the position.
871 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
873 /// <since_tizen> 3 </since_tizen>
874 public bool PositionUsesPivotPoint
878 return (bool)GetValue(PositionUsesPivotPointProperty);
882 SetValue(PositionUsesPivotPointProperty, value);
883 NotifyPropertyChanged();
888 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
890 /// <since_tizen> 3 </since_tizen>
891 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
893 "View view = new View(); " +
894 "view.PivotPoint = PivotPoint.Center; " +
895 "view.PositionUsesPivotPoint = true;" +
896 " Deprecated in API5: Will be removed in API8")]
897 [EditorBrowsable(EditorBrowsableState.Never)]
898 public bool PositionUsesAnchorPoint
903 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
908 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
909 NotifyPropertyChanged();
914 /// Queries whether the view is connected to the stage.<br />
915 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
917 /// <since_tizen> 3 </since_tizen>
918 public bool IsOnWindow
927 /// Gets the depth in the hierarchy for the view.
929 /// <since_tizen> 3 </since_tizen>
930 public int HierarchyDepth
934 return GetHierarchyDepth();
939 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
942 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
943 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
944 /// The values set by this property will likely change.
946 /// <since_tizen> 3 </since_tizen>
947 public int SiblingOrder
951 return (int)GetValue(SiblingOrderProperty);
955 SetValue(SiblingOrderProperty, value);
957 LayoutGroup layout = Layout as LayoutGroup;
958 layout?.ChangeLayoutSiblingOrder(value);
960 NotifyPropertyChanged();
965 /// Returns the natural size of the view.
968 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
970 /// <since_tizen> 5 </since_tizen>
971 public Vector3 NaturalSize
975 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
976 if (NDalicPINVOKE.SWIGPendingException.Pending)
977 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
983 /// Returns the natural size (Size2D) of the view.
986 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
988 /// <since_tizen> 4 </since_tizen>
989 public Size2D NaturalSize2D
993 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
994 if (NDalicPINVOKE.SWIGPendingException.Pending)
995 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
997 return new Size2D((int)temp.Width, (int)temp.Height);
1002 /// Gets or sets the origin of a view within its parent's area.<br />
1003 /// 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 />
1004 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1005 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1007 /// <pre>The view has been initialized.</pre>
1008 /// <since_tizen> 3 </since_tizen>
1009 public Position ParentOrigin
1013 Position tmp = (Position)GetValue(ParentOriginProperty);
1014 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1018 SetValue(ParentOriginProperty, value);
1019 NotifyPropertyChanged();
1024 /// Gets or sets the anchor-point of a view.<br />
1025 /// 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 />
1026 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1027 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1028 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1029 /// <pre>The view has been initialized.</pre>
1032 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1034 /// <since_tizen> 3 </since_tizen>
1035 public Position PivotPoint
1039 Position tmp = (Position)GetValue(PivotPointProperty);
1040 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1044 SetValue(PivotPointProperty, value);
1045 NotifyPropertyChanged();
1050 /// Gets or sets the size width of the view.
1054 /// Animatable - This property can be animated using <c>Animation</c> class.
1057 /// <since_tizen> 3 </since_tizen>
1058 public float SizeWidth
1062 return (float)GetValue(SizeWidthProperty);
1066 SetValue(SizeWidthProperty, value);
1067 NotifyPropertyChanged();
1072 /// Gets or sets the size height of the view.
1076 /// Animatable - This property can be animated using <c>Animation</c> class.
1079 /// <since_tizen> 3 </since_tizen>
1080 public float SizeHeight
1084 return (float)GetValue(SizeHeightProperty);
1088 SetValue(SizeHeightProperty, value);
1089 NotifyPropertyChanged();
1094 /// Gets or sets the position of the view.<br />
1095 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1096 /// If the position inheritance is disabled, sets the world position.<br />
1100 /// Animatable - This property can be animated using <c>Animation</c> class.
1102 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1104 /// <since_tizen> 3 </since_tizen>
1105 public Position Position
1109 Position tmp = (Position)GetValue(PositionProperty);
1110 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1114 SetValue(PositionProperty, value);
1115 NotifyPropertyChanged();
1120 /// Gets or sets the position X of the view.
1124 /// Animatable - This property can be animated using <c>Animation</c> class.
1127 /// <since_tizen> 3 </since_tizen>
1128 public float PositionX
1132 return (float)GetValue(PositionXProperty);
1136 SetValue(PositionXProperty, value);
1137 NotifyPropertyChanged();
1142 /// Gets or sets the position Y of the view.
1146 /// Animatable - This property can be animated using <c>Animation</c> class.
1149 /// <since_tizen> 3 </since_tizen>
1150 public float PositionY
1154 return (float)GetValue(PositionYProperty);
1158 SetValue(PositionYProperty, value);
1159 NotifyPropertyChanged();
1164 /// Gets or sets the position Z of the view.
1168 /// Animatable - This property can be animated using <c>Animation</c> class.
1171 /// <since_tizen> 3 </since_tizen>
1172 public float PositionZ
1176 return (float)GetValue(PositionZProperty);
1180 SetValue(PositionZProperty, value);
1181 NotifyPropertyChanged();
1186 /// Gets or sets the world position of the view.
1188 /// <since_tizen> 3 </since_tizen>
1189 public Vector3 WorldPosition
1193 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1194 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1200 /// Gets or sets the orientation of the view.<br />
1201 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1205 /// This is an asynchronous method.
1208 /// Animatable - This property can be animated using <c>Animation</c> class.
1211 /// <since_tizen> 3 </since_tizen>
1212 public Rotation Orientation
1216 return (Rotation)GetValue(OrientationProperty);
1220 SetValue(OrientationProperty, value);
1221 NotifyPropertyChanged();
1226 /// Gets or sets the world orientation of the view.<br />
1228 /// <since_tizen> 3 </since_tizen>
1229 public Rotation WorldOrientation
1233 Rotation temp = new Rotation();
1234 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1240 /// Gets or sets the scale factor applied to the view.<br />
1244 /// Animatable - This property can be animated using <c>Animation</c> class.
1246 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1248 /// <since_tizen> 3 </since_tizen>
1249 public Vector3 Scale
1253 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1254 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1258 SetValue(ScaleProperty, value);
1259 NotifyPropertyChanged();
1264 /// Gets or sets the scale X factor applied to the view.
1268 /// Animatable - This property can be animated using <c>Animation</c> class.
1271 /// <since_tizen> 3 </since_tizen>
1276 return (float)GetValue(ScaleXProperty);
1280 SetValue(ScaleXProperty, value);
1281 NotifyPropertyChanged();
1286 /// Gets or sets the scale Y factor applied to the view.
1290 /// Animatable - This property can be animated using <c>Animation</c> class.
1293 /// <since_tizen> 3 </since_tizen>
1298 return (float)GetValue(ScaleYProperty);
1302 SetValue(ScaleYProperty, value);
1303 NotifyPropertyChanged();
1308 /// Gets or sets the scale Z factor applied to the view.
1312 /// Animatable - This property can be animated using <c>Animation</c> class.
1315 /// <since_tizen> 3 </since_tizen>
1320 return (float)GetValue(ScaleZProperty);
1324 SetValue(ScaleZProperty, value);
1325 NotifyPropertyChanged();
1330 /// Gets the world scale of the view.
1332 /// <since_tizen> 3 </since_tizen>
1333 public Vector3 WorldScale
1337 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1338 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1344 /// Retrieves the visibility flag of the view.
1348 /// If the view is not visible, then the view and its children will not be rendered.
1349 /// 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.
1352 /// Animatable - This property can be animated using <c>Animation</c> class.
1355 /// <since_tizen> 3 </since_tizen>
1356 public bool Visibility
1361 GetProperty(View.Property.VISIBLE).Get(out temp);
1367 /// Gets the view's world color.
1369 /// <since_tizen> 3 </since_tizen>
1370 public Vector4 WorldColor
1374 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1375 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1381 /// Gets or sets the view's name.
1383 /// <since_tizen> 3 </since_tizen>
1388 return (string)GetValue(NameProperty);
1392 SetValue(NameProperty, value);
1393 NotifyPropertyChanged();
1398 /// Get the number of children held by the view.
1400 /// <since_tizen> 3 </since_tizen>
1401 public new uint ChildCount
1405 return GetChildCount();
1410 /// Gets the view's ID.
1413 /// <since_tizen> 3 </since_tizen>
1423 /// Gets or sets the status of whether the view should emit touch or hover signals.
1425 /// <since_tizen> 3 </since_tizen>
1426 public bool Sensitive
1430 return (bool)GetValue(SensitiveProperty);
1434 SetValue(SensitiveProperty, value);
1435 NotifyPropertyChanged();
1440 /// 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.
1442 /// <since_tizen> 3 </since_tizen>
1443 public bool LeaveRequired
1447 return (bool)GetValue(LeaveRequiredProperty);
1451 SetValue(LeaveRequiredProperty, value);
1452 NotifyPropertyChanged();
1457 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1459 /// <since_tizen> 3 </since_tizen>
1460 public bool InheritOrientation
1464 return (bool)GetValue(InheritOrientationProperty);
1468 SetValue(InheritOrientationProperty, value);
1469 NotifyPropertyChanged();
1474 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1476 /// <since_tizen> 3 </since_tizen>
1477 public bool InheritScale
1481 return (bool)GetValue(InheritScaleProperty);
1485 SetValue(InheritScaleProperty, value);
1486 NotifyPropertyChanged();
1491 /// Gets or sets the status of how the view and its children should be drawn.<br />
1492 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1493 /// 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 />
1494 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1495 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1496 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1498 /// <since_tizen> 3 </since_tizen>
1499 public DrawModeType DrawMode
1503 return (DrawModeType)GetValue(DrawModeProperty);
1507 SetValue(DrawModeProperty, value);
1508 NotifyPropertyChanged();
1513 /// Gets or sets the relative to parent size factor of the view.<br />
1514 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1515 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1518 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1520 /// <since_tizen> 3 </since_tizen>
1521 public Vector3 SizeModeFactor
1525 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1526 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1530 SetValue(SizeModeFactorProperty, value);
1531 NotifyPropertyChanged();
1536 /// Gets or sets the width resize policy to be used.
1538 /// <since_tizen> 3 </since_tizen>
1539 public ResizePolicyType WidthResizePolicy
1543 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1547 SetValue(WidthResizePolicyProperty, value);
1548 NotifyPropertyChanged();
1553 /// Gets or sets the height resize policy to be used.
1555 /// <since_tizen> 3 </since_tizen>
1556 public ResizePolicyType HeightResizePolicy
1560 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1564 SetValue(HeightResizePolicyProperty, value);
1565 NotifyPropertyChanged();
1570 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1571 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1573 /// <since_tizen> 3 </since_tizen>
1574 public SizeScalePolicyType SizeScalePolicy
1578 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1582 SetValue(SizeScalePolicyProperty, value);
1583 NotifyPropertyChanged();
1588 /// Gets or sets the status of whether the width size is dependent on the height size.
1590 /// <since_tizen> 3 </since_tizen>
1591 public bool WidthForHeight
1595 return (bool)GetValue(WidthForHeightProperty);
1599 SetValue(WidthForHeightProperty, value);
1600 NotifyPropertyChanged();
1605 /// Gets or sets the status of whether the height size is dependent on the width size.
1607 /// <since_tizen> 3 </since_tizen>
1608 public bool HeightForWidth
1612 return (bool)GetValue(HeightForWidthProperty);
1616 SetValue(HeightForWidthProperty, value);
1617 NotifyPropertyChanged();
1622 /// Gets or sets the padding for use in layout.
1625 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1627 /// <since_tizen> 5 </since_tizen>
1628 public Extents Padding
1632 // If View has a Layout then padding in stored in the base Layout class
1635 return Layout.Padding;
1639 Extents temp = (Extents)GetValue(PaddingProperty);
1640 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1642 // Two return points to prevent creating a zeroed Extent native object before assignment
1646 Extents padding = value;
1649 // Layout set so store Padding in LayoutItem instead of in View.
1650 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1651 // the position and sizes measure in the Layouting.
1652 Layout.Padding = value;
1653 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1654 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1655 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1657 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1661 SetValue(PaddingProperty, padding);
1662 NotifyPropertyChanged();
1667 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1670 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1672 /// <since_tizen> 3 </since_tizen>
1673 public Size2D MinimumSize
1677 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1678 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1682 if (_layout != null)
1684 // Note: it only works if minimum size is >= than natural size.
1685 // To force the size it should be done through the width&height spec or Size2D.
1686 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1687 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1688 _layout.RequestLayout();
1690 SetValue(MinimumSizeProperty, value);
1691 NotifyPropertyChanged();
1696 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1699 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1701 /// <since_tizen> 3 </since_tizen>
1702 public Size2D MaximumSize
1706 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1707 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1711 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1712 // MATCH_PARENT spec + parent container size can be used to limit
1713 if (_layout != null)
1715 _layout.RequestLayout();
1717 SetValue(MaximumSizeProperty, value);
1718 NotifyPropertyChanged();
1723 /// Gets or sets whether a child view inherits it's parent's position.<br />
1724 /// Default is to inherit.<br />
1725 /// 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 />
1727 /// <since_tizen> 3 </since_tizen>
1728 public bool InheritPosition
1732 return (bool)GetValue(InheritPositionProperty);
1736 SetValue(InheritPositionProperty, value);
1737 NotifyPropertyChanged();
1742 /// Gets or sets the clipping behavior (mode) of it's children.
1744 /// <since_tizen> 3 </since_tizen>
1745 public ClippingModeType ClippingMode
1749 return (ClippingModeType)GetValue(ClippingModeProperty);
1753 SetValue(ClippingModeProperty, value);
1754 NotifyPropertyChanged();
1759 /// Gets the number of renderers held by the view.
1761 /// <since_tizen> 3 </since_tizen>
1762 public uint RendererCount
1766 return GetRendererCount();
1771 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1774 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1776 /// <since_tizen> 3 </since_tizen>
1777 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1779 "View view = new View(); " +
1780 "view.PivotPoint = PivotPoint.Center; " +
1781 "view.PositionUsesPivotPoint = true;")]
1782 [EditorBrowsable(EditorBrowsableState.Never)]
1783 public Position AnchorPoint
1787 Position temp = new Position(0.0f, 0.0f, 0.0f);
1788 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1789 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1793 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1794 NotifyPropertyChanged();
1799 /// Sets the size of a view for the width, the height and the depth.<br />
1800 /// Geometry can be scaled to fit within this area.<br />
1801 /// This does not interfere with the view's scale factor.<br />
1802 /// The views default depth is the minimum of width and height.<br />
1806 /// Animatable - This property can be animated using <c>Animation</c> class.
1808 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1810 /// <since_tizen> 5 </since_tizen>
1815 Size tmp = (Size)GetValue(SizeProperty);
1816 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1820 SetValue(SizeProperty, value);
1821 NotifyPropertyChanged();
1826 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1828 /// <since_tizen> 3 </since_tizen>
1829 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1831 "Container parent = view.GetParent(); " +
1832 "View view = parent as View;")]
1833 [EditorBrowsable(EditorBrowsableState.Never)]
1834 public new View Parent
1839 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1840 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1841 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1843 if (basehandle is Layer layer)
1845 ret = new View(Layer.getCPtr(layer).Handle, false);
1846 NUILog.Error("This Parent property is deprecated, should do not be used");
1850 ret = basehandle as View;
1853 Interop.BaseHandle.delete_BaseHandle(CPtr);
1854 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1856 if (NDalicPINVOKE.SWIGPendingException.Pending)
1857 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1863 /// Gets/Sets whether inherit parent's the layout Direction.
1865 /// <since_tizen> 4 </since_tizen>
1866 public bool InheritLayoutDirection
1870 return (bool)GetValue(InheritLayoutDirectionProperty);
1874 SetValue(InheritLayoutDirectionProperty, value);
1875 NotifyPropertyChanged();
1880 /// Gets/Sets the layout Direction.
1882 /// <since_tizen> 4 </since_tizen>
1883 public ViewLayoutDirectionType LayoutDirection
1887 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1891 SetValue(LayoutDirectionProperty, value);
1892 NotifyPropertyChanged();
1893 _layout?.RequestLayout();
1898 /// Gets or sets the Margin for use in layout.
1901 /// Margin property is supported by Layout algorithms and containers.
1902 /// Please Set Layout if you want to use Margin property.
1903 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1905 /// <since_tizen> 4 </since_tizen>
1906 public Extents Margin
1910 // If View has a Layout then margin is stored in Layout.
1913 return Layout.Margin;
1917 // If Layout not set then return margin stored in View.
1918 Extents temp = (Extents)GetValue(MarginProperty);
1919 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1921 // Two return points to prevent creating a zeroed Extent native object before assignment
1927 // Layout set so store Margin in LayoutItem instead of View.
1928 // If View stores the Margin too then the Legacy Size Negotiation will
1929 // overwrite the position and size values measured in the Layouting.
1930 Layout.Margin = value;
1931 SetValue(MarginProperty, new Extents(0,0,0,0));
1932 _layout?.RequestLayout();
1936 SetValue(MarginProperty, value);
1938 NotifyPropertyChanged();
1939 _layout?.RequestLayout();
1944 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1946 /// <since_tizen> 6 </since_tizen>
1947 public int WidthSpecification
1951 return _widthPolicy;
1955 _widthPolicy = value;
1956 if( _oldWidthPolicy != _widthPolicy )
1958 if (_widthPolicy >= 0)
1960 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1962 if(_heightPolicy>=0) // Policy an exact value
1964 // Create Size2D only both _widthPolicy and _heightPolicy are set.
1965 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1968 _layout?.RequestLayout();
1969 _oldWidthPolicy = _widthPolicy;
1975 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1977 /// <since_tizen> 6 </since_tizen>
1978 public int HeightSpecification
1982 return _heightPolicy;
1986 _heightPolicy = value;
1987 if( _oldHeightPolicy != _heightPolicy )
1989 if (_heightPolicy >= 0)
1991 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1993 if(_widthPolicy>=0) // Policy an exact value
1995 // Create Size2D only both _widthPolicy and _heightPolicy are set.
1996 Size2D = new Size2D(_widthPolicy,_heightPolicy);
2000 _layout?.RequestLayout();
2001 _oldHeightPolicy = _heightPolicy;
2007 /// Gets the List of transitions for this View.
2009 /// <since_tizen> 6 </since_tizen>
2010 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2014 if (_layoutTransitions == null)
2016 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2018 return _layoutTransitions;
2023 /// Set a layout transitions for this View.
2026 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2028 /// <since_tizen> 6 </since_tizen>
2029 public LayoutTransition LayoutTransition
2033 if (_layoutTransitions == null)
2035 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2037 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2039 AttachTransitionsToChildren(value);
2044 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2047 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2049 /// <since_tizen> 4 </since_tizen>
2050 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2051 [EditorBrowsable(EditorBrowsableState.Never)]
2052 public Extents PaddingEX
2056 Extents temp = new Extents(0, 0, 0, 0);
2057 GetProperty(View.Property.PADDING).Get(temp);
2058 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2062 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2063 NotifyPropertyChanged();
2064 _layout?.RequestLayout();
2068 /// <since_tizen> 6 </since_tizen>
2069 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2070 [EditorBrowsable(EditorBrowsableState.Never)]
2071 public Style XamlStyle
2075 return (Style)GetValue(XamlStyleProperty);
2079 SetValue(XamlStyleProperty, value);
2084 /// The Color of View. This is an RGBA value.
2088 /// Animatable - This property can be animated using <c>Animation</c> class.
2090 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2092 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2093 [EditorBrowsable(EditorBrowsableState.Never)]
2098 Color temp = (Color)GetValue(ColorProperty);
2099 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2103 SetValue(ColorProperty, value);
2104 selectorData?.Color.UpdateIfNeeds(this, value);
2105 NotifyPropertyChanged();
2110 /// Set the layout on this View. Replaces any existing Layout.
2112 /// <since_tizen> 6 </since_tizen>
2113 public LayoutItem Layout
2121 // Do nothing if layout provided is already set on this View.
2122 if (value == _layout)
2127 layoutingDisabled = false;
2130 // If new layout being set already has a owner then that owner receives a replacement default layout.
2131 // First check if the layout to be set already has a owner.
2132 if (value?.Owner != null)
2134 // Previous owner of the layout gets a default layout as a replacement.
2135 value.Owner.Layout = new AbsoluteLayout();
2137 // Copy Margin and Padding to replacement LayoutGroup.
2138 if (value.Owner.Layout != null)
2140 value.Owner.Layout.Margin = value.Margin;
2141 value.Owner.Layout.Padding = value.Padding;
2145 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2146 // View if no replacement. Previously margin and padding values would have been moved from
2147 // the View to the layout.
2148 if (_layout != null ) // Existing layout
2152 // Existing layout being replaced so copy over margin and padding values.
2153 value.Margin = _layout.Margin;
2154 value.Padding = _layout.Padding;
2158 // Layout not being replaced so restore margin and padding to View.
2159 SetValue(MarginProperty, _layout.Margin);
2160 SetValue(PaddingProperty, _layout.Padding);
2161 NotifyPropertyChanged();
2166 // First Layout to be added to the View hence copy
2168 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2171 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2173 // If View already has a margin set then store it in Layout instead.
2174 value.Margin = Margin;
2175 SetValue(MarginProperty, new Extents(0,0,0,0));
2176 NotifyPropertyChanged();
2179 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2181 // If View already has a padding set then store it in Layout instead.
2182 value.Padding = Padding;
2183 SetValue(PaddingProperty, new Extents(0,0,0,0));
2184 NotifyPropertyChanged();
2189 // Remove existing layout from it's parent layout group.
2190 _layout?.Unparent();
2192 // Set layout to this view
2198 /// The weight of the View, used to share available space in a layout with siblings.
2200 /// <since_tizen> 6 </since_tizen>
2210 _layout?.RequestLayout();
2215 /// Whether to load the BackgroundImage synchronously.
2216 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2217 /// Note: For Normal Quad images only.
2219 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2220 [EditorBrowsable(EditorBrowsableState.Never)]
2221 public bool BackgroundImageSynchronosLoading
2225 return _backgroundImageSynchronosLoading;
2229 _backgroundImageSynchronosLoading = value;
2231 string bgUrl = null;
2232 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2234 if (!string.IsNullOrEmpty(bgUrl))
2236 PropertyMap bgMap = this.Background;
2237 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2243 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2244 [EditorBrowsable(EditorBrowsableState.Never)]
2245 public Vector2 UpdateSizeHint
2249 return (Vector2)GetValue(UpdateSizeHintProperty);
2253 SetValue(UpdateSizeHintProperty, value);
2254 NotifyPropertyChanged();
2258 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2259 [EditorBrowsable(EditorBrowsableState.Never)]
2260 public string[] TransitionNames
2264 return transitionNames;
2268 transitionNames = value;
2274 /// Enable/Disable ControlState propagation for children.
2275 /// It is false by default.
2276 /// If the View needs to share ControlState with descendants, please set it true.
2277 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2279 [EditorBrowsable(EditorBrowsableState.Never)]
2280 public bool EnableControlStatePropagation
2282 get => controlStatePropagation;
2285 controlStatePropagation = value;
2287 foreach (View child in Children)
2289 child.EnableControlStatePropagation = value;
2295 /// If this property is set to true, the View can have a touch related ControlState (such as Pressed) when touch.
2296 /// By default, it is false in View, true in Control.
2297 /// Note that if the value is true, the View will be a touch receptor.
2299 [EditorBrowsable(EditorBrowsableState.Never)]
2300 public bool EnableControlState
2304 return (bool)GetValue(EnableControlStateProperty);
2308 SetValue(EnableControlStateProperty, value);
2313 /// Whether the actor grab all touches even if touch leaves its boundary.
2315 /// <returns>true, if it grab all touch after start</returns>
2316 [EditorBrowsable(EditorBrowsableState.Never)]
2317 public bool GrabTouchAfterLeave
2322 GetProperty(View.Property.CaptureAllTouchAfterStart).Get(out temp);
2327 SetProperty(View.Property.CaptureAllTouchAfterStart, new Tizen.NUI.PropertyValue(value));
2328 NotifyPropertyChanged();
2333 /// If the value is true, the View will change its style as the theme changes.
2334 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2336 [EditorBrowsable(EditorBrowsableState.Never)]
2337 public bool ThemeChangeSensitive
2339 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2340 set => SetValue(ThemeChangeSensitiveProperty, value);
2344 /// Get Style, it is abstract function and must be override.
2346 /// <since_tizen> 6 </since_tizen>
2347 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2348 // TODO: It should be deprecated. please use CreateViewStyle instead.
2349 [EditorBrowsable(EditorBrowsableState.Never)]
2350 protected virtual ViewStyle GetViewStyle()
2352 return CreateViewStyle();
2356 /// Create Style, it is abstract function and must be override.
2358 [EditorBrowsable(EditorBrowsableState.Never)]
2359 protected virtual ViewStyle CreateViewStyle()
2361 return new ViewStyle();
2365 /// Called after the View's ControlStates changed.
2367 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2368 [EditorBrowsable(EditorBrowsableState.Never)]
2369 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2375 [EditorBrowsable(EditorBrowsableState.Never)]
2376 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2381 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2382 [EditorBrowsable(EditorBrowsableState.Never)]
2383 public virtual void ApplyStyle(ViewStyle viewStyle)
2385 if (null == viewStyle || this.viewStyle == viewStyle) return;
2387 this.viewStyle = viewStyle;
2389 Dictionary<string, BindableProperty> bindablePropertyOfView;
2390 Type viewType = GetType();
2392 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2393 Type styleType = viewStyle.GetType();
2395 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2396 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2398 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2400 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2402 BindableProperty viewProperty;
2403 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2405 if (null != viewProperty && viewProperty != StyleNameProperty)
2407 object value = viewStyle.GetValue(keyValuePair.Value);
2411 SetValue(viewProperty, value);