2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.Binding;
22 using Tizen.NUI.Components;
24 namespace Tizen.NUI.BaseComponents
27 /// View is the base class for all views.
29 /// <since_tizen> 3 </since_tizen>
30 public partial class View : Container, IResourcesProvider
33 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
35 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
36 [EditorBrowsable(EditorBrowsableState.Never)]
37 public bool layoutSet = false;
40 /// Flag to allow Layouting to be disabled for Views.
41 /// Once a View has a Layout set then any children added to Views from then on will receive
42 /// automatic Layouts.
44 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
45 [EditorBrowsable(EditorBrowsableState.Never)]
46 public static bool layoutingDisabled{get; set;} = true;
48 private LayoutItem _layout; // Exclusive layout assigned to this View.
50 // List of transitions paired with the condition that uses the transition.
51 private Dictionary<TransitionCondition, TransitionList> _layoutTransitions;
52 private int _widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
53 private int _heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
54 private int _oldWidthPolicy = LayoutParamPolicies.MatchParent; // // Store Layout width to compare against later
55 private int _oldHeightPolicy = LayoutParamPolicies.MatchParent; // Store Layout height to compare against later
56 private float _weight = 0.0f; // Weighting of child View in a Layout
57 private MeasureSpecification _measureSpecificationWidth; // Layout width and internal Mode
58 private MeasureSpecification _measureSpecificationHeight; // Layout height and internal Mode
59 private bool _backgroundImageSynchronosLoading = false;
60 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
61 private string[] transitionNames;
62 private bool controlStatePropagation = false;
63 private ViewStyle viewStyle;
64 private bool themeChangeSensitive = false;
66 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
67 internal BackgroundExtraData backgroundExtraData;
71 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
72 [EditorBrowsable(EditorBrowsableState.Never)]
73 public ViewStyle ViewStyle
77 if (null == viewStyle)
79 ApplyStyle(GetViewStyle());
87 /// Creates a new instance of a view.
89 /// <since_tizen> 3 </since_tizen>
90 public View() : this(Interop.View.View_New(), true)
92 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
95 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
96 [EditorBrowsable(EditorBrowsableState.Never)]
97 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true, viewStyle)
102 /// Create a new instance of a View with setting the status of shown or hidden.
104 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
105 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
106 [EditorBrowsable(EditorBrowsableState.Never)]
107 public View(bool shown) : this(Interop.View.View_New(), true)
109 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
113 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
115 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
124 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
126 if (!ThemeManager.ThemeApplied) return;
128 if (viewStyle == null) UpdateStyle(); // Use style in the current theme
129 else ApplyStyle(viewStyle.Clone()); // Use given style
132 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
136 PositionUsesPivotPoint = false;
139 _onWindowSendEventCallback = SendViewAddedEventToWindow;
140 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
148 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
150 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159 /// The event that is triggered when the View's ControlState is changed.
161 [EditorBrowsable(EditorBrowsableState.Never)]
162 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
164 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
166 private ControlState controlStates = ControlState.Normal;
168 /// Get/Set the control state.
170 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
171 [EditorBrowsable(EditorBrowsableState.Never)]
172 public ControlState ControlState
176 return controlStates;
180 if (controlStates == value)
185 var prevState = controlStates;
187 controlStates = value;
189 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
191 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
193 if (controlStatePropagation)
195 foreach (View child in Children)
197 child.ControlState = value;
201 OnControlStateChanged(changeInfo);
203 ControlStateChangedEvent?.Invoke(this, changeInfo);
207 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
208 [EditorBrowsable(EditorBrowsableState.Never)]
209 public bool IsResourcesCreated
213 return Application.Current.IsResourcesCreated;
217 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
218 [EditorBrowsable(EditorBrowsableState.Never)]
219 public ResourceDictionary XamlResources
223 return Application.Current.XamlResources;
227 Application.Current.XamlResources = value;
232 /// The StyleName, type string.
233 /// The value indicates DALi style name defined in json theme file.
235 /// <since_tizen> 3 </since_tizen>
236 public string StyleName
240 return (string)GetValue(StyleNameProperty);
244 SetValue(StyleNameProperty, value);
245 NotifyPropertyChanged();
250 /// The KeyInputFocus, type bool.
252 [EditorBrowsable(EditorBrowsableState.Never)]
253 public bool KeyInputFocus
257 return (bool)GetValue(KeyInputFocusProperty);
261 SetValue(KeyInputFocusProperty, value);
262 NotifyPropertyChanged();
267 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
270 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
272 /// <since_tizen> 3 </since_tizen>
273 public Color BackgroundColor
277 Color temp = (Color)GetValue(BackgroundColorProperty);
278 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
282 SetValue(BackgroundColorProperty, value);
283 if (selectorData != null)
285 selectorData.BackgroundImage.Reset(this);
286 selectorData.BackgroundColor.UpdateIfNeeds(this, value);
288 NotifyPropertyChanged();
293 /// The mutually exclusive with "backgroundColor" and "background" type Map.
295 /// <since_tizen> 3 </since_tizen>
296 public string BackgroundImage
300 return (string)GetValue(BackgroundImageProperty);
304 SetValue(BackgroundImageProperty, value);
305 if (selectorData != null)
307 selectorData.BackgroundColor.Reset(this);
308 selectorData.BackgroundImage.UpdateIfNeeds(this, value);
310 NotifyPropertyChanged();
315 /// Get or set the border of background image.
317 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
318 [EditorBrowsable(EditorBrowsableState.Never)]
319 public Rectangle BackgroundImageBorder
323 return (Rectangle)GetValue(BackgroundImageBorderProperty);
327 SetValue(BackgroundImageBorderProperty, value);
328 selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value);
329 NotifyPropertyChanged();
334 /// The background of view.
336 /// <since_tizen> 3 </since_tizen>
337 public Tizen.NUI.PropertyMap Background
341 return (PropertyMap)GetValue(BackgroundProperty);
345 SetValue(BackgroundProperty, value);
346 NotifyPropertyChanged();
351 /// Describes a shadow as an image for a View.
352 /// It is null by default.
355 /// Getter returns copied instance of current shadow.
358 /// The mutually exclusive with "BoxShadow".
360 [EditorBrowsable(EditorBrowsableState.Never)]
361 public ImageShadow ImageShadow
365 return (ImageShadow)GetValue(ImageShadowProperty);
369 SetValue(ImageShadowProperty, value);
370 if (selectorData != null)
372 selectorData.BoxShadow.Reset(this);
373 selectorData.ImageShadow.UpdateIfNeeds(this, value);
375 NotifyPropertyChanged();
380 /// Describes a box shaped shadow drawing for a View.
381 /// It is null by default.
384 /// Gettter returns copied instance of current shadow.
387 /// The mutually exclusive with "ImageShadow".
389 [EditorBrowsable(EditorBrowsableState.Never)]
390 public Shadow BoxShadow
394 return (Shadow)GetValue(BoxShadowProperty);
398 SetValue(BoxShadowProperty, value);
399 if (selectorData != null)
401 selectorData.ImageShadow.Reset(this);
402 selectorData.BoxShadow.UpdateIfNeeds(this, value);
404 NotifyPropertyChanged();
409 /// The radius for the rounded corners of the View.
410 /// This will rounds background and shadow edges.
411 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
413 [EditorBrowsable(EditorBrowsableState.Never)]
414 public float CornerRadius
418 return (float)GetValue(CornerRadiusProperty);
422 SetValue(CornerRadiusProperty, value);
423 selectorData?.CornerRadius.UpdateIfNeeds(this, value);
424 NotifyPropertyChanged();
429 /// The current state of the view.
431 /// <since_tizen> 3 </since_tizen>
436 return (States)GetValue(StateProperty);
440 SetValue(StateProperty, value);
441 NotifyPropertyChanged();
446 /// The current sub state of the view.
448 /// <since_tizen> 3 </since_tizen>
449 public States SubState
453 return (States)GetValue(SubStateProperty);
457 SetValue(SubStateProperty, value);
458 NotifyPropertyChanged();
463 /// Displays a tooltip
465 /// <since_tizen> 3 </since_tizen>
466 public Tizen.NUI.PropertyMap Tooltip
470 return (PropertyMap)GetValue(TooltipProperty);
474 SetValue(TooltipProperty, value);
475 NotifyPropertyChanged();
480 /// Displays a tooltip as a text.
482 /// <since_tizen> 3 </since_tizen>
483 public string TooltipText
487 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
488 NotifyPropertyChanged();
493 /// The Child property of FlexContainer.<br />
494 /// The proportion of the free space in the container, the flex item will receive.<br />
495 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
497 /// <since_tizen> 3 </since_tizen>
498 [Obsolete("Deprecated in API8, will be removed in API10.")]
503 return (float)GetValue(FlexProperty);
507 SetValue(FlexProperty, value);
508 NotifyPropertyChanged();
513 /// The Child property of FlexContainer.<br />
514 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
516 /// <since_tizen> 3 </since_tizen>
517 [Obsolete("Deprecated in API8, will be removed in API10.")]
522 return (int)GetValue(AlignSelfProperty);
526 SetValue(AlignSelfProperty, value);
527 NotifyPropertyChanged();
532 /// The Child property of FlexContainer.<br />
533 /// The space around the flex item.<br />
536 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
538 /// <since_tizen> 3 </since_tizen>
539 [Obsolete("Deprecated in API8, will be removed in API10.")]
540 public Vector4 FlexMargin
544 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
545 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
549 SetValue(FlexMarginProperty, value);
550 NotifyPropertyChanged();
555 /// The top-left cell this child occupies, if not set, the first available cell is used.
558 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
560 /// <since_tizen> 3 </since_tizen>
561 public Vector2 CellIndex
565 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
566 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
570 SetValue(CellIndexProperty, value);
571 NotifyPropertyChanged();
576 /// The number of rows this child occupies, if not set, the default value is 1.
578 /// <since_tizen> 3 </since_tizen>
583 return (float)GetValue(RowSpanProperty);
587 SetValue(RowSpanProperty, value);
588 NotifyPropertyChanged();
593 /// The number of columns this child occupies, if not set, the default value is 1.
595 /// <since_tizen> 3 </since_tizen>
596 public float ColumnSpan
600 return (float)GetValue(ColumnSpanProperty);
604 SetValue(ColumnSpanProperty, value);
605 NotifyPropertyChanged();
610 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
612 /// <since_tizen> 3 </since_tizen>
613 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
617 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
621 SetValue(CellHorizontalAlignmentProperty, value);
622 NotifyPropertyChanged();
627 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
629 /// <since_tizen> 3 </since_tizen>
630 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
634 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
638 SetValue(CellVerticalAlignmentProperty, value);
639 NotifyPropertyChanged();
644 /// The left focusable view.<br />
645 /// This will return null if not set.<br />
646 /// This will also return null if the specified left focusable view is not on a window.<br />
648 /// <since_tizen> 3 </since_tizen>
649 public View LeftFocusableView
651 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
654 return (View)GetValue(LeftFocusableViewProperty);
658 SetValue(LeftFocusableViewProperty, value);
659 NotifyPropertyChanged();
664 /// The right focusable view.<br />
665 /// This will return null if not set.<br />
666 /// This will also return null if the specified right focusable view is not on a window.<br />
668 /// <since_tizen> 3 </since_tizen>
669 public View RightFocusableView
671 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
674 return (View)GetValue(RightFocusableViewProperty);
678 SetValue(RightFocusableViewProperty, value);
679 NotifyPropertyChanged();
684 /// The up focusable view.<br />
685 /// This will return null if not set.<br />
686 /// This will also return null if the specified up focusable view is not on a window.<br />
688 /// <since_tizen> 3 </since_tizen>
689 public View UpFocusableView
691 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
694 return (View)GetValue(UpFocusableViewProperty);
698 SetValue(UpFocusableViewProperty, value);
699 NotifyPropertyChanged();
704 /// The down focusable view.<br />
705 /// This will return null if not set.<br />
706 /// This will also return null if the specified down focusable view is not on a window.<br />
708 /// <since_tizen> 3 </since_tizen>
709 public View DownFocusableView
711 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
714 return (View)GetValue(DownFocusableViewProperty);
718 SetValue(DownFocusableViewProperty, value);
719 NotifyPropertyChanged();
724 /// Whether the view should be focusable by keyboard navigation.
726 /// <since_tizen> 3 </since_tizen>
727 public bool Focusable
731 SetValue(FocusableProperty, value);
732 NotifyPropertyChanged();
736 return (bool)GetValue(FocusableProperty);
741 /// Whether the children of this view can be focusable by keyboard navigation. If user sets this to false, the children of this actor view will not be focused.
742 /// Note : Default value is true.
744 [EditorBrowsable(EditorBrowsableState.Never)]
745 public bool FocusableChildren
749 SetValue(FocusableChildrenProperty, value);
750 NotifyPropertyChanged();
754 return (bool)GetValue(FocusableChildrenProperty);
759 /// Whether this view can focus by touch.
760 /// If Focusable is false, FocusableInTouch is disabled.
761 /// If you want to have focus on touch, you need to set both Focusable and FocusableInTouch settings to true.
763 [EditorBrowsable(EditorBrowsableState.Never)]
764 public bool FocusableInTouch
768 SetValue(FocusableInTouchProperty, value);
769 NotifyPropertyChanged();
773 return (bool)GetValue(FocusableInTouchProperty);
778 /// Retrieves the position of the view.<br />
779 /// The coordinates are relative to the view's parent.<br />
781 /// <since_tizen> 3 </since_tizen>
782 public Position CurrentPosition
786 return GetCurrentPosition();
791 /// Sets the size of a view for the width and the height.<br />
792 /// Geometry can be scaled to fit within this area.<br />
793 /// This does not interfere with the view's scale factor.<br />
794 /// The views default depth is the minimum of width and height.<br />
797 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
798 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
800 /// <since_tizen> 3 </since_tizen>
805 Size2D temp = (Size2D)GetValue(Size2DProperty);
806 int width = temp.Width;
807 int height = temp.Height;
809 if (this.Layout == null)
811 if (width < 0) { width = 0; }
812 if (height < 0) { height = 0; }
815 return new Size2D(OnSize2DChanged, width, height);
819 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
820 SetValue(Size2DProperty, value);
821 // Set Specification so when layouts measure this View it matches the value set here.
822 // All Views are currently Layouts.
823 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
824 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
825 _widthPolicy = value.Width;
826 _heightPolicy = value.Height;
828 _layout?.RequestLayout();
829 NotifyPropertyChanged();
834 /// Retrieves the size of the view.<br />
835 /// The coordinates are relative to the view's parent.<br />
837 /// <since_tizen> 3 </since_tizen>
838 public Size2D CurrentSize
842 return GetCurrentSize();
847 /// Retrieves and sets the view's opacity.<br />
849 /// <since_tizen> 3 </since_tizen>
854 return (float)GetValue(OpacityProperty);
858 SetValue(OpacityProperty, value);
859 selectorData?.Opacity.UpdateIfNeeds(this, value);
860 NotifyPropertyChanged();
865 /// Sets the position of the view for X and Y.<br />
866 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
867 /// If the position inheritance is disabled, sets the world position.<br />
870 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
871 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
873 /// <since_tizen> 3 </since_tizen>
874 public Position2D Position2D
878 Position2D temp = (Position2D)GetValue(Position2DProperty);
879 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
883 SetValue(Position2DProperty, value);
884 NotifyPropertyChanged();
889 /// Retrieves the screen postion of the view.<br />
891 /// <since_tizen> 3 </since_tizen>
892 public Vector2 ScreenPosition
896 Vector2 temp = new Vector2(0.0f, 0.0f);
897 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
903 /// Determines whether the pivot point should be used to determine the position of the view.
904 /// This is false by default.
906 /// <remarks>If false, then the top-left of the view is used for the position.
907 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
909 /// <since_tizen> 3 </since_tizen>
910 public bool PositionUsesPivotPoint
914 return (bool)GetValue(PositionUsesPivotPointProperty);
918 SetValue(PositionUsesPivotPointProperty, value);
919 NotifyPropertyChanged();
924 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
926 /// <since_tizen> 3 </since_tizen>
927 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
929 "View view = new View(); " +
930 "view.PivotPoint = PivotPoint.Center; " +
931 "view.PositionUsesPivotPoint = true;" +
932 " Deprecated in API5: Will be removed in API8")]
933 [EditorBrowsable(EditorBrowsableState.Never)]
934 public bool PositionUsesAnchorPoint
939 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
944 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
945 NotifyPropertyChanged();
950 /// Queries whether the view is connected to the stage.<br />
951 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
953 /// <since_tizen> 3 </since_tizen>
954 public bool IsOnWindow
963 /// Gets the depth in the hierarchy for the view.
965 /// <since_tizen> 3 </since_tizen>
966 public int HierarchyDepth
970 return GetHierarchyDepth();
975 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
978 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
979 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
980 /// The values set by this property will likely change.
982 /// <since_tizen> 3 </since_tizen>
983 public int SiblingOrder
987 return (int)GetValue(SiblingOrderProperty);
991 SetValue(SiblingOrderProperty, value);
993 LayoutGroup layout = Layout as LayoutGroup;
994 layout?.ChangeLayoutSiblingOrder(value);
996 NotifyPropertyChanged();
1001 /// Returns the natural size of the view.
1004 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1006 /// <since_tizen> 5 </since_tizen>
1007 public Vector3 NaturalSize
1011 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
1012 if (NDalicPINVOKE.SWIGPendingException.Pending)
1013 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1019 /// Returns the natural size (Size2D) of the view.
1022 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1024 /// <since_tizen> 4 </since_tizen>
1025 public Size2D NaturalSize2D
1029 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
1030 if (NDalicPINVOKE.SWIGPendingException.Pending)
1031 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1033 return new Size2D((int)temp.Width, (int)temp.Height);
1038 /// Gets or sets the origin of a view within its parent's area.<br />
1039 /// 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 />
1040 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1041 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1043 /// <pre>The view has been initialized.</pre>
1044 /// <since_tizen> 3 </since_tizen>
1045 public Position ParentOrigin
1049 Position tmp = (Position)GetValue(ParentOriginProperty);
1050 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1054 SetValue(ParentOriginProperty, value);
1055 NotifyPropertyChanged();
1060 /// Gets or sets the anchor-point of a view.<br />
1061 /// 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 />
1062 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1063 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1064 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1065 /// <pre>The view has been initialized.</pre>
1068 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1070 /// <since_tizen> 3 </since_tizen>
1071 public Position PivotPoint
1075 Position tmp = (Position)GetValue(PivotPointProperty);
1076 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1080 SetValue(PivotPointProperty, value);
1081 NotifyPropertyChanged();
1086 /// Gets or sets the size width of the view.
1090 /// Animatable - This property can be animated using <c>Animation</c> class.
1093 /// <since_tizen> 3 </since_tizen>
1094 public float SizeWidth
1098 return (float)GetValue(SizeWidthProperty);
1102 SetValue(SizeWidthProperty, value);
1103 NotifyPropertyChanged();
1108 /// Gets or sets the size height of the view.
1112 /// Animatable - This property can be animated using <c>Animation</c> class.
1115 /// <since_tizen> 3 </since_tizen>
1116 public float SizeHeight
1120 return (float)GetValue(SizeHeightProperty);
1124 SetValue(SizeHeightProperty, value);
1125 NotifyPropertyChanged();
1130 /// Gets or sets the position of the view.<br />
1131 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1132 /// If the position inheritance is disabled, sets the world position.<br />
1136 /// Animatable - This property can be animated using <c>Animation</c> class.
1138 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1140 /// <since_tizen> 3 </since_tizen>
1141 public Position Position
1145 Position tmp = (Position)GetValue(PositionProperty);
1146 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1150 SetValue(PositionProperty, value);
1151 NotifyPropertyChanged();
1156 /// Gets or sets the position X of the view.
1160 /// Animatable - This property can be animated using <c>Animation</c> class.
1163 /// <since_tizen> 3 </since_tizen>
1164 public float PositionX
1168 return (float)GetValue(PositionXProperty);
1172 SetValue(PositionXProperty, value);
1173 NotifyPropertyChanged();
1178 /// Gets or sets the position Y of the view.
1182 /// Animatable - This property can be animated using <c>Animation</c> class.
1185 /// <since_tizen> 3 </since_tizen>
1186 public float PositionY
1190 return (float)GetValue(PositionYProperty);
1194 SetValue(PositionYProperty, value);
1195 NotifyPropertyChanged();
1200 /// Gets or sets the position Z of the view.
1204 /// Animatable - This property can be animated using <c>Animation</c> class.
1207 /// <since_tizen> 3 </since_tizen>
1208 public float PositionZ
1212 return (float)GetValue(PositionZProperty);
1216 SetValue(PositionZProperty, value);
1217 NotifyPropertyChanged();
1222 /// Gets or sets the world position of the view.
1224 /// <since_tizen> 3 </since_tizen>
1225 public Vector3 WorldPosition
1229 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1230 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1236 /// Gets or sets the orientation of the view.<br />
1237 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1241 /// This is an asynchronous method.
1244 /// Animatable - This property can be animated using <c>Animation</c> class.
1247 /// <since_tizen> 3 </since_tizen>
1248 public Rotation Orientation
1252 return (Rotation)GetValue(OrientationProperty);
1256 SetValue(OrientationProperty, value);
1257 NotifyPropertyChanged();
1262 /// Gets or sets the world orientation of the view.<br />
1264 /// <since_tizen> 3 </since_tizen>
1265 public Rotation WorldOrientation
1269 Rotation temp = new Rotation();
1270 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1276 /// Gets or sets the scale factor applied to the view.<br />
1280 /// Animatable - This property can be animated using <c>Animation</c> class.
1282 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1284 /// <since_tizen> 3 </since_tizen>
1285 public Vector3 Scale
1289 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1290 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1294 SetValue(ScaleProperty, value);
1295 NotifyPropertyChanged();
1300 /// Gets or sets the scale X factor applied to the view.
1304 /// Animatable - This property can be animated using <c>Animation</c> class.
1307 /// <since_tizen> 3 </since_tizen>
1312 return (float)GetValue(ScaleXProperty);
1316 SetValue(ScaleXProperty, value);
1317 NotifyPropertyChanged();
1322 /// Gets or sets the scale Y factor applied to the view.
1326 /// Animatable - This property can be animated using <c>Animation</c> class.
1329 /// <since_tizen> 3 </since_tizen>
1334 return (float)GetValue(ScaleYProperty);
1338 SetValue(ScaleYProperty, value);
1339 NotifyPropertyChanged();
1344 /// Gets or sets the scale Z factor applied to the view.
1348 /// Animatable - This property can be animated using <c>Animation</c> class.
1351 /// <since_tizen> 3 </since_tizen>
1356 return (float)GetValue(ScaleZProperty);
1360 SetValue(ScaleZProperty, value);
1361 NotifyPropertyChanged();
1366 /// Gets the world scale of the view.
1368 /// <since_tizen> 3 </since_tizen>
1369 public Vector3 WorldScale
1373 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1374 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1380 /// Retrieves the visibility flag of the view.
1384 /// If the view is not visible, then the view and its children will not be rendered.
1385 /// 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.
1388 /// Animatable - This property can be animated using <c>Animation</c> class.
1391 /// <since_tizen> 3 </since_tizen>
1392 public bool Visibility
1397 GetProperty(View.Property.VISIBLE).Get(out temp);
1403 /// Gets the view's world color.
1405 /// <since_tizen> 3 </since_tizen>
1406 public Vector4 WorldColor
1410 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1411 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1417 /// Gets or sets the view's name.
1419 /// <since_tizen> 3 </since_tizen>
1424 return (string)GetValue(NameProperty);
1428 SetValue(NameProperty, value);
1429 NotifyPropertyChanged();
1434 /// Get the number of children held by the view.
1436 /// <since_tizen> 3 </since_tizen>
1437 public new uint ChildCount
1441 return GetChildCount();
1446 /// Gets the view's ID.
1449 /// <since_tizen> 3 </since_tizen>
1459 /// Gets or sets the status of whether the view should emit touch or hover signals.
1461 /// <since_tizen> 3 </since_tizen>
1462 public bool Sensitive
1466 return (bool)GetValue(SensitiveProperty);
1470 SetValue(SensitiveProperty, value);
1471 NotifyPropertyChanged();
1476 /// 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.
1478 /// <since_tizen> 3 </since_tizen>
1479 public bool LeaveRequired
1483 return (bool)GetValue(LeaveRequiredProperty);
1487 SetValue(LeaveRequiredProperty, value);
1488 NotifyPropertyChanged();
1493 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1495 /// <since_tizen> 3 </since_tizen>
1496 public bool InheritOrientation
1500 return (bool)GetValue(InheritOrientationProperty);
1504 SetValue(InheritOrientationProperty, value);
1505 NotifyPropertyChanged();
1510 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1512 /// <since_tizen> 3 </since_tizen>
1513 public bool InheritScale
1517 return (bool)GetValue(InheritScaleProperty);
1521 SetValue(InheritScaleProperty, value);
1522 NotifyPropertyChanged();
1527 /// Gets or sets the status of how the view and its children should be drawn.<br />
1528 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1529 /// 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 />
1530 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1531 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1532 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1534 /// <since_tizen> 3 </since_tizen>
1535 public DrawModeType DrawMode
1539 return (DrawModeType)GetValue(DrawModeProperty);
1543 SetValue(DrawModeProperty, value);
1544 NotifyPropertyChanged();
1549 /// Gets or sets the relative to parent size factor of the view.<br />
1550 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1551 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1554 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1556 /// <since_tizen> 3 </since_tizen>
1557 public Vector3 SizeModeFactor
1561 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1562 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1566 SetValue(SizeModeFactorProperty, value);
1567 NotifyPropertyChanged();
1572 /// Gets or sets the width resize policy to be used.
1574 /// <since_tizen> 3 </since_tizen>
1575 public ResizePolicyType WidthResizePolicy
1579 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1583 SetValue(WidthResizePolicyProperty, value);
1584 NotifyPropertyChanged();
1589 /// Gets or sets the height resize policy to be used.
1591 /// <since_tizen> 3 </since_tizen>
1592 public ResizePolicyType HeightResizePolicy
1596 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1600 SetValue(HeightResizePolicyProperty, value);
1601 NotifyPropertyChanged();
1606 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1607 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1609 /// <since_tizen> 3 </since_tizen>
1610 public SizeScalePolicyType SizeScalePolicy
1614 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1618 SetValue(SizeScalePolicyProperty, value);
1619 NotifyPropertyChanged();
1624 /// Gets or sets the status of whether the width size is dependent on the height size.
1626 /// <since_tizen> 3 </since_tizen>
1627 public bool WidthForHeight
1631 return (bool)GetValue(WidthForHeightProperty);
1635 SetValue(WidthForHeightProperty, value);
1636 NotifyPropertyChanged();
1641 /// Gets or sets the status of whether the height size is dependent on the width size.
1643 /// <since_tizen> 3 </since_tizen>
1644 public bool HeightForWidth
1648 return (bool)GetValue(HeightForWidthProperty);
1652 SetValue(HeightForWidthProperty, value);
1653 NotifyPropertyChanged();
1658 /// Gets or sets the padding for use in layout.
1661 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1663 /// <since_tizen> 5 </since_tizen>
1664 public Extents Padding
1668 // If View has a Layout then padding in stored in the base Layout class
1671 return Layout.Padding;
1675 Extents temp = (Extents)GetValue(PaddingProperty);
1676 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1678 // Two return points to prevent creating a zeroed Extent native object before assignment
1682 Extents padding = value;
1685 // Layout set so store Padding in LayoutItem instead of in View.
1686 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1687 // the position and sizes measure in the Layouting.
1688 Layout.Padding = value;
1689 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1690 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1691 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1693 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1697 SetValue(PaddingProperty, padding);
1698 NotifyPropertyChanged();
1703 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1706 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1708 /// <since_tizen> 3 </since_tizen>
1709 public Size2D MinimumSize
1713 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1714 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1718 if (_layout != null)
1720 // Note: it only works if minimum size is >= than natural size.
1721 // To force the size it should be done through the width&height spec or Size2D.
1722 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1723 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1724 _layout.RequestLayout();
1726 SetValue(MinimumSizeProperty, value);
1727 NotifyPropertyChanged();
1732 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1735 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1737 /// <since_tizen> 3 </since_tizen>
1738 public Size2D MaximumSize
1742 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1743 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1747 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1748 // MATCH_PARENT spec + parent container size can be used to limit
1749 if (_layout != null)
1751 _layout.RequestLayout();
1753 SetValue(MaximumSizeProperty, value);
1754 NotifyPropertyChanged();
1759 /// Gets or sets whether a child view inherits it's parent's position.<br />
1760 /// Default is to inherit.<br />
1761 /// 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 />
1763 /// <since_tizen> 3 </since_tizen>
1764 public bool InheritPosition
1768 return (bool)GetValue(InheritPositionProperty);
1772 SetValue(InheritPositionProperty, value);
1773 NotifyPropertyChanged();
1778 /// Gets or sets the clipping behavior (mode) of it's children.
1780 /// <since_tizen> 3 </since_tizen>
1781 public ClippingModeType ClippingMode
1785 return (ClippingModeType)GetValue(ClippingModeProperty);
1789 SetValue(ClippingModeProperty, value);
1790 NotifyPropertyChanged();
1795 /// Gets the number of renderers held by the view.
1797 /// <since_tizen> 3 </since_tizen>
1798 public uint RendererCount
1802 return GetRendererCount();
1807 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1810 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1812 /// <since_tizen> 3 </since_tizen>
1813 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1815 "View view = new View(); " +
1816 "view.PivotPoint = PivotPoint.Center; " +
1817 "view.PositionUsesPivotPoint = true;")]
1818 [EditorBrowsable(EditorBrowsableState.Never)]
1819 public Position AnchorPoint
1823 Position temp = new Position(0.0f, 0.0f, 0.0f);
1824 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1825 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1829 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1830 NotifyPropertyChanged();
1835 /// Sets the size of a view for the width, the height and the depth.<br />
1836 /// Geometry can be scaled to fit within this area.<br />
1837 /// This does not interfere with the view's scale factor.<br />
1838 /// The views default depth is the minimum of width and height.<br />
1842 /// Animatable - This property can be animated using <c>Animation</c> class.
1844 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1846 /// <since_tizen> 5 </since_tizen>
1851 Size tmp = (Size)GetValue(SizeProperty);
1852 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1856 SetValue(SizeProperty, value);
1857 NotifyPropertyChanged();
1862 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1864 /// <since_tizen> 3 </since_tizen>
1865 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1867 "Container parent = view.GetParent(); " +
1868 "View view = parent as View;")]
1869 [EditorBrowsable(EditorBrowsableState.Never)]
1870 public new View Parent
1875 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1876 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1877 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1879 if (basehandle is Layer layer)
1881 ret = new View(Layer.getCPtr(layer).Handle, false);
1882 NUILog.Error("This Parent property is deprecated, should do not be used");
1886 ret = basehandle as View;
1889 Interop.BaseHandle.delete_BaseHandle(CPtr);
1890 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1892 if (NDalicPINVOKE.SWIGPendingException.Pending)
1893 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1899 /// Gets/Sets whether inherit parent's the layout Direction.
1901 /// <since_tizen> 4 </since_tizen>
1902 public bool InheritLayoutDirection
1906 return (bool)GetValue(InheritLayoutDirectionProperty);
1910 SetValue(InheritLayoutDirectionProperty, value);
1911 NotifyPropertyChanged();
1916 /// Gets/Sets the layout Direction.
1918 /// <since_tizen> 4 </since_tizen>
1919 public ViewLayoutDirectionType LayoutDirection
1923 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1927 SetValue(LayoutDirectionProperty, value);
1928 NotifyPropertyChanged();
1929 _layout?.RequestLayout();
1934 /// Gets or sets the Margin for use in layout.
1937 /// Margin property is supported by Layout algorithms and containers.
1938 /// Please Set Layout if you want to use Margin property.
1939 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1941 /// <since_tizen> 4 </since_tizen>
1942 public Extents Margin
1946 // If View has a Layout then margin is stored in Layout.
1949 return Layout.Margin;
1953 // If Layout not set then return margin stored in View.
1954 Extents temp = (Extents)GetValue(MarginProperty);
1955 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1957 // Two return points to prevent creating a zeroed Extent native object before assignment
1963 // Layout set so store Margin in LayoutItem instead of View.
1964 // If View stores the Margin too then the Legacy Size Negotiation will
1965 // overwrite the position and size values measured in the Layouting.
1966 Layout.Margin = value;
1967 SetValue(MarginProperty, new Extents(0,0,0,0));
1968 _layout?.RequestLayout();
1972 SetValue(MarginProperty, value);
1974 NotifyPropertyChanged();
1975 _layout?.RequestLayout();
1980 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1982 /// <since_tizen> 6 </since_tizen>
1983 public int WidthSpecification
1987 return _widthPolicy;
1991 _widthPolicy = value;
1992 if( _oldWidthPolicy != _widthPolicy )
1994 if (_widthPolicy >= 0)
1996 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1998 if(_heightPolicy>=0) // Policy an exact value
2000 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2001 Size2D = new Size2D(_widthPolicy,_heightPolicy);
2004 _layout?.RequestLayout();
2005 _oldWidthPolicy = _widthPolicy;
2011 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2013 /// <since_tizen> 6 </since_tizen>
2014 public int HeightSpecification
2018 return _heightPolicy;
2022 _heightPolicy = value;
2023 if( _oldHeightPolicy != _heightPolicy )
2025 if (_heightPolicy >= 0)
2027 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
2029 if(_widthPolicy>=0) // Policy an exact value
2031 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2032 Size2D = new Size2D(_widthPolicy,_heightPolicy);
2036 _layout?.RequestLayout();
2037 _oldHeightPolicy = _heightPolicy;
2043 /// Gets the List of transitions for this View.
2045 /// <since_tizen> 6 </since_tizen>
2046 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2050 if (_layoutTransitions == null)
2052 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2054 return _layoutTransitions;
2059 /// Set a layout transitions for this View.
2062 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2064 /// <since_tizen> 6 </since_tizen>
2065 public LayoutTransition LayoutTransition
2069 if (_layoutTransitions == null)
2071 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2073 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
2075 AttachTransitionsToChildren(value);
2080 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2083 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2085 /// <since_tizen> 4 </since_tizen>
2086 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2087 [EditorBrowsable(EditorBrowsableState.Never)]
2088 public Extents PaddingEX
2092 Extents temp = new Extents(0, 0, 0, 0);
2093 GetProperty(View.Property.PADDING).Get(temp);
2094 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2098 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2099 NotifyPropertyChanged();
2100 _layout?.RequestLayout();
2104 /// <since_tizen> 6 </since_tizen>
2105 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2106 [EditorBrowsable(EditorBrowsableState.Never)]
2107 public Style XamlStyle
2111 return (Style)GetValue(XamlStyleProperty);
2115 SetValue(XamlStyleProperty, value);
2120 /// The Color of View. This is an RGBA value.
2124 /// Animatable - This property can be animated using <c>Animation</c> class.
2126 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2128 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2129 [EditorBrowsable(EditorBrowsableState.Never)]
2134 Color temp = (Color)GetValue(ColorProperty);
2135 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2139 SetValue(ColorProperty, value);
2140 selectorData?.Color.UpdateIfNeeds(this, value);
2141 NotifyPropertyChanged();
2146 /// Set the layout on this View. Replaces any existing Layout.
2148 /// <since_tizen> 6 </since_tizen>
2149 public LayoutItem Layout
2157 // Do nothing if layout provided is already set on this View.
2158 if (value == _layout)
2163 layoutingDisabled = false;
2166 // If new layout being set already has a owner then that owner receives a replacement default layout.
2167 // First check if the layout to be set already has a owner.
2168 if (value?.Owner != null)
2170 // Previous owner of the layout gets a default layout as a replacement.
2171 value.Owner.Layout = new AbsoluteLayout();
2173 // Copy Margin and Padding to replacement LayoutGroup.
2174 if (value.Owner.Layout != null)
2176 value.Owner.Layout.Margin = value.Margin;
2177 value.Owner.Layout.Padding = value.Padding;
2181 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2182 // View if no replacement. Previously margin and padding values would have been moved from
2183 // the View to the layout.
2184 if (_layout != null ) // Existing layout
2188 // Existing layout being replaced so copy over margin and padding values.
2189 value.Margin = _layout.Margin;
2190 value.Padding = _layout.Padding;
2194 // Layout not being replaced so restore margin and padding to View.
2195 SetValue(MarginProperty, _layout.Margin);
2196 SetValue(PaddingProperty, _layout.Padding);
2197 NotifyPropertyChanged();
2202 // First Layout to be added to the View hence copy
2203 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2206 if (Margin.Top != 0 || Margin.Bottom != 0 || Margin.Start != 0 || Margin.End != 0)
2208 // If View already has a margin set then store it in Layout instead.
2209 value.Margin = Margin;
2210 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2211 NotifyPropertyChanged();
2214 if (Padding.Top != 0 || Padding.Bottom != 0 || Padding.Start != 0 || Padding.End != 0)
2216 // If View already has a padding set then store it in Layout instead.
2217 value.Padding = Padding;
2218 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2219 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2220 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType())) // If a Layout container of some kind.
2222 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2223 NotifyPropertyChanged();
2229 // Remove existing layout from it's parent layout group.
2230 _layout?.Unparent();
2232 // Set layout to this view
2238 /// The weight of the View, used to share available space in a layout with siblings.
2240 /// <since_tizen> 6 </since_tizen>
2250 _layout?.RequestLayout();
2255 /// Whether to load the BackgroundImage synchronously.
2256 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2257 /// Note: For Normal Quad images only.
2259 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2260 [EditorBrowsable(EditorBrowsableState.Never)]
2261 public bool BackgroundImageSynchronosLoading
2265 return _backgroundImageSynchronosLoading;
2269 _backgroundImageSynchronosLoading = value;
2271 string bgUrl = null;
2272 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2274 if (!string.IsNullOrEmpty(bgUrl))
2276 PropertyMap bgMap = this.Background;
2277 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2283 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2284 [EditorBrowsable(EditorBrowsableState.Never)]
2285 public Vector2 UpdateSizeHint
2289 return (Vector2)GetValue(UpdateSizeHintProperty);
2293 SetValue(UpdateSizeHintProperty, value);
2294 NotifyPropertyChanged();
2298 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2299 [EditorBrowsable(EditorBrowsableState.Never)]
2300 public string[] TransitionNames
2304 return transitionNames;
2308 transitionNames = value;
2314 /// Enable/Disable ControlState propagation for children.
2315 /// It is false by default.
2316 /// If the View needs to share ControlState with descendants, please set it true.
2317 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2319 [EditorBrowsable(EditorBrowsableState.Never)]
2320 public bool EnableControlStatePropagation
2322 get => controlStatePropagation;
2325 controlStatePropagation = value;
2327 foreach (View child in Children)
2329 child.EnableControlStatePropagation = value;
2335 /// If this property is set to true, the View can have a touch related ControlState (such as Pressed) when touch.
2336 /// By default, it is false in View, true in Control.
2337 /// Note that if the value is true, the View will be a touch receptor.
2339 [EditorBrowsable(EditorBrowsableState.Never)]
2340 public bool EnableControlState
2344 return (bool)GetValue(EnableControlStateProperty);
2348 SetValue(EnableControlStateProperty, value);
2353 /// Whether the actor grab all touches even if touch leaves its boundary.
2355 /// <returns>true, if it grab all touch after start</returns>
2356 [EditorBrowsable(EditorBrowsableState.Never)]
2357 public bool GrabTouchAfterLeave
2362 GetProperty(View.Property.CaptureAllTouchAfterStart).Get(out temp);
2367 SetProperty(View.Property.CaptureAllTouchAfterStart, new Tizen.NUI.PropertyValue(value));
2368 NotifyPropertyChanged();
2373 /// If the value is true, the View will change its style as the theme changes.
2374 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2376 [EditorBrowsable(EditorBrowsableState.Never)]
2377 public bool ThemeChangeSensitive
2379 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2380 set => SetValue(ThemeChangeSensitiveProperty, value);
2384 /// Get Style, it is abstract function and must be override.
2386 /// <since_tizen> 6 </since_tizen>
2387 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2388 // TODO: It should be deprecated. please use CreateViewStyle instead.
2389 [EditorBrowsable(EditorBrowsableState.Never)]
2390 protected virtual ViewStyle GetViewStyle()
2392 return CreateViewStyle();
2396 /// Create Style, it is abstract function and must be override.
2398 [EditorBrowsable(EditorBrowsableState.Never)]
2399 protected virtual ViewStyle CreateViewStyle()
2401 return new ViewStyle();
2405 /// Called after the View's ControlStates changed.
2407 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2408 [EditorBrowsable(EditorBrowsableState.Never)]
2409 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2415 [EditorBrowsable(EditorBrowsableState.Never)]
2416 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2421 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2422 [EditorBrowsable(EditorBrowsableState.Never)]
2423 public virtual void ApplyStyle(ViewStyle viewStyle)
2425 if (null == viewStyle || this.viewStyle == viewStyle) return;
2427 this.viewStyle = viewStyle;
2429 Dictionary<string, BindableProperty> bindablePropertyOfView;
2430 Type viewType = GetType();
2432 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2433 Type styleType = viewStyle.GetType();
2435 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2436 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2438 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2440 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2442 BindableProperty viewProperty;
2443 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2445 if (null != viewProperty && viewProperty != StyleNameProperty)
2447 object value = viewStyle.GetValue(keyValuePair.Value);
2451 SetValue(viewProperty, value);