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 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
472 /// Animatable - This property can be animated using <c>Animation</c> class.
475 [EditorBrowsable(EditorBrowsableState.Never)]
476 public float CornerRadius
480 return (float)GetValue(CornerRadiusProperty);
484 SetValue(CornerRadiusProperty, value);
485 NotifyPropertyChanged();
493 [EditorBrowsable(EditorBrowsableState.Never)]
494 protected bool IsHighlighted
498 return Accessibility.AccessibilityManager.Instance.GetCurrentFocusView() == this;
502 [EditorBrowsable(EditorBrowsableState.Never)]
503 protected static readonly string AccessibilityActivateAction = "activate";
504 [EditorBrowsable(EditorBrowsableState.Never)]
505 protected static readonly string AccessibilityReadingSkippedAction = "ReadingSkipped";
506 [EditorBrowsable(EditorBrowsableState.Never)]
507 protected static readonly string AccessibilityReadingCancelledAction = "ReadingCancelled";
508 [EditorBrowsable(EditorBrowsableState.Never)]
509 protected static readonly string AccessibilityReadingStoppedAction = "ReadingStopped";
510 [EditorBrowsable(EditorBrowsableState.Never)]
511 protected static readonly string AccessibilityReadingPausedAction = "ReadingPaused";
512 [EditorBrowsable(EditorBrowsableState.Never)]
513 protected static readonly string AccessibilityReadingResumedAction = "ReadingResumed";
515 [EditorBrowsable(EditorBrowsableState.Never)]
516 private static readonly string[] AccessibilityActions = {
517 AccessibilityActivateAction,
518 AccessibilityReadingSkippedAction,
519 AccessibilityReadingCancelledAction,
520 AccessibilityReadingStoppedAction,
521 AccessibilityReadingPausedAction,
522 AccessibilityReadingResumedAction,
525 [EditorBrowsable(EditorBrowsableState.Never)]
526 protected virtual string AccessibilityGetName()
531 [EditorBrowsable(EditorBrowsableState.Never)]
532 protected virtual string AccessibilityGetDescription()
537 [EditorBrowsable(EditorBrowsableState.Never)]
538 protected virtual bool AccessibilityDoAction(string name)
543 [EditorBrowsable(EditorBrowsableState.Never)]
544 protected virtual AccessibilityStates AccessibilityCalculateStates()
546 var states = new AccessibilityStates();
547 states.Set(AccessibilityState.Highlightable, this.AccessibilityHighlightable);
548 states.Set(AccessibilityState.Focusable, this.Focusable);
549 states.Set(AccessibilityState.Focused, this.State == States.Focused);
550 states.Set(AccessibilityState.Highlighted, this.IsHighlighted);
551 states.Set(AccessibilityState.Enabled, this.State != States.Disabled);
552 states.Set(AccessibilityState.Sensitive, this.Sensitive);
553 states.Set(AccessibilityState.Animated, this.AccessibilityAnimated);
554 states.Set(AccessibilityState.Visible, true);
555 states.Set(AccessibilityState.Showing, this.Visibility);
556 states.Set(AccessibilityState.Defunct, !this.IsOnWindow);
560 [EditorBrowsable(EditorBrowsableState.Never)]
561 protected virtual int AccessibilityGetActionCount()
563 return AccessibilityActions.Length;
566 [EditorBrowsable(EditorBrowsableState.Never)]
567 protected virtual string AccessibilityGetActionName(int index)
569 if (index >= 0 && index < AccessibilityActions.Length)
570 return AccessibilityActions[index];
575 [EditorBrowsable(EditorBrowsableState.Never)]
576 protected virtual bool AccessibilityShouldReportZeroChildren()
581 [EditorBrowsable(EditorBrowsableState.Never)]
582 protected virtual double AccessibilityGetMinimum()
587 [EditorBrowsable(EditorBrowsableState.Never)]
588 protected virtual double AccessibilityGetCurrent()
593 [EditorBrowsable(EditorBrowsableState.Never)]
594 protected virtual double AccessibilityGetMaximum()
599 [EditorBrowsable(EditorBrowsableState.Never)]
600 protected virtual bool AccessibilitySetCurrent(double value)
605 [EditorBrowsable(EditorBrowsableState.Never)]
606 protected virtual double AccessibilityGetMinimumIncrement()
611 [EditorBrowsable(EditorBrowsableState.Never)]
612 protected virtual bool AccessibilityIsScrollable()
617 [EditorBrowsable(EditorBrowsableState.Never)]
618 protected virtual string AccessibilityGetText(int startOffset, int endOffset)
623 [EditorBrowsable(EditorBrowsableState.Never)]
624 protected virtual int AccessibilityGetCharacterCount()
629 [EditorBrowsable(EditorBrowsableState.Never)]
630 protected virtual int AccessibilityGetCaretOffset()
635 [EditorBrowsable(EditorBrowsableState.Never)]
636 protected virtual bool AccessibilitySetCaretOffset(int offset)
641 [EditorBrowsable(EditorBrowsableState.Never)]
642 protected virtual AccessibilityRange AccessibilityGetTextAtOffset(int offset, TextBoundary boundary)
644 return new AccessibilityRange();
647 [EditorBrowsable(EditorBrowsableState.Never)]
648 protected virtual AccessibilityRange AccessibilityGetSelection(int selectionNum)
650 return new AccessibilityRange();
653 [EditorBrowsable(EditorBrowsableState.Never)]
654 protected virtual bool AccessibilityRemoveSelection(int selectionNum)
659 [EditorBrowsable(EditorBrowsableState.Never)]
660 protected virtual bool AccessibilitySetSelection(int selectionNum, int startOffset, int endOffset)
665 [EditorBrowsable(EditorBrowsableState.Never)]
666 protected virtual bool AccessibilityCopyText(int startPosition, int endPosition)
671 [EditorBrowsable(EditorBrowsableState.Never)]
672 protected virtual bool AccessibilityCutText(int startPosition, int endPosition)
678 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
679 /// It is absolute by default.
680 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
682 [EditorBrowsable(EditorBrowsableState.Never)]
683 public VisualTransformPolicyType CornerRadiusPolicy
685 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
686 set => SetValue(CornerRadiusPolicyProperty, value);
690 /// The current state of the view.
692 /// <since_tizen> 3 </since_tizen>
697 return (States)GetValue(StateProperty);
701 SetValue(StateProperty, value);
702 NotifyPropertyChanged();
707 /// The current sub state of the view.
709 /// <since_tizen> 3 </since_tizen>
710 public States SubState
714 return (States)GetValue(SubStateProperty);
718 SetValue(SubStateProperty, value);
719 NotifyPropertyChanged();
724 /// Displays a tooltip
726 /// <since_tizen> 3 </since_tizen>
727 public Tizen.NUI.PropertyMap Tooltip
731 return (PropertyMap)GetValue(TooltipProperty);
735 SetValue(TooltipProperty, value);
736 NotifyPropertyChanged();
741 /// Displays a tooltip as a text.
743 /// <since_tizen> 3 </since_tizen>
744 public string TooltipText
748 using (var propertyValue = GetProperty(Property.TOOLTIP))
750 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
752 return retrivedValue;
754 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
755 return "error to get TooltipText";
760 var temp = new Tizen.NUI.PropertyValue(value);
761 SetProperty(View.Property.TOOLTIP, temp);
763 NotifyPropertyChanged();
768 /// The Child property of FlexContainer.<br />
769 /// The proportion of the free space in the container, the flex item will receive.<br />
770 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
772 /// <since_tizen> 3 </since_tizen>
773 [Obsolete("Deprecated in API8, will be removed in API10.")]
778 return (float)GetValue(FlexProperty);
782 SetValue(FlexProperty, value);
783 NotifyPropertyChanged();
788 /// The Child property of FlexContainer.<br />
789 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
791 /// <since_tizen> 3 </since_tizen>
792 [Obsolete("Deprecated in API8, will be removed in API10.")]
797 return (int)GetValue(AlignSelfProperty);
801 SetValue(AlignSelfProperty, value);
802 NotifyPropertyChanged();
807 /// The Child property of FlexContainer.<br />
808 /// The space around the flex item.<br />
811 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
813 /// <since_tizen> 3 </since_tizen>
814 [Obsolete("Deprecated in API8, will be removed in API10.")]
815 public Vector4 FlexMargin
819 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
820 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
824 SetValue(FlexMarginProperty, value);
825 NotifyPropertyChanged();
830 /// The top-left cell this child occupies, if not set, the first available cell is used.
833 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
835 /// <since_tizen> 3 </since_tizen>
836 public Vector2 CellIndex
840 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
841 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
845 SetValue(CellIndexProperty, value);
846 NotifyPropertyChanged();
851 /// The number of rows this child occupies, if not set, the default value is 1.
853 /// <since_tizen> 3 </since_tizen>
858 return (float)GetValue(RowSpanProperty);
862 SetValue(RowSpanProperty, value);
863 NotifyPropertyChanged();
868 /// The number of columns this child occupies, if not set, the default value is 1.
870 /// <since_tizen> 3 </since_tizen>
871 public float ColumnSpan
875 return (float)GetValue(ColumnSpanProperty);
879 SetValue(ColumnSpanProperty, value);
880 NotifyPropertyChanged();
885 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
887 /// <since_tizen> 3 </since_tizen>
888 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
892 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
896 SetValue(CellHorizontalAlignmentProperty, value);
897 NotifyPropertyChanged();
902 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
904 /// <since_tizen> 3 </since_tizen>
905 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
909 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
913 SetValue(CellVerticalAlignmentProperty, value);
914 NotifyPropertyChanged();
919 /// The left focusable view.<br />
920 /// This will return null if not set.<br />
921 /// This will also return null if the specified left focusable view is not on a window.<br />
923 /// <since_tizen> 3 </since_tizen>
924 public View LeftFocusableView
926 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
929 return (View)GetValue(LeftFocusableViewProperty);
933 SetValue(LeftFocusableViewProperty, value);
934 NotifyPropertyChanged();
939 /// The right focusable view.<br />
940 /// This will return null if not set.<br />
941 /// This will also return null if the specified right focusable view is not on a window.<br />
943 /// <since_tizen> 3 </since_tizen>
944 public View RightFocusableView
946 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
949 return (View)GetValue(RightFocusableViewProperty);
953 SetValue(RightFocusableViewProperty, value);
954 NotifyPropertyChanged();
959 /// The up focusable view.<br />
960 /// This will return null if not set.<br />
961 /// This will also return null if the specified up focusable view is not on a window.<br />
963 /// <since_tizen> 3 </since_tizen>
964 public View UpFocusableView
966 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
969 return (View)GetValue(UpFocusableViewProperty);
973 SetValue(UpFocusableViewProperty, value);
974 NotifyPropertyChanged();
979 /// The down focusable view.<br />
980 /// This will return null if not set.<br />
981 /// This will also return null if the specified down focusable view is not on a window.<br />
983 /// <since_tizen> 3 </since_tizen>
984 public View DownFocusableView
986 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
989 return (View)GetValue(DownFocusableViewProperty);
993 SetValue(DownFocusableViewProperty, value);
994 NotifyPropertyChanged();
999 /// Whether the view should be focusable by keyboard navigation.
1001 /// <since_tizen> 3 </since_tizen>
1002 public bool Focusable
1006 SetValue(FocusableProperty, value);
1007 NotifyPropertyChanged();
1011 return (bool)GetValue(FocusableProperty);
1016 /// Retrieves the position of the view.<br />
1017 /// The coordinates are relative to the view's parent.<br />
1019 /// <since_tizen> 3 </since_tizen>
1020 public Position CurrentPosition
1024 return GetCurrentPosition();
1029 /// Sets the size of a view for the width and the height.<br />
1030 /// Geometry can be scaled to fit within this area.<br />
1031 /// This does not interfere with the view's scale factor.<br />
1032 /// The views default depth is the minimum of width and height.<br />
1035 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
1036 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
1038 /// <since_tizen> 3 </since_tizen>
1039 public Size2D Size2D
1043 Size2D temp = (Size2D)GetValue(Size2DProperty);
1044 int width = temp.Width;
1045 int height = temp.Height;
1047 if (this.Layout == null)
1049 if (width < 0) { width = 0; }
1050 if (height < 0) { height = 0; }
1053 return new Size2D(OnSize2DChanged, width, height);
1057 SetValue(Size2DProperty, value);
1059 NotifyPropertyChanged();
1064 /// Retrieves the size of the view.<br />
1065 /// The coordinates are relative to the view's parent.<br />
1067 /// <since_tizen> 3 </since_tizen>
1068 public Size2D CurrentSize
1072 return GetCurrentSize();
1077 /// Retrieves and sets the view's opacity.<br />
1079 /// <since_tizen> 3 </since_tizen>
1080 public float Opacity
1084 return (float)GetValue(OpacityProperty);
1088 SetValue(OpacityProperty, value);
1089 selectorData?.Opacity?.Reset(this);
1090 NotifyPropertyChanged();
1095 /// Sets the position of the view for X and Y.<br />
1096 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1097 /// If the position inheritance is disabled, sets the world position.<br />
1100 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1101 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1103 /// <since_tizen> 3 </since_tizen>
1104 public Position2D Position2D
1108 Position2D temp = (Position2D)GetValue(Position2DProperty);
1109 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1113 SetValue(Position2DProperty, value);
1114 NotifyPropertyChanged();
1119 /// Retrieves the screen position of the view.<br />
1121 /// <since_tizen> 3 </since_tizen>
1122 public Vector2 ScreenPosition
1126 Vector2 temp = new Vector2(0.0f, 0.0f);
1127 var pValue = GetProperty(View.Property.ScreenPosition);
1135 /// Determines whether the pivot point should be used to determine the position of the view.
1136 /// This is false by default.
1138 /// <remarks>If false, then the top-left of the view is used for the position.
1139 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1141 /// <since_tizen> 3 </since_tizen>
1142 public bool PositionUsesPivotPoint
1146 return (bool)GetValue(PositionUsesPivotPointProperty);
1150 SetValue(PositionUsesPivotPointProperty, value);
1151 NotifyPropertyChanged();
1156 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1158 /// <since_tizen> 3 </since_tizen>
1159 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1161 "View view = new View(); " +
1162 "view.PivotPoint = PivotPoint.Center; " +
1163 "view.PositionUsesPivotPoint = true;" +
1164 " Deprecated in API5: Will be removed in API8")]
1165 [EditorBrowsable(EditorBrowsableState.Never)]
1166 public bool PositionUsesAnchorPoint
1171 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1172 pValue.Get(out temp);
1178 var temp = new Tizen.NUI.PropertyValue(value);
1179 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1181 NotifyPropertyChanged();
1186 /// Queries whether the view is connected to the stage.<br />
1187 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1189 /// <since_tizen> 3 </since_tizen>
1190 public bool IsOnWindow
1199 /// Gets the depth in the hierarchy for the view.
1201 /// <since_tizen> 3 </since_tizen>
1202 public int HierarchyDepth
1206 return GetHierarchyDepth();
1211 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1214 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1215 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1216 /// The values set by this property will likely change.
1218 /// <since_tizen> 3 </since_tizen>
1219 public int SiblingOrder
1223 return (int)GetValue(SiblingOrderProperty);
1227 SetValue(SiblingOrderProperty, value);
1229 LayoutGroup layout = Layout as LayoutGroup;
1230 layout?.ChangeLayoutSiblingOrder(value);
1232 NotifyPropertyChanged();
1237 /// Returns the natural size of the view.
1240 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1242 /// <since_tizen> 5 </since_tizen>
1243 public Vector3 NaturalSize
1247 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1248 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1254 /// Returns the natural size (Size2D) of the view.
1257 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1259 /// <since_tizen> 4 </since_tizen>
1260 public Size2D NaturalSize2D
1264 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1265 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1267 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1274 /// Gets or sets the origin of a view within its parent's area.<br />
1275 /// 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 />
1276 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1277 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1279 /// <pre>The view has been initialized.</pre>
1280 /// <since_tizen> 3 </since_tizen>
1281 public Position ParentOrigin
1285 Position tmp = (Position)GetValue(ParentOriginProperty);
1286 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1290 SetValue(ParentOriginProperty, value);
1291 NotifyPropertyChanged();
1296 /// Gets or sets the anchor-point of a view.<br />
1297 /// 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 />
1298 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1299 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1300 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1301 /// <pre>The view has been initialized.</pre>
1304 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1306 /// <since_tizen> 3 </since_tizen>
1307 public Position PivotPoint
1311 Position tmp = (Position)GetValue(PivotPointProperty);
1312 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1316 SetValue(PivotPointProperty, value);
1317 NotifyPropertyChanged();
1322 /// Gets or sets the size width of the view.
1326 /// Animatable - This property can be animated using <c>Animation</c> class.
1329 /// <since_tizen> 3 </since_tizen>
1330 public float SizeWidth
1334 return (float)GetValue(SizeWidthProperty);
1338 SetValue(SizeWidthProperty, value);
1339 NotifyPropertyChanged();
1344 /// Gets or sets the size height of the view.
1348 /// Animatable - This property can be animated using <c>Animation</c> class.
1351 /// <since_tizen> 3 </since_tizen>
1352 public float SizeHeight
1356 return (float)GetValue(SizeHeightProperty);
1360 SetValue(SizeHeightProperty, value);
1361 NotifyPropertyChanged();
1366 /// Gets or sets the position of the view.<br />
1367 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1368 /// If the position inheritance is disabled, sets the world position.<br />
1372 /// Animatable - This property can be animated using <c>Animation</c> class.
1374 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1376 /// <since_tizen> 3 </since_tizen>
1377 public Position Position
1381 Position tmp = (Position)GetValue(PositionProperty);
1382 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1386 SetValue(PositionProperty, value);
1387 NotifyPropertyChanged();
1392 /// Gets or sets the position X of the view.
1396 /// Animatable - This property can be animated using <c>Animation</c> class.
1399 /// <since_tizen> 3 </since_tizen>
1400 public float PositionX
1404 return (float)GetValue(PositionXProperty);
1408 SetValue(PositionXProperty, value);
1409 NotifyPropertyChanged();
1414 /// Gets or sets the position Y of the view.
1418 /// Animatable - This property can be animated using <c>Animation</c> class.
1421 /// <since_tizen> 3 </since_tizen>
1422 public float PositionY
1426 return (float)GetValue(PositionYProperty);
1430 SetValue(PositionYProperty, value);
1431 NotifyPropertyChanged();
1436 /// Gets or sets the position Z of the view.
1440 /// Animatable - This property can be animated using <c>Animation</c> class.
1443 /// <since_tizen> 3 </since_tizen>
1444 public float PositionZ
1448 return (float)GetValue(PositionZProperty);
1452 SetValue(PositionZProperty, value);
1453 NotifyPropertyChanged();
1458 /// Gets or sets the world position of the view.
1460 /// <since_tizen> 3 </since_tizen>
1461 public Vector3 WorldPosition
1465 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1466 var pValue = GetProperty(View.Property.WorldPosition);
1474 /// Gets or sets the orientation of the view.<br />
1475 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1479 /// This is an asynchronous method.
1482 /// Animatable - This property can be animated using <c>Animation</c> class.
1485 /// <since_tizen> 3 </since_tizen>
1486 public Rotation Orientation
1490 return (Rotation)GetValue(OrientationProperty);
1494 SetValue(OrientationProperty, value);
1495 NotifyPropertyChanged();
1500 /// Gets or sets the world orientation of the view.<br />
1502 /// <since_tizen> 3 </since_tizen>
1503 public Rotation WorldOrientation
1507 Rotation temp = new Rotation();
1508 var pValue = GetProperty(View.Property.WorldOrientation);
1516 /// Gets or sets the scale factor applied to the view.<br />
1520 /// Animatable - This property can be animated using <c>Animation</c> class.
1522 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1524 /// <since_tizen> 3 </since_tizen>
1525 public Vector3 Scale
1529 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1530 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1534 SetValue(ScaleProperty, value);
1535 NotifyPropertyChanged();
1540 /// Gets or sets the scale X factor applied to the view.
1544 /// Animatable - This property can be animated using <c>Animation</c> class.
1547 /// <since_tizen> 3 </since_tizen>
1552 return (float)GetValue(ScaleXProperty);
1556 SetValue(ScaleXProperty, value);
1557 NotifyPropertyChanged();
1562 /// Gets or sets the scale Y factor applied to the view.
1566 /// Animatable - This property can be animated using <c>Animation</c> class.
1569 /// <since_tizen> 3 </since_tizen>
1574 return (float)GetValue(ScaleYProperty);
1578 SetValue(ScaleYProperty, value);
1579 NotifyPropertyChanged();
1584 /// Gets or sets the scale Z factor applied to the view.
1588 /// Animatable - This property can be animated using <c>Animation</c> class.
1591 /// <since_tizen> 3 </since_tizen>
1596 return (float)GetValue(ScaleZProperty);
1600 SetValue(ScaleZProperty, value);
1601 NotifyPropertyChanged();
1606 /// Gets the world scale of the view.
1608 /// <since_tizen> 3 </since_tizen>
1609 public Vector3 WorldScale
1613 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1614 var pValue = GetProperty(View.Property.WorldScale);
1622 /// Retrieves the visibility flag of the view.
1626 /// If the view is not visible, then the view and its children will not be rendered.
1627 /// 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.
1630 /// Animatable - This property can be animated using <c>Animation</c> class.
1633 /// <since_tizen> 3 </since_tizen>
1634 public bool Visibility
1639 var pValue = GetProperty(View.Property.VISIBLE);
1640 pValue.Get(out temp);
1647 /// Gets the view's world color.
1649 /// <since_tizen> 3 </since_tizen>
1650 public Vector4 WorldColor
1654 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1655 var pValue = GetProperty(View.Property.WorldColor);
1663 /// Gets or sets the view's name.
1665 /// <since_tizen> 3 </since_tizen>
1670 return (string)GetValue(NameProperty);
1674 SetValue(NameProperty, value);
1675 NotifyPropertyChanged();
1680 /// Get the number of children held by the view.
1682 /// <since_tizen> 3 </since_tizen>
1683 public new uint ChildCount
1687 return Convert.ToUInt32(Children.Count);
1692 /// Gets the view's ID.
1695 /// <since_tizen> 3 </since_tizen>
1705 /// Gets or sets the status of whether the view should emit touch or hover signals.
1707 /// <since_tizen> 3 </since_tizen>
1708 public bool Sensitive
1712 return (bool)GetValue(SensitiveProperty);
1716 SetValue(SensitiveProperty, value);
1717 NotifyPropertyChanged();
1722 /// 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.
1724 /// <since_tizen> 3 </since_tizen>
1725 public bool LeaveRequired
1729 return (bool)GetValue(LeaveRequiredProperty);
1733 SetValue(LeaveRequiredProperty, value);
1734 NotifyPropertyChanged();
1739 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1741 /// <since_tizen> 3 </since_tizen>
1742 public bool InheritOrientation
1746 return (bool)GetValue(InheritOrientationProperty);
1750 SetValue(InheritOrientationProperty, value);
1751 NotifyPropertyChanged();
1756 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1758 /// <since_tizen> 3 </since_tizen>
1759 public bool InheritScale
1763 return (bool)GetValue(InheritScaleProperty);
1767 SetValue(InheritScaleProperty, value);
1768 NotifyPropertyChanged();
1773 /// Gets or sets the status of how the view and its children should be drawn.<br />
1774 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1775 /// 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 />
1776 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1777 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1778 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1780 /// <since_tizen> 3 </since_tizen>
1781 public DrawModeType DrawMode
1785 return (DrawModeType)GetValue(DrawModeProperty);
1789 SetValue(DrawModeProperty, value);
1790 NotifyPropertyChanged();
1795 /// Gets or sets the relative to parent size factor of the view.<br />
1796 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1797 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1800 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1802 /// <since_tizen> 3 </since_tizen>
1803 public Vector3 SizeModeFactor
1807 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1808 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1812 SetValue(SizeModeFactorProperty, value);
1813 NotifyPropertyChanged();
1818 /// Gets or sets the width resize policy to be used.
1820 /// <since_tizen> 3 </since_tizen>
1821 public ResizePolicyType WidthResizePolicy
1825 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1829 SetValue(WidthResizePolicyProperty, value);
1830 NotifyPropertyChanged();
1835 /// Gets or sets the height resize policy to be used.
1837 /// <since_tizen> 3 </since_tizen>
1838 public ResizePolicyType HeightResizePolicy
1842 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1846 SetValue(HeightResizePolicyProperty, value);
1847 NotifyPropertyChanged();
1852 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1853 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1855 /// <since_tizen> 3 </since_tizen>
1856 public SizeScalePolicyType SizeScalePolicy
1860 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1864 SetValue(SizeScalePolicyProperty, value);
1865 NotifyPropertyChanged();
1870 /// Gets or sets the status of whether the width size is dependent on the height size.
1872 /// <since_tizen> 3 </since_tizen>
1873 public bool WidthForHeight
1877 return (bool)GetValue(WidthForHeightProperty);
1881 SetValue(WidthForHeightProperty, value);
1882 NotifyPropertyChanged();
1887 /// Gets or sets the status of whether the height size is dependent on the width size.
1889 /// <since_tizen> 3 </since_tizen>
1890 public bool HeightForWidth
1894 return (bool)GetValue(HeightForWidthProperty);
1898 SetValue(HeightForWidthProperty, value);
1899 NotifyPropertyChanged();
1904 /// Gets or sets the padding for use in layout.
1907 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1909 /// <since_tizen> 5 </since_tizen>
1910 public Extents Padding
1914 // If View has a Layout then padding in stored in the base Layout class
1917 return Layout.Padding;
1921 Extents temp = (Extents)GetValue(PaddingProperty);
1922 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1924 // Two return points to prevent creating a zeroed Extent native object before assignment
1928 Extents padding = value;
1931 // Layout set so store Padding in LayoutItem instead of in View.
1932 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1933 // the position and sizes measure in the Layouting.
1934 Layout.Padding = value;
1935 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1936 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1937 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1939 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1943 SetValue(PaddingProperty, padding);
1944 NotifyPropertyChanged();
1949 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1951 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1953 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1955 /// <since_tizen> 3 </since_tizen>
1956 public Size2D MinimumSize
1960 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1961 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1967 throw new ArgumentNullException(nameof(value));
1971 // Note: it only works if minimum size is >= than natural size.
1972 // To force the size it should be done through the width&height spec or Size2D.
1973 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1974 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1975 layout.RequestLayout();
1977 SetValue(MinimumSizeProperty, value);
1978 NotifyPropertyChanged();
1983 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1986 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1988 /// <since_tizen> 3 </since_tizen>
1989 public Size2D MaximumSize
1993 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1994 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1998 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1999 // MATCH_PARENT spec + parent container size can be used to limit
2002 layout.RequestLayout();
2004 SetValue(MaximumSizeProperty, value);
2005 NotifyPropertyChanged();
2010 /// Gets or sets whether a child view inherits it's parent's position.<br />
2011 /// Default is to inherit.<br />
2012 /// 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 />
2014 /// <since_tizen> 3 </since_tizen>
2015 public bool InheritPosition
2019 return (bool)GetValue(InheritPositionProperty);
2023 SetValue(InheritPositionProperty, value);
2024 NotifyPropertyChanged();
2029 /// Gets or sets the clipping behavior (mode) of it's children.
2031 /// <since_tizen> 3 </since_tizen>
2032 public ClippingModeType ClippingMode
2036 return (ClippingModeType)GetValue(ClippingModeProperty);
2040 SetValue(ClippingModeProperty, value);
2041 NotifyPropertyChanged();
2046 /// Gets the number of renderers held by the view.
2048 /// <since_tizen> 3 </since_tizen>
2049 public uint RendererCount
2053 return GetRendererCount();
2058 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2061 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2063 /// <since_tizen> 3 </since_tizen>
2064 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2066 "View view = new View(); " +
2067 "view.PivotPoint = PivotPoint.Center; " +
2068 "view.PositionUsesPivotPoint = true;")]
2069 [EditorBrowsable(EditorBrowsableState.Never)]
2070 public Position AnchorPoint
2074 Position temp = new Position(0.0f, 0.0f, 0.0f);
2075 var pValue = GetProperty(View.Property.AnchorPoint);
2078 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2084 var temp = new Tizen.NUI.PropertyValue(value);
2085 SetProperty(View.Property.AnchorPoint, temp);
2087 NotifyPropertyChanged();
2092 /// Sets the size of a view for the width, the height and the depth.<br />
2093 /// Geometry can be scaled to fit within this area.<br />
2094 /// This does not interfere with the view's scale factor.<br />
2095 /// The views default depth is the minimum of width and height.<br />
2099 /// Animatable - This property can be animated using <c>Animation</c> class.
2101 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2103 /// <since_tizen> 5 </since_tizen>
2108 Size tmp = (Size)GetValue(SizeProperty);
2109 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2113 SetValue(SizeProperty, value);
2114 NotifyPropertyChanged();
2119 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2121 /// <since_tizen> 3 </since_tizen>
2122 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2124 "Container parent = view.GetParent(); " +
2125 "View view = parent as View;")]
2126 [EditorBrowsable(EditorBrowsableState.Never)]
2127 public new View Parent
2132 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2133 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2134 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2136 if (basehandle is Layer layer)
2138 ret = new View(Layer.getCPtr(layer).Handle, false);
2139 NUILog.Error("This Parent property is deprecated, should do not be used");
2143 ret = basehandle as View;
2146 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2147 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2149 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2155 /// Gets/Sets whether inherit parent's the layout Direction.
2157 /// <since_tizen> 4 </since_tizen>
2158 public bool InheritLayoutDirection
2162 return (bool)GetValue(InheritLayoutDirectionProperty);
2166 SetValue(InheritLayoutDirectionProperty, value);
2167 NotifyPropertyChanged();
2172 /// Gets/Sets the layout Direction.
2174 /// <since_tizen> 4 </since_tizen>
2175 public ViewLayoutDirectionType LayoutDirection
2179 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2183 SetValue(LayoutDirectionProperty, value);
2184 NotifyPropertyChanged();
2185 layout?.RequestLayout();
2190 /// Gets or sets the Margin for use in layout.
2193 /// Margin property is supported by Layout algorithms and containers.
2194 /// Please Set Layout if you want to use Margin property.
2195 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2197 /// <since_tizen> 4 </since_tizen>
2198 public Extents Margin
2202 // If View has a Layout then margin is stored in Layout.
2205 return Layout.Margin;
2209 // If Layout not set then return margin stored in View.
2210 Extents temp = (Extents)GetValue(MarginProperty);
2211 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2213 // Two return points to prevent creating a zeroed Extent native object before assignment
2219 // Layout set so store Margin in LayoutItem instead of View.
2220 // If View stores the Margin too then the Legacy Size Negotiation will
2221 // overwrite the position and size values measured in the Layouting.
2222 Layout.Margin = value;
2223 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2224 layout?.RequestLayout();
2228 SetValue(MarginProperty, value);
2230 NotifyPropertyChanged();
2231 layout?.RequestLayout();
2236 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2238 /// <since_tizen> 6 </since_tizen>
2239 public int WidthSpecification
2247 if (value == widthPolicy)
2250 widthPolicy = value;
2251 if (widthPolicy >= 0)
2253 if (heightPolicy >= 0) // Policy an exact value
2255 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2256 Size2D = new Size2D(widthPolicy, heightPolicy);
2259 layout?.RequestLayout();
2264 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2266 /// <since_tizen> 6 </since_tizen>
2267 public int HeightSpecification
2271 return heightPolicy;
2275 if (value == heightPolicy)
2278 heightPolicy = value;
2279 if (heightPolicy >= 0)
2281 if (widthPolicy >= 0) // Policy an exact value
2283 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2284 Size2D = new Size2D(widthPolicy, heightPolicy);
2287 layout?.RequestLayout();
2292 /// Gets the List of transitions for this View.
2294 /// <since_tizen> 6 </since_tizen>
2295 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2299 if (layoutTransitions == null)
2301 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2303 return layoutTransitions;
2308 /// Set a layout transitions for this View.
2310 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2312 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2314 /// <since_tizen> 6 </since_tizen>
2315 public LayoutTransition LayoutTransition
2319 return layoutTransition;
2325 throw new global::System.ArgumentNullException(nameof(value));
2327 if (layoutTransitions == null)
2329 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2332 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2334 AttachTransitionsToChildren(value);
2336 layoutTransition = value;
2341 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2344 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2346 /// <since_tizen> 4 </since_tizen>
2347 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2348 [EditorBrowsable(EditorBrowsableState.Never)]
2349 public Extents PaddingEX
2353 Extents temp = new Extents(0, 0, 0, 0);
2354 var pValue = GetProperty(View.Property.PADDING);
2357 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2363 var temp = new Tizen.NUI.PropertyValue(value);
2364 SetProperty(View.Property.PADDING, temp);
2366 NotifyPropertyChanged();
2367 layout?.RequestLayout();
2372 /// The Color of View. This is an RGBA value.
2376 /// Animatable - This property can be animated using <c>Animation</c> class.
2378 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2380 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2381 [EditorBrowsable(EditorBrowsableState.Never)]
2386 Color temp = (Color)GetValue(ColorProperty);
2387 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2391 SetValue(ColorProperty, value);
2392 selectorData?.Color?.Reset(this);
2393 NotifyPropertyChanged();
2398 /// Set the layout on this View. Replaces any existing Layout.
2401 /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore.
2403 /// <since_tizen> 6 </since_tizen>
2404 public LayoutItem Layout
2412 // Do nothing if layout provided is already set on this View.
2413 if (value == layout)
2418 LayoutingDisabled = false;
2421 // If new layout being set already has a owner then that owner receives a replacement default layout.
2422 // First check if the layout to be set already has a owner.
2423 if (value?.Owner != null)
2425 // Previous owner of the layout gets a default layout as a replacement.
2426 value.Owner.Layout = new AbsoluteLayout();
2428 // Copy Margin and Padding to replacement LayoutGroup.
2429 if (value.Owner.Layout != null)
2431 value.Owner.Layout.Margin = value.Margin;
2432 value.Owner.Layout.Padding = value.Padding;
2436 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2437 // View if no replacement. Previously margin and padding values would have been moved from
2438 // the View to the layout.
2439 if (layout != null) // Existing layout
2443 // Existing layout being replaced so copy over margin and padding values.
2444 value.Margin = layout.Margin;
2445 value.Padding = layout.Padding;
2449 // Layout not being replaced so restore margin and padding to View.
2450 SetValue(MarginProperty, layout.Margin);
2451 SetValue(PaddingProperty, layout.Padding);
2452 NotifyPropertyChanged();
2457 // First Layout to be added to the View hence copy
2459 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2462 Extents margin = Margin;
2463 Extents padding = Padding;
2464 if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0)
2466 // If View already has a margin set then store it in Layout instead.
2467 value.Margin = margin;
2468 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2469 NotifyPropertyChanged();
2472 if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0)
2474 // If View already has a padding set then store it in Layout instead.
2475 value.Padding = padding;
2477 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2478 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2479 if (typeof(LayoutGroup).IsAssignableFrom(value.GetType()))
2481 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2482 NotifyPropertyChanged();
2488 // Remove existing layout from it's parent layout group.
2491 value.SetPositionByLayout = !excludeLayouting;
2493 // Set layout to this view
2499 /// The weight of the View, used to share available space in a layout with siblings.
2501 /// <since_tizen> 6 </since_tizen>
2511 layout?.RequestLayout();
2516 /// Whether to load the BackgroundImage synchronously.
2517 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2518 /// Note: For Normal Quad images only.
2520 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2521 [EditorBrowsable(EditorBrowsableState.Never)]
2522 public bool BackgroundImageSynchronosLoading
2526 return backgroundImageSynchronosLoading;
2530 backgroundImageSynchronosLoading = value;
2532 string bgUrl = null;
2533 var pValue = Background.Find(ImageVisualProperty.URL);
2534 pValue?.Get(out bgUrl);
2537 if (!string.IsNullOrEmpty(bgUrl))
2539 PropertyMap bgMap = this.Background;
2540 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2541 bgMap.Add("synchronousLoading", temp);
2548 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2549 [EditorBrowsable(EditorBrowsableState.Never)]
2550 public Vector2 UpdateSizeHint
2554 return (Vector2)GetValue(UpdateSizeHintProperty);
2558 SetValue(UpdateSizeHintProperty, value);
2559 NotifyPropertyChanged();
2564 /// Enable/Disable ControlState propagation for children.
2565 /// It is false by default.
2566 /// If the View needs to share ControlState with descendants, please set it true.
2567 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2569 [EditorBrowsable(EditorBrowsableState.Never)]
2570 public bool EnableControlStatePropagation
2572 get => controlStatePropagation;
2575 controlStatePropagation = value;
2577 foreach (View child in Children)
2579 child.EnableControlStatePropagation = value;
2585 /// By default, it is false in View, true in Control.
2586 /// Note that if the value is true, the View will be a touch receptor.
2588 [EditorBrowsable(EditorBrowsableState.Never)]
2589 public bool EnableControlState
2593 return (bool)GetValue(EnableControlStateProperty);
2597 SetValue(EnableControlStateProperty, value);
2602 /// Whether the actor grab all touches even if touch leaves its boundary.
2604 /// <returns>true, if it grab all touch after start</returns>
2605 [EditorBrowsable(EditorBrowsableState.Never)]
2606 public bool GrabTouchAfterLeave
2611 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2612 pValue.Get(out temp);
2618 var temp = new Tizen.NUI.PropertyValue(value);
2619 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2621 NotifyPropertyChanged();
2626 /// Determines which blend equation will be used to render renderers of this actor.
2628 /// <returns>blend equation enum currently assigned</returns>
2629 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2630 [EditorBrowsable(EditorBrowsableState.Never)]
2631 public BlendEquationType BlendEquation
2636 var pValue = GetProperty(View.Property.BlendEquation);
2637 pValue.Get(out temp);
2639 return (BlendEquationType)temp;
2643 var temp = new Tizen.NUI.PropertyValue((int)value);
2644 SetProperty(View.Property.BlendEquation, temp);
2646 NotifyPropertyChanged();
2651 /// If the value is true, the View will change its style as the theme changes.
2652 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2654 [EditorBrowsable(EditorBrowsableState.Never)]
2655 public bool ThemeChangeSensitive
2657 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2658 set => SetValue(ThemeChangeSensitiveProperty, value);
2662 /// Create Style, it is abstract function and must be override.
2664 [EditorBrowsable(EditorBrowsableState.Never)]
2665 protected virtual ViewStyle CreateViewStyle()
2667 return new ViewStyle();
2671 /// Called after the View's ControlStates changed.
2673 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2674 [EditorBrowsable(EditorBrowsableState.Never)]
2675 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2681 [EditorBrowsable(EditorBrowsableState.Never)]
2682 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2687 private bool IsViewPropertyDirty(BindableProperty styleProperty)
2689 if (dirtyPropertySet.Count == 0)
2694 if (styleProperty.ReturnType.IsGenericType && styleProperty.ReturnType.GetGenericTypeDefinition() == typeof(Selector<>))
2696 return dirtyPropertySet.Contains(styleProperty.PropertyName.Substring(0, styleProperty.PropertyName.Length - 8));
2699 return dirtyPropertySet.Contains(styleProperty.PropertyName);
2703 /// Apply style instance to the view.
2704 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2706 [EditorBrowsable(EditorBrowsableState.Never)]
2707 public virtual void ApplyStyle(ViewStyle viewStyle)
2709 if (viewStyle == null || this.viewStyle == viewStyle) return;
2711 this.viewStyle = viewStyle;
2713 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2719 if (dirtyPropertySet == null)
2721 dirtyPropertySet = new HashSet<string>();
2724 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2726 if (bindablePropertyOfView == null)
2731 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2732 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2734 foreach (var sourceProperty in dirtyStyleProperties)
2736 if (blockSetDirty && IsViewPropertyDirty(sourceProperty))
2738 // Skip applying theme style for a property set by user.
2742 var sourceValue = viewStyle.GetValue(sourceProperty);
2744 if (sourceValue == null)
2749 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2751 if (destinationProperty != null)
2753 SetValue(destinationProperty, sourceValue);
2759 /// Get whether the View is culled or not.
2760 /// True means that the View is out of the view frustum.
2763 /// Hidden-API (Inhouse-API).
2765 [EditorBrowsable(EditorBrowsableState.Never)]
2771 var pValue = GetProperty(View.Property.Culled);
2772 pValue.Get(out temp);