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;
22 using Tizen.NUI.Components;
24 namespace Tizen.NUI.BaseComponents
27 /// View is the base class for all views.
29 /// <since_tizen> 3 </since_tizen>
30 public partial class View : Container, IResourcesProvider
32 internal BackgroundExtraData backgroundExtraData;
34 private bool layoutSet = false;
35 private LayoutItem layout; // Exclusive layout assigned to this View.
37 // List of transitions paired with the condition that uses the transition.
38 private Dictionary<TransitionCondition, TransitionList> layoutTransitions;
39 private int widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
40 private int heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
41 private float weight = 0.0f; // Weighting of child View in a Layout
42 private bool backgroundImageSynchronosLoading = false;
43 private bool controlStatePropagation = false;
44 private ViewStyle viewStyle;
45 private bool themeChangeSensitive = false;
46 private bool excludeLayouting = false;
47 private LayoutTransition layoutTransition;
48 private ControlState controlStates = ControlState.Normal;
49 private TransitionOptions transitionOptions = null;
54 /// Creates a new instance of a view.
56 /// <since_tizen> 3 </since_tizen>
57 public View() : this(Interop.View.New(), true)
59 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
62 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
63 [EditorBrowsable(EditorBrowsableState.Never)]
64 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
69 /// Create a new instance of a View with setting the status of shown or hidden.
71 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
72 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
73 [EditorBrowsable(EditorBrowsableState.Never)]
74 public View(bool shown) : this(Interop.View.New(), true)
76 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
80 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
82 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
88 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
91 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
93 InitializeStyle(viewStyle);
96 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
100 PositionUsesPivotPoint = false;
103 onWindowSendEventCallback = SendViewAddedEventToWindow;
104 this.OnWindowSignal().Connect(onWindowSendEventCallback);
112 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
114 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123 /// The event that is triggered when the View's ControlState is changed.
125 [EditorBrowsable(EditorBrowsableState.Never)]
126 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
128 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
132 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
134 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
135 [EditorBrowsable(EditorBrowsableState.Never)]
136 public bool LayoutSet
145 /// Flag to allow Layouting to be disabled for Views.
146 /// Once a View has a Layout set then any children added to Views from then on will receive
147 /// automatic Layouts.
149 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
150 [EditorBrowsable(EditorBrowsableState.Never)]
151 public static bool LayoutingDisabled { get; set; } = true;
154 /// The style instance applied to this view.
155 /// Note that please do not modify the ViewStyle.
156 /// Modifying ViewStyle will affect other views with same ViewStyle.
158 [EditorBrowsable(EditorBrowsableState.Never)]
159 protected ViewStyle ViewStyle
163 if (null == viewStyle)
165 ApplyStyle(CreateViewStyle());
173 /// Get/Set the control state.
174 /// Note that the ControlState only available for the classes derived from Control.
175 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
176 /// please set <see cref="EnableControlState"/> to true.
178 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
179 [EditorBrowsable(EditorBrowsableState.Never)]
180 public ControlState ControlState
184 return controlStates;
188 if (controlStates == value)
193 var prevState = controlStates;
195 controlStates = value;
197 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
199 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
201 if (controlStatePropagation)
203 foreach (View child in Children)
205 child.ControlState = value;
209 OnControlStateChanged(changeInfo);
211 ControlStateChangedEvent?.Invoke(this, changeInfo);
216 /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
218 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
219 [EditorBrowsable(EditorBrowsableState.Never)]
220 public bool ExcludeLayouting
224 return excludeLayouting;
228 excludeLayouting = value;
229 if (Layout != null && Layout.SetPositionByLayout == value)
231 Layout.SetPositionByLayout = !value;
232 Layout.RequestLayout();
237 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
238 [EditorBrowsable(EditorBrowsableState.Never)]
239 public bool IsResourcesCreated
243 return Application.Current.IsResourcesCreated;
247 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
248 [EditorBrowsable(EditorBrowsableState.Never)]
249 public ResourceDictionary XamlResources
253 return Application.Current.XamlResources;
257 Application.Current.XamlResources = value;
262 /// The StyleName, type string.
263 /// The value indicates DALi style name defined in json theme file.
265 /// <since_tizen> 3 </since_tizen>
266 public string StyleName
270 return (string)GetValue(StyleNameProperty);
274 SetValue(StyleNameProperty, value);
275 NotifyPropertyChanged();
280 /// The KeyInputFocus, type bool.
282 [EditorBrowsable(EditorBrowsableState.Never)]
283 public bool KeyInputFocus
287 return (bool)GetValue(KeyInputFocusProperty);
291 SetValue(KeyInputFocusProperty, value);
292 NotifyPropertyChanged();
297 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
301 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
304 /// Animatable - This property can be animated using <c>Animation</c> class.
306 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
310 /// <since_tizen> 3 </since_tizen>
311 public Color BackgroundColor
315 Color temp = (Color)GetValue(BackgroundColorProperty);
316 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
320 SetValue(BackgroundColorProperty, value);
321 if (selectorData != null)
323 selectorData.BackgroundImage?.Reset(this);
324 selectorData.BackgroundColor?.Reset(this);
326 NotifyPropertyChanged();
331 /// The mutually exclusive with "backgroundColor" and "background" type Map.
333 /// <since_tizen> 3 </since_tizen>
334 public string BackgroundImage
338 return (string)GetValue(BackgroundImageProperty);
342 SetValue(BackgroundImageProperty, value);
343 if (selectorData != null)
345 selectorData.BackgroundColor?.Reset(this);
346 selectorData.BackgroundImage?.Reset(this);
348 NotifyPropertyChanged();
353 /// Get or set the border of background image.
355 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
356 [EditorBrowsable(EditorBrowsableState.Never)]
357 public Rectangle BackgroundImageBorder
361 return (Rectangle)GetValue(BackgroundImageBorderProperty);
365 SetValue(BackgroundImageBorderProperty, value);
366 selectorData?.BackgroundImageBorder?.Reset(this);
367 NotifyPropertyChanged();
372 /// The background of view.
374 /// <since_tizen> 3 </since_tizen>
375 public Tizen.NUI.PropertyMap Background
379 return (PropertyMap)GetValue(BackgroundProperty);
383 SetValue(BackgroundProperty, value);
384 NotifyPropertyChanged();
389 /// Describes a shadow as an image for a View.
390 /// It is null by default.
393 /// Getter returns copied instance of current shadow.
396 /// The mutually exclusive with "BoxShadow".
400 /// Animatable - This property can be animated using <c>Animation</c> class.
401 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
403 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
405 /// Animatable sub-property : Offset.
408 [EditorBrowsable(EditorBrowsableState.Never)]
409 public ImageShadow ImageShadow
413 return (ImageShadow)GetValue(ImageShadowProperty);
417 SetValue(ImageShadowProperty, value);
418 if (selectorData != null)
420 selectorData.BoxShadow?.Reset(this);
421 selectorData.ImageShadow?.Reset(this);
423 NotifyPropertyChanged();
428 /// Describes a box shaped shadow drawing for a View.
429 /// It is null by default.
432 /// Getter returns copied instance of current shadow.
435 /// The mutually exclusive with "ImageShadow".
439 /// Animatable - This property can be animated using <c>Animation</c> class.
440 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
442 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
444 /// Animatable sub-property : Offset, Color, BlurRadius.
447 [EditorBrowsable(EditorBrowsableState.Never)]
448 public Shadow BoxShadow
452 return (Shadow)GetValue(BoxShadowProperty);
456 SetValue(BoxShadowProperty, value);
457 if (selectorData != null)
459 selectorData.ImageShadow?.Reset(this);
460 selectorData.BoxShadow?.Reset(this);
462 NotifyPropertyChanged();
467 /// The radius for the rounded corners of the View.
468 /// This will rounds background and shadow edges.
469 /// 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).
470 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
474 /// Animatable - This property can be animated using <c>Animation</c> class.
477 [EditorBrowsable(EditorBrowsableState.Never)]
478 public Vector4 CornerRadius
482 return (Vector4)GetValue(CornerRadiusProperty);
486 SetValue(CornerRadiusProperty, value);
487 NotifyPropertyChanged();
495 [EditorBrowsable(EditorBrowsableState.Never)]
496 protected bool IsHighlighted
500 using (View view = Accessibility.Accessibility.Instance.GetCurrentlyHighlightedView())
507 [EditorBrowsable(EditorBrowsableState.Never)]
508 protected static readonly string AccessibilityActivateAction = "activate";
509 [EditorBrowsable(EditorBrowsableState.Never)]
510 protected static readonly string AccessibilityReadingSkippedAction = "ReadingSkipped";
511 [EditorBrowsable(EditorBrowsableState.Never)]
512 protected static readonly string AccessibilityReadingCancelledAction = "ReadingCancelled";
513 [EditorBrowsable(EditorBrowsableState.Never)]
514 protected static readonly string AccessibilityReadingStoppedAction = "ReadingStopped";
515 [EditorBrowsable(EditorBrowsableState.Never)]
516 protected static readonly string AccessibilityReadingPausedAction = "ReadingPaused";
517 [EditorBrowsable(EditorBrowsableState.Never)]
518 protected static readonly string AccessibilityReadingResumedAction = "ReadingResumed";
520 [EditorBrowsable(EditorBrowsableState.Never)]
521 private static readonly string[] AccessibilityActions = {
522 AccessibilityActivateAction,
523 AccessibilityReadingSkippedAction,
524 AccessibilityReadingCancelledAction,
525 AccessibilityReadingStoppedAction,
526 AccessibilityReadingPausedAction,
527 AccessibilityReadingResumedAction,
530 [EditorBrowsable(EditorBrowsableState.Never)]
531 protected virtual string AccessibilityGetName()
536 [EditorBrowsable(EditorBrowsableState.Never)]
537 protected virtual string AccessibilityGetDescription()
542 [EditorBrowsable(EditorBrowsableState.Never)]
543 protected virtual bool AccessibilityDoAction(string name)
548 [EditorBrowsable(EditorBrowsableState.Never)]
549 protected virtual AccessibilityStates AccessibilityCalculateStates()
551 var states = new AccessibilityStates();
552 states.Set(AccessibilityState.Highlightable, this.AccessibilityHighlightable);
553 states.Set(AccessibilityState.Focusable, this.Focusable);
554 states.Set(AccessibilityState.Focused, this.State == States.Focused);
555 states.Set(AccessibilityState.Highlighted, this.IsHighlighted);
556 states.Set(AccessibilityState.Enabled, this.State != States.Disabled);
557 states.Set(AccessibilityState.Sensitive, this.Sensitive);
558 states.Set(AccessibilityState.Animated, this.AccessibilityAnimated);
559 states.Set(AccessibilityState.Visible, true);
560 states.Set(AccessibilityState.Showing, this.Visibility);
561 states.Set(AccessibilityState.Defunct, !this.IsOnWindow);
565 [EditorBrowsable(EditorBrowsableState.Never)]
566 protected virtual int AccessibilityGetActionCount()
568 return AccessibilityActions.Length;
571 [EditorBrowsable(EditorBrowsableState.Never)]
572 protected virtual string AccessibilityGetActionName(int index)
574 if (index >= 0 && index < AccessibilityActions.Length)
575 return AccessibilityActions[index];
580 [EditorBrowsable(EditorBrowsableState.Never)]
581 protected virtual bool AccessibilityShouldReportZeroChildren()
586 [EditorBrowsable(EditorBrowsableState.Never)]
587 protected virtual double AccessibilityGetMinimum()
592 [EditorBrowsable(EditorBrowsableState.Never)]
593 protected virtual double AccessibilityGetCurrent()
598 [EditorBrowsable(EditorBrowsableState.Never)]
599 protected virtual double AccessibilityGetMaximum()
604 [EditorBrowsable(EditorBrowsableState.Never)]
605 protected virtual bool AccessibilitySetCurrent(double value)
610 [EditorBrowsable(EditorBrowsableState.Never)]
611 protected virtual double AccessibilityGetMinimumIncrement()
616 [EditorBrowsable(EditorBrowsableState.Never)]
617 protected virtual bool AccessibilityIsScrollable()
622 [EditorBrowsable(EditorBrowsableState.Never)]
623 protected virtual string AccessibilityGetText(int startOffset, int endOffset)
628 [EditorBrowsable(EditorBrowsableState.Never)]
629 protected virtual int AccessibilityGetCharacterCount()
634 [EditorBrowsable(EditorBrowsableState.Never)]
635 protected virtual int AccessibilityGetCaretOffset()
640 [EditorBrowsable(EditorBrowsableState.Never)]
641 protected virtual bool AccessibilitySetCaretOffset(int offset)
646 [EditorBrowsable(EditorBrowsableState.Never)]
647 protected virtual AccessibilityRange AccessibilityGetTextAtOffset(int offset, TextBoundary boundary)
649 return new AccessibilityRange();
652 [EditorBrowsable(EditorBrowsableState.Never)]
653 protected virtual AccessibilityRange AccessibilityGetSelection(int selectionNum)
655 return new AccessibilityRange();
658 [EditorBrowsable(EditorBrowsableState.Never)]
659 protected virtual bool AccessibilityRemoveSelection(int selectionNum)
664 [EditorBrowsable(EditorBrowsableState.Never)]
665 protected virtual bool AccessibilitySetSelection(int selectionNum, int startOffset, int endOffset)
670 [EditorBrowsable(EditorBrowsableState.Never)]
671 protected virtual bool AccessibilityCopyText(int startPosition, int endPosition)
676 [EditorBrowsable(EditorBrowsableState.Never)]
677 protected virtual bool AccessibilityCutText(int startPosition, int endPosition)
683 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
684 /// It is absolute by default.
685 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
687 [EditorBrowsable(EditorBrowsableState.Never)]
688 public VisualTransformPolicyType CornerRadiusPolicy
690 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
691 set => SetValue(CornerRadiusPolicyProperty, value);
695 /// The current state of the view.
697 /// <since_tizen> 3 </since_tizen>
702 return (States)GetValue(StateProperty);
706 SetValue(StateProperty, value);
707 NotifyPropertyChanged();
712 /// The current sub state of the view.
714 /// <since_tizen> 3 </since_tizen>
715 public States SubState
719 return (States)GetValue(SubStateProperty);
723 SetValue(SubStateProperty, value);
724 NotifyPropertyChanged();
729 /// Displays a tooltip
731 /// <since_tizen> 3 </since_tizen>
732 public Tizen.NUI.PropertyMap Tooltip
736 return (PropertyMap)GetValue(TooltipProperty);
740 SetValue(TooltipProperty, value);
741 NotifyPropertyChanged();
746 /// Displays a tooltip as a text.
748 /// <since_tizen> 3 </since_tizen>
749 public string TooltipText
753 using (var propertyValue = GetProperty(Property.TOOLTIP))
755 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
757 return retrivedValue;
759 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
760 return "error to get TooltipText";
765 var temp = new Tizen.NUI.PropertyValue(value);
766 SetProperty(View.Property.TOOLTIP, temp);
768 NotifyPropertyChanged();
773 /// The Child property of FlexContainer.<br />
774 /// The proportion of the free space in the container, the flex item will receive.<br />
775 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
777 /// <since_tizen> 3 </since_tizen>
778 [Obsolete("Deprecated in API8, will be removed in API10.")]
783 return (float)GetValue(FlexProperty);
787 SetValue(FlexProperty, value);
788 NotifyPropertyChanged();
793 /// The Child property of FlexContainer.<br />
794 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
796 /// <since_tizen> 3 </since_tizen>
797 [Obsolete("Deprecated in API8, will be removed in API10.")]
802 return (int)GetValue(AlignSelfProperty);
806 SetValue(AlignSelfProperty, value);
807 NotifyPropertyChanged();
812 /// The Child property of FlexContainer.<br />
813 /// The space around the flex item.<br />
816 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
818 /// <since_tizen> 3 </since_tizen>
819 [Obsolete("Deprecated in API8, will be removed in API10.")]
820 public Vector4 FlexMargin
824 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
825 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
829 SetValue(FlexMarginProperty, value);
830 NotifyPropertyChanged();
835 /// The top-left cell this child occupies, if not set, the first available cell is used.
838 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
840 /// <since_tizen> 3 </since_tizen>
841 public Vector2 CellIndex
845 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
846 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
850 SetValue(CellIndexProperty, value);
851 NotifyPropertyChanged();
856 /// The number of rows this child occupies, if not set, the default value is 1.
858 /// <since_tizen> 3 </since_tizen>
863 return (float)GetValue(RowSpanProperty);
867 SetValue(RowSpanProperty, value);
868 NotifyPropertyChanged();
873 /// The number of columns this child occupies, if not set, the default value is 1.
875 /// <since_tizen> 3 </since_tizen>
876 public float ColumnSpan
880 return (float)GetValue(ColumnSpanProperty);
884 SetValue(ColumnSpanProperty, value);
885 NotifyPropertyChanged();
890 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
892 /// <since_tizen> 3 </since_tizen>
893 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
897 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
901 SetValue(CellHorizontalAlignmentProperty, value);
902 NotifyPropertyChanged();
907 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
909 /// <since_tizen> 3 </since_tizen>
910 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
914 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
918 SetValue(CellVerticalAlignmentProperty, value);
919 NotifyPropertyChanged();
924 /// The left focusable view.<br />
925 /// This will return null if not set.<br />
926 /// This will also return null if the specified left focusable view is not on a window.<br />
928 /// <since_tizen> 3 </since_tizen>
929 public View LeftFocusableView
931 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
934 return (View)GetValue(LeftFocusableViewProperty);
938 SetValue(LeftFocusableViewProperty, value);
939 NotifyPropertyChanged();
944 /// The right focusable view.<br />
945 /// This will return null if not set.<br />
946 /// This will also return null if the specified right focusable view is not on a window.<br />
948 /// <since_tizen> 3 </since_tizen>
949 public View RightFocusableView
951 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
954 return (View)GetValue(RightFocusableViewProperty);
958 SetValue(RightFocusableViewProperty, value);
959 NotifyPropertyChanged();
964 /// The up focusable view.<br />
965 /// This will return null if not set.<br />
966 /// This will also return null if the specified up focusable view is not on a window.<br />
968 /// <since_tizen> 3 </since_tizen>
969 public View UpFocusableView
971 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
974 return (View)GetValue(UpFocusableViewProperty);
978 SetValue(UpFocusableViewProperty, value);
979 NotifyPropertyChanged();
984 /// The down focusable view.<br />
985 /// This will return null if not set.<br />
986 /// This will also return null if the specified down focusable view is not on a window.<br />
988 /// <since_tizen> 3 </since_tizen>
989 public View DownFocusableView
991 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
994 return (View)GetValue(DownFocusableViewProperty);
998 SetValue(DownFocusableViewProperty, value);
999 NotifyPropertyChanged();
1004 /// Whether the view should be focusable by keyboard navigation.
1006 /// <since_tizen> 3 </since_tizen>
1007 public bool Focusable
1011 SetValue(FocusableProperty, value);
1012 NotifyPropertyChanged();
1016 return (bool)GetValue(FocusableProperty);
1021 /// Retrieves the position of the view.<br />
1022 /// The coordinates are relative to the view's parent.<br />
1024 /// <since_tizen> 3 </since_tizen>
1025 public Position CurrentPosition
1029 return GetCurrentPosition();
1034 /// Sets the size of a view for the width and the height.<br />
1035 /// Geometry can be scaled to fit within this area.<br />
1036 /// This does not interfere with the view's scale factor.<br />
1037 /// The views default depth is the minimum of width and height.<br />
1040 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
1041 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
1043 /// <since_tizen> 3 </since_tizen>
1044 public Size2D Size2D
1048 Size2D temp = (Size2D)GetValue(Size2DProperty);
1049 int width = temp.Width;
1050 int height = temp.Height;
1052 if (this.Layout == null)
1054 if (width < 0) { width = 0; }
1055 if (height < 0) { height = 0; }
1058 return new Size2D(OnSize2DChanged, width, height);
1062 SetValue(Size2DProperty, value);
1064 NotifyPropertyChanged();
1069 /// Retrieves the size of the view.<br />
1070 /// The coordinates are relative to the view's parent.<br />
1072 /// <since_tizen> 3 </since_tizen>
1073 public Size2D CurrentSize
1077 return GetCurrentSize();
1082 /// Retrieves and sets the view's opacity.<br />
1084 /// <since_tizen> 3 </since_tizen>
1085 public float Opacity
1089 return (float)GetValue(OpacityProperty);
1093 SetValue(OpacityProperty, value);
1094 selectorData?.Opacity?.Reset(this);
1095 NotifyPropertyChanged();
1100 /// Sets the position of the view for X and Y.<br />
1101 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1102 /// If the position inheritance is disabled, sets the world position.<br />
1105 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1106 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1108 /// <since_tizen> 3 </since_tizen>
1109 public Position2D Position2D
1113 Position2D temp = (Position2D)GetValue(Position2DProperty);
1114 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1118 SetValue(Position2DProperty, value);
1119 NotifyPropertyChanged();
1124 /// Retrieves the screen position of the view.<br />
1126 /// <since_tizen> 3 </since_tizen>
1127 public Vector2 ScreenPosition
1131 Vector2 temp = new Vector2(0.0f, 0.0f);
1132 var pValue = GetProperty(View.Property.ScreenPosition);
1140 /// Determines whether the pivot point should be used to determine the position of the view.
1141 /// This is false by default.
1143 /// <remarks>If false, then the top-left of the view is used for the position.
1144 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1146 /// <since_tizen> 3 </since_tizen>
1147 public bool PositionUsesPivotPoint
1151 return (bool)GetValue(PositionUsesPivotPointProperty);
1155 SetValue(PositionUsesPivotPointProperty, value);
1156 NotifyPropertyChanged();
1161 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1163 /// <since_tizen> 3 </since_tizen>
1164 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1166 "View view = new View(); " +
1167 "view.PivotPoint = PivotPoint.Center; " +
1168 "view.PositionUsesPivotPoint = true;" +
1169 " Deprecated in API5: Will be removed in API8")]
1170 [EditorBrowsable(EditorBrowsableState.Never)]
1171 public bool PositionUsesAnchorPoint
1176 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1177 pValue.Get(out temp);
1183 var temp = new Tizen.NUI.PropertyValue(value);
1184 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1186 NotifyPropertyChanged();
1191 /// Queries whether the view is connected to the stage.<br />
1192 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1194 /// <since_tizen> 3 </since_tizen>
1195 public bool IsOnWindow
1204 /// Gets the depth in the hierarchy for the view.
1206 /// <since_tizen> 3 </since_tizen>
1207 public int HierarchyDepth
1211 return GetHierarchyDepth();
1216 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1219 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1220 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1221 /// The values set by this property will likely change.
1223 /// <since_tizen> 3 </since_tizen>
1224 public int SiblingOrder
1228 return (int)GetValue(SiblingOrderProperty);
1232 SetValue(SiblingOrderProperty, value);
1234 LayoutGroup layout = Layout as LayoutGroup;
1235 layout?.ChangeLayoutSiblingOrder(value);
1237 NotifyPropertyChanged();
1242 /// Returns the natural size of the view.
1245 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1247 /// <since_tizen> 5 </since_tizen>
1248 public Vector3 NaturalSize
1252 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1253 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1259 /// Returns the natural size (Size2D) of the view.
1262 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1264 /// <since_tizen> 4 </since_tizen>
1265 public Size2D NaturalSize2D
1269 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1270 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1272 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1279 /// Gets or sets the origin of a view within its parent's area.<br />
1280 /// 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 />
1281 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1282 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1284 /// <pre>The view has been initialized.</pre>
1285 /// <since_tizen> 3 </since_tizen>
1286 public Position ParentOrigin
1290 Position tmp = (Position)GetValue(ParentOriginProperty);
1291 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1295 SetValue(ParentOriginProperty, value);
1296 NotifyPropertyChanged();
1301 /// Gets or sets the anchor-point of a view.<br />
1302 /// 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 />
1303 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1304 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1305 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1306 /// <pre>The view has been initialized.</pre>
1309 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1311 /// <since_tizen> 3 </since_tizen>
1312 public Position PivotPoint
1316 Position tmp = (Position)GetValue(PivotPointProperty);
1317 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1321 SetValue(PivotPointProperty, value);
1322 NotifyPropertyChanged();
1327 /// Gets or sets the size width of the view.
1331 /// Animatable - This property can be animated using <c>Animation</c> class.
1334 /// <since_tizen> 3 </since_tizen>
1335 public float SizeWidth
1339 return (float)GetValue(SizeWidthProperty);
1343 SetValue(SizeWidthProperty, value);
1344 NotifyPropertyChanged();
1349 /// Gets or sets the size height of the view.
1353 /// Animatable - This property can be animated using <c>Animation</c> class.
1356 /// <since_tizen> 3 </since_tizen>
1357 public float SizeHeight
1361 return (float)GetValue(SizeHeightProperty);
1365 SetValue(SizeHeightProperty, value);
1366 NotifyPropertyChanged();
1371 /// Gets or sets the position of the view.<br />
1372 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1373 /// If the position inheritance is disabled, sets the world position.<br />
1377 /// Animatable - This property can be animated using <c>Animation</c> class.
1379 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1381 /// <since_tizen> 3 </since_tizen>
1382 public Position Position
1386 Position tmp = (Position)GetValue(PositionProperty);
1387 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1391 SetValue(PositionProperty, value);
1392 NotifyPropertyChanged();
1397 /// Gets or sets the position X of the view.
1401 /// Animatable - This property can be animated using <c>Animation</c> class.
1404 /// <since_tizen> 3 </since_tizen>
1405 public float PositionX
1409 return (float)GetValue(PositionXProperty);
1413 SetValue(PositionXProperty, value);
1414 NotifyPropertyChanged();
1419 /// Gets or sets the position Y of the view.
1423 /// Animatable - This property can be animated using <c>Animation</c> class.
1426 /// <since_tizen> 3 </since_tizen>
1427 public float PositionY
1431 return (float)GetValue(PositionYProperty);
1435 SetValue(PositionYProperty, value);
1436 NotifyPropertyChanged();
1441 /// Gets or sets the position Z of the view.
1445 /// Animatable - This property can be animated using <c>Animation</c> class.
1448 /// <since_tizen> 3 </since_tizen>
1449 public float PositionZ
1453 return (float)GetValue(PositionZProperty);
1457 SetValue(PositionZProperty, value);
1458 NotifyPropertyChanged();
1463 /// Gets or sets the world position of the view.
1465 /// <since_tizen> 3 </since_tizen>
1466 public Vector3 WorldPosition
1470 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1471 var pValue = GetProperty(View.Property.WorldPosition);
1479 /// Gets or sets the orientation of the view.<br />
1480 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1484 /// This is an asynchronous method.
1487 /// Animatable - This property can be animated using <c>Animation</c> class.
1490 /// <since_tizen> 3 </since_tizen>
1491 public Rotation Orientation
1495 return (Rotation)GetValue(OrientationProperty);
1499 SetValue(OrientationProperty, value);
1500 NotifyPropertyChanged();
1505 /// Gets or sets the world orientation of the view.<br />
1507 /// <since_tizen> 3 </since_tizen>
1508 public Rotation WorldOrientation
1512 Rotation temp = new Rotation();
1513 var pValue = GetProperty(View.Property.WorldOrientation);
1521 /// Gets or sets the scale factor applied to the view.<br />
1525 /// Animatable - This property can be animated using <c>Animation</c> class.
1527 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1529 /// <since_tizen> 3 </since_tizen>
1530 public Vector3 Scale
1534 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1535 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1539 SetValue(ScaleProperty, value);
1540 NotifyPropertyChanged();
1545 /// Gets or sets the scale X factor applied to the view.
1549 /// Animatable - This property can be animated using <c>Animation</c> class.
1552 /// <since_tizen> 3 </since_tizen>
1557 return (float)GetValue(ScaleXProperty);
1561 SetValue(ScaleXProperty, value);
1562 NotifyPropertyChanged();
1567 /// Gets or sets the scale Y factor applied to the view.
1571 /// Animatable - This property can be animated using <c>Animation</c> class.
1574 /// <since_tizen> 3 </since_tizen>
1579 return (float)GetValue(ScaleYProperty);
1583 SetValue(ScaleYProperty, value);
1584 NotifyPropertyChanged();
1589 /// Gets or sets the scale Z factor applied to the view.
1593 /// Animatable - This property can be animated using <c>Animation</c> class.
1596 /// <since_tizen> 3 </since_tizen>
1601 return (float)GetValue(ScaleZProperty);
1605 SetValue(ScaleZProperty, value);
1606 NotifyPropertyChanged();
1611 /// Gets the world scale of the view.
1613 /// <since_tizen> 3 </since_tizen>
1614 public Vector3 WorldScale
1618 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1619 var pValue = GetProperty(View.Property.WorldScale);
1627 /// Retrieves the visibility flag of the view.
1631 /// If the view is not visible, then the view and its children will not be rendered.
1632 /// 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.
1635 /// Animatable - This property can be animated using <c>Animation</c> class.
1638 /// <since_tizen> 3 </since_tizen>
1639 public bool Visibility
1644 var pValue = GetProperty(View.Property.VISIBLE);
1645 pValue.Get(out temp);
1652 /// Gets the view's world color.
1654 /// <since_tizen> 3 </since_tizen>
1655 public Vector4 WorldColor
1659 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1660 var pValue = GetProperty(View.Property.WorldColor);
1668 /// Gets or sets the view's name.
1670 /// <since_tizen> 3 </since_tizen>
1675 return (string)GetValue(NameProperty);
1679 SetValue(NameProperty, value);
1680 NotifyPropertyChanged();
1685 /// Get the number of children held by the view.
1687 /// <since_tizen> 3 </since_tizen>
1688 public new uint ChildCount
1692 return Convert.ToUInt32(Children.Count);
1697 /// Gets the view's ID.
1700 /// <since_tizen> 3 </since_tizen>
1710 /// Gets or sets the status of whether the view should emit touch or hover signals.
1712 /// <since_tizen> 3 </since_tizen>
1713 public bool Sensitive
1717 return (bool)GetValue(SensitiveProperty);
1721 SetValue(SensitiveProperty, value);
1722 NotifyPropertyChanged();
1727 /// 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.
1729 /// <since_tizen> 3 </since_tizen>
1730 public bool LeaveRequired
1734 return (bool)GetValue(LeaveRequiredProperty);
1738 SetValue(LeaveRequiredProperty, value);
1739 NotifyPropertyChanged();
1744 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1746 /// <since_tizen> 3 </since_tizen>
1747 public bool InheritOrientation
1751 return (bool)GetValue(InheritOrientationProperty);
1755 SetValue(InheritOrientationProperty, value);
1756 NotifyPropertyChanged();
1761 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1763 /// <since_tizen> 3 </since_tizen>
1764 public bool InheritScale
1768 return (bool)GetValue(InheritScaleProperty);
1772 SetValue(InheritScaleProperty, value);
1773 NotifyPropertyChanged();
1778 /// Gets or sets the status of how the view and its children should be drawn.<br />
1779 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1780 /// 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 />
1781 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1782 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1783 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1785 /// <since_tizen> 3 </since_tizen>
1786 public DrawModeType DrawMode
1790 return (DrawModeType)GetValue(DrawModeProperty);
1794 SetValue(DrawModeProperty, value);
1795 NotifyPropertyChanged();
1800 /// Gets or sets the relative to parent size factor of the view.<br />
1801 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1802 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1805 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1807 /// <since_tizen> 3 </since_tizen>
1808 public Vector3 SizeModeFactor
1812 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1813 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1817 SetValue(SizeModeFactorProperty, value);
1818 NotifyPropertyChanged();
1823 /// Gets or sets the width resize policy to be used.
1825 /// <since_tizen> 3 </since_tizen>
1826 public ResizePolicyType WidthResizePolicy
1830 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1834 SetValue(WidthResizePolicyProperty, value);
1835 NotifyPropertyChanged();
1840 /// Gets or sets the height resize policy to be used.
1842 /// <since_tizen> 3 </since_tizen>
1843 public ResizePolicyType HeightResizePolicy
1847 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1851 SetValue(HeightResizePolicyProperty, value);
1852 NotifyPropertyChanged();
1857 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1858 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1860 /// <since_tizen> 3 </since_tizen>
1861 public SizeScalePolicyType SizeScalePolicy
1865 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1869 SetValue(SizeScalePolicyProperty, value);
1870 NotifyPropertyChanged();
1875 /// Gets or sets the status of whether the width size is dependent on the height size.
1877 /// <since_tizen> 3 </since_tizen>
1878 public bool WidthForHeight
1882 return (bool)GetValue(WidthForHeightProperty);
1886 SetValue(WidthForHeightProperty, value);
1887 NotifyPropertyChanged();
1892 /// Gets or sets the status of whether the height size is dependent on the width size.
1894 /// <since_tizen> 3 </since_tizen>
1895 public bool HeightForWidth
1899 return (bool)GetValue(HeightForWidthProperty);
1903 SetValue(HeightForWidthProperty, value);
1904 NotifyPropertyChanged();
1909 /// Gets or sets the padding for use in layout.
1912 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1914 /// <since_tizen> 5 </since_tizen>
1915 public Extents Padding
1919 // If View has a Layout then padding in stored in the base Layout class
1922 return Layout.Padding;
1926 Extents temp = (Extents)GetValue(PaddingProperty);
1927 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1929 // Two return points to prevent creating a zeroed Extent native object before assignment
1933 Extents padding = value;
1936 // Layout set so store Padding in LayoutItem instead of in View.
1937 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1938 // the position and sizes measure in the Layouting.
1939 Layout.Padding = value;
1940 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1941 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1942 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1944 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1948 SetValue(PaddingProperty, padding);
1949 NotifyPropertyChanged();
1954 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1956 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1958 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1960 /// <since_tizen> 3 </since_tizen>
1961 public Size2D MinimumSize
1965 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1966 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1972 throw new ArgumentNullException(nameof(value));
1976 // Note: it only works if minimum size is >= than natural size.
1977 // To force the size it should be done through the width&height spec or Size2D.
1978 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1979 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1980 layout.RequestLayout();
1982 SetValue(MinimumSizeProperty, value);
1983 NotifyPropertyChanged();
1988 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1991 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1993 /// <since_tizen> 3 </since_tizen>
1994 public Size2D MaximumSize
1998 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1999 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
2003 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
2004 // MATCH_PARENT spec + parent container size can be used to limit
2007 layout.RequestLayout();
2009 SetValue(MaximumSizeProperty, value);
2010 NotifyPropertyChanged();
2015 /// Gets or sets whether a child view inherits it's parent's position.<br />
2016 /// Default is to inherit.<br />
2017 /// 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 />
2019 /// <since_tizen> 3 </since_tizen>
2020 public bool InheritPosition
2024 return (bool)GetValue(InheritPositionProperty);
2028 SetValue(InheritPositionProperty, value);
2029 NotifyPropertyChanged();
2034 /// Gets or sets the clipping behavior (mode) of it's children.
2036 /// <since_tizen> 3 </since_tizen>
2037 public ClippingModeType ClippingMode
2041 return (ClippingModeType)GetValue(ClippingModeProperty);
2045 SetValue(ClippingModeProperty, value);
2046 NotifyPropertyChanged();
2051 /// Gets the number of renderers held by the view.
2053 /// <since_tizen> 3 </since_tizen>
2054 public uint RendererCount
2058 return GetRendererCount();
2063 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2066 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2068 /// <since_tizen> 3 </since_tizen>
2069 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2071 "View view = new View(); " +
2072 "view.PivotPoint = PivotPoint.Center; " +
2073 "view.PositionUsesPivotPoint = true;")]
2074 [EditorBrowsable(EditorBrowsableState.Never)]
2075 public Position AnchorPoint
2079 Position temp = new Position(0.0f, 0.0f, 0.0f);
2080 var pValue = GetProperty(View.Property.AnchorPoint);
2083 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2089 var temp = new Tizen.NUI.PropertyValue(value);
2090 SetProperty(View.Property.AnchorPoint, temp);
2092 NotifyPropertyChanged();
2097 /// Sets the size of a view for the width, the height and the depth.<br />
2098 /// Geometry can be scaled to fit within this area.<br />
2099 /// This does not interfere with the view's scale factor.<br />
2100 /// The views default depth is the minimum of width and height.<br />
2104 /// Animatable - This property can be animated using <c>Animation</c> class.
2106 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2108 /// <since_tizen> 5 </since_tizen>
2113 Size tmp = (Size)GetValue(SizeProperty);
2114 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2118 SetValue(SizeProperty, value);
2119 NotifyPropertyChanged();
2124 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2126 /// <since_tizen> 3 </since_tizen>
2127 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2129 "Container parent = view.GetParent(); " +
2130 "View view = parent as View;")]
2131 [EditorBrowsable(EditorBrowsableState.Never)]
2132 public new View Parent
2137 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2138 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2139 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2141 if (basehandle is Layer layer)
2143 ret = new View(Layer.getCPtr(layer).Handle, false);
2144 NUILog.Error("This Parent property is deprecated, should do not be used");
2148 ret = basehandle as View;
2151 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2152 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2154 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2160 /// Gets/Sets whether inherit parent's the layout Direction.
2162 /// <since_tizen> 4 </since_tizen>
2163 public bool InheritLayoutDirection
2167 return (bool)GetValue(InheritLayoutDirectionProperty);
2171 SetValue(InheritLayoutDirectionProperty, value);
2172 NotifyPropertyChanged();
2177 /// Gets/Sets the layout Direction.
2179 /// <since_tizen> 4 </since_tizen>
2180 public ViewLayoutDirectionType LayoutDirection
2184 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2188 SetValue(LayoutDirectionProperty, value);
2189 NotifyPropertyChanged();
2190 layout?.RequestLayout();
2195 /// Gets or sets the Margin for use in layout.
2198 /// Margin property is supported by Layout algorithms and containers.
2199 /// Please Set Layout if you want to use Margin property.
2200 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2202 /// <since_tizen> 4 </since_tizen>
2203 public Extents Margin
2207 // If View has a Layout then margin is stored in Layout.
2210 return Layout.Margin;
2214 // If Layout not set then return margin stored in View.
2215 Extents temp = (Extents)GetValue(MarginProperty);
2216 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2218 // Two return points to prevent creating a zeroed Extent native object before assignment
2224 // Layout set so store Margin in LayoutItem instead of View.
2225 // If View stores the Margin too then the Legacy Size Negotiation will
2226 // overwrite the position and size values measured in the Layouting.
2227 Layout.Margin = value;
2228 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2229 layout?.RequestLayout();
2233 SetValue(MarginProperty, value);
2235 NotifyPropertyChanged();
2236 layout?.RequestLayout();
2241 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2243 /// <since_tizen> 6 </since_tizen>
2244 public int WidthSpecification
2252 if (value == widthPolicy)
2255 widthPolicy = value;
2256 if (widthPolicy >= 0)
2258 if (heightPolicy >= 0) // Policy an exact value
2260 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2261 Size2D = new Size2D(widthPolicy, heightPolicy);
2264 layout?.RequestLayout();
2269 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2271 /// <since_tizen> 6 </since_tizen>
2272 public int HeightSpecification
2276 return heightPolicy;
2280 if (value == heightPolicy)
2283 heightPolicy = value;
2284 if (heightPolicy >= 0)
2286 if (widthPolicy >= 0) // Policy an exact value
2288 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2289 Size2D = new Size2D(widthPolicy, heightPolicy);
2292 layout?.RequestLayout();
2297 /// Gets the List of transitions for this View.
2299 /// <since_tizen> 6 </since_tizen>
2300 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2304 if (layoutTransitions == null)
2306 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2308 return layoutTransitions;
2313 /// Set a layout transitions for this View.
2315 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2317 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2319 /// <since_tizen> 6 </since_tizen>
2320 public LayoutTransition LayoutTransition
2324 return layoutTransition;
2330 throw new global::System.ArgumentNullException(nameof(value));
2332 if (layoutTransitions == null)
2334 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2337 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2339 AttachTransitionsToChildren(value);
2341 layoutTransition = value;
2346 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2349 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2351 /// <since_tizen> 4 </since_tizen>
2352 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2353 [EditorBrowsable(EditorBrowsableState.Never)]
2354 public Extents PaddingEX
2358 Extents temp = new Extents(0, 0, 0, 0);
2359 var pValue = GetProperty(View.Property.PADDING);
2362 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2368 var temp = new Tizen.NUI.PropertyValue(value);
2369 SetProperty(View.Property.PADDING, temp);
2371 NotifyPropertyChanged();
2372 layout?.RequestLayout();
2377 /// The Color of View. This is an RGBA value.
2381 /// Animatable - This property can be animated using <c>Animation</c> class.
2383 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2385 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2386 [EditorBrowsable(EditorBrowsableState.Never)]
2391 Color temp = (Color)GetValue(ColorProperty);
2392 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2396 SetValue(ColorProperty, value);
2397 selectorData?.Color?.Reset(this);
2398 NotifyPropertyChanged();
2403 /// Set the layout on this View. Replaces any existing Layout.
2406 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2408 /// <since_tizen> 6 </since_tizen>
2409 public LayoutItem Layout
2417 // Do nothing if layout provided is already set on this View.
2418 if (value == layout)
2423 LayoutingDisabled = false;
2426 // If new layout being set already has a owner then that owner receives a replacement default layout.
2427 // First check if the layout to be set already has a owner.
2428 if (value?.Owner != null)
2430 // Previous owner of the layout gets a default layout as a replacement.
2431 value.Owner.Layout = new AbsoluteLayout();
2433 // Copy Margin and Padding to replacement LayoutGroup.
2434 if (value.Owner.Layout != null)
2436 value.Owner.Layout.Margin = value.Margin;
2437 value.Owner.Layout.Padding = value.Padding;
2441 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2442 // View if no replacement. Previously margin and padding values would have been moved from
2443 // the View to the layout.
2444 if (layout != null) // Existing layout
2448 // Existing layout being replaced so copy over margin and padding values.
2449 value.Margin = layout.Margin;
2450 value.Padding = layout.Padding;
2454 // Layout not being replaced so restore margin and padding to View.
2455 SetValue(MarginProperty, layout.Margin);
2456 SetValue(PaddingProperty, layout.Padding);
2457 NotifyPropertyChanged();
2462 // First Layout to be added to the View hence copy
2464 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2467 Extents margin = Margin;
2468 Extents padding = Padding;
2469 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2471 // If View already has a margin set then store it in Layout instead.
2472 value.Margin = margin;
2473 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2474 NotifyPropertyChanged();
2477 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2479 // If View already has a padding set then store it in Layout instead.
2480 value.Padding = padding;
2482 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2483 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2484 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2486 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2487 NotifyPropertyChanged();
2493 // Remove existing layout from it's parent layout group.
2496 value.SetPositionByLayout = !excludeLayouting;
2498 // Set layout to this view
2504 /// The weight of the View, used to share available space in a layout with siblings.
2506 /// <since_tizen> 6 </since_tizen>
2516 layout?.RequestLayout();
2521 /// Whether to load the BackgroundImage synchronously.
2522 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2523 /// Note: For Normal Quad images only.
2525 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2526 [EditorBrowsable(EditorBrowsableState.Never)]
2527 public bool BackgroundImageSynchronosLoading
2531 return backgroundImageSynchronosLoading;
2535 backgroundImageSynchronosLoading = value;
2537 string bgUrl = null;
2538 var pValue = Background.Find(ImageVisualProperty.URL);
2539 pValue?.Get(out bgUrl);
2542 if (!string.IsNullOrEmpty(bgUrl))
2544 PropertyMap bgMap = this.Background;
2545 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2546 bgMap.Add("synchronousLoading", temp);
2553 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2554 [EditorBrowsable(EditorBrowsableState.Never)]
2555 public Vector2 UpdateSizeHint
2559 return (Vector2)GetValue(UpdateSizeHintProperty);
2563 SetValue(UpdateSizeHintProperty, value);
2564 NotifyPropertyChanged();
2569 /// Enable/Disable ControlState propagation for children.
2570 /// It is false by default.
2571 /// If the View needs to share ControlState with descendants, please set it true.
2572 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2574 [EditorBrowsable(EditorBrowsableState.Never)]
2575 public bool EnableControlStatePropagation
2577 get => controlStatePropagation;
2580 controlStatePropagation = value;
2582 foreach (View child in Children)
2584 child.EnableControlStatePropagation = value;
2590 /// By default, it is false in View, true in Control.
2591 /// Note that if the value is true, the View will be a touch receptor.
2593 [EditorBrowsable(EditorBrowsableState.Never)]
2594 public bool EnableControlState
2598 return (bool)GetValue(EnableControlStateProperty);
2602 SetValue(EnableControlStateProperty, value);
2607 /// Whether the actor grab all touches even if touch leaves its boundary.
2609 /// <returns>true, if it grab all touch after start</returns>
2610 [EditorBrowsable(EditorBrowsableState.Never)]
2611 public bool GrabTouchAfterLeave
2616 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2617 pValue.Get(out temp);
2623 var temp = new Tizen.NUI.PropertyValue(value);
2624 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2626 NotifyPropertyChanged();
2631 /// Determines which blend equation will be used to render renderers of this actor.
2633 /// <returns>blend equation enum currently assigned</returns>
2634 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2635 [EditorBrowsable(EditorBrowsableState.Never)]
2636 public BlendEquationType BlendEquation
2641 var pValue = GetProperty(View.Property.BlendEquation);
2642 pValue.Get(out temp);
2644 return (BlendEquationType)temp;
2648 var temp = new Tizen.NUI.PropertyValue((int)value);
2649 SetProperty(View.Property.BlendEquation, temp);
2651 NotifyPropertyChanged();
2656 /// If the value is true, the View will change its style as the theme changes.
2657 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2659 [EditorBrowsable(EditorBrowsableState.Never)]
2660 public bool ThemeChangeSensitive
2662 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2663 set => SetValue(ThemeChangeSensitiveProperty, value);
2667 /// Create Style, it is abstract function and must be override.
2669 [EditorBrowsable(EditorBrowsableState.Never)]
2670 protected virtual ViewStyle CreateViewStyle()
2672 return new ViewStyle();
2676 /// Called after the View's ControlStates changed.
2678 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2679 [EditorBrowsable(EditorBrowsableState.Never)]
2680 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2686 [EditorBrowsable(EditorBrowsableState.Never)]
2687 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2692 private bool IsViewPropertyDirty(BindableProperty styleProperty)
2694 if (dirtyPropertySet.Count == 0)
2699 if (styleProperty.ReturnType.IsGenericType && styleProperty.ReturnType.GetGenericTypeDefinition() == typeof(Selector<>))
2701 return dirtyPropertySet.Contains(styleProperty.PropertyName.Substring(0, styleProperty.PropertyName.Length - 8));
2704 return dirtyPropertySet.Contains(styleProperty.PropertyName);
2708 /// Apply style instance to the view.
2709 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2711 [EditorBrowsable(EditorBrowsableState.Never)]
2712 public virtual void ApplyStyle(ViewStyle viewStyle)
2714 if (viewStyle == null || this.viewStyle == viewStyle) return;
2716 this.viewStyle = viewStyle;
2718 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2724 if (dirtyPropertySet == null)
2726 dirtyPropertySet = new HashSet<string>();
2729 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2731 if (bindablePropertyOfView == null)
2736 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2737 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2739 foreach (var sourceProperty in dirtyStyleProperties)
2741 if (blockSetDirty && IsViewPropertyDirty(sourceProperty))
2743 // Skip applying theme style for a property set by user.
2747 var sourceValue = viewStyle.GetValue(sourceProperty);
2749 if (sourceValue == null)
2754 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2756 if (destinationProperty != null)
2758 SetValue(destinationProperty, sourceValue);
2764 /// Get whether the View is culled or not.
2765 /// True means that the View is out of the view frustum.
2768 /// Hidden-API (Inhouse-API).
2770 [EditorBrowsable(EditorBrowsableState.Never)]
2776 var pValue = GetProperty(View.Property.Culled);
2777 pValue.Get(out temp);
2784 /// Set or Get TransitionOptions for the page transition.
2787 /// Hidden-API (Inhouse-API).
2789 [EditorBrowsable(EditorBrowsableState.Never)]
2790 public TransitionOptions TransitionOptions
2794 transitionOptions = value;
2798 return transitionOptions;