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 (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1625 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1629 SetValue(PaddingProperty, padding);
1630 NotifyPropertyChanged();
1635 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1638 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1640 /// <since_tizen> 3 </since_tizen>
1641 public Size2D MinimumSize
1645 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1646 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1650 if (_layout != null)
1652 // Note: it only works if minimum size is >= than natural size.
1653 // To force the size it should be done through the width&height spec or Size2D.
1654 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1655 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1656 _layout.RequestLayout();
1658 SetValue(MinimumSizeProperty, value);
1659 NotifyPropertyChanged();
1664 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1667 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1669 /// <since_tizen> 3 </since_tizen>
1670 public Size2D MaximumSize
1674 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1675 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1679 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1680 // MATCH_PARENT spec + parent container size can be used to limit
1681 if (_layout != null)
1683 _layout.RequestLayout();
1685 SetValue(MaximumSizeProperty, value);
1686 NotifyPropertyChanged();
1691 /// Gets or sets whether a child view inherits it's parent's position.<br />
1692 /// Default is to inherit.<br />
1693 /// 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 />
1695 /// <since_tizen> 3 </since_tizen>
1696 public bool InheritPosition
1700 return (bool)GetValue(InheritPositionProperty);
1704 SetValue(InheritPositionProperty, value);
1705 NotifyPropertyChanged();
1710 /// Gets or sets the clipping behavior (mode) of it's children.
1712 /// <since_tizen> 3 </since_tizen>
1713 public ClippingModeType ClippingMode
1717 return (ClippingModeType)GetValue(ClippingModeProperty);
1721 SetValue(ClippingModeProperty, value);
1722 NotifyPropertyChanged();
1727 /// Gets the number of renderers held by the view.
1729 /// <since_tizen> 3 </since_tizen>
1730 public uint RendererCount
1734 return GetRendererCount();
1739 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1742 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1744 /// <since_tizen> 3 </since_tizen>
1745 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1747 "View view = new View(); " +
1748 "view.PivotPoint = PivotPoint.Center; " +
1749 "view.PositionUsesPivotPoint = true;")]
1750 [EditorBrowsable(EditorBrowsableState.Never)]
1751 public Position AnchorPoint
1755 Position temp = new Position(0.0f, 0.0f, 0.0f);
1756 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1757 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1761 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1762 NotifyPropertyChanged();
1767 /// Sets the size of a view for the width, the height and the depth.<br />
1768 /// Geometry can be scaled to fit within this area.<br />
1769 /// This does not interfere with the view's scale factor.<br />
1770 /// The views default depth is the minimum of width and height.<br />
1774 /// Animatable - This property can be animated using <c>Animation</c> class.
1776 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1778 /// <since_tizen> 5 </since_tizen>
1783 Size tmp = (Size)GetValue(SizeProperty);
1784 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1788 SetValue(SizeProperty, value);
1789 NotifyPropertyChanged();
1794 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1796 /// <since_tizen> 3 </since_tizen>
1797 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1799 "Container parent = view.GetParent(); " +
1800 "View view = parent as View;")]
1801 [EditorBrowsable(EditorBrowsableState.Never)]
1802 public new View Parent
1807 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1808 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1809 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1811 if (basehandle is Layer layer)
1813 ret = new View(Layer.getCPtr(layer).Handle, false);
1814 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1818 ret = basehandle as View;
1821 Interop.BaseHandle.delete_BaseHandle(CPtr);
1822 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1824 if (NDalicPINVOKE.SWIGPendingException.Pending)
1825 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1831 /// Gets/Sets whether inherit parent's the layout Direction.
1833 /// <since_tizen> 4 </since_tizen>
1834 public bool InheritLayoutDirection
1838 return (bool)GetValue(InheritLayoutDirectionProperty);
1842 SetValue(InheritLayoutDirectionProperty, value);
1843 NotifyPropertyChanged();
1848 /// Gets/Sets the layout Direction.
1850 /// <since_tizen> 4 </since_tizen>
1851 public ViewLayoutDirectionType LayoutDirection
1855 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1859 SetValue(LayoutDirectionProperty, value);
1860 NotifyPropertyChanged();
1861 _layout?.RequestLayout();
1866 /// Gets or sets the Margin for use in layout.
1869 /// Margin property is supported by Layout algorithms and containers.
1870 /// Please Set Layout if you want to use Margin property.
1871 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1873 /// <since_tizen> 4 </since_tizen>
1874 public Extents Margin
1878 // If View has a Layout then margin is stored in Layout.
1881 return Layout.Margin;
1885 // If Layout not set then return margin stored in View.
1886 Extents temp = (Extents)GetValue(MarginProperty);
1887 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1889 // Two return points to prevent creating a zeroed Extent native object before assignment
1895 // Layout set so store Margin in LayoutItem instead of View.
1896 // If View stores the Margin too then the Legacy Size Negotiation will
1897 // overwrite the position and size values measured in the Layouting.
1898 Layout.Margin = value;
1899 SetValue(MarginProperty, new Extents(0,0,0,0));
1900 _layout?.RequestLayout();
1904 SetValue(MarginProperty, value);
1906 NotifyPropertyChanged();
1907 _layout?.RequestLayout();
1912 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1914 /// <since_tizen> 6 </since_tizen>
1915 public int WidthSpecification
1919 return _widthPolicy;
1923 _widthPolicy = value;
1924 if( _oldWidthPolicy != _widthPolicy )
1926 if (_widthPolicy >= 0)
1928 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1930 if(_heightPolicy>=0) // Policy an exact value
1932 Size2D.Width = _widthPolicy;
1936 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1937 // Size2D height will store the specification value (negative number) this will then be applied to the
1938 // HeightSpecification when the Size2D callback is invoked.
1939 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1942 _layout?.RequestLayout();
1943 _oldWidthPolicy = _widthPolicy;
1949 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1951 /// <since_tizen> 6 </since_tizen>
1952 public int HeightSpecification
1956 return _heightPolicy;
1960 _heightPolicy = value;
1961 if( _oldHeightPolicy != _heightPolicy )
1963 if (_heightPolicy >= 0)
1965 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1967 if(_widthPolicy>=0) // Policy an exact value
1969 Size2D.Height = _heightPolicy;
1973 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1974 // Size2D height will store the specification value (negative number) this will then be applied to the
1975 // HeightSpecification when the Size2D callback is invoked.
1976 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1980 _layout?.RequestLayout();
1981 _oldHeightPolicy = _heightPolicy;
1987 /// Gets the List of transitions for this View.
1989 /// <since_tizen> 6 </since_tizen>
1990 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
1994 if (_layoutTransitions == null)
1996 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
1998 return _layoutTransitions;
2003 /// Set a layout transitions for this View.
2006 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2008 /// <since_tizen> 6 </since_tizen>
2009 public LayoutTransition LayoutTransition
2013 if (_layoutTransitions == null)
2015 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2017 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2019 AttachTransitionsToChildren(value);
2024 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2027 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2029 /// <since_tizen> 4 </since_tizen>
2030 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2031 [EditorBrowsable(EditorBrowsableState.Never)]
2032 public Extents PaddingEX
2036 Extents temp = new Extents(0, 0, 0, 0);
2037 GetProperty(View.Property.PADDING).Get(temp);
2038 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2042 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2043 NotifyPropertyChanged();
2044 _layout?.RequestLayout();
2048 /// <since_tizen> 6 </since_tizen>
2049 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2050 [EditorBrowsable(EditorBrowsableState.Never)]
2051 public Style XamlStyle
2055 return (Style)GetValue(XamlStyleProperty);
2059 SetValue(XamlStyleProperty, value);
2064 /// The Color of View. This is an RGBA value.
2068 /// Animatable - This property can be animated using <c>Animation</c> class.
2070 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2072 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2073 [EditorBrowsable(EditorBrowsableState.Never)]
2078 Color temp = (Color)GetValue(ColorProperty);
2079 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2083 SetValue(ColorProperty, value);
2084 selectorData?.Color.UpdateIfNeeds(this, value);
2085 NotifyPropertyChanged();
2090 /// Set the layout on this View. Replaces any existing Layout.
2092 /// <since_tizen> 6 </since_tizen>
2093 public LayoutItem Layout
2101 // Do nothing if layout provided is already set on this View.
2102 if (value == _layout)
2107 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2108 layoutingDisabled = false;
2111 // If new layout being set already has a owner then that owner receives a replacement default layout.
2112 // First check if the layout to be set already has a owner.
2113 if (value?.Owner != null)
2115 // Previous owner of the layout gets a default layout as a replacement.
2116 value.Owner.Layout = new AbsoluteLayout();
2118 // Copy Margin and Padding to replacement LayoutGroup.
2119 value.Owner.Layout.Margin = value.Margin;
2120 value.Owner.Layout.Padding = value.Padding;
2123 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2124 // View if no replacement. Previously margin and padding values would have been moved from
2125 // the View to the layout.
2126 if (_layout != null ) // Existing layout
2130 // Existing layout being replaced so copy over margin and padding values.
2131 value.Margin = _layout.Margin;
2132 value.Padding = _layout.Padding;
2136 // Layout not being replaced so restore margin and padding to View.
2137 SetValue(MarginProperty, _layout.Margin);
2138 SetValue(PaddingProperty, _layout.Padding);
2139 NotifyPropertyChanged();
2144 // First Layout to be added to the View hence copy
2146 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2149 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2151 // If View already has a margin set then store it in Layout instead.
2152 value.Margin = Margin;
2153 SetValue(MarginProperty, new Extents(0,0,0,0));
2154 NotifyPropertyChanged();
2157 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2159 // If View already has a padding set then store it in Layout instead.
2160 value.Padding = Padding;
2161 SetValue(PaddingProperty, new Extents(0,0,0,0));
2162 NotifyPropertyChanged();
2167 // Remove existing layout from it's parent layout group.
2168 _layout?.Unparent();
2170 // Set layout to this view
2176 /// The weight of the View, used to share available space in a layout with siblings.
2178 /// <since_tizen> 6 </since_tizen>
2188 _layout?.RequestLayout();
2193 /// Whether to load the BackgroundImage synchronously.
2194 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2195 /// Note: For Normal Quad images only.
2197 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2198 [EditorBrowsable(EditorBrowsableState.Never)]
2199 public bool BackgroundImageSynchronosLoading
2203 return _backgroundImageSynchronosLoading;
2207 _backgroundImageSynchronosLoading = value;
2210 Background.Find(Visual.Property.Type)?.Get(out visualType);
2211 if (visualType == (int)Visual.Type.Image)
2213 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2216 if (bgUrl.Length != 0)
2218 PropertyMap bgMap = this.Background;
2219 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2225 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2226 [EditorBrowsable(EditorBrowsableState.Never)]
2227 public Vector2 UpdateSizeHint
2231 return (Vector2)GetValue(UpdateSizeHintProperty);
2235 SetValue(UpdateSizeHintProperty, value);
2236 NotifyPropertyChanged();
2240 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2241 [EditorBrowsable(EditorBrowsableState.Never)]
2242 public string[] TransitionNames
2246 return transitionNames;
2250 transitionNames = value;
2256 /// Enable/Disable ControlState propagation for children.
2257 /// It is false by default.
2258 /// If the View needs to share ControlState with descendants, please set it true.
2259 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2261 [EditorBrowsable(EditorBrowsableState.Never)]
2262 public bool EnableControlStatePropagation
2264 get => controlStatePropagation;
2267 controlStatePropagation = value;
2269 foreach (View child in Children)
2271 child.EnableControlStatePropagation = value;
2277 /// If this property is set to true, the View can have a touch related ControlState (such as Pressed) when touch.
2278 /// By default, it is false in View, true in Control.
2279 /// Note that if the value is true, the View will be a touch receptor.
2281 [EditorBrowsable(EditorBrowsableState.Never)]
2282 public bool EnableControlState
2286 return (bool)GetValue(EnableControlStateProperty);
2290 SetValue(EnableControlStateProperty, value);
2295 /// Whether the actor grab all touches even if touch leaves its boundary.
2297 /// <returns>true, if it grab all touch after start</returns>
2298 [EditorBrowsable(EditorBrowsableState.Never)]
2299 public bool GrabTouchAfterLeave
2304 GetProperty(View.Property.CaptureAllTouchAfterStart).Get(out temp);
2309 SetProperty(View.Property.CaptureAllTouchAfterStart, new Tizen.NUI.PropertyValue(value));
2310 NotifyPropertyChanged();
2315 /// Get Style, it is abstract function and must be override.
2317 /// <since_tizen> 6 </since_tizen>
2318 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2319 // TODO: It should be deprecated. please use CreateViewStyle instead.
2320 [EditorBrowsable(EditorBrowsableState.Never)]
2321 protected virtual ViewStyle GetViewStyle()
2323 return CreateViewStyle();
2327 /// Create Style, it is abstract function and must be override.
2329 [EditorBrowsable(EditorBrowsableState.Never)]
2330 protected virtual ViewStyle CreateViewStyle()
2332 return new ViewStyle();
2336 /// Called after the View's ControlStates changed.
2338 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2339 [EditorBrowsable(EditorBrowsableState.Never)]
2340 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2344 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2345 [EditorBrowsable(EditorBrowsableState.Never)]
2346 public virtual void ApplyStyle(ViewStyle viewStyle)
2348 if (null == viewStyle || this.viewStyle == viewStyle) return;
2350 this.viewStyle = viewStyle;
2352 Dictionary<string, BindableProperty> bindablePropertyOfView;
2353 Type viewType = GetType();
2355 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2356 Type styleType = viewStyle.GetType();
2358 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2359 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2361 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2363 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2365 BindableProperty viewProperty;
2366 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2368 if (null != viewProperty)
2370 object value = viewStyle.GetValue(keyValuePair.Value);
2374 SetValue(viewProperty, value);