2 * Copyright(c) 2021 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;
23 namespace Tizen.NUI.BaseComponents
26 /// View is the base class for all views.
28 /// <since_tizen> 3 </since_tizen>
29 public partial class View : Container, IResourcesProvider
31 internal BackgroundExtraData backgroundExtraData;
33 private bool layoutSet = false;
34 private LayoutItem layout; // Exclusive layout assigned to this View.
36 // List of transitions paired with the condition that uses the transition.
37 private Dictionary<TransitionCondition, TransitionList> layoutTransitions;
38 private int widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
39 private int heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
40 private float weight = 0.0f; // Weighting of child View in a Layout
41 private bool backgroundImageSynchronosLoading = false;
42 private bool controlStatePropagation = false;
43 private ViewStyle viewStyle;
44 private bool themeChangeSensitive = false;
45 private bool excludeLayouting = false;
46 private LayoutTransition layoutTransition;
47 private ControlState controlStates = ControlState.Normal;
48 private TransitionOptions transitionOptions = null;
53 /// Creates a new instance of a view.
55 /// <since_tizen> 3 </since_tizen>
56 public View() : this(Interop.View.New(), true)
58 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
61 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
62 [EditorBrowsable(EditorBrowsableState.Never)]
63 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
68 /// Create a new instance of a View with setting the status of shown or hidden.
70 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
71 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
72 [EditorBrowsable(EditorBrowsableState.Never)]
73 public View(bool shown) : this(Interop.View.New(), true)
75 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
81 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
87 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
90 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
92 InitializeStyle(viewStyle);
95 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
99 PositionUsesPivotPoint = false;
102 onWindowSendEventCallback = SendViewAddedEventToWindow;
103 this.OnWindowSignal().Connect(onWindowSendEventCallback);
111 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
122 /// The event that is triggered when the View's ControlState is changed.
124 [EditorBrowsable(EditorBrowsableState.Never)]
125 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
127 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
131 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
133 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
134 [EditorBrowsable(EditorBrowsableState.Never)]
135 public bool LayoutSet
144 /// Flag to allow Layouting to be disabled for Views.
145 /// Once a View has a Layout set then any children added to Views from then on will receive
146 /// automatic Layouts.
148 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
149 [EditorBrowsable(EditorBrowsableState.Never)]
150 public static bool LayoutingDisabled { get; set; } = true;
153 /// The style instance applied to this view.
154 /// Note that please do not modify the ViewStyle.
155 /// Modifying ViewStyle will affect other views with same ViewStyle.
157 [EditorBrowsable(EditorBrowsableState.Never)]
158 protected ViewStyle ViewStyle
162 if (null == viewStyle)
164 ApplyStyle(CreateViewStyle());
172 /// Get/Set the control state.
173 /// Note that the ControlState only available for the classes derived from Control.
174 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
175 /// please set <see cref="EnableControlState"/> to true.
177 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
178 [EditorBrowsable(EditorBrowsableState.Never)]
179 public ControlState ControlState
183 return controlStates;
187 if (controlStates == value)
192 var prevState = controlStates;
194 controlStates = value;
196 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
198 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
200 if (controlStatePropagation)
202 foreach (View child in Children)
204 child.ControlState = value;
208 OnControlStateChanged(changeInfo);
210 ControlStateChangedEvent?.Invoke(this, changeInfo);
215 /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
217 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
218 [EditorBrowsable(EditorBrowsableState.Never)]
219 public bool ExcludeLayouting
223 return excludeLayouting;
227 excludeLayouting = value;
228 if (Layout != null && Layout.SetPositionByLayout == value)
230 Layout.SetPositionByLayout = !value;
231 Layout.RequestLayout();
236 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
237 [EditorBrowsable(EditorBrowsableState.Never)]
238 public bool IsResourcesCreated
242 return Application.Current.IsResourcesCreated;
246 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
247 [EditorBrowsable(EditorBrowsableState.Never)]
248 public ResourceDictionary XamlResources
252 return Application.Current.XamlResources;
256 Application.Current.XamlResources = value;
261 /// The StyleName, type string.
262 /// The value indicates DALi style name defined in json theme file.
264 /// <since_tizen> 3 </since_tizen>
265 public string StyleName
269 return (string)GetValue(StyleNameProperty);
273 SetValue(StyleNameProperty, value);
274 NotifyPropertyChanged();
279 /// The KeyInputFocus, type bool.
281 [EditorBrowsable(EditorBrowsableState.Never)]
282 public bool KeyInputFocus
286 return (bool)GetValue(KeyInputFocusProperty);
290 SetValue(KeyInputFocusProperty, value);
291 NotifyPropertyChanged();
296 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
300 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
303 /// Animatable - This property can be animated using <c>Animation</c> class.
305 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
309 /// <since_tizen> 3 </since_tizen>
310 public Color BackgroundColor
314 Color temp = (Color)GetValue(BackgroundColorProperty);
315 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
319 SetValue(BackgroundColorProperty, value);
320 NotifyPropertyChanged();
325 /// The mutually exclusive with "backgroundColor" and "background" type Map.
327 /// <since_tizen> 3 </since_tizen>
328 public string BackgroundImage
332 return (string)GetValue(BackgroundImageProperty);
336 SetValue(BackgroundImageProperty, value);
337 NotifyPropertyChanged();
342 /// Get or set the border of background image.
344 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
345 [EditorBrowsable(EditorBrowsableState.Never)]
346 public Rectangle BackgroundImageBorder
350 return (Rectangle)GetValue(BackgroundImageBorderProperty);
354 SetValue(BackgroundImageBorderProperty, value);
355 NotifyPropertyChanged();
360 /// The background of view.
362 /// <since_tizen> 3 </since_tizen>
363 public Tizen.NUI.PropertyMap Background
367 return (PropertyMap)GetValue(BackgroundProperty);
371 SetValue(BackgroundProperty, value);
372 NotifyPropertyChanged();
377 /// Describes a shadow as an image for a View.
378 /// It is null by default.
381 /// Getter returns copied instance of current shadow.
384 /// The mutually exclusive with "BoxShadow".
388 /// Animatable - This property can be animated using <c>Animation</c> class.
389 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
391 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
393 /// Animatable sub-property : Offset.
396 [EditorBrowsable(EditorBrowsableState.Never)]
397 public ImageShadow ImageShadow
401 return (ImageShadow)GetValue(ImageShadowProperty);
405 SetValue(ImageShadowProperty, value);
406 NotifyPropertyChanged();
411 /// Describes a box shaped shadow drawing for a View.
412 /// It is null by default.
415 /// Getter returns copied instance of current shadow.
418 /// The mutually exclusive with "ImageShadow".
422 /// Animatable - This property can be animated using <c>Animation</c> class.
423 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
425 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
427 /// Animatable sub-property : Offset, Color, BlurRadius.
430 [EditorBrowsable(EditorBrowsableState.Never)]
431 public Shadow BoxShadow
435 return (Shadow)GetValue(BoxShadowProperty);
439 SetValue(BoxShadowProperty, value);
440 NotifyPropertyChanged();
445 /// The radius for the rounded corners of the View.
446 /// This will rounds background and shadow edges.
447 /// The values in Vector4 are used in clockwise order from top-left to bottom-left : Vector4(top-left-corner, top-right-corner, bottom-right-corner, bottom-left-corner).
448 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
452 /// Animatable - This property can be animated using <c>Animation</c> class.
455 [EditorBrowsable(EditorBrowsableState.Never)]
456 public Vector4 CornerRadius
460 return (Vector4)GetValue(CornerRadiusProperty);
464 SetValue(CornerRadiusProperty, value);
465 NotifyPropertyChanged();
473 [EditorBrowsable(EditorBrowsableState.Never)]
474 protected bool IsHighlighted
478 using (View view = Accessibility.Accessibility.Instance.GetCurrentlyHighlightedView())
485 [EditorBrowsable(EditorBrowsableState.Never)]
486 protected static readonly string AccessibilityActivateAction = "activate";
487 [EditorBrowsable(EditorBrowsableState.Never)]
488 protected static readonly string AccessibilityReadingSkippedAction = "ReadingSkipped";
489 [EditorBrowsable(EditorBrowsableState.Never)]
490 protected static readonly string AccessibilityReadingCancelledAction = "ReadingCancelled";
491 [EditorBrowsable(EditorBrowsableState.Never)]
492 protected static readonly string AccessibilityReadingStoppedAction = "ReadingStopped";
493 [EditorBrowsable(EditorBrowsableState.Never)]
494 protected static readonly string AccessibilityReadingPausedAction = "ReadingPaused";
495 [EditorBrowsable(EditorBrowsableState.Never)]
496 protected static readonly string AccessibilityReadingResumedAction = "ReadingResumed";
498 [EditorBrowsable(EditorBrowsableState.Never)]
499 private static readonly string[] AccessibilityActions = {
500 AccessibilityActivateAction,
501 AccessibilityReadingSkippedAction,
502 AccessibilityReadingCancelledAction,
503 AccessibilityReadingStoppedAction,
504 AccessibilityReadingPausedAction,
505 AccessibilityReadingResumedAction,
508 [EditorBrowsable(EditorBrowsableState.Never)]
509 protected virtual string AccessibilityGetName()
514 [EditorBrowsable(EditorBrowsableState.Never)]
515 protected virtual string AccessibilityGetDescription()
520 [EditorBrowsable(EditorBrowsableState.Never)]
521 protected virtual bool AccessibilityDoAction(string name)
526 [EditorBrowsable(EditorBrowsableState.Never)]
527 protected virtual AccessibilityStates AccessibilityCalculateStates()
529 var states = new AccessibilityStates();
530 states.Set(AccessibilityState.Highlightable, this.AccessibilityHighlightable);
531 states.Set(AccessibilityState.Focusable, this.Focusable);
532 states.Set(AccessibilityState.Focused, this.State == States.Focused);
533 states.Set(AccessibilityState.Highlighted, this.IsHighlighted);
534 states.Set(AccessibilityState.Enabled, this.State != States.Disabled);
535 states.Set(AccessibilityState.Sensitive, this.Sensitive);
536 states.Set(AccessibilityState.Animated, this.AccessibilityAnimated);
537 states.Set(AccessibilityState.Visible, true);
538 states.Set(AccessibilityState.Showing, this.Visibility);
539 states.Set(AccessibilityState.Defunct, !this.IsOnWindow);
543 [EditorBrowsable(EditorBrowsableState.Never)]
544 protected virtual int AccessibilityGetActionCount()
546 return AccessibilityActions.Length;
549 [EditorBrowsable(EditorBrowsableState.Never)]
550 protected virtual string AccessibilityGetActionName(int index)
552 if (index >= 0 && index < AccessibilityActions.Length)
553 return AccessibilityActions[index];
558 [EditorBrowsable(EditorBrowsableState.Never)]
559 protected virtual bool AccessibilityShouldReportZeroChildren()
564 [EditorBrowsable(EditorBrowsableState.Never)]
565 protected virtual double AccessibilityGetMinimum()
570 [EditorBrowsable(EditorBrowsableState.Never)]
571 protected virtual double AccessibilityGetCurrent()
576 [EditorBrowsable(EditorBrowsableState.Never)]
577 protected virtual double AccessibilityGetMaximum()
582 [EditorBrowsable(EditorBrowsableState.Never)]
583 protected virtual bool AccessibilitySetCurrent(double value)
588 [EditorBrowsable(EditorBrowsableState.Never)]
589 protected virtual double AccessibilityGetMinimumIncrement()
594 [EditorBrowsable(EditorBrowsableState.Never)]
595 protected virtual bool AccessibilityIsScrollable()
600 [EditorBrowsable(EditorBrowsableState.Never)]
601 protected virtual string AccessibilityGetText(int startOffset, int endOffset)
606 [EditorBrowsable(EditorBrowsableState.Never)]
607 protected virtual int AccessibilityGetCharacterCount()
612 [EditorBrowsable(EditorBrowsableState.Never)]
613 protected virtual int AccessibilityGetCaretOffset()
618 [EditorBrowsable(EditorBrowsableState.Never)]
619 protected virtual bool AccessibilitySetCaretOffset(int offset)
624 [EditorBrowsable(EditorBrowsableState.Never)]
625 protected virtual AccessibilityRange AccessibilityGetTextAtOffset(int offset, TextBoundary boundary)
627 return new AccessibilityRange();
630 [EditorBrowsable(EditorBrowsableState.Never)]
631 protected virtual AccessibilityRange AccessibilityGetSelection(int selectionNum)
633 return new AccessibilityRange();
636 [EditorBrowsable(EditorBrowsableState.Never)]
637 protected virtual bool AccessibilityRemoveSelection(int selectionNum)
642 [EditorBrowsable(EditorBrowsableState.Never)]
643 protected virtual bool AccessibilitySetSelection(int selectionNum, int startOffset, int endOffset)
648 [EditorBrowsable(EditorBrowsableState.Never)]
649 protected virtual bool AccessibilityCopyText(int startPosition, int endPosition)
654 [EditorBrowsable(EditorBrowsableState.Never)]
655 protected virtual bool AccessibilityCutText(int startPosition, int endPosition)
661 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
662 /// It is absolute by default.
663 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
665 [EditorBrowsable(EditorBrowsableState.Never)]
666 public VisualTransformPolicyType CornerRadiusPolicy
668 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
669 set => SetValue(CornerRadiusPolicyProperty, value);
673 /// The current state of the view.
675 /// <since_tizen> 3 </since_tizen>
680 return (States)GetValue(StateProperty);
684 SetValue(StateProperty, value);
685 NotifyPropertyChanged();
690 /// The current sub state of the view.
692 /// <since_tizen> 3 </since_tizen>
693 public States SubState
697 return (States)GetValue(SubStateProperty);
701 SetValue(SubStateProperty, value);
702 NotifyPropertyChanged();
707 /// Displays a tooltip
709 /// <since_tizen> 3 </since_tizen>
710 public Tizen.NUI.PropertyMap Tooltip
714 return (PropertyMap)GetValue(TooltipProperty);
718 SetValue(TooltipProperty, value);
719 NotifyPropertyChanged();
724 /// Displays a tooltip as a text.
726 /// <since_tizen> 3 </since_tizen>
727 public string TooltipText
731 using (var propertyValue = GetProperty(Property.TOOLTIP))
733 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
735 return retrivedValue;
737 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
738 return "error to get TooltipText";
743 var temp = new Tizen.NUI.PropertyValue(value);
744 SetProperty(View.Property.TOOLTIP, temp);
746 NotifyPropertyChanged();
751 /// The Child property of FlexContainer.<br />
752 /// The proportion of the free space in the container, the flex item will receive.<br />
753 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
755 /// <since_tizen> 3 </since_tizen>
756 [Obsolete("Deprecated in API8, will be removed in API10.")]
761 return (float)GetValue(FlexProperty);
765 SetValue(FlexProperty, value);
766 NotifyPropertyChanged();
771 /// The Child property of FlexContainer.<br />
772 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
774 /// <since_tizen> 3 </since_tizen>
775 [Obsolete("Deprecated in API8, will be removed in API10.")]
780 return (int)GetValue(AlignSelfProperty);
784 SetValue(AlignSelfProperty, value);
785 NotifyPropertyChanged();
790 /// The Child property of FlexContainer.<br />
791 /// The space around the flex item.<br />
794 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
796 /// <since_tizen> 3 </since_tizen>
797 [Obsolete("Deprecated in API8, will be removed in API10.")]
798 public Vector4 FlexMargin
802 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
803 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
807 SetValue(FlexMarginProperty, value);
808 NotifyPropertyChanged();
813 /// The top-left cell this child occupies, if not set, the first available cell is used.
816 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
818 /// <since_tizen> 3 </since_tizen>
819 public Vector2 CellIndex
823 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
824 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
828 SetValue(CellIndexProperty, value);
829 NotifyPropertyChanged();
834 /// The number of rows this child occupies, if not set, the default value is 1.
836 /// <since_tizen> 3 </since_tizen>
841 return (float)GetValue(RowSpanProperty);
845 SetValue(RowSpanProperty, value);
846 NotifyPropertyChanged();
851 /// The number of columns this child occupies, if not set, the default value is 1.
853 /// <since_tizen> 3 </since_tizen>
854 public float ColumnSpan
858 return (float)GetValue(ColumnSpanProperty);
862 SetValue(ColumnSpanProperty, value);
863 NotifyPropertyChanged();
868 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
870 /// <since_tizen> 3 </since_tizen>
871 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
875 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
879 SetValue(CellHorizontalAlignmentProperty, value);
880 NotifyPropertyChanged();
885 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
887 /// <since_tizen> 3 </since_tizen>
888 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
892 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
896 SetValue(CellVerticalAlignmentProperty, value);
897 NotifyPropertyChanged();
902 /// The left focusable view.<br />
903 /// This will return null if not set.<br />
904 /// This will also return null if the specified left focusable view is not on a window.<br />
906 /// <since_tizen> 3 </since_tizen>
907 public View LeftFocusableView
909 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
912 return (View)GetValue(LeftFocusableViewProperty);
916 SetValue(LeftFocusableViewProperty, value);
917 NotifyPropertyChanged();
922 /// The right focusable view.<br />
923 /// This will return null if not set.<br />
924 /// This will also return null if the specified right focusable view is not on a window.<br />
926 /// <since_tizen> 3 </since_tizen>
927 public View RightFocusableView
929 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
932 return (View)GetValue(RightFocusableViewProperty);
936 SetValue(RightFocusableViewProperty, value);
937 NotifyPropertyChanged();
942 /// The up focusable view.<br />
943 /// This will return null if not set.<br />
944 /// This will also return null if the specified up focusable view is not on a window.<br />
946 /// <since_tizen> 3 </since_tizen>
947 public View UpFocusableView
949 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
952 return (View)GetValue(UpFocusableViewProperty);
956 SetValue(UpFocusableViewProperty, value);
957 NotifyPropertyChanged();
962 /// The down focusable view.<br />
963 /// This will return null if not set.<br />
964 /// This will also return null if the specified down focusable view is not on a window.<br />
966 /// <since_tizen> 3 </since_tizen>
967 public View DownFocusableView
969 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
972 return (View)GetValue(DownFocusableViewProperty);
976 SetValue(DownFocusableViewProperty, value);
977 NotifyPropertyChanged();
982 /// Whether the view should be focusable by keyboard navigation.
984 /// <since_tizen> 3 </since_tizen>
985 public bool Focusable
989 SetValue(FocusableProperty, value);
990 NotifyPropertyChanged();
994 return (bool)GetValue(FocusableProperty);
999 /// Retrieves the position of the view.<br />
1000 /// The coordinates are relative to the view's parent.<br />
1002 /// <since_tizen> 3 </since_tizen>
1003 public Position CurrentPosition
1007 return GetCurrentPosition();
1012 /// Sets the size of a view for the width and the height.<br />
1013 /// Geometry can be scaled to fit within this area.<br />
1014 /// This does not interfere with the view's scale factor.<br />
1015 /// The views default depth is the minimum of width and height.<br />
1018 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
1019 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
1021 /// <since_tizen> 3 </since_tizen>
1022 public Size2D Size2D
1026 Size2D temp = (Size2D)GetValue(Size2DProperty);
1027 int width = temp.Width;
1028 int height = temp.Height;
1030 if (this.Layout == null)
1032 if (width < 0) { width = 0; }
1033 if (height < 0) { height = 0; }
1036 return new Size2D(OnSize2DChanged, width, height);
1040 SetValue(Size2DProperty, value);
1042 NotifyPropertyChanged();
1047 /// Retrieves the size of the view.<br />
1048 /// The coordinates are relative to the view's parent.<br />
1050 /// <since_tizen> 3 </since_tizen>
1051 public Size2D CurrentSize
1055 return GetCurrentSize();
1060 /// Retrieves and sets the view's opacity.<br />
1062 /// <since_tizen> 3 </since_tizen>
1063 public float Opacity
1067 return (float)GetValue(OpacityProperty);
1071 SetValue(OpacityProperty, value);
1072 NotifyPropertyChanged();
1077 /// Sets the position of the view for X and Y.<br />
1078 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1079 /// If the position inheritance is disabled, sets the world position.<br />
1082 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1083 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1085 /// <since_tizen> 3 </since_tizen>
1086 public Position2D Position2D
1090 Position2D temp = (Position2D)GetValue(Position2DProperty);
1091 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1095 SetValue(Position2DProperty, value);
1096 NotifyPropertyChanged();
1101 /// Retrieves the screen position of the view.<br />
1103 /// <since_tizen> 3 </since_tizen>
1104 public Vector2 ScreenPosition
1108 Vector2 temp = new Vector2(0.0f, 0.0f);
1109 var pValue = GetProperty(View.Property.ScreenPosition);
1117 /// Determines whether the pivot point should be used to determine the position of the view.
1118 /// This is false by default.
1120 /// <remarks>If false, then the top-left of the view is used for the position.
1121 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1123 /// <since_tizen> 3 </since_tizen>
1124 public bool PositionUsesPivotPoint
1128 return (bool)GetValue(PositionUsesPivotPointProperty);
1132 SetValue(PositionUsesPivotPointProperty, value);
1133 NotifyPropertyChanged();
1138 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1140 /// <since_tizen> 3 </since_tizen>
1141 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1143 "View view = new View(); " +
1144 "view.PivotPoint = PivotPoint.Center; " +
1145 "view.PositionUsesPivotPoint = true;" +
1146 " Deprecated in API5: Will be removed in API8")]
1147 [EditorBrowsable(EditorBrowsableState.Never)]
1148 public bool PositionUsesAnchorPoint
1153 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1154 pValue.Get(out temp);
1160 var temp = new Tizen.NUI.PropertyValue(value);
1161 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1163 NotifyPropertyChanged();
1168 /// Queries whether the view is connected to the stage.<br />
1169 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1171 /// <since_tizen> 3 </since_tizen>
1172 public bool IsOnWindow
1181 /// Gets the depth in the hierarchy for the view.
1183 /// <since_tizen> 3 </since_tizen>
1184 public int HierarchyDepth
1188 return GetHierarchyDepth();
1193 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1196 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1197 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1198 /// The values set by this property will likely change.
1200 /// <since_tizen> 3 </since_tizen>
1201 public int SiblingOrder
1205 return (int)GetValue(SiblingOrderProperty);
1209 SetValue(SiblingOrderProperty, value);
1211 LayoutGroup layout = Layout as LayoutGroup;
1212 layout?.ChangeLayoutSiblingOrder(value);
1214 NotifyPropertyChanged();
1219 /// Returns the natural size of the view.
1222 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1224 /// <since_tizen> 5 </since_tizen>
1225 public Vector3 NaturalSize
1229 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1230 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1236 /// Returns the natural size (Size2D) of the view.
1239 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1241 /// <since_tizen> 4 </since_tizen>
1242 public Size2D NaturalSize2D
1246 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1247 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1249 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1256 /// Gets or sets the origin of a view within its parent's area.<br />
1257 /// 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 />
1258 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1259 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1261 /// <pre>The view has been initialized.</pre>
1262 /// <since_tizen> 3 </since_tizen>
1263 public Position ParentOrigin
1267 Position tmp = (Position)GetValue(ParentOriginProperty);
1268 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1272 SetValue(ParentOriginProperty, value);
1273 NotifyPropertyChanged();
1278 /// Gets or sets the anchor-point of a view.<br />
1279 /// 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 />
1280 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1281 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1282 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1283 /// <pre>The view has been initialized.</pre>
1286 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1288 /// <since_tizen> 3 </since_tizen>
1289 public Position PivotPoint
1293 Position tmp = (Position)GetValue(PivotPointProperty);
1294 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1298 SetValue(PivotPointProperty, value);
1299 NotifyPropertyChanged();
1304 /// Gets or sets the size width of the view.
1308 /// Animatable - This property can be animated using <c>Animation</c> class.
1311 /// <since_tizen> 3 </since_tizen>
1312 public float SizeWidth
1316 return (float)GetValue(SizeWidthProperty);
1320 SetValue(SizeWidthProperty, value);
1321 NotifyPropertyChanged();
1326 /// Gets or sets the size height of the view.
1330 /// Animatable - This property can be animated using <c>Animation</c> class.
1333 /// <since_tizen> 3 </since_tizen>
1334 public float SizeHeight
1338 return (float)GetValue(SizeHeightProperty);
1342 SetValue(SizeHeightProperty, value);
1343 NotifyPropertyChanged();
1348 /// Gets or sets the position of the view.<br />
1349 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1350 /// If the position inheritance is disabled, sets the world position.<br />
1354 /// Animatable - This property can be animated using <c>Animation</c> class.
1356 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1358 /// <since_tizen> 3 </since_tizen>
1359 public Position Position
1363 Position tmp = (Position)GetValue(PositionProperty);
1364 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1368 SetValue(PositionProperty, value);
1369 NotifyPropertyChanged();
1374 /// Gets or sets the position X of the view.
1378 /// Animatable - This property can be animated using <c>Animation</c> class.
1381 /// <since_tizen> 3 </since_tizen>
1382 public float PositionX
1386 return (float)GetValue(PositionXProperty);
1390 SetValue(PositionXProperty, value);
1391 NotifyPropertyChanged();
1396 /// Gets or sets the position Y of the view.
1400 /// Animatable - This property can be animated using <c>Animation</c> class.
1403 /// <since_tizen> 3 </since_tizen>
1404 public float PositionY
1408 return (float)GetValue(PositionYProperty);
1412 SetValue(PositionYProperty, value);
1413 NotifyPropertyChanged();
1418 /// Gets or sets the position Z of the view.
1422 /// Animatable - This property can be animated using <c>Animation</c> class.
1425 /// <since_tizen> 3 </since_tizen>
1426 public float PositionZ
1430 return (float)GetValue(PositionZProperty);
1434 SetValue(PositionZProperty, value);
1435 NotifyPropertyChanged();
1440 /// Gets or sets the world position of the view.
1442 /// <since_tizen> 3 </since_tizen>
1443 public Vector3 WorldPosition
1447 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1448 var pValue = GetProperty(View.Property.WorldPosition);
1456 /// Gets or sets the orientation of the view.<br />
1457 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1461 /// This is an asynchronous method.
1464 /// Animatable - This property can be animated using <c>Animation</c> class.
1467 /// <since_tizen> 3 </since_tizen>
1468 public Rotation Orientation
1472 return (Rotation)GetValue(OrientationProperty);
1476 SetValue(OrientationProperty, value);
1477 NotifyPropertyChanged();
1482 /// Gets or sets the world orientation of the view.<br />
1484 /// <since_tizen> 3 </since_tizen>
1485 public Rotation WorldOrientation
1489 Rotation temp = new Rotation();
1490 var pValue = GetProperty(View.Property.WorldOrientation);
1498 /// Gets or sets the scale factor applied to the view.<br />
1502 /// Animatable - This property can be animated using <c>Animation</c> class.
1504 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1506 /// <since_tizen> 3 </since_tizen>
1507 public Vector3 Scale
1511 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1512 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1516 SetValue(ScaleProperty, value);
1517 NotifyPropertyChanged();
1522 /// Gets or sets the scale X factor applied to the view.
1526 /// Animatable - This property can be animated using <c>Animation</c> class.
1529 /// <since_tizen> 3 </since_tizen>
1534 return (float)GetValue(ScaleXProperty);
1538 SetValue(ScaleXProperty, value);
1539 NotifyPropertyChanged();
1544 /// Gets or sets the scale Y factor applied to the view.
1548 /// Animatable - This property can be animated using <c>Animation</c> class.
1551 /// <since_tizen> 3 </since_tizen>
1556 return (float)GetValue(ScaleYProperty);
1560 SetValue(ScaleYProperty, value);
1561 NotifyPropertyChanged();
1566 /// Gets or sets the scale Z factor applied to the view.
1570 /// Animatable - This property can be animated using <c>Animation</c> class.
1573 /// <since_tizen> 3 </since_tizen>
1578 return (float)GetValue(ScaleZProperty);
1582 SetValue(ScaleZProperty, value);
1583 NotifyPropertyChanged();
1588 /// Gets the world scale of the view.
1590 /// <since_tizen> 3 </since_tizen>
1591 public Vector3 WorldScale
1595 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1596 var pValue = GetProperty(View.Property.WorldScale);
1604 /// Retrieves the visibility flag of the view.
1608 /// If the view is not visible, then the view and its children will not be rendered.
1609 /// 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.
1612 /// Animatable - This property can be animated using <c>Animation</c> class.
1615 /// <since_tizen> 3 </since_tizen>
1616 public bool Visibility
1621 var pValue = GetProperty(View.Property.VISIBLE);
1622 pValue.Get(out temp);
1629 /// Gets the view's world color.
1631 /// <since_tizen> 3 </since_tizen>
1632 public Vector4 WorldColor
1636 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1637 var pValue = GetProperty(View.Property.WorldColor);
1645 /// Gets or sets the view's name.
1647 /// <since_tizen> 3 </since_tizen>
1652 return (string)GetValue(NameProperty);
1656 SetValue(NameProperty, value);
1657 NotifyPropertyChanged();
1662 /// Get the number of children held by the view.
1664 /// <since_tizen> 3 </since_tizen>
1665 public new uint ChildCount
1669 return Convert.ToUInt32(Children.Count);
1674 /// Gets the view's ID.
1677 /// <since_tizen> 3 </since_tizen>
1687 /// Gets or sets the status of whether the view should emit touch or hover signals.
1689 /// <since_tizen> 3 </since_tizen>
1690 public bool Sensitive
1694 return (bool)GetValue(SensitiveProperty);
1698 SetValue(SensitiveProperty, value);
1699 NotifyPropertyChanged();
1704 /// 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.
1706 /// <since_tizen> 3 </since_tizen>
1707 public bool LeaveRequired
1711 return (bool)GetValue(LeaveRequiredProperty);
1715 SetValue(LeaveRequiredProperty, value);
1716 NotifyPropertyChanged();
1721 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1723 /// <since_tizen> 3 </since_tizen>
1724 public bool InheritOrientation
1728 return (bool)GetValue(InheritOrientationProperty);
1732 SetValue(InheritOrientationProperty, value);
1733 NotifyPropertyChanged();
1738 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1740 /// <since_tizen> 3 </since_tizen>
1741 public bool InheritScale
1745 return (bool)GetValue(InheritScaleProperty);
1749 SetValue(InheritScaleProperty, value);
1750 NotifyPropertyChanged();
1755 /// Gets or sets the status of how the view and its children should be drawn.<br />
1756 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1757 /// 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 />
1758 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1759 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1760 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1762 /// <since_tizen> 3 </since_tizen>
1763 public DrawModeType DrawMode
1767 return (DrawModeType)GetValue(DrawModeProperty);
1771 SetValue(DrawModeProperty, value);
1772 NotifyPropertyChanged();
1777 /// Gets or sets the relative to parent size factor of the view.<br />
1778 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1779 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1782 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1784 /// <since_tizen> 3 </since_tizen>
1785 public Vector3 SizeModeFactor
1789 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1790 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1794 SetValue(SizeModeFactorProperty, value);
1795 NotifyPropertyChanged();
1800 /// Gets or sets the width resize policy to be used.
1802 /// <since_tizen> 3 </since_tizen>
1803 public ResizePolicyType WidthResizePolicy
1807 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1811 SetValue(WidthResizePolicyProperty, value);
1812 NotifyPropertyChanged();
1817 /// Gets or sets the height resize policy to be used.
1819 /// <since_tizen> 3 </since_tizen>
1820 public ResizePolicyType HeightResizePolicy
1824 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1828 SetValue(HeightResizePolicyProperty, value);
1829 NotifyPropertyChanged();
1834 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1835 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1837 /// <since_tizen> 3 </since_tizen>
1838 public SizeScalePolicyType SizeScalePolicy
1842 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1846 SetValue(SizeScalePolicyProperty, value);
1847 NotifyPropertyChanged();
1852 /// Gets or sets the status of whether the width size is dependent on the height size.
1854 /// <since_tizen> 3 </since_tizen>
1855 public bool WidthForHeight
1859 return (bool)GetValue(WidthForHeightProperty);
1863 SetValue(WidthForHeightProperty, value);
1864 NotifyPropertyChanged();
1869 /// Gets or sets the status of whether the height size is dependent on the width size.
1871 /// <since_tizen> 3 </since_tizen>
1872 public bool HeightForWidth
1876 return (bool)GetValue(HeightForWidthProperty);
1880 SetValue(HeightForWidthProperty, value);
1881 NotifyPropertyChanged();
1886 /// Gets or sets the padding for use in layout.
1889 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1891 /// <since_tizen> 5 </since_tizen>
1892 public Extents Padding
1896 // If View has a Layout then padding in stored in the base Layout class
1899 return Layout.Padding;
1903 Extents temp = (Extents)GetValue(PaddingProperty);
1904 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1906 // Two return points to prevent creating a zeroed Extent native object before assignment
1910 Extents padding = value;
1913 // Layout set so store Padding in LayoutItem instead of in View.
1914 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1915 // the position and sizes measure in the Layouting.
1916 Layout.Padding = value;
1917 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1918 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1919 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1921 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1925 SetValue(PaddingProperty, padding);
1926 NotifyPropertyChanged();
1931 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1933 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1935 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1937 /// <since_tizen> 3 </since_tizen>
1938 public Size2D MinimumSize
1942 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1943 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1949 throw new ArgumentNullException(nameof(value));
1953 // Note: it only works if minimum size is >= than natural size.
1954 // To force the size it should be done through the width&height spec or Size2D.
1955 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1956 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1957 layout.RequestLayout();
1959 SetValue(MinimumSizeProperty, value);
1960 NotifyPropertyChanged();
1965 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1968 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1970 /// <since_tizen> 3 </since_tizen>
1971 public Size2D MaximumSize
1975 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1976 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1980 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1981 // MATCH_PARENT spec + parent container size can be used to limit
1984 layout.RequestLayout();
1986 SetValue(MaximumSizeProperty, value);
1987 NotifyPropertyChanged();
1992 /// Gets or sets whether a child view inherits it's parent's position.<br />
1993 /// Default is to inherit.<br />
1994 /// 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 />
1996 /// <since_tizen> 3 </since_tizen>
1997 public bool InheritPosition
2001 return (bool)GetValue(InheritPositionProperty);
2005 SetValue(InheritPositionProperty, value);
2006 NotifyPropertyChanged();
2011 /// Gets or sets the clipping behavior (mode) of it's children.
2013 /// <since_tizen> 3 </since_tizen>
2014 public ClippingModeType ClippingMode
2018 return (ClippingModeType)GetValue(ClippingModeProperty);
2022 SetValue(ClippingModeProperty, value);
2023 NotifyPropertyChanged();
2028 /// Gets the number of renderers held by the view.
2030 /// <since_tizen> 3 </since_tizen>
2031 public uint RendererCount
2035 return GetRendererCount();
2040 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2043 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2045 /// <since_tizen> 3 </since_tizen>
2046 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2048 "View view = new View(); " +
2049 "view.PivotPoint = PivotPoint.Center; " +
2050 "view.PositionUsesPivotPoint = true;")]
2051 [EditorBrowsable(EditorBrowsableState.Never)]
2052 public Position AnchorPoint
2056 Position temp = new Position(0.0f, 0.0f, 0.0f);
2057 var pValue = GetProperty(View.Property.AnchorPoint);
2060 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2066 var temp = new Tizen.NUI.PropertyValue(value);
2067 SetProperty(View.Property.AnchorPoint, temp);
2069 NotifyPropertyChanged();
2074 /// Sets the size of a view for the width, the height and the depth.<br />
2075 /// Geometry can be scaled to fit within this area.<br />
2076 /// This does not interfere with the view's scale factor.<br />
2077 /// The views default depth is the minimum of width and height.<br />
2081 /// Animatable - This property can be animated using <c>Animation</c> class.
2083 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2085 /// <since_tizen> 5 </since_tizen>
2090 Size tmp = (Size)GetValue(SizeProperty);
2091 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2095 SetValue(SizeProperty, value);
2096 NotifyPropertyChanged();
2101 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2103 /// <since_tizen> 3 </since_tizen>
2104 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2106 "Container parent = view.GetParent(); " +
2107 "View view = parent as View;")]
2108 [EditorBrowsable(EditorBrowsableState.Never)]
2109 public new View Parent
2114 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2115 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2116 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2118 if (basehandle is Layer layer)
2120 ret = new View(Layer.getCPtr(layer).Handle, false);
2121 NUILog.Error("This Parent property is deprecated, should do not be used");
2125 ret = basehandle as View;
2128 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2129 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2131 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2137 /// Gets/Sets whether inherit parent's the layout Direction.
2139 /// <since_tizen> 4 </since_tizen>
2140 public bool InheritLayoutDirection
2144 return (bool)GetValue(InheritLayoutDirectionProperty);
2148 SetValue(InheritLayoutDirectionProperty, value);
2149 NotifyPropertyChanged();
2154 /// Gets/Sets the layout Direction.
2156 /// <since_tizen> 4 </since_tizen>
2157 public ViewLayoutDirectionType LayoutDirection
2161 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2165 SetValue(LayoutDirectionProperty, value);
2166 NotifyPropertyChanged();
2167 layout?.RequestLayout();
2172 /// Gets or sets the Margin for use in layout.
2175 /// Margin property is supported by Layout algorithms and containers.
2176 /// Please Set Layout if you want to use Margin property.
2177 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2179 /// <since_tizen> 4 </since_tizen>
2180 public Extents Margin
2184 // If View has a Layout then margin is stored in Layout.
2187 return Layout.Margin;
2191 // If Layout not set then return margin stored in View.
2192 Extents temp = (Extents)GetValue(MarginProperty);
2193 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2195 // Two return points to prevent creating a zeroed Extent native object before assignment
2201 // Layout set so store Margin in LayoutItem instead of View.
2202 // If View stores the Margin too then the Legacy Size Negotiation will
2203 // overwrite the position and size values measured in the Layouting.
2204 Layout.Margin = value;
2205 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2206 layout?.RequestLayout();
2210 SetValue(MarginProperty, value);
2212 NotifyPropertyChanged();
2213 layout?.RequestLayout();
2218 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2220 /// <since_tizen> 6 </since_tizen>
2221 public int WidthSpecification
2229 if (value == widthPolicy)
2232 widthPolicy = value;
2233 if (widthPolicy >= 0)
2235 if (heightPolicy >= 0) // Policy an exact value
2237 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2238 Size2D = new Size2D(widthPolicy, heightPolicy);
2241 layout?.RequestLayout();
2246 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2248 /// <since_tizen> 6 </since_tizen>
2249 public int HeightSpecification
2253 return heightPolicy;
2257 if (value == heightPolicy)
2260 heightPolicy = value;
2261 if (heightPolicy >= 0)
2263 if (widthPolicy >= 0) // Policy an exact value
2265 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2266 Size2D = new Size2D(widthPolicy, heightPolicy);
2269 layout?.RequestLayout();
2274 /// Gets the List of transitions for this View.
2276 /// <since_tizen> 6 </since_tizen>
2277 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2281 if (layoutTransitions == null)
2283 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2285 return layoutTransitions;
2290 /// Set a layout transitions for this View.
2292 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2294 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2296 /// <since_tizen> 6 </since_tizen>
2297 public LayoutTransition LayoutTransition
2301 return layoutTransition;
2307 throw new global::System.ArgumentNullException(nameof(value));
2309 if (layoutTransitions == null)
2311 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2314 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2316 AttachTransitionsToChildren(value);
2318 layoutTransition = value;
2323 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2326 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2328 /// <since_tizen> 4 </since_tizen>
2329 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2330 [EditorBrowsable(EditorBrowsableState.Never)]
2331 public Extents PaddingEX
2335 Extents temp = new Extents(0, 0, 0, 0);
2336 var pValue = GetProperty(View.Property.PADDING);
2339 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2345 var temp = new Tizen.NUI.PropertyValue(value);
2346 SetProperty(View.Property.PADDING, temp);
2348 NotifyPropertyChanged();
2349 layout?.RequestLayout();
2354 /// The Color of View. This is an RGBA value.
2358 /// Animatable - This property can be animated using <c>Animation</c> class.
2360 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2362 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2363 [EditorBrowsable(EditorBrowsableState.Never)]
2368 Color temp = (Color)GetValue(ColorProperty);
2369 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2373 SetValue(ColorProperty, value);
2374 NotifyPropertyChanged();
2379 /// Set the layout on this View. Replaces any existing Layout.
2382 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2384 /// <since_tizen> 6 </since_tizen>
2385 public LayoutItem Layout
2393 // Do nothing if layout provided is already set on this View.
2394 if (value == layout)
2399 LayoutingDisabled = false;
2402 // If new layout being set already has a owner then that owner receives a replacement default layout.
2403 // First check if the layout to be set already has a owner.
2404 if (value?.Owner != null)
2406 // Previous owner of the layout gets a default layout as a replacement.
2407 value.Owner.Layout = new AbsoluteLayout();
2409 // Copy Margin and Padding to replacement LayoutGroup.
2410 if (value.Owner.Layout != null)
2412 value.Owner.Layout.Margin = value.Margin;
2413 value.Owner.Layout.Padding = value.Padding;
2417 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2418 // View if no replacement. Previously margin and padding values would have been moved from
2419 // the View to the layout.
2420 if (layout != null) // Existing layout
2424 // Existing layout being replaced so copy over margin and padding values.
2425 value.Margin = layout.Margin;
2426 value.Padding = layout.Padding;
2430 // Layout not being replaced so restore margin and padding to View.
2431 SetValue(MarginProperty, layout.Margin);
2432 SetValue(PaddingProperty, layout.Padding);
2433 NotifyPropertyChanged();
2438 // First Layout to be added to the View hence copy
2440 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2443 Extents margin = Margin;
2444 Extents padding = Padding;
2445 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2447 // If View already has a margin set then store it in Layout instead.
2448 value.Margin = margin;
2449 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2450 NotifyPropertyChanged();
2453 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2455 // If View already has a padding set then store it in Layout instead.
2456 value.Padding = padding;
2458 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2459 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2460 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2462 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2463 NotifyPropertyChanged();
2469 // Remove existing layout from it's parent layout group.
2472 value.SetPositionByLayout = !excludeLayouting;
2474 // Set layout to this view
2480 /// The weight of the View, used to share available space in a layout with siblings.
2482 /// <since_tizen> 6 </since_tizen>
2492 layout?.RequestLayout();
2497 /// Whether to load the BackgroundImage synchronously.
2498 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2499 /// Note: For Normal Quad images only.
2501 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2502 [EditorBrowsable(EditorBrowsableState.Never)]
2503 public bool BackgroundImageSynchronosLoading
2507 return backgroundImageSynchronosLoading;
2511 backgroundImageSynchronosLoading = value;
2513 string bgUrl = null;
2514 var pValue = Background.Find(ImageVisualProperty.URL);
2515 pValue?.Get(out bgUrl);
2518 if (!string.IsNullOrEmpty(bgUrl))
2520 PropertyMap bgMap = this.Background;
2521 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2522 bgMap.Add("synchronousLoading", temp);
2529 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2530 [EditorBrowsable(EditorBrowsableState.Never)]
2531 public Vector2 UpdateSizeHint
2535 return (Vector2)GetValue(UpdateSizeHintProperty);
2539 SetValue(UpdateSizeHintProperty, value);
2540 NotifyPropertyChanged();
2545 /// Enable/Disable ControlState propagation for children.
2546 /// It is false by default.
2547 /// If the View needs to share ControlState with descendants, please set it true.
2548 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2550 [EditorBrowsable(EditorBrowsableState.Never)]
2551 public bool EnableControlStatePropagation
2553 get => controlStatePropagation;
2556 controlStatePropagation = value;
2558 foreach (View child in Children)
2560 child.EnableControlStatePropagation = value;
2566 /// By default, it is false in View, true in Control.
2567 /// Note that if the value is true, the View will be a touch receptor.
2569 [EditorBrowsable(EditorBrowsableState.Never)]
2570 public bool EnableControlState
2574 return (bool)GetValue(EnableControlStateProperty);
2578 SetValue(EnableControlStateProperty, value);
2583 /// Whether the actor grab all touches even if touch leaves its boundary.
2585 /// <returns>true, if it grab all touch after start</returns>
2586 [EditorBrowsable(EditorBrowsableState.Never)]
2587 public bool GrabTouchAfterLeave
2592 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2593 pValue.Get(out temp);
2599 var temp = new Tizen.NUI.PropertyValue(value);
2600 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2602 NotifyPropertyChanged();
2607 /// Determines which blend equation will be used to render renderers of this actor.
2609 /// <returns>blend equation enum currently assigned</returns>
2610 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2611 [EditorBrowsable(EditorBrowsableState.Never)]
2612 public BlendEquationType BlendEquation
2617 var pValue = GetProperty(View.Property.BlendEquation);
2618 pValue.Get(out temp);
2620 return (BlendEquationType)temp;
2624 var temp = new Tizen.NUI.PropertyValue((int)value);
2625 SetProperty(View.Property.BlendEquation, temp);
2627 NotifyPropertyChanged();
2632 /// If the value is true, the View will change its style as the theme changes.
2633 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2635 [EditorBrowsable(EditorBrowsableState.Never)]
2636 public bool ThemeChangeSensitive
2638 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2639 set => SetValue(ThemeChangeSensitiveProperty, value);
2643 /// Create Style, it is abstract function and must be override.
2645 [EditorBrowsable(EditorBrowsableState.Never)]
2646 protected virtual ViewStyle CreateViewStyle()
2648 return new ViewStyle();
2652 /// Called after the View's ControlStates changed.
2654 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2655 [EditorBrowsable(EditorBrowsableState.Never)]
2656 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2662 [EditorBrowsable(EditorBrowsableState.Never)]
2663 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2668 private bool IsViewPropertyDirty(BindableProperty styleProperty)
2670 if (dirtyPropertySet.Count == 0)
2675 return dirtyPropertySet.Contains(styleProperty.PropertyName);
2679 /// Apply style instance to the view.
2680 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2682 [EditorBrowsable(EditorBrowsableState.Never)]
2683 public virtual void ApplyStyle(ViewStyle viewStyle)
2685 if (viewStyle == null || this.viewStyle == viewStyle) return;
2687 this.viewStyle = viewStyle;
2689 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2695 if (dirtyPropertySet == null)
2697 dirtyPropertySet = new HashSet<string>();
2700 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2702 if (bindablePropertyOfView == null)
2707 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2708 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2710 foreach (var sourceProperty in dirtyStyleProperties)
2712 if (blockSetDirty && IsViewPropertyDirty(sourceProperty))
2714 // Skip applying theme style for a property set by user.
2718 var sourceValue = viewStyle.GetValue(sourceProperty);
2720 if (sourceValue == null)
2725 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2727 if (destinationProperty != null)
2729 SetValue(destinationProperty, sourceValue);
2735 /// Get whether the View is culled or not.
2736 /// True means that the View is out of the view frustum.
2739 /// Hidden-API (Inhouse-API).
2741 [EditorBrowsable(EditorBrowsableState.Never)]
2747 var pValue = GetProperty(View.Property.Culled);
2748 pValue.Get(out temp);
2755 /// Set or Get TransitionOptions for the page transition.
2758 /// Hidden-API (Inhouse-API).
2760 [EditorBrowsable(EditorBrowsableState.Never)]
2761 public TransitionOptions TransitionOptions
2765 transitionOptions = value;
2769 return transitionOptions;