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);
771 if (this.Layout == null)
773 if (temp.Width < 0) { temp.Width = 0; }
774 if (temp.Height < 0) { temp.Height = 0; }
777 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
781 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
782 SetValue(Size2DProperty, value);
783 // Set Specification so when layouts measure this View it matches the value set here.
784 // All Views are currently Layouts.
785 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
786 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
787 _widthPolicy = value.Width;
788 _heightPolicy = value.Height;
790 _layout?.RequestLayout();
791 NotifyPropertyChanged();
796 /// Retrieves the size of the view.<br />
797 /// The coordinates are relative to the view's parent.<br />
799 /// <since_tizen> 3 </since_tizen>
800 public Size2D CurrentSize
804 return GetCurrentSize();
809 /// Retrieves and sets the view's opacity.<br />
811 /// <since_tizen> 3 </since_tizen>
816 return (float)GetValue(OpacityProperty);
820 SetValue(OpacityProperty, value);
821 selectorData?.Opacity.UpdateIfNeeds(this, value);
822 NotifyPropertyChanged();
827 /// Sets the position of the view for X and Y.<br />
828 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
829 /// If the position inheritance is disabled, sets the world position.<br />
832 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
833 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
835 /// <since_tizen> 3 </since_tizen>
836 public Position2D Position2D
840 Position2D temp = (Position2D)GetValue(Position2DProperty);
841 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
845 SetValue(Position2DProperty, value);
846 NotifyPropertyChanged();
851 /// Retrieves the screen postion of the view.<br />
853 /// <since_tizen> 3 </since_tizen>
854 public Vector2 ScreenPosition
858 Vector2 temp = new Vector2(0.0f, 0.0f);
859 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
865 /// Determines whether the pivot point should be used to determine the position of the view.
866 /// This is false by default.
868 /// <remarks>If false, then the top-left of the view is used for the position.
869 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
871 /// <since_tizen> 3 </since_tizen>
872 public bool PositionUsesPivotPoint
876 return (bool)GetValue(PositionUsesPivotPointProperty);
880 SetValue(PositionUsesPivotPointProperty, value);
881 NotifyPropertyChanged();
886 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
888 /// <since_tizen> 3 </since_tizen>
889 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
891 "View view = new View(); " +
892 "view.PivotPoint = PivotPoint.Center; " +
893 "view.PositionUsesPivotPoint = true;" +
894 " Deprecated in API5: Will be removed in API8")]
895 [EditorBrowsable(EditorBrowsableState.Never)]
896 public bool PositionUsesAnchorPoint
901 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
906 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
907 NotifyPropertyChanged();
912 /// Queries whether the view is connected to the stage.<br />
913 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
915 /// <since_tizen> 3 </since_tizen>
916 public bool IsOnWindow
925 /// Gets the depth in the hierarchy for the view.
927 /// <since_tizen> 3 </since_tizen>
928 public int HierarchyDepth
932 return GetHierarchyDepth();
937 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
940 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
941 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
942 /// The values set by this property will likely change.
944 /// <since_tizen> 3 </since_tizen>
945 public int SiblingOrder
949 return (int)GetValue(SiblingOrderProperty);
953 SetValue(SiblingOrderProperty, value);
955 LayoutGroup layout = Layout as LayoutGroup;
956 layout?.ChangeLayoutSiblingOrder(value);
958 NotifyPropertyChanged();
963 /// Returns the natural size of the view.
966 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
968 /// <since_tizen> 5 </since_tizen>
969 public Vector3 NaturalSize
973 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
974 if (NDalicPINVOKE.SWIGPendingException.Pending)
975 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
981 /// Returns the natural size (Size2D) of the view.
984 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
986 /// <since_tizen> 4 </since_tizen>
987 public Size2D NaturalSize2D
991 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
992 if (NDalicPINVOKE.SWIGPendingException.Pending)
993 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
995 return new Size2D((int)temp.Width, (int)temp.Height);
1000 /// Gets or sets the origin of a view within its parent's area.<br />
1001 /// 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 />
1002 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1003 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1005 /// <pre>The view has been initialized.</pre>
1006 /// <since_tizen> 3 </since_tizen>
1007 public Position ParentOrigin
1011 Position tmp = (Position)GetValue(ParentOriginProperty);
1012 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1016 SetValue(ParentOriginProperty, value);
1017 NotifyPropertyChanged();
1022 /// Gets or sets the anchor-point of a view.<br />
1023 /// 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 />
1024 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1025 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1026 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1027 /// <pre>The view has been initialized.</pre>
1030 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1032 /// <since_tizen> 3 </since_tizen>
1033 public Position PivotPoint
1037 Position tmp = (Position)GetValue(PivotPointProperty);
1038 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1042 SetValue(PivotPointProperty, value);
1043 NotifyPropertyChanged();
1048 /// Gets or sets the size width of the view.
1052 /// Animatable - This property can be animated using <c>Animation</c> class.
1055 /// <since_tizen> 3 </since_tizen>
1056 public float SizeWidth
1060 return (float)GetValue(SizeWidthProperty);
1064 SetValue(SizeWidthProperty, value);
1065 NotifyPropertyChanged();
1070 /// Gets or sets the size height of the view.
1074 /// Animatable - This property can be animated using <c>Animation</c> class.
1077 /// <since_tizen> 3 </since_tizen>
1078 public float SizeHeight
1082 return (float)GetValue(SizeHeightProperty);
1086 SetValue(SizeHeightProperty, value);
1087 NotifyPropertyChanged();
1092 /// Gets or sets the position of the view.<br />
1093 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1094 /// If the position inheritance is disabled, sets the world position.<br />
1098 /// Animatable - This property can be animated using <c>Animation</c> class.
1100 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1102 /// <since_tizen> 3 </since_tizen>
1103 public Position Position
1107 Position tmp = (Position)GetValue(PositionProperty);
1108 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1112 SetValue(PositionProperty, value);
1113 NotifyPropertyChanged();
1118 /// Gets or sets the position X of the view.
1122 /// Animatable - This property can be animated using <c>Animation</c> class.
1125 /// <since_tizen> 3 </since_tizen>
1126 public float PositionX
1130 return (float)GetValue(PositionXProperty);
1134 SetValue(PositionXProperty, value);
1135 NotifyPropertyChanged();
1140 /// Gets or sets the position Y of the view.
1144 /// Animatable - This property can be animated using <c>Animation</c> class.
1147 /// <since_tizen> 3 </since_tizen>
1148 public float PositionY
1152 return (float)GetValue(PositionYProperty);
1156 SetValue(PositionYProperty, value);
1157 NotifyPropertyChanged();
1162 /// Gets or sets the position Z of the view.
1166 /// Animatable - This property can be animated using <c>Animation</c> class.
1169 /// <since_tizen> 3 </since_tizen>
1170 public float PositionZ
1174 return (float)GetValue(PositionZProperty);
1178 SetValue(PositionZProperty, value);
1179 NotifyPropertyChanged();
1184 /// Gets or sets the world position of the view.
1186 /// <since_tizen> 3 </since_tizen>
1187 public Vector3 WorldPosition
1191 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1192 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1198 /// Gets or sets the orientation of the view.<br />
1199 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1203 /// This is an asynchronous method.
1206 /// Animatable - This property can be animated using <c>Animation</c> class.
1209 /// <since_tizen> 3 </since_tizen>
1210 public Rotation Orientation
1214 return (Rotation)GetValue(OrientationProperty);
1218 SetValue(OrientationProperty, value);
1219 NotifyPropertyChanged();
1224 /// Gets or sets the world orientation of the view.<br />
1226 /// <since_tizen> 3 </since_tizen>
1227 public Rotation WorldOrientation
1231 Rotation temp = new Rotation();
1232 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1238 /// Gets or sets the scale factor applied to the view.<br />
1242 /// Animatable - This property can be animated using <c>Animation</c> class.
1244 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1246 /// <since_tizen> 3 </since_tizen>
1247 public Vector3 Scale
1251 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1252 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1256 SetValue(ScaleProperty, value);
1257 NotifyPropertyChanged();
1262 /// Gets or sets the scale X factor applied to the view.
1266 /// Animatable - This property can be animated using <c>Animation</c> class.
1269 /// <since_tizen> 3 </since_tizen>
1274 return (float)GetValue(ScaleXProperty);
1278 SetValue(ScaleXProperty, value);
1279 NotifyPropertyChanged();
1284 /// Gets or sets the scale Y factor applied to the view.
1288 /// Animatable - This property can be animated using <c>Animation</c> class.
1291 /// <since_tizen> 3 </since_tizen>
1296 return (float)GetValue(ScaleYProperty);
1300 SetValue(ScaleYProperty, value);
1301 NotifyPropertyChanged();
1306 /// Gets or sets the scale Z factor applied to the view.
1310 /// Animatable - This property can be animated using <c>Animation</c> class.
1313 /// <since_tizen> 3 </since_tizen>
1318 return (float)GetValue(ScaleZProperty);
1322 SetValue(ScaleZProperty, value);
1323 NotifyPropertyChanged();
1328 /// Gets the world scale of the view.
1330 /// <since_tizen> 3 </since_tizen>
1331 public Vector3 WorldScale
1335 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1336 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1342 /// Retrieves the visibility flag of the view.
1346 /// If the view is not visible, then the view and its children will not be rendered.
1347 /// 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.
1350 /// Animatable - This property can be animated using <c>Animation</c> class.
1353 /// <since_tizen> 3 </since_tizen>
1354 public bool Visibility
1359 GetProperty(View.Property.VISIBLE).Get(out temp);
1365 /// Gets the view's world color.
1367 /// <since_tizen> 3 </since_tizen>
1368 public Vector4 WorldColor
1372 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1373 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1379 /// Gets or sets the view's name.
1381 /// <since_tizen> 3 </since_tizen>
1386 return (string)GetValue(NameProperty);
1390 SetValue(NameProperty, value);
1391 NotifyPropertyChanged();
1396 /// Get the number of children held by the view.
1398 /// <since_tizen> 3 </since_tizen>
1399 public new uint ChildCount
1403 return GetChildCount();
1408 /// Gets the view's ID.
1411 /// <since_tizen> 3 </since_tizen>
1421 /// Gets or sets the status of whether the view should emit touch or hover signals.
1423 /// <since_tizen> 3 </since_tizen>
1424 public bool Sensitive
1428 return (bool)GetValue(SensitiveProperty);
1432 SetValue(SensitiveProperty, value);
1433 NotifyPropertyChanged();
1438 /// 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.
1440 /// <since_tizen> 3 </since_tizen>
1441 public bool LeaveRequired
1445 return (bool)GetValue(LeaveRequiredProperty);
1449 SetValue(LeaveRequiredProperty, value);
1450 NotifyPropertyChanged();
1455 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1457 /// <since_tizen> 3 </since_tizen>
1458 public bool InheritOrientation
1462 return (bool)GetValue(InheritOrientationProperty);
1466 SetValue(InheritOrientationProperty, value);
1467 NotifyPropertyChanged();
1472 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1474 /// <since_tizen> 3 </since_tizen>
1475 public bool InheritScale
1479 return (bool)GetValue(InheritScaleProperty);
1483 SetValue(InheritScaleProperty, value);
1484 NotifyPropertyChanged();
1489 /// Gets or sets the status of how the view and its children should be drawn.<br />
1490 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1491 /// 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 />
1492 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1493 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1494 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1496 /// <since_tizen> 3 </since_tizen>
1497 public DrawModeType DrawMode
1501 return (DrawModeType)GetValue(DrawModeProperty);
1505 SetValue(DrawModeProperty, value);
1506 NotifyPropertyChanged();
1511 /// Gets or sets the relative to parent size factor of the view.<br />
1512 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1513 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1516 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1518 /// <since_tizen> 3 </since_tizen>
1519 public Vector3 SizeModeFactor
1523 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1524 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1528 SetValue(SizeModeFactorProperty, value);
1529 NotifyPropertyChanged();
1534 /// Gets or sets the width resize policy to be used.
1536 /// <since_tizen> 3 </since_tizen>
1537 public ResizePolicyType WidthResizePolicy
1541 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1545 SetValue(WidthResizePolicyProperty, value);
1546 NotifyPropertyChanged();
1551 /// Gets or sets the height resize policy to be used.
1553 /// <since_tizen> 3 </since_tizen>
1554 public ResizePolicyType HeightResizePolicy
1558 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1562 SetValue(HeightResizePolicyProperty, value);
1563 NotifyPropertyChanged();
1568 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1569 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1571 /// <since_tizen> 3 </since_tizen>
1572 public SizeScalePolicyType SizeScalePolicy
1576 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1580 SetValue(SizeScalePolicyProperty, value);
1581 NotifyPropertyChanged();
1586 /// Gets or sets the status of whether the width size is dependent on the height size.
1588 /// <since_tizen> 3 </since_tizen>
1589 public bool WidthForHeight
1593 return (bool)GetValue(WidthForHeightProperty);
1597 SetValue(WidthForHeightProperty, value);
1598 NotifyPropertyChanged();
1603 /// Gets or sets the status of whether the height size is dependent on the width size.
1605 /// <since_tizen> 3 </since_tizen>
1606 public bool HeightForWidth
1610 return (bool)GetValue(HeightForWidthProperty);
1614 SetValue(HeightForWidthProperty, value);
1615 NotifyPropertyChanged();
1620 /// Gets or sets the padding for use in layout.
1623 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1625 /// <since_tizen> 5 </since_tizen>
1626 public Extents Padding
1630 // If View has a Layout then padding in stored in the base Layout class
1633 return Layout.Padding;
1637 Extents temp = (Extents)GetValue(PaddingProperty);
1638 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1640 // Two return points to prevent creating a zeroed Extent native object before assignment
1644 Extents padding = value;
1647 // Layout set so store Padding in LayoutItem instead of in View.
1648 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1649 // the position and sizes measure in the Layouting.
1650 Layout.Padding = value;
1651 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1652 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1653 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1655 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1659 SetValue(PaddingProperty, padding);
1660 NotifyPropertyChanged();
1665 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1668 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1670 /// <since_tizen> 3 </since_tizen>
1671 public Size2D MinimumSize
1675 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1676 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1680 if (_layout != null)
1682 // Note: it only works if minimum size is >= than natural size.
1683 // To force the size it should be done through the width&height spec or Size2D.
1684 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1685 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1686 _layout.RequestLayout();
1688 SetValue(MinimumSizeProperty, value);
1689 NotifyPropertyChanged();
1694 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1697 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1699 /// <since_tizen> 3 </since_tizen>
1700 public Size2D MaximumSize
1704 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1705 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1709 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1710 // MATCH_PARENT spec + parent container size can be used to limit
1711 if (_layout != null)
1713 _layout.RequestLayout();
1715 SetValue(MaximumSizeProperty, value);
1716 NotifyPropertyChanged();
1721 /// Gets or sets whether a child view inherits it's parent's position.<br />
1722 /// Default is to inherit.<br />
1723 /// 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 />
1725 /// <since_tizen> 3 </since_tizen>
1726 public bool InheritPosition
1730 return (bool)GetValue(InheritPositionProperty);
1734 SetValue(InheritPositionProperty, value);
1735 NotifyPropertyChanged();
1740 /// Gets or sets the clipping behavior (mode) of it's children.
1742 /// <since_tizen> 3 </since_tizen>
1743 public ClippingModeType ClippingMode
1747 return (ClippingModeType)GetValue(ClippingModeProperty);
1751 SetValue(ClippingModeProperty, value);
1752 NotifyPropertyChanged();
1757 /// Gets the number of renderers held by the view.
1759 /// <since_tizen> 3 </since_tizen>
1760 public uint RendererCount
1764 return GetRendererCount();
1769 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1772 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1774 /// <since_tizen> 3 </since_tizen>
1775 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1777 "View view = new View(); " +
1778 "view.PivotPoint = PivotPoint.Center; " +
1779 "view.PositionUsesPivotPoint = true;")]
1780 [EditorBrowsable(EditorBrowsableState.Never)]
1781 public Position AnchorPoint
1785 Position temp = new Position(0.0f, 0.0f, 0.0f);
1786 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1787 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1791 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1792 NotifyPropertyChanged();
1797 /// Sets the size of a view for the width, the height and the depth.<br />
1798 /// Geometry can be scaled to fit within this area.<br />
1799 /// This does not interfere with the view's scale factor.<br />
1800 /// The views default depth is the minimum of width and height.<br />
1804 /// Animatable - This property can be animated using <c>Animation</c> class.
1806 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1808 /// <since_tizen> 5 </since_tizen>
1813 Size tmp = (Size)GetValue(SizeProperty);
1814 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1818 SetValue(SizeProperty, value);
1819 NotifyPropertyChanged();
1824 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1826 /// <since_tizen> 3 </since_tizen>
1827 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1829 "Container parent = view.GetParent(); " +
1830 "View view = parent as View;")]
1831 [EditorBrowsable(EditorBrowsableState.Never)]
1832 public new View Parent
1837 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1838 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1839 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1841 if (basehandle is Layer layer)
1843 ret = new View(Layer.getCPtr(layer).Handle, false);
1844 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1848 ret = basehandle as View;
1851 Interop.BaseHandle.delete_BaseHandle(CPtr);
1852 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1854 if (NDalicPINVOKE.SWIGPendingException.Pending)
1855 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1861 /// Gets/Sets whether inherit parent's the layout Direction.
1863 /// <since_tizen> 4 </since_tizen>
1864 public bool InheritLayoutDirection
1868 return (bool)GetValue(InheritLayoutDirectionProperty);
1872 SetValue(InheritLayoutDirectionProperty, value);
1873 NotifyPropertyChanged();
1878 /// Gets/Sets the layout Direction.
1880 /// <since_tizen> 4 </since_tizen>
1881 public ViewLayoutDirectionType LayoutDirection
1885 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1889 SetValue(LayoutDirectionProperty, value);
1890 NotifyPropertyChanged();
1891 _layout?.RequestLayout();
1896 /// Gets or sets the Margin for use in layout.
1899 /// Margin property is supported by Layout algorithms and containers.
1900 /// Please Set Layout if you want to use Margin property.
1901 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1903 /// <since_tizen> 4 </since_tizen>
1904 public Extents Margin
1908 // If View has a Layout then margin is stored in Layout.
1911 return Layout.Margin;
1915 // If Layout not set then return margin stored in View.
1916 Extents temp = (Extents)GetValue(MarginProperty);
1917 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1919 // Two return points to prevent creating a zeroed Extent native object before assignment
1925 // Layout set so store Margin in LayoutItem instead of View.
1926 // If View stores the Margin too then the Legacy Size Negotiation will
1927 // overwrite the position and size values measured in the Layouting.
1928 Layout.Margin = value;
1929 SetValue(MarginProperty, new Extents(0,0,0,0));
1930 _layout?.RequestLayout();
1934 SetValue(MarginProperty, value);
1936 NotifyPropertyChanged();
1937 _layout?.RequestLayout();
1942 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1944 /// <since_tizen> 6 </since_tizen>
1945 public int WidthSpecification
1949 return _widthPolicy;
1953 _widthPolicy = value;
1954 if( _oldWidthPolicy != _widthPolicy )
1956 if (_widthPolicy >= 0)
1958 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1960 if(_heightPolicy>=0) // Policy an exact value
1962 // Create Size2D only both _widthPolicy and _heightPolicy are set.
1963 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1966 _layout?.RequestLayout();
1967 _oldWidthPolicy = _widthPolicy;
1973 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1975 /// <since_tizen> 6 </since_tizen>
1976 public int HeightSpecification
1980 return _heightPolicy;
1984 _heightPolicy = value;
1985 if( _oldHeightPolicy != _heightPolicy )
1987 if (_heightPolicy >= 0)
1989 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1991 if(_widthPolicy>=0) // Policy an exact value
1993 // Create Size2D only both _widthPolicy and _heightPolicy are set.
1994 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1998 _layout?.RequestLayout();
1999 _oldHeightPolicy = _heightPolicy;
2005 /// Gets the List of transitions for this View.
2007 /// <since_tizen> 6 </since_tizen>
2008 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2012 if (_layoutTransitions == null)
2014 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2016 return _layoutTransitions;
2021 /// Set a layout transitions for this View.
2024 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2026 /// <since_tizen> 6 </since_tizen>
2027 public LayoutTransition LayoutTransition
2031 if (_layoutTransitions == null)
2033 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2035 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2037 AttachTransitionsToChildren(value);
2042 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2045 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2047 /// <since_tizen> 4 </since_tizen>
2048 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2049 [EditorBrowsable(EditorBrowsableState.Never)]
2050 public Extents PaddingEX
2054 Extents temp = new Extents(0, 0, 0, 0);
2055 GetProperty(View.Property.PADDING).Get(temp);
2056 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2060 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2061 NotifyPropertyChanged();
2062 _layout?.RequestLayout();
2066 /// <since_tizen> 6 </since_tizen>
2067 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2068 [EditorBrowsable(EditorBrowsableState.Never)]
2069 public Style XamlStyle
2073 return (Style)GetValue(XamlStyleProperty);
2077 SetValue(XamlStyleProperty, value);
2082 /// The Color of View. This is an RGBA value.
2086 /// Animatable - This property can be animated using <c>Animation</c> class.
2088 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2090 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2091 [EditorBrowsable(EditorBrowsableState.Never)]
2096 Color temp = (Color)GetValue(ColorProperty);
2097 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2101 SetValue(ColorProperty, value);
2102 selectorData?.Color.UpdateIfNeeds(this, value);
2103 NotifyPropertyChanged();
2108 /// Set the layout on this View. Replaces any existing Layout.
2110 /// <since_tizen> 6 </since_tizen>
2111 public LayoutItem Layout
2119 // Do nothing if layout provided is already set on this View.
2120 if (value == _layout)
2125 layoutingDisabled = false;
2128 // If new layout being set already has a owner then that owner receives a replacement default layout.
2129 // First check if the layout to be set already has a owner.
2130 if (value?.Owner != null)
2132 // Previous owner of the layout gets a default layout as a replacement.
2133 value.Owner.Layout = new AbsoluteLayout();
2135 // Copy Margin and Padding to replacement LayoutGroup.
2136 if (value.Owner.Layout != null)
2138 value.Owner.Layout.Margin = value.Margin;
2139 value.Owner.Layout.Padding = value.Padding;
2143 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2144 // View if no replacement. Previously margin and padding values would have been moved from
2145 // the View to the layout.
2146 if (_layout != null ) // Existing layout
2150 // Existing layout being replaced so copy over margin and padding values.
2151 value.Margin = _layout.Margin;
2152 value.Padding = _layout.Padding;
2156 // Layout not being replaced so restore margin and padding to View.
2157 SetValue(MarginProperty, _layout.Margin);
2158 SetValue(PaddingProperty, _layout.Padding);
2159 NotifyPropertyChanged();
2164 // 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 SetValue(PaddingProperty, new Extents(0,0,0,0));
2182 NotifyPropertyChanged();
2187 // Remove existing layout from it's parent layout group.
2188 _layout?.Unparent();
2190 // Set layout to this view
2196 /// The weight of the View, used to share available space in a layout with siblings.
2198 /// <since_tizen> 6 </since_tizen>
2208 _layout?.RequestLayout();
2213 /// Whether to load the BackgroundImage synchronously.
2214 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2215 /// Note: For Normal Quad images only.
2217 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2218 [EditorBrowsable(EditorBrowsableState.Never)]
2219 public bool BackgroundImageSynchronosLoading
2223 return _backgroundImageSynchronosLoading;
2227 _backgroundImageSynchronosLoading = value;
2229 string bgUrl = null;
2230 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2232 if (!string.IsNullOrEmpty(bgUrl))
2234 PropertyMap bgMap = this.Background;
2235 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2241 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2242 [EditorBrowsable(EditorBrowsableState.Never)]
2243 public Vector2 UpdateSizeHint
2247 return (Vector2)GetValue(UpdateSizeHintProperty);
2251 SetValue(UpdateSizeHintProperty, value);
2252 NotifyPropertyChanged();
2256 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2257 [EditorBrowsable(EditorBrowsableState.Never)]
2258 public string[] TransitionNames
2262 return transitionNames;
2266 transitionNames = value;
2272 /// Enable/Disable ControlState propagation for children.
2273 /// It is false by default.
2274 /// If the View needs to share ControlState with descendants, please set it true.
2275 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2277 [EditorBrowsable(EditorBrowsableState.Never)]
2278 public bool EnableControlStatePropagation
2280 get => controlStatePropagation;
2283 controlStatePropagation = value;
2285 foreach (View child in Children)
2287 child.EnableControlStatePropagation = value;
2293 /// If this property is set to true, the View can have a touch related ControlState (such as Pressed) when touch.
2294 /// By default, it is false in View, true in Control.
2295 /// Note that if the value is true, the View will be a touch receptor.
2297 [EditorBrowsable(EditorBrowsableState.Never)]
2298 public bool EnableControlState
2302 return (bool)GetValue(EnableControlStateProperty);
2306 SetValue(EnableControlStateProperty, value);
2311 /// Whether the actor grab all touches even if touch leaves its boundary.
2313 /// <returns>true, if it grab all touch after start</returns>
2314 [EditorBrowsable(EditorBrowsableState.Never)]
2315 public bool GrabTouchAfterLeave
2320 GetProperty(View.Property.CaptureAllTouchAfterStart).Get(out temp);
2325 SetProperty(View.Property.CaptureAllTouchAfterStart, new Tizen.NUI.PropertyValue(value));
2326 NotifyPropertyChanged();
2331 /// If the value is true, the View will change its style as the theme changes.
2332 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2334 [EditorBrowsable(EditorBrowsableState.Never)]
2335 public bool ThemeChangeSensitive
2337 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2338 set => SetValue(ThemeChangeSensitiveProperty, value);
2342 /// Get Style, it is abstract function and must be override.
2344 /// <since_tizen> 6 </since_tizen>
2345 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2346 // TODO: It should be deprecated. please use CreateViewStyle instead.
2347 [EditorBrowsable(EditorBrowsableState.Never)]
2348 protected virtual ViewStyle GetViewStyle()
2350 return CreateViewStyle();
2354 /// Create Style, it is abstract function and must be override.
2356 [EditorBrowsable(EditorBrowsableState.Never)]
2357 protected virtual ViewStyle CreateViewStyle()
2359 return new ViewStyle();
2363 /// Called after the View's ControlStates changed.
2365 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2366 [EditorBrowsable(EditorBrowsableState.Never)]
2367 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2373 [EditorBrowsable(EditorBrowsableState.Never)]
2374 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2379 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2380 [EditorBrowsable(EditorBrowsableState.Never)]
2381 public virtual void ApplyStyle(ViewStyle viewStyle)
2383 if (null == viewStyle || this.viewStyle == viewStyle) return;
2385 this.viewStyle = viewStyle;
2387 Dictionary<string, BindableProperty> bindablePropertyOfView;
2388 Type viewType = GetType();
2390 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2391 Type styleType = viewStyle.GetType();
2393 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2394 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2396 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2398 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2400 BindableProperty viewProperty;
2401 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2403 if (null != viewProperty && viewProperty != StyleNameProperty)
2405 object value = viewStyle.GetValue(keyValuePair.Value);
2409 SetValue(viewProperty, value);