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);
214 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
215 [EditorBrowsable(EditorBrowsableState.Never)]
216 public bool ExcludeLayouting
220 return excludeLayouting;
224 excludeLayouting = value;
225 if (Layout != null && Layout.SetPositionByLayout == value)
227 Layout.SetPositionByLayout = !value;
228 Layout.RequestLayout();
233 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
234 [EditorBrowsable(EditorBrowsableState.Never)]
235 public bool IsResourcesCreated
239 return Application.Current.IsResourcesCreated;
243 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
244 [EditorBrowsable(EditorBrowsableState.Never)]
245 public ResourceDictionary XamlResources
249 return Application.Current.XamlResources;
253 Application.Current.XamlResources = value;
258 /// The StyleName, type string.
259 /// The value indicates DALi style name defined in json theme file.
261 /// <since_tizen> 3 </since_tizen>
262 public string StyleName
266 return (string)GetValue(StyleNameProperty);
270 SetValue(StyleNameProperty, value);
271 NotifyPropertyChanged();
276 /// The KeyInputFocus, type bool.
278 [EditorBrowsable(EditorBrowsableState.Never)]
279 public bool KeyInputFocus
283 return (bool)GetValue(KeyInputFocusProperty);
287 SetValue(KeyInputFocusProperty, value);
288 NotifyPropertyChanged();
293 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
297 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
300 /// Animatable - This property can be animated using <c>Animation</c> class.
302 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
306 /// <since_tizen> 3 </since_tizen>
307 public Color BackgroundColor
311 Color temp = (Color)GetValue(BackgroundColorProperty);
312 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
316 SetValue(BackgroundColorProperty, value);
317 if (selectorData != null)
319 selectorData.BackgroundImage?.Reset(this);
320 selectorData.BackgroundColor?.Reset(this);
322 NotifyPropertyChanged();
327 /// The mutually exclusive with "backgroundColor" and "background" type Map.
329 /// <since_tizen> 3 </since_tizen>
330 public string BackgroundImage
334 return (string)GetValue(BackgroundImageProperty);
338 SetValue(BackgroundImageProperty, value);
339 if (selectorData != null)
341 selectorData.BackgroundColor?.Reset(this);
342 selectorData.BackgroundImage?.Reset(this);
344 NotifyPropertyChanged();
349 /// Get or set the border of background image.
351 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
352 [EditorBrowsable(EditorBrowsableState.Never)]
353 public Rectangle BackgroundImageBorder
357 return (Rectangle)GetValue(BackgroundImageBorderProperty);
361 SetValue(BackgroundImageBorderProperty, value);
362 selectorData?.BackgroundImageBorder?.Reset(this);
363 NotifyPropertyChanged();
368 /// The background of view.
370 /// <since_tizen> 3 </since_tizen>
371 public Tizen.NUI.PropertyMap Background
375 return (PropertyMap)GetValue(BackgroundProperty);
379 SetValue(BackgroundProperty, value);
380 NotifyPropertyChanged();
385 /// Describes a shadow as an image for a View.
386 /// It is null by default.
389 /// Getter returns copied instance of current shadow.
392 /// The mutually exclusive with "BoxShadow".
396 /// Animatable - This property can be animated using <c>Animation</c> class.
397 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
399 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
401 /// Animatable sub-property : Offset.
404 [EditorBrowsable(EditorBrowsableState.Never)]
405 public ImageShadow ImageShadow
409 return (ImageShadow)GetValue(ImageShadowProperty);
413 SetValue(ImageShadowProperty, value);
414 if (selectorData != null)
416 selectorData.BoxShadow?.Reset(this);
417 selectorData.ImageShadow?.Reset(this);
419 NotifyPropertyChanged();
424 /// Describes a box shaped shadow drawing for a View.
425 /// It is null by default.
428 /// Getter returns copied instance of current shadow.
431 /// The mutually exclusive with "ImageShadow".
435 /// Animatable - This property can be animated using <c>Animation</c> class.
436 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
438 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
440 /// Animatable sub-property : Offset, Color, BlurRadius.
443 [EditorBrowsable(EditorBrowsableState.Never)]
444 public Shadow BoxShadow
448 return (Shadow)GetValue(BoxShadowProperty);
452 SetValue(BoxShadowProperty, value);
453 if (selectorData != null)
455 selectorData.ImageShadow?.Reset(this);
456 selectorData.BoxShadow?.Reset(this);
458 NotifyPropertyChanged();
463 /// The radius for the rounded corners of the View.
464 /// This will rounds background and shadow edges.
465 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
469 /// Animatable - This property can be animated using <c>Animation</c> class.
472 [EditorBrowsable(EditorBrowsableState.Never)]
473 public float CornerRadius
477 return (float)GetValue(CornerRadiusProperty);
481 SetValue(CornerRadiusProperty, value);
482 NotifyPropertyChanged();
490 [EditorBrowsable(EditorBrowsableState.Never)]
491 protected bool IsHighlighted
495 return Accessibility.AccessibilityManager.Instance.GetCurrentFocusView() == this;
499 [EditorBrowsable(EditorBrowsableState.Never)]
500 protected static readonly string AccessibilityActivateAction = "activate";
501 [EditorBrowsable(EditorBrowsableState.Never)]
502 protected static readonly string AccessibilityReadingSkippedAction = "ReadingSkipped";
503 [EditorBrowsable(EditorBrowsableState.Never)]
504 protected static readonly string AccessibilityReadingCancelledAction = "ReadingCancelled";
505 [EditorBrowsable(EditorBrowsableState.Never)]
506 protected static readonly string AccessibilityReadingStoppedAction = "ReadingStopped";
507 [EditorBrowsable(EditorBrowsableState.Never)]
508 protected static readonly string AccessibilityReadingPausedAction = "ReadingPaused";
509 [EditorBrowsable(EditorBrowsableState.Never)]
510 protected static readonly string AccessibilityReadingResumedAction = "ReadingResumed";
512 [EditorBrowsable(EditorBrowsableState.Never)]
513 private static readonly string[] AccessibilityActions = {
514 AccessibilityActivateAction,
515 AccessibilityReadingSkippedAction,
516 AccessibilityReadingCancelledAction,
517 AccessibilityReadingStoppedAction,
518 AccessibilityReadingPausedAction,
519 AccessibilityReadingResumedAction,
522 [EditorBrowsable(EditorBrowsableState.Never)]
523 protected virtual string AccessibilityGetName()
528 [EditorBrowsable(EditorBrowsableState.Never)]
529 protected virtual string AccessibilityGetDescription()
534 [EditorBrowsable(EditorBrowsableState.Never)]
535 protected virtual bool AccessibilityDoAction(string name)
540 [EditorBrowsable(EditorBrowsableState.Never)]
541 protected virtual AccessibilityStates AccessibilityCalculateStates()
543 var states = new AccessibilityStates();
544 states.Set(AccessibilityState.Highlightable, this.AccessibilityHighlightable);
545 states.Set(AccessibilityState.Focusable, this.Focusable);
546 states.Set(AccessibilityState.Focused, this.State == States.Focused);
547 states.Set(AccessibilityState.Highlighted, this.IsHighlighted);
548 states.Set(AccessibilityState.Enabled, this.State != States.Disabled);
549 states.Set(AccessibilityState.Sensitive, this.Sensitive);
550 states.Set(AccessibilityState.Animated, this.AccessibilityAnimated);
551 states.Set(AccessibilityState.Visible, true);
552 states.Set(AccessibilityState.Showing, this.Visibility);
553 states.Set(AccessibilityState.Defunct, !this.IsOnWindow);
557 [EditorBrowsable(EditorBrowsableState.Never)]
558 protected virtual int AccessibilityGetActionCount()
560 return AccessibilityActions.Length;
563 [EditorBrowsable(EditorBrowsableState.Never)]
564 protected virtual string AccessibilityGetActionName(int index)
566 if (index >= 0 && index < AccessibilityActions.Length)
567 return AccessibilityActions[index];
572 [EditorBrowsable(EditorBrowsableState.Never)]
573 protected virtual bool AccessibilityShouldReportZeroChildren()
578 [EditorBrowsable(EditorBrowsableState.Never)]
579 protected virtual double AccessibilityGetMinimum()
584 [EditorBrowsable(EditorBrowsableState.Never)]
585 protected virtual double AccessibilityGetCurrent()
590 [EditorBrowsable(EditorBrowsableState.Never)]
591 protected virtual double AccessibilityGetMaximum()
596 [EditorBrowsable(EditorBrowsableState.Never)]
597 protected virtual bool AccessibilitySetCurrent(double value)
602 [EditorBrowsable(EditorBrowsableState.Never)]
603 protected virtual double AccessibilityGetMinimumIncrement()
608 [EditorBrowsable(EditorBrowsableState.Never)]
609 protected virtual bool AccessibilityIsScrollable()
614 [EditorBrowsable(EditorBrowsableState.Never)]
615 protected virtual string AccessibilityGetText(int startOffset, int endOffset)
620 [EditorBrowsable(EditorBrowsableState.Never)]
621 protected virtual int AccessibilityGetCharacterCount()
626 [EditorBrowsable(EditorBrowsableState.Never)]
627 protected virtual int AccessibilityGetCaretOffset()
632 [EditorBrowsable(EditorBrowsableState.Never)]
633 protected virtual bool AccessibilitySetCaretOffset(int offset)
638 [EditorBrowsable(EditorBrowsableState.Never)]
639 protected virtual AccessibilityRange AccessibilityGetTextAtOffset(int offset, TextBoundary boundary)
641 return new AccessibilityRange();
644 [EditorBrowsable(EditorBrowsableState.Never)]
645 protected virtual AccessibilityRange AccessibilityGetSelection(int selectionNum)
647 return new AccessibilityRange();
650 [EditorBrowsable(EditorBrowsableState.Never)]
651 protected virtual bool AccessibilityRemoveSelection(int selectionNum)
656 [EditorBrowsable(EditorBrowsableState.Never)]
657 protected virtual bool AccessibilitySetSelection(int selectionNum, int startOffset, int endOffset)
662 [EditorBrowsable(EditorBrowsableState.Never)]
663 protected virtual bool AccessibilityCopyText(int startPosition, int endPosition)
668 [EditorBrowsable(EditorBrowsableState.Never)]
669 protected virtual bool AccessibilityCutText(int startPosition, int endPosition)
675 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
676 /// It is absolute by default.
677 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
679 [EditorBrowsable(EditorBrowsableState.Never)]
680 public VisualTransformPolicyType CornerRadiusPolicy
682 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
683 set => SetValue(CornerRadiusPolicyProperty, value);
687 /// The current state of the view.
689 /// <since_tizen> 3 </since_tizen>
694 return (States)GetValue(StateProperty);
698 SetValue(StateProperty, value);
699 NotifyPropertyChanged();
704 /// The current sub state of the view.
706 /// <since_tizen> 3 </since_tizen>
707 public States SubState
711 return (States)GetValue(SubStateProperty);
715 SetValue(SubStateProperty, value);
716 NotifyPropertyChanged();
721 /// Displays a tooltip
723 /// <since_tizen> 3 </since_tizen>
724 public Tizen.NUI.PropertyMap Tooltip
728 return (PropertyMap)GetValue(TooltipProperty);
732 SetValue(TooltipProperty, value);
733 NotifyPropertyChanged();
738 /// Displays a tooltip as a text.
740 /// <since_tizen> 3 </since_tizen>
741 public string TooltipText
745 using (var propertyValue = GetProperty(Property.TOOLTIP))
747 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
749 return retrivedValue;
751 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
752 return "error to get TooltipText";
757 var temp = new Tizen.NUI.PropertyValue(value);
758 SetProperty(View.Property.TOOLTIP, temp);
760 NotifyPropertyChanged();
765 /// The Child property of FlexContainer.<br />
766 /// The proportion of the free space in the container, the flex item will receive.<br />
767 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
769 /// <since_tizen> 3 </since_tizen>
770 [Obsolete("Deprecated in API8, will be removed in API10.")]
775 return (float)GetValue(FlexProperty);
779 SetValue(FlexProperty, value);
780 NotifyPropertyChanged();
785 /// The Child property of FlexContainer.<br />
786 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
788 /// <since_tizen> 3 </since_tizen>
789 [Obsolete("Deprecated in API8, will be removed in API10.")]
794 return (int)GetValue(AlignSelfProperty);
798 SetValue(AlignSelfProperty, value);
799 NotifyPropertyChanged();
804 /// The Child property of FlexContainer.<br />
805 /// The space around the flex item.<br />
808 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
810 /// <since_tizen> 3 </since_tizen>
811 [Obsolete("Deprecated in API8, will be removed in API10.")]
812 public Vector4 FlexMargin
816 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
817 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
821 SetValue(FlexMarginProperty, value);
822 NotifyPropertyChanged();
827 /// The top-left cell this child occupies, if not set, the first available cell is used.
830 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
832 /// <since_tizen> 3 </since_tizen>
833 public Vector2 CellIndex
837 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
838 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
842 SetValue(CellIndexProperty, value);
843 NotifyPropertyChanged();
848 /// The number of rows this child occupies, if not set, the default value is 1.
850 /// <since_tizen> 3 </since_tizen>
855 return (float)GetValue(RowSpanProperty);
859 SetValue(RowSpanProperty, value);
860 NotifyPropertyChanged();
865 /// The number of columns this child occupies, if not set, the default value is 1.
867 /// <since_tizen> 3 </since_tizen>
868 public float ColumnSpan
872 return (float)GetValue(ColumnSpanProperty);
876 SetValue(ColumnSpanProperty, value);
877 NotifyPropertyChanged();
882 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
884 /// <since_tizen> 3 </since_tizen>
885 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
889 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
893 SetValue(CellHorizontalAlignmentProperty, value);
894 NotifyPropertyChanged();
899 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
901 /// <since_tizen> 3 </since_tizen>
902 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
906 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
910 SetValue(CellVerticalAlignmentProperty, value);
911 NotifyPropertyChanged();
916 /// The left focusable view.<br />
917 /// This will return null if not set.<br />
918 /// This will also return null if the specified left focusable view is not on a window.<br />
920 /// <since_tizen> 3 </since_tizen>
921 public View LeftFocusableView
923 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
926 return (View)GetValue(LeftFocusableViewProperty);
930 SetValue(LeftFocusableViewProperty, value);
931 NotifyPropertyChanged();
936 /// The right focusable view.<br />
937 /// This will return null if not set.<br />
938 /// This will also return null if the specified right focusable view is not on a window.<br />
940 /// <since_tizen> 3 </since_tizen>
941 public View RightFocusableView
943 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
946 return (View)GetValue(RightFocusableViewProperty);
950 SetValue(RightFocusableViewProperty, value);
951 NotifyPropertyChanged();
956 /// The up focusable view.<br />
957 /// This will return null if not set.<br />
958 /// This will also return null if the specified up focusable view is not on a window.<br />
960 /// <since_tizen> 3 </since_tizen>
961 public View UpFocusableView
963 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
966 return (View)GetValue(UpFocusableViewProperty);
970 SetValue(UpFocusableViewProperty, value);
971 NotifyPropertyChanged();
976 /// The down focusable view.<br />
977 /// This will return null if not set.<br />
978 /// This will also return null if the specified down focusable view is not on a window.<br />
980 /// <since_tizen> 3 </since_tizen>
981 public View DownFocusableView
983 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
986 return (View)GetValue(DownFocusableViewProperty);
990 SetValue(DownFocusableViewProperty, value);
991 NotifyPropertyChanged();
996 /// Whether the view should be focusable by keyboard navigation.
998 /// <since_tizen> 3 </since_tizen>
999 public bool Focusable
1003 SetValue(FocusableProperty, value);
1004 NotifyPropertyChanged();
1008 return (bool)GetValue(FocusableProperty);
1013 /// Retrieves the position of the view.<br />
1014 /// The coordinates are relative to the view's parent.<br />
1016 /// <since_tizen> 3 </since_tizen>
1017 public Position CurrentPosition
1021 return GetCurrentPosition();
1026 /// Sets the size of a view for the width and the height.<br />
1027 /// Geometry can be scaled to fit within this area.<br />
1028 /// This does not interfere with the view's scale factor.<br />
1029 /// The views default depth is the minimum of width and height.<br />
1032 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
1033 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
1035 /// <since_tizen> 3 </since_tizen>
1036 public Size2D Size2D
1040 Size2D temp = (Size2D)GetValue(Size2DProperty);
1041 int width = temp.Width;
1042 int height = temp.Height;
1044 if (this.Layout == null)
1046 if (width < 0) { width = 0; }
1047 if (height < 0) { height = 0; }
1050 return new Size2D(OnSize2DChanged, width, height);
1054 SetValue(Size2DProperty, value);
1056 NotifyPropertyChanged();
1061 /// Retrieves the size of the view.<br />
1062 /// The coordinates are relative to the view's parent.<br />
1064 /// <since_tizen> 3 </since_tizen>
1065 public Size2D CurrentSize
1069 return GetCurrentSize();
1074 /// Retrieves and sets the view's opacity.<br />
1076 /// <since_tizen> 3 </since_tizen>
1077 public float Opacity
1081 return (float)GetValue(OpacityProperty);
1085 SetValue(OpacityProperty, value);
1086 selectorData?.Opacity?.Reset(this);
1087 NotifyPropertyChanged();
1092 /// Sets the position of the view for X and Y.<br />
1093 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1094 /// If the position inheritance is disabled, sets the world position.<br />
1097 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1098 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1100 /// <since_tizen> 3 </since_tizen>
1101 public Position2D Position2D
1105 Position2D temp = (Position2D)GetValue(Position2DProperty);
1106 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1110 SetValue(Position2DProperty, value);
1111 NotifyPropertyChanged();
1116 /// Retrieves the screen position of the view.<br />
1118 /// <since_tizen> 3 </since_tizen>
1119 public Vector2 ScreenPosition
1123 Vector2 temp = new Vector2(0.0f, 0.0f);
1124 var pValue = GetProperty(View.Property.ScreenPosition);
1132 /// Determines whether the pivot point should be used to determine the position of the view.
1133 /// This is false by default.
1135 /// <remarks>If false, then the top-left of the view is used for the position.
1136 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1138 /// <since_tizen> 3 </since_tizen>
1139 public bool PositionUsesPivotPoint
1143 return (bool)GetValue(PositionUsesPivotPointProperty);
1147 SetValue(PositionUsesPivotPointProperty, value);
1148 NotifyPropertyChanged();
1153 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1155 /// <since_tizen> 3 </since_tizen>
1156 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1158 "View view = new View(); " +
1159 "view.PivotPoint = PivotPoint.Center; " +
1160 "view.PositionUsesPivotPoint = true;" +
1161 " Deprecated in API5: Will be removed in API8")]
1162 [EditorBrowsable(EditorBrowsableState.Never)]
1163 public bool PositionUsesAnchorPoint
1168 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1169 pValue.Get(out temp);
1175 var temp = new Tizen.NUI.PropertyValue(value);
1176 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1178 NotifyPropertyChanged();
1183 /// Queries whether the view is connected to the stage.<br />
1184 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1186 /// <since_tizen> 3 </since_tizen>
1187 public bool IsOnWindow
1196 /// Gets the depth in the hierarchy for the view.
1198 /// <since_tizen> 3 </since_tizen>
1199 public int HierarchyDepth
1203 return GetHierarchyDepth();
1208 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1211 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1212 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1213 /// The values set by this property will likely change.
1215 /// <since_tizen> 3 </since_tizen>
1216 public int SiblingOrder
1220 return (int)GetValue(SiblingOrderProperty);
1224 SetValue(SiblingOrderProperty, value);
1226 LayoutGroup layout = Layout as LayoutGroup;
1227 layout?.ChangeLayoutSiblingOrder(value);
1229 NotifyPropertyChanged();
1234 /// Returns the natural size of the view.
1237 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1239 /// <since_tizen> 5 </since_tizen>
1240 public Vector3 NaturalSize
1244 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1245 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1251 /// Returns the natural size (Size2D) of the view.
1254 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1256 /// <since_tizen> 4 </since_tizen>
1257 public Size2D NaturalSize2D
1261 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1262 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1264 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1271 /// Gets or sets the origin of a view within its parent's area.<br />
1272 /// 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 />
1273 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1274 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1276 /// <pre>The view has been initialized.</pre>
1277 /// <since_tizen> 3 </since_tizen>
1278 public Position ParentOrigin
1282 Position tmp = (Position)GetValue(ParentOriginProperty);
1283 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1287 SetValue(ParentOriginProperty, value);
1288 NotifyPropertyChanged();
1293 /// Gets or sets the anchor-point of a view.<br />
1294 /// 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 />
1295 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1296 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1297 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1298 /// <pre>The view has been initialized.</pre>
1301 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1303 /// <since_tizen> 3 </since_tizen>
1304 public Position PivotPoint
1308 Position tmp = (Position)GetValue(PivotPointProperty);
1309 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1313 SetValue(PivotPointProperty, value);
1314 NotifyPropertyChanged();
1319 /// Gets or sets the size width of the view.
1323 /// Animatable - This property can be animated using <c>Animation</c> class.
1326 /// <since_tizen> 3 </since_tizen>
1327 public float SizeWidth
1331 return (float)GetValue(SizeWidthProperty);
1335 SetValue(SizeWidthProperty, value);
1336 NotifyPropertyChanged();
1341 /// Gets or sets the size height of the view.
1345 /// Animatable - This property can be animated using <c>Animation</c> class.
1348 /// <since_tizen> 3 </since_tizen>
1349 public float SizeHeight
1353 return (float)GetValue(SizeHeightProperty);
1357 SetValue(SizeHeightProperty, value);
1358 NotifyPropertyChanged();
1363 /// Gets or sets the position of the view.<br />
1364 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1365 /// If the position inheritance is disabled, sets the world position.<br />
1369 /// Animatable - This property can be animated using <c>Animation</c> class.
1371 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1373 /// <since_tizen> 3 </since_tizen>
1374 public Position Position
1378 Position tmp = (Position)GetValue(PositionProperty);
1379 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1383 SetValue(PositionProperty, value);
1384 NotifyPropertyChanged();
1389 /// Gets or sets the position X of the view.
1393 /// Animatable - This property can be animated using <c>Animation</c> class.
1396 /// <since_tizen> 3 </since_tizen>
1397 public float PositionX
1401 return (float)GetValue(PositionXProperty);
1405 SetValue(PositionXProperty, value);
1406 NotifyPropertyChanged();
1411 /// Gets or sets the position Y of the view.
1415 /// Animatable - This property can be animated using <c>Animation</c> class.
1418 /// <since_tizen> 3 </since_tizen>
1419 public float PositionY
1423 return (float)GetValue(PositionYProperty);
1427 SetValue(PositionYProperty, value);
1428 NotifyPropertyChanged();
1433 /// Gets or sets the position Z of the view.
1437 /// Animatable - This property can be animated using <c>Animation</c> class.
1440 /// <since_tizen> 3 </since_tizen>
1441 public float PositionZ
1445 return (float)GetValue(PositionZProperty);
1449 SetValue(PositionZProperty, value);
1450 NotifyPropertyChanged();
1455 /// Gets or sets the world position of the view.
1457 /// <since_tizen> 3 </since_tizen>
1458 public Vector3 WorldPosition
1462 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1463 var pValue = GetProperty(View.Property.WorldPosition);
1471 /// Gets or sets the orientation of the view.<br />
1472 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1476 /// This is an asynchronous method.
1479 /// Animatable - This property can be animated using <c>Animation</c> class.
1482 /// <since_tizen> 3 </since_tizen>
1483 public Rotation Orientation
1487 return (Rotation)GetValue(OrientationProperty);
1491 SetValue(OrientationProperty, value);
1492 NotifyPropertyChanged();
1497 /// Gets or sets the world orientation of the view.<br />
1499 /// <since_tizen> 3 </since_tizen>
1500 public Rotation WorldOrientation
1504 Rotation temp = new Rotation();
1505 var pValue = GetProperty(View.Property.WorldOrientation);
1513 /// Gets or sets the scale factor applied to the view.<br />
1517 /// Animatable - This property can be animated using <c>Animation</c> class.
1519 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1521 /// <since_tizen> 3 </since_tizen>
1522 public Vector3 Scale
1526 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1527 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1531 SetValue(ScaleProperty, value);
1532 NotifyPropertyChanged();
1537 /// Gets or sets the scale X factor applied to the view.
1541 /// Animatable - This property can be animated using <c>Animation</c> class.
1544 /// <since_tizen> 3 </since_tizen>
1549 return (float)GetValue(ScaleXProperty);
1553 SetValue(ScaleXProperty, value);
1554 NotifyPropertyChanged();
1559 /// Gets or sets the scale Y factor applied to the view.
1563 /// Animatable - This property can be animated using <c>Animation</c> class.
1566 /// <since_tizen> 3 </since_tizen>
1571 return (float)GetValue(ScaleYProperty);
1575 SetValue(ScaleYProperty, value);
1576 NotifyPropertyChanged();
1581 /// Gets or sets the scale Z factor applied to the view.
1585 /// Animatable - This property can be animated using <c>Animation</c> class.
1588 /// <since_tizen> 3 </since_tizen>
1593 return (float)GetValue(ScaleZProperty);
1597 SetValue(ScaleZProperty, value);
1598 NotifyPropertyChanged();
1603 /// Gets the world scale of the view.
1605 /// <since_tizen> 3 </since_tizen>
1606 public Vector3 WorldScale
1610 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1611 var pValue = GetProperty(View.Property.WorldScale);
1619 /// Retrieves the visibility flag of the view.
1623 /// If the view is not visible, then the view and its children will not be rendered.
1624 /// 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.
1627 /// Animatable - This property can be animated using <c>Animation</c> class.
1630 /// <since_tizen> 3 </since_tizen>
1631 public bool Visibility
1636 var pValue = GetProperty(View.Property.VISIBLE);
1637 pValue.Get(out temp);
1644 /// Gets the view's world color.
1646 /// <since_tizen> 3 </since_tizen>
1647 public Vector4 WorldColor
1651 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1652 var pValue = GetProperty(View.Property.WorldColor);
1660 /// Gets or sets the view's name.
1662 /// <since_tizen> 3 </since_tizen>
1667 return (string)GetValue(NameProperty);
1671 SetValue(NameProperty, value);
1672 NotifyPropertyChanged();
1677 /// Get the number of children held by the view.
1679 /// <since_tizen> 3 </since_tizen>
1680 public new uint ChildCount
1684 return Convert.ToUInt32(Children.Count);
1689 /// Gets the view's ID.
1692 /// <since_tizen> 3 </since_tizen>
1702 /// Gets or sets the status of whether the view should emit touch or hover signals.
1704 /// <since_tizen> 3 </since_tizen>
1705 public bool Sensitive
1709 return (bool)GetValue(SensitiveProperty);
1713 SetValue(SensitiveProperty, value);
1714 NotifyPropertyChanged();
1719 /// 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.
1721 /// <since_tizen> 3 </since_tizen>
1722 public bool LeaveRequired
1726 return (bool)GetValue(LeaveRequiredProperty);
1730 SetValue(LeaveRequiredProperty, value);
1731 NotifyPropertyChanged();
1736 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1738 /// <since_tizen> 3 </since_tizen>
1739 public bool InheritOrientation
1743 return (bool)GetValue(InheritOrientationProperty);
1747 SetValue(InheritOrientationProperty, value);
1748 NotifyPropertyChanged();
1753 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1755 /// <since_tizen> 3 </since_tizen>
1756 public bool InheritScale
1760 return (bool)GetValue(InheritScaleProperty);
1764 SetValue(InheritScaleProperty, value);
1765 NotifyPropertyChanged();
1770 /// Gets or sets the status of how the view and its children should be drawn.<br />
1771 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1772 /// 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 />
1773 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1774 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1775 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1777 /// <since_tizen> 3 </since_tizen>
1778 public DrawModeType DrawMode
1782 return (DrawModeType)GetValue(DrawModeProperty);
1786 SetValue(DrawModeProperty, value);
1787 NotifyPropertyChanged();
1792 /// Gets or sets the relative to parent size factor of the view.<br />
1793 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1794 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1797 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1799 /// <since_tizen> 3 </since_tizen>
1800 public Vector3 SizeModeFactor
1804 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1805 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1809 SetValue(SizeModeFactorProperty, value);
1810 NotifyPropertyChanged();
1815 /// Gets or sets the width resize policy to be used.
1817 /// <since_tizen> 3 </since_tizen>
1818 public ResizePolicyType WidthResizePolicy
1822 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1826 SetValue(WidthResizePolicyProperty, value);
1827 NotifyPropertyChanged();
1832 /// Gets or sets the height resize policy to be used.
1834 /// <since_tizen> 3 </since_tizen>
1835 public ResizePolicyType HeightResizePolicy
1839 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1843 SetValue(HeightResizePolicyProperty, value);
1844 NotifyPropertyChanged();
1849 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1850 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1852 /// <since_tizen> 3 </since_tizen>
1853 public SizeScalePolicyType SizeScalePolicy
1857 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1861 SetValue(SizeScalePolicyProperty, value);
1862 NotifyPropertyChanged();
1867 /// Gets or sets the status of whether the width size is dependent on the height size.
1869 /// <since_tizen> 3 </since_tizen>
1870 public bool WidthForHeight
1874 return (bool)GetValue(WidthForHeightProperty);
1878 SetValue(WidthForHeightProperty, value);
1879 NotifyPropertyChanged();
1884 /// Gets or sets the status of whether the height size is dependent on the width size.
1886 /// <since_tizen> 3 </since_tizen>
1887 public bool HeightForWidth
1891 return (bool)GetValue(HeightForWidthProperty);
1895 SetValue(HeightForWidthProperty, value);
1896 NotifyPropertyChanged();
1901 /// Gets or sets the padding for use in layout.
1904 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1906 /// <since_tizen> 5 </since_tizen>
1907 public Extents Padding
1911 // If View has a Layout then padding in stored in the base Layout class
1914 return Layout.Padding;
1918 Extents temp = (Extents)GetValue(PaddingProperty);
1919 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1921 // Two return points to prevent creating a zeroed Extent native object before assignment
1925 Extents padding = value;
1928 // Layout set so store Padding in LayoutItem instead of in View.
1929 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1930 // the position and sizes measure in the Layouting.
1931 Layout.Padding = value;
1932 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1933 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1934 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1936 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1940 SetValue(PaddingProperty, padding);
1941 NotifyPropertyChanged();
1946 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1948 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1950 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1952 /// <since_tizen> 3 </since_tizen>
1953 public Size2D MinimumSize
1957 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1958 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1964 throw new ArgumentNullException(nameof(value));
1968 // Note: it only works if minimum size is >= than natural size.
1969 // To force the size it should be done through the width&height spec or Size2D.
1970 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1971 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1972 layout.RequestLayout();
1974 SetValue(MinimumSizeProperty, value);
1975 NotifyPropertyChanged();
1980 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1983 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1985 /// <since_tizen> 3 </since_tizen>
1986 public Size2D MaximumSize
1990 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1991 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1995 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1996 // MATCH_PARENT spec + parent container size can be used to limit
1999 layout.RequestLayout();
2001 SetValue(MaximumSizeProperty, value);
2002 NotifyPropertyChanged();
2007 /// Gets or sets whether a child view inherits it's parent's position.<br />
2008 /// Default is to inherit.<br />
2009 /// 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 />
2011 /// <since_tizen> 3 </since_tizen>
2012 public bool InheritPosition
2016 return (bool)GetValue(InheritPositionProperty);
2020 SetValue(InheritPositionProperty, value);
2021 NotifyPropertyChanged();
2026 /// Gets or sets the clipping behavior (mode) of it's children.
2028 /// <since_tizen> 3 </since_tizen>
2029 public ClippingModeType ClippingMode
2033 return (ClippingModeType)GetValue(ClippingModeProperty);
2037 SetValue(ClippingModeProperty, value);
2038 NotifyPropertyChanged();
2043 /// Gets the number of renderers held by the view.
2045 /// <since_tizen> 3 </since_tizen>
2046 public uint RendererCount
2050 return GetRendererCount();
2055 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2058 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2060 /// <since_tizen> 3 </since_tizen>
2061 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2063 "View view = new View(); " +
2064 "view.PivotPoint = PivotPoint.Center; " +
2065 "view.PositionUsesPivotPoint = true;")]
2066 [EditorBrowsable(EditorBrowsableState.Never)]
2067 public Position AnchorPoint
2071 Position temp = new Position(0.0f, 0.0f, 0.0f);
2072 var pValue = GetProperty(View.Property.AnchorPoint);
2075 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2081 var temp = new Tizen.NUI.PropertyValue(value);
2082 SetProperty(View.Property.AnchorPoint, temp);
2084 NotifyPropertyChanged();
2089 /// Sets the size of a view for the width, the height and the depth.<br />
2090 /// Geometry can be scaled to fit within this area.<br />
2091 /// This does not interfere with the view's scale factor.<br />
2092 /// The views default depth is the minimum of width and height.<br />
2096 /// Animatable - This property can be animated using <c>Animation</c> class.
2098 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2100 /// <since_tizen> 5 </since_tizen>
2105 Size tmp = (Size)GetValue(SizeProperty);
2106 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2110 SetValue(SizeProperty, value);
2111 NotifyPropertyChanged();
2116 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2118 /// <since_tizen> 3 </since_tizen>
2119 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2121 "Container parent = view.GetParent(); " +
2122 "View view = parent as View;")]
2123 [EditorBrowsable(EditorBrowsableState.Never)]
2124 public new View Parent
2129 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2130 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2131 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2133 if (basehandle is Layer layer)
2135 ret = new View(Layer.getCPtr(layer).Handle, false);
2136 NUILog.Error("This Parent property is deprecated, should do not be used");
2140 ret = basehandle as View;
2143 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2144 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2146 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2152 /// Gets/Sets whether inherit parent's the layout Direction.
2154 /// <since_tizen> 4 </since_tizen>
2155 public bool InheritLayoutDirection
2159 return (bool)GetValue(InheritLayoutDirectionProperty);
2163 SetValue(InheritLayoutDirectionProperty, value);
2164 NotifyPropertyChanged();
2169 /// Gets/Sets the layout Direction.
2171 /// <since_tizen> 4 </since_tizen>
2172 public ViewLayoutDirectionType LayoutDirection
2176 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2180 SetValue(LayoutDirectionProperty, value);
2181 NotifyPropertyChanged();
2182 layout?.RequestLayout();
2187 /// Gets or sets the Margin for use in layout.
2190 /// Margin property is supported by Layout algorithms and containers.
2191 /// Please Set Layout if you want to use Margin property.
2192 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2194 /// <since_tizen> 4 </since_tizen>
2195 public Extents Margin
2199 // If View has a Layout then margin is stored in Layout.
2202 return Layout.Margin;
2206 // If Layout not set then return margin stored in View.
2207 Extents temp = (Extents)GetValue(MarginProperty);
2208 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2210 // Two return points to prevent creating a zeroed Extent native object before assignment
2216 // Layout set so store Margin in LayoutItem instead of View.
2217 // If View stores the Margin too then the Legacy Size Negotiation will
2218 // overwrite the position and size values measured in the Layouting.
2219 Layout.Margin = value;
2220 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2221 layout?.RequestLayout();
2225 SetValue(MarginProperty, value);
2227 NotifyPropertyChanged();
2228 layout?.RequestLayout();
2233 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2235 /// <since_tizen> 6 </since_tizen>
2236 public int WidthSpecification
2244 if (value == widthPolicy)
2247 widthPolicy = value;
2248 if (widthPolicy >= 0)
2250 if (heightPolicy >= 0) // Policy an exact value
2252 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2253 Size2D = new Size2D(widthPolicy, heightPolicy);
2256 layout?.RequestLayout();
2261 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2263 /// <since_tizen> 6 </since_tizen>
2264 public int HeightSpecification
2268 return heightPolicy;
2272 if (value == heightPolicy)
2275 heightPolicy = value;
2276 if (heightPolicy >= 0)
2278 if (widthPolicy >= 0) // Policy an exact value
2280 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2281 Size2D = new Size2D(widthPolicy, heightPolicy);
2284 layout?.RequestLayout();
2289 /// Gets the List of transitions for this View.
2291 /// <since_tizen> 6 </since_tizen>
2292 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2296 if (layoutTransitions == null)
2298 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2300 return layoutTransitions;
2305 /// Set a layout transitions for this View.
2307 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2309 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2311 /// <since_tizen> 6 </since_tizen>
2312 public LayoutTransition LayoutTransition
2316 return layoutTransition;
2322 throw new global::System.ArgumentNullException(nameof(value));
2324 if (layoutTransitions == null)
2326 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2329 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2331 AttachTransitionsToChildren(value);
2333 layoutTransition = value;
2338 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2341 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2343 /// <since_tizen> 4 </since_tizen>
2344 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2345 [EditorBrowsable(EditorBrowsableState.Never)]
2346 public Extents PaddingEX
2350 Extents temp = new Extents(0, 0, 0, 0);
2351 var pValue = GetProperty(View.Property.PADDING);
2354 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2360 var temp = new Tizen.NUI.PropertyValue(value);
2361 SetProperty(View.Property.PADDING, temp);
2363 NotifyPropertyChanged();
2364 layout?.RequestLayout();
2369 /// The Color of View. This is an RGBA value.
2373 /// Animatable - This property can be animated using <c>Animation</c> class.
2375 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2377 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2378 [EditorBrowsable(EditorBrowsableState.Never)]
2383 Color temp = (Color)GetValue(ColorProperty);
2384 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2388 SetValue(ColorProperty, value);
2389 selectorData?.Color?.Reset(this);
2390 NotifyPropertyChanged();
2395 /// Set the layout on this View. Replaces any existing Layout.
2397 /// <since_tizen> 6 </since_tizen>
2398 public LayoutItem Layout
2406 // Do nothing if layout provided is already set on this View.
2407 if (value == layout)
2412 LayoutingDisabled = false;
2415 // If new layout being set already has a owner then that owner receives a replacement default layout.
2416 // First check if the layout to be set already has a owner.
2417 if (value?.Owner != null)
2419 // Previous owner of the layout gets a default layout as a replacement.
2420 value.Owner.Layout = new AbsoluteLayout();
2422 // Copy Margin and Padding to replacement LayoutGroup.
2423 if (value.Owner.Layout != null)
2425 value.Owner.Layout.Margin = value.Margin;
2426 value.Owner.Layout.Padding = value.Padding;
2430 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2431 // View if no replacement. Previously margin and padding values would have been moved from
2432 // the View to the layout.
2433 if (layout != null) // Existing layout
2437 // Existing layout being replaced so copy over margin and padding values.
2438 value.Margin = layout.Margin;
2439 value.Padding = layout.Padding;
2443 // Layout not being replaced so restore margin and padding to View.
2444 SetValue(MarginProperty, layout.Margin);
2445 SetValue(PaddingProperty, layout.Padding);
2446 NotifyPropertyChanged();
2451 // First Layout to be added to the View hence copy
2453 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2456 if (Margin.Top != 0 || Margin.Bottom != 0 || Margin.Start != 0 || Margin.End != 0)
2458 // If View already has a margin set then store it in Layout instead.
2459 value.Margin = Margin;
2460 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2461 NotifyPropertyChanged();
2464 if (Padding.Top != 0 || Padding.Bottom != 0 || Padding.Start != 0 || Padding.End != 0)
2466 // If View already has a padding set then store it in Layout instead.
2467 value.Padding = Padding;
2469 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2470 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2471 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType()))
2473 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2474 NotifyPropertyChanged();
2480 // Remove existing layout from it's parent layout group.
2483 value.SetPositionByLayout = !excludeLayouting;
2485 // Set layout to this view
2491 /// The weight of the View, used to share available space in a layout with siblings.
2493 /// <since_tizen> 6 </since_tizen>
2503 layout?.RequestLayout();
2508 /// Whether to load the BackgroundImage synchronously.
2509 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2510 /// Note: For Normal Quad images only.
2512 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2513 [EditorBrowsable(EditorBrowsableState.Never)]
2514 public bool BackgroundImageSynchronosLoading
2518 return backgroundImageSynchronosLoading;
2522 backgroundImageSynchronosLoading = value;
2524 string bgUrl = null;
2525 var pValue = Background.Find(ImageVisualProperty.URL);
2526 pValue?.Get(out bgUrl);
2529 if (!string.IsNullOrEmpty(bgUrl))
2531 PropertyMap bgMap = this.Background;
2532 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2533 bgMap.Add("synchronousLoading", temp);
2540 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2541 [EditorBrowsable(EditorBrowsableState.Never)]
2542 public Vector2 UpdateSizeHint
2546 return (Vector2)GetValue(UpdateSizeHintProperty);
2550 SetValue(UpdateSizeHintProperty, value);
2551 NotifyPropertyChanged();
2556 /// Enable/Disable ControlState propagation for children.
2557 /// It is false by default.
2558 /// If the View needs to share ControlState with descendants, please set it true.
2559 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2561 [EditorBrowsable(EditorBrowsableState.Never)]
2562 public bool EnableControlStatePropagation
2564 get => controlStatePropagation;
2567 controlStatePropagation = value;
2569 foreach (View child in Children)
2571 child.EnableControlStatePropagation = value;
2577 /// By default, it is false in View, true in Control.
2578 /// Note that if the value is true, the View will be a touch receptor.
2580 [EditorBrowsable(EditorBrowsableState.Never)]
2581 public bool EnableControlState
2585 return (bool)GetValue(EnableControlStateProperty);
2589 SetValue(EnableControlStateProperty, value);
2594 /// Whether the actor grab all touches even if touch leaves its boundary.
2596 /// <returns>true, if it grab all touch after start</returns>
2597 [EditorBrowsable(EditorBrowsableState.Never)]
2598 public bool GrabTouchAfterLeave
2603 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2604 pValue.Get(out temp);
2610 var temp = new Tizen.NUI.PropertyValue(value);
2611 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2613 NotifyPropertyChanged();
2618 /// Determines which blend equation will be used to render renderers of this actor.
2620 /// <returns>blend equation enum currently assigned</returns>
2621 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2622 [EditorBrowsable(EditorBrowsableState.Never)]
2623 public BlendEquationType BlendEquation
2628 var pValue = GetProperty(View.Property.BlendEquation);
2629 pValue.Get(out temp);
2631 return (BlendEquationType)temp;
2635 var temp = new Tizen.NUI.PropertyValue((int)value);
2636 SetProperty(View.Property.BlendEquation, temp);
2638 NotifyPropertyChanged();
2643 /// If the value is true, the View will change its style as the theme changes.
2644 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2646 [EditorBrowsable(EditorBrowsableState.Never)]
2647 public bool ThemeChangeSensitive
2649 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2650 set => SetValue(ThemeChangeSensitiveProperty, value);
2654 /// Create Style, it is abstract function and must be override.
2656 [EditorBrowsable(EditorBrowsableState.Never)]
2657 protected virtual ViewStyle CreateViewStyle()
2659 return new ViewStyle();
2663 /// Called after the View's ControlStates changed.
2665 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2666 [EditorBrowsable(EditorBrowsableState.Never)]
2667 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2673 [EditorBrowsable(EditorBrowsableState.Never)]
2674 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2679 private bool IsViewPropertyDirty(BindableProperty styleProperty)
2681 if (dirtyPropertySet.Count == 0)
2686 if (styleProperty.ReturnType.IsGenericType && styleProperty.ReturnType.GetGenericTypeDefinition() == typeof(Selector<>))
2688 return dirtyPropertySet.Contains(styleProperty.PropertyName.Substring(0, styleProperty.PropertyName.Length - 8));
2691 return dirtyPropertySet.Contains(styleProperty.PropertyName);
2695 /// Apply style instance to the view.
2696 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2698 [EditorBrowsable(EditorBrowsableState.Never)]
2699 public virtual void ApplyStyle(ViewStyle viewStyle)
2701 if (viewStyle == null || this.viewStyle == viewStyle) return;
2703 this.viewStyle = viewStyle;
2705 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2711 if (dirtyPropertySet == null)
2713 dirtyPropertySet = new HashSet<string>();
2716 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2718 if (bindablePropertyOfView == null)
2723 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2724 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2726 foreach (var sourceProperty in dirtyStyleProperties)
2728 if (blockSetDirty && IsViewPropertyDirty(sourceProperty))
2730 // Skip applying theme style for a property set by user.
2734 var sourceValue = viewStyle.GetValue(sourceProperty);
2736 if (sourceValue == null)
2741 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2743 if (destinationProperty != null)
2745 SetValue(destinationProperty, sourceValue);
2751 /// Get whether the View is culled or not.
2752 /// True means that the View is out of the view frustum.
2755 /// Hidden-API (Inhouse-API).
2757 [EditorBrowsable(EditorBrowsableState.Never)]
2763 var pValue = GetProperty(View.Property.Culled);
2764 pValue.Get(out temp);