2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.Binding;
22 using Tizen.NUI.Components;
24 namespace Tizen.NUI.BaseComponents
27 /// View is the base class for all views.
29 /// <since_tizen> 3 </since_tizen>
30 public partial class View : Container, IResourcesProvider
33 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
35 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
36 [EditorBrowsable(EditorBrowsableState.Never)]
37 public bool layoutSet = false;
40 /// Flag to allow Layouting to be disabled for Views.
41 /// Once a View has a Layout set then any children added to Views from then on will receive
42 /// automatic Layouts.
44 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
45 [EditorBrowsable(EditorBrowsableState.Never)]
46 public static bool layoutingDisabled{get; set;} = true;
48 private LayoutItem _layout; // Exclusive layout assigned to this View.
50 // List of transitions paired with the condition that uses the transition.
51 private Dictionary<TransitionCondition, TransitionList> _layoutTransitions;
52 private int _widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
53 private int _heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
54 private int _oldWidthPolicy = LayoutParamPolicies.MatchParent; // // Store Layout width to compare against later
55 private int _oldHeightPolicy = LayoutParamPolicies.MatchParent; // Store Layout height to compare against later
56 private float _weight = 0.0f; // Weighting of child View in a Layout
57 private MeasureSpecification _measureSpecificationWidth; // Layout width and internal Mode
58 private MeasureSpecification _measureSpecificationHeight; // Layout height and internal Mode
59 private bool _backgroundImageSynchronosLoading = false;
60 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
61 private string[] transitionNames;
62 private bool controlStatePropagation = false;
63 private ViewStyle viewStyle;
65 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
66 internal BackgroundExtraData backgroundExtraData;
70 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
71 [EditorBrowsable(EditorBrowsableState.Never)]
72 public ViewStyle ViewStyle
76 if (null == viewStyle)
78 ApplyStyle(GetViewStyle());
86 /// Creates a new instance of a view.
88 /// <since_tizen> 3 </since_tizen>
89 public View() : this(Interop.View.View_New(), true)
91 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
94 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
95 [EditorBrowsable(EditorBrowsableState.Never)]
96 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true)
98 ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
102 /// Create a new instance of a View with setting the status of shown or hidden.
104 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
105 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
106 [EditorBrowsable(EditorBrowsableState.Never)]
107 public View(bool shown) : this(Interop.View.View_New(), true)
109 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
115 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
124 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
126 ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
129 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
133 PositionUsesPivotPoint = false;
136 _onWindowSendEventCallback = SendViewAddedEventToWindow;
137 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
145 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
147 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
156 /// The event that is triggered when the View's ControlState is changed.
158 [EditorBrowsable(EditorBrowsableState.Never)]
159 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
161 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
163 private ControlState controlStates = ControlState.Normal;
165 /// Get/Set the control state.
167 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
168 [EditorBrowsable(EditorBrowsableState.Never)]
169 public ControlState ControlState
173 return controlStates;
177 if (controlStates == value)
182 var prevState = controlStates;
184 controlStates = value;
186 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
188 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
190 OnControlStateChanged(changeInfo);
192 if (controlStatePropagation)
194 foreach (View child in Children)
196 child.ControlState = value;
200 ControlStateChangedEvent?.Invoke(this, changeInfo);
204 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
205 [EditorBrowsable(EditorBrowsableState.Never)]
206 public bool IsResourcesCreated
210 return Application.Current.IsResourcesCreated;
214 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
215 [EditorBrowsable(EditorBrowsableState.Never)]
216 public ResourceDictionary XamlResources
220 return Application.Current.XamlResources;
224 Application.Current.XamlResources = value;
229 /// The StyleName, type string.
231 /// <since_tizen> 3 </since_tizen>
232 public string StyleName
236 return (string)GetValue(StyleNameProperty);
240 SetValue(StyleNameProperty, value);
241 NotifyPropertyChanged();
246 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
249 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
251 /// <since_tizen> 3 </since_tizen>
252 public Color BackgroundColor
256 Color temp = (Color)GetValue(BackgroundColorProperty);
257 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
261 SetValue(BackgroundColorProperty, value);
262 if (selectorData != null)
264 selectorData.BackgroundImage.Reset(this);
265 selectorData.BackgroundColor.UpdateIfNeeds(this, value);
267 NotifyPropertyChanged();
272 /// The mutually exclusive with "backgroundColor" and "background" type Map.
274 /// <since_tizen> 3 </since_tizen>
275 public string BackgroundImage
279 return (string)GetValue(BackgroundImageProperty);
283 SetValue(BackgroundImageProperty, value);
284 if (selectorData != null)
286 selectorData.BackgroundColor.Reset(this);
287 selectorData.BackgroundImage.UpdateIfNeeds(this, value);
289 NotifyPropertyChanged();
294 /// Get or set the border of background image.
296 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
297 [EditorBrowsable(EditorBrowsableState.Never)]
298 public Rectangle BackgroundImageBorder
302 return (Rectangle)GetValue(BackgroundImageBorderProperty);
306 SetValue(BackgroundImageBorderProperty, value);
307 selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value);
308 NotifyPropertyChanged();
313 /// The background of view.
315 /// <since_tizen> 3 </since_tizen>
316 public Tizen.NUI.PropertyMap Background
320 return (PropertyMap)GetValue(BackgroundProperty);
324 SetValue(BackgroundProperty, value);
325 NotifyPropertyChanged();
330 /// Describes a shadow as an image for a View.
331 /// It is null by default.
334 /// Getter returns copied instance of current shadow.
337 /// The mutually exclusive with "BoxShadow".
339 [EditorBrowsable(EditorBrowsableState.Never)]
340 public ImageShadow ImageShadow
344 return (ImageShadow)GetValue(ImageShadowProperty);
348 SetValue(ImageShadowProperty, value);
349 if (selectorData != null)
351 selectorData.BoxShadow.Reset(this);
352 selectorData.ImageShadow.UpdateIfNeeds(this, value);
354 NotifyPropertyChanged();
359 /// Describes a box shaped shadow drawing for a View.
360 /// It is null by default.
363 /// Gettter returns copied instance of current shadow.
366 /// The mutually exclusive with "ImageShadow".
368 [EditorBrowsable(EditorBrowsableState.Never)]
369 public Shadow BoxShadow
373 return (Shadow)GetValue(BoxShadowProperty);
377 SetValue(BoxShadowProperty, value);
378 if (selectorData != null)
380 selectorData.ImageShadow.Reset(this);
381 selectorData.BoxShadow.UpdateIfNeeds(this, value);
383 NotifyPropertyChanged();
388 /// The radius for the rounded corners of the View.
389 /// This will rounds background and shadow edges.
390 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
392 [EditorBrowsable(EditorBrowsableState.Never)]
393 public float CornerRadius
397 return (float)GetValue(CornerRadiusProperty);
401 SetValue(CornerRadiusProperty, value);
402 selectorData?.CornerRadius.UpdateIfNeeds(this, value);
403 NotifyPropertyChanged();
408 /// The current state of the view.
410 /// <since_tizen> 3 </since_tizen>
415 return (States)GetValue(StateProperty);
419 SetValue(StateProperty, value);
420 NotifyPropertyChanged();
425 /// The current sub state of the view.
427 /// <since_tizen> 3 </since_tizen>
428 public States SubState
432 return (States)GetValue(SubStateProperty);
436 SetValue(SubStateProperty, value);
437 NotifyPropertyChanged();
442 /// Displays a tooltip
444 /// <since_tizen> 3 </since_tizen>
445 public Tizen.NUI.PropertyMap Tooltip
449 return (PropertyMap)GetValue(TooltipProperty);
453 SetValue(TooltipProperty, value);
454 NotifyPropertyChanged();
459 /// Displays a tooltip as a text.
461 /// <since_tizen> 3 </since_tizen>
462 public string TooltipText
466 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
467 NotifyPropertyChanged();
472 /// The Child property of FlexContainer.<br />
473 /// The proportion of the free space in the container, the flex item will receive.<br />
474 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
476 /// <since_tizen> 3 </since_tizen>
477 [Obsolete("Deprecated in API8, will be removed in API10.")]
482 return (float)GetValue(FlexProperty);
486 SetValue(FlexProperty, value);
487 NotifyPropertyChanged();
492 /// The Child property of FlexContainer.<br />
493 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
495 /// <since_tizen> 3 </since_tizen>
496 [Obsolete("Deprecated in API8, will be removed in API10.")]
501 return (int)GetValue(AlignSelfProperty);
505 SetValue(AlignSelfProperty, value);
506 NotifyPropertyChanged();
511 /// The Child property of FlexContainer.<br />
512 /// The space around the flex item.<br />
515 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
517 /// <since_tizen> 3 </since_tizen>
518 [Obsolete("Deprecated in API8, will be removed in API10.")]
519 public Vector4 FlexMargin
523 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
524 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
528 SetValue(FlexMarginProperty, value);
529 NotifyPropertyChanged();
534 /// The top-left cell this child occupies, if not set, the first available cell is used.
537 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
539 /// <since_tizen> 3 </since_tizen>
540 public Vector2 CellIndex
544 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
545 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
549 SetValue(CellIndexProperty, value);
550 NotifyPropertyChanged();
555 /// The number of rows this child occupies, if not set, the default value is 1.
557 /// <since_tizen> 3 </since_tizen>
562 return (float)GetValue(RowSpanProperty);
566 SetValue(RowSpanProperty, value);
567 NotifyPropertyChanged();
572 /// The number of columns this child occupies, if not set, the default value is 1.
574 /// <since_tizen> 3 </since_tizen>
575 public float ColumnSpan
579 return (float)GetValue(ColumnSpanProperty);
583 SetValue(ColumnSpanProperty, value);
584 NotifyPropertyChanged();
589 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
591 /// <since_tizen> 3 </since_tizen>
592 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
596 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
600 SetValue(CellHorizontalAlignmentProperty, value);
601 NotifyPropertyChanged();
606 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
608 /// <since_tizen> 3 </since_tizen>
609 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
613 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
617 SetValue(CellVerticalAlignmentProperty, value);
618 NotifyPropertyChanged();
623 /// The left focusable view.<br />
624 /// This will return null if not set.<br />
625 /// This will also return null if the specified left focusable view is not on a window.<br />
627 /// <since_tizen> 3 </since_tizen>
628 public View LeftFocusableView
630 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
633 return (View)GetValue(LeftFocusableViewProperty);
637 SetValue(LeftFocusableViewProperty, value);
638 NotifyPropertyChanged();
643 /// The right focusable view.<br />
644 /// This will return null if not set.<br />
645 /// This will also return null if the specified right focusable view is not on a window.<br />
647 /// <since_tizen> 3 </since_tizen>
648 public View RightFocusableView
650 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
653 return (View)GetValue(RightFocusableViewProperty);
657 SetValue(RightFocusableViewProperty, value);
658 NotifyPropertyChanged();
663 /// The up focusable view.<br />
664 /// This will return null if not set.<br />
665 /// This will also return null if the specified up focusable view is not on a window.<br />
667 /// <since_tizen> 3 </since_tizen>
668 public View UpFocusableView
670 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
673 return (View)GetValue(UpFocusableViewProperty);
677 SetValue(UpFocusableViewProperty, value);
678 NotifyPropertyChanged();
683 /// The down focusable view.<br />
684 /// This will return null if not set.<br />
685 /// This will also return null if the specified down focusable view is not on a window.<br />
687 /// <since_tizen> 3 </since_tizen>
688 public View DownFocusableView
690 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
693 return (View)GetValue(DownFocusableViewProperty);
697 SetValue(DownFocusableViewProperty, value);
698 NotifyPropertyChanged();
703 /// Whether the view should be focusable by keyboard navigation.
705 /// <since_tizen> 3 </since_tizen>
706 public bool Focusable
710 SetValue(FocusableProperty, value);
711 NotifyPropertyChanged();
715 return (bool)GetValue(FocusableProperty);
720 /// Retrieves the position of the view.<br />
721 /// The coordinates are relative to the view's parent.<br />
723 /// <since_tizen> 3 </since_tizen>
724 public Position CurrentPosition
728 return GetCurrentPosition();
733 /// Sets the size of a view for the width and the height.<br />
734 /// Geometry can be scaled to fit within this area.<br />
735 /// This does not interfere with the view's scale factor.<br />
736 /// The views default depth is the minimum of width and height.<br />
739 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
740 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
742 /// <since_tizen> 3 </since_tizen>
747 Size2D temp = (Size2D)GetValue(Size2DProperty);
748 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
752 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
753 SetValue(Size2DProperty, value);
754 // Set Specification so when layouts measure this View it matches the value set here.
755 // All Views are currently Layouts.
756 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
757 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
758 _widthPolicy = value.Width;
759 _heightPolicy = value.Height;
760 _layout?.RequestLayout();
761 NotifyPropertyChanged();
766 /// Retrieves the size of the view.<br />
767 /// The coordinates are relative to the view's parent.<br />
769 /// <since_tizen> 3 </since_tizen>
770 public Size2D CurrentSize
774 return GetCurrentSize();
779 /// Retrieves and sets the view's opacity.<br />
781 /// <since_tizen> 3 </since_tizen>
786 return (float)GetValue(OpacityProperty);
790 SetValue(OpacityProperty, value);
791 selectorData?.Opacity.UpdateIfNeeds(this, value);
792 NotifyPropertyChanged();
797 /// Sets the position of the view for X and Y.<br />
798 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
799 /// If the position inheritance is disabled, sets the world position.<br />
802 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
803 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
805 /// <since_tizen> 3 </since_tizen>
806 public Position2D Position2D
810 Position2D temp = (Position2D)GetValue(Position2DProperty);
811 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
815 SetValue(Position2DProperty, value);
816 NotifyPropertyChanged();
821 /// Retrieves the screen postion of the view.<br />
823 /// <since_tizen> 3 </since_tizen>
824 public Vector2 ScreenPosition
828 Vector2 temp = new Vector2(0.0f, 0.0f);
829 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
835 /// Determines whether the pivot point should be used to determine the position of the view.
836 /// This is false by default.
838 /// <remarks>If false, then the top-left of the view is used for the position.
839 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
841 /// <since_tizen> 3 </since_tizen>
842 public bool PositionUsesPivotPoint
846 return (bool)GetValue(PositionUsesPivotPointProperty);
850 SetValue(PositionUsesPivotPointProperty, value);
851 NotifyPropertyChanged();
856 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
858 /// <since_tizen> 3 </since_tizen>
859 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
861 "View view = new View(); " +
862 "view.PivotPoint = PivotPoint.Center; " +
863 "view.PositionUsesPivotPoint = true;" +
864 " Deprecated in API5: Will be removed in API8")]
865 [EditorBrowsable(EditorBrowsableState.Never)]
866 public bool PositionUsesAnchorPoint
871 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
876 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
877 NotifyPropertyChanged();
882 /// Queries whether the view is connected to the stage.<br />
883 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
885 /// <since_tizen> 3 </since_tizen>
886 public bool IsOnWindow
895 /// Gets the depth in the hierarchy for the view.
897 /// <since_tizen> 3 </since_tizen>
898 public int HierarchyDepth
902 return GetHierarchyDepth();
907 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
910 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
911 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
912 /// The values set by this property will likely change.
914 /// <since_tizen> 3 </since_tizen>
915 public int SiblingOrder
919 return (int)GetValue(SiblingOrderProperty);
923 SetValue(SiblingOrderProperty, value);
925 LayoutGroup layout = Layout as LayoutGroup;
926 layout?.ChangeLayoutSiblingOrder(value);
928 NotifyPropertyChanged();
933 /// Returns the natural size of the view.
936 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
938 /// <since_tizen> 5 </since_tizen>
939 public Vector3 NaturalSize
943 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
944 if (NDalicPINVOKE.SWIGPendingException.Pending)
945 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
951 /// Returns the natural size (Size2D) of the view.
954 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
956 /// <since_tizen> 4 </since_tizen>
957 public Size2D NaturalSize2D
961 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
962 if (NDalicPINVOKE.SWIGPendingException.Pending)
963 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
965 return new Size2D((int)temp.Width, (int)temp.Height);
970 /// Gets or sets the origin of a view within its parent's area.<br />
971 /// 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 />
972 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
973 /// A view's position is the distance between this origin and the view's anchor-point.<br />
975 /// <pre>The view has been initialized.</pre>
976 /// <since_tizen> 3 </since_tizen>
977 public Position ParentOrigin
981 Position tmp = (Position)GetValue(ParentOriginProperty);
982 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
986 SetValue(ParentOriginProperty, value);
987 NotifyPropertyChanged();
992 /// Gets or sets the anchor-point of a view.<br />
993 /// 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 />
994 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
995 /// A view position is the distance between its parent-origin and this anchor-point.<br />
996 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
997 /// <pre>The view has been initialized.</pre>
1000 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1002 /// <since_tizen> 3 </since_tizen>
1003 public Position PivotPoint
1007 Position tmp = (Position)GetValue(PivotPointProperty);
1008 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1012 SetValue(PivotPointProperty, value);
1013 NotifyPropertyChanged();
1018 /// Gets or sets the size width of the view.
1022 /// Animatable - This property can be animated using <c>Animation</c> class.
1025 /// <since_tizen> 3 </since_tizen>
1026 public float SizeWidth
1030 return (float)GetValue(SizeWidthProperty);
1034 SetValue(SizeWidthProperty, value);
1035 NotifyPropertyChanged();
1040 /// Gets or sets the size height of the view.
1044 /// Animatable - This property can be animated using <c>Animation</c> class.
1047 /// <since_tizen> 3 </since_tizen>
1048 public float SizeHeight
1052 return (float)GetValue(SizeHeightProperty);
1056 SetValue(SizeHeightProperty, value);
1057 NotifyPropertyChanged();
1062 /// Gets or sets the position of the view.<br />
1063 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1064 /// If the position inheritance is disabled, sets the world position.<br />
1068 /// Animatable - This property can be animated using <c>Animation</c> class.
1070 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1072 /// <since_tizen> 3 </since_tizen>
1073 public Position Position
1077 Position tmp = (Position)GetValue(PositionProperty);
1078 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1082 SetValue(PositionProperty, value);
1083 NotifyPropertyChanged();
1088 /// Gets or sets the position X of the view.
1092 /// Animatable - This property can be animated using <c>Animation</c> class.
1095 /// <since_tizen> 3 </since_tizen>
1096 public float PositionX
1100 return (float)GetValue(PositionXProperty);
1104 SetValue(PositionXProperty, value);
1105 NotifyPropertyChanged();
1110 /// Gets or sets the position Y of the view.
1114 /// Animatable - This property can be animated using <c>Animation</c> class.
1117 /// <since_tizen> 3 </since_tizen>
1118 public float PositionY
1122 return (float)GetValue(PositionYProperty);
1126 SetValue(PositionYProperty, value);
1127 NotifyPropertyChanged();
1132 /// Gets or sets the position Z of the view.
1136 /// Animatable - This property can be animated using <c>Animation</c> class.
1139 /// <since_tizen> 3 </since_tizen>
1140 public float PositionZ
1144 return (float)GetValue(PositionZProperty);
1148 SetValue(PositionZProperty, value);
1149 NotifyPropertyChanged();
1154 /// Gets or sets the world position of the view.
1156 /// <since_tizen> 3 </since_tizen>
1157 public Vector3 WorldPosition
1161 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1162 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1168 /// Gets or sets the orientation of the view.<br />
1169 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1173 /// This is an asynchronous method.
1176 /// Animatable - This property can be animated using <c>Animation</c> class.
1179 /// <since_tizen> 3 </since_tizen>
1180 public Rotation Orientation
1184 return (Rotation)GetValue(OrientationProperty);
1188 SetValue(OrientationProperty, value);
1189 NotifyPropertyChanged();
1194 /// Gets or sets the world orientation of the view.<br />
1196 /// <since_tizen> 3 </since_tizen>
1197 public Rotation WorldOrientation
1201 Rotation temp = new Rotation();
1202 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1208 /// Gets or sets the scale factor applied to the view.<br />
1212 /// Animatable - This property can be animated using <c>Animation</c> class.
1214 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1216 /// <since_tizen> 3 </since_tizen>
1217 public Vector3 Scale
1221 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1222 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1226 SetValue(ScaleProperty, value);
1227 NotifyPropertyChanged();
1232 /// Gets or sets the scale X factor applied to the view.
1236 /// Animatable - This property can be animated using <c>Animation</c> class.
1239 /// <since_tizen> 3 </since_tizen>
1244 return (float)GetValue(ScaleXProperty);
1248 SetValue(ScaleXProperty, value);
1249 NotifyPropertyChanged();
1254 /// Gets or sets the scale Y factor applied to the view.
1258 /// Animatable - This property can be animated using <c>Animation</c> class.
1261 /// <since_tizen> 3 </since_tizen>
1266 return (float)GetValue(ScaleYProperty);
1270 SetValue(ScaleYProperty, value);
1271 NotifyPropertyChanged();
1276 /// Gets or sets the scale Z factor applied to the view.
1280 /// Animatable - This property can be animated using <c>Animation</c> class.
1283 /// <since_tizen> 3 </since_tizen>
1288 return (float)GetValue(ScaleZProperty);
1292 SetValue(ScaleZProperty, value);
1293 NotifyPropertyChanged();
1298 /// Gets the world scale of the view.
1300 /// <since_tizen> 3 </since_tizen>
1301 public Vector3 WorldScale
1305 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1306 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1312 /// Retrieves the visibility flag of the view.
1316 /// If the view is not visible, then the view and its children will not be rendered.
1317 /// 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.
1320 /// Animatable - This property can be animated using <c>Animation</c> class.
1323 /// <since_tizen> 3 </since_tizen>
1324 public bool Visibility
1329 GetProperty(View.Property.VISIBLE).Get(out temp);
1335 /// Gets the view's world color.
1337 /// <since_tizen> 3 </since_tizen>
1338 public Vector4 WorldColor
1342 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1343 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1349 /// Gets or sets the view's name.
1351 /// <since_tizen> 3 </since_tizen>
1356 return (string)GetValue(NameProperty);
1360 SetValue(NameProperty, value);
1361 NotifyPropertyChanged();
1366 /// Get the number of children held by the view.
1368 /// <since_tizen> 3 </since_tizen>
1369 public new uint ChildCount
1373 return GetChildCount();
1378 /// Gets the view's ID.
1381 /// <since_tizen> 3 </since_tizen>
1391 /// Gets or sets the status of whether the view should emit touch or hover signals.
1393 /// <since_tizen> 3 </since_tizen>
1394 public bool Sensitive
1398 return (bool)GetValue(SensitiveProperty);
1402 SetValue(SensitiveProperty, value);
1403 NotifyPropertyChanged();
1408 /// 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.
1410 /// <since_tizen> 3 </since_tizen>
1411 public bool LeaveRequired
1415 return (bool)GetValue(LeaveRequiredProperty);
1419 SetValue(LeaveRequiredProperty, value);
1420 NotifyPropertyChanged();
1425 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1427 /// <since_tizen> 3 </since_tizen>
1428 public bool InheritOrientation
1432 return (bool)GetValue(InheritOrientationProperty);
1436 SetValue(InheritOrientationProperty, value);
1437 NotifyPropertyChanged();
1442 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1444 /// <since_tizen> 3 </since_tizen>
1445 public bool InheritScale
1449 return (bool)GetValue(InheritScaleProperty);
1453 SetValue(InheritScaleProperty, value);
1454 NotifyPropertyChanged();
1459 /// Gets or sets the status of how the view and its children should be drawn.<br />
1460 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1461 /// 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 />
1462 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1463 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1464 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1466 /// <since_tizen> 3 </since_tizen>
1467 public DrawModeType DrawMode
1471 return (DrawModeType)GetValue(DrawModeProperty);
1475 SetValue(DrawModeProperty, value);
1476 NotifyPropertyChanged();
1481 /// Gets or sets the relative to parent size factor of the view.<br />
1482 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1483 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1486 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1488 /// <since_tizen> 3 </since_tizen>
1489 public Vector3 SizeModeFactor
1493 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1494 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1498 SetValue(SizeModeFactorProperty, value);
1499 NotifyPropertyChanged();
1504 /// Gets or sets the width resize policy to be used.
1506 /// <since_tizen> 3 </since_tizen>
1507 public ResizePolicyType WidthResizePolicy
1511 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1515 SetValue(WidthResizePolicyProperty, value);
1516 NotifyPropertyChanged();
1521 /// Gets or sets the height resize policy to be used.
1523 /// <since_tizen> 3 </since_tizen>
1524 public ResizePolicyType HeightResizePolicy
1528 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1532 SetValue(HeightResizePolicyProperty, value);
1533 NotifyPropertyChanged();
1538 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1539 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1541 /// <since_tizen> 3 </since_tizen>
1542 public SizeScalePolicyType SizeScalePolicy
1546 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1550 SetValue(SizeScalePolicyProperty, value);
1551 NotifyPropertyChanged();
1556 /// Gets or sets the status of whether the width size is dependent on the height size.
1558 /// <since_tizen> 3 </since_tizen>
1559 public bool WidthForHeight
1563 return (bool)GetValue(WidthForHeightProperty);
1567 SetValue(WidthForHeightProperty, value);
1568 NotifyPropertyChanged();
1573 /// Gets or sets the status of whether the height size is dependent on the width size.
1575 /// <since_tizen> 3 </since_tizen>
1576 public bool HeightForWidth
1580 return (bool)GetValue(HeightForWidthProperty);
1584 SetValue(HeightForWidthProperty, value);
1585 NotifyPropertyChanged();
1590 /// Gets or sets the padding for use in layout.
1593 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1595 /// <since_tizen> 5 </since_tizen>
1596 public Extents Padding
1600 // If View has a Layout then padding in stored in the base Layout class
1603 return Layout.Padding;
1607 Extents temp = (Extents)GetValue(PaddingProperty);
1608 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1610 // Two return points to prevent creating a zeroed Extent native object before assignment
1614 Extents padding = value;
1617 // Layout set so store Padding in LayoutItem instead of in View.
1618 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1619 // the position and sizes measure in the Layouting.
1620 Layout.Padding = value;
1621 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1622 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1623 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1625 padding = new Extents(0,0,0,0); // Reset value stored in View.
1627 _layout?.RequestLayout();
1629 SetValue(PaddingProperty, padding);
1630 NotifyPropertyChanged();
1631 _layout?.RequestLayout();
1636 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1639 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1641 /// <since_tizen> 3 </since_tizen>
1642 public Size2D MinimumSize
1646 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1647 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1651 if (_layout != null)
1653 // Note: it only works if minimum size is >= than natural size.
1654 // To force the size it should be done through the width&height spec or Size2D.
1655 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1656 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1657 _layout.RequestLayout();
1659 SetValue(MinimumSizeProperty, value);
1660 NotifyPropertyChanged();
1665 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1668 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1670 /// <since_tizen> 3 </since_tizen>
1671 public Size2D MaximumSize
1675 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1676 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1680 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1681 // MATCH_PARENT spec + parent container size can be used to limit
1682 if (_layout != null)
1684 _layout.RequestLayout();
1686 SetValue(MaximumSizeProperty, value);
1687 NotifyPropertyChanged();
1692 /// Gets or sets whether a child view inherits it's parent's position.<br />
1693 /// Default is to inherit.<br />
1694 /// 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 />
1696 /// <since_tizen> 3 </since_tizen>
1697 public bool InheritPosition
1701 return (bool)GetValue(InheritPositionProperty);
1705 SetValue(InheritPositionProperty, value);
1706 NotifyPropertyChanged();
1711 /// Gets or sets the clipping behavior (mode) of it's children.
1713 /// <since_tizen> 3 </since_tizen>
1714 public ClippingModeType ClippingMode
1718 return (ClippingModeType)GetValue(ClippingModeProperty);
1722 SetValue(ClippingModeProperty, value);
1723 NotifyPropertyChanged();
1728 /// Gets the number of renderers held by the view.
1730 /// <since_tizen> 3 </since_tizen>
1731 public uint RendererCount
1735 return GetRendererCount();
1740 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1743 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1745 /// <since_tizen> 3 </since_tizen>
1746 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1748 "View view = new View(); " +
1749 "view.PivotPoint = PivotPoint.Center; " +
1750 "view.PositionUsesPivotPoint = true;")]
1751 [EditorBrowsable(EditorBrowsableState.Never)]
1752 public Position AnchorPoint
1756 Position temp = new Position(0.0f, 0.0f, 0.0f);
1757 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1758 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1762 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1763 NotifyPropertyChanged();
1768 /// Sets the size of a view for the width, the height and the depth.<br />
1769 /// Geometry can be scaled to fit within this area.<br />
1770 /// This does not interfere with the view's scale factor.<br />
1771 /// The views default depth is the minimum of width and height.<br />
1775 /// Animatable - This property can be animated using <c>Animation</c> class.
1777 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1779 /// <since_tizen> 5 </since_tizen>
1784 Size tmp = (Size)GetValue(SizeProperty);
1785 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1789 SetValue(SizeProperty, value);
1790 NotifyPropertyChanged();
1795 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1797 /// <since_tizen> 3 </since_tizen>
1798 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1800 "Container parent = view.GetParent(); " +
1801 "View view = parent as View;")]
1802 [EditorBrowsable(EditorBrowsableState.Never)]
1803 public new View Parent
1808 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1809 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1810 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1812 if (basehandle is Layer layer)
1814 ret = new View(Layer.getCPtr(layer).Handle, false);
1815 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1819 ret = basehandle as View;
1822 Interop.BaseHandle.delete_BaseHandle(CPtr);
1823 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1825 if (NDalicPINVOKE.SWIGPendingException.Pending)
1826 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1832 /// Gets/Sets whether inherit parent's the layout Direction.
1834 /// <since_tizen> 4 </since_tizen>
1835 public bool InheritLayoutDirection
1839 return (bool)GetValue(InheritLayoutDirectionProperty);
1843 SetValue(InheritLayoutDirectionProperty, value);
1844 NotifyPropertyChanged();
1849 /// Gets/Sets the layout Direction.
1851 /// <since_tizen> 4 </since_tizen>
1852 public ViewLayoutDirectionType LayoutDirection
1856 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1860 SetValue(LayoutDirectionProperty, value);
1861 NotifyPropertyChanged();
1862 _layout?.RequestLayout();
1867 /// Gets or sets the Margin for use in layout.
1870 /// Margin property is supported by Layout algorithms and containers.
1871 /// Please Set Layout if you want to use Margin property.
1872 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1874 /// <since_tizen> 4 </since_tizen>
1875 public Extents Margin
1879 // If View has a Layout then margin is stored in Layout.
1882 return Layout.Margin;
1886 // If Layout not set then return margin stored in View.
1887 Extents temp = (Extents)GetValue(MarginProperty);
1888 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1890 // Two return points to prevent creating a zeroed Extent native object before assignment
1896 // Layout set so store Margin in LayoutItem instead of View.
1897 // If View stores the Margin too then the Legacy Size Negotiation will
1898 // overwrite the position and size values measured in the Layouting.
1899 Layout.Margin = value;
1900 SetValue(MarginProperty, new Extents(0,0,0,0));
1901 _layout?.RequestLayout();
1905 SetValue(MarginProperty, value);
1907 NotifyPropertyChanged();
1908 _layout?.RequestLayout();
1913 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1915 /// <since_tizen> 6 </since_tizen>
1916 public int WidthSpecification
1920 return _widthPolicy;
1924 _widthPolicy = value;
1925 if( _oldWidthPolicy != _widthPolicy )
1927 if (_widthPolicy >= 0)
1929 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1931 if(_heightPolicy>=0) // Policy an exact value
1933 Size2D.Width = _widthPolicy;
1937 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1938 // Size2D height will store the specification value (negative number) this will then be applied to the
1939 // HeightSpecification when the Size2D callback is invoked.
1940 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1943 _layout?.RequestLayout();
1944 _oldWidthPolicy = _widthPolicy;
1950 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1952 /// <since_tizen> 6 </since_tizen>
1953 public int HeightSpecification
1957 return _heightPolicy;
1961 _heightPolicy = value;
1962 if( _oldHeightPolicy != _heightPolicy )
1964 if (_heightPolicy >= 0)
1966 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1968 if(_widthPolicy>=0) // Policy an exact value
1970 Size2D.Height = _heightPolicy;
1974 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1975 // Size2D height will store the specification value (negative number) this will then be applied to the
1976 // HeightSpecification when the Size2D callback is invoked.
1977 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1981 _layout?.RequestLayout();
1982 _oldHeightPolicy = _heightPolicy;
1988 /// Gets the List of transitions for this View.
1990 /// <since_tizen> 6 </since_tizen>
1991 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
1995 if (_layoutTransitions == null)
1997 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
1999 return _layoutTransitions;
2004 /// Set a layout transitions for this View.
2007 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2009 /// <since_tizen> 6 </since_tizen>
2010 public LayoutTransition LayoutTransition
2014 if (_layoutTransitions == null)
2016 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2018 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2020 AttachTransitionsToChildren(value);
2025 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2028 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2030 /// <since_tizen> 4 </since_tizen>
2031 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2032 [EditorBrowsable(EditorBrowsableState.Never)]
2033 public Extents PaddingEX
2037 Extents temp = new Extents(0, 0, 0, 0);
2038 GetProperty(View.Property.PADDING).Get(temp);
2039 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2043 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2044 NotifyPropertyChanged();
2045 _layout?.RequestLayout();
2049 /// <since_tizen> 6 </since_tizen>
2050 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2051 [EditorBrowsable(EditorBrowsableState.Never)]
2052 public Style XamlStyle
2056 return (Style)GetValue(XamlStyleProperty);
2060 SetValue(XamlStyleProperty, value);
2065 /// The Color of View. This is an RGBA value.
2069 /// Animatable - This property can be animated using <c>Animation</c> class.
2071 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2073 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2074 [EditorBrowsable(EditorBrowsableState.Never)]
2079 Color temp = (Color)GetValue(ColorProperty);
2080 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2084 SetValue(ColorProperty, value);
2085 selectorData?.Color.UpdateIfNeeds(this, value);
2086 NotifyPropertyChanged();
2091 /// Set the layout on this View. Replaces any existing Layout.
2093 /// <since_tizen> 6 </since_tizen>
2094 public LayoutItem Layout
2102 // Do nothing if layout provided is already set on this View.
2103 if (value == _layout)
2108 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2109 layoutingDisabled = false;
2112 // If new layout being set already has a owner then that owner receives a replacement default layout.
2113 // First check if the layout to be set already has a owner.
2114 if (value?.Owner != null)
2116 // Previous owner of the layout gets a default layout as a replacement.
2117 value.Owner.Layout = new AbsoluteLayout();
2119 // Copy Margin and Padding to replacement LayoutGroup.
2120 value.Owner.Layout.Margin = value.Margin;
2121 value.Owner.Layout.Padding = value.Padding;
2124 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2125 // View if no replacement. Previously margin and padding values would have been moved from
2126 // the View to the layout.
2127 if (_layout != null ) // Existing layout
2131 // Existing layout being replaced so copy over margin and padding values.
2132 value.Margin = _layout.Margin;
2133 value.Padding = _layout.Padding;
2137 // Layout not being replaced so restore margin and padding to View.
2138 SetValue(MarginProperty, _layout.Margin);
2139 SetValue(PaddingProperty, _layout.Padding);
2140 NotifyPropertyChanged();
2145 // First Layout to be added to the View hence copy
2147 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2150 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2152 // If View already has a margin set then store it in Layout instead.
2153 value.Margin = Margin;
2154 SetValue(MarginProperty, new Extents(0,0,0,0));
2155 NotifyPropertyChanged();
2158 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2160 // If View already has a padding set then store it in Layout instead.
2161 value.Padding = Padding;
2162 SetValue(PaddingProperty, new Extents(0,0,0,0));
2163 NotifyPropertyChanged();
2168 // Remove existing layout from it's parent layout group.
2169 _layout?.Unparent();
2171 // Set layout to this view
2177 /// The weight of the View, used to share available space in a layout with siblings.
2179 /// <since_tizen> 6 </since_tizen>
2189 _layout?.RequestLayout();
2194 /// Whether to load the BackgroundImage synchronously.
2195 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2196 /// Note: For Normal Quad images only.
2198 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2199 [EditorBrowsable(EditorBrowsableState.Never)]
2200 public bool BackgroundImageSynchronosLoading
2204 return _backgroundImageSynchronosLoading;
2208 _backgroundImageSynchronosLoading = value;
2211 Background.Find(Visual.Property.Type)?.Get(out visualType);
2212 if (visualType == (int)Visual.Type.Image)
2214 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2217 if (bgUrl.Length != 0)
2219 PropertyMap bgMap = this.Background;
2220 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2226 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2227 [EditorBrowsable(EditorBrowsableState.Never)]
2228 public Vector2 UpdateSizeHint
2232 return (Vector2)GetValue(UpdateSizeHintProperty);
2236 SetValue(UpdateSizeHintProperty, value);
2237 NotifyPropertyChanged();
2241 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2242 [EditorBrowsable(EditorBrowsableState.Never)]
2243 public string[] TransitionNames
2247 return transitionNames;
2251 transitionNames = value;
2257 /// Enable/Disable ControlState propagation for children.
2258 /// It is false by default.
2259 /// If the View needs to share ControlState with descendants, please set it true.
2260 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2262 [EditorBrowsable(EditorBrowsableState.Never)]
2263 public bool EnableControlStatePropagation
2265 get => controlStatePropagation;
2268 controlStatePropagation = value;
2270 foreach (View child in Children)
2272 child.EnableControlStatePropagation = value;
2278 /// Get Style, it is abstract function and must be override.
2280 /// <since_tizen> 6 </since_tizen>
2281 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2282 // TODO: It should be deprecated. please use CreateViewStyle instead.
2283 [EditorBrowsable(EditorBrowsableState.Never)]
2284 protected virtual ViewStyle GetViewStyle()
2286 return CreateViewStyle();
2290 /// Create Style, it is abstract function and must be override.
2292 [EditorBrowsable(EditorBrowsableState.Never)]
2293 protected virtual ViewStyle CreateViewStyle()
2295 return new ViewStyle();
2299 /// Called after the View's ControlStates changed.
2301 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2302 [EditorBrowsable(EditorBrowsableState.Never)]
2303 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2307 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2308 [EditorBrowsable(EditorBrowsableState.Never)]
2309 public virtual void ApplyStyle(ViewStyle viewStyle)
2311 if (null == viewStyle || this.viewStyle == viewStyle) return;
2313 this.viewStyle = viewStyle;
2315 Dictionary<string, BindableProperty> bindablePropertyOfView;
2316 Type viewType = GetType();
2318 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2319 Type styleType = viewStyle.GetType();
2321 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2322 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2324 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2326 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2328 BindableProperty viewProperty;
2329 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2331 if (null != viewProperty)
2333 object value = viewStyle.GetValue(keyValuePair.Value);
2337 SetValue(viewProperty, value);