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 string[] transitionNames;
45 private bool controlStatePropagation = false;
46 private ViewStyle viewStyle;
47 private bool themeChangeSensitive = false;
48 private bool excludeLayouting = false;
49 private LayoutTransition layoutTransition;
51 private ControlState controlStates = ControlState.Normal;
56 /// Creates a new instance of a view.
58 /// <since_tizen> 3 </since_tizen>
59 public View() : this(Interop.View.New(), true)
61 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
64 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
65 [EditorBrowsable(EditorBrowsableState.Never)]
66 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
71 /// Create a new instance of a View with setting the status of shown or hidden.
73 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
74 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
75 [EditorBrowsable(EditorBrowsableState.Never)]
76 public View(bool shown) : this(Interop.View.New(), true)
78 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
82 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
84 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
90 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
93 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
95 InitializeStyle(viewStyle);
98 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.Upcast(cPtr), cMemoryOwn)
102 PositionUsesPivotPoint = false;
105 //ToDo: this has memory leak and this is not used currently. will be fixed soon by using Event subscribing pattern.
106 //_onWindowSendEventCallback = SendViewAddedEventToWindow;
107 //this.OnWindowSignal().Connect(_onWindowSendEventCallback);
115 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
117 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
126 /// The event that is triggered when the View's ControlState is changed.
128 [EditorBrowsable(EditorBrowsableState.Never)]
129 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
131 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
135 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
137 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
138 [EditorBrowsable(EditorBrowsableState.Never)]
139 public bool LayoutSet
148 /// Flag to allow Layouting to be disabled for Views.
149 /// Once a View has a Layout set then any children added to Views from then on will receive
150 /// automatic Layouts.
152 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
153 [EditorBrowsable(EditorBrowsableState.Never)]
154 public static bool LayoutingDisabled { get; set; } = true;
156 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
157 [EditorBrowsable(EditorBrowsableState.Never)]
158 public ViewStyle ViewStyle
162 if (null == viewStyle)
164 ApplyStyle(GetViewStyle());
172 /// Get/Set the control state.
174 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
175 [EditorBrowsable(EditorBrowsableState.Never)]
176 public ControlState ControlState
180 return controlStates;
184 if (controlStates == value)
189 var prevState = controlStates;
191 controlStates = value;
193 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
195 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
197 if (controlStatePropagation)
199 foreach (View child in Children)
201 child.ControlState = value;
205 OnControlStateChanged(changeInfo);
207 ControlStateChangedEvent?.Invoke(this, changeInfo);
211 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
212 [EditorBrowsable(EditorBrowsableState.Never)]
213 public bool ExcludeLayouting
217 return excludeLayouting;
221 excludeLayouting = value;
222 if (Layout != null && Layout.SetPositionByLayout == value)
224 Layout.SetPositionByLayout = !value;
225 Layout.RequestLayout();
230 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
231 [EditorBrowsable(EditorBrowsableState.Never)]
232 public bool IsResourcesCreated
236 return Application.Current.IsResourcesCreated;
240 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
241 [EditorBrowsable(EditorBrowsableState.Never)]
242 public ResourceDictionary XamlResources
246 return Application.Current.XamlResources;
250 Application.Current.XamlResources = value;
255 /// The StyleName, type string.
256 /// The value indicates DALi style name defined in json theme file.
258 /// <since_tizen> 3 </since_tizen>
259 public string StyleName
263 return (string)GetValue(StyleNameProperty);
267 SetValue(StyleNameProperty, value);
268 NotifyPropertyChanged();
273 /// The KeyInputFocus, type bool.
275 [EditorBrowsable(EditorBrowsableState.Never)]
276 public bool KeyInputFocus
280 return (bool)GetValue(KeyInputFocusProperty);
284 SetValue(KeyInputFocusProperty, value);
285 NotifyPropertyChanged();
290 /// 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.
295 /// <since_tizen> 3 </since_tizen>
296 public Color BackgroundColor
300 Color temp = (Color)GetValue(BackgroundColorProperty);
301 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
305 SetValue(BackgroundColorProperty, value);
306 if (selectorData != null)
308 selectorData.BackgroundImage.Reset(this);
309 selectorData.BackgroundColor.UpdateIfNeeds(this, value);
311 NotifyPropertyChanged();
316 /// The mutually exclusive with "backgroundColor" and "background" type Map.
318 /// <since_tizen> 3 </since_tizen>
319 public string BackgroundImage
323 return (string)GetValue(BackgroundImageProperty);
327 SetValue(BackgroundImageProperty, value);
328 if (selectorData != null)
330 selectorData.BackgroundColor.Reset(this);
331 selectorData.BackgroundImage.UpdateIfNeeds(this, value);
333 NotifyPropertyChanged();
338 /// Get or set the border of background image.
340 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
341 [EditorBrowsable(EditorBrowsableState.Never)]
342 public Rectangle BackgroundImageBorder
346 return (Rectangle)GetValue(BackgroundImageBorderProperty);
350 SetValue(BackgroundImageBorderProperty, value);
351 selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value);
352 NotifyPropertyChanged();
357 /// The background of view.
359 /// <since_tizen> 3 </since_tizen>
360 public Tizen.NUI.PropertyMap Background
364 return (PropertyMap)GetValue(BackgroundProperty);
368 SetValue(BackgroundProperty, value);
369 NotifyPropertyChanged();
374 /// Describes a shadow as an image for a View.
375 /// It is null by default.
378 /// Getter returns copied instance of current shadow.
381 /// The mutually exclusive with "BoxShadow".
383 [EditorBrowsable(EditorBrowsableState.Never)]
384 public ImageShadow ImageShadow
388 return (ImageShadow)GetValue(ImageShadowProperty);
392 SetValue(ImageShadowProperty, value);
393 if (selectorData != null)
395 selectorData.BoxShadow.Reset(this);
396 selectorData.ImageShadow.UpdateIfNeeds(this, value);
398 NotifyPropertyChanged();
403 /// Describes a box shaped shadow drawing for a View.
404 /// It is null by default.
407 /// Gettter returns copied instance of current shadow.
410 /// The mutually exclusive with "ImageShadow".
412 [EditorBrowsable(EditorBrowsableState.Never)]
413 public Shadow BoxShadow
417 return (Shadow)GetValue(BoxShadowProperty);
421 SetValue(BoxShadowProperty, value);
422 if (selectorData != null)
424 selectorData.ImageShadow.Reset(this);
425 selectorData.BoxShadow.UpdateIfNeeds(this, value);
427 NotifyPropertyChanged();
432 /// The radius for the rounded corners of the View.
433 /// This will rounds background and shadow edges.
434 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
436 [EditorBrowsable(EditorBrowsableState.Never)]
437 public float CornerRadius
441 return (float)GetValue(CornerRadiusProperty);
445 SetValue(CornerRadiusProperty, value);
446 selectorData?.CornerRadius.UpdateIfNeeds(this, value);
447 NotifyPropertyChanged();
452 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
453 /// It is absolute by default.
454 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
456 [EditorBrowsable(EditorBrowsableState.Never)]
457 public VisualTransformPolicyType CornerRadiusPolicy
459 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
460 set => SetValue(CornerRadiusPolicyProperty, value);
464 /// The current state of the view.
466 /// <since_tizen> 3 </since_tizen>
471 return (States)GetValue(StateProperty);
475 SetValue(StateProperty, value);
476 NotifyPropertyChanged();
481 /// The current sub state of the view.
483 /// <since_tizen> 3 </since_tizen>
484 public States SubState
488 return (States)GetValue(SubStateProperty);
492 SetValue(SubStateProperty, value);
493 NotifyPropertyChanged();
498 /// Displays a tooltip
500 /// <since_tizen> 3 </since_tizen>
501 public Tizen.NUI.PropertyMap Tooltip
505 return (PropertyMap)GetValue(TooltipProperty);
509 SetValue(TooltipProperty, value);
510 NotifyPropertyChanged();
515 /// Displays a tooltip as a text.
517 /// <since_tizen> 3 </since_tizen>
518 public string TooltipText
522 using (var propertyValue = GetProperty(Property.TOOLTIP))
524 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
526 return retrivedValue;
528 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
529 return "error to get TooltipText";
534 var temp = new Tizen.NUI.PropertyValue(value);
535 SetProperty(View.Property.TOOLTIP, temp);
537 NotifyPropertyChanged();
542 /// The Child property of FlexContainer.<br />
543 /// The proportion of the free space in the container, the flex item will receive.<br />
544 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
546 /// <since_tizen> 3 </since_tizen>
547 [Obsolete("Deprecated in API8, will be removed in API10.")]
552 return (float)GetValue(FlexProperty);
556 SetValue(FlexProperty, value);
557 NotifyPropertyChanged();
562 /// The Child property of FlexContainer.<br />
563 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
565 /// <since_tizen> 3 </since_tizen>
566 [Obsolete("Deprecated in API8, will be removed in API10.")]
571 return (int)GetValue(AlignSelfProperty);
575 SetValue(AlignSelfProperty, value);
576 NotifyPropertyChanged();
581 /// The Child property of FlexContainer.<br />
582 /// The space around the flex item.<br />
585 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
587 /// <since_tizen> 3 </since_tizen>
588 [Obsolete("Deprecated in API8, will be removed in API10.")]
589 public Vector4 FlexMargin
593 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
594 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
598 SetValue(FlexMarginProperty, value);
599 NotifyPropertyChanged();
604 /// The top-left cell this child occupies, if not set, the first available cell is used.
607 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
609 /// <since_tizen> 3 </since_tizen>
610 public Vector2 CellIndex
614 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
615 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
619 SetValue(CellIndexProperty, value);
620 NotifyPropertyChanged();
625 /// The number of rows this child occupies, if not set, the default value is 1.
627 /// <since_tizen> 3 </since_tizen>
632 return (float)GetValue(RowSpanProperty);
636 SetValue(RowSpanProperty, value);
637 NotifyPropertyChanged();
642 /// The number of columns this child occupies, if not set, the default value is 1.
644 /// <since_tizen> 3 </since_tizen>
645 public float ColumnSpan
649 return (float)GetValue(ColumnSpanProperty);
653 SetValue(ColumnSpanProperty, value);
654 NotifyPropertyChanged();
659 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
661 /// <since_tizen> 3 </since_tizen>
662 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
666 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
670 SetValue(CellHorizontalAlignmentProperty, value);
671 NotifyPropertyChanged();
676 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
678 /// <since_tizen> 3 </since_tizen>
679 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
683 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
687 SetValue(CellVerticalAlignmentProperty, value);
688 NotifyPropertyChanged();
693 /// The left focusable view.<br />
694 /// This will return null if not set.<br />
695 /// This will also return null if the specified left focusable view is not on a window.<br />
697 /// <since_tizen> 3 </since_tizen>
698 public View LeftFocusableView
700 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
703 return (View)GetValue(LeftFocusableViewProperty);
707 SetValue(LeftFocusableViewProperty, value);
708 NotifyPropertyChanged();
713 /// The right focusable view.<br />
714 /// This will return null if not set.<br />
715 /// This will also return null if the specified right focusable view is not on a window.<br />
717 /// <since_tizen> 3 </since_tizen>
718 public View RightFocusableView
720 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
723 return (View)GetValue(RightFocusableViewProperty);
727 SetValue(RightFocusableViewProperty, value);
728 NotifyPropertyChanged();
733 /// The up focusable view.<br />
734 /// This will return null if not set.<br />
735 /// This will also return null if the specified up focusable view is not on a window.<br />
737 /// <since_tizen> 3 </since_tizen>
738 public View UpFocusableView
740 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
743 return (View)GetValue(UpFocusableViewProperty);
747 SetValue(UpFocusableViewProperty, value);
748 NotifyPropertyChanged();
753 /// The down focusable view.<br />
754 /// This will return null if not set.<br />
755 /// This will also return null if the specified down focusable view is not on a window.<br />
757 /// <since_tizen> 3 </since_tizen>
758 public View DownFocusableView
760 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
763 return (View)GetValue(DownFocusableViewProperty);
767 SetValue(DownFocusableViewProperty, value);
768 NotifyPropertyChanged();
773 /// Whether the view should be focusable by keyboard navigation.
775 /// <since_tizen> 3 </since_tizen>
776 public bool Focusable
780 SetValue(FocusableProperty, value);
781 NotifyPropertyChanged();
785 return (bool)GetValue(FocusableProperty);
790 /// Retrieves the position of the view.<br />
791 /// The coordinates are relative to the view's parent.<br />
793 /// <since_tizen> 3 </since_tizen>
794 public Position CurrentPosition
798 return GetCurrentPosition();
803 /// Sets the size of a view for the width and the height.<br />
804 /// Geometry can be scaled to fit within this area.<br />
805 /// This does not interfere with the view's scale factor.<br />
806 /// The views default depth is the minimum of width and height.<br />
809 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
810 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
812 /// <since_tizen> 3 </since_tizen>
817 Size2D temp = (Size2D)GetValue(Size2DProperty);
818 int width = temp.Width;
819 int height = temp.Height;
821 if (this.Layout == null)
823 if (width < 0) { width = 0; }
824 if (height < 0) { height = 0; }
827 return new Size2D(OnSize2DChanged, width, height);
831 SetValue(Size2DProperty, value);
833 NotifyPropertyChanged();
838 /// Retrieves the size of the view.<br />
839 /// The coordinates are relative to the view's parent.<br />
841 /// <since_tizen> 3 </since_tizen>
842 public Size2D CurrentSize
846 return GetCurrentSize();
851 /// Retrieves and sets the view's opacity.<br />
853 /// <since_tizen> 3 </since_tizen>
858 return (float)GetValue(OpacityProperty);
862 SetValue(OpacityProperty, value);
863 selectorData?.Opacity.UpdateIfNeeds(this, value);
864 NotifyPropertyChanged();
869 /// Sets the position of the view for X and Y.<br />
870 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
871 /// If the position inheritance is disabled, sets the world position.<br />
874 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
875 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
877 /// <since_tizen> 3 </since_tizen>
878 public Position2D Position2D
882 Position2D temp = (Position2D)GetValue(Position2DProperty);
883 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
887 SetValue(Position2DProperty, value);
888 NotifyPropertyChanged();
893 /// Retrieves the screen postion of the view.<br />
895 /// <since_tizen> 3 </since_tizen>
896 public Vector2 ScreenPosition
900 Vector2 temp = new Vector2(0.0f, 0.0f);
901 var pValue = GetProperty(View.Property.ScreenPosition);
909 /// Determines whether the pivot point should be used to determine the position of the view.
910 /// This is false by default.
912 /// <remarks>If false, then the top-left of the view is used for the position.
913 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
915 /// <since_tizen> 3 </since_tizen>
916 public bool PositionUsesPivotPoint
920 return (bool)GetValue(PositionUsesPivotPointProperty);
924 SetValue(PositionUsesPivotPointProperty, value);
925 NotifyPropertyChanged();
930 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
932 /// <since_tizen> 3 </since_tizen>
933 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
935 "View view = new View(); " +
936 "view.PivotPoint = PivotPoint.Center; " +
937 "view.PositionUsesPivotPoint = true;" +
938 " Deprecated in API5: Will be removed in API8")]
939 [EditorBrowsable(EditorBrowsableState.Never)]
940 public bool PositionUsesAnchorPoint
945 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
946 pValue.Get(out temp);
952 var temp = new Tizen.NUI.PropertyValue(value);
953 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
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 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1048 /// Gets or sets the origin of a view within its parent's area.<br />
1049 /// 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 />
1050 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1051 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1053 /// <pre>The view has been initialized.</pre>
1054 /// <since_tizen> 3 </since_tizen>
1055 public Position ParentOrigin
1059 Position tmp = (Position)GetValue(ParentOriginProperty);
1060 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1064 SetValue(ParentOriginProperty, value);
1065 NotifyPropertyChanged();
1070 /// Gets or sets the anchor-point of a view.<br />
1071 /// 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 />
1072 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1073 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1074 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1075 /// <pre>The view has been initialized.</pre>
1078 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1080 /// <since_tizen> 3 </since_tizen>
1081 public Position PivotPoint
1085 Position tmp = (Position)GetValue(PivotPointProperty);
1086 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1090 SetValue(PivotPointProperty, value);
1091 NotifyPropertyChanged();
1096 /// Gets or sets the size width of the view.
1100 /// Animatable - This property can be animated using <c>Animation</c> class.
1103 /// <since_tizen> 3 </since_tizen>
1104 public float SizeWidth
1108 return (float)GetValue(SizeWidthProperty);
1112 SetValue(SizeWidthProperty, value);
1113 NotifyPropertyChanged();
1118 /// Gets or sets the size height of the view.
1122 /// Animatable - This property can be animated using <c>Animation</c> class.
1125 /// <since_tizen> 3 </since_tizen>
1126 public float SizeHeight
1130 return (float)GetValue(SizeHeightProperty);
1134 SetValue(SizeHeightProperty, value);
1135 NotifyPropertyChanged();
1140 /// Gets or sets the position of the view.<br />
1141 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1142 /// If the position inheritance is disabled, sets the world position.<br />
1146 /// Animatable - This property can be animated using <c>Animation</c> class.
1148 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1150 /// <since_tizen> 3 </since_tizen>
1151 public Position Position
1155 Position tmp = (Position)GetValue(PositionProperty);
1156 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1160 SetValue(PositionProperty, value);
1161 NotifyPropertyChanged();
1166 /// Gets or sets the position X of the view.
1170 /// Animatable - This property can be animated using <c>Animation</c> class.
1173 /// <since_tizen> 3 </since_tizen>
1174 public float PositionX
1178 return (float)GetValue(PositionXProperty);
1182 SetValue(PositionXProperty, value);
1183 NotifyPropertyChanged();
1188 /// Gets or sets the position Y of the view.
1192 /// Animatable - This property can be animated using <c>Animation</c> class.
1195 /// <since_tizen> 3 </since_tizen>
1196 public float PositionY
1200 return (float)GetValue(PositionYProperty);
1204 SetValue(PositionYProperty, value);
1205 NotifyPropertyChanged();
1210 /// Gets or sets the position Z of the view.
1214 /// Animatable - This property can be animated using <c>Animation</c> class.
1217 /// <since_tizen> 3 </since_tizen>
1218 public float PositionZ
1222 return (float)GetValue(PositionZProperty);
1226 SetValue(PositionZProperty, value);
1227 NotifyPropertyChanged();
1232 /// Gets or sets the world position of the view.
1234 /// <since_tizen> 3 </since_tizen>
1235 public Vector3 WorldPosition
1239 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1240 var pValue = GetProperty(View.Property.WorldPosition);
1248 /// Gets or sets the orientation of the view.<br />
1249 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1253 /// This is an asynchronous method.
1256 /// Animatable - This property can be animated using <c>Animation</c> class.
1259 /// <since_tizen> 3 </since_tizen>
1260 public Rotation Orientation
1264 return (Rotation)GetValue(OrientationProperty);
1268 SetValue(OrientationProperty, value);
1269 NotifyPropertyChanged();
1274 /// Gets or sets the world orientation of the view.<br />
1276 /// <since_tizen> 3 </since_tizen>
1277 public Rotation WorldOrientation
1281 Rotation temp = new Rotation();
1282 var pValue = GetProperty(View.Property.WorldOrientation);
1290 /// Gets or sets the scale factor applied to the view.<br />
1294 /// Animatable - This property can be animated using <c>Animation</c> class.
1296 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1298 /// <since_tizen> 3 </since_tizen>
1299 public Vector3 Scale
1303 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1304 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1308 SetValue(ScaleProperty, value);
1309 NotifyPropertyChanged();
1314 /// Gets or sets the scale X factor applied to the view.
1318 /// Animatable - This property can be animated using <c>Animation</c> class.
1321 /// <since_tizen> 3 </since_tizen>
1326 return (float)GetValue(ScaleXProperty);
1330 SetValue(ScaleXProperty, value);
1331 NotifyPropertyChanged();
1336 /// Gets or sets the scale Y factor applied to the view.
1340 /// Animatable - This property can be animated using <c>Animation</c> class.
1343 /// <since_tizen> 3 </since_tizen>
1348 return (float)GetValue(ScaleYProperty);
1352 SetValue(ScaleYProperty, value);
1353 NotifyPropertyChanged();
1358 /// Gets or sets the scale Z factor applied to the view.
1362 /// Animatable - This property can be animated using <c>Animation</c> class.
1365 /// <since_tizen> 3 </since_tizen>
1370 return (float)GetValue(ScaleZProperty);
1374 SetValue(ScaleZProperty, value);
1375 NotifyPropertyChanged();
1380 /// Gets the world scale of the view.
1382 /// <since_tizen> 3 </since_tizen>
1383 public Vector3 WorldScale
1387 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1388 var pValue = GetProperty(View.Property.WorldScale);
1396 /// Retrieves the visibility flag of the view.
1400 /// If the view is not visible, then the view and its children will not be rendered.
1401 /// 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.
1404 /// Animatable - This property can be animated using <c>Animation</c> class.
1407 /// <since_tizen> 3 </since_tizen>
1408 public bool Visibility
1413 var pValue = GetProperty(View.Property.VISIBLE);
1414 pValue.Get(out temp);
1421 /// Gets the view's world color.
1423 /// <since_tizen> 3 </since_tizen>
1424 public Vector4 WorldColor
1428 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1429 var pValue = GetProperty(View.Property.WorldColor);
1437 /// Gets or sets the view's name.
1439 /// <since_tizen> 3 </since_tizen>
1444 return (string)GetValue(NameProperty);
1448 SetValue(NameProperty, value);
1449 NotifyPropertyChanged();
1454 /// Get the number of children held by the view.
1456 /// <since_tizen> 3 </since_tizen>
1457 public new uint ChildCount
1461 return GetChildCount();
1466 /// Gets the view's ID.
1469 /// <since_tizen> 3 </since_tizen>
1479 /// Gets or sets the status of whether the view should emit touch or hover signals.
1481 /// <since_tizen> 3 </since_tizen>
1482 public bool Sensitive
1486 return (bool)GetValue(SensitiveProperty);
1490 SetValue(SensitiveProperty, value);
1491 NotifyPropertyChanged();
1496 /// 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.
1498 /// <since_tizen> 3 </since_tizen>
1499 public bool LeaveRequired
1503 return (bool)GetValue(LeaveRequiredProperty);
1507 SetValue(LeaveRequiredProperty, value);
1508 NotifyPropertyChanged();
1513 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1515 /// <since_tizen> 3 </since_tizen>
1516 public bool InheritOrientation
1520 return (bool)GetValue(InheritOrientationProperty);
1524 SetValue(InheritOrientationProperty, value);
1525 NotifyPropertyChanged();
1530 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1532 /// <since_tizen> 3 </since_tizen>
1533 public bool InheritScale
1537 return (bool)GetValue(InheritScaleProperty);
1541 SetValue(InheritScaleProperty, value);
1542 NotifyPropertyChanged();
1547 /// Gets or sets the status of how the view and its children should be drawn.<br />
1548 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1549 /// 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 />
1550 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1551 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1552 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1554 /// <since_tizen> 3 </since_tizen>
1555 public DrawModeType DrawMode
1559 return (DrawModeType)GetValue(DrawModeProperty);
1563 SetValue(DrawModeProperty, value);
1564 NotifyPropertyChanged();
1569 /// Gets or sets the relative to parent size factor of the view.<br />
1570 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1571 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1574 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1576 /// <since_tizen> 3 </since_tizen>
1577 public Vector3 SizeModeFactor
1581 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1582 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1586 SetValue(SizeModeFactorProperty, value);
1587 NotifyPropertyChanged();
1592 /// Gets or sets the width resize policy to be used.
1594 /// <since_tizen> 3 </since_tizen>
1595 public ResizePolicyType WidthResizePolicy
1599 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1603 SetValue(WidthResizePolicyProperty, value);
1604 NotifyPropertyChanged();
1609 /// Gets or sets the height resize policy to be used.
1611 /// <since_tizen> 3 </since_tizen>
1612 public ResizePolicyType HeightResizePolicy
1616 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1620 SetValue(HeightResizePolicyProperty, value);
1621 NotifyPropertyChanged();
1626 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1627 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1629 /// <since_tizen> 3 </since_tizen>
1630 public SizeScalePolicyType SizeScalePolicy
1634 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1638 SetValue(SizeScalePolicyProperty, value);
1639 NotifyPropertyChanged();
1644 /// Gets or sets the status of whether the width size is dependent on the height size.
1646 /// <since_tizen> 3 </since_tizen>
1647 public bool WidthForHeight
1651 return (bool)GetValue(WidthForHeightProperty);
1655 SetValue(WidthForHeightProperty, value);
1656 NotifyPropertyChanged();
1661 /// Gets or sets the status of whether the height size is dependent on the width size.
1663 /// <since_tizen> 3 </since_tizen>
1664 public bool HeightForWidth
1668 return (bool)GetValue(HeightForWidthProperty);
1672 SetValue(HeightForWidthProperty, value);
1673 NotifyPropertyChanged();
1678 /// Gets or sets the padding for use in layout.
1681 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1683 /// <since_tizen> 5 </since_tizen>
1684 public Extents Padding
1688 // If View has a Layout then padding in stored in the base Layout class
1691 return Layout.Padding;
1695 Extents temp = (Extents)GetValue(PaddingProperty);
1696 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1698 // Two return points to prevent creating a zeroed Extent native object before assignment
1702 Extents padding = value;
1705 // Layout set so store Padding in LayoutItem instead of in View.
1706 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1707 // the position and sizes measure in the Layouting.
1708 Layout.Padding = value;
1709 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1710 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1711 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1713 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1717 SetValue(PaddingProperty, padding);
1718 NotifyPropertyChanged();
1723 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1725 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1727 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1729 /// <since_tizen> 3 </since_tizen>
1730 public Size2D MinimumSize
1734 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1735 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1741 throw new ArgumentNullException(nameof(value));
1745 // Note: it only works if minimum size is >= than natural size.
1746 // To force the size it should be done through the width&height spec or Size2D.
1747 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1748 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1749 layout.RequestLayout();
1751 SetValue(MinimumSizeProperty, value);
1752 NotifyPropertyChanged();
1757 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1760 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1762 /// <since_tizen> 3 </since_tizen>
1763 public Size2D MaximumSize
1767 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1768 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1772 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1773 // MATCH_PARENT spec + parent container size can be used to limit
1776 layout.RequestLayout();
1778 SetValue(MaximumSizeProperty, value);
1779 NotifyPropertyChanged();
1784 /// Gets or sets whether a child view inherits it's parent's position.<br />
1785 /// Default is to inherit.<br />
1786 /// 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 />
1788 /// <since_tizen> 3 </since_tizen>
1789 public bool InheritPosition
1793 return (bool)GetValue(InheritPositionProperty);
1797 SetValue(InheritPositionProperty, value);
1798 NotifyPropertyChanged();
1803 /// Gets or sets the clipping behavior (mode) of it's children.
1805 /// <since_tizen> 3 </since_tizen>
1806 public ClippingModeType ClippingMode
1810 return (ClippingModeType)GetValue(ClippingModeProperty);
1814 SetValue(ClippingModeProperty, value);
1815 NotifyPropertyChanged();
1820 /// Gets the number of renderers held by the view.
1822 /// <since_tizen> 3 </since_tizen>
1823 public uint RendererCount
1827 return GetRendererCount();
1832 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1835 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1837 /// <since_tizen> 3 </since_tizen>
1838 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1840 "View view = new View(); " +
1841 "view.PivotPoint = PivotPoint.Center; " +
1842 "view.PositionUsesPivotPoint = true;")]
1843 [EditorBrowsable(EditorBrowsableState.Never)]
1844 public Position AnchorPoint
1848 Position temp = new Position(0.0f, 0.0f, 0.0f);
1849 var pValue = GetProperty(View.Property.AnchorPoint);
1852 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1858 var temp = new Tizen.NUI.PropertyValue(value);
1859 SetProperty(View.Property.AnchorPoint, temp);
1861 NotifyPropertyChanged();
1866 /// Sets the size of a view for the width, the height and the depth.<br />
1867 /// Geometry can be scaled to fit within this area.<br />
1868 /// This does not interfere with the view's scale factor.<br />
1869 /// The views default depth is the minimum of width and height.<br />
1873 /// Animatable - This property can be animated using <c>Animation</c> class.
1875 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1877 /// <since_tizen> 5 </since_tizen>
1882 Size tmp = (Size)GetValue(SizeProperty);
1883 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1887 SetValue(SizeProperty, value);
1888 NotifyPropertyChanged();
1893 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1895 /// <since_tizen> 3 </since_tizen>
1896 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1898 "Container parent = view.GetParent(); " +
1899 "View view = parent as View;")]
1900 [EditorBrowsable(EditorBrowsableState.Never)]
1901 public new View Parent
1906 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
1907 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1908 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1910 if (basehandle is Layer layer)
1912 ret = new View(Layer.getCPtr(layer).Handle, false);
1913 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1917 ret = basehandle as View;
1920 Interop.BaseHandle.DeleteBaseHandle(CPtr);
1921 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1923 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1929 /// Gets/Sets whether inherit parent's the layout Direction.
1931 /// <since_tizen> 4 </since_tizen>
1932 public bool InheritLayoutDirection
1936 return (bool)GetValue(InheritLayoutDirectionProperty);
1940 SetValue(InheritLayoutDirectionProperty, value);
1941 NotifyPropertyChanged();
1946 /// Gets/Sets the layout Direction.
1948 /// <since_tizen> 4 </since_tizen>
1949 public ViewLayoutDirectionType LayoutDirection
1953 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1957 SetValue(LayoutDirectionProperty, value);
1958 NotifyPropertyChanged();
1959 layout?.RequestLayout();
1964 /// Gets or sets the Margin for use in layout.
1967 /// Margin property is supported by Layout algorithms and containers.
1968 /// Please Set Layout if you want to use Margin property.
1969 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1971 /// <since_tizen> 4 </since_tizen>
1972 public Extents Margin
1976 // If View has a Layout then margin is stored in Layout.
1979 return Layout.Margin;
1983 // If Layout not set then return margin stored in View.
1984 Extents temp = (Extents)GetValue(MarginProperty);
1985 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1987 // Two return points to prevent creating a zeroed Extent native object before assignment
1993 // Layout set so store Margin in LayoutItem instead of View.
1994 // If View stores the Margin too then the Legacy Size Negotiation will
1995 // overwrite the position and size values measured in the Layouting.
1996 Layout.Margin = value;
1997 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
1998 layout?.RequestLayout();
2002 SetValue(MarginProperty, value);
2004 NotifyPropertyChanged();
2005 layout?.RequestLayout();
2010 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2012 /// <since_tizen> 6 </since_tizen>
2013 public int WidthSpecification
2021 if (value == widthPolicy)
2024 widthPolicy = value;
2025 if (widthPolicy >= 0)
2027 if (heightPolicy >= 0) // Policy an exact value
2029 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2030 Size2D = new Size2D(widthPolicy, heightPolicy);
2033 layout?.RequestLayout();
2038 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2040 /// <since_tizen> 6 </since_tizen>
2041 public int HeightSpecification
2045 return heightPolicy;
2049 if (value == heightPolicy)
2052 heightPolicy = value;
2053 if (heightPolicy >= 0)
2055 if (widthPolicy >= 0) // Policy an exact value
2057 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2058 Size2D = new Size2D(widthPolicy, heightPolicy);
2061 layout?.RequestLayout();
2066 /// Gets the List of transitions for this View.
2068 /// <since_tizen> 6 </since_tizen>
2069 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2073 if (layoutTransitions == null)
2075 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2077 return layoutTransitions;
2082 /// Set a layout transitions for this View.
2084 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2086 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2088 /// <since_tizen> 6 </since_tizen>
2089 public LayoutTransition LayoutTransition
2093 return layoutTransition;
2099 throw new global::System.ArgumentNullException(nameof(value));
2101 if (layoutTransitions == null)
2103 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2106 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2108 AttachTransitionsToChildren(value);
2110 layoutTransition = value;
2115 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2118 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2120 /// <since_tizen> 4 </since_tizen>
2121 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2122 [EditorBrowsable(EditorBrowsableState.Never)]
2123 public Extents PaddingEX
2127 Extents temp = new Extents(0, 0, 0, 0);
2128 var pValue = GetProperty(View.Property.PADDING);
2131 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2137 var temp = new Tizen.NUI.PropertyValue(value);
2138 SetProperty(View.Property.PADDING, temp);
2140 NotifyPropertyChanged();
2141 layout?.RequestLayout();
2146 /// The Color of View. This is an RGBA value.
2150 /// Animatable - This property can be animated using <c>Animation</c> class.
2152 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2154 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2155 [EditorBrowsable(EditorBrowsableState.Never)]
2160 Color temp = (Color)GetValue(ColorProperty);
2161 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2165 SetValue(ColorProperty, value);
2166 selectorData?.Color.UpdateIfNeeds(this, value);
2167 NotifyPropertyChanged();
2172 /// Set the layout on this View. Replaces any existing Layout.
2174 /// <since_tizen> 6 </since_tizen>
2175 public LayoutItem Layout
2183 // Do nothing if layout provided is already set on this View.
2184 if (value == layout)
2189 LayoutingDisabled = false;
2192 // If new layout being set already has a owner then that owner receives a replacement default layout.
2193 // First check if the layout to be set already has a owner.
2194 if (value?.Owner != null)
2196 // Previous owner of the layout gets a default layout as a replacement.
2197 value.Owner.Layout = new AbsoluteLayout();
2199 // Copy Margin and Padding to replacement LayoutGroup.
2200 if (value.Owner.Layout != null)
2202 value.Owner.Layout.Margin = value.Margin;
2203 value.Owner.Layout.Padding = value.Padding;
2207 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2208 // View if no replacement. Previously margin and padding values would have been moved from
2209 // the View to the layout.
2210 if (layout != null) // Existing layout
2214 // Existing layout being replaced so copy over margin and padding values.
2215 value.Margin = layout.Margin;
2216 value.Padding = layout.Padding;
2220 // Layout not being replaced so restore margin and padding to View.
2221 SetValue(MarginProperty, layout.Margin);
2222 SetValue(PaddingProperty, layout.Padding);
2223 NotifyPropertyChanged();
2228 // First Layout to be added to the View hence copy
2230 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2233 if (Margin.Top != 0 || Margin.Bottom != 0 || Margin.Start != 0 || Margin.End != 0)
2235 // If View already has a margin set then store it in Layout instead.
2236 value.Margin = Margin;
2237 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2238 NotifyPropertyChanged();
2241 if (Padding.Top != 0 || Padding.Bottom != 0 || Padding.Start != 0 || Padding.End != 0)
2243 // If View already has a padding set then store it in Layout instead.
2244 value.Padding = Padding;
2245 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2246 NotifyPropertyChanged();
2251 // Remove existing layout from it's parent layout group.
2254 value.SetPositionByLayout = !excludeLayouting;
2256 // Set layout to this view
2262 /// The weight of the View, used to share available space in a layout with siblings.
2264 /// <since_tizen> 6 </since_tizen>
2274 layout?.RequestLayout();
2279 /// Whether to load the BackgroundImage synchronously.
2280 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2281 /// Note: For Normal Quad images only.
2283 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2284 [EditorBrowsable(EditorBrowsableState.Never)]
2285 public bool BackgroundImageSynchronosLoading
2289 return backgroundImageSynchronosLoading;
2293 backgroundImageSynchronosLoading = value;
2295 string bgUrl = null;
2296 var pValue = Background.Find(ImageVisualProperty.URL);
2297 pValue?.Get(out bgUrl);
2300 if (!string.IsNullOrEmpty(bgUrl))
2302 PropertyMap bgMap = this.Background;
2303 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2304 bgMap.Add("synchronousLoading", temp);
2311 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2312 [EditorBrowsable(EditorBrowsableState.Never)]
2313 public Vector2 UpdateSizeHint
2317 return (Vector2)GetValue(UpdateSizeHintProperty);
2321 SetValue(UpdateSizeHintProperty, value);
2322 NotifyPropertyChanged();
2326 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2327 [EditorBrowsable(EditorBrowsableState.Never)]
2328 public string[] TransitionNames
2332 return transitionNames;
2336 transitionNames = value;
2342 /// Enable/Disable ControlState propagation for children.
2343 /// It is false by default.
2344 /// If the View needs to share ControlState with descendants, please set it true.
2345 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2347 [EditorBrowsable(EditorBrowsableState.Never)]
2348 public bool EnableControlStatePropagation
2350 get => controlStatePropagation;
2353 controlStatePropagation = value;
2355 foreach (View child in Children)
2357 child.EnableControlStatePropagation = value;
2363 /// If this property is set to true, the View can have a touch related ControlState (such as Pressed) when touch.
2364 /// By default, it is false in View, true in Control.
2365 /// Note that if the value is true, the View will be a touch receptor.
2367 [EditorBrowsable(EditorBrowsableState.Never)]
2368 public bool EnableControlState
2372 return (bool)GetValue(EnableControlStateProperty);
2376 SetValue(EnableControlStateProperty, value);
2381 /// Whether the actor grab all touches even if touch leaves its boundary.
2383 /// <returns>true, if it grab all touch after start</returns>
2384 [EditorBrowsable(EditorBrowsableState.Never)]
2385 public bool GrabTouchAfterLeave
2390 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2391 pValue.Get(out temp);
2397 var temp = new Tizen.NUI.PropertyValue(value);
2398 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2400 NotifyPropertyChanged();
2405 /// Determines which blend equation will be used to render renderers of this actor.
2407 /// <returns>blend equation enum currently assigned</returns>
2408 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2409 [EditorBrowsable(EditorBrowsableState.Never)]
2410 public BlendEquationType BlendEquation
2415 var pValue = GetProperty(View.Property.BlendEquation);
2416 pValue.Get(out temp);
2418 return (BlendEquationType)temp;
2422 var temp = new Tizen.NUI.PropertyValue((int)value);
2423 SetProperty(View.Property.BlendEquation, temp);
2425 NotifyPropertyChanged();
2430 /// If the value is true, the View will change its style as the theme changes.
2431 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2433 [EditorBrowsable(EditorBrowsableState.Never)]
2434 public bool ThemeChangeSensitive
2436 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2437 set => SetValue(ThemeChangeSensitiveProperty, value);
2441 /// Get Style, it is abstract function and must be override.
2443 /// <since_tizen> 6 </since_tizen>
2444 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2445 // TODO: It should be deprecated. please use CreateViewStyle instead.
2446 [EditorBrowsable(EditorBrowsableState.Never)]
2447 protected virtual ViewStyle GetViewStyle()
2449 return CreateViewStyle();
2453 /// Create Style, it is abstract function and must be override.
2455 [EditorBrowsable(EditorBrowsableState.Never)]
2456 protected virtual ViewStyle CreateViewStyle()
2458 return new ViewStyle();
2462 /// Called after the View's ControlStates changed.
2464 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2465 [EditorBrowsable(EditorBrowsableState.Never)]
2466 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2472 [EditorBrowsable(EditorBrowsableState.Never)]
2473 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2478 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2479 [EditorBrowsable(EditorBrowsableState.Never)]
2480 public virtual void ApplyStyle(ViewStyle viewStyle)
2482 if (null == viewStyle || this.viewStyle == viewStyle) return;
2484 this.viewStyle = viewStyle;
2486 Dictionary<string, BindableProperty> bindablePropertyOfView;
2487 Type viewType = GetType();
2489 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2490 Type styleType = viewStyle.GetType();
2492 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2493 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2495 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2497 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2499 BindableProperty viewProperty;
2500 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2502 if (null != viewProperty && viewProperty != StyleNameProperty)
2504 object value = viewStyle.GetValue(keyValuePair.Value);
2508 SetValue(viewProperty, value);