2 * Copyright(c) 2020 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.Binding;
22 using Tizen.NUI.Components;
24 namespace Tizen.NUI.BaseComponents
27 /// View is the base class for all views.
29 /// <since_tizen> 3 </since_tizen>
30 public partial class View : Container, IResourcesProvider
32 internal BackgroundExtraData backgroundExtraData;
34 private bool layoutSet = false;
35 private LayoutItem layout; // Exclusive layout assigned to this View.
37 // List of transitions paired with the condition that uses the transition.
38 private Dictionary<TransitionCondition, TransitionList> layoutTransitions;
39 private int widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
40 private int heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
41 private float weight = 0.0f; // Weighting of child View in a Layout
42 private bool backgroundImageSynchronosLoading = false;
43 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
44 private bool controlStatePropagation = false;
45 private ViewStyle viewStyle;
46 private bool themeChangeSensitive = false;
47 private bool excludeLayouting = false;
48 private LayoutTransition layoutTransition;
50 private ControlState controlStates = ControlState.Normal;
55 /// Creates a new instance of a view.
57 /// <since_tizen> 3 </since_tizen>
58 public View() : this(Interop.View.New(), true)
60 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
63 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
64 [EditorBrowsable(EditorBrowsableState.Never)]
65 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
70 /// Create a new instance of a View with setting the status of shown or hidden.
72 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
73 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
74 [EditorBrowsable(EditorBrowsableState.Never)]
75 public View(bool shown) : this(Interop.View.New(), true)
77 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
81 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
83 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
92 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
94 InitializeStyle(viewStyle);
97 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
101 PositionUsesPivotPoint = false;
104 onWindowSendEventCallback = SendViewAddedEventToWindow;
105 this.OnWindowSignal().Connect(onWindowSendEventCallback);
113 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
115 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124 /// The event that is triggered when the View's ControlState is changed.
126 [EditorBrowsable(EditorBrowsableState.Never)]
127 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
129 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
133 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
135 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
136 [EditorBrowsable(EditorBrowsableState.Never)]
137 public bool LayoutSet
146 /// Flag to allow Layouting to be disabled for Views.
147 /// Once a View has a Layout set then any children added to Views from then on will receive
148 /// automatic Layouts.
150 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
151 [EditorBrowsable(EditorBrowsableState.Never)]
152 public static bool LayoutingDisabled { get; set; } = true;
154 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
155 [EditorBrowsable(EditorBrowsableState.Never)]
156 public ViewStyle ViewStyle
160 if (null == viewStyle)
162 ApplyStyle(CreateViewStyle());
170 /// Get/Set the control state.
171 /// Note that the ControlState only available for the classes derived from Control.
172 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
173 /// please set <see cref="EnableControlState"/> to true.
175 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
176 [EditorBrowsable(EditorBrowsableState.Never)]
177 public ControlState ControlState
181 return controlStates;
185 if (controlStates == value)
190 var prevState = controlStates;
192 controlStates = value;
194 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
196 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
198 if (controlStatePropagation)
200 foreach (View child in Children)
202 child.ControlState = value;
206 OnControlStateChanged(changeInfo);
208 ControlStateChangedEvent?.Invoke(this, changeInfo);
212 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
213 [EditorBrowsable(EditorBrowsableState.Never)]
214 public bool ExcludeLayouting
218 return excludeLayouting;
222 excludeLayouting = value;
223 if (Layout != null && Layout.SetPositionByLayout == value)
225 Layout.SetPositionByLayout = !value;
226 Layout.RequestLayout();
231 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
232 [EditorBrowsable(EditorBrowsableState.Never)]
233 public bool IsResourcesCreated
237 return Application.Current.IsResourcesCreated;
241 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
242 [EditorBrowsable(EditorBrowsableState.Never)]
243 public ResourceDictionary XamlResources
247 return Application.Current.XamlResources;
251 Application.Current.XamlResources = value;
256 /// The StyleName, type string.
257 /// The value indicates DALi style name defined in json theme file.
259 /// <since_tizen> 3 </since_tizen>
260 public string StyleName
264 return (string)GetValue(StyleNameProperty);
268 SetValue(StyleNameProperty, value);
269 NotifyPropertyChanged();
274 /// The KeyInputFocus, type bool.
276 [EditorBrowsable(EditorBrowsableState.Never)]
277 public bool KeyInputFocus
281 return (bool)GetValue(KeyInputFocusProperty);
285 SetValue(KeyInputFocusProperty, value);
286 NotifyPropertyChanged();
291 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
295 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
298 /// Animatable - This property can be animated using <c>Animation</c> class.
300 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
304 /// <since_tizen> 3 </since_tizen>
305 public Color BackgroundColor
309 Color temp = (Color)GetValue(BackgroundColorProperty);
310 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
314 SetValue(BackgroundColorProperty, value);
315 if (selectorData != null)
317 selectorData.BackgroundImage?.Reset(this);
318 selectorData.BackgroundColor?.Reset(this);
320 NotifyPropertyChanged();
325 /// The mutually exclusive with "backgroundColor" and "background" type Map.
327 /// <since_tizen> 3 </since_tizen>
328 public string BackgroundImage
332 return (string)GetValue(BackgroundImageProperty);
336 SetValue(BackgroundImageProperty, value);
337 if (selectorData != null)
339 selectorData.BackgroundColor?.Reset(this);
340 selectorData.BackgroundImage?.Reset(this);
342 NotifyPropertyChanged();
347 /// Get or set the border of background image.
349 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
350 [EditorBrowsable(EditorBrowsableState.Never)]
351 public Rectangle BackgroundImageBorder
355 return (Rectangle)GetValue(BackgroundImageBorderProperty);
359 SetValue(BackgroundImageBorderProperty, value);
360 selectorData?.BackgroundImageBorder?.Reset(this);
361 NotifyPropertyChanged();
366 /// The background of view.
368 /// <since_tizen> 3 </since_tizen>
369 public Tizen.NUI.PropertyMap Background
373 return (PropertyMap)GetValue(BackgroundProperty);
377 SetValue(BackgroundProperty, value);
378 NotifyPropertyChanged();
383 /// Describes a shadow as an image for a View.
384 /// It is null by default.
387 /// Getter returns copied instance of current shadow.
390 /// The mutually exclusive with "BoxShadow".
394 /// Animatable - This property can be animated using <c>Animation</c> class.
395 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
397 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
399 /// Animatable sub-property : Offset.
402 [EditorBrowsable(EditorBrowsableState.Never)]
403 public ImageShadow ImageShadow
407 return (ImageShadow)GetValue(ImageShadowProperty);
411 SetValue(ImageShadowProperty, value);
412 if (selectorData != null)
414 selectorData.BoxShadow?.Reset(this);
415 selectorData.ImageShadow?.Reset(this);
417 NotifyPropertyChanged();
422 /// Describes a box shaped shadow drawing for a View.
423 /// It is null by default.
426 /// Gettter returns copied instance of current shadow.
429 /// The mutually exclusive with "ImageShadow".
433 /// Animatable - This property can be animated using <c>Animation</c> class.
434 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
436 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
438 /// Animatable sub-property : Offset, Color, BlurRadius.
441 [EditorBrowsable(EditorBrowsableState.Never)]
442 public Shadow BoxShadow
446 return (Shadow)GetValue(BoxShadowProperty);
450 SetValue(BoxShadowProperty, value);
451 if (selectorData != null)
453 selectorData.ImageShadow?.Reset(this);
454 selectorData.BoxShadow?.Reset(this);
456 NotifyPropertyChanged();
461 /// The radius for the rounded corners of the View.
462 /// This will rounds background and shadow edges.
463 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
467 /// Animatable - This property can be animated using <c>Animation</c> class.
470 [EditorBrowsable(EditorBrowsableState.Never)]
471 public float CornerRadius
475 return (float)GetValue(CornerRadiusProperty);
479 SetValue(CornerRadiusProperty, value);
480 NotifyPropertyChanged();
488 [EditorBrowsable(EditorBrowsableState.Never)]
489 protected bool IsHighlighted
493 return Accessibility.AccessibilityManager.Instance.GetCurrentFocusView() == this;
497 [EditorBrowsable(EditorBrowsableState.Never)]
498 protected static readonly string AccessibilityActivateAction = "activate";
499 [EditorBrowsable(EditorBrowsableState.Never)]
500 protected static readonly string AccessibilityReadingSkippedAction = "ReadingSkipped";
501 [EditorBrowsable(EditorBrowsableState.Never)]
502 protected static readonly string AccessibilityReadingCancelledAction = "ReadingCancelled";
503 [EditorBrowsable(EditorBrowsableState.Never)]
504 protected static readonly string AccessibilityReadingStoppedAction = "ReadingStopped";
505 [EditorBrowsable(EditorBrowsableState.Never)]
506 protected static readonly string AccessibilityReadingPausedAction = "ReadingPaused";
507 [EditorBrowsable(EditorBrowsableState.Never)]
508 protected static readonly string AccessibilityReadingResumedAction = "ReadingResumed";
510 [EditorBrowsable(EditorBrowsableState.Never)]
511 private static readonly string[] AccessibilityActions = {
512 AccessibilityActivateAction,
513 AccessibilityReadingSkippedAction,
514 AccessibilityReadingCancelledAction,
515 AccessibilityReadingStoppedAction,
516 AccessibilityReadingPausedAction,
517 AccessibilityReadingResumedAction,
520 [EditorBrowsable(EditorBrowsableState.Never)]
521 protected virtual string AccessibilityGetName()
526 [EditorBrowsable(EditorBrowsableState.Never)]
527 protected virtual string AccessibilityGetDescription()
532 [EditorBrowsable(EditorBrowsableState.Never)]
533 protected virtual bool AccessibilityDoAction(string name)
538 [EditorBrowsable(EditorBrowsableState.Never)]
539 protected virtual AccessibilityStates AccessibilityCalculateStates()
541 var states = new AccessibilityStates();
542 states.Set(AccessibilityState.Highlightable, this.AccessibilityHighlightable);
543 states.Set(AccessibilityState.Focusable, this.Focusable);
544 states.Set(AccessibilityState.Focused, this.State == States.Focused);
545 states.Set(AccessibilityState.Highlighted, this.IsHighlighted);
546 states.Set(AccessibilityState.Enabled, this.State != States.Disabled);
547 states.Set(AccessibilityState.Sensitive, this.Sensitive);
548 states.Set(AccessibilityState.Animated, this.AccessibilityAnimated);
549 states.Set(AccessibilityState.Visible, true);
550 states.Set(AccessibilityState.Showing, this.Visibility);
551 states.Set(AccessibilityState.Defunct, !this.IsOnWindow);
555 [EditorBrowsable(EditorBrowsableState.Never)]
556 protected virtual int AccessibilityGetActionCount()
558 return AccessibilityActions.Length;
561 [EditorBrowsable(EditorBrowsableState.Never)]
562 protected virtual string AccessibilityGetActionName(int index)
564 if (index >= 0 && index < AccessibilityActions.Length)
565 return AccessibilityActions[index];
570 [EditorBrowsable(EditorBrowsableState.Never)]
571 protected virtual bool AccessibilityShouldReportZeroChildren()
576 [EditorBrowsable(EditorBrowsableState.Never)]
577 protected virtual double AccessibilityGetMinimum()
582 [EditorBrowsable(EditorBrowsableState.Never)]
583 protected virtual double AccessibilityGetCurrent()
588 [EditorBrowsable(EditorBrowsableState.Never)]
589 protected virtual double AccessibilityGetMaximum()
594 [EditorBrowsable(EditorBrowsableState.Never)]
595 protected virtual bool AccessibilitySetCurrent(double value)
600 [EditorBrowsable(EditorBrowsableState.Never)]
601 protected virtual double AccessibilityGetMinimumIncrement()
606 [EditorBrowsable(EditorBrowsableState.Never)]
607 protected virtual bool AccessibilityIsScrollable()
612 [EditorBrowsable(EditorBrowsableState.Never)]
613 protected virtual string AccessibilityGetText(int startOffset, int endOffset)
618 [EditorBrowsable(EditorBrowsableState.Never)]
619 protected virtual int AccessibilityGetCharacterCount()
624 [EditorBrowsable(EditorBrowsableState.Never)]
625 protected virtual int AccessibilityGetCaretOffset()
630 [EditorBrowsable(EditorBrowsableState.Never)]
631 protected virtual bool AccessibilitySetCaretOffset(int offset)
636 [EditorBrowsable(EditorBrowsableState.Never)]
637 protected virtual AccessibilityRange AccessibilityGetTextAtOffset(int offset, TextBoundary boundary)
639 return new AccessibilityRange();
642 [EditorBrowsable(EditorBrowsableState.Never)]
643 protected virtual AccessibilityRange AccessibilityGetSelection(int selectionNum)
645 return new AccessibilityRange();
648 [EditorBrowsable(EditorBrowsableState.Never)]
649 protected virtual bool AccessibilityRemoveSelection(int selectionNum)
654 [EditorBrowsable(EditorBrowsableState.Never)]
655 protected virtual bool AccessibilitySetSelection(int selectionNum, int startOffset, int endOffset)
660 [EditorBrowsable(EditorBrowsableState.Never)]
661 protected virtual bool AccessibilityCopyText(int startPosition, int endPosition)
666 [EditorBrowsable(EditorBrowsableState.Never)]
667 protected virtual bool AccessibilityCutText(int startPosition, int endPosition)
673 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
674 /// It is absolute by default.
675 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
677 [EditorBrowsable(EditorBrowsableState.Never)]
678 public VisualTransformPolicyType CornerRadiusPolicy
680 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
681 set => SetValue(CornerRadiusPolicyProperty, value);
685 /// The current state of the view.
687 /// <since_tizen> 3 </since_tizen>
692 return (States)GetValue(StateProperty);
696 SetValue(StateProperty, value);
697 NotifyPropertyChanged();
702 /// The current sub state of the view.
704 /// <since_tizen> 3 </since_tizen>
705 public States SubState
709 return (States)GetValue(SubStateProperty);
713 SetValue(SubStateProperty, value);
714 NotifyPropertyChanged();
719 /// Displays a tooltip
721 /// <since_tizen> 3 </since_tizen>
722 public Tizen.NUI.PropertyMap Tooltip
726 return (PropertyMap)GetValue(TooltipProperty);
730 SetValue(TooltipProperty, value);
731 NotifyPropertyChanged();
736 /// Displays a tooltip as a text.
738 /// <since_tizen> 3 </since_tizen>
739 public string TooltipText
743 using (var propertyValue = GetProperty(Property.TOOLTIP))
745 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
747 return retrivedValue;
749 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
750 return "error to get TooltipText";
755 var temp = new Tizen.NUI.PropertyValue(value);
756 SetProperty(View.Property.TOOLTIP, temp);
758 NotifyPropertyChanged();
763 /// The Child property of FlexContainer.<br />
764 /// The proportion of the free space in the container, the flex item will receive.<br />
765 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
767 /// <since_tizen> 3 </since_tizen>
768 [Obsolete("Deprecated in API8, will be removed in API10.")]
773 return (float)GetValue(FlexProperty);
777 SetValue(FlexProperty, value);
778 NotifyPropertyChanged();
783 /// The Child property of FlexContainer.<br />
784 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
786 /// <since_tizen> 3 </since_tizen>
787 [Obsolete("Deprecated in API8, will be removed in API10.")]
792 return (int)GetValue(AlignSelfProperty);
796 SetValue(AlignSelfProperty, value);
797 NotifyPropertyChanged();
802 /// The Child property of FlexContainer.<br />
803 /// The space around the flex item.<br />
806 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
808 /// <since_tizen> 3 </since_tizen>
809 [Obsolete("Deprecated in API8, will be removed in API10.")]
810 public Vector4 FlexMargin
814 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
815 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
819 SetValue(FlexMarginProperty, value);
820 NotifyPropertyChanged();
825 /// The top-left cell this child occupies, if not set, the first available cell is used.
828 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
830 /// <since_tizen> 3 </since_tizen>
831 public Vector2 CellIndex
835 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
836 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
840 SetValue(CellIndexProperty, value);
841 NotifyPropertyChanged();
846 /// The number of rows this child occupies, if not set, the default value is 1.
848 /// <since_tizen> 3 </since_tizen>
853 return (float)GetValue(RowSpanProperty);
857 SetValue(RowSpanProperty, value);
858 NotifyPropertyChanged();
863 /// The number of columns this child occupies, if not set, the default value is 1.
865 /// <since_tizen> 3 </since_tizen>
866 public float ColumnSpan
870 return (float)GetValue(ColumnSpanProperty);
874 SetValue(ColumnSpanProperty, value);
875 NotifyPropertyChanged();
880 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
882 /// <since_tizen> 3 </since_tizen>
883 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
887 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
891 SetValue(CellHorizontalAlignmentProperty, value);
892 NotifyPropertyChanged();
897 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
899 /// <since_tizen> 3 </since_tizen>
900 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
904 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
908 SetValue(CellVerticalAlignmentProperty, value);
909 NotifyPropertyChanged();
914 /// The left focusable view.<br />
915 /// This will return null if not set.<br />
916 /// This will also return null if the specified left focusable view is not on a window.<br />
918 /// <since_tizen> 3 </since_tizen>
919 public View LeftFocusableView
921 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
924 return (View)GetValue(LeftFocusableViewProperty);
928 SetValue(LeftFocusableViewProperty, value);
929 NotifyPropertyChanged();
934 /// The right focusable view.<br />
935 /// This will return null if not set.<br />
936 /// This will also return null if the specified right focusable view is not on a window.<br />
938 /// <since_tizen> 3 </since_tizen>
939 public View RightFocusableView
941 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
944 return (View)GetValue(RightFocusableViewProperty);
948 SetValue(RightFocusableViewProperty, value);
949 NotifyPropertyChanged();
954 /// The up focusable view.<br />
955 /// This will return null if not set.<br />
956 /// This will also return null if the specified up focusable view is not on a window.<br />
958 /// <since_tizen> 3 </since_tizen>
959 public View UpFocusableView
961 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
964 return (View)GetValue(UpFocusableViewProperty);
968 SetValue(UpFocusableViewProperty, value);
969 NotifyPropertyChanged();
974 /// The down focusable view.<br />
975 /// This will return null if not set.<br />
976 /// This will also return null if the specified down focusable view is not on a window.<br />
978 /// <since_tizen> 3 </since_tizen>
979 public View DownFocusableView
981 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
984 return (View)GetValue(DownFocusableViewProperty);
988 SetValue(DownFocusableViewProperty, value);
989 NotifyPropertyChanged();
994 /// Whether the view should be focusable by keyboard navigation.
996 /// <since_tizen> 3 </since_tizen>
997 public bool Focusable
1001 SetValue(FocusableProperty, value);
1002 NotifyPropertyChanged();
1006 return (bool)GetValue(FocusableProperty);
1011 /// Retrieves the position of the view.<br />
1012 /// The coordinates are relative to the view's parent.<br />
1014 /// <since_tizen> 3 </since_tizen>
1015 public Position CurrentPosition
1019 return GetCurrentPosition();
1024 /// Sets the size of a view for the width and the height.<br />
1025 /// Geometry can be scaled to fit within this area.<br />
1026 /// This does not interfere with the view's scale factor.<br />
1027 /// The views default depth is the minimum of width and height.<br />
1030 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
1031 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
1033 /// <since_tizen> 3 </since_tizen>
1034 public Size2D Size2D
1038 Size2D temp = (Size2D)GetValue(Size2DProperty);
1039 int width = temp.Width;
1040 int height = temp.Height;
1042 if (this.Layout == null)
1044 if (width < 0) { width = 0; }
1045 if (height < 0) { height = 0; }
1048 return new Size2D(OnSize2DChanged, width, height);
1052 SetValue(Size2DProperty, value);
1054 NotifyPropertyChanged();
1059 /// Retrieves the size of the view.<br />
1060 /// The coordinates are relative to the view's parent.<br />
1062 /// <since_tizen> 3 </since_tizen>
1063 public Size2D CurrentSize
1067 return GetCurrentSize();
1072 /// Retrieves and sets the view's opacity.<br />
1074 /// <since_tizen> 3 </since_tizen>
1075 public float Opacity
1079 return (float)GetValue(OpacityProperty);
1083 SetValue(OpacityProperty, value);
1084 selectorData?.Opacity?.Reset(this);
1085 NotifyPropertyChanged();
1090 /// Sets the position of the view for X and Y.<br />
1091 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1092 /// If the position inheritance is disabled, sets the world position.<br />
1095 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1096 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1098 /// <since_tizen> 3 </since_tizen>
1099 public Position2D Position2D
1103 Position2D temp = (Position2D)GetValue(Position2DProperty);
1104 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1108 SetValue(Position2DProperty, value);
1109 NotifyPropertyChanged();
1114 /// Retrieves the screen postion of the view.<br />
1116 /// <since_tizen> 3 </since_tizen>
1117 public Vector2 ScreenPosition
1121 Vector2 temp = new Vector2(0.0f, 0.0f);
1122 var pValue = GetProperty(View.Property.ScreenPosition);
1130 /// Determines whether the pivot point should be used to determine the position of the view.
1131 /// This is false by default.
1133 /// <remarks>If false, then the top-left of the view is used for the position.
1134 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1136 /// <since_tizen> 3 </since_tizen>
1137 public bool PositionUsesPivotPoint
1141 return (bool)GetValue(PositionUsesPivotPointProperty);
1145 SetValue(PositionUsesPivotPointProperty, value);
1146 NotifyPropertyChanged();
1151 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1153 /// <since_tizen> 3 </since_tizen>
1154 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1156 "View view = new View(); " +
1157 "view.PivotPoint = PivotPoint.Center; " +
1158 "view.PositionUsesPivotPoint = true;" +
1159 " Deprecated in API5: Will be removed in API8")]
1160 [EditorBrowsable(EditorBrowsableState.Never)]
1161 public bool PositionUsesAnchorPoint
1166 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1167 pValue.Get(out temp);
1173 var temp = new Tizen.NUI.PropertyValue(value);
1174 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1176 NotifyPropertyChanged();
1181 /// Queries whether the view is connected to the stage.<br />
1182 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1184 /// <since_tizen> 3 </since_tizen>
1185 public bool IsOnWindow
1194 /// Gets the depth in the hierarchy for the view.
1196 /// <since_tizen> 3 </since_tizen>
1197 public int HierarchyDepth
1201 return GetHierarchyDepth();
1206 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1209 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1210 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1211 /// The values set by this property will likely change.
1213 /// <since_tizen> 3 </since_tizen>
1214 public int SiblingOrder
1218 return (int)GetValue(SiblingOrderProperty);
1222 SetValue(SiblingOrderProperty, value);
1224 LayoutGroup layout = Layout as LayoutGroup;
1225 layout?.ChangeLayoutSiblingOrder(value);
1227 NotifyPropertyChanged();
1232 /// Returns the natural size of the view.
1235 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1237 /// <since_tizen> 5 </since_tizen>
1238 public Vector3 NaturalSize
1242 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1243 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1249 /// Returns the natural size (Size2D) of the view.
1252 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1254 /// <since_tizen> 4 </since_tizen>
1255 public Size2D NaturalSize2D
1259 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1260 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1262 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1269 /// Gets or sets the origin of a view within its parent's area.<br />
1270 /// 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 />
1271 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1272 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1274 /// <pre>The view has been initialized.</pre>
1275 /// <since_tizen> 3 </since_tizen>
1276 public Position ParentOrigin
1280 Position tmp = (Position)GetValue(ParentOriginProperty);
1281 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1285 SetValue(ParentOriginProperty, value);
1286 NotifyPropertyChanged();
1291 /// Gets or sets the anchor-point of a view.<br />
1292 /// 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 />
1293 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1294 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1295 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1296 /// <pre>The view has been initialized.</pre>
1299 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1301 /// <since_tizen> 3 </since_tizen>
1302 public Position PivotPoint
1306 Position tmp = (Position)GetValue(PivotPointProperty);
1307 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1311 SetValue(PivotPointProperty, value);
1312 NotifyPropertyChanged();
1317 /// Gets or sets the size width of the view.
1321 /// Animatable - This property can be animated using <c>Animation</c> class.
1324 /// <since_tizen> 3 </since_tizen>
1325 public float SizeWidth
1329 return (float)GetValue(SizeWidthProperty);
1333 SetValue(SizeWidthProperty, value);
1334 NotifyPropertyChanged();
1339 /// Gets or sets the size height of the view.
1343 /// Animatable - This property can be animated using <c>Animation</c> class.
1346 /// <since_tizen> 3 </since_tizen>
1347 public float SizeHeight
1351 return (float)GetValue(SizeHeightProperty);
1355 SetValue(SizeHeightProperty, value);
1356 NotifyPropertyChanged();
1361 /// Gets or sets the position of the view.<br />
1362 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1363 /// If the position inheritance is disabled, sets the world position.<br />
1367 /// Animatable - This property can be animated using <c>Animation</c> class.
1369 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1371 /// <since_tizen> 3 </since_tizen>
1372 public Position Position
1376 Position tmp = (Position)GetValue(PositionProperty);
1377 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1381 SetValue(PositionProperty, value);
1382 NotifyPropertyChanged();
1387 /// Gets or sets the position X of the view.
1391 /// Animatable - This property can be animated using <c>Animation</c> class.
1394 /// <since_tizen> 3 </since_tizen>
1395 public float PositionX
1399 return (float)GetValue(PositionXProperty);
1403 SetValue(PositionXProperty, value);
1404 NotifyPropertyChanged();
1409 /// Gets or sets the position Y of the view.
1413 /// Animatable - This property can be animated using <c>Animation</c> class.
1416 /// <since_tizen> 3 </since_tizen>
1417 public float PositionY
1421 return (float)GetValue(PositionYProperty);
1425 SetValue(PositionYProperty, value);
1426 NotifyPropertyChanged();
1431 /// Gets or sets the position Z of the view.
1435 /// Animatable - This property can be animated using <c>Animation</c> class.
1438 /// <since_tizen> 3 </since_tizen>
1439 public float PositionZ
1443 return (float)GetValue(PositionZProperty);
1447 SetValue(PositionZProperty, value);
1448 NotifyPropertyChanged();
1453 /// Gets or sets the world position of the view.
1455 /// <since_tizen> 3 </since_tizen>
1456 public Vector3 WorldPosition
1460 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1461 var pValue = GetProperty(View.Property.WorldPosition);
1469 /// Gets or sets the orientation of the view.<br />
1470 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1474 /// This is an asynchronous method.
1477 /// Animatable - This property can be animated using <c>Animation</c> class.
1480 /// <since_tizen> 3 </since_tizen>
1481 public Rotation Orientation
1485 return (Rotation)GetValue(OrientationProperty);
1489 SetValue(OrientationProperty, value);
1490 NotifyPropertyChanged();
1495 /// Gets or sets the world orientation of the view.<br />
1497 /// <since_tizen> 3 </since_tizen>
1498 public Rotation WorldOrientation
1502 Rotation temp = new Rotation();
1503 var pValue = GetProperty(View.Property.WorldOrientation);
1511 /// Gets or sets the scale factor applied to the view.<br />
1515 /// Animatable - This property can be animated using <c>Animation</c> class.
1517 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1519 /// <since_tizen> 3 </since_tizen>
1520 public Vector3 Scale
1524 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1525 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1529 SetValue(ScaleProperty, value);
1530 NotifyPropertyChanged();
1535 /// Gets or sets the scale X factor applied to the view.
1539 /// Animatable - This property can be animated using <c>Animation</c> class.
1542 /// <since_tizen> 3 </since_tizen>
1547 return (float)GetValue(ScaleXProperty);
1551 SetValue(ScaleXProperty, value);
1552 NotifyPropertyChanged();
1557 /// Gets or sets the scale Y factor applied to the view.
1561 /// Animatable - This property can be animated using <c>Animation</c> class.
1564 /// <since_tizen> 3 </since_tizen>
1569 return (float)GetValue(ScaleYProperty);
1573 SetValue(ScaleYProperty, value);
1574 NotifyPropertyChanged();
1579 /// Gets or sets the scale Z factor applied to the view.
1583 /// Animatable - This property can be animated using <c>Animation</c> class.
1586 /// <since_tizen> 3 </since_tizen>
1591 return (float)GetValue(ScaleZProperty);
1595 SetValue(ScaleZProperty, value);
1596 NotifyPropertyChanged();
1601 /// Gets the world scale of the view.
1603 /// <since_tizen> 3 </since_tizen>
1604 public Vector3 WorldScale
1608 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1609 var pValue = GetProperty(View.Property.WorldScale);
1617 /// Retrieves the visibility flag of the view.
1621 /// If the view is not visible, then the view and its children will not be rendered.
1622 /// 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.
1625 /// Animatable - This property can be animated using <c>Animation</c> class.
1628 /// <since_tizen> 3 </since_tizen>
1629 public bool Visibility
1634 var pValue = GetProperty(View.Property.VISIBLE);
1635 pValue.Get(out temp);
1642 /// Gets the view's world color.
1644 /// <since_tizen> 3 </since_tizen>
1645 public Vector4 WorldColor
1649 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1650 var pValue = GetProperty(View.Property.WorldColor);
1658 /// Gets or sets the view's name.
1660 /// <since_tizen> 3 </since_tizen>
1665 return (string)GetValue(NameProperty);
1669 SetValue(NameProperty, value);
1670 NotifyPropertyChanged();
1675 /// Get the number of children held by the view.
1677 /// <since_tizen> 3 </since_tizen>
1678 public new uint ChildCount
1682 return Convert.ToUInt32(Children.Count);
1687 /// Gets the view's ID.
1690 /// <since_tizen> 3 </since_tizen>
1700 /// Gets or sets the status of whether the view should emit touch or hover signals.
1702 /// <since_tizen> 3 </since_tizen>
1703 public bool Sensitive
1707 return (bool)GetValue(SensitiveProperty);
1711 SetValue(SensitiveProperty, value);
1712 NotifyPropertyChanged();
1717 /// 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.
1719 /// <since_tizen> 3 </since_tizen>
1720 public bool LeaveRequired
1724 return (bool)GetValue(LeaveRequiredProperty);
1728 SetValue(LeaveRequiredProperty, value);
1729 NotifyPropertyChanged();
1734 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1736 /// <since_tizen> 3 </since_tizen>
1737 public bool InheritOrientation
1741 return (bool)GetValue(InheritOrientationProperty);
1745 SetValue(InheritOrientationProperty, value);
1746 NotifyPropertyChanged();
1751 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1753 /// <since_tizen> 3 </since_tizen>
1754 public bool InheritScale
1758 return (bool)GetValue(InheritScaleProperty);
1762 SetValue(InheritScaleProperty, value);
1763 NotifyPropertyChanged();
1768 /// Gets or sets the status of how the view and its children should be drawn.<br />
1769 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1770 /// 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 />
1771 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1772 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1773 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1775 /// <since_tizen> 3 </since_tizen>
1776 public DrawModeType DrawMode
1780 return (DrawModeType)GetValue(DrawModeProperty);
1784 SetValue(DrawModeProperty, value);
1785 NotifyPropertyChanged();
1790 /// Gets or sets the relative to parent size factor of the view.<br />
1791 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1792 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1795 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1797 /// <since_tizen> 3 </since_tizen>
1798 public Vector3 SizeModeFactor
1802 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1803 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1807 SetValue(SizeModeFactorProperty, value);
1808 NotifyPropertyChanged();
1813 /// Gets or sets the width resize policy to be used.
1815 /// <since_tizen> 3 </since_tizen>
1816 public ResizePolicyType WidthResizePolicy
1820 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1824 SetValue(WidthResizePolicyProperty, value);
1825 NotifyPropertyChanged();
1830 /// Gets or sets the height resize policy to be used.
1832 /// <since_tizen> 3 </since_tizen>
1833 public ResizePolicyType HeightResizePolicy
1837 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1841 SetValue(HeightResizePolicyProperty, value);
1842 NotifyPropertyChanged();
1847 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1848 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1850 /// <since_tizen> 3 </since_tizen>
1851 public SizeScalePolicyType SizeScalePolicy
1855 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1859 SetValue(SizeScalePolicyProperty, value);
1860 NotifyPropertyChanged();
1865 /// Gets or sets the status of whether the width size is dependent on the height size.
1867 /// <since_tizen> 3 </since_tizen>
1868 public bool WidthForHeight
1872 return (bool)GetValue(WidthForHeightProperty);
1876 SetValue(WidthForHeightProperty, value);
1877 NotifyPropertyChanged();
1882 /// Gets or sets the status of whether the height size is dependent on the width size.
1884 /// <since_tizen> 3 </since_tizen>
1885 public bool HeightForWidth
1889 return (bool)GetValue(HeightForWidthProperty);
1893 SetValue(HeightForWidthProperty, value);
1894 NotifyPropertyChanged();
1899 /// Gets or sets the padding for use in layout.
1902 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1904 /// <since_tizen> 5 </since_tizen>
1905 public Extents Padding
1909 // If View has a Layout then padding in stored in the base Layout class
1912 return Layout.Padding;
1916 Extents temp = (Extents)GetValue(PaddingProperty);
1917 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1919 // Two return points to prevent creating a zeroed Extent native object before assignment
1923 Extents padding = value;
1926 // Layout set so store Padding in LayoutItem instead of in View.
1927 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1928 // the position and sizes measure in the Layouting.
1929 Layout.Padding = value;
1930 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1931 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1932 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1934 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1938 SetValue(PaddingProperty, padding);
1939 NotifyPropertyChanged();
1944 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1946 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1948 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1950 /// <since_tizen> 3 </since_tizen>
1951 public Size2D MinimumSize
1955 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1956 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1962 throw new ArgumentNullException(nameof(value));
1966 // Note: it only works if minimum size is >= than natural size.
1967 // To force the size it should be done through the width&height spec or Size2D.
1968 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1969 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1970 layout.RequestLayout();
1972 SetValue(MinimumSizeProperty, value);
1973 NotifyPropertyChanged();
1978 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1981 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1983 /// <since_tizen> 3 </since_tizen>
1984 public Size2D MaximumSize
1988 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1989 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1993 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1994 // MATCH_PARENT spec + parent container size can be used to limit
1997 layout.RequestLayout();
1999 SetValue(MaximumSizeProperty, value);
2000 NotifyPropertyChanged();
2005 /// Gets or sets whether a child view inherits it's parent's position.<br />
2006 /// Default is to inherit.<br />
2007 /// 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 />
2009 /// <since_tizen> 3 </since_tizen>
2010 public bool InheritPosition
2014 return (bool)GetValue(InheritPositionProperty);
2018 SetValue(InheritPositionProperty, value);
2019 NotifyPropertyChanged();
2024 /// Gets or sets the clipping behavior (mode) of it's children.
2026 /// <since_tizen> 3 </since_tizen>
2027 public ClippingModeType ClippingMode
2031 return (ClippingModeType)GetValue(ClippingModeProperty);
2035 SetValue(ClippingModeProperty, value);
2036 NotifyPropertyChanged();
2041 /// Gets the number of renderers held by the view.
2043 /// <since_tizen> 3 </since_tizen>
2044 public uint RendererCount
2048 return GetRendererCount();
2053 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2056 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2058 /// <since_tizen> 3 </since_tizen>
2059 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2061 "View view = new View(); " +
2062 "view.PivotPoint = PivotPoint.Center; " +
2063 "view.PositionUsesPivotPoint = true;")]
2064 [EditorBrowsable(EditorBrowsableState.Never)]
2065 public Position AnchorPoint
2069 Position temp = new Position(0.0f, 0.0f, 0.0f);
2070 var pValue = GetProperty(View.Property.AnchorPoint);
2073 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2079 var temp = new Tizen.NUI.PropertyValue(value);
2080 SetProperty(View.Property.AnchorPoint, temp);
2082 NotifyPropertyChanged();
2087 /// Sets the size of a view for the width, the height and the depth.<br />
2088 /// Geometry can be scaled to fit within this area.<br />
2089 /// This does not interfere with the view's scale factor.<br />
2090 /// The views default depth is the minimum of width and height.<br />
2094 /// Animatable - This property can be animated using <c>Animation</c> class.
2096 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2098 /// <since_tizen> 5 </since_tizen>
2103 Size tmp = (Size)GetValue(SizeProperty);
2104 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2108 SetValue(SizeProperty, value);
2109 NotifyPropertyChanged();
2114 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2116 /// <since_tizen> 3 </since_tizen>
2117 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2119 "Container parent = view.GetParent(); " +
2120 "View view = parent as View;")]
2121 [EditorBrowsable(EditorBrowsableState.Never)]
2122 public new View Parent
2127 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2128 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2129 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2131 if (basehandle is Layer layer)
2133 ret = new View(Layer.getCPtr(layer).Handle, false);
2134 NUILog.Error("This Parent property is deprecated, should do not be used");
2138 ret = basehandle as View;
2141 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2142 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2144 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2150 /// Gets/Sets whether inherit parent's the layout Direction.
2152 /// <since_tizen> 4 </since_tizen>
2153 public bool InheritLayoutDirection
2157 return (bool)GetValue(InheritLayoutDirectionProperty);
2161 SetValue(InheritLayoutDirectionProperty, value);
2162 NotifyPropertyChanged();
2167 /// Gets/Sets the layout Direction.
2169 /// <since_tizen> 4 </since_tizen>
2170 public ViewLayoutDirectionType LayoutDirection
2174 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2178 SetValue(LayoutDirectionProperty, value);
2179 NotifyPropertyChanged();
2180 layout?.RequestLayout();
2185 /// Gets or sets the Margin for use in layout.
2188 /// Margin property is supported by Layout algorithms and containers.
2189 /// Please Set Layout if you want to use Margin property.
2190 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2192 /// <since_tizen> 4 </since_tizen>
2193 public Extents Margin
2197 // If View has a Layout then margin is stored in Layout.
2200 return Layout.Margin;
2204 // If Layout not set then return margin stored in View.
2205 Extents temp = (Extents)GetValue(MarginProperty);
2206 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2208 // Two return points to prevent creating a zeroed Extent native object before assignment
2214 // Layout set so store Margin in LayoutItem instead of View.
2215 // If View stores the Margin too then the Legacy Size Negotiation will
2216 // overwrite the position and size values measured in the Layouting.
2217 Layout.Margin = value;
2218 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2219 layout?.RequestLayout();
2223 SetValue(MarginProperty, value);
2225 NotifyPropertyChanged();
2226 layout?.RequestLayout();
2231 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2233 /// <since_tizen> 6 </since_tizen>
2234 public int WidthSpecification
2242 if (value == widthPolicy)
2245 widthPolicy = value;
2246 if (widthPolicy >= 0)
2248 if (heightPolicy >= 0) // Policy an exact value
2250 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2251 Size2D = new Size2D(widthPolicy, heightPolicy);
2254 layout?.RequestLayout();
2259 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2261 /// <since_tizen> 6 </since_tizen>
2262 public int HeightSpecification
2266 return heightPolicy;
2270 if (value == heightPolicy)
2273 heightPolicy = value;
2274 if (heightPolicy >= 0)
2276 if (widthPolicy >= 0) // Policy an exact value
2278 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2279 Size2D = new Size2D(widthPolicy, heightPolicy);
2282 layout?.RequestLayout();
2287 /// Gets the List of transitions for this View.
2289 /// <since_tizen> 6 </since_tizen>
2290 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2294 if (layoutTransitions == null)
2296 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2298 return layoutTransitions;
2303 /// Set a layout transitions for this View.
2305 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2307 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2309 /// <since_tizen> 6 </since_tizen>
2310 public LayoutTransition LayoutTransition
2314 return layoutTransition;
2320 throw new global::System.ArgumentNullException(nameof(value));
2322 if (layoutTransitions == null)
2324 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2327 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2329 AttachTransitionsToChildren(value);
2331 layoutTransition = value;
2336 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2339 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2341 /// <since_tizen> 4 </since_tizen>
2342 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2343 [EditorBrowsable(EditorBrowsableState.Never)]
2344 public Extents PaddingEX
2348 Extents temp = new Extents(0, 0, 0, 0);
2349 var pValue = GetProperty(View.Property.PADDING);
2352 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2358 var temp = new Tizen.NUI.PropertyValue(value);
2359 SetProperty(View.Property.PADDING, temp);
2361 NotifyPropertyChanged();
2362 layout?.RequestLayout();
2367 /// The Color of View. This is an RGBA value.
2371 /// Animatable - This property can be animated using <c>Animation</c> class.
2373 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2375 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2376 [EditorBrowsable(EditorBrowsableState.Never)]
2381 Color temp = (Color)GetValue(ColorProperty);
2382 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2386 SetValue(ColorProperty, value);
2387 selectorData?.Color?.Reset(this);
2388 NotifyPropertyChanged();
2393 /// Set the layout on this View. Replaces any existing Layout.
2395 /// <since_tizen> 6 </since_tizen>
2396 public LayoutItem Layout
2404 // Do nothing if layout provided is already set on this View.
2405 if (value == layout)
2410 LayoutingDisabled = false;
2413 // If new layout being set already has a owner then that owner receives a replacement default layout.
2414 // First check if the layout to be set already has a owner.
2415 if (value?.Owner != null)
2417 // Previous owner of the layout gets a default layout as a replacement.
2418 value.Owner.Layout = new AbsoluteLayout();
2420 // Copy Margin and Padding to replacement LayoutGroup.
2421 if (value.Owner.Layout != null)
2423 value.Owner.Layout.Margin = value.Margin;
2424 value.Owner.Layout.Padding = value.Padding;
2428 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2429 // View if no replacement. Previously margin and padding values would have been moved from
2430 // the View to the layout.
2431 if (layout != null) // Existing layout
2435 // Existing layout being replaced so copy over margin and padding values.
2436 value.Margin = layout.Margin;
2437 value.Padding = layout.Padding;
2441 // Layout not being replaced so restore margin and padding to View.
2442 SetValue(MarginProperty, layout.Margin);
2443 SetValue(PaddingProperty, layout.Padding);
2444 NotifyPropertyChanged();
2449 // First Layout to be added to the View hence copy
2451 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2454 if (false == (this is TextLabel))
2456 if (Margin.Top != 0 || Margin.Bottom != 0 || Margin.Start != 0 || Margin.End != 0)
2458 // If View already has a margin set then store it in Layout instead.
2459 value.Margin = Margin;
2460 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2461 NotifyPropertyChanged();
2464 if (Padding.Top != 0 || Padding.Bottom != 0 || Padding.Start != 0 || Padding.End != 0)
2466 // If View already has a padding set then store it in Layout instead.
2467 value.Padding = Padding;
2468 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2469 NotifyPropertyChanged();
2476 // Remove existing layout from it's parent layout group.
2479 value.SetPositionByLayout = !excludeLayouting;
2481 // Set layout to this view
2487 /// The weight of the View, used to share available space in a layout with siblings.
2489 /// <since_tizen> 6 </since_tizen>
2499 layout?.RequestLayout();
2504 /// Whether to load the BackgroundImage synchronously.
2505 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2506 /// Note: For Normal Quad images only.
2508 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2509 [EditorBrowsable(EditorBrowsableState.Never)]
2510 public bool BackgroundImageSynchronosLoading
2514 return backgroundImageSynchronosLoading;
2518 backgroundImageSynchronosLoading = value;
2520 string bgUrl = null;
2521 var pValue = Background.Find(ImageVisualProperty.URL);
2522 pValue?.Get(out bgUrl);
2525 if (!string.IsNullOrEmpty(bgUrl))
2527 PropertyMap bgMap = this.Background;
2528 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2529 bgMap.Add("synchronousLoading", temp);
2536 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2537 [EditorBrowsable(EditorBrowsableState.Never)]
2538 public Vector2 UpdateSizeHint
2542 return (Vector2)GetValue(UpdateSizeHintProperty);
2546 SetValue(UpdateSizeHintProperty, value);
2547 NotifyPropertyChanged();
2552 /// Enable/Disable ControlState propagation for children.
2553 /// It is false by default.
2554 /// If the View needs to share ControlState with descendants, please set it true.
2555 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2557 [EditorBrowsable(EditorBrowsableState.Never)]
2558 public bool EnableControlStatePropagation
2560 get => controlStatePropagation;
2563 controlStatePropagation = value;
2565 foreach (View child in Children)
2567 child.EnableControlStatePropagation = value;
2573 /// By default, it is false in View, true in Control.
2574 /// Note that if the value is true, the View will be a touch receptor.
2576 [EditorBrowsable(EditorBrowsableState.Never)]
2577 public bool EnableControlState
2581 return (bool)GetValue(EnableControlStateProperty);
2585 SetValue(EnableControlStateProperty, value);
2590 /// Whether the actor grab all touches even if touch leaves its boundary.
2592 /// <returns>true, if it grab all touch after start</returns>
2593 [EditorBrowsable(EditorBrowsableState.Never)]
2594 public bool GrabTouchAfterLeave
2599 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2600 pValue.Get(out temp);
2606 var temp = new Tizen.NUI.PropertyValue(value);
2607 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2609 NotifyPropertyChanged();
2614 /// Determines which blend equation will be used to render renderers of this actor.
2616 /// <returns>blend equation enum currently assigned</returns>
2617 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2618 [EditorBrowsable(EditorBrowsableState.Never)]
2619 public BlendEquationType BlendEquation
2624 var pValue = GetProperty(View.Property.BlendEquation);
2625 pValue.Get(out temp);
2627 return (BlendEquationType)temp;
2631 var temp = new Tizen.NUI.PropertyValue((int)value);
2632 SetProperty(View.Property.BlendEquation, temp);
2634 NotifyPropertyChanged();
2639 /// If the value is true, the View will change its style as the theme changes.
2640 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2642 [EditorBrowsable(EditorBrowsableState.Never)]
2643 public bool ThemeChangeSensitive
2645 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2646 set => SetValue(ThemeChangeSensitiveProperty, value);
2650 /// Create Style, it is abstract function and must be override.
2652 [EditorBrowsable(EditorBrowsableState.Never)]
2653 protected virtual ViewStyle CreateViewStyle()
2655 return new ViewStyle();
2659 /// Called after the View's ControlStates changed.
2661 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2662 [EditorBrowsable(EditorBrowsableState.Never)]
2663 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2669 [EditorBrowsable(EditorBrowsableState.Never)]
2670 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2675 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2676 [EditorBrowsable(EditorBrowsableState.Never)]
2677 public virtual void ApplyStyle(ViewStyle viewStyle)
2679 if (null == viewStyle || this.viewStyle == viewStyle) return;
2681 this.viewStyle = viewStyle;
2683 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2689 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2691 if (bindablePropertyOfView == null)
2696 var dirtyProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2697 viewStyle.DirtyProperties.CopyTo(dirtyProperties);
2699 foreach (var sourceProperty in dirtyProperties)
2701 var sourceValue = viewStyle.GetValue(sourceProperty);
2703 if (sourceValue == null)
2708 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2710 if (destinationProperty != null)
2712 SetValue(destinationProperty, sourceValue);
2718 /// Used to restore the transition.
2720 [EditorBrowsable(EditorBrowsableState.Never)]
2721 public IList<Transition> TransitionList
2724 } = new List<Transition>();
2727 /// Get whether the View is culled or not.
2728 /// True means that the View is out of the view frustum.
2731 /// Hidden-API (Inhouse-API).
2733 [EditorBrowsable(EditorBrowsableState.Never)]
2739 var pValue = GetProperty(View.Property.Culled);
2740 pValue.Get(out temp);