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;
53 /// Creates a new instance of a view.
55 /// <since_tizen> 3 </since_tizen>
56 public View() : this(Interop.View.New(), true)
58 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
61 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
62 [EditorBrowsable(EditorBrowsableState.Never)]
63 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
68 /// Create a new instance of a View with setting the status of shown or hidden.
70 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
71 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
72 [EditorBrowsable(EditorBrowsableState.Never)]
73 public View(bool shown) : this(Interop.View.New(), true)
75 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
79 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
81 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
87 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
90 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
92 InitializeStyle(viewStyle);
95 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
99 PositionUsesPivotPoint = false;
102 onWindowSendEventCallback = SendViewAddedEventToWindow;
103 this.OnWindowSignal().Connect(onWindowSendEventCallback);
111 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
122 /// The event that is triggered when the View's ControlState is changed.
124 [EditorBrowsable(EditorBrowsableState.Never)]
125 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
127 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
131 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
133 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
134 [EditorBrowsable(EditorBrowsableState.Never)]
135 public bool LayoutSet
144 /// Flag to allow Layouting to be disabled for Views.
145 /// Once a View has a Layout set then any children added to Views from then on will receive
146 /// automatic Layouts.
148 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
149 [EditorBrowsable(EditorBrowsableState.Never)]
150 public static bool LayoutingDisabled { get; set; } = true;
153 /// The style instance applied to this view.
154 /// Note that please do not modify the ViewStyle.
155 /// Modifying ViewStyle will affect other views with same ViewStyle.
157 [EditorBrowsable(EditorBrowsableState.Never)]
158 protected ViewStyle ViewStyle
162 if (null == viewStyle)
164 ApplyStyle(CreateViewStyle());
172 /// Get/Set the control state.
173 /// Note that the ControlState only available for the classes derived from Control.
174 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
175 /// please set <see cref="EnableControlState"/> to true.
177 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
178 [EditorBrowsable(EditorBrowsableState.Never)]
179 public ControlState ControlState
183 return controlStates;
187 if (controlStates == value)
192 var prevState = controlStates;
194 controlStates = value;
196 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
198 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
200 if (controlStatePropagation)
202 foreach (View child in Children)
204 child.ControlState = value;
208 OnControlStateChanged(changeInfo);
210 ControlStateChangedEvent?.Invoke(this, changeInfo);
215 /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not.
217 /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API.
218 [EditorBrowsable(EditorBrowsableState.Never)]
219 public bool ExcludeLayouting
223 return excludeLayouting;
227 excludeLayouting = value;
228 if (Layout != null && Layout.SetPositionByLayout == value)
230 Layout.SetPositionByLayout = !value;
231 Layout.RequestLayout();
236 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
237 [EditorBrowsable(EditorBrowsableState.Never)]
238 public bool IsResourcesCreated
242 return Application.Current.IsResourcesCreated;
246 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
247 [EditorBrowsable(EditorBrowsableState.Never)]
248 public ResourceDictionary XamlResources
252 return Application.Current.XamlResources;
256 Application.Current.XamlResources = value;
261 /// The StyleName, type string.
262 /// The value indicates DALi style name defined in json theme file.
264 /// <since_tizen> 3 </since_tizen>
265 public string StyleName
269 return (string)GetValue(StyleNameProperty);
273 SetValue(StyleNameProperty, value);
274 NotifyPropertyChanged();
279 /// The KeyInputFocus, type bool.
281 [EditorBrowsable(EditorBrowsableState.Never)]
282 public bool KeyInputFocus
286 return (bool)GetValue(KeyInputFocusProperty);
290 SetValue(KeyInputFocusProperty, value);
291 NotifyPropertyChanged();
296 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
300 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
303 /// Animatable - This property can be animated using <c>Animation</c> class.
305 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
309 /// <since_tizen> 3 </since_tizen>
310 public Color BackgroundColor
314 Color temp = (Color)GetValue(BackgroundColorProperty);
315 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
319 SetValue(BackgroundColorProperty, value);
320 if (selectorData != null)
322 selectorData.BackgroundImage?.Reset(this);
323 selectorData.BackgroundColor?.Reset(this);
325 NotifyPropertyChanged();
330 /// The mutually exclusive with "backgroundColor" and "background" type Map.
332 /// <since_tizen> 3 </since_tizen>
333 public string BackgroundImage
337 return (string)GetValue(BackgroundImageProperty);
341 SetValue(BackgroundImageProperty, value);
342 if (selectorData != null)
344 selectorData.BackgroundColor?.Reset(this);
345 selectorData.BackgroundImage?.Reset(this);
347 NotifyPropertyChanged();
352 /// Get or set the border of background image.
354 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
355 [EditorBrowsable(EditorBrowsableState.Never)]
356 public Rectangle BackgroundImageBorder
360 return (Rectangle)GetValue(BackgroundImageBorderProperty);
364 SetValue(BackgroundImageBorderProperty, value);
365 selectorData?.BackgroundImageBorder?.Reset(this);
366 NotifyPropertyChanged();
371 /// The background of view.
373 /// <since_tizen> 3 </since_tizen>
374 public Tizen.NUI.PropertyMap Background
378 return (PropertyMap)GetValue(BackgroundProperty);
382 SetValue(BackgroundProperty, value);
383 NotifyPropertyChanged();
388 /// Describes a shadow as an image for a View.
389 /// It is null by default.
392 /// Getter returns copied instance of current shadow.
395 /// The mutually exclusive with "BoxShadow".
399 /// Animatable - This property can be animated using <c>Animation</c> class.
400 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
402 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
404 /// Animatable sub-property : Offset.
407 [EditorBrowsable(EditorBrowsableState.Never)]
408 public ImageShadow ImageShadow
412 return (ImageShadow)GetValue(ImageShadowProperty);
416 SetValue(ImageShadowProperty, value);
417 if (selectorData != null)
419 selectorData.BoxShadow?.Reset(this);
420 selectorData.ImageShadow?.Reset(this);
422 NotifyPropertyChanged();
427 /// Describes a box shaped shadow drawing for a View.
428 /// It is null by default.
431 /// Getter returns copied instance of current shadow.
434 /// The mutually exclusive with "ImageShadow".
438 /// Animatable - This property can be animated using <c>Animation</c> class.
439 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
441 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
443 /// Animatable sub-property : Offset, Color, BlurRadius.
446 [EditorBrowsable(EditorBrowsableState.Never)]
447 public Shadow BoxShadow
451 return (Shadow)GetValue(BoxShadowProperty);
455 SetValue(BoxShadowProperty, value);
456 if (selectorData != null)
458 selectorData.ImageShadow?.Reset(this);
459 selectorData.BoxShadow?.Reset(this);
461 NotifyPropertyChanged();
466 /// The radius for the rounded corners of the View.
467 /// This will rounds background and shadow edges.
468 /// 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).
469 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
473 /// Animatable - This property can be animated using <c>Animation</c> class.
476 [EditorBrowsable(EditorBrowsableState.Never)]
477 public Vector4 CornerRadius
481 return (Vector4)GetValue(CornerRadiusProperty);
485 SetValue(CornerRadiusProperty, value);
486 NotifyPropertyChanged();
494 [EditorBrowsable(EditorBrowsableState.Never)]
495 protected bool IsHighlighted
499 return Accessibility.AccessibilityManager.Instance.GetCurrentFocusView() == this;
503 [EditorBrowsable(EditorBrowsableState.Never)]
504 protected static readonly string AccessibilityActivateAction = "activate";
505 [EditorBrowsable(EditorBrowsableState.Never)]
506 protected static readonly string AccessibilityReadingSkippedAction = "ReadingSkipped";
507 [EditorBrowsable(EditorBrowsableState.Never)]
508 protected static readonly string AccessibilityReadingCancelledAction = "ReadingCancelled";
509 [EditorBrowsable(EditorBrowsableState.Never)]
510 protected static readonly string AccessibilityReadingStoppedAction = "ReadingStopped";
511 [EditorBrowsable(EditorBrowsableState.Never)]
512 protected static readonly string AccessibilityReadingPausedAction = "ReadingPaused";
513 [EditorBrowsable(EditorBrowsableState.Never)]
514 protected static readonly string AccessibilityReadingResumedAction = "ReadingResumed";
516 [EditorBrowsable(EditorBrowsableState.Never)]
517 private static readonly string[] AccessibilityActions = {
518 AccessibilityActivateAction,
519 AccessibilityReadingSkippedAction,
520 AccessibilityReadingCancelledAction,
521 AccessibilityReadingStoppedAction,
522 AccessibilityReadingPausedAction,
523 AccessibilityReadingResumedAction,
526 [EditorBrowsable(EditorBrowsableState.Never)]
527 protected virtual string AccessibilityGetName()
532 [EditorBrowsable(EditorBrowsableState.Never)]
533 protected virtual string AccessibilityGetDescription()
538 [EditorBrowsable(EditorBrowsableState.Never)]
539 protected virtual bool AccessibilityDoAction(string name)
544 [EditorBrowsable(EditorBrowsableState.Never)]
545 protected virtual AccessibilityStates AccessibilityCalculateStates()
547 var states = new AccessibilityStates();
548 states.Set(AccessibilityState.Highlightable, this.AccessibilityHighlightable);
549 states.Set(AccessibilityState.Focusable, this.Focusable);
550 states.Set(AccessibilityState.Focused, this.State == States.Focused);
551 states.Set(AccessibilityState.Highlighted, this.IsHighlighted);
552 states.Set(AccessibilityState.Enabled, this.State != States.Disabled);
553 states.Set(AccessibilityState.Sensitive, this.Sensitive);
554 states.Set(AccessibilityState.Animated, this.AccessibilityAnimated);
555 states.Set(AccessibilityState.Visible, true);
556 states.Set(AccessibilityState.Showing, this.Visibility);
557 states.Set(AccessibilityState.Defunct, !this.IsOnWindow);
561 [EditorBrowsable(EditorBrowsableState.Never)]
562 protected virtual int AccessibilityGetActionCount()
564 return AccessibilityActions.Length;
567 [EditorBrowsable(EditorBrowsableState.Never)]
568 protected virtual string AccessibilityGetActionName(int index)
570 if (index >= 0 && index < AccessibilityActions.Length)
571 return AccessibilityActions[index];
576 [EditorBrowsable(EditorBrowsableState.Never)]
577 protected virtual bool AccessibilityShouldReportZeroChildren()
582 [EditorBrowsable(EditorBrowsableState.Never)]
583 protected virtual double AccessibilityGetMinimum()
588 [EditorBrowsable(EditorBrowsableState.Never)]
589 protected virtual double AccessibilityGetCurrent()
594 [EditorBrowsable(EditorBrowsableState.Never)]
595 protected virtual double AccessibilityGetMaximum()
600 [EditorBrowsable(EditorBrowsableState.Never)]
601 protected virtual bool AccessibilitySetCurrent(double value)
606 [EditorBrowsable(EditorBrowsableState.Never)]
607 protected virtual double AccessibilityGetMinimumIncrement()
612 [EditorBrowsable(EditorBrowsableState.Never)]
613 protected virtual bool AccessibilityIsScrollable()
618 [EditorBrowsable(EditorBrowsableState.Never)]
619 protected virtual string AccessibilityGetText(int startOffset, int endOffset)
624 [EditorBrowsable(EditorBrowsableState.Never)]
625 protected virtual int AccessibilityGetCharacterCount()
630 [EditorBrowsable(EditorBrowsableState.Never)]
631 protected virtual int AccessibilityGetCaretOffset()
636 [EditorBrowsable(EditorBrowsableState.Never)]
637 protected virtual bool AccessibilitySetCaretOffset(int offset)
642 [EditorBrowsable(EditorBrowsableState.Never)]
643 protected virtual AccessibilityRange AccessibilityGetTextAtOffset(int offset, TextBoundary boundary)
645 return new AccessibilityRange();
648 [EditorBrowsable(EditorBrowsableState.Never)]
649 protected virtual AccessibilityRange AccessibilityGetSelection(int selectionNum)
651 return new AccessibilityRange();
654 [EditorBrowsable(EditorBrowsableState.Never)]
655 protected virtual bool AccessibilityRemoveSelection(int selectionNum)
660 [EditorBrowsable(EditorBrowsableState.Never)]
661 protected virtual bool AccessibilitySetSelection(int selectionNum, int startOffset, int endOffset)
666 [EditorBrowsable(EditorBrowsableState.Never)]
667 protected virtual bool AccessibilityCopyText(int startPosition, int endPosition)
672 [EditorBrowsable(EditorBrowsableState.Never)]
673 protected virtual bool AccessibilityCutText(int startPosition, int endPosition)
679 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
680 /// It is absolute by default.
681 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
683 [EditorBrowsable(EditorBrowsableState.Never)]
684 public VisualTransformPolicyType CornerRadiusPolicy
686 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
687 set => SetValue(CornerRadiusPolicyProperty, value);
691 /// The current state of the view.
693 /// <since_tizen> 3 </since_tizen>
698 return (States)GetValue(StateProperty);
702 SetValue(StateProperty, value);
703 NotifyPropertyChanged();
708 /// The current sub state of the view.
710 /// <since_tizen> 3 </since_tizen>
711 public States SubState
715 return (States)GetValue(SubStateProperty);
719 SetValue(SubStateProperty, value);
720 NotifyPropertyChanged();
725 /// Displays a tooltip
727 /// <since_tizen> 3 </since_tizen>
728 public Tizen.NUI.PropertyMap Tooltip
732 return (PropertyMap)GetValue(TooltipProperty);
736 SetValue(TooltipProperty, value);
737 NotifyPropertyChanged();
742 /// Displays a tooltip as a text.
744 /// <since_tizen> 3 </since_tizen>
745 public string TooltipText
749 using (var propertyValue = GetProperty(Property.TOOLTIP))
751 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
753 return retrivedValue;
755 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
756 return "error to get TooltipText";
761 var temp = new Tizen.NUI.PropertyValue(value);
762 SetProperty(View.Property.TOOLTIP, temp);
764 NotifyPropertyChanged();
769 /// The Child property of FlexContainer.<br />
770 /// The proportion of the free space in the container, the flex item will receive.<br />
771 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
773 /// <since_tizen> 3 </since_tizen>
774 [Obsolete("Deprecated in API8, will be removed in API10.")]
779 return (float)GetValue(FlexProperty);
783 SetValue(FlexProperty, value);
784 NotifyPropertyChanged();
789 /// The Child property of FlexContainer.<br />
790 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
792 /// <since_tizen> 3 </since_tizen>
793 [Obsolete("Deprecated in API8, will be removed in API10.")]
798 return (int)GetValue(AlignSelfProperty);
802 SetValue(AlignSelfProperty, value);
803 NotifyPropertyChanged();
808 /// The Child property of FlexContainer.<br />
809 /// The space around the flex item.<br />
812 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
814 /// <since_tizen> 3 </since_tizen>
815 [Obsolete("Deprecated in API8, will be removed in API10.")]
816 public Vector4 FlexMargin
820 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
821 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
825 SetValue(FlexMarginProperty, value);
826 NotifyPropertyChanged();
831 /// The top-left cell this child occupies, if not set, the first available cell is used.
834 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
836 /// <since_tizen> 3 </since_tizen>
837 public Vector2 CellIndex
841 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
842 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
846 SetValue(CellIndexProperty, value);
847 NotifyPropertyChanged();
852 /// The number of rows this child occupies, if not set, the default value is 1.
854 /// <since_tizen> 3 </since_tizen>
859 return (float)GetValue(RowSpanProperty);
863 SetValue(RowSpanProperty, value);
864 NotifyPropertyChanged();
869 /// The number of columns this child occupies, if not set, the default value is 1.
871 /// <since_tizen> 3 </since_tizen>
872 public float ColumnSpan
876 return (float)GetValue(ColumnSpanProperty);
880 SetValue(ColumnSpanProperty, value);
881 NotifyPropertyChanged();
886 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
888 /// <since_tizen> 3 </since_tizen>
889 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
893 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
897 SetValue(CellHorizontalAlignmentProperty, value);
898 NotifyPropertyChanged();
903 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
905 /// <since_tizen> 3 </since_tizen>
906 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
910 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
914 SetValue(CellVerticalAlignmentProperty, value);
915 NotifyPropertyChanged();
920 /// The left focusable view.<br />
921 /// This will return null if not set.<br />
922 /// This will also return null if the specified left focusable view is not on a window.<br />
924 /// <since_tizen> 3 </since_tizen>
925 public View LeftFocusableView
927 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
930 return (View)GetValue(LeftFocusableViewProperty);
934 SetValue(LeftFocusableViewProperty, value);
935 NotifyPropertyChanged();
940 /// The right focusable view.<br />
941 /// This will return null if not set.<br />
942 /// This will also return null if the specified right focusable view is not on a window.<br />
944 /// <since_tizen> 3 </since_tizen>
945 public View RightFocusableView
947 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
950 return (View)GetValue(RightFocusableViewProperty);
954 SetValue(RightFocusableViewProperty, value);
955 NotifyPropertyChanged();
960 /// The up focusable view.<br />
961 /// This will return null if not set.<br />
962 /// This will also return null if the specified up focusable view is not on a window.<br />
964 /// <since_tizen> 3 </since_tizen>
965 public View UpFocusableView
967 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
970 return (View)GetValue(UpFocusableViewProperty);
974 SetValue(UpFocusableViewProperty, value);
975 NotifyPropertyChanged();
980 /// The down focusable view.<br />
981 /// This will return null if not set.<br />
982 /// This will also return null if the specified down focusable view is not on a window.<br />
984 /// <since_tizen> 3 </since_tizen>
985 public View DownFocusableView
987 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
990 return (View)GetValue(DownFocusableViewProperty);
994 SetValue(DownFocusableViewProperty, value);
995 NotifyPropertyChanged();
1000 /// Whether the view should be focusable by keyboard navigation.
1002 /// <since_tizen> 3 </since_tizen>
1003 public bool Focusable
1007 SetValue(FocusableProperty, value);
1008 NotifyPropertyChanged();
1012 return (bool)GetValue(FocusableProperty);
1017 /// Retrieves the position of the view.<br />
1018 /// The coordinates are relative to the view's parent.<br />
1020 /// <since_tizen> 3 </since_tizen>
1021 public Position CurrentPosition
1025 return GetCurrentPosition();
1030 /// Sets the size of a view for the width and the height.<br />
1031 /// Geometry can be scaled to fit within this area.<br />
1032 /// This does not interfere with the view's scale factor.<br />
1033 /// The views default depth is the minimum of width and height.<br />
1036 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
1037 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
1039 /// <since_tizen> 3 </since_tizen>
1040 public Size2D Size2D
1044 Size2D temp = (Size2D)GetValue(Size2DProperty);
1045 int width = temp.Width;
1046 int height = temp.Height;
1048 if (this.Layout == null)
1050 if (width < 0) { width = 0; }
1051 if (height < 0) { height = 0; }
1054 return new Size2D(OnSize2DChanged, width, height);
1058 SetValue(Size2DProperty, value);
1060 NotifyPropertyChanged();
1065 /// Retrieves the size of the view.<br />
1066 /// The coordinates are relative to the view's parent.<br />
1068 /// <since_tizen> 3 </since_tizen>
1069 public Size2D CurrentSize
1073 return GetCurrentSize();
1078 /// Retrieves and sets the view's opacity.<br />
1080 /// <since_tizen> 3 </since_tizen>
1081 public float Opacity
1085 return (float)GetValue(OpacityProperty);
1089 SetValue(OpacityProperty, value);
1090 selectorData?.Opacity?.Reset(this);
1091 NotifyPropertyChanged();
1096 /// Sets the position of the view for X and Y.<br />
1097 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1098 /// If the position inheritance is disabled, sets the world position.<br />
1101 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1102 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1104 /// <since_tizen> 3 </since_tizen>
1105 public Position2D Position2D
1109 Position2D temp = (Position2D)GetValue(Position2DProperty);
1110 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1114 SetValue(Position2DProperty, value);
1115 NotifyPropertyChanged();
1120 /// Retrieves the screen position of the view.<br />
1122 /// <since_tizen> 3 </since_tizen>
1123 public Vector2 ScreenPosition
1127 Vector2 temp = new Vector2(0.0f, 0.0f);
1128 var pValue = GetProperty(View.Property.ScreenPosition);
1136 /// Determines whether the pivot point should be used to determine the position of the view.
1137 /// This is false by default.
1139 /// <remarks>If false, then the top-left of the view is used for the position.
1140 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1142 /// <since_tizen> 3 </since_tizen>
1143 public bool PositionUsesPivotPoint
1147 return (bool)GetValue(PositionUsesPivotPointProperty);
1151 SetValue(PositionUsesPivotPointProperty, value);
1152 NotifyPropertyChanged();
1157 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1159 /// <since_tizen> 3 </since_tizen>
1160 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1162 "View view = new View(); " +
1163 "view.PivotPoint = PivotPoint.Center; " +
1164 "view.PositionUsesPivotPoint = true;" +
1165 " Deprecated in API5: Will be removed in API8")]
1166 [EditorBrowsable(EditorBrowsableState.Never)]
1167 public bool PositionUsesAnchorPoint
1172 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1173 pValue.Get(out temp);
1179 var temp = new Tizen.NUI.PropertyValue(value);
1180 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1182 NotifyPropertyChanged();
1187 /// Queries whether the view is connected to the stage.<br />
1188 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1190 /// <since_tizen> 3 </since_tizen>
1191 public bool IsOnWindow
1200 /// Gets the depth in the hierarchy for the view.
1202 /// <since_tizen> 3 </since_tizen>
1203 public int HierarchyDepth
1207 return GetHierarchyDepth();
1212 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1215 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1216 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1217 /// The values set by this property will likely change.
1219 /// <since_tizen> 3 </since_tizen>
1220 public int SiblingOrder
1224 return (int)GetValue(SiblingOrderProperty);
1228 SetValue(SiblingOrderProperty, value);
1230 LayoutGroup layout = Layout as LayoutGroup;
1231 layout?.ChangeLayoutSiblingOrder(value);
1233 NotifyPropertyChanged();
1238 /// Returns the natural size of the view.
1241 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1243 /// <since_tizen> 5 </since_tizen>
1244 public Vector3 NaturalSize
1248 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1249 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1255 /// Returns the natural size (Size2D) of the view.
1258 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1260 /// <since_tizen> 4 </since_tizen>
1261 public Size2D NaturalSize2D
1265 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1266 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1268 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1275 /// Gets or sets the origin of a view within its parent's area.<br />
1276 /// 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 />
1277 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1278 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1280 /// <pre>The view has been initialized.</pre>
1281 /// <since_tizen> 3 </since_tizen>
1282 public Position ParentOrigin
1286 Position tmp = (Position)GetValue(ParentOriginProperty);
1287 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1291 SetValue(ParentOriginProperty, value);
1292 NotifyPropertyChanged();
1297 /// Gets or sets the anchor-point of a view.<br />
1298 /// 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 />
1299 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1300 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1301 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1302 /// <pre>The view has been initialized.</pre>
1305 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1307 /// <since_tizen> 3 </since_tizen>
1308 public Position PivotPoint
1312 Position tmp = (Position)GetValue(PivotPointProperty);
1313 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1317 SetValue(PivotPointProperty, value);
1318 NotifyPropertyChanged();
1323 /// Gets or sets the size width of the view.
1327 /// Animatable - This property can be animated using <c>Animation</c> class.
1330 /// <since_tizen> 3 </since_tizen>
1331 public float SizeWidth
1335 return (float)GetValue(SizeWidthProperty);
1339 SetValue(SizeWidthProperty, value);
1340 NotifyPropertyChanged();
1345 /// Gets or sets the size height of the view.
1349 /// Animatable - This property can be animated using <c>Animation</c> class.
1352 /// <since_tizen> 3 </since_tizen>
1353 public float SizeHeight
1357 return (float)GetValue(SizeHeightProperty);
1361 SetValue(SizeHeightProperty, value);
1362 NotifyPropertyChanged();
1367 /// Gets or sets the position of the view.<br />
1368 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1369 /// If the position inheritance is disabled, sets the world position.<br />
1373 /// Animatable - This property can be animated using <c>Animation</c> class.
1375 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1377 /// <since_tizen> 3 </since_tizen>
1378 public Position Position
1382 Position tmp = (Position)GetValue(PositionProperty);
1383 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1387 SetValue(PositionProperty, value);
1388 NotifyPropertyChanged();
1393 /// Gets or sets the position X of the view.
1397 /// Animatable - This property can be animated using <c>Animation</c> class.
1400 /// <since_tizen> 3 </since_tizen>
1401 public float PositionX
1405 return (float)GetValue(PositionXProperty);
1409 SetValue(PositionXProperty, value);
1410 NotifyPropertyChanged();
1415 /// Gets or sets the position Y of the view.
1419 /// Animatable - This property can be animated using <c>Animation</c> class.
1422 /// <since_tizen> 3 </since_tizen>
1423 public float PositionY
1427 return (float)GetValue(PositionYProperty);
1431 SetValue(PositionYProperty, value);
1432 NotifyPropertyChanged();
1437 /// Gets or sets the position Z of the view.
1441 /// Animatable - This property can be animated using <c>Animation</c> class.
1444 /// <since_tizen> 3 </since_tizen>
1445 public float PositionZ
1449 return (float)GetValue(PositionZProperty);
1453 SetValue(PositionZProperty, value);
1454 NotifyPropertyChanged();
1459 /// Gets or sets the world position of the view.
1461 /// <since_tizen> 3 </since_tizen>
1462 public Vector3 WorldPosition
1466 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1467 var pValue = GetProperty(View.Property.WorldPosition);
1475 /// Gets or sets the orientation of the view.<br />
1476 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1480 /// This is an asynchronous method.
1483 /// Animatable - This property can be animated using <c>Animation</c> class.
1486 /// <since_tizen> 3 </since_tizen>
1487 public Rotation Orientation
1491 return (Rotation)GetValue(OrientationProperty);
1495 SetValue(OrientationProperty, value);
1496 NotifyPropertyChanged();
1501 /// Gets or sets the world orientation of the view.<br />
1503 /// <since_tizen> 3 </since_tizen>
1504 public Rotation WorldOrientation
1508 Rotation temp = new Rotation();
1509 var pValue = GetProperty(View.Property.WorldOrientation);
1517 /// Gets or sets the scale factor applied to the view.<br />
1521 /// Animatable - This property can be animated using <c>Animation</c> class.
1523 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1525 /// <since_tizen> 3 </since_tizen>
1526 public Vector3 Scale
1530 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1531 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1535 SetValue(ScaleProperty, value);
1536 NotifyPropertyChanged();
1541 /// Gets or sets the scale X factor applied to the view.
1545 /// Animatable - This property can be animated using <c>Animation</c> class.
1548 /// <since_tizen> 3 </since_tizen>
1553 return (float)GetValue(ScaleXProperty);
1557 SetValue(ScaleXProperty, value);
1558 NotifyPropertyChanged();
1563 /// Gets or sets the scale Y factor applied to the view.
1567 /// Animatable - This property can be animated using <c>Animation</c> class.
1570 /// <since_tizen> 3 </since_tizen>
1575 return (float)GetValue(ScaleYProperty);
1579 SetValue(ScaleYProperty, value);
1580 NotifyPropertyChanged();
1585 /// Gets or sets the scale Z factor applied to the view.
1589 /// Animatable - This property can be animated using <c>Animation</c> class.
1592 /// <since_tizen> 3 </since_tizen>
1597 return (float)GetValue(ScaleZProperty);
1601 SetValue(ScaleZProperty, value);
1602 NotifyPropertyChanged();
1607 /// Gets the world scale of the view.
1609 /// <since_tizen> 3 </since_tizen>
1610 public Vector3 WorldScale
1614 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1615 var pValue = GetProperty(View.Property.WorldScale);
1623 /// Retrieves the visibility flag of the view.
1627 /// If the view is not visible, then the view and its children will not be rendered.
1628 /// 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.
1631 /// Animatable - This property can be animated using <c>Animation</c> class.
1634 /// <since_tizen> 3 </since_tizen>
1635 public bool Visibility
1640 var pValue = GetProperty(View.Property.VISIBLE);
1641 pValue.Get(out temp);
1648 /// Gets the view's world color.
1650 /// <since_tizen> 3 </since_tizen>
1651 public Vector4 WorldColor
1655 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1656 var pValue = GetProperty(View.Property.WorldColor);
1664 /// Gets or sets the view's name.
1666 /// <since_tizen> 3 </since_tizen>
1671 return (string)GetValue(NameProperty);
1675 SetValue(NameProperty, value);
1676 NotifyPropertyChanged();
1681 /// Get the number of children held by the view.
1683 /// <since_tizen> 3 </since_tizen>
1684 public new uint ChildCount
1688 return Convert.ToUInt32(Children.Count);
1693 /// Gets the view's ID.
1696 /// <since_tizen> 3 </since_tizen>
1706 /// Gets or sets the status of whether the view should emit touch or hover signals.
1708 /// <since_tizen> 3 </since_tizen>
1709 public bool Sensitive
1713 return (bool)GetValue(SensitiveProperty);
1717 SetValue(SensitiveProperty, value);
1718 NotifyPropertyChanged();
1723 /// 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.
1725 /// <since_tizen> 3 </since_tizen>
1726 public bool LeaveRequired
1730 return (bool)GetValue(LeaveRequiredProperty);
1734 SetValue(LeaveRequiredProperty, value);
1735 NotifyPropertyChanged();
1740 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1742 /// <since_tizen> 3 </since_tizen>
1743 public bool InheritOrientation
1747 return (bool)GetValue(InheritOrientationProperty);
1751 SetValue(InheritOrientationProperty, value);
1752 NotifyPropertyChanged();
1757 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1759 /// <since_tizen> 3 </since_tizen>
1760 public bool InheritScale
1764 return (bool)GetValue(InheritScaleProperty);
1768 SetValue(InheritScaleProperty, value);
1769 NotifyPropertyChanged();
1774 /// Gets or sets the status of how the view and its children should be drawn.<br />
1775 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1776 /// 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 />
1777 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1778 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1779 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1781 /// <since_tizen> 3 </since_tizen>
1782 public DrawModeType DrawMode
1786 return (DrawModeType)GetValue(DrawModeProperty);
1790 SetValue(DrawModeProperty, value);
1791 NotifyPropertyChanged();
1796 /// Gets or sets the relative to parent size factor of the view.<br />
1797 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1798 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1801 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1803 /// <since_tizen> 3 </since_tizen>
1804 public Vector3 SizeModeFactor
1808 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1809 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1813 SetValue(SizeModeFactorProperty, value);
1814 NotifyPropertyChanged();
1819 /// Gets or sets the width resize policy to be used.
1821 /// <since_tizen> 3 </since_tizen>
1822 public ResizePolicyType WidthResizePolicy
1826 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1830 SetValue(WidthResizePolicyProperty, value);
1831 NotifyPropertyChanged();
1836 /// Gets or sets the height resize policy to be used.
1838 /// <since_tizen> 3 </since_tizen>
1839 public ResizePolicyType HeightResizePolicy
1843 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1847 SetValue(HeightResizePolicyProperty, value);
1848 NotifyPropertyChanged();
1853 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1854 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1856 /// <since_tizen> 3 </since_tizen>
1857 public SizeScalePolicyType SizeScalePolicy
1861 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1865 SetValue(SizeScalePolicyProperty, value);
1866 NotifyPropertyChanged();
1871 /// Gets or sets the status of whether the width size is dependent on the height size.
1873 /// <since_tizen> 3 </since_tizen>
1874 public bool WidthForHeight
1878 return (bool)GetValue(WidthForHeightProperty);
1882 SetValue(WidthForHeightProperty, value);
1883 NotifyPropertyChanged();
1888 /// Gets or sets the status of whether the height size is dependent on the width size.
1890 /// <since_tizen> 3 </since_tizen>
1891 public bool HeightForWidth
1895 return (bool)GetValue(HeightForWidthProperty);
1899 SetValue(HeightForWidthProperty, value);
1900 NotifyPropertyChanged();
1905 /// Gets or sets the padding for use in layout.
1908 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1910 /// <since_tizen> 5 </since_tizen>
1911 public Extents Padding
1915 // If View has a Layout then padding in stored in the base Layout class
1918 return Layout.Padding;
1922 Extents temp = (Extents)GetValue(PaddingProperty);
1923 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1925 // Two return points to prevent creating a zeroed Extent native object before assignment
1929 Extents padding = value;
1932 // Layout set so store Padding in LayoutItem instead of in View.
1933 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1934 // the position and sizes measure in the Layouting.
1935 Layout.Padding = value;
1936 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1937 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1938 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1940 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1944 SetValue(PaddingProperty, padding);
1945 NotifyPropertyChanged();
1950 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1952 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1954 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1956 /// <since_tizen> 3 </since_tizen>
1957 public Size2D MinimumSize
1961 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1962 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1968 throw new ArgumentNullException(nameof(value));
1972 // Note: it only works if minimum size is >= than natural size.
1973 // To force the size it should be done through the width&height spec or Size2D.
1974 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1975 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1976 layout.RequestLayout();
1978 SetValue(MinimumSizeProperty, value);
1979 NotifyPropertyChanged();
1984 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1987 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1989 /// <since_tizen> 3 </since_tizen>
1990 public Size2D MaximumSize
1994 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1995 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1999 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
2000 // MATCH_PARENT spec + parent container size can be used to limit
2003 layout.RequestLayout();
2005 SetValue(MaximumSizeProperty, value);
2006 NotifyPropertyChanged();
2011 /// Gets or sets whether a child view inherits it's parent's position.<br />
2012 /// Default is to inherit.<br />
2013 /// 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 />
2015 /// <since_tizen> 3 </since_tizen>
2016 public bool InheritPosition
2020 return (bool)GetValue(InheritPositionProperty);
2024 SetValue(InheritPositionProperty, value);
2025 NotifyPropertyChanged();
2030 /// Gets or sets the clipping behavior (mode) of it's children.
2032 /// <since_tizen> 3 </since_tizen>
2033 public ClippingModeType ClippingMode
2037 return (ClippingModeType)GetValue(ClippingModeProperty);
2041 SetValue(ClippingModeProperty, value);
2042 NotifyPropertyChanged();
2047 /// Gets the number of renderers held by the view.
2049 /// <since_tizen> 3 </since_tizen>
2050 public uint RendererCount
2054 return GetRendererCount();
2059 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2062 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2064 /// <since_tizen> 3 </since_tizen>
2065 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2067 "View view = new View(); " +
2068 "view.PivotPoint = PivotPoint.Center; " +
2069 "view.PositionUsesPivotPoint = true;")]
2070 [EditorBrowsable(EditorBrowsableState.Never)]
2071 public Position AnchorPoint
2075 Position temp = new Position(0.0f, 0.0f, 0.0f);
2076 var pValue = GetProperty(View.Property.AnchorPoint);
2079 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2085 var temp = new Tizen.NUI.PropertyValue(value);
2086 SetProperty(View.Property.AnchorPoint, temp);
2088 NotifyPropertyChanged();
2093 /// Sets the size of a view for the width, the height and the depth.<br />
2094 /// Geometry can be scaled to fit within this area.<br />
2095 /// This does not interfere with the view's scale factor.<br />
2096 /// The views default depth is the minimum of width and height.<br />
2100 /// Animatable - This property can be animated using <c>Animation</c> class.
2102 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2104 /// <since_tizen> 5 </since_tizen>
2109 Size tmp = (Size)GetValue(SizeProperty);
2110 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2114 SetValue(SizeProperty, value);
2115 NotifyPropertyChanged();
2120 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2122 /// <since_tizen> 3 </since_tizen>
2123 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2125 "Container parent = view.GetParent(); " +
2126 "View view = parent as View;")]
2127 [EditorBrowsable(EditorBrowsableState.Never)]
2128 public new View Parent
2133 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2134 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2135 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2137 if (basehandle is Layer layer)
2139 ret = new View(Layer.getCPtr(layer).Handle, false);
2140 NUILog.Error("This Parent property is deprecated, should do not be used");
2144 ret = basehandle as View;
2147 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2148 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2150 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2156 /// Gets/Sets whether inherit parent's the layout Direction.
2158 /// <since_tizen> 4 </since_tizen>
2159 public bool InheritLayoutDirection
2163 return (bool)GetValue(InheritLayoutDirectionProperty);
2167 SetValue(InheritLayoutDirectionProperty, value);
2168 NotifyPropertyChanged();
2173 /// Gets/Sets the layout Direction.
2175 /// <since_tizen> 4 </since_tizen>
2176 public ViewLayoutDirectionType LayoutDirection
2180 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2184 SetValue(LayoutDirectionProperty, value);
2185 NotifyPropertyChanged();
2186 layout?.RequestLayout();
2191 /// Gets or sets the Margin for use in layout.
2194 /// Margin property is supported by Layout algorithms and containers.
2195 /// Please Set Layout if you want to use Margin property.
2196 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2198 /// <since_tizen> 4 </since_tizen>
2199 public Extents Margin
2203 // If View has a Layout then margin is stored in Layout.
2206 return Layout.Margin;
2210 // If Layout not set then return margin stored in View.
2211 Extents temp = (Extents)GetValue(MarginProperty);
2212 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2214 // Two return points to prevent creating a zeroed Extent native object before assignment
2220 // Layout set so store Margin in LayoutItem instead of View.
2221 // If View stores the Margin too then the Legacy Size Negotiation will
2222 // overwrite the position and size values measured in the Layouting.
2223 Layout.Margin = value;
2224 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2225 layout?.RequestLayout();
2229 SetValue(MarginProperty, value);
2231 NotifyPropertyChanged();
2232 layout?.RequestLayout();
2237 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2239 /// <since_tizen> 6 </since_tizen>
2240 public int WidthSpecification
2248 if (value == widthPolicy)
2251 widthPolicy = value;
2252 if (widthPolicy >= 0)
2254 if (heightPolicy >= 0) // Policy an exact value
2256 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2257 Size2D = new Size2D(widthPolicy, heightPolicy);
2260 layout?.RequestLayout();
2265 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2267 /// <since_tizen> 6 </since_tizen>
2268 public int HeightSpecification
2272 return heightPolicy;
2276 if (value == heightPolicy)
2279 heightPolicy = value;
2280 if (heightPolicy >= 0)
2282 if (widthPolicy >= 0) // Policy an exact value
2284 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2285 Size2D = new Size2D(widthPolicy, heightPolicy);
2288 layout?.RequestLayout();
2293 /// Gets the List of transitions for this View.
2295 /// <since_tizen> 6 </since_tizen>
2296 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2300 if (layoutTransitions == null)
2302 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2304 return layoutTransitions;
2309 /// Set a layout transitions for this View.
2311 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2313 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2315 /// <since_tizen> 6 </since_tizen>
2316 public LayoutTransition LayoutTransition
2320 return layoutTransition;
2326 throw new global::System.ArgumentNullException(nameof(value));
2328 if (layoutTransitions == null)
2330 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2333 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2335 AttachTransitionsToChildren(value);
2337 layoutTransition = value;
2342 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2345 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2347 /// <since_tizen> 4 </since_tizen>
2348 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2349 [EditorBrowsable(EditorBrowsableState.Never)]
2350 public Extents PaddingEX
2354 Extents temp = new Extents(0, 0, 0, 0);
2355 var pValue = GetProperty(View.Property.PADDING);
2358 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2364 var temp = new Tizen.NUI.PropertyValue(value);
2365 SetProperty(View.Property.PADDING, temp);
2367 NotifyPropertyChanged();
2368 layout?.RequestLayout();
2373 /// The Color of View. This is an RGBA value.
2377 /// Animatable - This property can be animated using <c>Animation</c> class.
2379 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2381 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2382 [EditorBrowsable(EditorBrowsableState.Never)]
2387 Color temp = (Color)GetValue(ColorProperty);
2388 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2392 SetValue(ColorProperty, value);
2393 selectorData?.Color?.Reset(this);
2394 NotifyPropertyChanged();
2399 /// Set the layout on this View. Replaces any existing Layout.
2402 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2404 /// <since_tizen> 6 </since_tizen>
2405 public LayoutItem Layout
2413 // Do nothing if layout provided is already set on this View.
2414 if (value == layout)
2419 LayoutingDisabled = false;
2422 // If new layout being set already has a owner then that owner receives a replacement default layout.
2423 // First check if the layout to be set already has a owner.
2424 if (value?.Owner != null)
2426 // Previous owner of the layout gets a default layout as a replacement.
2427 value.Owner.Layout = new AbsoluteLayout();
2429 // Copy Margin and Padding to replacement LayoutGroup.
2430 if (value.Owner.Layout != null)
2432 value.Owner.Layout.Margin = value.Margin;
2433 value.Owner.Layout.Padding = value.Padding;
2437 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2438 // View if no replacement. Previously margin and padding values would have been moved from
2439 // the View to the layout.
2440 if (layout != null) // Existing layout
2444 // Existing layout being replaced so copy over margin and padding values.
2445 value.Margin = layout.Margin;
2446 value.Padding = layout.Padding;
2450 // Layout not being replaced so restore margin and padding to View.
2451 SetValue(MarginProperty, layout.Margin);
2452 SetValue(PaddingProperty, layout.Padding);
2453 NotifyPropertyChanged();
2458 // First Layout to be added to the View hence copy
2460 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2463 Extents margin = Margin;
2464 Extents padding = Padding;
2465 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2467 // If View already has a margin set then store it in Layout instead.
2468 value.Margin = margin;
2469 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2470 NotifyPropertyChanged();
2473 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2475 // If View already has a padding set then store it in Layout instead.
2476 value.Padding = padding;
2478 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2479 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2480 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2482 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2483 NotifyPropertyChanged();
2489 // Remove existing layout from it's parent layout group.
2492 value.SetPositionByLayout = !excludeLayouting;
2494 // Set layout to this view
2500 /// The weight of the View, used to share available space in a layout with siblings.
2502 /// <since_tizen> 6 </since_tizen>
2512 layout?.RequestLayout();
2517 /// Whether to load the BackgroundImage synchronously.
2518 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2519 /// Note: For Normal Quad images only.
2521 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2522 [EditorBrowsable(EditorBrowsableState.Never)]
2523 public bool BackgroundImageSynchronosLoading
2527 return backgroundImageSynchronosLoading;
2531 backgroundImageSynchronosLoading = value;
2533 string bgUrl = null;
2534 var pValue = Background.Find(ImageVisualProperty.URL);
2535 pValue?.Get(out bgUrl);
2538 if (!string.IsNullOrEmpty(bgUrl))
2540 PropertyMap bgMap = this.Background;
2541 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2542 bgMap.Add("synchronousLoading", temp);
2549 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2550 [EditorBrowsable(EditorBrowsableState.Never)]
2551 public Vector2 UpdateSizeHint
2555 return (Vector2)GetValue(UpdateSizeHintProperty);
2559 SetValue(UpdateSizeHintProperty, value);
2560 NotifyPropertyChanged();
2565 /// Enable/Disable ControlState propagation for children.
2566 /// It is false by default.
2567 /// If the View needs to share ControlState with descendants, please set it true.
2568 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2570 [EditorBrowsable(EditorBrowsableState.Never)]
2571 public bool EnableControlStatePropagation
2573 get => controlStatePropagation;
2576 controlStatePropagation = value;
2578 foreach (View child in Children)
2580 child.EnableControlStatePropagation = value;
2586 /// By default, it is false in View, true in Control.
2587 /// Note that if the value is true, the View will be a touch receptor.
2589 [EditorBrowsable(EditorBrowsableState.Never)]
2590 public bool EnableControlState
2594 return (bool)GetValue(EnableControlStateProperty);
2598 SetValue(EnableControlStateProperty, value);
2603 /// Whether the actor grab all touches even if touch leaves its boundary.
2605 /// <returns>true, if it grab all touch after start</returns>
2606 [EditorBrowsable(EditorBrowsableState.Never)]
2607 public bool GrabTouchAfterLeave
2612 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2613 pValue.Get(out temp);
2619 var temp = new Tizen.NUI.PropertyValue(value);
2620 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2622 NotifyPropertyChanged();
2627 /// Determines which blend equation will be used to render renderers of this actor.
2629 /// <returns>blend equation enum currently assigned</returns>
2630 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2631 [EditorBrowsable(EditorBrowsableState.Never)]
2632 public BlendEquationType BlendEquation
2637 var pValue = GetProperty(View.Property.BlendEquation);
2638 pValue.Get(out temp);
2640 return (BlendEquationType)temp;
2644 var temp = new Tizen.NUI.PropertyValue((int)value);
2645 SetProperty(View.Property.BlendEquation, temp);
2647 NotifyPropertyChanged();
2652 /// If the value is true, the View will change its style as the theme changes.
2653 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2655 [EditorBrowsable(EditorBrowsableState.Never)]
2656 public bool ThemeChangeSensitive
2658 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2659 set => SetValue(ThemeChangeSensitiveProperty, value);
2663 /// Create Style, it is abstract function and must be override.
2665 [EditorBrowsable(EditorBrowsableState.Never)]
2666 protected virtual ViewStyle CreateViewStyle()
2668 return new ViewStyle();
2672 /// Called after the View's ControlStates changed.
2674 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2675 [EditorBrowsable(EditorBrowsableState.Never)]
2676 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2682 [EditorBrowsable(EditorBrowsableState.Never)]
2683 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2688 private bool IsViewPropertyDirty(BindableProperty styleProperty)
2690 if (dirtyPropertySet.Count == 0)
2695 if (styleProperty.ReturnType.IsGenericType && styleProperty.ReturnType.GetGenericTypeDefinition() == typeof(Selector<>))
2697 return dirtyPropertySet.Contains(styleProperty.PropertyName.Substring(0, styleProperty.PropertyName.Length - 8));
2700 return dirtyPropertySet.Contains(styleProperty.PropertyName);
2704 /// Apply style instance to the view.
2705 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2707 [EditorBrowsable(EditorBrowsableState.Never)]
2708 public virtual void ApplyStyle(ViewStyle viewStyle)
2710 if (viewStyle == null || this.viewStyle == viewStyle) return;
2712 this.viewStyle = viewStyle;
2714 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2720 if (dirtyPropertySet == null)
2722 dirtyPropertySet = new HashSet<string>();
2725 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2727 if (bindablePropertyOfView == null)
2732 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2733 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2735 foreach (var sourceProperty in dirtyStyleProperties)
2737 if (blockSetDirty && IsViewPropertyDirty(sourceProperty))
2739 // Skip applying theme style for a property set by user.
2743 var sourceValue = viewStyle.GetValue(sourceProperty);
2745 if (sourceValue == null)
2750 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2752 if (destinationProperty != null)
2754 SetValue(destinationProperty, sourceValue);
2760 /// Get whether the View is culled or not.
2761 /// True means that the View is out of the view frustum.
2764 /// Hidden-API (Inhouse-API).
2766 [EditorBrowsable(EditorBrowsableState.Never)]
2772 var pValue = GetProperty(View.Property.Culled);
2773 pValue.Get(out temp);