2 * Copyright(c) 2020 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
32 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
33 internal BackgroundExtraData backgroundExtraData;
35 private bool layoutSet = false;
36 private LayoutItem layout; // Exclusive layout assigned to this View.
38 // List of transitions paired with the condition that uses the transition.
39 private Dictionary<TransitionCondition, TransitionList> layoutTransitions;
40 private int widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
41 private int heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
42 private int oldWidthPolicy = LayoutParamPolicies.MatchParent; // // Store Layout width to compare against later
43 private int oldHeightPolicy = LayoutParamPolicies.MatchParent; // Store Layout height to compare against later
44 private float weight = 0.0f; // Weighting of child View in a Layout
45 private bool backgroundImageSynchronosLoading = false;
46 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
47 private string[] transitionNames;
48 private bool controlStatePropagation = false;
49 private ViewStyle viewStyle;
50 private bool themeChangeSensitive = false;
51 private bool excludeLayouting = false;
52 private LayoutTransition layoutTransition;
54 private ControlState controlStates = ControlState.Normal;
59 /// Creates a new instance of a view.
61 /// <since_tizen> 3 </since_tizen>
62 public View() : this(Interop.View.New(), true)
64 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
67 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
68 [EditorBrowsable(EditorBrowsableState.Never)]
69 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
74 /// Create a new instance of a View with setting the status of shown or hidden.
76 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
77 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
78 [EditorBrowsable(EditorBrowsableState.Never)]
79 public View(bool shown) : this(Interop.View.New(), true)
81 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
85 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
87 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
93 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
96 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
98 InitializeStyle(viewStyle);
101 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.Upcast(cPtr), cMemoryOwn)
105 PositionUsesPivotPoint = false;
108 //ToDo: this has memory leak and this is not used currently. will be fixed soon by using Event subscribing pattern.
109 //_onWindowSendEventCallback = SendViewAddedEventToWindow;
110 //this.OnWindowSignal().Connect(_onWindowSendEventCallback);
118 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
129 /// The event that is triggered when the View's ControlState is changed.
131 [EditorBrowsable(EditorBrowsableState.Never)]
132 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
134 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
138 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
140 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
141 [EditorBrowsable(EditorBrowsableState.Never)]
142 public bool LayoutSet
151 /// Flag to allow Layouting to be disabled for Views.
152 /// Once a View has a Layout set then any children added to Views from then on will receive
153 /// automatic Layouts.
155 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
156 [EditorBrowsable(EditorBrowsableState.Never)]
157 public static bool LayoutingDisabled { get; set; } = true;
159 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
160 [EditorBrowsable(EditorBrowsableState.Never)]
161 public ViewStyle ViewStyle
165 if (null == viewStyle)
167 ApplyStyle(GetViewStyle());
175 /// Get/Set the control state.
177 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
178 [EditorBrowsable(EditorBrowsableState.Never)]
179 public ControlState ControlState
183 return controlStates;
187 if (controlStates == value)
192 var prevState = controlStates;
194 controlStates = value;
196 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
198 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
200 if (controlStatePropagation)
202 foreach (View child in Children)
204 child.ControlState = value;
208 OnControlStateChanged(changeInfo);
210 ControlStateChangedEvent?.Invoke(this, changeInfo);
214 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
215 [EditorBrowsable(EditorBrowsableState.Never)]
216 public bool ExcludeLayouting
220 return excludeLayouting;
224 excludeLayouting = value;
225 if (Layout != null && Layout.SetPositionByLayout == value)
227 Layout.SetPositionByLayout = !value;
228 Layout.RequestLayout();
233 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
234 [EditorBrowsable(EditorBrowsableState.Never)]
235 public bool IsResourcesCreated
239 return Application.Current.IsResourcesCreated;
243 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
244 [EditorBrowsable(EditorBrowsableState.Never)]
245 public ResourceDictionary XamlResources
249 return Application.Current.XamlResources;
253 Application.Current.XamlResources = value;
258 /// The StyleName, type string.
259 /// The value indicates DALi style name defined in json theme file.
261 /// <since_tizen> 3 </since_tizen>
262 public string StyleName
266 return (string)GetValue(StyleNameProperty);
270 SetValue(StyleNameProperty, value);
271 NotifyPropertyChanged();
276 /// The KeyInputFocus, type bool.
278 [EditorBrowsable(EditorBrowsableState.Never)]
279 public bool KeyInputFocus
283 return (bool)GetValue(KeyInputFocusProperty);
287 SetValue(KeyInputFocusProperty, value);
288 NotifyPropertyChanged();
293 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
296 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
298 /// <since_tizen> 3 </since_tizen>
299 public Color BackgroundColor
303 Color temp = (Color)GetValue(BackgroundColorProperty);
304 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
308 SetValue(BackgroundColorProperty, value);
309 if (selectorData != null)
311 selectorData.BackgroundImage.Reset(this);
312 selectorData.BackgroundColor.UpdateIfNeeds(this, value);
314 NotifyPropertyChanged();
319 /// The mutually exclusive with "backgroundColor" and "background" type Map.
321 /// <since_tizen> 3 </since_tizen>
322 public string BackgroundImage
326 return (string)GetValue(BackgroundImageProperty);
330 SetValue(BackgroundImageProperty, value);
331 if (selectorData != null)
333 selectorData.BackgroundColor.Reset(this);
334 selectorData.BackgroundImage.UpdateIfNeeds(this, value);
336 NotifyPropertyChanged();
341 /// Get or set the border of background image.
343 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
344 [EditorBrowsable(EditorBrowsableState.Never)]
345 public Rectangle BackgroundImageBorder
349 return (Rectangle)GetValue(BackgroundImageBorderProperty);
353 SetValue(BackgroundImageBorderProperty, value);
354 selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value);
355 NotifyPropertyChanged();
360 /// The background of view.
362 /// <since_tizen> 3 </since_tizen>
363 public Tizen.NUI.PropertyMap Background
367 return (PropertyMap)GetValue(BackgroundProperty);
371 SetValue(BackgroundProperty, value);
372 NotifyPropertyChanged();
377 /// Describes a shadow as an image for a View.
378 /// It is null by default.
381 /// Getter returns copied instance of current shadow.
384 /// The mutually exclusive with "BoxShadow".
386 [EditorBrowsable(EditorBrowsableState.Never)]
387 public ImageShadow ImageShadow
391 return (ImageShadow)GetValue(ImageShadowProperty);
395 SetValue(ImageShadowProperty, value);
396 if (selectorData != null)
398 selectorData.BoxShadow.Reset(this);
399 selectorData.ImageShadow.UpdateIfNeeds(this, value);
401 NotifyPropertyChanged();
406 /// Describes a box shaped shadow drawing for a View.
407 /// It is null by default.
410 /// Gettter returns copied instance of current shadow.
413 /// The mutually exclusive with "ImageShadow".
415 [EditorBrowsable(EditorBrowsableState.Never)]
416 public Shadow BoxShadow
420 return (Shadow)GetValue(BoxShadowProperty);
424 SetValue(BoxShadowProperty, value);
425 if (selectorData != null)
427 selectorData.ImageShadow.Reset(this);
428 selectorData.BoxShadow.UpdateIfNeeds(this, value);
430 NotifyPropertyChanged();
435 /// The radius for the rounded corners of the View.
436 /// This will rounds background and shadow edges.
437 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
439 [EditorBrowsable(EditorBrowsableState.Never)]
440 public float CornerRadius
444 return (float)GetValue(CornerRadiusProperty);
448 SetValue(CornerRadiusProperty, value);
449 selectorData?.CornerRadius.UpdateIfNeeds(this, value);
450 NotifyPropertyChanged();
455 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
456 /// It is absolute by default.
457 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
459 [EditorBrowsable(EditorBrowsableState.Never)]
460 public VisualTransformPolicyType CornerRadiusPolicy
462 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
463 set => SetValue(CornerRadiusPolicyProperty, value);
467 /// The current state of the view.
469 /// <since_tizen> 3 </since_tizen>
474 return (States)GetValue(StateProperty);
478 SetValue(StateProperty, value);
479 NotifyPropertyChanged();
484 /// The current sub state of the view.
486 /// <since_tizen> 3 </since_tizen>
487 public States SubState
491 return (States)GetValue(SubStateProperty);
495 SetValue(SubStateProperty, value);
496 NotifyPropertyChanged();
501 /// Displays a tooltip
503 /// <since_tizen> 3 </since_tizen>
504 public Tizen.NUI.PropertyMap Tooltip
508 return (PropertyMap)GetValue(TooltipProperty);
512 SetValue(TooltipProperty, value);
513 NotifyPropertyChanged();
518 /// Displays a tooltip as a text.
520 /// <since_tizen> 3 </since_tizen>
521 public string TooltipText
525 using (var propertyValue = GetProperty(Property.TOOLTIP))
527 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
529 return retrivedValue;
531 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
532 return "error to get TooltipText";
537 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
538 NotifyPropertyChanged();
543 /// The Child property of FlexContainer.<br />
544 /// The proportion of the free space in the container, the flex item will receive.<br />
545 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
547 /// <since_tizen> 3 </since_tizen>
548 [Obsolete("Deprecated in API8, will be removed in API10.")]
553 return (float)GetValue(FlexProperty);
557 SetValue(FlexProperty, value);
558 NotifyPropertyChanged();
563 /// The Child property of FlexContainer.<br />
564 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
566 /// <since_tizen> 3 </since_tizen>
567 [Obsolete("Deprecated in API8, will be removed in API10.")]
572 return (int)GetValue(AlignSelfProperty);
576 SetValue(AlignSelfProperty, value);
577 NotifyPropertyChanged();
582 /// The Child property of FlexContainer.<br />
583 /// The space around the flex item.<br />
586 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
588 /// <since_tizen> 3 </since_tizen>
589 [Obsolete("Deprecated in API8, will be removed in API10.")]
590 public Vector4 FlexMargin
594 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
595 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
599 SetValue(FlexMarginProperty, value);
600 NotifyPropertyChanged();
605 /// The top-left cell this child occupies, if not set, the first available cell is used.
608 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
610 /// <since_tizen> 3 </since_tizen>
611 public Vector2 CellIndex
615 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
616 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
620 SetValue(CellIndexProperty, value);
621 NotifyPropertyChanged();
626 /// The number of rows this child occupies, if not set, the default value is 1.
628 /// <since_tizen> 3 </since_tizen>
633 return (float)GetValue(RowSpanProperty);
637 SetValue(RowSpanProperty, value);
638 NotifyPropertyChanged();
643 /// The number of columns this child occupies, if not set, the default value is 1.
645 /// <since_tizen> 3 </since_tizen>
646 public float ColumnSpan
650 return (float)GetValue(ColumnSpanProperty);
654 SetValue(ColumnSpanProperty, value);
655 NotifyPropertyChanged();
660 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
662 /// <since_tizen> 3 </since_tizen>
663 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
667 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
671 SetValue(CellHorizontalAlignmentProperty, value);
672 NotifyPropertyChanged();
677 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
679 /// <since_tizen> 3 </since_tizen>
680 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
684 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
688 SetValue(CellVerticalAlignmentProperty, value);
689 NotifyPropertyChanged();
694 /// The left focusable view.<br />
695 /// This will return null if not set.<br />
696 /// This will also return null if the specified left focusable view is not on a window.<br />
698 /// <since_tizen> 3 </since_tizen>
699 public View LeftFocusableView
701 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
704 return (View)GetValue(LeftFocusableViewProperty);
708 SetValue(LeftFocusableViewProperty, value);
709 NotifyPropertyChanged();
714 /// The right focusable view.<br />
715 /// This will return null if not set.<br />
716 /// This will also return null if the specified right focusable view is not on a window.<br />
718 /// <since_tizen> 3 </since_tizen>
719 public View RightFocusableView
721 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
724 return (View)GetValue(RightFocusableViewProperty);
728 SetValue(RightFocusableViewProperty, value);
729 NotifyPropertyChanged();
734 /// The up focusable view.<br />
735 /// This will return null if not set.<br />
736 /// This will also return null if the specified up focusable view is not on a window.<br />
738 /// <since_tizen> 3 </since_tizen>
739 public View UpFocusableView
741 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
744 return (View)GetValue(UpFocusableViewProperty);
748 SetValue(UpFocusableViewProperty, value);
749 NotifyPropertyChanged();
754 /// The down focusable view.<br />
755 /// This will return null if not set.<br />
756 /// This will also return null if the specified down focusable view is not on a window.<br />
758 /// <since_tizen> 3 </since_tizen>
759 public View DownFocusableView
761 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
764 return (View)GetValue(DownFocusableViewProperty);
768 SetValue(DownFocusableViewProperty, value);
769 NotifyPropertyChanged();
774 /// Whether the view should be focusable by keyboard navigation.
776 /// <since_tizen> 3 </since_tizen>
777 public bool Focusable
781 SetValue(FocusableProperty, value);
782 NotifyPropertyChanged();
786 return (bool)GetValue(FocusableProperty);
791 /// Retrieves the position of the view.<br />
792 /// The coordinates are relative to the view's parent.<br />
794 /// <since_tizen> 3 </since_tizen>
795 public Position CurrentPosition
799 return GetCurrentPosition();
804 /// Sets the size of a view for the width and the height.<br />
805 /// Geometry can be scaled to fit within this area.<br />
806 /// This does not interfere with the view's scale factor.<br />
807 /// The views default depth is the minimum of width and height.<br />
810 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
811 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
813 /// <since_tizen> 3 </since_tizen>
818 Size2D temp = (Size2D)GetValue(Size2DProperty);
819 int width = temp.Width;
820 int height = temp.Height;
822 if (this.Layout == null)
824 if (width < 0) { width = 0; }
825 if (height < 0) { height = 0; }
828 return new Size2D(OnSize2DChanged, width, height);
832 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
833 SetValue(Size2DProperty, value);
835 widthPolicy = value.Width;
836 heightPolicy = value.Height;
838 layout?.RequestLayout();
839 NotifyPropertyChanged();
844 /// Retrieves the size of the view.<br />
845 /// The coordinates are relative to the view's parent.<br />
847 /// <since_tizen> 3 </since_tizen>
848 public Size2D CurrentSize
852 return GetCurrentSize();
857 /// Retrieves and sets the view's opacity.<br />
859 /// <since_tizen> 3 </since_tizen>
864 return (float)GetValue(OpacityProperty);
868 SetValue(OpacityProperty, value);
869 selectorData?.Opacity.UpdateIfNeeds(this, value);
870 NotifyPropertyChanged();
875 /// Sets the position of the view for X and Y.<br />
876 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
877 /// If the position inheritance is disabled, sets the world position.<br />
880 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
881 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
883 /// <since_tizen> 3 </since_tizen>
884 public Position2D Position2D
888 Position2D temp = (Position2D)GetValue(Position2DProperty);
889 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
893 SetValue(Position2DProperty, value);
894 NotifyPropertyChanged();
899 /// Retrieves the screen postion of the view.<br />
901 /// <since_tizen> 3 </since_tizen>
902 public Vector2 ScreenPosition
906 Vector2 temp = new Vector2(0.0f, 0.0f);
907 GetProperty(View.Property.ScreenPosition).Get(temp);
913 /// Determines whether the pivot point should be used to determine the position of the view.
914 /// This is false by default.
916 /// <remarks>If false, then the top-left of the view is used for the position.
917 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
919 /// <since_tizen> 3 </since_tizen>
920 public bool PositionUsesPivotPoint
924 return (bool)GetValue(PositionUsesPivotPointProperty);
928 SetValue(PositionUsesPivotPointProperty, value);
929 NotifyPropertyChanged();
934 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
936 /// <since_tizen> 3 </since_tizen>
937 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
939 "View view = new View(); " +
940 "view.PivotPoint = PivotPoint.Center; " +
941 "view.PositionUsesPivotPoint = true;" +
942 " Deprecated in API5: Will be removed in API8")]
943 [EditorBrowsable(EditorBrowsableState.Never)]
944 public bool PositionUsesAnchorPoint
949 GetProperty(View.Property.PositionUsesAnchorPoint).Get(out temp);
954 SetProperty(View.Property.PositionUsesAnchorPoint, new Tizen.NUI.PropertyValue(value));
955 NotifyPropertyChanged();
960 /// Queries whether the view is connected to the stage.<br />
961 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
963 /// <since_tizen> 3 </since_tizen>
964 public bool IsOnWindow
973 /// Gets the depth in the hierarchy for the view.
975 /// <since_tizen> 3 </since_tizen>
976 public int HierarchyDepth
980 return GetHierarchyDepth();
985 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
988 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
989 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
990 /// The values set by this property will likely change.
992 /// <since_tizen> 3 </since_tizen>
993 public int SiblingOrder
997 return (int)GetValue(SiblingOrderProperty);
1001 SetValue(SiblingOrderProperty, value);
1003 LayoutGroup layout = Layout as LayoutGroup;
1004 layout?.ChangeLayoutSiblingOrder(value);
1006 NotifyPropertyChanged();
1011 /// Returns the natural size of the view.
1014 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1016 /// <since_tizen> 5 </since_tizen>
1017 public Vector3 NaturalSize
1021 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1022 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1028 /// Returns the natural size (Size2D) of the view.
1031 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1033 /// <since_tizen> 4 </since_tizen>
1034 public Size2D NaturalSize2D
1038 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1039 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1041 return new Size2D((int)temp.Width, (int)temp.Height);
1046 /// Gets or sets the origin of a view within its parent's area.<br />
1047 /// 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 />
1048 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1049 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1051 /// <pre>The view has been initialized.</pre>
1052 /// <since_tizen> 3 </since_tizen>
1053 public Position ParentOrigin
1057 Position tmp = (Position)GetValue(ParentOriginProperty);
1058 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1062 SetValue(ParentOriginProperty, value);
1063 NotifyPropertyChanged();
1068 /// Gets or sets the anchor-point of a view.<br />
1069 /// 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 />
1070 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1071 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1072 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1073 /// <pre>The view has been initialized.</pre>
1076 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1078 /// <since_tizen> 3 </since_tizen>
1079 public Position PivotPoint
1083 Position tmp = (Position)GetValue(PivotPointProperty);
1084 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1088 SetValue(PivotPointProperty, value);
1089 NotifyPropertyChanged();
1094 /// Gets or sets the size width of the view.
1098 /// Animatable - This property can be animated using <c>Animation</c> class.
1101 /// <since_tizen> 3 </since_tizen>
1102 public float SizeWidth
1106 return (float)GetValue(SizeWidthProperty);
1110 SetValue(SizeWidthProperty, value);
1111 NotifyPropertyChanged();
1116 /// Gets or sets the size height of the view.
1120 /// Animatable - This property can be animated using <c>Animation</c> class.
1123 /// <since_tizen> 3 </since_tizen>
1124 public float SizeHeight
1128 return (float)GetValue(SizeHeightProperty);
1132 SetValue(SizeHeightProperty, value);
1133 NotifyPropertyChanged();
1138 /// Gets or sets the position of the view.<br />
1139 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1140 /// If the position inheritance is disabled, sets the world position.<br />
1144 /// Animatable - This property can be animated using <c>Animation</c> class.
1146 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1148 /// <since_tizen> 3 </since_tizen>
1149 public Position Position
1153 Position tmp = (Position)GetValue(PositionProperty);
1154 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1158 SetValue(PositionProperty, value);
1159 NotifyPropertyChanged();
1164 /// Gets or sets the position X of the view.
1168 /// Animatable - This property can be animated using <c>Animation</c> class.
1171 /// <since_tizen> 3 </since_tizen>
1172 public float PositionX
1176 return (float)GetValue(PositionXProperty);
1180 SetValue(PositionXProperty, value);
1181 NotifyPropertyChanged();
1186 /// Gets or sets the position Y of the view.
1190 /// Animatable - This property can be animated using <c>Animation</c> class.
1193 /// <since_tizen> 3 </since_tizen>
1194 public float PositionY
1198 return (float)GetValue(PositionYProperty);
1202 SetValue(PositionYProperty, value);
1203 NotifyPropertyChanged();
1208 /// Gets or sets the position Z of the view.
1212 /// Animatable - This property can be animated using <c>Animation</c> class.
1215 /// <since_tizen> 3 </since_tizen>
1216 public float PositionZ
1220 return (float)GetValue(PositionZProperty);
1224 SetValue(PositionZProperty, value);
1225 NotifyPropertyChanged();
1230 /// Gets or sets the world position of the view.
1232 /// <since_tizen> 3 </since_tizen>
1233 public Vector3 WorldPosition
1237 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1238 GetProperty(View.Property.WorldPosition).Get(temp);
1244 /// Gets or sets the orientation of the view.<br />
1245 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1249 /// This is an asynchronous method.
1252 /// Animatable - This property can be animated using <c>Animation</c> class.
1255 /// <since_tizen> 3 </since_tizen>
1256 public Rotation Orientation
1260 return (Rotation)GetValue(OrientationProperty);
1264 SetValue(OrientationProperty, value);
1265 NotifyPropertyChanged();
1270 /// Gets or sets the world orientation of the view.<br />
1272 /// <since_tizen> 3 </since_tizen>
1273 public Rotation WorldOrientation
1277 Rotation temp = new Rotation();
1278 GetProperty(View.Property.WorldOrientation).Get(temp);
1284 /// Gets or sets the scale factor applied to the view.<br />
1288 /// Animatable - This property can be animated using <c>Animation</c> class.
1290 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1292 /// <since_tizen> 3 </since_tizen>
1293 public Vector3 Scale
1297 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1298 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1302 SetValue(ScaleProperty, value);
1303 NotifyPropertyChanged();
1308 /// Gets or sets the scale X factor applied to the view.
1312 /// Animatable - This property can be animated using <c>Animation</c> class.
1315 /// <since_tizen> 3 </since_tizen>
1320 return (float)GetValue(ScaleXProperty);
1324 SetValue(ScaleXProperty, value);
1325 NotifyPropertyChanged();
1330 /// Gets or sets the scale Y factor applied to the view.
1334 /// Animatable - This property can be animated using <c>Animation</c> class.
1337 /// <since_tizen> 3 </since_tizen>
1342 return (float)GetValue(ScaleYProperty);
1346 SetValue(ScaleYProperty, value);
1347 NotifyPropertyChanged();
1352 /// Gets or sets the scale Z factor applied to the view.
1356 /// Animatable - This property can be animated using <c>Animation</c> class.
1359 /// <since_tizen> 3 </since_tizen>
1364 return (float)GetValue(ScaleZProperty);
1368 SetValue(ScaleZProperty, value);
1369 NotifyPropertyChanged();
1374 /// Gets the world scale of the view.
1376 /// <since_tizen> 3 </since_tizen>
1377 public Vector3 WorldScale
1381 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1382 GetProperty(View.Property.WorldScale).Get(temp);
1388 /// Retrieves the visibility flag of the view.
1392 /// If the view is not visible, then the view and its children will not be rendered.
1393 /// 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.
1396 /// Animatable - This property can be animated using <c>Animation</c> class.
1399 /// <since_tizen> 3 </since_tizen>
1400 public bool Visibility
1405 GetProperty(View.Property.VISIBLE).Get(out temp);
1411 /// Gets the view's world color.
1413 /// <since_tizen> 3 </since_tizen>
1414 public Vector4 WorldColor
1418 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1419 GetProperty(View.Property.WorldColor).Get(temp);
1425 /// Gets or sets the view's name.
1427 /// <since_tizen> 3 </since_tizen>
1432 return (string)GetValue(NameProperty);
1436 SetValue(NameProperty, value);
1437 NotifyPropertyChanged();
1442 /// Get the number of children held by the view.
1444 /// <since_tizen> 3 </since_tizen>
1445 public new uint ChildCount
1449 return GetChildCount();
1454 /// Gets the view's ID.
1457 /// <since_tizen> 3 </since_tizen>
1467 /// Gets or sets the status of whether the view should emit touch or hover signals.
1469 /// <since_tizen> 3 </since_tizen>
1470 public bool Sensitive
1474 return (bool)GetValue(SensitiveProperty);
1478 SetValue(SensitiveProperty, value);
1479 NotifyPropertyChanged();
1484 /// 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.
1486 /// <since_tizen> 3 </since_tizen>
1487 public bool LeaveRequired
1491 return (bool)GetValue(LeaveRequiredProperty);
1495 SetValue(LeaveRequiredProperty, value);
1496 NotifyPropertyChanged();
1501 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1503 /// <since_tizen> 3 </since_tizen>
1504 public bool InheritOrientation
1508 return (bool)GetValue(InheritOrientationProperty);
1512 SetValue(InheritOrientationProperty, value);
1513 NotifyPropertyChanged();
1518 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1520 /// <since_tizen> 3 </since_tizen>
1521 public bool InheritScale
1525 return (bool)GetValue(InheritScaleProperty);
1529 SetValue(InheritScaleProperty, value);
1530 NotifyPropertyChanged();
1535 /// Gets or sets the status of how the view and its children should be drawn.<br />
1536 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1537 /// 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 />
1538 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1539 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1540 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1542 /// <since_tizen> 3 </since_tizen>
1543 public DrawModeType DrawMode
1547 return (DrawModeType)GetValue(DrawModeProperty);
1551 SetValue(DrawModeProperty, value);
1552 NotifyPropertyChanged();
1557 /// Gets or sets the relative to parent size factor of the view.<br />
1558 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1559 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1562 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1564 /// <since_tizen> 3 </since_tizen>
1565 public Vector3 SizeModeFactor
1569 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1570 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1574 SetValue(SizeModeFactorProperty, value);
1575 NotifyPropertyChanged();
1580 /// Gets or sets the width resize policy to be used.
1582 /// <since_tizen> 3 </since_tizen>
1583 public ResizePolicyType WidthResizePolicy
1587 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1591 SetValue(WidthResizePolicyProperty, value);
1592 NotifyPropertyChanged();
1597 /// Gets or sets the height resize policy to be used.
1599 /// <since_tizen> 3 </since_tizen>
1600 public ResizePolicyType HeightResizePolicy
1604 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1608 SetValue(HeightResizePolicyProperty, value);
1609 NotifyPropertyChanged();
1614 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1615 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1617 /// <since_tizen> 3 </since_tizen>
1618 public SizeScalePolicyType SizeScalePolicy
1622 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1626 SetValue(SizeScalePolicyProperty, value);
1627 NotifyPropertyChanged();
1632 /// Gets or sets the status of whether the width size is dependent on the height size.
1634 /// <since_tizen> 3 </since_tizen>
1635 public bool WidthForHeight
1639 return (bool)GetValue(WidthForHeightProperty);
1643 SetValue(WidthForHeightProperty, value);
1644 NotifyPropertyChanged();
1649 /// Gets or sets the status of whether the height size is dependent on the width size.
1651 /// <since_tizen> 3 </since_tizen>
1652 public bool HeightForWidth
1656 return (bool)GetValue(HeightForWidthProperty);
1660 SetValue(HeightForWidthProperty, value);
1661 NotifyPropertyChanged();
1666 /// Gets or sets the padding for use in layout.
1669 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1671 /// <since_tizen> 5 </since_tizen>
1672 public Extents Padding
1676 // If View has a Layout then padding in stored in the base Layout class
1679 return Layout.Padding;
1683 Extents temp = (Extents)GetValue(PaddingProperty);
1684 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1686 // Two return points to prevent creating a zeroed Extent native object before assignment
1690 Extents padding = value;
1693 // Layout set so store Padding in LayoutItem instead of in View.
1694 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1695 // the position and sizes measure in the Layouting.
1696 Layout.Padding = value;
1697 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1698 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1699 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1701 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1705 SetValue(PaddingProperty, padding);
1706 NotifyPropertyChanged();
1711 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1713 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1715 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1717 /// <since_tizen> 3 </since_tizen>
1718 public Size2D MinimumSize
1722 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1723 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1729 throw new ArgumentNullException(nameof(value));
1733 // Note: it only works if minimum size is >= than natural size.
1734 // To force the size it should be done through the width&height spec or Size2D.
1735 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1736 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1737 layout.RequestLayout();
1739 SetValue(MinimumSizeProperty, value);
1740 NotifyPropertyChanged();
1745 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1748 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1750 /// <since_tizen> 3 </since_tizen>
1751 public Size2D MaximumSize
1755 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1756 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1760 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1761 // MATCH_PARENT spec + parent container size can be used to limit
1764 layout.RequestLayout();
1766 SetValue(MaximumSizeProperty, value);
1767 NotifyPropertyChanged();
1772 /// Gets or sets whether a child view inherits it's parent's position.<br />
1773 /// Default is to inherit.<br />
1774 /// 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 />
1776 /// <since_tizen> 3 </since_tizen>
1777 public bool InheritPosition
1781 return (bool)GetValue(InheritPositionProperty);
1785 SetValue(InheritPositionProperty, value);
1786 NotifyPropertyChanged();
1791 /// Gets or sets the clipping behavior (mode) of it's children.
1793 /// <since_tizen> 3 </since_tizen>
1794 public ClippingModeType ClippingMode
1798 return (ClippingModeType)GetValue(ClippingModeProperty);
1802 SetValue(ClippingModeProperty, value);
1803 NotifyPropertyChanged();
1808 /// Gets the number of renderers held by the view.
1810 /// <since_tizen> 3 </since_tizen>
1811 public uint RendererCount
1815 return GetRendererCount();
1820 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1823 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1825 /// <since_tizen> 3 </since_tizen>
1826 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1828 "View view = new View(); " +
1829 "view.PivotPoint = PivotPoint.Center; " +
1830 "view.PositionUsesPivotPoint = true;")]
1831 [EditorBrowsable(EditorBrowsableState.Never)]
1832 public Position AnchorPoint
1836 Position temp = new Position(0.0f, 0.0f, 0.0f);
1837 GetProperty(View.Property.AnchorPoint).Get(temp);
1838 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1842 SetProperty(View.Property.AnchorPoint, new Tizen.NUI.PropertyValue(value));
1843 NotifyPropertyChanged();
1848 /// Sets the size of a view for the width, the height and the depth.<br />
1849 /// Geometry can be scaled to fit within this area.<br />
1850 /// This does not interfere with the view's scale factor.<br />
1851 /// The views default depth is the minimum of width and height.<br />
1855 /// Animatable - This property can be animated using <c>Animation</c> class.
1857 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1859 /// <since_tizen> 5 </since_tizen>
1864 Size tmp = (Size)GetValue(SizeProperty);
1865 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1869 SetValue(SizeProperty, value);
1870 NotifyPropertyChanged();
1875 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1877 /// <since_tizen> 3 </since_tizen>
1878 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1880 "Container parent = view.GetParent(); " +
1881 "View view = parent as View;")]
1882 [EditorBrowsable(EditorBrowsableState.Never)]
1883 public new View Parent
1888 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
1889 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1890 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1892 if (basehandle is Layer layer)
1894 ret = new View(Layer.getCPtr(layer).Handle, false);
1895 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1899 ret = basehandle as View;
1902 Interop.BaseHandle.DeleteBaseHandle(CPtr);
1903 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1905 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1911 /// Gets/Sets whether inherit parent's the layout Direction.
1913 /// <since_tizen> 4 </since_tizen>
1914 public bool InheritLayoutDirection
1918 return (bool)GetValue(InheritLayoutDirectionProperty);
1922 SetValue(InheritLayoutDirectionProperty, value);
1923 NotifyPropertyChanged();
1928 /// Gets/Sets the layout Direction.
1930 /// <since_tizen> 4 </since_tizen>
1931 public ViewLayoutDirectionType LayoutDirection
1935 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1939 SetValue(LayoutDirectionProperty, value);
1940 NotifyPropertyChanged();
1941 layout?.RequestLayout();
1946 /// Gets or sets the Margin for use in layout.
1949 /// Margin property is supported by Layout algorithms and containers.
1950 /// Please Set Layout if you want to use Margin property.
1951 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1953 /// <since_tizen> 4 </since_tizen>
1954 public Extents Margin
1958 // If View has a Layout then margin is stored in Layout.
1961 return Layout.Margin;
1965 // If Layout not set then return margin stored in View.
1966 Extents temp = (Extents)GetValue(MarginProperty);
1967 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1969 // Two return points to prevent creating a zeroed Extent native object before assignment
1975 // Layout set so store Margin in LayoutItem instead of View.
1976 // If View stores the Margin too then the Legacy Size Negotiation will
1977 // overwrite the position and size values measured in the Layouting.
1978 Layout.Margin = value;
1979 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
1980 layout?.RequestLayout();
1984 SetValue(MarginProperty, value);
1986 NotifyPropertyChanged();
1987 layout?.RequestLayout();
1992 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1994 /// <since_tizen> 6 </since_tizen>
1995 public int WidthSpecification
2003 widthPolicy = value;
2004 if (oldWidthPolicy != widthPolicy)
2006 if (widthPolicy >= 0)
2008 if (heightPolicy >= 0) // Policy an exact value
2010 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2011 Size2D = new Size2D(widthPolicy, heightPolicy);
2014 layout?.RequestLayout();
2015 oldWidthPolicy = widthPolicy;
2021 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2023 /// <since_tizen> 6 </since_tizen>
2024 public int HeightSpecification
2028 return heightPolicy;
2032 heightPolicy = value;
2033 if (oldHeightPolicy != heightPolicy)
2035 if (heightPolicy >= 0)
2037 if (widthPolicy >= 0) // Policy an exact value
2039 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2040 Size2D = new Size2D(widthPolicy, heightPolicy);
2044 layout?.RequestLayout();
2045 oldHeightPolicy = heightPolicy;
2051 /// Gets the List of transitions for this View.
2053 /// <since_tizen> 6 </since_tizen>
2054 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2058 if (layoutTransitions == null)
2060 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2062 return layoutTransitions;
2067 /// Set a layout transitions for this View.
2069 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2071 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2073 /// <since_tizen> 6 </since_tizen>
2074 public LayoutTransition LayoutTransition
2078 return layoutTransition;
2084 throw new global::System.ArgumentNullException(nameof(value));
2086 if (layoutTransitions == null)
2088 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2091 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2093 AttachTransitionsToChildren(value);
2095 layoutTransition = value;
2100 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2103 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2105 /// <since_tizen> 4 </since_tizen>
2106 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2107 [EditorBrowsable(EditorBrowsableState.Never)]
2108 public Extents PaddingEX
2112 Extents temp = new Extents(0, 0, 0, 0);
2113 GetProperty(View.Property.PADDING).Get(temp);
2114 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2118 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2119 NotifyPropertyChanged();
2120 layout?.RequestLayout();
2125 /// The Color of View. This is an RGBA value.
2129 /// Animatable - This property can be animated using <c>Animation</c> class.
2131 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2133 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2134 [EditorBrowsable(EditorBrowsableState.Never)]
2139 Color temp = (Color)GetValue(ColorProperty);
2140 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2144 SetValue(ColorProperty, value);
2145 selectorData?.Color.UpdateIfNeeds(this, value);
2146 NotifyPropertyChanged();
2151 /// Set the layout on this View. Replaces any existing Layout.
2153 /// <since_tizen> 6 </since_tizen>
2154 public LayoutItem Layout
2162 // Do nothing if layout provided is already set on this View.
2163 if (value == layout)
2168 LayoutingDisabled = false;
2171 // If new layout being set already has a owner then that owner receives a replacement default layout.
2172 // First check if the layout to be set already has a owner.
2173 if (value?.Owner != null)
2175 // Previous owner of the layout gets a default layout as a replacement.
2176 value.Owner.Layout = new AbsoluteLayout();
2178 // Copy Margin and Padding to replacement LayoutGroup.
2179 if (value.Owner.Layout != null)
2181 value.Owner.Layout.Margin = value.Margin;
2182 value.Owner.Layout.Padding = value.Padding;
2186 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2187 // View if no replacement. Previously margin and padding values would have been moved from
2188 // the View to the layout.
2189 if (layout != null) // Existing layout
2193 // Existing layout being replaced so copy over margin and padding values.
2194 value.Margin = layout.Margin;
2195 value.Padding = layout.Padding;
2199 // Layout not being replaced so restore margin and padding to View.
2200 SetValue(MarginProperty, layout.Margin);
2201 SetValue(PaddingProperty, layout.Padding);
2202 NotifyPropertyChanged();
2207 // First Layout to be added to the View hence copy
2209 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2212 if (Margin.Top != 0 || Margin.Bottom != 0 || Margin.Start != 0 || Margin.End != 0)
2214 // If View already has a margin set then store it in Layout instead.
2215 value.Margin = Margin;
2216 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2217 NotifyPropertyChanged();
2220 if (Padding.Top != 0 || Padding.Bottom != 0 || Padding.Start != 0 || Padding.End != 0)
2222 // If View already has a padding set then store it in Layout instead.
2223 value.Padding = Padding;
2224 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2225 NotifyPropertyChanged();
2230 // Remove existing layout from it's parent layout group.
2233 value.SetPositionByLayout = !excludeLayouting;
2235 // Set layout to this view
2241 /// The weight of the View, used to share available space in a layout with siblings.
2243 /// <since_tizen> 6 </since_tizen>
2253 layout?.RequestLayout();
2258 /// Whether to load the BackgroundImage synchronously.
2259 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2260 /// Note: For Normal Quad images only.
2262 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2263 [EditorBrowsable(EditorBrowsableState.Never)]
2264 public bool BackgroundImageSynchronosLoading
2268 return backgroundImageSynchronosLoading;
2272 backgroundImageSynchronosLoading = value;
2274 string bgUrl = null;
2275 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2277 if (!string.IsNullOrEmpty(bgUrl))
2279 PropertyMap bgMap = this.Background;
2280 bgMap.Add("synchronousLoading", new PropertyValue(backgroundImageSynchronosLoading));
2286 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2287 [EditorBrowsable(EditorBrowsableState.Never)]
2288 public Vector2 UpdateSizeHint
2292 return (Vector2)GetValue(UpdateSizeHintProperty);
2296 SetValue(UpdateSizeHintProperty, value);
2297 NotifyPropertyChanged();
2301 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2302 [EditorBrowsable(EditorBrowsableState.Never)]
2303 public string[] TransitionNames
2307 return transitionNames;
2311 transitionNames = value;
2317 /// Enable/Disable ControlState propagation for children.
2318 /// It is false by default.
2319 /// If the View needs to share ControlState with descendants, please set it true.
2320 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2322 [EditorBrowsable(EditorBrowsableState.Never)]
2323 public bool EnableControlStatePropagation
2325 get => controlStatePropagation;
2328 controlStatePropagation = value;
2330 foreach (View child in Children)
2332 child.EnableControlStatePropagation = value;
2338 /// If this property is set to true, the View can have a touch related ControlState (such as Pressed) when touch.
2339 /// By default, it is false in View, true in Control.
2340 /// Note that if the value is true, the View will be a touch receptor.
2342 [EditorBrowsable(EditorBrowsableState.Never)]
2343 public bool EnableControlState
2347 return (bool)GetValue(EnableControlStateProperty);
2351 SetValue(EnableControlStateProperty, value);
2356 /// Whether the actor grab all touches even if touch leaves its boundary.
2358 /// <returns>true, if it grab all touch after start</returns>
2359 [EditorBrowsable(EditorBrowsableState.Never)]
2360 public bool GrabTouchAfterLeave
2365 GetProperty(View.Property.CaptureAllTouchAfterStart).Get(out temp);
2370 SetProperty(View.Property.CaptureAllTouchAfterStart, new Tizen.NUI.PropertyValue(value));
2371 NotifyPropertyChanged();
2376 /// Determines which blend equation will be used to render renderers of this actor.
2378 /// <returns>blend equation enum currently assigned</returns>
2379 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2380 [EditorBrowsable(EditorBrowsableState.Never)]
2381 public BlendEquationType BlendEquation
2386 GetProperty(View.Property.BlendEquation).Get(out temp);
2387 return (BlendEquationType)temp;
2391 SetProperty(View.Property.BlendEquation, new Tizen.NUI.PropertyValue((int)value));
2392 NotifyPropertyChanged();
2397 /// If the value is true, the View will change its style as the theme changes.
2398 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2400 [EditorBrowsable(EditorBrowsableState.Never)]
2401 public bool ThemeChangeSensitive
2403 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2404 set => SetValue(ThemeChangeSensitiveProperty, value);
2408 /// Get Style, it is abstract function and must be override.
2410 /// <since_tizen> 6 </since_tizen>
2411 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2412 // TODO: It should be deprecated. please use CreateViewStyle instead.
2413 [EditorBrowsable(EditorBrowsableState.Never)]
2414 protected virtual ViewStyle GetViewStyle()
2416 return CreateViewStyle();
2420 /// Create Style, it is abstract function and must be override.
2422 [EditorBrowsable(EditorBrowsableState.Never)]
2423 protected virtual ViewStyle CreateViewStyle()
2425 return new ViewStyle();
2429 /// Called after the View's ControlStates changed.
2431 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2432 [EditorBrowsable(EditorBrowsableState.Never)]
2433 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2439 [EditorBrowsable(EditorBrowsableState.Never)]
2440 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2445 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2446 [EditorBrowsable(EditorBrowsableState.Never)]
2447 public virtual void ApplyStyle(ViewStyle viewStyle)
2449 if (null == viewStyle || this.viewStyle == viewStyle) return;
2451 this.viewStyle = viewStyle;
2453 Dictionary<string, BindableProperty> bindablePropertyOfView;
2454 Type viewType = GetType();
2456 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2457 Type styleType = viewStyle.GetType();
2459 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2460 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2462 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2464 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2466 BindableProperty viewProperty;
2467 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2469 if (null != viewProperty && viewProperty != StyleNameProperty)
2471 object value = viewStyle.GetValue(keyValuePair.Value);
2475 SetValue(viewProperty, value);