2 * Copyright(c) 2022 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 private static HashSet<BindableProperty> positionPropertyGroup = new HashSet<BindableProperty>();
32 private static HashSet<BindableProperty> sizePropertyGroup = new HashSet<BindableProperty>();
33 private static HashSet<BindableProperty> scalePropertyGroup = new HashSet<BindableProperty>();
34 private static bool defaultGrabTouchAfterLeave = false;
35 private static bool defaultAllowOnlyOwnTouch = false;
37 internal BackgroundExtraData backgroundExtraData;
39 private bool layoutSet = false;
40 private LayoutItem layout; // Exclusive layout assigned to this View.
42 // List of transitions paired with the condition that uses the transition.
43 private Dictionary<TransitionCondition, TransitionList> layoutTransitions;
44 private int widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
45 private int heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
46 private float weight = 0.0f; // Weighting of child View in a Layout
47 private bool backgroundImageSynchronousLoading = false;
48 private bool excludeLayouting = false;
49 private LayoutTransition layoutTransition;
50 private TransitionOptions transitionOptions = null;
51 private ThemeData themeData;
52 private bool isThemeChanged = false;
54 // List of constraints
55 private Constraint widthConstraint = null;
56 private Constraint heightConstraint = null;
58 private Size2D internalMaximumSize = null;
59 private Size2D internalMinimumSize = null;
60 private Extents internalMargin = null;
61 private Extents internalPadding = null;
62 private Vector3 internalSizeModeFactor = null;
63 private Vector2 internalCellIndex = null;
64 private Color internalBackgroundColor = null;
65 private Color internalColor = null;
66 private Position internalPivotPoint = null;
67 private Position internalPosition = null;
68 private Position2D internalPosition2D = null;
69 private Vector3 internalScale = null;
70 private Size internalSize = null;
71 private Size2D internalSize2D = null;
72 private int layoutCount = 0;
73 private ControlState propagatableControlStates = ControlState.All;
75 // List of dispatch Event
76 private PanGestureDetector panGestureDetector = null;
77 private LongPressGestureDetector longGestureDetector = null;
78 private PinchGestureDetector pinchGestureDetector = null;
79 private TapGestureDetector tapGestureDetector = null;
80 private RotationGestureDetector rotationGestureDetector = null;
81 private int configGestureCount = 0;
82 private bool dispatchTouchEvents = true;
83 private bool dispatchParentTouchEvents = true;
84 private bool dispatchHoverEvents = true;
85 private bool dispatchParentHoverEvents = true;
86 private bool dispatchGestureEvents = true;
87 private bool dispatchParentGestureEvents = true;
88 private string internalName = string.Empty;
89 private Position internalCurrentParentOrigin = null;
90 private Position internalCurrentAnchorPoint = null;
91 private Vector3 internalTargetSize = null;
92 private Size2D internalCurrentSize = null;
93 private Position internalCurrentPosition = null;
94 private Vector3 internalCurrentWorldPosition = null;
95 private Vector3 internalCurrentScale = null;
96 private Vector3 internalCurrentWorldScale = null;
97 private Vector4 internalCurrentColor = null;
98 private Vector4 internalCurrentWorldColor = null;
99 private Vector2 internalCurrentScreenPosition = null;
103 RegisterPropertyGroup(PositionProperty, positionPropertyGroup);
104 RegisterPropertyGroup(Position2DProperty, positionPropertyGroup);
105 RegisterPropertyGroup(PositionXProperty, positionPropertyGroup);
106 RegisterPropertyGroup(PositionYProperty, positionPropertyGroup);
108 RegisterPropertyGroup(SizeProperty, sizePropertyGroup);
109 RegisterPropertyGroup(Size2DProperty, sizePropertyGroup);
110 RegisterPropertyGroup(SizeWidthProperty, sizePropertyGroup);
111 RegisterPropertyGroup(SizeHeightProperty, sizePropertyGroup);
113 RegisterPropertyGroup(ScaleProperty, scalePropertyGroup);
114 RegisterPropertyGroup(ScaleXProperty, scalePropertyGroup);
115 RegisterPropertyGroup(ScaleYProperty, scalePropertyGroup);
116 RegisterPropertyGroup(ScaleZProperty, scalePropertyGroup);
118 RegisterAccessibilityDelegate();
122 /// Accessibility mode for controlling View's Accessible implementation.
123 /// It is only relevant when deriving custom controls from View directly,
124 /// as classes derived from CustomView (or any of its subclasses) get the
125 /// Custom mode by default.
127 [EditorBrowsable(EditorBrowsableState.Never)]
128 public enum ViewAccessibilityMode
131 /// Default accessibility implementation. Overriding View.Accessibility...()
132 /// virtual methods will have no effect.
134 [EditorBrowsable(EditorBrowsableState.Never)]
137 /// Custom accessibility implementation. Overriding View.Accessibility...()
138 /// will be necessary to provide accessibility support for the View.
140 [EditorBrowsable(EditorBrowsableState.Never)]
144 private static IntPtr NewWithAccessibilityMode(ViewAccessibilityMode accessibilityMode)
146 switch (accessibilityMode)
148 case ViewAccessibilityMode.Custom:
150 return Interop.View.NewCustom();
152 case ViewAccessibilityMode.Default:
155 return Interop.View.New();
161 /// Creates a new instance of a view.
163 /// <since_tizen> 3 </since_tizen>
164 public View() : this(ViewAccessibilityMode.Default)
168 [EditorBrowsable(EditorBrowsableState.Never)]
169 public View(ViewAccessibilityMode accessibilityMode) : this(NewWithAccessibilityMode(accessibilityMode), true)
171 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
175 [EditorBrowsable(EditorBrowsableState.Never)]
176 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
181 /// Create a new instance of a View with setting the status of shown or hidden.
183 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
184 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
185 [EditorBrowsable(EditorBrowsableState.Never)]
186 public View(bool shown) : this(Interop.View.New(), true)
188 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
194 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
203 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
205 InitializeStyle(viewStyle);
208 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
212 PositionUsesPivotPoint = false;
213 GrabTouchAfterLeave = defaultGrabTouchAfterLeave;
214 AllowOnlyOwnTouch = defaultAllowOnlyOwnTouch;
223 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
225 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
234 /// The event that is triggered when the View's ControlState is changed.
236 [EditorBrowsable(EditorBrowsableState.Never)]
237 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
239 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
243 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
245 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
246 [EditorBrowsable(EditorBrowsableState.Never)]
247 public bool LayoutSet
256 /// Flag to allow Layouting to be disabled for Views.
257 /// Once a View has a Layout set then any children added to Views from then on will receive
258 /// automatic Layouts.
260 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
261 [EditorBrowsable(EditorBrowsableState.Never)]
262 public static bool LayoutingDisabled { get; set; } = true;
265 /// If set to true, the <see cref="GrabTouchAfterLeave"/> property value is set to true when all Views are created.
267 /// <param name="enable">Sets value of GrabTouchAfterLeave property</param>
268 [EditorBrowsable(EditorBrowsableState.Never)]
269 public static void SetDefaultGrabTouchAfterLeave(bool enable)
271 defaultGrabTouchAfterLeave = enable;
275 /// If set to true, the <see cref="AllowOnlyOwnTouch"/> property value is set to true when all Views are created.
277 /// <param name="enable">Sets value of AllowOnlyOwnTouch property</param>
278 [EditorBrowsable(EditorBrowsableState.Never)]
279 public static void SetDefaultAllowOnlyOwnTouch(bool enable)
281 defaultAllowOnlyOwnTouch = enable;
285 /// Deprecate. Do not use this.
286 /// The style instance applied to this view.
287 /// Note that do not modify the ViewStyle.
288 /// Modifying ViewStyle will affect other views with same ViewStyle.
290 [EditorBrowsable(EditorBrowsableState.Never)]
291 protected ViewStyle ViewStyle
295 if (themeData == null) themeData = new ThemeData();
297 if (themeData.viewStyle == null)
299 ApplyStyle(CreateViewStyle());
301 return themeData.viewStyle;
306 /// Get/Set the control state.
307 /// Note that the ControlState only available for the classes derived from Control.
308 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
309 /// please set <see cref="EnableControlState"/> to true.
311 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
312 [EditorBrowsable(EditorBrowsableState.Never)]
313 public ControlState ControlState
317 return themeData == null ? ControlState.Normal : themeData.controlStates;
321 if (ControlState == value)
326 var prevState = ControlState;
328 if (themeData == null) themeData = new ThemeData();
329 themeData.controlStates = value;
331 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
333 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
335 if (themeData.ControlStatePropagation)
337 foreach (View child in Children)
339 ControlState allowed = child.PropagatableControlStates;
340 if (allowed.Contains(ControlState.All))
342 child.ControlState = value;
346 ControlState newControlState = child.ControlState;
348 if (allowed.Contains(ControlState.Normal))
350 if (value.Contains(ControlState.Normal))
352 newControlState += ControlState.Normal;
356 newControlState -= ControlState.Normal;
360 if (allowed.Contains(ControlState.Disabled))
362 if (value.Contains(ControlState.Disabled))
364 newControlState += ControlState.Disabled;
368 newControlState -= ControlState.Disabled;
372 if (allowed.Contains(ControlState.Selected))
374 if (value.Contains(ControlState.Selected))
376 newControlState += ControlState.Selected;
380 newControlState -= ControlState.Selected;
384 if (allowed.Contains(ControlState.Pressed))
386 if (value.Contains(ControlState.Pressed))
388 newControlState += ControlState.Pressed;
392 newControlState -= ControlState.Pressed;
396 if (allowed.Contains(ControlState.Focused))
398 if (value.Contains(ControlState.Focused))
400 newControlState += ControlState.Focused;
404 newControlState -= ControlState.Focused;
408 if (allowed.Contains(ControlState.Other))
410 if (value.Contains(ControlState.Other))
412 newControlState += ControlState.Other;
416 newControlState -= ControlState.Other;
420 if (child.ControlState != newControlState)
421 child.ControlState = newControlState;
426 OnControlStateChanged(changeInfo);
428 ControlStateChangedEvent?.Invoke(this, changeInfo);
433 /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
435 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
436 [EditorBrowsable(EditorBrowsableState.Never)]
437 public bool ExcludeLayouting
441 return (bool)GetValue(ExcludeLayoutingProperty);
445 SetValue(ExcludeLayoutingProperty, value);
446 NotifyPropertyChanged();
450 private bool InternalExcludeLayouting
454 return excludeLayouting;
458 excludeLayouting = value;
459 if (Layout != null && Layout.SetPositionByLayout == value)
461 Layout.SetPositionByLayout = !value;
462 Layout.RequestLayout();
468 /// The StyleName, type string.
469 /// The value indicates DALi style name defined in json theme file.
471 /// <since_tizen> 3 </since_tizen>
472 public string StyleName
476 return (string)GetValue(StyleNameProperty);
480 SetValue(StyleNameProperty, value);
481 NotifyPropertyChanged();
486 /// The KeyInputFocus, type bool.
488 [EditorBrowsable(EditorBrowsableState.Never)]
489 public bool KeyInputFocus
493 return (bool)GetValue(KeyInputFocusProperty);
497 SetValue(KeyInputFocusProperty, value);
498 NotifyPropertyChanged();
503 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
507 /// The property cascade chaining set is not recommended.
510 /// Animatable - This property can be animated using <c>Animation</c> class.
512 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
517 /// This way is recommended for setting the property
519 /// var view = new View();
520 /// view.BackgroundColor = new Color(0.5f, 0.1f, 0, 1);
522 /// This way to set the property is prohibited
524 /// view.BackgroundColor.R = 0.5f; //This does not guarantee a proper operation
527 /// <since_tizen> 3 </since_tizen>
528 public Color BackgroundColor
532 return (Color)GetValue(BackgroundColorProperty);
536 SetValue(BackgroundColorProperty, value);
537 NotifyPropertyChanged();
542 /// The mutually exclusive with "backgroundColor" and "background" type Map.
544 /// <since_tizen> 3 </since_tizen>
545 public string BackgroundImage
549 return (string)GetValue(BackgroundImageProperty);
553 SetValue(BackgroundImageProperty, value);
554 NotifyPropertyChanged();
559 /// Get or set the border of background image.
561 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
562 [EditorBrowsable(EditorBrowsableState.Never)]
563 public Rectangle BackgroundImageBorder
567 return (Rectangle)GetValue(BackgroundImageBorderProperty);
571 SetValue(BackgroundImageBorderProperty, value);
572 NotifyPropertyChanged();
577 /// The background of view.
579 /// <since_tizen> 3 </since_tizen>
580 public Tizen.NUI.PropertyMap Background
584 return (PropertyMap)GetValue(BackgroundProperty);
588 SetValue(BackgroundProperty, value);
589 NotifyPropertyChanged();
594 /// Describes a shadow as an image for a View.
595 /// It is null by default.
598 /// Getter returns copied instance of current shadow.
601 /// The mutually exclusive with "BoxShadow".
605 /// Animatable - This property can be animated using <c>Animation</c> class.
606 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
608 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
610 /// Animatable sub-property : Offset.
613 [EditorBrowsable(EditorBrowsableState.Never)]
614 public ImageShadow ImageShadow
618 return (ImageShadow)GetValue(ImageShadowProperty);
622 SetValue(ImageShadowProperty, value);
623 NotifyPropertyChanged();
628 /// Describes a box shaped shadow drawing for a View.
629 /// It is null by default.
632 /// The mutually exclusive with "ImageShadow".
636 /// Animatable - This property can be animated using <c>Animation</c> class.
637 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
639 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
641 /// Animatable sub-property : Offset, Color, BlurRadius.
644 /// <since_tizen> 9 </since_tizen>
645 public Shadow BoxShadow
649 return (Shadow)GetValue(BoxShadowProperty);
653 SetValue(BoxShadowProperty, value);
654 NotifyPropertyChanged();
659 /// The radius for the rounded corners of the View.
660 /// This will rounds background and shadow edges.
661 /// 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).
662 /// Each radius will clamp internally to the half of smaller of the view's width or height.
663 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
667 /// Animatable - This property can be animated using <c>Animation</c> class.
669 /// animation.AnimateTo(view, "CornerRadius", new Vector4(10, 10, 10, 10));
673 /// <since_tizen> 9 </since_tizen>
674 public Vector4 CornerRadius
678 return (Vector4)GetValue(CornerRadiusProperty);
682 SetValue(CornerRadiusProperty, value);
683 NotifyPropertyChanged();
688 /// Whether the CornerRadius property value is relative (percentage [0.0f to 0.5f] of the view size) or absolute (in world units).
689 /// It is absolute by default.
690 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
692 /// <since_tizen> 9 </since_tizen>
693 public VisualTransformPolicyType CornerRadiusPolicy
695 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
696 set => SetValue(CornerRadiusPolicyProperty, value);
700 /// The width for the borderline of the View.
704 /// Animatable - This property can be animated using <c>Animation</c> class.
706 /// animation.AnimateTo(view, "BorderlineWidth", 100.0f);
709 /// Note that, an image background may not have borderline if it uses the Border property.
711 /// <since_tizen> 9 </since_tizen>
712 public float BorderlineWidth
716 return (float)GetValue(BorderlineWidthProperty);
720 SetValue(BorderlineWidthProperty, value);
721 NotifyPropertyChanged();
726 /// The color for the borderline of the View.
727 /// It is Color.Black by default.
731 /// Animatable - This property can be animated using <c>Animation</c> class.
733 /// animation.AnimateTo(view, "BorderlineColor", new Color(r, g, b, a));
737 /// <since_tizen> 9 </since_tizen>
738 public Color BorderlineColor
742 return (Color)GetValue(BorderlineColorProperty);
746 SetValue(BorderlineColorProperty, value);
747 NotifyPropertyChanged();
752 /// The color selector for the borderline of the View.
753 /// Like BackgroundColor, color selector typed BorderlineColor should be used in ViewStyle only.
754 /// So this API is internally used only.
756 internal Selector<Color> BorderlineColorSelector
760 return (Selector<Color>)GetValue(BorderlineColorSelectorProperty);
764 SetValue(BorderlineColorSelectorProperty, value);
765 NotifyPropertyChanged();
770 /// The Relative offset for the borderline of the View.
771 /// Recommended range : [-1.0f to 1.0f].
772 /// If -1.0f, draw borderline inside of the View.
773 /// If 1.0f, draw borderline outside of the View.
774 /// If 0.0f, draw borderline half inside and half outside.
775 /// It is 0.0f by default.
779 /// Animatable - This property can be animated using <c>Animation</c> class.
781 /// animation.AnimateTo(view, "BorderlineOffset", -1.0f);
785 /// <since_tizen> 9 </since_tizen>
786 public float BorderlineOffset
790 return (float)GetValue(BorderlineOffsetProperty);
794 SetValue(BorderlineOffsetProperty, value);
795 NotifyPropertyChanged();
800 /// The current state of the view.
802 /// <since_tizen> 3 </since_tizen>
807 return (States)GetValue(StateProperty);
811 SetValue(StateProperty, value);
812 NotifyPropertyChanged();
817 /// The current sub state of the view.
819 /// <since_tizen> 3 </since_tizen>
820 public States SubState
824 return (States)GetValue(SubStateProperty);
828 SetValue(SubStateProperty, value);
829 NotifyPropertyChanged();
834 /// Displays a tooltip
836 /// <since_tizen> 3 </since_tizen>
837 public Tizen.NUI.PropertyMap Tooltip
841 return (PropertyMap)GetValue(TooltipProperty);
845 SetValue(TooltipProperty, value);
846 NotifyPropertyChanged();
851 /// Displays a tooltip as a text.
853 /// <since_tizen> 3 </since_tizen>
854 public string TooltipText
858 return GetValue(TooltipTextProperty) as string;
862 SetValue(TooltipTextProperty, value);
866 private string InternalTooltipText
870 using (var propertyValue = GetProperty(Property.TOOLTIP))
872 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
874 return retrivedValue;
876 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
877 return "error to get TooltipText";
882 var temp = new Tizen.NUI.PropertyValue(value);
883 SetProperty(View.Property.TOOLTIP, temp);
885 NotifyPropertyChanged();
890 /// The Child property of FlexContainer.<br />
891 /// The proportion of the free space in the container, the flex item will receive.<br />
892 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
894 /// <since_tizen> 3 </since_tizen>
895 [Obsolete("Deprecated in API8, will be removed in API10.")]
900 return (float)GetValue(FlexProperty);
904 SetValue(FlexProperty, value);
905 NotifyPropertyChanged();
910 /// The Child property of FlexContainer.<br />
911 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
913 /// <since_tizen> 3 </since_tizen>
914 [Obsolete("Deprecated in API8, will be removed in API10.")]
919 return (int)GetValue(AlignSelfProperty);
923 SetValue(AlignSelfProperty, value);
924 NotifyPropertyChanged();
929 /// The Child property of FlexContainer.<br />
930 /// The space around the flex item.<br />
933 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
935 /// <since_tizen> 3 </since_tizen>
936 [Obsolete("Deprecated in API8, will be removed in API10.")]
937 public Vector4 FlexMargin
941 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
942 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
946 SetValue(FlexMarginProperty, value);
947 NotifyPropertyChanged();
952 /// The top-left cell this child occupies, if not set, the first available cell is used.
955 /// The property cascade chaining set is not recommended.
956 /// Also, this property is for <see cref="TableView"/> class. Please use the property for the child position of <see cref="TableView"/>.
959 /// This way is recommended for setting the property
961 /// var view = new View();
962 /// view.CellIndex = new Vector2(1, 3);
964 /// This way to set the property is prohibited
966 /// view.CellIndex.X = 1; //This does not guarantee a proper operation
969 /// <since_tizen> 3 </since_tizen>
970 public Vector2 CellIndex
974 return (Vector2)GetValue(CellIndexProperty);
978 SetValue(CellIndexProperty, value);
979 NotifyPropertyChanged();
984 /// The number of rows this child occupies, if not set, the default value is 1.
987 /// This property is for <see cref="TableView"/> class. Use the property for the child position of <see cref="TableView"/>.
989 /// <since_tizen> 3 </since_tizen>
994 return (float)GetValue(RowSpanProperty);
998 SetValue(RowSpanProperty, value);
999 NotifyPropertyChanged();
1004 /// The number of columns this child occupies, if not set, the default value is 1.
1007 /// This property is for <see cref="TableView"/> class. Use the property for the child position of <see cref="TableView"/>.
1009 /// <since_tizen> 3 </since_tizen>
1010 public float ColumnSpan
1014 return (float)GetValue(ColumnSpanProperty);
1018 SetValue(ColumnSpanProperty, value);
1019 NotifyPropertyChanged();
1024 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
1027 /// This property is for <see cref="TableView"/> class. Use the property for the child position of <see cref="TableView"/>.
1029 /// <since_tizen> 3 </since_tizen>
1030 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
1034 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
1038 SetValue(CellHorizontalAlignmentProperty, value);
1039 NotifyPropertyChanged();
1044 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
1047 /// This property is for <see cref="TableView"/> class. Use the property for the child position of <see cref="TableView"/>.
1049 /// <since_tizen> 3 </since_tizen>
1050 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
1054 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
1058 SetValue(CellVerticalAlignmentProperty, value);
1059 NotifyPropertyChanged();
1064 /// The left focusable view.<br />
1065 /// This will return null if not set.<br />
1066 /// This will also return null if the specified left focusable view is not on a window.<br />
1068 /// <since_tizen> 3 </since_tizen>
1069 public View LeftFocusableView
1071 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
1074 return (View)GetValue(LeftFocusableViewProperty);
1078 SetValue(LeftFocusableViewProperty, value);
1079 NotifyPropertyChanged();
1084 /// The right focusable view.<br />
1085 /// This will return null if not set.<br />
1086 /// This will also return null if the specified right focusable view is not on a window.<br />
1088 /// <since_tizen> 3 </since_tizen>
1089 public View RightFocusableView
1091 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
1094 return (View)GetValue(RightFocusableViewProperty);
1098 SetValue(RightFocusableViewProperty, value);
1099 NotifyPropertyChanged();
1104 /// The up focusable view.<br />
1105 /// This will return null if not set.<br />
1106 /// This will also return null if the specified up focusable view is not on a window.<br />
1108 /// <since_tizen> 3 </since_tizen>
1109 public View UpFocusableView
1111 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
1114 return (View)GetValue(UpFocusableViewProperty);
1118 SetValue(UpFocusableViewProperty, value);
1119 NotifyPropertyChanged();
1124 /// The down focusable view.<br />
1125 /// This will return null if not set.<br />
1126 /// This will also return null if the specified down focusable view is not on a window.<br />
1128 /// <since_tizen> 3 </since_tizen>
1129 public View DownFocusableView
1131 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
1134 return (View)GetValue(DownFocusableViewProperty);
1138 SetValue(DownFocusableViewProperty, value);
1139 NotifyPropertyChanged();
1144 /// The clockwise focusable view by rotary wheel.<br />
1145 /// This will return null if not set.<br />
1146 /// This will also return null if the specified clockwise focusable view is not on a window.<br />
1148 [EditorBrowsable(EditorBrowsableState.Never)]
1149 public View ClockwiseFocusableView
1151 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
1154 return (View)GetValue(ClockwiseFocusableViewProperty);
1158 SetValue(ClockwiseFocusableViewProperty, value);
1159 NotifyPropertyChanged();
1164 /// The counter clockwise focusable view by rotary wheel.<br />
1165 /// This will return null if not set.<br />
1166 /// This will also return null if the specified counter clockwise focusable view is not on a window.<br />
1168 [EditorBrowsable(EditorBrowsableState.Never)]
1169 public View CounterClockwiseFocusableView
1171 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
1174 return (View)GetValue(CounterClockwiseFocusableViewProperty);
1178 SetValue(CounterClockwiseFocusableViewProperty, value);
1179 NotifyPropertyChanged();
1184 /// Whether the view should be focusable by keyboard navigation.
1186 /// <since_tizen> 3 </since_tizen>
1187 public bool Focusable
1191 SetValue(FocusableProperty, value);
1192 NotifyPropertyChanged();
1196 return (bool)GetValue(FocusableProperty);
1201 /// Whether the children of this view can be focusable by keyboard navigation. If user sets this to false, the children of this actor view will not be focused.
1202 /// Note : Default value is true.
1204 [EditorBrowsable(EditorBrowsableState.Never)]
1205 public bool FocusableChildren
1209 SetValue(FocusableChildrenProperty, value);
1210 NotifyPropertyChanged();
1214 return (bool)GetValue(FocusableChildrenProperty);
1219 /// Whether this view can focus by touch.
1220 /// If Focusable is false, FocusableInTouch is disabled.
1221 /// If you want to have focus on touch, you need to set both Focusable and FocusableInTouch settings to true.
1223 [EditorBrowsable(EditorBrowsableState.Never)]
1224 public bool FocusableInTouch
1228 SetValue(FocusableInTouchProperty, value);
1229 NotifyPropertyChanged();
1233 return (bool)GetValue(FocusableInTouchProperty);
1238 /// Retrieves the position of the view.
1239 /// The coordinates are relative to the view's parent.
1242 /// The <see cref="Size"/>, <see cref="Position"/>, <see cref="Color"/>, and <see cref="Scale"/> properties are set in the main thread.
1243 /// Therefore, it is not updated in real time when the value is changed in the render thread (for example, the value is changed during animation).
1244 /// However, <see cref="CurrentSize"/>, <see cref="CurrentPosition"/>, <see cref="CurrentColor"/>, and <see cref="CurrentScale"/> properties are updated in real time,
1245 /// and users can get the current actual values through them.
1247 /// <since_tizen> 3 </since_tizen>
1248 public Position CurrentPosition
1252 return GetCurrentPosition();
1257 /// Sets the size of a view for the width and the height.<br />
1258 /// Geometry can be scaled to fit within this area.<br />
1259 /// This does not interfere with the view's scale factor.<br />
1260 /// The views default depth is the minimum of width and height.<br />
1263 /// The property cascade chaining set is not recommended.
1266 /// This way is recommended for setting the property
1268 /// var view = new View();
1269 /// view.Size2D = new Size2D(100, 200);
1271 /// This way to set the property is prohibited
1273 /// view.Size2D.Width = 100; //This does not guarantee a proper operation
1276 /// <since_tizen> 3 </since_tizen>
1277 public Size2D Size2D
1281 var temp = (Size2D)GetValue(Size2DProperty);
1283 if (this.Layout == null)
1285 if (temp.Width < 0) { temp.Width = 0; }
1286 if (temp.Height < 0) { temp.Height = 0; }
1293 SetValue(Size2DProperty, value);
1295 NotifyPropertyChanged();
1300 /// Retrieves the size of the view.
1301 /// The coordinates are relative to the view's parent.
1304 /// The <see cref="Size"/>, <see cref="Position"/>, <see cref="Color"/>, and <see cref="Scale"/> properties are set in the main thread.
1305 /// Therefore, it is not updated in real time when the value is changed in the render thread (for example, the value is changed during animation).
1306 /// However, <see cref="CurrentSize"/>, <see cref="CurrentPosition"/>, <see cref="CurrentColor"/>, and <see cref="CurrentScale"/> properties are updated in real time,
1307 /// and users can get the current actual values through them.
1309 /// <since_tizen> 3 </since_tizen>
1310 public Size2D CurrentSize
1314 return GetCurrentSize();
1319 /// Retrieves and sets the view's opacity.<br />
1323 /// Animatable - This property can be animated using <c>Animation</c> class.
1325 /// animation.AnimateTo(view, "Opacity", 0.5f);
1329 /// <since_tizen> 3 </since_tizen>
1330 public float Opacity
1334 return (float)GetValue(OpacityProperty);
1338 SetValue(OpacityProperty, value);
1339 NotifyPropertyChanged();
1344 /// Sets the position of the view for X and Y.<br />
1345 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1346 /// If the position inheritance is disabled, sets the world position.<br />
1349 /// The property cascade chaining set is not recommended.
1352 /// This way is recommended for setting the property
1354 /// var view = new View();
1355 /// view.Position2D = new Position2D(100, 200);
1357 /// This way to set the property is prohibited
1359 /// view.Position2D.X = 100; //This does not guarantee a proper operation
1362 /// <since_tizen> 3 </since_tizen>
1363 public Position2D Position2D
1367 return (Position2D)GetValue(Position2DProperty);
1371 SetValue(Position2DProperty, value);
1372 NotifyPropertyChanged();
1377 /// Retrieves the screen position of the view.<br />
1379 /// <since_tizen> 3 </since_tizen>
1380 public Vector2 ScreenPosition
1384 return GetCurrentScreenPosition();
1389 /// Retrieves the screen position and size of the view.<br />
1392 /// The float type Rectangle class is not ready yet.
1393 /// Therefore, it transmits data in Vector4 class.
1394 /// This type should later be changed to the appropriate data type.
1396 [EditorBrowsable(EditorBrowsableState.Never)]
1397 public Vector4 ScreenPositionSize
1401 return GetCurrentScreenPositionSize();
1406 /// Determines whether the pivot point should be used to determine the position of the view.
1407 /// This is false by default.
1409 /// <remarks>If false, then the top-left of the view is used for the position.
1410 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1412 /// <since_tizen> 3 </since_tizen>
1413 public bool PositionUsesPivotPoint
1417 return (bool)GetValue(PositionUsesPivotPointProperty);
1421 SetValue(PositionUsesPivotPointProperty, value);
1422 NotifyPropertyChanged();
1427 /// This has been deprecated in API5 and Will be removed in API8. Use PositionUsesPivotPoint instead.
1429 /// <since_tizen> 3 </since_tizen>
1430 [Obsolete("This has been deprecated in API5 and will be removed in API8. Use PositionUsesPivotPoint instead. " +
1432 "View view = new View(); " +
1433 "view.PivotPoint = PivotPoint.Center; " +
1434 "view.PositionUsesPivotPoint = true;" +
1435 " This has been deprecated in API5 and will be removed in API8")]
1436 [EditorBrowsable(EditorBrowsableState.Never)]
1437 public bool PositionUsesAnchorPoint
1441 return (bool)GetValue(PositionUsesAnchorPointProperty);
1445 SetValue(PositionUsesAnchorPointProperty, value);
1449 private bool InternalPositionUsesAnchorPoint
1453 return Object.InternalGetPropertyBool(SwigCPtr, View.Property.PositionUsesAnchorPoint);
1457 Object.InternalSetPropertyBool(SwigCPtr, View.Property.PositionUsesAnchorPoint, value);
1458 NotifyPropertyChanged();
1463 /// Queries whether the view is connected to the stage.<br />
1464 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1466 /// <since_tizen> 3 </since_tizen>
1467 public bool IsOnWindow
1476 /// Gets the depth in the hierarchy for the view.
1478 /// <since_tizen> 3 </since_tizen>
1479 public int HierarchyDepth
1483 return GetHierarchyDepth();
1488 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1491 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1492 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1493 /// The values set by this property will likely change.
1495 /// <since_tizen> 3 </since_tizen>
1496 public int SiblingOrder
1500 return (int)GetValue(SiblingOrderProperty);
1504 SetValue(SiblingOrderProperty, value);
1506 Layout?.ChangeLayoutSiblingOrder(value);
1508 NotifyPropertyChanged();
1513 /// Returns the natural size of the view.
1516 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1518 /// <since_tizen> 5 </since_tizen>
1519 public Vector3 NaturalSize
1523 Vector3 ret = GetNaturalSize();
1524 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1530 /// Returns the natural size (Size2D) of the view.
1533 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1535 /// <since_tizen> 4 </since_tizen>
1536 public Size2D NaturalSize2D
1540 Vector3 temp = GetNaturalSize();
1541 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1545 sz = new Size2D((int)temp.Width, (int)temp.Height);
1553 /// Gets or sets the origin of a view within its parent's area.<br />
1554 /// 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 />
1555 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1556 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1558 /// <pre>The view has been initialized.</pre>
1559 /// <since_tizen> 3 </since_tizen>
1560 public Position ParentOrigin
1564 Position tmp = (Position)GetValue(ParentOriginProperty);
1565 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1569 SetValue(ParentOriginProperty, value);
1570 NotifyPropertyChanged();
1575 /// Gets or sets the anchor-point of a view.<br />
1576 /// 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 />
1577 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1578 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1579 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1580 /// <pre>The view has been initialized.</pre>
1583 /// The property cascade chaining set is not recommended.
1586 /// This way is recommended for setting the property
1588 /// var view = new View();
1589 /// view.PivotPoint = PivotPoint.Center;
1591 /// This way to set the property is prohibited
1593 /// view.PivotPoint.X = 0.5f; //This does not guarantee a proper operation
1596 /// <since_tizen> 3 </since_tizen>
1597 public Position PivotPoint
1601 return (Position)GetValue(PivotPointProperty);
1605 SetValue(PivotPointProperty, value);
1606 NotifyPropertyChanged();
1611 /// Gets or sets the size width of the view.
1615 /// Animatable - This property can be animated using <c>Animation</c> class.
1617 /// animation.AnimateTo(view, "SizeWidth", 500.0f);
1621 /// <since_tizen> 3 </since_tizen>
1622 public float SizeWidth
1626 return (float)GetValue(SizeWidthProperty);
1630 SetValue(SizeWidthProperty, value);
1631 NotifyPropertyChanged();
1636 /// Gets or sets the size height of the view.
1640 /// Animatable - This property can be animated using <c>Animation</c> class.
1643 /// animation.AnimateTo(view, "SizeHeight", 500.0f);
1646 /// <since_tizen> 3 </since_tizen>
1647 public float SizeHeight
1651 return (float)GetValue(SizeHeightProperty);
1655 SetValue(SizeHeightProperty, value);
1656 NotifyPropertyChanged();
1661 /// Gets or sets the position of the view.<br />
1662 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1663 /// If the position inheritance is disabled, sets the world position.<br />
1667 /// Animatable - This property can be animated using <c>Animation</c> class.
1669 /// animation.AnimateTo(view, "Position", new Position(50, 0));
1672 /// The property cascade chaining set is not recommended.
1675 /// This way is recommended for setting the property
1677 /// var view = new View();
1678 /// view.Position = new Position(100, 200.5f, 0);
1680 /// This way to set the property is prohibited
1682 /// view.Position.Y = 200.5f; //This does not guarantee a proper operation
1685 /// <since_tizen> 3 </since_tizen>
1686 public Position Position
1690 return (Position)GetValue(PositionProperty);
1694 SetValue(PositionProperty, value);
1695 NotifyPropertyChanged();
1700 /// Gets or sets the position X of the view.
1704 /// Animatable - This property can be animated using <c>Animation</c> class.
1706 /// animation.AnimateTo(view, "PositionX", 50.0f);
1710 /// <since_tizen> 3 </since_tizen>
1711 public float PositionX
1715 return (float)GetValue(PositionXProperty);
1719 SetValue(PositionXProperty, value);
1720 NotifyPropertyChanged();
1725 /// Gets or sets the position Y of the view.
1729 /// Animatable - This property can be animated using <c>Animation</c> class.
1731 /// animation.AnimateTo(view, "PositionY", 50.0f);
1735 /// <since_tizen> 3 </since_tizen>
1736 public float PositionY
1740 return (float)GetValue(PositionYProperty);
1744 SetValue(PositionYProperty, value);
1745 NotifyPropertyChanged();
1750 /// Gets or sets the position Z of the view.
1754 /// Animatable - This property can be animated using <c>Animation</c> class.
1756 /// animation.AnimateTo(view, "PositionZ", 50.0f);
1760 /// <since_tizen> 3 </since_tizen>
1761 public float PositionZ
1765 return (float)GetValue(PositionZProperty);
1769 SetValue(PositionZProperty, value);
1770 NotifyPropertyChanged();
1775 /// Gets or sets the world position of the view.
1777 /// <since_tizen> 3 </since_tizen>
1778 public Vector3 WorldPosition
1782 return GetCurrentWorldPosition();
1787 /// Gets or sets the orientation of the view.<br />
1788 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1792 /// This is an asynchronous method.
1795 /// Animatable - This property can be animated using <c>Animation</c> class.
1797 /// animation.AnimateTo(view, "Orientation", new Rotation(new Radian((float)Math.PI), Vector3.XAxis));
1801 /// <since_tizen> 3 </since_tizen>
1802 public Rotation Orientation
1806 return (Rotation)GetValue(OrientationProperty);
1810 SetValue(OrientationProperty, value);
1811 NotifyPropertyChanged();
1816 /// Gets or sets the world orientation of the view.<br />
1818 /// <since_tizen> 3 </since_tizen>
1819 public Rotation WorldOrientation
1823 Rotation temp = new Rotation();
1824 var pValue = GetProperty(View.Property.WorldOrientation);
1832 /// Gets or sets the scale factor applied to the view.<br />
1836 /// Animatable - This property can be animated using <c>Animation</c> class.
1838 /// animation.AnimateTo(view, "Scale", new Vector3(1.5f, 1.5f, 1.0f));
1841 /// The property cascade chaining set is not recommended.
1844 /// This way is recommended for setting the property
1846 /// var view = new View();
1847 /// view.Scale = new Vector3(1.5f, 2.0f, 1.0f);
1849 /// This way to set the property is prohibited
1851 /// view.Scale.Width = 1.5f; //This does not guarantee a proper operation
1854 /// <since_tizen> 3 </since_tizen>
1855 public Vector3 Scale
1859 return (Vector3)GetValue(ScaleProperty);
1863 SetValue(ScaleProperty, value);
1864 NotifyPropertyChanged();
1869 /// Gets or sets the scale X factor applied to the view.
1873 /// Animatable - This property can be animated using <c>Animation</c> class.
1875 /// animation.AnimateTo(view, "ScaleX", 1.5f);
1879 /// <since_tizen> 3 </since_tizen>
1884 return (float)GetValue(ScaleXProperty);
1888 SetValue(ScaleXProperty, value);
1889 NotifyPropertyChanged();
1894 /// Gets or sets the scale Y factor applied to the view.
1898 /// Animatable - This property can be animated using <c>Animation</c> class.
1900 /// animation.AnimateTo(view, "ScaleY", 1.5f);
1904 /// <since_tizen> 3 </since_tizen>
1909 return (float)GetValue(ScaleYProperty);
1913 SetValue(ScaleYProperty, value);
1914 NotifyPropertyChanged();
1919 /// Gets or sets the scale Z factor applied to the view.
1923 /// Animatable - This property can be animated using <c>Animation</c> class.
1925 /// animation.AnimateTo(view, "ScaleZ", 1.5f);
1929 /// <since_tizen> 3 </since_tizen>
1934 return (float)GetValue(ScaleZProperty);
1938 SetValue(ScaleZProperty, value);
1939 NotifyPropertyChanged();
1944 /// Gets the world scale of the view.
1946 /// <since_tizen> 3 </since_tizen>
1947 public Vector3 WorldScale
1951 return GetCurrentWorldScale();
1956 /// Retrieves the visibility flag of the view.
1960 /// If the view is not visible, then the view and its children will not be rendered.
1961 /// 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.
1964 /// Animatable - This property can be animated using <c>Animation</c> class.
1966 /// animation.AnimateTo(view, "Visibility", false);
1970 /// <since_tizen> 3 </since_tizen>
1971 public bool Visibility
1975 return Object.InternalGetPropertyBool(SwigCPtr, View.Property.VISIBLE);
1980 /// Gets the view's world color.
1982 /// <since_tizen> 3 </since_tizen>
1983 public Vector4 WorldColor
1987 return GetCurrentWorldColor();
1992 /// Gets or sets the view's name.
1994 /// <since_tizen> 3 </since_tizen>
1999 return (string)GetValue(NameProperty);
2003 SetValue(NameProperty, value);
2004 NotifyPropertyChanged();
2009 /// Get the number of children held by the view.
2011 /// <since_tizen> 3 </since_tizen>
2012 public new uint ChildCount
2016 return Convert.ToUInt32(Children.Count);
2021 /// Gets the view's ID.
2024 /// <since_tizen> 3 </since_tizen>
2034 /// Gets or sets the status of whether the view should emit touch or hover signals.
2035 /// If a View is made insensitive, then the View and its children are not hittable.
2037 /// <since_tizen> 3 </since_tizen>
2038 public bool Sensitive
2042 return (bool)GetValue(SensitiveProperty);
2046 SetValue(SensitiveProperty, value);
2047 NotifyPropertyChanged();
2052 /// Gets or sets the status of whether the view should be enabled user interactions.
2053 /// If a View is made disabled, then user interactions including touch, focus, and actiavation is disabled.
2055 /// <since_tizen> tizen_next </since_tizen>
2056 [EditorBrowsable(EditorBrowsableState.Never)]
2057 public bool IsEnabled
2061 return (bool)GetValue(IsEnabledProperty);
2065 SetValue(IsEnabledProperty, value);
2066 NotifyPropertyChanged();
2071 /// 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.
2073 /// <since_tizen> 3 </since_tizen>
2074 public bool LeaveRequired
2078 return (bool)GetValue(LeaveRequiredProperty);
2082 SetValue(LeaveRequiredProperty, value);
2083 NotifyPropertyChanged();
2088 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
2090 /// <since_tizen> 3 </since_tizen>
2091 public bool InheritOrientation
2095 return (bool)GetValue(InheritOrientationProperty);
2099 SetValue(InheritOrientationProperty, value);
2100 NotifyPropertyChanged();
2105 /// Gets or sets the status of whether a child view inherits it's parent's scale.
2107 /// <since_tizen> 3 </since_tizen>
2108 public bool InheritScale
2112 return (bool)GetValue(InheritScaleProperty);
2116 SetValue(InheritScaleProperty, value);
2117 NotifyPropertyChanged();
2122 /// Gets or sets the status of how the view and its children should be drawn.<br />
2123 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
2124 /// 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 />
2125 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
2126 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
2127 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
2129 /// <since_tizen> 3 </since_tizen>
2130 public DrawModeType DrawMode
2134 return (DrawModeType)GetValue(DrawModeProperty);
2138 SetValue(DrawModeProperty, value);
2139 NotifyPropertyChanged();
2144 /// Gets or sets the relative to parent size factor of the view.<br />
2145 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
2146 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
2149 /// The property cascade chaining set is not recommended.
2152 /// This way is recommended for setting the property
2154 /// var text = new TextField();
2155 /// text.SizeModeFactor = new Vector3(1.0f, 0.45f, 1.0f);
2157 /// This way to set the property is prohibited
2159 /// text.SizeModeFactor.Width = 1.0f; //This does not guarantee a proper operation
2162 /// <since_tizen> 3 </since_tizen>
2163 public Vector3 SizeModeFactor
2167 return (Vector3)GetValue(SizeModeFactorProperty);
2171 SetValue(SizeModeFactorProperty, value);
2172 NotifyPropertyChanged();
2177 /// Gets or sets the width resize policy to be used.
2179 /// <since_tizen> 3 </since_tizen>
2180 public ResizePolicyType WidthResizePolicy
2184 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
2188 SetValue(WidthResizePolicyProperty, value);
2189 NotifyPropertyChanged();
2194 /// Gets or sets the height resize policy to be used.
2196 /// <since_tizen> 3 </since_tizen>
2197 public ResizePolicyType HeightResizePolicy
2201 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
2205 SetValue(HeightResizePolicyProperty, value);
2206 NotifyPropertyChanged();
2211 /// Gets or sets the policy to use when setting size with size negotiation.<br />
2212 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
2214 /// <since_tizen> 3 </since_tizen>
2215 public SizeScalePolicyType SizeScalePolicy
2219 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
2223 SetValue(SizeScalePolicyProperty, value);
2224 NotifyPropertyChanged();
2229 /// Gets or sets the status of whether the width size is dependent on the height size.
2231 /// <since_tizen> 3 </since_tizen>
2232 public bool WidthForHeight
2236 return (bool)GetValue(WidthForHeightProperty);
2240 SetValue(WidthForHeightProperty, value);
2241 NotifyPropertyChanged();
2246 /// Gets or sets the status of whether the height size is dependent on the width size.
2248 /// <since_tizen> 3 </since_tizen>
2249 public bool HeightForWidth
2253 return (bool)GetValue(HeightForWidthProperty);
2257 SetValue(HeightForWidthProperty, value);
2258 NotifyPropertyChanged();
2263 /// Gets or sets the padding for use in layout.
2266 /// The property cascade chaining set is not recommended.
2269 /// This way is recommended for setting the property
2271 /// var view = new View();
2272 /// view.Padding = new Extents(5, 5, 5, 5);
2274 /// This way to set the property is prohibited
2276 /// view.Padding.Start = 5; //This does not guarantee a proper operation
2279 /// <since_tizen> 5 </since_tizen>
2280 public Extents Padding
2284 return (Extents)GetValue(PaddingProperty);
2288 SetValue(PaddingProperty, value);
2289 NotifyPropertyChanged();
2294 /// Gets or sets the minimum size the view can be assigned in size negotiation.
2296 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2298 /// The property cascade chaining set is not recommended.
2301 /// This way is recommended for setting the property
2303 /// var view = new View();
2304 /// view.MinimumSize = new Size2D(100, 200);
2306 /// This way to set the property is prohibited
2308 /// view.MinimumSize.Width = 100; //This does not guarantee a proper operation
2311 /// <since_tizen> 3 </since_tizen>
2312 public Size2D MinimumSize
2316 return (Size2D)GetValue(MinimumSizeProperty);
2322 throw new ArgumentNullException(nameof(value));
2326 // Note: it only works if minimum size is >= than natural size.
2327 // To force the size it should be done through the width&height spec or Size2D.
2328 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
2329 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
2330 layout.RequestLayout();
2332 SetValue(MinimumSizeProperty, value);
2333 NotifyPropertyChanged();
2338 /// Gets or sets the maximum size the view can be assigned in size negotiation.
2341 /// This way is recommended for setting the property
2343 /// var view = new View();
2344 /// view.MaximumSize = new Size2D(100, 200);
2346 /// This way to set the property is prohibited
2348 /// view.MaximumSize.Height = 200; //This does not guarantee a proper operation
2351 /// <since_tizen> 3 </since_tizen>
2352 public Size2D MaximumSize
2356 return (Size2D)GetValue(MaximumSizeProperty);
2360 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
2361 // MATCH_PARENT spec + parent container size can be used to limit
2364 layout.RequestLayout();
2366 SetValue(MaximumSizeProperty, value);
2367 NotifyPropertyChanged();
2372 /// Gets or sets whether a child view inherits it's parent's position.<br />
2373 /// Default is to inherit.<br />
2374 /// 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 />
2376 /// <since_tizen> 3 </since_tizen>
2377 public bool InheritPosition
2381 return (bool)GetValue(InheritPositionProperty);
2385 SetValue(InheritPositionProperty, value);
2386 NotifyPropertyChanged();
2391 /// Gets or sets the clipping behavior (mode) of it's children.
2393 /// <since_tizen> 3 </since_tizen>
2394 public ClippingModeType ClippingMode
2398 return (ClippingModeType)GetValue(ClippingModeProperty);
2402 SetValue(ClippingModeProperty, value);
2403 NotifyPropertyChanged();
2408 /// Gets the number of renderers held by the view.
2410 /// <since_tizen> 3 </since_tizen>
2411 public uint RendererCount
2415 return GetRendererCount();
2420 /// This has been deprecated in API5 and will be removed in API8. Use PivotPoint instead.
2423 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2425 /// <since_tizen> 3 </since_tizen>
2426 [Obsolete("This has been deprecated in API5 and will be removed in API8. Use PivotPoint instead. " +
2428 "View view = new View(); " +
2429 "view.PivotPoint = PivotPoint.Center; " +
2430 "view.PositionUsesPivotPoint = true;")]
2431 [EditorBrowsable(EditorBrowsableState.Never)]
2432 public Position AnchorPoint
2436 return GetValue(AnchorPointProperty) as Position;
2440 SetValue(AnchorPointProperty, value);
2444 private Position InternalAnchorPoint
2448 return GetCurrentAnchorPoint();
2452 SetAnchorPoint(value);
2453 NotifyPropertyChanged();
2458 /// Sets the size of a view for the width, the height and the depth.<br />
2459 /// Geometry can be scaled to fit within this area.<br />
2460 /// This does not interfere with the view's scale factor.<br />
2461 /// The views default depth is the minimum of width and height.<br />
2465 /// Animatable - This property can be animated using <c>Animation</c> class.
2467 /// animation.AnimateTo(view, "Size", new Size(100, 100));
2470 /// The property cascade chaining set is not recommended.
2473 /// This way is recommended for setting the property
2475 /// var view = new View();
2476 /// view.Size = new Size(100.5f, 200, 0);
2478 /// This way to set the property is prohibited
2480 /// view.Size.Width = 100.5f; //This does not guarantee a proper operation
2483 /// <since_tizen> 5 </since_tizen>
2488 return (Size)GetValue(SizeProperty);
2492 SetValue(SizeProperty, value);
2493 NotifyPropertyChanged();
2498 /// This has been deprecated in API5 and will be removed in API8. Use 'Container GetParent() for derived class' instead.
2500 /// <since_tizen> 3 </since_tizen>
2501 [Obsolete("This has been deprecated in API5 and will be removed in API8. Use 'Container GetParent() for derived class' instead. " +
2503 "Container parent = view.GetParent(); " +
2504 "View view = parent as View;")]
2505 [EditorBrowsable(EditorBrowsableState.Never)]
2506 public new View Parent
2511 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2512 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2513 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2515 if (basehandle is Layer layer)
2517 ret = new View(Layer.getCPtr(layer).Handle, false);
2518 NUILog.Error("This Parent property is deprecated, should do not be used");
2522 ret = basehandle as View;
2525 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2526 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2528 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2534 /// Gets/Sets whether inherit parent's the layout Direction.
2536 /// <since_tizen> 4 </since_tizen>
2537 public bool InheritLayoutDirection
2541 return (bool)GetValue(InheritLayoutDirectionProperty);
2545 SetValue(InheritLayoutDirectionProperty, value);
2546 NotifyPropertyChanged();
2551 /// Gets/Sets the layout Direction.
2553 /// <since_tizen> 4 </since_tizen>
2554 public ViewLayoutDirectionType LayoutDirection
2558 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2562 SetValue(LayoutDirectionProperty, value);
2563 NotifyPropertyChanged();
2564 layout?.RequestLayout();
2569 /// Gets or sets the Margin for use in layout.
2572 /// Margin property is supported by Layout algorithms and containers.
2573 /// Please Set Layout if you want to use Margin property.
2574 /// The property cascade chaining set is not recommended.
2577 /// This way is recommended for setting the property
2579 /// var view = new View();
2580 /// view.Margin = new Extents(10, 5, 15, 20);
2582 /// This way to set the property is prohibited
2584 /// view.Margin.Top = 15; //This does not guarantee a proper operation
2587 /// <since_tizen> 4 </since_tizen>
2588 public Extents Margin
2592 return (Extents)GetValue(MarginProperty);
2596 SetValue(MarginProperty, value);
2597 NotifyPropertyChanged();
2602 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2606 /// // matchParentView matches its size to its parent size.
2607 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2608 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2610 /// // wrapContentView wraps its children with their desired size.
2611 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2612 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2614 /// // exactSizeView shows itself with an exact size.
2615 /// exactSizeView.WidthSpecification = 100;
2616 /// exactSizeView.HeightSpecification = 100;
2619 /// <since_tizen> 6 </since_tizen>
2620 [Binding.TypeConverter(typeof(IntGraphicsTypeConverter))]
2621 public int WidthSpecification
2625 return (int)GetValue(WidthSpecificationProperty);
2629 SetValue(WidthSpecificationProperty, value);
2630 NotifyPropertyChanged();
2634 private int InternalWidthSpecification
2642 if (value == widthPolicy)
2645 widthPolicy = value;
2646 if (widthPolicy >= 0)
2648 SizeWidth = widthPolicy;
2650 layout?.RequestLayout();
2655 /// The required policy for this dimension, <see cref="LayoutParamPolicies"/> values or exact value.
2659 /// // matchParentView matches its size to its parent size.
2660 /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent;
2661 /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent;
2663 /// // wrapContentView wraps its children with their desired size.
2664 /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent;
2665 /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent;
2667 /// // exactSizeView shows itself with an exact size.
2668 /// exactSizeView.WidthSpecification = 100;
2669 /// exactSizeView.HeightSpecification = 100;
2672 /// <since_tizen> 6 </since_tizen>
2673 [Binding.TypeConverter(typeof(IntGraphicsTypeConverter))]
2674 public int HeightSpecification
2678 return (int)GetValue(HeightSpecificationProperty);
2682 SetValue(HeightSpecificationProperty, value);
2683 NotifyPropertyChanged();
2687 private int InternalHeightSpecification
2691 return heightPolicy;
2695 if (value == heightPolicy)
2698 heightPolicy = value;
2699 if (heightPolicy >= 0)
2701 SizeHeight = heightPolicy;
2703 layout?.RequestLayout();
2708 /// Gets the List of transitions for this View.
2710 /// <since_tizen> 6 </since_tizen>
2711 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2715 if (layoutTransitions == null)
2717 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2719 return layoutTransitions;
2724 /// Sets a layout transitions for this View.
2726 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2728 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2730 /// <since_tizen> 6 </since_tizen>
2731 public LayoutTransition LayoutTransition
2735 return GetValue(LayoutTransitionProperty) as LayoutTransition;
2739 SetValue(LayoutTransitionProperty, value);
2740 NotifyPropertyChanged();
2744 private LayoutTransition InternalLayoutTransition
2748 return layoutTransition;
2754 throw new global::System.ArgumentNullException(nameof(value));
2756 if (layoutTransitions == null)
2758 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2761 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2763 AttachTransitionsToChildren(value);
2765 layoutTransition = value;
2770 /// This has been deprecated in API5 and will be removed in API8. Use Padding instead.
2773 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2775 /// <since_tizen> 4 </since_tizen>
2776 [Obsolete("This has been deprecated in API5 and will be removed in API8. Use Padding instead.")]
2777 [EditorBrowsable(EditorBrowsableState.Never)]
2778 public Extents PaddingEX
2782 return GetValue(PaddingEXProperty) as Extents;
2786 SetValue(PaddingEXProperty, value);
2790 private Extents InternalPaddingEX
2794 Extents temp = new Extents(0, 0, 0, 0);
2795 var pValue = GetProperty(View.Property.PADDING);
2798 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2804 var temp = new Tizen.NUI.PropertyValue(value);
2805 SetProperty(View.Property.PADDING, temp);
2807 NotifyPropertyChanged();
2808 layout?.RequestLayout();
2813 /// The Color of View. This is an RGBA value.
2814 /// Each RGBA components match as <see cref="ColorRed"/>, <see cref="ColorGreen"/>, <see cref="ColorBlue"/>, and <see cref="Opacity"/>.
2815 /// This property will multiply the final color of this view. (BackgroundColor, BorderlineColor, BackgroundImage, etc).
2816 /// For example, if view.BackgroundColor = Color.Yellow and view.Color = Color.Purple, this view will shown as Red.
2817 /// Inherient of color value depend on <see cref="ColorMode"/>.
2821 /// Animatable - This property can be animated using <c>Animation</c> class.
2823 /// The property cascade chaining set is not recommended.
2826 /// This way is recommended for setting the property
2828 /// var view = new View();
2829 /// view.Color = new Color(0.5f, 0.2f, 0.1f, 0.5f);
2831 /// This way to set the property is prohibited
2833 /// view.Color.A = 0.5f; //This does not guarantee a proper operation
2836 [EditorBrowsable(EditorBrowsableState.Never)]
2841 return (Color)GetValue(ColorProperty);
2845 SetValue(ColorProperty, value);
2846 NotifyPropertyChanged();
2851 /// The Red component of View.Color.
2855 /// Animatable - This property can be animated using <c>Animation</c> class.
2858 [EditorBrowsable(EditorBrowsableState.Never)]
2859 public float ColorRed
2863 return (float)GetValue(ColorRedProperty);
2867 SetValue(ColorRedProperty, value);
2868 NotifyPropertyChanged();
2873 /// The Green component of View.Color.
2877 /// Animatable - This property can be animated using <c>Animation</c> class.
2880 [EditorBrowsable(EditorBrowsableState.Never)]
2881 public float ColorGreen
2885 return (float)GetValue(ColorGreenProperty);
2889 SetValue(ColorGreenProperty, value);
2890 NotifyPropertyChanged();
2895 /// The Blue component of View.Color.
2899 /// Animatable - This property can be animated using <c>Animation</c> class.
2902 [EditorBrowsable(EditorBrowsableState.Never)]
2903 public float ColorBlue
2907 return (float)GetValue(ColorBlueProperty);
2911 SetValue(ColorBlueProperty, value);
2912 NotifyPropertyChanged();
2917 /// Set the layout on this View. Replaces any existing Layout.
2920 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2922 /// <since_tizen> 6 </since_tizen>
2923 public LayoutItem Layout
2927 return GetValue(LayoutProperty) as LayoutItem;
2931 SetValue(LayoutProperty, value);
2935 private LayoutItem InternalLayout
2943 // Do nothing if layout provided is already set on this View.
2944 if (value == layout)
2949 LayoutingDisabled = false;
2952 // If new layout being set already has a owner then that owner receives a replacement default layout.
2953 // First check if the layout to be set already has a owner.
2954 if (value?.Owner != null)
2956 // Previous owner of the layout gets a default layout as a replacement.
2957 value.Owner.Layout = new AbsoluteLayout()
2959 // Copy Margin and Padding to replacement LayoutGroup.
2960 Margin = value.Margin,
2961 Padding = value.Padding,
2965 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2966 // View if no replacement. Previously margin and padding values would have been moved from
2967 // the View to the layout.
2968 if (layout != null) // Existing layout
2972 // Existing layout being replaced so copy over margin and padding values.
2973 value.Margin = layout.Margin;
2974 value.Padding = layout.Padding;
2975 value.SetPositionByLayout = !excludeLayouting;
2979 // Layout not being replaced so restore margin and padding to View.
2980 SetValue(MarginProperty, layout.Margin);
2981 SetValue(PaddingProperty, layout.Padding);
2982 NotifyPropertyChanged();
2987 // First Layout to be added to the View hence copy
2989 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2992 Extents margin = Margin;
2993 Extents padding = Padding;
2994 bool setMargin = false;
2995 bool setPadding = false;
2997 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2999 // If View already has a margin set then store it in Layout instead.
3000 value.Margin = margin;
3001 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
3005 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
3007 // If View already has a padding set then store it in Layout instead.
3008 value.Padding = padding;
3009 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
3013 if (setMargin || setPadding)
3015 NotifyPropertyChanged();
3018 value.SetPositionByLayout = !excludeLayouting;
3022 // Remove existing layout from it's parent layout group.
3025 // Set layout to this view
3031 /// The weight of the View, used to share available space in a layout with siblings.
3033 /// <since_tizen> 6 </since_tizen>
3043 layout?.RequestLayout();
3048 /// Whether to load the BackgroundImage synchronously.
3049 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
3050 /// Note: For Normal Quad images only.
3052 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
3053 [EditorBrowsable(EditorBrowsableState.Never)]
3054 public bool BackgroundImageSynchronosLoading
3058 return (bool)GetValue(BackgroundImageSynchronosLoadingProperty);
3062 SetValue(BackgroundImageSynchronosLoadingProperty, value);
3063 NotifyPropertyChanged();
3067 private bool InternalBackgroundImageSynchronosLoading
3071 return BackgroundImageSynchronousLoading;
3075 BackgroundImageSynchronousLoading = value;
3080 /// Whether to load the BackgroundImage synchronously.
3081 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
3082 /// Note: For Normal Quad images only.
3084 /// This will be public opened in tizen_7.0 after ACR done. Before ACR, need to be hidden as inhouse API.
3085 [EditorBrowsable(EditorBrowsableState.Never)]
3086 public bool BackgroundImageSynchronousLoading
3090 return (bool)GetValue(BackgroundImageSynchronousLoadingProperty);
3094 SetValue(BackgroundImageSynchronousLoadingProperty, value);
3095 NotifyPropertyChanged();
3099 private bool InternalBackgroundImageSynchronousLoading
3103 return backgroundImageSynchronousLoading;
3107 backgroundImageSynchronousLoading = value;
3109 if (!string.IsNullOrEmpty(BackgroundImage))
3111 PropertyMap bgMap = this.Background;
3112 var temp = new PropertyValue(backgroundImageSynchronousLoading);
3113 bgMap[ImageVisualProperty.SynchronousLoading] = temp;
3120 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
3121 [EditorBrowsable(EditorBrowsableState.Never)]
3122 public Vector4 UpdateAreaHint
3126 return (Vector4)GetValue(UpdateAreaHintProperty);
3130 SetValue(UpdateAreaHintProperty, value);
3131 NotifyPropertyChanged();
3136 /// Enable/Disable ControlState propagation for children.
3137 /// It is false by default.
3138 /// If the View needs to share ControlState with descendants, please set it true.
3139 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
3141 [EditorBrowsable(EditorBrowsableState.Never)]
3142 public bool EnableControlStatePropagation
3146 return (bool)GetValue(EnableControlStatePropagationProperty);
3150 SetValue(EnableControlStatePropagationProperty, value);
3151 NotifyPropertyChanged();
3155 private bool InternalEnableControlStatePropagation
3157 get => themeData?.ControlStatePropagation ?? false;
3160 if (InternalEnableControlStatePropagation == value) return;
3162 if (themeData == null) themeData = new ThemeData();
3164 themeData.ControlStatePropagation = value;
3166 foreach (View child in Children)
3168 child.EnableControlStatePropagation = value;
3174 /// The ControlStates can propagate from the parent.
3175 /// Listed ControlStates will be accepted propagation of the parent ControlState changes
3176 /// if parent view EnableControlState is true.
3177 /// <see cref="EnableControlState"/>.
3178 /// Default is ControlState.All, so every ControlStates will be propagated from the parent.
3180 [EditorBrowsable(EditorBrowsableState.Never)]
3181 public ControlState PropagatableControlStates
3185 return (ControlState)GetValue(PropagatableControlStatesProperty);
3189 SetValue(PropagatableControlStatesProperty, value);
3190 NotifyPropertyChanged();
3194 private ControlState InternalPropagatableControlStates
3196 get => propagatableControlStates;
3197 set => propagatableControlStates = value;
3201 /// By default, it is false in View, true in Control.
3202 /// Note that if the value is true, the View will be a touch receptor.
3204 [EditorBrowsable(EditorBrowsableState.Never)]
3205 public bool EnableControlState
3209 return (bool)GetValue(EnableControlStateProperty);
3213 SetValue(EnableControlStateProperty, value);
3218 /// Whether the actor grab all touches even if touch leaves its boundary.
3220 /// <returns>true, if it grab all touch after start</returns>
3221 [EditorBrowsable(EditorBrowsableState.Never)]
3222 public bool GrabTouchAfterLeave
3226 return (bool)GetValue(GrabTouchAfterLeaveProperty);
3230 SetValue(GrabTouchAfterLeaveProperty, value);
3234 private bool InternalGrabTouchAfterLeave
3238 return Object.InternalGetPropertyBool(SwigCPtr, View.Property.CaptureAllTouchAfterStart);
3242 Object.InternalSetPropertyBool(SwigCPtr, View.Property.CaptureAllTouchAfterStart, value);
3244 // Use custom HitTest callback only if GrabTouchAfterLeave is true.
3247 RegisterHitTestCallback();
3251 UnregisterHitTestCallback();
3254 NotifyPropertyChanged();
3259 /// Whether the view will only receive own touch.
3261 /// <returns>true, if it only receives touches that started from itself.</returns>
3262 [EditorBrowsable(EditorBrowsableState.Never)]
3263 public bool AllowOnlyOwnTouch
3267 return (bool)GetValue(AllowOnlyOwnTouchProperty);
3271 SetValue(AllowOnlyOwnTouchProperty, value);
3275 private bool InternalAllowOnlyOwnTouch
3279 return Object.InternalGetPropertyBool(SwigCPtr, View.Property.AllowOnlyOwnTouch);
3283 Object.InternalSetPropertyBool(SwigCPtr, View.Property.AllowOnlyOwnTouch, value);
3284 NotifyPropertyChanged();
3289 /// Determines which blend equation will be used to render renderers of this actor.
3291 /// <returns>blend equation enum currently assigned</returns>
3292 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
3293 [EditorBrowsable(EditorBrowsableState.Never)]
3294 public BlendEquationType BlendEquation
3298 return (BlendEquationType)GetValue(BlendEquationProperty);
3302 SetValue(BlendEquationProperty, value);
3306 private BlendEquationType InternalBlendEquation
3310 return (BlendEquationType)Object.InternalGetPropertyInt(SwigCPtr, View.Property.BlendEquation);
3314 Object.InternalSetPropertyInt(SwigCPtr, View.Property.BlendEquation, (int)value);
3315 NotifyPropertyChanged();
3320 /// If the value is true, the View will change its style as the theme changes.
3321 /// The default value is false in normal case but it can be true when the NUIApplication is created with <see cref="NUIApplication.ThemeOptions.ThemeChangeSensitive"/>.
3323 /// <since_tizen> 9 </since_tizen>
3324 public bool ThemeChangeSensitive
3326 get => (bool)GetValue(ThemeChangeSensitiveProperty);
3327 set => SetValue(ThemeChangeSensitiveProperty, value);
3331 /// Create Style, it is abstract function and must be override.
3333 [EditorBrowsable(EditorBrowsableState.Never)]
3334 protected virtual ViewStyle CreateViewStyle()
3336 return new ViewStyle();
3340 /// Called after the View's ControlStates changed.
3342 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
3343 [EditorBrowsable(EditorBrowsableState.Never)]
3344 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
3350 [EditorBrowsable(EditorBrowsableState.Never)]
3351 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
3353 isThemeChanged = true;
3354 if (string.IsNullOrEmpty(styleName)) ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(GetType()));
3355 else ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(styleName));
3356 isThemeChanged = false;
3360 /// Apply style instance to the view.
3361 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
3363 /// <since_tizen> 9 </since_tizen>
3364 public virtual void ApplyStyle(ViewStyle viewStyle)
3366 if (viewStyle == null || themeData?.viewStyle == viewStyle) return;
3368 if (themeData == null) themeData = new ThemeData();
3370 themeData.viewStyle = viewStyle;
3372 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
3378 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
3380 if (bindablePropertyOfView == null)
3385 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
3386 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
3388 foreach (var sourceProperty in dirtyStyleProperties)
3390 var sourceValue = viewStyle.GetValue(sourceProperty);
3392 if (sourceValue == null)
3397 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
3399 // Do not set value again when theme is changed and the value has been set already.
3400 if (isThemeChanged && ChangedPropertiesSetExcludingStyle.Contains(destinationProperty))
3405 if (destinationProperty != null)
3407 InternalSetValue(destinationProperty, sourceValue);
3413 /// Get whether the View is culled or not.
3414 /// True means that the View is out of the view frustum.
3417 /// Hidden-API (Inhouse-API).
3419 [EditorBrowsable(EditorBrowsableState.Never)]
3424 return Object.InternalGetPropertyBool(SwigCPtr, View.Property.Culled);
3429 /// Set or Get TransitionOptions for the page transition.
3430 /// This property is used to define how this view will be transitioned during Page switching.
3432 /// <since_tizen> 9 </since_tizen>
3433 public TransitionOptions TransitionOptions
3437 return GetValue(TransitionOptionsProperty) as TransitionOptions;
3441 SetValue(TransitionOptionsProperty, value);
3442 NotifyPropertyChanged();
3446 private TransitionOptions InternalTransitionOptions
3450 transitionOptions = value;
3454 return transitionOptions;
3459 /// Gets or sets the status of whether the view should emit key event signals.
3460 /// If a View's DispatchKeyEvents is set to false, then itself and parents will not receive key event signals.
3462 [EditorBrowsable(EditorBrowsableState.Never)]
3463 public bool DispatchKeyEvents
3467 return (bool)GetValue(DispatchKeyEventsProperty);
3471 SetValue(DispatchKeyEventsProperty, value);
3472 NotifyPropertyChanged();
3477 /// Gets or sets the status of whether touch events can be dispatched.
3478 /// If a View's DispatchTouchEvents is set to false, then it's can not will receive touch and parents will not receive a touch event signal either.
3479 /// This works without adding a TouchEvent callback in the View.
3481 /// If the <see cref="Tizen.NUI.BaseComponents.View.Sensitive"/> is a property that determines whether or not to be hittable, then this property prevents the propagation of the hit touch event.
3484 [EditorBrowsable(EditorBrowsableState.Never)]
3485 public bool DispatchTouchEvents
3489 return dispatchTouchEvents;
3493 if (dispatchTouchEvents != value)
3495 dispatchTouchEvents = value;
3496 if (dispatchTouchEvents == false)
3498 TouchEvent += OnDispatchTouchEvent;
3502 TouchEvent -= OnDispatchTouchEvent;
3508 private bool OnDispatchTouchEvent(object source, View.TouchEventArgs e)
3514 /// Gets or sets the status of whether touch events can be dispatched to the parent.
3515 /// If a View's DispatchParentTouchEvents is set to false, then parents will not receive a touch event signal either.
3516 /// This works without adding a TouchEvent callback in the View.
3518 /// If the <see cref="Tizen.NUI.BaseComponents.View.Sensitive"/> is a property that determines whether or not to be hittable, then this property prevents the propagation of the hit touch event.
3521 [EditorBrowsable(EditorBrowsableState.Never)]
3522 public bool DispatchParentTouchEvents
3526 return dispatchParentTouchEvents;
3530 if (dispatchParentTouchEvents != value)
3532 dispatchParentTouchEvents = value;
3533 if (dispatchParentTouchEvents == false)
3535 TouchEvent += OnDispatchParentTouchEvent;
3539 TouchEvent -= OnDispatchParentTouchEvent;
3545 private bool OnDispatchParentTouchEvent(object source, View.TouchEventArgs e)
3551 /// Gets or sets the status of whether hover events can be dispatched.
3552 /// If a View's DispatchHoverEvents is set to false, then it's can not will receive hover event and parents will not receive a hover event signal either.
3553 /// This works without adding a HoverEvent callback in the View.
3555 /// If the <see cref="Tizen.NUI.BaseComponents.View.Sensitive"/> is a property that determines whether or not to be hittable, then this property prevents the propagation of the hit hover event.
3558 [EditorBrowsable(EditorBrowsableState.Never)]
3559 public bool DispatchHoverEvents
3563 return dispatchHoverEvents;
3567 if (dispatchHoverEvents != value)
3569 dispatchHoverEvents = value;
3570 if (dispatchHoverEvents == false)
3572 HoverEvent += OnDispatchHoverEvent;
3576 HoverEvent -= OnDispatchHoverEvent;
3582 private bool OnDispatchHoverEvent(object source, View.HoverEventArgs e)
3588 /// Gets or sets the status of whether hover events can be dispatched to the parent.
3589 /// If a View's DispatchParentHoverEvents is set to false, then parents will not receive a hover event signal either.
3590 /// This works without adding a HoverEvent callback in the View.
3592 /// If the <see cref="Tizen.NUI.BaseComponents.View.Sensitive"/> is a property that determines whether or not to be hittable, then this property prevents the propagation of the hit hover event.
3595 [EditorBrowsable(EditorBrowsableState.Never)]
3596 public bool DispatchParentHoverEvents
3600 return dispatchParentHoverEvents;
3604 if (dispatchParentHoverEvents != value)
3606 dispatchParentHoverEvents = value;
3607 if (dispatchParentHoverEvents == false)
3609 HoverEvent += OnDispatchParentHoverEvent;
3613 HoverEvent -= OnDispatchParentHoverEvent;
3619 private bool OnDispatchParentHoverEvent(object source, View.HoverEventArgs e)
3625 /// Gets or sets the status of whether the view should emit Gesture event signals.
3626 /// If a View's DispatchGestureEvents is set to false, then itself and parents will not receive all gesture event signals.
3627 /// The itself and parents does not receive tap, pinch, pan, rotation, or longpress gestures.
3629 [EditorBrowsable(EditorBrowsableState.Never)]
3630 public bool DispatchGestureEvents
3634 return dispatchGestureEvents;
3638 if (dispatchGestureEvents != value)
3640 dispatchGestureEvents = value;
3641 ConfigGestureDetector(dispatchGestureEvents);
3647 /// Gets or sets the status of whether the view should emit Gesture event signals.
3648 /// If a View's DispatchParentGestureEvents is set to false, then parents will not receive all gesture event signals.
3649 /// The parents does not receive tap, pinch, pan, rotation, or longpress gestures.
3651 [EditorBrowsable(EditorBrowsableState.Never)]
3652 public bool DispatchParentGestureEvents
3656 return dispatchParentGestureEvents;
3660 if (dispatchParentGestureEvents != value)
3662 dispatchParentGestureEvents = value;
3663 ConfigGestureDetector(dispatchParentGestureEvents);
3668 private void ConfigGestureDetector(bool dispatch)
3670 if (panGestureDetector == null) panGestureDetector = new PanGestureDetector();
3671 if (longGestureDetector == null) longGestureDetector = new LongPressGestureDetector();
3672 if (pinchGestureDetector == null) pinchGestureDetector = new PinchGestureDetector();
3673 if (tapGestureDetector == null) tapGestureDetector = new TapGestureDetector();
3674 if (rotationGestureDetector == null) rotationGestureDetector = new RotationGestureDetector();
3676 if (dispatch == true)
3678 configGestureCount = configGestureCount > 0 ? configGestureCount - 1 : 0;
3679 if (configGestureCount == 0)
3681 panGestureDetector.Detach(this);
3682 longGestureDetector.Detach(this);
3683 pinchGestureDetector.Detach(this);
3684 tapGestureDetector.Detach(this);
3685 rotationGestureDetector.Detach(this);
3687 panGestureDetector.Detected -= OnGestureDetected;
3688 longGestureDetector.Detected -= OnGestureDetected;
3689 pinchGestureDetector.Detected -= OnGestureDetected;
3690 tapGestureDetector.Detected -= OnGestureDetected;
3691 rotationGestureDetector.Detected -= OnGestureDetected;
3696 if (configGestureCount == 0)
3698 panGestureDetector.Attach(this);
3699 longGestureDetector.Attach(this);
3700 pinchGestureDetector.Attach(this);
3701 tapGestureDetector.Attach(this);
3702 rotationGestureDetector.Attach(this);
3704 panGestureDetector.Detected += OnGestureDetected;
3705 longGestureDetector.Detected += OnGestureDetected;
3706 pinchGestureDetector.Detected += OnGestureDetected;
3707 tapGestureDetector.Detected += OnGestureDetected;
3708 rotationGestureDetector.Detected += OnGestureDetected;
3710 configGestureCount++;
3714 private void OnGestureDetected(object source, EventArgs e)
3716 // Does notting. This is to consume the gesture.
3720 /// Called when the view is hit through TouchEvent or GestureEvent.
3721 /// If it returns true, it means that it was hit, and the touch/gesture event is called from the view.
3722 /// If it returns false, it means that it will not be hit, and the hit-test continues to the next view.
3723 /// User can override whether hit or not in HitTest.
3724 /// You can get the coordinates relative to tthe top-left of the hit view by touch.GetLocalPosition(0).
3725 /// or you can get the coordinates relative to the top-left of the screen by touch.GetScreenPosition(0).
3727 // <param name="touch"><see cref="Tizen.NUI.Touch"/>The touch data</param>
3728 [EditorBrowsable(EditorBrowsableState.Never)]
3729 protected virtual bool HitTest(Touch touch)
3735 /// Retrieve the View's current Color.
3738 /// The <see cref="Size"/>, <see cref="Position"/>, <see cref="Color"/>, and <see cref="Scale"/> properties are set in the main thread.
3739 /// Therefore, it is not updated in real time when the value is changed in the render thread (for example, the value is changed during animation).
3740 /// However, <see cref="CurrentSize"/>, <see cref="CurrentPosition"/>, <see cref="CurrentColor"/>, and <see cref="CurrentScale"/> properties are updated in real time,
3741 /// and users can get the current actual values through them.
3743 [EditorBrowsable(EditorBrowsableState.Never)]
3744 public Color CurrentColor => GetCurrentColor();
3747 /// Retrieve the current scale factor applied to the View.
3750 /// The <see cref="Size"/>, <see cref="Position"/>, <see cref="Color"/>, and <see cref="Scale"/> properties are set in the main thread.
3751 /// Therefore, it is not updated in real time when the value is changed in the render thread (for example, the value is changed during animation).
3752 /// However, <see cref="CurrentSize"/>, <see cref="CurrentPosition"/>, <see cref="CurrentColor"/>, and <see cref="CurrentScale"/> properties are updated in real time,
3753 /// and users can get the current actual values through them.
3755 [EditorBrowsable(EditorBrowsableState.Never)]
3756 public Vector3 CurrentScale => GetCurrentScale();