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 BackgroundExtraData backgroundExtraData;
34 private bool layoutSet = false;
35 private LayoutItem layout; // Exclusive layout assigned to this View.
37 // List of transitions paired with the condition that uses the transition.
38 private Dictionary<TransitionCondition, TransitionList> layoutTransitions;
39 private int widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
40 private int heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
41 private float weight = 0.0f; // Weighting of child View in a Layout
42 private bool backgroundImageSynchronosLoading = false;
43 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
44 private bool controlStatePropagation = false;
45 private ViewStyle viewStyle;
46 private bool themeChangeSensitive = false;
47 private bool excludeLayouting = false;
48 private LayoutTransition layoutTransition;
50 private ControlState controlStates = ControlState.Normal;
55 /// Creates a new instance of a view.
57 /// <since_tizen> 3 </since_tizen>
58 public View() : this(Interop.View.New(), true)
60 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
63 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
64 [EditorBrowsable(EditorBrowsableState.Never)]
65 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
70 /// Create a new instance of a View with setting the status of shown or hidden.
72 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
73 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
74 [EditorBrowsable(EditorBrowsableState.Never)]
75 public View(bool shown) : this(Interop.View.New(), true)
77 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
81 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
83 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
92 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
94 InitializeStyle(viewStyle);
97 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
101 PositionUsesPivotPoint = false;
104 //ToDo: this has memory leak and this is not used currently. will be fixed soon by using Event subscribing pattern.
105 //_onWindowSendEventCallback = SendViewAddedEventToWindow;
106 //this.OnWindowSignal().Connect(_onWindowSendEventCallback);
114 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
125 /// The event that is triggered when the View's ControlState is changed.
127 [EditorBrowsable(EditorBrowsableState.Never)]
128 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
130 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
134 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
136 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
137 [EditorBrowsable(EditorBrowsableState.Never)]
138 public bool LayoutSet
147 /// Flag to allow Layouting to be disabled for Views.
148 /// Once a View has a Layout set then any children added to Views from then on will receive
149 /// automatic Layouts.
151 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
152 [EditorBrowsable(EditorBrowsableState.Never)]
153 public static bool LayoutingDisabled { get; set; } = true;
155 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
156 [EditorBrowsable(EditorBrowsableState.Never)]
157 public ViewStyle ViewStyle
161 if (null == viewStyle)
163 ApplyStyle(CreateViewStyle());
171 /// Get/Set the control state.
173 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
174 [EditorBrowsable(EditorBrowsableState.Never)]
175 public ControlState ControlState
179 return controlStates;
183 if (controlStates == value)
188 var prevState = controlStates;
190 controlStates = value;
192 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
194 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
196 if (controlStatePropagation)
198 foreach (View child in Children)
200 child.ControlState = value;
204 OnControlStateChanged(changeInfo);
206 ControlStateChangedEvent?.Invoke(this, changeInfo);
210 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
211 [EditorBrowsable(EditorBrowsableState.Never)]
212 public bool ExcludeLayouting
216 return excludeLayouting;
220 excludeLayouting = value;
221 if (Layout != null && Layout.SetPositionByLayout == value)
223 Layout.SetPositionByLayout = !value;
224 Layout.RequestLayout();
229 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
230 [EditorBrowsable(EditorBrowsableState.Never)]
231 public bool IsResourcesCreated
235 return Application.Current.IsResourcesCreated;
239 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
240 [EditorBrowsable(EditorBrowsableState.Never)]
241 public ResourceDictionary XamlResources
245 return Application.Current.XamlResources;
249 Application.Current.XamlResources = value;
254 /// The StyleName, type string.
255 /// The value indicates DALi style name defined in json theme file.
257 /// <since_tizen> 3 </since_tizen>
258 public string StyleName
262 return (string)GetValue(StyleNameProperty);
266 SetValue(StyleNameProperty, value);
267 NotifyPropertyChanged();
272 /// The KeyInputFocus, type bool.
274 [EditorBrowsable(EditorBrowsableState.Never)]
275 public bool KeyInputFocus
279 return (bool)GetValue(KeyInputFocusProperty);
283 SetValue(KeyInputFocusProperty, value);
284 NotifyPropertyChanged();
289 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
293 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
296 /// Animatable - This property can be animated using <c>Animation</c> class.
298 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
302 /// <since_tizen> 3 </since_tizen>
303 public Color BackgroundColor
307 Color temp = (Color)GetValue(BackgroundColorProperty);
308 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
312 SetValue(BackgroundColorProperty, value);
313 if (selectorData != null)
315 selectorData.BackgroundImage.Reset(this);
316 selectorData.BackgroundColor.UpdateIfNeeds(this, value);
318 NotifyPropertyChanged();
323 /// The mutually exclusive with "backgroundColor" and "background" type Map.
325 /// <since_tizen> 3 </since_tizen>
326 public string BackgroundImage
330 return (string)GetValue(BackgroundImageProperty);
334 SetValue(BackgroundImageProperty, value);
335 if (selectorData != null)
337 selectorData.BackgroundColor.Reset(this);
338 selectorData.BackgroundImage.UpdateIfNeeds(this, value);
340 NotifyPropertyChanged();
345 /// Get or set the border of background image.
347 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
348 [EditorBrowsable(EditorBrowsableState.Never)]
349 public Rectangle BackgroundImageBorder
353 return (Rectangle)GetValue(BackgroundImageBorderProperty);
357 SetValue(BackgroundImageBorderProperty, value);
358 selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value);
359 NotifyPropertyChanged();
364 /// The background of view.
366 /// <since_tizen> 3 </since_tizen>
367 public Tizen.NUI.PropertyMap Background
371 return (PropertyMap)GetValue(BackgroundProperty);
375 SetValue(BackgroundProperty, value);
376 NotifyPropertyChanged();
381 /// Describes a shadow as an image for a View.
382 /// It is null by default.
385 /// Getter returns copied instance of current shadow.
388 /// The mutually exclusive with "BoxShadow".
392 /// Animatable - This property can be animated using <c>Animation</c> class.
393 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
395 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
397 /// Animatable sub-property : Offset.
400 [EditorBrowsable(EditorBrowsableState.Never)]
401 public ImageShadow ImageShadow
405 return (ImageShadow)GetValue(ImageShadowProperty);
409 SetValue(ImageShadowProperty, value);
410 if (selectorData != null)
412 selectorData.BoxShadow.Reset(this);
413 selectorData.ImageShadow.UpdateIfNeeds(this, value);
415 NotifyPropertyChanged();
420 /// Describes a box shaped shadow drawing for a View.
421 /// It is null by default.
424 /// Gettter returns copied instance of current shadow.
427 /// The mutually exclusive with "ImageShadow".
431 /// Animatable - This property can be animated using <c>Animation</c> class.
432 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
434 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
436 /// Animatable sub-property : Offset, Color, BlurRadius.
439 [EditorBrowsable(EditorBrowsableState.Never)]
440 public Shadow BoxShadow
444 return (Shadow)GetValue(BoxShadowProperty);
448 SetValue(BoxShadowProperty, value);
449 if (selectorData != null)
451 selectorData.ImageShadow.Reset(this);
452 selectorData.BoxShadow.UpdateIfNeeds(this, value);
454 NotifyPropertyChanged();
459 /// The radius for the rounded corners of the View.
460 /// This will rounds background and shadow edges.
461 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
465 /// Animatable - This property can be animated using <c>Animation</c> class.
468 [EditorBrowsable(EditorBrowsableState.Never)]
469 public float CornerRadius
473 return (float)GetValue(CornerRadiusProperty);
477 SetValue(CornerRadiusProperty, value);
478 NotifyPropertyChanged();
483 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
484 /// It is absolute by default.
485 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
487 [EditorBrowsable(EditorBrowsableState.Never)]
488 public VisualTransformPolicyType CornerRadiusPolicy
490 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
491 set => SetValue(CornerRadiusPolicyProperty, value);
495 /// The current state of the view.
497 /// <since_tizen> 3 </since_tizen>
502 return (States)GetValue(StateProperty);
506 SetValue(StateProperty, value);
507 NotifyPropertyChanged();
512 /// The current sub state of the view.
514 /// <since_tizen> 3 </since_tizen>
515 public States SubState
519 return (States)GetValue(SubStateProperty);
523 SetValue(SubStateProperty, value);
524 NotifyPropertyChanged();
529 /// Displays a tooltip
531 /// <since_tizen> 3 </since_tizen>
532 public Tizen.NUI.PropertyMap Tooltip
536 return (PropertyMap)GetValue(TooltipProperty);
540 SetValue(TooltipProperty, value);
541 NotifyPropertyChanged();
546 /// Displays a tooltip as a text.
548 /// <since_tizen> 3 </since_tizen>
549 public string TooltipText
553 using (var propertyValue = GetProperty(Property.TOOLTIP))
555 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
557 return retrivedValue;
559 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
560 return "error to get TooltipText";
565 var temp = new Tizen.NUI.PropertyValue(value);
566 SetProperty(View.Property.TOOLTIP, temp);
568 NotifyPropertyChanged();
573 /// The Child property of FlexContainer.<br />
574 /// The proportion of the free space in the container, the flex item will receive.<br />
575 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
577 /// <since_tizen> 3 </since_tizen>
578 [Obsolete("Deprecated in API8, will be removed in API10.")]
583 return (float)GetValue(FlexProperty);
587 SetValue(FlexProperty, value);
588 NotifyPropertyChanged();
593 /// The Child property of FlexContainer.<br />
594 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
596 /// <since_tizen> 3 </since_tizen>
597 [Obsolete("Deprecated in API8, will be removed in API10.")]
602 return (int)GetValue(AlignSelfProperty);
606 SetValue(AlignSelfProperty, value);
607 NotifyPropertyChanged();
612 /// The Child property of FlexContainer.<br />
613 /// The space around the flex item.<br />
616 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
618 /// <since_tizen> 3 </since_tizen>
619 [Obsolete("Deprecated in API8, will be removed in API10.")]
620 public Vector4 FlexMargin
624 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
625 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
629 SetValue(FlexMarginProperty, value);
630 NotifyPropertyChanged();
635 /// The top-left cell this child occupies, if not set, the first available cell is used.
638 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
640 /// <since_tizen> 3 </since_tizen>
641 public Vector2 CellIndex
645 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
646 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
650 SetValue(CellIndexProperty, value);
651 NotifyPropertyChanged();
656 /// The number of rows this child occupies, if not set, the default value is 1.
658 /// <since_tizen> 3 </since_tizen>
663 return (float)GetValue(RowSpanProperty);
667 SetValue(RowSpanProperty, value);
668 NotifyPropertyChanged();
673 /// The number of columns this child occupies, if not set, the default value is 1.
675 /// <since_tizen> 3 </since_tizen>
676 public float ColumnSpan
680 return (float)GetValue(ColumnSpanProperty);
684 SetValue(ColumnSpanProperty, value);
685 NotifyPropertyChanged();
690 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
692 /// <since_tizen> 3 </since_tizen>
693 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
697 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
701 SetValue(CellHorizontalAlignmentProperty, value);
702 NotifyPropertyChanged();
707 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
709 /// <since_tizen> 3 </since_tizen>
710 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
714 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
718 SetValue(CellVerticalAlignmentProperty, value);
719 NotifyPropertyChanged();
724 /// The left focusable view.<br />
725 /// This will return null if not set.<br />
726 /// This will also return null if the specified left focusable view is not on a window.<br />
728 /// <since_tizen> 3 </since_tizen>
729 public View LeftFocusableView
731 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
734 return (View)GetValue(LeftFocusableViewProperty);
738 SetValue(LeftFocusableViewProperty, value);
739 NotifyPropertyChanged();
744 /// The right focusable view.<br />
745 /// This will return null if not set.<br />
746 /// This will also return null if the specified right focusable view is not on a window.<br />
748 /// <since_tizen> 3 </since_tizen>
749 public View RightFocusableView
751 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
754 return (View)GetValue(RightFocusableViewProperty);
758 SetValue(RightFocusableViewProperty, value);
759 NotifyPropertyChanged();
764 /// The up focusable view.<br />
765 /// This will return null if not set.<br />
766 /// This will also return null if the specified up focusable view is not on a window.<br />
768 /// <since_tizen> 3 </since_tizen>
769 public View UpFocusableView
771 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
774 return (View)GetValue(UpFocusableViewProperty);
778 SetValue(UpFocusableViewProperty, value);
779 NotifyPropertyChanged();
784 /// The down focusable view.<br />
785 /// This will return null if not set.<br />
786 /// This will also return null if the specified down focusable view is not on a window.<br />
788 /// <since_tizen> 3 </since_tizen>
789 public View DownFocusableView
791 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
794 return (View)GetValue(DownFocusableViewProperty);
798 SetValue(DownFocusableViewProperty, value);
799 NotifyPropertyChanged();
804 /// Whether the view should be focusable by keyboard navigation.
806 /// <since_tizen> 3 </since_tizen>
807 public bool Focusable
811 SetValue(FocusableProperty, value);
812 NotifyPropertyChanged();
816 return (bool)GetValue(FocusableProperty);
821 /// Retrieves the position of the view.<br />
822 /// The coordinates are relative to the view's parent.<br />
824 /// <since_tizen> 3 </since_tizen>
825 public Position CurrentPosition
829 return GetCurrentPosition();
834 /// Sets the size of a view for the width and the height.<br />
835 /// Geometry can be scaled to fit within this area.<br />
836 /// This does not interfere with the view's scale factor.<br />
837 /// The views default depth is the minimum of width and height.<br />
840 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
841 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
843 /// <since_tizen> 3 </since_tizen>
848 Size2D temp = (Size2D)GetValue(Size2DProperty);
849 int width = temp.Width;
850 int height = temp.Height;
852 if (this.Layout == null)
854 if (width < 0) { width = 0; }
855 if (height < 0) { height = 0; }
858 return new Size2D(OnSize2DChanged, width, height);
862 SetValue(Size2DProperty, value);
864 NotifyPropertyChanged();
869 /// Retrieves the size of the view.<br />
870 /// The coordinates are relative to the view's parent.<br />
872 /// <since_tizen> 3 </since_tizen>
873 public Size2D CurrentSize
877 return GetCurrentSize();
882 /// Retrieves and sets the view's opacity.<br />
884 /// <since_tizen> 3 </since_tizen>
889 return (float)GetValue(OpacityProperty);
893 SetValue(OpacityProperty, value);
894 selectorData?.Opacity.UpdateIfNeeds(this, value);
895 NotifyPropertyChanged();
900 /// Sets the position of the view for X and Y.<br />
901 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
902 /// If the position inheritance is disabled, sets the world position.<br />
905 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
906 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
908 /// <since_tizen> 3 </since_tizen>
909 public Position2D Position2D
913 Position2D temp = (Position2D)GetValue(Position2DProperty);
914 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
918 SetValue(Position2DProperty, value);
919 NotifyPropertyChanged();
924 /// Retrieves the screen postion of the view.<br />
926 /// <since_tizen> 3 </since_tizen>
927 public Vector2 ScreenPosition
931 Vector2 temp = new Vector2(0.0f, 0.0f);
932 var pValue = GetProperty(View.Property.ScreenPosition);
940 /// Determines whether the pivot point should be used to determine the position of the view.
941 /// This is false by default.
943 /// <remarks>If false, then the top-left of the view is used for the position.
944 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
946 /// <since_tizen> 3 </since_tizen>
947 public bool PositionUsesPivotPoint
951 return (bool)GetValue(PositionUsesPivotPointProperty);
955 SetValue(PositionUsesPivotPointProperty, value);
956 NotifyPropertyChanged();
961 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
963 /// <since_tizen> 3 </since_tizen>
964 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
966 "View view = new View(); " +
967 "view.PivotPoint = PivotPoint.Center; " +
968 "view.PositionUsesPivotPoint = true;" +
969 " Deprecated in API5: Will be removed in API8")]
970 [EditorBrowsable(EditorBrowsableState.Never)]
971 public bool PositionUsesAnchorPoint
976 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
977 pValue.Get(out temp);
983 var temp = new Tizen.NUI.PropertyValue(value);
984 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
986 NotifyPropertyChanged();
991 /// Queries whether the view is connected to the stage.<br />
992 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
994 /// <since_tizen> 3 </since_tizen>
995 public bool IsOnWindow
1004 /// Gets the depth in the hierarchy for the view.
1006 /// <since_tizen> 3 </since_tizen>
1007 public int HierarchyDepth
1011 return GetHierarchyDepth();
1016 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1019 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1020 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1021 /// The values set by this property will likely change.
1023 /// <since_tizen> 3 </since_tizen>
1024 public int SiblingOrder
1028 return (int)GetValue(SiblingOrderProperty);
1032 SetValue(SiblingOrderProperty, value);
1034 LayoutGroup layout = Layout as LayoutGroup;
1035 layout?.ChangeLayoutSiblingOrder(value);
1037 NotifyPropertyChanged();
1042 /// Returns the natural size of the view.
1045 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1047 /// <since_tizen> 5 </since_tizen>
1048 public Vector3 NaturalSize
1052 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1053 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1059 /// Returns the natural size (Size2D) of the view.
1062 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1064 /// <since_tizen> 4 </since_tizen>
1065 public Size2D NaturalSize2D
1069 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1070 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1072 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1079 /// Gets or sets the origin of a view within its parent's area.<br />
1080 /// 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 />
1081 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1082 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1084 /// <pre>The view has been initialized.</pre>
1085 /// <since_tizen> 3 </since_tizen>
1086 public Position ParentOrigin
1090 Position tmp = (Position)GetValue(ParentOriginProperty);
1091 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1095 SetValue(ParentOriginProperty, value);
1096 NotifyPropertyChanged();
1101 /// Gets or sets the anchor-point of a view.<br />
1102 /// 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 />
1103 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1104 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1105 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1106 /// <pre>The view has been initialized.</pre>
1109 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1111 /// <since_tizen> 3 </since_tizen>
1112 public Position PivotPoint
1116 Position tmp = (Position)GetValue(PivotPointProperty);
1117 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1121 SetValue(PivotPointProperty, value);
1122 NotifyPropertyChanged();
1127 /// Gets or sets the size width of the view.
1131 /// Animatable - This property can be animated using <c>Animation</c> class.
1134 /// <since_tizen> 3 </since_tizen>
1135 public float SizeWidth
1139 return (float)GetValue(SizeWidthProperty);
1143 SetValue(SizeWidthProperty, value);
1144 NotifyPropertyChanged();
1149 /// Gets or sets the size height of the view.
1153 /// Animatable - This property can be animated using <c>Animation</c> class.
1156 /// <since_tizen> 3 </since_tizen>
1157 public float SizeHeight
1161 return (float)GetValue(SizeHeightProperty);
1165 SetValue(SizeHeightProperty, value);
1166 NotifyPropertyChanged();
1171 /// Gets or sets the position of the view.<br />
1172 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1173 /// If the position inheritance is disabled, sets the world position.<br />
1177 /// Animatable - This property can be animated using <c>Animation</c> class.
1179 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1181 /// <since_tizen> 3 </since_tizen>
1182 public Position Position
1186 Position tmp = (Position)GetValue(PositionProperty);
1187 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1191 SetValue(PositionProperty, value);
1192 NotifyPropertyChanged();
1197 /// Gets or sets the position X of the view.
1201 /// Animatable - This property can be animated using <c>Animation</c> class.
1204 /// <since_tizen> 3 </since_tizen>
1205 public float PositionX
1209 return (float)GetValue(PositionXProperty);
1213 SetValue(PositionXProperty, value);
1214 NotifyPropertyChanged();
1219 /// Gets or sets the position Y of the view.
1223 /// Animatable - This property can be animated using <c>Animation</c> class.
1226 /// <since_tizen> 3 </since_tizen>
1227 public float PositionY
1231 return (float)GetValue(PositionYProperty);
1235 SetValue(PositionYProperty, value);
1236 NotifyPropertyChanged();
1241 /// Gets or sets the position Z of the view.
1245 /// Animatable - This property can be animated using <c>Animation</c> class.
1248 /// <since_tizen> 3 </since_tizen>
1249 public float PositionZ
1253 return (float)GetValue(PositionZProperty);
1257 SetValue(PositionZProperty, value);
1258 NotifyPropertyChanged();
1263 /// Gets or sets the world position of the view.
1265 /// <since_tizen> 3 </since_tizen>
1266 public Vector3 WorldPosition
1270 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1271 var pValue = GetProperty(View.Property.WorldPosition);
1279 /// Gets or sets the orientation of the view.<br />
1280 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1284 /// This is an asynchronous method.
1287 /// Animatable - This property can be animated using <c>Animation</c> class.
1290 /// <since_tizen> 3 </since_tizen>
1291 public Rotation Orientation
1295 return (Rotation)GetValue(OrientationProperty);
1299 SetValue(OrientationProperty, value);
1300 NotifyPropertyChanged();
1305 /// Gets or sets the world orientation of the view.<br />
1307 /// <since_tizen> 3 </since_tizen>
1308 public Rotation WorldOrientation
1312 Rotation temp = new Rotation();
1313 var pValue = GetProperty(View.Property.WorldOrientation);
1321 /// Gets or sets the scale factor applied to the view.<br />
1325 /// Animatable - This property can be animated using <c>Animation</c> class.
1327 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1329 /// <since_tizen> 3 </since_tizen>
1330 public Vector3 Scale
1334 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1335 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1339 SetValue(ScaleProperty, value);
1340 NotifyPropertyChanged();
1345 /// Gets or sets the scale X factor applied to the view.
1349 /// Animatable - This property can be animated using <c>Animation</c> class.
1352 /// <since_tizen> 3 </since_tizen>
1357 return (float)GetValue(ScaleXProperty);
1361 SetValue(ScaleXProperty, value);
1362 NotifyPropertyChanged();
1367 /// Gets or sets the scale Y factor applied to the view.
1371 /// Animatable - This property can be animated using <c>Animation</c> class.
1374 /// <since_tizen> 3 </since_tizen>
1379 return (float)GetValue(ScaleYProperty);
1383 SetValue(ScaleYProperty, value);
1384 NotifyPropertyChanged();
1389 /// Gets or sets the scale Z factor applied to the view.
1393 /// Animatable - This property can be animated using <c>Animation</c> class.
1396 /// <since_tizen> 3 </since_tizen>
1401 return (float)GetValue(ScaleZProperty);
1405 SetValue(ScaleZProperty, value);
1406 NotifyPropertyChanged();
1411 /// Gets the world scale of the view.
1413 /// <since_tizen> 3 </since_tizen>
1414 public Vector3 WorldScale
1418 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1419 var pValue = GetProperty(View.Property.WorldScale);
1427 /// Retrieves the visibility flag of the view.
1431 /// If the view is not visible, then the view and its children will not be rendered.
1432 /// 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.
1435 /// Animatable - This property can be animated using <c>Animation</c> class.
1438 /// <since_tizen> 3 </since_tizen>
1439 public bool Visibility
1444 var pValue = GetProperty(View.Property.VISIBLE);
1445 pValue.Get(out temp);
1452 /// Gets the view's world color.
1454 /// <since_tizen> 3 </since_tizen>
1455 public Vector4 WorldColor
1459 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1460 var pValue = GetProperty(View.Property.WorldColor);
1468 /// Gets or sets the view's name.
1470 /// <since_tizen> 3 </since_tizen>
1475 return (string)GetValue(NameProperty);
1479 SetValue(NameProperty, value);
1480 NotifyPropertyChanged();
1485 /// Get the number of children held by the view.
1487 /// <since_tizen> 3 </since_tizen>
1488 public new uint ChildCount
1492 return Convert.ToUInt32(Children.Count);
1497 /// Gets the view's ID.
1500 /// <since_tizen> 3 </since_tizen>
1510 /// Gets or sets the status of whether the view should emit touch or hover signals.
1512 /// <since_tizen> 3 </since_tizen>
1513 public bool Sensitive
1517 return (bool)GetValue(SensitiveProperty);
1521 SetValue(SensitiveProperty, value);
1522 NotifyPropertyChanged();
1527 /// 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.
1529 /// <since_tizen> 3 </since_tizen>
1530 public bool LeaveRequired
1534 return (bool)GetValue(LeaveRequiredProperty);
1538 SetValue(LeaveRequiredProperty, value);
1539 NotifyPropertyChanged();
1544 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1546 /// <since_tizen> 3 </since_tizen>
1547 public bool InheritOrientation
1551 return (bool)GetValue(InheritOrientationProperty);
1555 SetValue(InheritOrientationProperty, value);
1556 NotifyPropertyChanged();
1561 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1563 /// <since_tizen> 3 </since_tizen>
1564 public bool InheritScale
1568 return (bool)GetValue(InheritScaleProperty);
1572 SetValue(InheritScaleProperty, value);
1573 NotifyPropertyChanged();
1578 /// Gets or sets the status of how the view and its children should be drawn.<br />
1579 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1580 /// 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 />
1581 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1582 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1583 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1585 /// <since_tizen> 3 </since_tizen>
1586 public DrawModeType DrawMode
1590 return (DrawModeType)GetValue(DrawModeProperty);
1594 SetValue(DrawModeProperty, value);
1595 NotifyPropertyChanged();
1600 /// Gets or sets the relative to parent size factor of the view.<br />
1601 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1602 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1605 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1607 /// <since_tizen> 3 </since_tizen>
1608 public Vector3 SizeModeFactor
1612 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1613 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1617 SetValue(SizeModeFactorProperty, value);
1618 NotifyPropertyChanged();
1623 /// Gets or sets the width resize policy to be used.
1625 /// <since_tizen> 3 </since_tizen>
1626 public ResizePolicyType WidthResizePolicy
1630 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1634 SetValue(WidthResizePolicyProperty, value);
1635 NotifyPropertyChanged();
1640 /// Gets or sets the height resize policy to be used.
1642 /// <since_tizen> 3 </since_tizen>
1643 public ResizePolicyType HeightResizePolicy
1647 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1651 SetValue(HeightResizePolicyProperty, value);
1652 NotifyPropertyChanged();
1657 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1658 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1660 /// <since_tizen> 3 </since_tizen>
1661 public SizeScalePolicyType SizeScalePolicy
1665 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1669 SetValue(SizeScalePolicyProperty, value);
1670 NotifyPropertyChanged();
1675 /// Gets or sets the status of whether the width size is dependent on the height size.
1677 /// <since_tizen> 3 </since_tizen>
1678 public bool WidthForHeight
1682 return (bool)GetValue(WidthForHeightProperty);
1686 SetValue(WidthForHeightProperty, value);
1687 NotifyPropertyChanged();
1692 /// Gets or sets the status of whether the height size is dependent on the width size.
1694 /// <since_tizen> 3 </since_tizen>
1695 public bool HeightForWidth
1699 return (bool)GetValue(HeightForWidthProperty);
1703 SetValue(HeightForWidthProperty, value);
1704 NotifyPropertyChanged();
1709 /// Gets or sets the padding for use in layout.
1712 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1714 /// <since_tizen> 5 </since_tizen>
1715 public Extents Padding
1719 // If View has a Layout then padding in stored in the base Layout class
1722 return Layout.Padding;
1726 Extents temp = (Extents)GetValue(PaddingProperty);
1727 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1729 // Two return points to prevent creating a zeroed Extent native object before assignment
1733 Extents padding = value;
1736 // Layout set so store Padding in LayoutItem instead of in View.
1737 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1738 // the position and sizes measure in the Layouting.
1739 Layout.Padding = value;
1740 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1741 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1742 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1744 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1748 SetValue(PaddingProperty, padding);
1749 NotifyPropertyChanged();
1754 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1756 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1758 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1760 /// <since_tizen> 3 </since_tizen>
1761 public Size2D MinimumSize
1765 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1766 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1772 throw new ArgumentNullException(nameof(value));
1776 // Note: it only works if minimum size is >= than natural size.
1777 // To force the size it should be done through the width&height spec or Size2D.
1778 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1779 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1780 layout.RequestLayout();
1782 SetValue(MinimumSizeProperty, value);
1783 NotifyPropertyChanged();
1788 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1791 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1793 /// <since_tizen> 3 </since_tizen>
1794 public Size2D MaximumSize
1798 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1799 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1803 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1804 // MATCH_PARENT spec + parent container size can be used to limit
1807 layout.RequestLayout();
1809 SetValue(MaximumSizeProperty, value);
1810 NotifyPropertyChanged();
1815 /// Gets or sets whether a child view inherits it's parent's position.<br />
1816 /// Default is to inherit.<br />
1817 /// 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 />
1819 /// <since_tizen> 3 </since_tizen>
1820 public bool InheritPosition
1824 return (bool)GetValue(InheritPositionProperty);
1828 SetValue(InheritPositionProperty, value);
1829 NotifyPropertyChanged();
1834 /// Gets or sets the clipping behavior (mode) of it's children.
1836 /// <since_tizen> 3 </since_tizen>
1837 public ClippingModeType ClippingMode
1841 return (ClippingModeType)GetValue(ClippingModeProperty);
1845 SetValue(ClippingModeProperty, value);
1846 NotifyPropertyChanged();
1851 /// Gets the number of renderers held by the view.
1853 /// <since_tizen> 3 </since_tizen>
1854 public uint RendererCount
1858 return GetRendererCount();
1863 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1866 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1868 /// <since_tizen> 3 </since_tizen>
1869 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1871 "View view = new View(); " +
1872 "view.PivotPoint = PivotPoint.Center; " +
1873 "view.PositionUsesPivotPoint = true;")]
1874 [EditorBrowsable(EditorBrowsableState.Never)]
1875 public Position AnchorPoint
1879 Position temp = new Position(0.0f, 0.0f, 0.0f);
1880 var pValue = GetProperty(View.Property.AnchorPoint);
1883 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1889 var temp = new Tizen.NUI.PropertyValue(value);
1890 SetProperty(View.Property.AnchorPoint, temp);
1892 NotifyPropertyChanged();
1897 /// Sets the size of a view for the width, the height and the depth.<br />
1898 /// Geometry can be scaled to fit within this area.<br />
1899 /// This does not interfere with the view's scale factor.<br />
1900 /// The views default depth is the minimum of width and height.<br />
1904 /// Animatable - This property can be animated using <c>Animation</c> class.
1906 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1908 /// <since_tizen> 5 </since_tizen>
1913 Size tmp = (Size)GetValue(SizeProperty);
1914 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1918 SetValue(SizeProperty, value);
1919 NotifyPropertyChanged();
1924 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1926 /// <since_tizen> 3 </since_tizen>
1927 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1929 "Container parent = view.GetParent(); " +
1930 "View view = parent as View;")]
1931 [EditorBrowsable(EditorBrowsableState.Never)]
1932 public new View Parent
1937 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
1938 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1939 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1941 if (basehandle is Layer layer)
1943 ret = new View(Layer.getCPtr(layer).Handle, false);
1944 NUILog.Error("This Parent property is deprecated, should do not be used");
1948 ret = basehandle as View;
1951 Interop.BaseHandle.DeleteBaseHandle(CPtr);
1952 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1954 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1960 /// Gets/Sets whether inherit parent's the layout Direction.
1962 /// <since_tizen> 4 </since_tizen>
1963 public bool InheritLayoutDirection
1967 return (bool)GetValue(InheritLayoutDirectionProperty);
1971 SetValue(InheritLayoutDirectionProperty, value);
1972 NotifyPropertyChanged();
1977 /// Gets/Sets the layout Direction.
1979 /// <since_tizen> 4 </since_tizen>
1980 public ViewLayoutDirectionType LayoutDirection
1984 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1988 SetValue(LayoutDirectionProperty, value);
1989 NotifyPropertyChanged();
1990 layout?.RequestLayout();
1995 /// Gets or sets the Margin for use in layout.
1998 /// Margin property is supported by Layout algorithms and containers.
1999 /// Please Set Layout if you want to use Margin property.
2000 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2002 /// <since_tizen> 4 </since_tizen>
2003 public Extents Margin
2007 // If View has a Layout then margin is stored in Layout.
2010 return Layout.Margin;
2014 // If Layout not set then return margin stored in View.
2015 Extents temp = (Extents)GetValue(MarginProperty);
2016 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2018 // Two return points to prevent creating a zeroed Extent native object before assignment
2024 // Layout set so store Margin in LayoutItem instead of View.
2025 // If View stores the Margin too then the Legacy Size Negotiation will
2026 // overwrite the position and size values measured in the Layouting.
2027 Layout.Margin = value;
2028 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2029 layout?.RequestLayout();
2033 SetValue(MarginProperty, value);
2035 NotifyPropertyChanged();
2036 layout?.RequestLayout();
2041 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2043 /// <since_tizen> 6 </since_tizen>
2044 public int WidthSpecification
2052 if (value == widthPolicy)
2055 widthPolicy = value;
2056 if (widthPolicy >= 0)
2058 if (heightPolicy >= 0) // Policy an exact value
2060 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2061 Size2D = new Size2D(widthPolicy, heightPolicy);
2064 layout?.RequestLayout();
2069 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2071 /// <since_tizen> 6 </since_tizen>
2072 public int HeightSpecification
2076 return heightPolicy;
2080 if (value == heightPolicy)
2083 heightPolicy = value;
2084 if (heightPolicy >= 0)
2086 if (widthPolicy >= 0) // Policy an exact value
2088 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2089 Size2D = new Size2D(widthPolicy, heightPolicy);
2092 layout?.RequestLayout();
2097 /// Gets the List of transitions for this View.
2099 /// <since_tizen> 6 </since_tizen>
2100 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2104 if (layoutTransitions == null)
2106 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2108 return layoutTransitions;
2113 /// Set a layout transitions for this View.
2115 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2117 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2119 /// <since_tizen> 6 </since_tizen>
2120 public LayoutTransition LayoutTransition
2124 return layoutTransition;
2130 throw new global::System.ArgumentNullException(nameof(value));
2132 if (layoutTransitions == null)
2134 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2137 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2139 AttachTransitionsToChildren(value);
2141 layoutTransition = value;
2146 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2149 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2151 /// <since_tizen> 4 </since_tizen>
2152 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2153 [EditorBrowsable(EditorBrowsableState.Never)]
2154 public Extents PaddingEX
2158 Extents temp = new Extents(0, 0, 0, 0);
2159 var pValue = GetProperty(View.Property.PADDING);
2162 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2168 var temp = new Tizen.NUI.PropertyValue(value);
2169 SetProperty(View.Property.PADDING, temp);
2171 NotifyPropertyChanged();
2172 layout?.RequestLayout();
2177 /// The Color of View. This is an RGBA value.
2181 /// Animatable - This property can be animated using <c>Animation</c> class.
2183 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2185 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2186 [EditorBrowsable(EditorBrowsableState.Never)]
2191 Color temp = (Color)GetValue(ColorProperty);
2192 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2196 SetValue(ColorProperty, value);
2197 selectorData?.Color.UpdateIfNeeds(this, value);
2198 NotifyPropertyChanged();
2203 /// Set the layout on this View. Replaces any existing Layout.
2205 /// <since_tizen> 6 </since_tizen>
2206 public LayoutItem Layout
2214 // Do nothing if layout provided is already set on this View.
2215 if (value == layout)
2220 LayoutingDisabled = false;
2223 // If new layout being set already has a owner then that owner receives a replacement default layout.
2224 // First check if the layout to be set already has a owner.
2225 if (value?.Owner != null)
2227 // Previous owner of the layout gets a default layout as a replacement.
2228 value.Owner.Layout = new AbsoluteLayout();
2230 // Copy Margin and Padding to replacement LayoutGroup.
2231 if (value.Owner.Layout != null)
2233 value.Owner.Layout.Margin = value.Margin;
2234 value.Owner.Layout.Padding = value.Padding;
2238 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2239 // View if no replacement. Previously margin and padding values would have been moved from
2240 // the View to the layout.
2241 if (layout != null) // Existing layout
2245 // Existing layout being replaced so copy over margin and padding values.
2246 value.Margin = layout.Margin;
2247 value.Padding = layout.Padding;
2251 // Layout not being replaced so restore margin and padding to View.
2252 SetValue(MarginProperty, layout.Margin);
2253 SetValue(PaddingProperty, layout.Padding);
2254 NotifyPropertyChanged();
2259 // First Layout to be added to the View hence copy
2261 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2264 if (false == (this is TextLabel))
2266 if (Margin.Top != 0 || Margin.Bottom != 0 || Margin.Start != 0 || Margin.End != 0)
2268 // If View already has a margin set then store it in Layout instead.
2269 value.Margin = Margin;
2270 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2271 NotifyPropertyChanged();
2274 if (Padding.Top != 0 || Padding.Bottom != 0 || Padding.Start != 0 || Padding.End != 0)
2276 // If View already has a padding set then store it in Layout instead.
2277 value.Padding = Padding;
2278 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2279 NotifyPropertyChanged();
2286 // Remove existing layout from it's parent layout group.
2289 value.SetPositionByLayout = !excludeLayouting;
2291 // Set layout to this view
2297 /// The weight of the View, used to share available space in a layout with siblings.
2299 /// <since_tizen> 6 </since_tizen>
2309 layout?.RequestLayout();
2314 /// Whether to load the BackgroundImage synchronously.
2315 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2316 /// Note: For Normal Quad images only.
2318 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2319 [EditorBrowsable(EditorBrowsableState.Never)]
2320 public bool BackgroundImageSynchronosLoading
2324 return backgroundImageSynchronosLoading;
2328 backgroundImageSynchronosLoading = value;
2330 string bgUrl = null;
2331 var pValue = Background.Find(ImageVisualProperty.URL);
2332 pValue?.Get(out bgUrl);
2335 if (!string.IsNullOrEmpty(bgUrl))
2337 PropertyMap bgMap = this.Background;
2338 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2339 bgMap.Add("synchronousLoading", temp);
2346 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2347 [EditorBrowsable(EditorBrowsableState.Never)]
2348 public Vector2 UpdateSizeHint
2352 return (Vector2)GetValue(UpdateSizeHintProperty);
2356 SetValue(UpdateSizeHintProperty, value);
2357 NotifyPropertyChanged();
2362 /// Enable/Disable ControlState propagation for children.
2363 /// It is false by default.
2364 /// If the View needs to share ControlState with descendants, please set it true.
2365 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2367 [EditorBrowsable(EditorBrowsableState.Never)]
2368 public bool EnableControlStatePropagation
2370 get => controlStatePropagation;
2373 controlStatePropagation = value;
2375 foreach (View child in Children)
2377 child.EnableControlStatePropagation = value;
2383 /// If this property is set to true, the View can have a touch related ControlState (such as Pressed) when touch.
2384 /// By default, it is false in View, true in Control.
2385 /// Note that if the value is true, the View will be a touch receptor.
2387 [EditorBrowsable(EditorBrowsableState.Never)]
2388 public bool EnableControlState
2392 return (bool)GetValue(EnableControlStateProperty);
2396 SetValue(EnableControlStateProperty, value);
2401 /// Whether the actor grab all touches even if touch leaves its boundary.
2403 /// <returns>true, if it grab all touch after start</returns>
2404 [EditorBrowsable(EditorBrowsableState.Never)]
2405 public bool GrabTouchAfterLeave
2410 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2411 pValue.Get(out temp);
2417 var temp = new Tizen.NUI.PropertyValue(value);
2418 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2420 NotifyPropertyChanged();
2425 /// Determines which blend equation will be used to render renderers of this actor.
2427 /// <returns>blend equation enum currently assigned</returns>
2428 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2429 [EditorBrowsable(EditorBrowsableState.Never)]
2430 public BlendEquationType BlendEquation
2435 var pValue = GetProperty(View.Property.BlendEquation);
2436 pValue.Get(out temp);
2438 return (BlendEquationType)temp;
2442 var temp = new Tizen.NUI.PropertyValue((int)value);
2443 SetProperty(View.Property.BlendEquation, temp);
2445 NotifyPropertyChanged();
2450 /// If the value is true, the View will change its style as the theme changes.
2451 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2453 [EditorBrowsable(EditorBrowsableState.Never)]
2454 public bool ThemeChangeSensitive
2456 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2457 set => SetValue(ThemeChangeSensitiveProperty, value);
2461 /// Create Style, it is abstract function and must be override.
2463 [EditorBrowsable(EditorBrowsableState.Never)]
2464 protected virtual ViewStyle CreateViewStyle()
2466 return new ViewStyle();
2470 /// Called after the View's ControlStates changed.
2472 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2473 [EditorBrowsable(EditorBrowsableState.Never)]
2474 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2480 [EditorBrowsable(EditorBrowsableState.Never)]
2481 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2486 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2487 [EditorBrowsable(EditorBrowsableState.Never)]
2488 public virtual void ApplyStyle(ViewStyle viewStyle)
2490 if (null == viewStyle || this.viewStyle == viewStyle) return;
2492 this.viewStyle = viewStyle;
2494 Dictionary<string, BindableProperty> bindablePropertyOfView;
2495 Type viewType = GetType();
2497 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2498 Type styleType = viewStyle.GetType();
2500 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2501 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2503 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2505 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2507 BindableProperty viewProperty;
2508 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2510 if (null != viewProperty && viewProperty != StyleNameProperty)
2512 object value = viewStyle.GetValue(keyValuePair.Value);
2516 SetValue(viewProperty, value);
2524 /// Used to restore the transition.
2526 [EditorBrowsable(EditorBrowsableState.Never)]
2527 public IList<Transition> TransitionList
2530 } = new List<Transition>();
2533 /// Get whether the View is culled or not.
2534 /// True means that the View is out of the view frustum.
2537 /// Hidden-API (Inhouse-API).
2539 [EditorBrowsable(EditorBrowsableState.Never)]
2545 var pValue = GetProperty(View.Property.Culled);
2546 pValue.Get(out temp);