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.
292 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
294 /// <since_tizen> 3 </since_tizen>
295 public Color BackgroundColor
299 Color temp = (Color)GetValue(BackgroundColorProperty);
300 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
304 SetValue(BackgroundColorProperty, value);
305 if (selectorData != null)
307 selectorData.BackgroundImage.Reset(this);
308 selectorData.BackgroundColor.UpdateIfNeeds(this, value);
310 NotifyPropertyChanged();
315 /// The mutually exclusive with "backgroundColor" and "background" type Map.
317 /// <since_tizen> 3 </since_tizen>
318 public string BackgroundImage
322 return (string)GetValue(BackgroundImageProperty);
326 SetValue(BackgroundImageProperty, value);
327 if (selectorData != null)
329 selectorData.BackgroundColor.Reset(this);
330 selectorData.BackgroundImage.UpdateIfNeeds(this, value);
332 NotifyPropertyChanged();
337 /// Get or set the border of background image.
339 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
340 [EditorBrowsable(EditorBrowsableState.Never)]
341 public Rectangle BackgroundImageBorder
345 return (Rectangle)GetValue(BackgroundImageBorderProperty);
349 SetValue(BackgroundImageBorderProperty, value);
350 selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value);
351 NotifyPropertyChanged();
356 /// The background of view.
358 /// <since_tizen> 3 </since_tizen>
359 public Tizen.NUI.PropertyMap Background
363 return (PropertyMap)GetValue(BackgroundProperty);
367 SetValue(BackgroundProperty, value);
368 NotifyPropertyChanged();
373 /// Describes a shadow as an image for a View.
374 /// It is null by default.
377 /// Getter returns copied instance of current shadow.
380 /// The mutually exclusive with "BoxShadow".
382 [EditorBrowsable(EditorBrowsableState.Never)]
383 public ImageShadow ImageShadow
387 return (ImageShadow)GetValue(ImageShadowProperty);
391 SetValue(ImageShadowProperty, value);
392 if (selectorData != null)
394 selectorData.BoxShadow.Reset(this);
395 selectorData.ImageShadow.UpdateIfNeeds(this, value);
397 NotifyPropertyChanged();
402 /// Describes a box shaped shadow drawing for a View.
403 /// It is null by default.
406 /// Gettter returns copied instance of current shadow.
409 /// The mutually exclusive with "ImageShadow".
411 [EditorBrowsable(EditorBrowsableState.Never)]
412 public Shadow BoxShadow
416 return (Shadow)GetValue(BoxShadowProperty);
420 SetValue(BoxShadowProperty, value);
421 if (selectorData != null)
423 selectorData.ImageShadow.Reset(this);
424 selectorData.BoxShadow.UpdateIfNeeds(this, value);
426 NotifyPropertyChanged();
431 /// The radius for the rounded corners of the View.
432 /// This will rounds background and shadow edges.
433 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
435 [EditorBrowsable(EditorBrowsableState.Never)]
436 public float CornerRadius
440 return (float)GetValue(CornerRadiusProperty);
444 SetValue(CornerRadiusProperty, value);
445 selectorData?.CornerRadius.UpdateIfNeeds(this, value);
446 NotifyPropertyChanged();
451 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
452 /// It is absolute by default.
453 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
455 [EditorBrowsable(EditorBrowsableState.Never)]
456 public VisualTransformPolicyType CornerRadiusPolicy
458 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
459 set => SetValue(CornerRadiusPolicyProperty, value);
463 /// The current state of the view.
465 /// <since_tizen> 3 </since_tizen>
470 return (States)GetValue(StateProperty);
474 SetValue(StateProperty, value);
475 NotifyPropertyChanged();
480 /// The current sub state of the view.
482 /// <since_tizen> 3 </since_tizen>
483 public States SubState
487 return (States)GetValue(SubStateProperty);
491 SetValue(SubStateProperty, value);
492 NotifyPropertyChanged();
497 /// Displays a tooltip
499 /// <since_tizen> 3 </since_tizen>
500 public Tizen.NUI.PropertyMap Tooltip
504 return (PropertyMap)GetValue(TooltipProperty);
508 SetValue(TooltipProperty, value);
509 NotifyPropertyChanged();
514 /// Displays a tooltip as a text.
516 /// <since_tizen> 3 </since_tizen>
517 public string TooltipText
521 using (var propertyValue = GetProperty(Property.TOOLTIP))
523 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
525 return retrivedValue;
527 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
528 return "error to get TooltipText";
533 var temp = new Tizen.NUI.PropertyValue(value);
534 SetProperty(View.Property.TOOLTIP, temp);
536 NotifyPropertyChanged();
541 /// The Child property of FlexContainer.<br />
542 /// The proportion of the free space in the container, the flex item will receive.<br />
543 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
545 /// <since_tizen> 3 </since_tizen>
546 [Obsolete("Deprecated in API8, will be removed in API10.")]
551 return (float)GetValue(FlexProperty);
555 SetValue(FlexProperty, value);
556 NotifyPropertyChanged();
561 /// The Child property of FlexContainer.<br />
562 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
564 /// <since_tizen> 3 </since_tizen>
565 [Obsolete("Deprecated in API8, will be removed in API10.")]
570 return (int)GetValue(AlignSelfProperty);
574 SetValue(AlignSelfProperty, value);
575 NotifyPropertyChanged();
580 /// The Child property of FlexContainer.<br />
581 /// The space around the flex item.<br />
584 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
586 /// <since_tizen> 3 </since_tizen>
587 [Obsolete("Deprecated in API8, will be removed in API10.")]
588 public Vector4 FlexMargin
592 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
593 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
597 SetValue(FlexMarginProperty, value);
598 NotifyPropertyChanged();
603 /// The top-left cell this child occupies, if not set, the first available cell is used.
606 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
608 /// <since_tizen> 3 </since_tizen>
609 public Vector2 CellIndex
613 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
614 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
618 SetValue(CellIndexProperty, value);
619 NotifyPropertyChanged();
624 /// The number of rows this child occupies, if not set, the default value is 1.
626 /// <since_tizen> 3 </since_tizen>
631 return (float)GetValue(RowSpanProperty);
635 SetValue(RowSpanProperty, value);
636 NotifyPropertyChanged();
641 /// The number of columns this child occupies, if not set, the default value is 1.
643 /// <since_tizen> 3 </since_tizen>
644 public float ColumnSpan
648 return (float)GetValue(ColumnSpanProperty);
652 SetValue(ColumnSpanProperty, value);
653 NotifyPropertyChanged();
658 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
660 /// <since_tizen> 3 </since_tizen>
661 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
665 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
669 SetValue(CellHorizontalAlignmentProperty, value);
670 NotifyPropertyChanged();
675 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
677 /// <since_tizen> 3 </since_tizen>
678 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
682 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
686 SetValue(CellVerticalAlignmentProperty, value);
687 NotifyPropertyChanged();
692 /// The left focusable view.<br />
693 /// This will return null if not set.<br />
694 /// This will also return null if the specified left focusable view is not on a window.<br />
696 /// <since_tizen> 3 </since_tizen>
697 public View LeftFocusableView
699 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
702 return (View)GetValue(LeftFocusableViewProperty);
706 SetValue(LeftFocusableViewProperty, value);
707 NotifyPropertyChanged();
712 /// The right focusable view.<br />
713 /// This will return null if not set.<br />
714 /// This will also return null if the specified right focusable view is not on a window.<br />
716 /// <since_tizen> 3 </since_tizen>
717 public View RightFocusableView
719 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
722 return (View)GetValue(RightFocusableViewProperty);
726 SetValue(RightFocusableViewProperty, value);
727 NotifyPropertyChanged();
732 /// The up focusable view.<br />
733 /// This will return null if not set.<br />
734 /// This will also return null if the specified up focusable view is not on a window.<br />
736 /// <since_tizen> 3 </since_tizen>
737 public View UpFocusableView
739 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
742 return (View)GetValue(UpFocusableViewProperty);
746 SetValue(UpFocusableViewProperty, value);
747 NotifyPropertyChanged();
752 /// The down focusable view.<br />
753 /// This will return null if not set.<br />
754 /// This will also return null if the specified down focusable view is not on a window.<br />
756 /// <since_tizen> 3 </since_tizen>
757 public View DownFocusableView
759 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
762 return (View)GetValue(DownFocusableViewProperty);
766 SetValue(DownFocusableViewProperty, value);
767 NotifyPropertyChanged();
772 /// Whether the view should be focusable by keyboard navigation.
774 /// <since_tizen> 3 </since_tizen>
775 public bool Focusable
779 SetValue(FocusableProperty, value);
780 NotifyPropertyChanged();
784 return (bool)GetValue(FocusableProperty);
789 /// Retrieves the position of the view.<br />
790 /// The coordinates are relative to the view's parent.<br />
792 /// <since_tizen> 3 </since_tizen>
793 public Position CurrentPosition
797 return GetCurrentPosition();
802 /// Sets the size of a view for the width and the height.<br />
803 /// Geometry can be scaled to fit within this area.<br />
804 /// This does not interfere with the view's scale factor.<br />
805 /// The views default depth is the minimum of width and height.<br />
808 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
809 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
811 /// <since_tizen> 3 </since_tizen>
816 Size2D temp = (Size2D)GetValue(Size2DProperty);
817 int width = temp.Width;
818 int height = temp.Height;
820 if (this.Layout == null)
822 if (width < 0) { width = 0; }
823 if (height < 0) { height = 0; }
826 return new Size2D(OnSize2DChanged, width, height);
830 SetValue(Size2DProperty, value);
832 NotifyPropertyChanged();
837 /// Retrieves the size of the view.<br />
838 /// The coordinates are relative to the view's parent.<br />
840 /// <since_tizen> 3 </since_tizen>
841 public Size2D CurrentSize
845 return GetCurrentSize();
850 /// Retrieves and sets the view's opacity.<br />
852 /// <since_tizen> 3 </since_tizen>
857 return (float)GetValue(OpacityProperty);
861 SetValue(OpacityProperty, value);
862 selectorData?.Opacity.UpdateIfNeeds(this, value);
863 NotifyPropertyChanged();
868 /// Sets the position of the view for X and Y.<br />
869 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
870 /// If the position inheritance is disabled, sets the world position.<br />
873 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
874 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
876 /// <since_tizen> 3 </since_tizen>
877 public Position2D Position2D
881 Position2D temp = (Position2D)GetValue(Position2DProperty);
882 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
886 SetValue(Position2DProperty, value);
887 NotifyPropertyChanged();
892 /// Retrieves the screen postion of the view.<br />
894 /// <since_tizen> 3 </since_tizen>
895 public Vector2 ScreenPosition
899 Vector2 temp = new Vector2(0.0f, 0.0f);
900 var pValue = GetProperty(View.Property.ScreenPosition);
908 /// Determines whether the pivot point should be used to determine the position of the view.
909 /// This is false by default.
911 /// <remarks>If false, then the top-left of the view is used for the position.
912 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
914 /// <since_tizen> 3 </since_tizen>
915 public bool PositionUsesPivotPoint
919 return (bool)GetValue(PositionUsesPivotPointProperty);
923 SetValue(PositionUsesPivotPointProperty, value);
924 NotifyPropertyChanged();
929 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
931 /// <since_tizen> 3 </since_tizen>
932 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
934 "View view = new View(); " +
935 "view.PivotPoint = PivotPoint.Center; " +
936 "view.PositionUsesPivotPoint = true;" +
937 " Deprecated in API5: Will be removed in API8")]
938 [EditorBrowsable(EditorBrowsableState.Never)]
939 public bool PositionUsesAnchorPoint
944 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
945 pValue.Get(out temp);
951 var temp = new Tizen.NUI.PropertyValue(value);
952 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
954 NotifyPropertyChanged();
959 /// Queries whether the view is connected to the stage.<br />
960 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
962 /// <since_tizen> 3 </since_tizen>
963 public bool IsOnWindow
972 /// Gets the depth in the hierarchy for the view.
974 /// <since_tizen> 3 </since_tizen>
975 public int HierarchyDepth
979 return GetHierarchyDepth();
984 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
987 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
988 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
989 /// The values set by this property will likely change.
991 /// <since_tizen> 3 </since_tizen>
992 public int SiblingOrder
996 return (int)GetValue(SiblingOrderProperty);
1000 SetValue(SiblingOrderProperty, value);
1002 LayoutGroup layout = Layout as LayoutGroup;
1003 layout?.ChangeLayoutSiblingOrder(value);
1005 NotifyPropertyChanged();
1010 /// Returns the natural size of the view.
1013 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1015 /// <since_tizen> 5 </since_tizen>
1016 public Vector3 NaturalSize
1020 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1021 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1027 /// Returns the natural size (Size2D) of the view.
1030 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1032 /// <since_tizen> 4 </since_tizen>
1033 public Size2D NaturalSize2D
1037 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1038 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1040 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1047 /// Gets or sets the origin of a view within its parent's area.<br />
1048 /// 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 />
1049 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1050 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1052 /// <pre>The view has been initialized.</pre>
1053 /// <since_tizen> 3 </since_tizen>
1054 public Position ParentOrigin
1058 Position tmp = (Position)GetValue(ParentOriginProperty);
1059 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1063 SetValue(ParentOriginProperty, value);
1064 NotifyPropertyChanged();
1069 /// Gets or sets the anchor-point of a view.<br />
1070 /// 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 />
1071 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1072 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1073 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1074 /// <pre>The view has been initialized.</pre>
1077 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1079 /// <since_tizen> 3 </since_tizen>
1080 public Position PivotPoint
1084 Position tmp = (Position)GetValue(PivotPointProperty);
1085 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1089 SetValue(PivotPointProperty, value);
1090 NotifyPropertyChanged();
1095 /// Gets or sets the size width of the view.
1099 /// Animatable - This property can be animated using <c>Animation</c> class.
1102 /// <since_tizen> 3 </since_tizen>
1103 public float SizeWidth
1107 return (float)GetValue(SizeWidthProperty);
1111 SetValue(SizeWidthProperty, value);
1112 NotifyPropertyChanged();
1117 /// Gets or sets the size height of the view.
1121 /// Animatable - This property can be animated using <c>Animation</c> class.
1124 /// <since_tizen> 3 </since_tizen>
1125 public float SizeHeight
1129 return (float)GetValue(SizeHeightProperty);
1133 SetValue(SizeHeightProperty, value);
1134 NotifyPropertyChanged();
1139 /// Gets or sets the position of the view.<br />
1140 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1141 /// If the position inheritance is disabled, sets the world position.<br />
1145 /// Animatable - This property can be animated using <c>Animation</c> class.
1147 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1149 /// <since_tizen> 3 </since_tizen>
1150 public Position Position
1154 Position tmp = (Position)GetValue(PositionProperty);
1155 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1159 SetValue(PositionProperty, value);
1160 NotifyPropertyChanged();
1165 /// Gets or sets the position X of the view.
1169 /// Animatable - This property can be animated using <c>Animation</c> class.
1172 /// <since_tizen> 3 </since_tizen>
1173 public float PositionX
1177 return (float)GetValue(PositionXProperty);
1181 SetValue(PositionXProperty, value);
1182 NotifyPropertyChanged();
1187 /// Gets or sets the position Y of the view.
1191 /// Animatable - This property can be animated using <c>Animation</c> class.
1194 /// <since_tizen> 3 </since_tizen>
1195 public float PositionY
1199 return (float)GetValue(PositionYProperty);
1203 SetValue(PositionYProperty, value);
1204 NotifyPropertyChanged();
1209 /// Gets or sets the position Z of the view.
1213 /// Animatable - This property can be animated using <c>Animation</c> class.
1216 /// <since_tizen> 3 </since_tizen>
1217 public float PositionZ
1221 return (float)GetValue(PositionZProperty);
1225 SetValue(PositionZProperty, value);
1226 NotifyPropertyChanged();
1231 /// Gets or sets the world position of the view.
1233 /// <since_tizen> 3 </since_tizen>
1234 public Vector3 WorldPosition
1238 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1239 var pValue = GetProperty(View.Property.WorldPosition);
1247 /// Gets or sets the orientation of the view.<br />
1248 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1252 /// This is an asynchronous method.
1255 /// Animatable - This property can be animated using <c>Animation</c> class.
1258 /// <since_tizen> 3 </since_tizen>
1259 public Rotation Orientation
1263 return (Rotation)GetValue(OrientationProperty);
1267 SetValue(OrientationProperty, value);
1268 NotifyPropertyChanged();
1273 /// Gets or sets the world orientation of the view.<br />
1275 /// <since_tizen> 3 </since_tizen>
1276 public Rotation WorldOrientation
1280 Rotation temp = new Rotation();
1281 var pValue = GetProperty(View.Property.WorldOrientation);
1289 /// Gets or sets the scale factor applied to the view.<br />
1293 /// Animatable - This property can be animated using <c>Animation</c> class.
1295 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1297 /// <since_tizen> 3 </since_tizen>
1298 public Vector3 Scale
1302 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1303 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1307 SetValue(ScaleProperty, value);
1308 NotifyPropertyChanged();
1313 /// Gets or sets the scale X factor applied to the view.
1317 /// Animatable - This property can be animated using <c>Animation</c> class.
1320 /// <since_tizen> 3 </since_tizen>
1325 return (float)GetValue(ScaleXProperty);
1329 SetValue(ScaleXProperty, value);
1330 NotifyPropertyChanged();
1335 /// Gets or sets the scale Y factor applied to the view.
1339 /// Animatable - This property can be animated using <c>Animation</c> class.
1342 /// <since_tizen> 3 </since_tizen>
1347 return (float)GetValue(ScaleYProperty);
1351 SetValue(ScaleYProperty, value);
1352 NotifyPropertyChanged();
1357 /// Gets or sets the scale Z factor applied to the view.
1361 /// Animatable - This property can be animated using <c>Animation</c> class.
1364 /// <since_tizen> 3 </since_tizen>
1369 return (float)GetValue(ScaleZProperty);
1373 SetValue(ScaleZProperty, value);
1374 NotifyPropertyChanged();
1379 /// Gets the world scale of the view.
1381 /// <since_tizen> 3 </since_tizen>
1382 public Vector3 WorldScale
1386 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1387 var pValue = GetProperty(View.Property.WorldScale);
1395 /// Retrieves the visibility flag of the view.
1399 /// If the view is not visible, then the view and its children will not be rendered.
1400 /// 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.
1403 /// Animatable - This property can be animated using <c>Animation</c> class.
1406 /// <since_tizen> 3 </since_tizen>
1407 public bool Visibility
1412 var pValue = GetProperty(View.Property.VISIBLE);
1413 pValue.Get(out temp);
1420 /// Gets the view's world color.
1422 /// <since_tizen> 3 </since_tizen>
1423 public Vector4 WorldColor
1427 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1428 var pValue = GetProperty(View.Property.WorldColor);
1436 /// Gets or sets the view's name.
1438 /// <since_tizen> 3 </since_tizen>
1443 return (string)GetValue(NameProperty);
1447 SetValue(NameProperty, value);
1448 NotifyPropertyChanged();
1453 /// Get the number of children held by the view.
1455 /// <since_tizen> 3 </since_tizen>
1456 public new uint ChildCount
1460 return Convert.ToUInt32(Children.Count);
1465 /// Gets the view's ID.
1468 /// <since_tizen> 3 </since_tizen>
1478 /// Gets or sets the status of whether the view should emit touch or hover signals.
1480 /// <since_tizen> 3 </since_tizen>
1481 public bool Sensitive
1485 return (bool)GetValue(SensitiveProperty);
1489 SetValue(SensitiveProperty, value);
1490 NotifyPropertyChanged();
1495 /// 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.
1497 /// <since_tizen> 3 </since_tizen>
1498 public bool LeaveRequired
1502 return (bool)GetValue(LeaveRequiredProperty);
1506 SetValue(LeaveRequiredProperty, value);
1507 NotifyPropertyChanged();
1512 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1514 /// <since_tizen> 3 </since_tizen>
1515 public bool InheritOrientation
1519 return (bool)GetValue(InheritOrientationProperty);
1523 SetValue(InheritOrientationProperty, value);
1524 NotifyPropertyChanged();
1529 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1531 /// <since_tizen> 3 </since_tizen>
1532 public bool InheritScale
1536 return (bool)GetValue(InheritScaleProperty);
1540 SetValue(InheritScaleProperty, value);
1541 NotifyPropertyChanged();
1546 /// Gets or sets the status of how the view and its children should be drawn.<br />
1547 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1548 /// 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 />
1549 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1550 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1551 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1553 /// <since_tizen> 3 </since_tizen>
1554 public DrawModeType DrawMode
1558 return (DrawModeType)GetValue(DrawModeProperty);
1562 SetValue(DrawModeProperty, value);
1563 NotifyPropertyChanged();
1568 /// Gets or sets the relative to parent size factor of the view.<br />
1569 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1570 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1573 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1575 /// <since_tizen> 3 </since_tizen>
1576 public Vector3 SizeModeFactor
1580 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1581 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1585 SetValue(SizeModeFactorProperty, value);
1586 NotifyPropertyChanged();
1591 /// Gets or sets the width resize policy to be used.
1593 /// <since_tizen> 3 </since_tizen>
1594 public ResizePolicyType WidthResizePolicy
1598 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1602 SetValue(WidthResizePolicyProperty, value);
1603 NotifyPropertyChanged();
1608 /// Gets or sets the height resize policy to be used.
1610 /// <since_tizen> 3 </since_tizen>
1611 public ResizePolicyType HeightResizePolicy
1615 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1619 SetValue(HeightResizePolicyProperty, value);
1620 NotifyPropertyChanged();
1625 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1626 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1628 /// <since_tizen> 3 </since_tizen>
1629 public SizeScalePolicyType SizeScalePolicy
1633 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1637 SetValue(SizeScalePolicyProperty, value);
1638 NotifyPropertyChanged();
1643 /// Gets or sets the status of whether the width size is dependent on the height size.
1645 /// <since_tizen> 3 </since_tizen>
1646 public bool WidthForHeight
1650 return (bool)GetValue(WidthForHeightProperty);
1654 SetValue(WidthForHeightProperty, value);
1655 NotifyPropertyChanged();
1660 /// Gets or sets the status of whether the height size is dependent on the width size.
1662 /// <since_tizen> 3 </since_tizen>
1663 public bool HeightForWidth
1667 return (bool)GetValue(HeightForWidthProperty);
1671 SetValue(HeightForWidthProperty, value);
1672 NotifyPropertyChanged();
1677 /// Gets or sets the padding for use in layout.
1680 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1682 /// <since_tizen> 5 </since_tizen>
1683 public Extents Padding
1687 // If View has a Layout then padding in stored in the base Layout class
1690 return Layout.Padding;
1694 Extents temp = (Extents)GetValue(PaddingProperty);
1695 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1697 // Two return points to prevent creating a zeroed Extent native object before assignment
1701 Extents padding = value;
1704 // Layout set so store Padding in LayoutItem instead of in View.
1705 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1706 // the position and sizes measure in the Layouting.
1707 Layout.Padding = value;
1708 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1709 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1710 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1712 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1716 SetValue(PaddingProperty, padding);
1717 NotifyPropertyChanged();
1722 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1724 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1726 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1728 /// <since_tizen> 3 </since_tizen>
1729 public Size2D MinimumSize
1733 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1734 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1740 throw new ArgumentNullException(nameof(value));
1744 // Note: it only works if minimum size is >= than natural size.
1745 // To force the size it should be done through the width&height spec or Size2D.
1746 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1747 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1748 layout.RequestLayout();
1750 SetValue(MinimumSizeProperty, value);
1751 NotifyPropertyChanged();
1756 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1759 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1761 /// <since_tizen> 3 </since_tizen>
1762 public Size2D MaximumSize
1766 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1767 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1771 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1772 // MATCH_PARENT spec + parent container size can be used to limit
1775 layout.RequestLayout();
1777 SetValue(MaximumSizeProperty, value);
1778 NotifyPropertyChanged();
1783 /// Gets or sets whether a child view inherits it's parent's position.<br />
1784 /// Default is to inherit.<br />
1785 /// 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 />
1787 /// <since_tizen> 3 </since_tizen>
1788 public bool InheritPosition
1792 return (bool)GetValue(InheritPositionProperty);
1796 SetValue(InheritPositionProperty, value);
1797 NotifyPropertyChanged();
1802 /// Gets or sets the clipping behavior (mode) of it's children.
1804 /// <since_tizen> 3 </since_tizen>
1805 public ClippingModeType ClippingMode
1809 return (ClippingModeType)GetValue(ClippingModeProperty);
1813 SetValue(ClippingModeProperty, value);
1814 NotifyPropertyChanged();
1819 /// Gets the number of renderers held by the view.
1821 /// <since_tizen> 3 </since_tizen>
1822 public uint RendererCount
1826 return GetRendererCount();
1831 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1834 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1836 /// <since_tizen> 3 </since_tizen>
1837 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1839 "View view = new View(); " +
1840 "view.PivotPoint = PivotPoint.Center; " +
1841 "view.PositionUsesPivotPoint = true;")]
1842 [EditorBrowsable(EditorBrowsableState.Never)]
1843 public Position AnchorPoint
1847 Position temp = new Position(0.0f, 0.0f, 0.0f);
1848 var pValue = GetProperty(View.Property.AnchorPoint);
1851 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1857 var temp = new Tizen.NUI.PropertyValue(value);
1858 SetProperty(View.Property.AnchorPoint, temp);
1860 NotifyPropertyChanged();
1865 /// Sets the size of a view for the width, the height and the depth.<br />
1866 /// Geometry can be scaled to fit within this area.<br />
1867 /// This does not interfere with the view's scale factor.<br />
1868 /// The views default depth is the minimum of width and height.<br />
1872 /// Animatable - This property can be animated using <c>Animation</c> class.
1874 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1876 /// <since_tizen> 5 </since_tizen>
1881 Size tmp = (Size)GetValue(SizeProperty);
1882 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1886 SetValue(SizeProperty, value);
1887 NotifyPropertyChanged();
1892 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1894 /// <since_tizen> 3 </since_tizen>
1895 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1897 "Container parent = view.GetParent(); " +
1898 "View view = parent as View;")]
1899 [EditorBrowsable(EditorBrowsableState.Never)]
1900 public new View Parent
1905 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
1906 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1907 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1909 if (basehandle is Layer layer)
1911 ret = new View(Layer.getCPtr(layer).Handle, false);
1912 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1916 ret = basehandle as View;
1919 Interop.BaseHandle.DeleteBaseHandle(CPtr);
1920 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1922 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1928 /// Gets/Sets whether inherit parent's the layout Direction.
1930 /// <since_tizen> 4 </since_tizen>
1931 public bool InheritLayoutDirection
1935 return (bool)GetValue(InheritLayoutDirectionProperty);
1939 SetValue(InheritLayoutDirectionProperty, value);
1940 NotifyPropertyChanged();
1945 /// Gets/Sets the layout Direction.
1947 /// <since_tizen> 4 </since_tizen>
1948 public ViewLayoutDirectionType LayoutDirection
1952 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1956 SetValue(LayoutDirectionProperty, value);
1957 NotifyPropertyChanged();
1958 layout?.RequestLayout();
1963 /// Gets or sets the Margin for use in layout.
1966 /// Margin property is supported by Layout algorithms and containers.
1967 /// Please Set Layout if you want to use Margin property.
1968 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1970 /// <since_tizen> 4 </since_tizen>
1971 public Extents Margin
1975 // If View has a Layout then margin is stored in Layout.
1978 return Layout.Margin;
1982 // If Layout not set then return margin stored in View.
1983 Extents temp = (Extents)GetValue(MarginProperty);
1984 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1986 // Two return points to prevent creating a zeroed Extent native object before assignment
1992 // Layout set so store Margin in LayoutItem instead of View.
1993 // If View stores the Margin too then the Legacy Size Negotiation will
1994 // overwrite the position and size values measured in the Layouting.
1995 Layout.Margin = value;
1996 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
1997 layout?.RequestLayout();
2001 SetValue(MarginProperty, value);
2003 NotifyPropertyChanged();
2004 layout?.RequestLayout();
2009 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2011 /// <since_tizen> 6 </since_tizen>
2012 public int WidthSpecification
2020 if (value == widthPolicy)
2023 widthPolicy = value;
2024 if (widthPolicy >= 0)
2026 if (heightPolicy >= 0) // Policy an exact value
2028 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2029 Size2D = new Size2D(widthPolicy, heightPolicy);
2032 layout?.RequestLayout();
2037 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2039 /// <since_tizen> 6 </since_tizen>
2040 public int HeightSpecification
2044 return heightPolicy;
2048 if (value == heightPolicy)
2051 heightPolicy = value;
2052 if (heightPolicy >= 0)
2054 if (widthPolicy >= 0) // Policy an exact value
2056 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2057 Size2D = new Size2D(widthPolicy, heightPolicy);
2060 layout?.RequestLayout();
2065 /// Gets the List of transitions for this View.
2067 /// <since_tizen> 6 </since_tizen>
2068 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2072 if (layoutTransitions == null)
2074 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2076 return layoutTransitions;
2081 /// Set a layout transitions for this View.
2083 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2085 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2087 /// <since_tizen> 6 </since_tizen>
2088 public LayoutTransition LayoutTransition
2092 return layoutTransition;
2098 throw new global::System.ArgumentNullException(nameof(value));
2100 if (layoutTransitions == null)
2102 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2105 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2107 AttachTransitionsToChildren(value);
2109 layoutTransition = value;
2114 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2117 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2119 /// <since_tizen> 4 </since_tizen>
2120 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2121 [EditorBrowsable(EditorBrowsableState.Never)]
2122 public Extents PaddingEX
2126 Extents temp = new Extents(0, 0, 0, 0);
2127 var pValue = GetProperty(View.Property.PADDING);
2130 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2136 var temp = new Tizen.NUI.PropertyValue(value);
2137 SetProperty(View.Property.PADDING, temp);
2139 NotifyPropertyChanged();
2140 layout?.RequestLayout();
2145 /// The Color of View. This is an RGBA value.
2149 /// Animatable - This property can be animated using <c>Animation</c> class.
2151 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2153 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2154 [EditorBrowsable(EditorBrowsableState.Never)]
2159 Color temp = (Color)GetValue(ColorProperty);
2160 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2164 SetValue(ColorProperty, value);
2165 selectorData?.Color.UpdateIfNeeds(this, value);
2166 NotifyPropertyChanged();
2171 /// Set the layout on this View. Replaces any existing Layout.
2173 /// <since_tizen> 6 </since_tizen>
2174 public LayoutItem Layout
2182 // Do nothing if layout provided is already set on this View.
2183 if (value == layout)
2188 LayoutingDisabled = false;
2191 // If new layout being set already has a owner then that owner receives a replacement default layout.
2192 // First check if the layout to be set already has a owner.
2193 if (value?.Owner != null)
2195 // Previous owner of the layout gets a default layout as a replacement.
2196 value.Owner.Layout = new AbsoluteLayout();
2198 // Copy Margin and Padding to replacement LayoutGroup.
2199 if (value.Owner.Layout != null)
2201 value.Owner.Layout.Margin = value.Margin;
2202 value.Owner.Layout.Padding = value.Padding;
2206 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2207 // View if no replacement. Previously margin and padding values would have been moved from
2208 // the View to the layout.
2209 if (layout != null) // Existing layout
2213 // Existing layout being replaced so copy over margin and padding values.
2214 value.Margin = layout.Margin;
2215 value.Padding = layout.Padding;
2219 // Layout not being replaced so restore margin and padding to View.
2220 SetValue(MarginProperty, layout.Margin);
2221 SetValue(PaddingProperty, layout.Padding);
2222 NotifyPropertyChanged();
2227 // First Layout to be added to the View hence copy
2229 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2232 if (Margin.Top != 0 || Margin.Bottom != 0 || Margin.Start != 0 || Margin.End != 0)
2234 // If View already has a margin set then store it in Layout instead.
2235 value.Margin = Margin;
2236 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2237 NotifyPropertyChanged();
2240 if (Padding.Top != 0 || Padding.Bottom != 0 || Padding.Start != 0 || Padding.End != 0)
2242 // If View already has a padding set then store it in Layout instead.
2243 value.Padding = Padding;
2244 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2245 NotifyPropertyChanged();
2250 // Remove existing layout from it's parent layout group.
2253 value.SetPositionByLayout = !excludeLayouting;
2255 // Set layout to this view
2261 /// The weight of the View, used to share available space in a layout with siblings.
2263 /// <since_tizen> 6 </since_tizen>
2273 layout?.RequestLayout();
2278 /// Whether to load the BackgroundImage synchronously.
2279 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2280 /// Note: For Normal Quad images only.
2282 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2283 [EditorBrowsable(EditorBrowsableState.Never)]
2284 public bool BackgroundImageSynchronosLoading
2288 return backgroundImageSynchronosLoading;
2292 backgroundImageSynchronosLoading = value;
2294 string bgUrl = null;
2295 var pValue = Background.Find(ImageVisualProperty.URL);
2296 pValue?.Get(out bgUrl);
2299 if (!string.IsNullOrEmpty(bgUrl))
2301 PropertyMap bgMap = this.Background;
2302 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2303 bgMap.Add("synchronousLoading", temp);
2310 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2311 [EditorBrowsable(EditorBrowsableState.Never)]
2312 public Vector2 UpdateSizeHint
2316 return (Vector2)GetValue(UpdateSizeHintProperty);
2320 SetValue(UpdateSizeHintProperty, value);
2321 NotifyPropertyChanged();
2326 /// Enable/Disable ControlState propagation for children.
2327 /// It is false by default.
2328 /// If the View needs to share ControlState with descendants, please set it true.
2329 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2331 [EditorBrowsable(EditorBrowsableState.Never)]
2332 public bool EnableControlStatePropagation
2334 get => controlStatePropagation;
2337 controlStatePropagation = value;
2339 foreach (View child in Children)
2341 child.EnableControlStatePropagation = value;
2347 /// If this property is set to true, the View can have a touch related ControlState (such as Pressed) when touch.
2348 /// By default, it is false in View, true in Control.
2349 /// Note that if the value is true, the View will be a touch receptor.
2351 [EditorBrowsable(EditorBrowsableState.Never)]
2352 public bool EnableControlState
2356 return (bool)GetValue(EnableControlStateProperty);
2360 SetValue(EnableControlStateProperty, value);
2365 /// Whether the actor grab all touches even if touch leaves its boundary.
2367 /// <returns>true, if it grab all touch after start</returns>
2368 [EditorBrowsable(EditorBrowsableState.Never)]
2369 public bool GrabTouchAfterLeave
2374 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2375 pValue.Get(out temp);
2381 var temp = new Tizen.NUI.PropertyValue(value);
2382 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2384 NotifyPropertyChanged();
2389 /// Determines which blend equation will be used to render renderers of this actor.
2391 /// <returns>blend equation enum currently assigned</returns>
2392 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2393 [EditorBrowsable(EditorBrowsableState.Never)]
2394 public BlendEquationType BlendEquation
2399 var pValue = GetProperty(View.Property.BlendEquation);
2400 pValue.Get(out temp);
2402 return (BlendEquationType)temp;
2406 var temp = new Tizen.NUI.PropertyValue((int)value);
2407 SetProperty(View.Property.BlendEquation, temp);
2409 NotifyPropertyChanged();
2414 /// If the value is true, the View will change its style as the theme changes.
2415 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2417 [EditorBrowsable(EditorBrowsableState.Never)]
2418 public bool ThemeChangeSensitive
2420 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2421 set => SetValue(ThemeChangeSensitiveProperty, value);
2425 /// Create Style, it is abstract function and must be override.
2427 [EditorBrowsable(EditorBrowsableState.Never)]
2428 protected virtual ViewStyle CreateViewStyle()
2430 return new ViewStyle();
2434 /// Called after the View's ControlStates changed.
2436 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2437 [EditorBrowsable(EditorBrowsableState.Never)]
2438 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2444 [EditorBrowsable(EditorBrowsableState.Never)]
2445 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2450 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2451 [EditorBrowsable(EditorBrowsableState.Never)]
2452 public virtual void ApplyStyle(ViewStyle viewStyle)
2454 if (null == viewStyle || this.viewStyle == viewStyle) return;
2456 this.viewStyle = viewStyle;
2458 Dictionary<string, BindableProperty> bindablePropertyOfView;
2459 Type viewType = GetType();
2461 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2462 Type styleType = viewStyle.GetType();
2464 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2465 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2467 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2469 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2471 BindableProperty viewProperty;
2472 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2474 if (null != viewProperty && viewProperty != StyleNameProperty)
2476 object value = viewStyle.GetValue(keyValuePair.Value);
2480 SetValue(viewProperty, value);
2488 /// Used to restore the transition.
2490 [EditorBrowsable(EditorBrowsableState.Never)]
2491 public IList<Transition> TransitionList
2494 } = new List<Transition>();