2 * Copyright(c) 2020 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.Binding;
22 using Tizen.NUI.Components;
24 namespace Tizen.NUI.BaseComponents
27 /// View is the base class for all views.
29 /// <since_tizen> 3 </since_tizen>
30 public partial class View : Container, IResourcesProvider
32 internal BackgroundExtraData backgroundExtraData;
34 private bool layoutSet = false;
35 private LayoutItem layout; // Exclusive layout assigned to this View.
37 // List of transitions paired with the condition that uses the transition.
38 private Dictionary<TransitionCondition, TransitionList> layoutTransitions;
39 private int widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
40 private int heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
41 private float weight = 0.0f; // Weighting of child View in a Layout
42 private bool backgroundImageSynchronosLoading = false;
43 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
44 private bool controlStatePropagation = false;
45 private ViewStyle viewStyle;
46 private bool themeChangeSensitive = false;
47 private bool excludeLayouting = false;
48 private LayoutTransition layoutTransition;
50 private ControlState controlStates = ControlState.Normal;
55 /// Creates a new instance of a view.
57 /// <since_tizen> 3 </since_tizen>
58 public View() : this(Interop.View.New(), true)
60 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
63 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
64 [EditorBrowsable(EditorBrowsableState.Never)]
65 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
70 /// Create a new instance of a View with setting the status of shown or hidden.
72 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
73 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
74 [EditorBrowsable(EditorBrowsableState.Never)]
75 public View(bool shown) : this(Interop.View.New(), true)
77 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
81 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
83 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
92 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
94 InitializeStyle(viewStyle);
97 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
101 PositionUsesPivotPoint = false;
104 onWindowSendEventCallback = SendViewAddedEventToWindow;
105 this.OnWindowSignal().Connect(onWindowSendEventCallback);
113 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
115 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124 /// The event that is triggered when the View's ControlState is changed.
126 [EditorBrowsable(EditorBrowsableState.Never)]
127 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
129 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
133 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
135 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
136 [EditorBrowsable(EditorBrowsableState.Never)]
137 public bool LayoutSet
146 /// Flag to allow Layouting to be disabled for Views.
147 /// Once a View has a Layout set then any children added to Views from then on will receive
148 /// automatic Layouts.
150 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
151 [EditorBrowsable(EditorBrowsableState.Never)]
152 public static bool LayoutingDisabled { get; set; } = true;
154 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
155 [EditorBrowsable(EditorBrowsableState.Never)]
156 public ViewStyle ViewStyle
160 if (null == viewStyle)
162 ApplyStyle(CreateViewStyle());
170 /// Get/Set the control state.
172 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
173 [EditorBrowsable(EditorBrowsableState.Never)]
174 public ControlState ControlState
178 return controlStates;
182 if (controlStates == value)
187 var prevState = controlStates;
189 controlStates = value;
191 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
193 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
195 if (controlStatePropagation)
197 foreach (View child in Children)
199 child.ControlState = value;
203 OnControlStateChanged(changeInfo);
205 ControlStateChangedEvent?.Invoke(this, changeInfo);
209 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
210 [EditorBrowsable(EditorBrowsableState.Never)]
211 public bool ExcludeLayouting
215 return excludeLayouting;
219 excludeLayouting = value;
220 if (Layout != null && Layout.SetPositionByLayout == value)
222 Layout.SetPositionByLayout = !value;
223 Layout.RequestLayout();
228 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
229 [EditorBrowsable(EditorBrowsableState.Never)]
230 public bool IsResourcesCreated
234 return Application.Current.IsResourcesCreated;
238 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
239 [EditorBrowsable(EditorBrowsableState.Never)]
240 public ResourceDictionary XamlResources
244 return Application.Current.XamlResources;
248 Application.Current.XamlResources = value;
253 /// The StyleName, type string.
254 /// The value indicates DALi style name defined in json theme file.
256 /// <since_tizen> 3 </since_tizen>
257 public string StyleName
261 return (string)GetValue(StyleNameProperty);
265 SetValue(StyleNameProperty, value);
266 NotifyPropertyChanged();
271 /// The KeyInputFocus, type bool.
273 [EditorBrowsable(EditorBrowsableState.Never)]
274 public bool KeyInputFocus
278 return (bool)GetValue(KeyInputFocusProperty);
282 SetValue(KeyInputFocusProperty, value);
283 NotifyPropertyChanged();
288 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
292 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
295 /// Animatable - This property can be animated using <c>Animation</c> class.
297 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
301 /// <since_tizen> 3 </since_tizen>
302 public Color BackgroundColor
306 Color temp = (Color)GetValue(BackgroundColorProperty);
307 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
311 SetValue(BackgroundColorProperty, value);
312 if (selectorData != null)
314 selectorData.BackgroundImage.Reset(this);
315 selectorData.BackgroundColor.UpdateIfNeeds(this, value);
317 NotifyPropertyChanged();
322 /// The mutually exclusive with "backgroundColor" and "background" type Map.
324 /// <since_tizen> 3 </since_tizen>
325 public string BackgroundImage
329 return (string)GetValue(BackgroundImageProperty);
333 SetValue(BackgroundImageProperty, value);
334 if (selectorData != null)
336 selectorData.BackgroundColor.Reset(this);
337 selectorData.BackgroundImage.UpdateIfNeeds(this, value);
339 NotifyPropertyChanged();
344 /// Get or set the border of background image.
346 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
347 [EditorBrowsable(EditorBrowsableState.Never)]
348 public Rectangle BackgroundImageBorder
352 return (Rectangle)GetValue(BackgroundImageBorderProperty);
356 SetValue(BackgroundImageBorderProperty, value);
357 selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value);
358 NotifyPropertyChanged();
363 /// The background of view.
365 /// <since_tizen> 3 </since_tizen>
366 public Tizen.NUI.PropertyMap Background
370 return (PropertyMap)GetValue(BackgroundProperty);
374 SetValue(BackgroundProperty, value);
375 NotifyPropertyChanged();
380 /// Describes a shadow as an image for a View.
381 /// It is null by default.
384 /// Getter returns copied instance of current shadow.
387 /// The mutually exclusive with "BoxShadow".
391 /// Animatable - This property can be animated using <c>Animation</c> class.
392 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
394 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
396 /// Animatable sub-property : Offset.
399 [EditorBrowsable(EditorBrowsableState.Never)]
400 public ImageShadow ImageShadow
404 return (ImageShadow)GetValue(ImageShadowProperty);
408 SetValue(ImageShadowProperty, value);
409 if (selectorData != null)
411 selectorData.BoxShadow.Reset(this);
412 selectorData.ImageShadow.UpdateIfNeeds(this, value);
414 NotifyPropertyChanged();
419 /// Describes a box shaped shadow drawing for a View.
420 /// It is null by default.
423 /// Gettter returns copied instance of current shadow.
426 /// The mutually exclusive with "ImageShadow".
430 /// Animatable - This property can be animated using <c>Animation</c> class.
431 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
433 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
435 /// Animatable sub-property : Offset, Color, BlurRadius.
438 [EditorBrowsable(EditorBrowsableState.Never)]
439 public Shadow BoxShadow
443 return (Shadow)GetValue(BoxShadowProperty);
447 SetValue(BoxShadowProperty, value);
448 if (selectorData != null)
450 selectorData.ImageShadow.Reset(this);
451 selectorData.BoxShadow.UpdateIfNeeds(this, value);
453 NotifyPropertyChanged();
458 /// The radius for the rounded corners of the View.
459 /// This will rounds background and shadow edges.
460 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
464 /// Animatable - This property can be animated using <c>Animation</c> class.
467 [EditorBrowsable(EditorBrowsableState.Never)]
468 public float CornerRadius
472 return (float)GetValue(CornerRadiusProperty);
476 SetValue(CornerRadiusProperty, value);
477 NotifyPropertyChanged();
485 [EditorBrowsable(EditorBrowsableState.Never)]
486 protected bool IsHighlighted
490 return Accessibility.AccessibilityManager.Instance.GetCurrentFocusView() == this;
494 [EditorBrowsable(EditorBrowsableState.Never)]
495 protected static readonly string AccessibilityActivateAction = "activate";
496 [EditorBrowsable(EditorBrowsableState.Never)]
497 protected static readonly string AccessibilityReadingSkippedAction = "ReadingSkipped";
498 [EditorBrowsable(EditorBrowsableState.Never)]
499 protected static readonly string AccessibilityReadingCancelledAction = "ReadingCancelled";
500 [EditorBrowsable(EditorBrowsableState.Never)]
501 protected static readonly string AccessibilityReadingStoppedAction = "ReadingStopped";
502 [EditorBrowsable(EditorBrowsableState.Never)]
503 protected static readonly string AccessibilityReadingPausedAction = "ReadingPaused";
504 [EditorBrowsable(EditorBrowsableState.Never)]
505 protected static readonly string AccessibilityReadingResumedAction = "ReadingResumed";
507 [EditorBrowsable(EditorBrowsableState.Never)]
508 private static readonly string[] AccessibilityActions = {
509 AccessibilityActivateAction,
510 AccessibilityReadingSkippedAction,
511 AccessibilityReadingCancelledAction,
512 AccessibilityReadingStoppedAction,
513 AccessibilityReadingPausedAction,
514 AccessibilityReadingResumedAction,
517 [EditorBrowsable(EditorBrowsableState.Never)]
518 protected virtual string AccessibilityGetName()
523 [EditorBrowsable(EditorBrowsableState.Never)]
524 protected virtual string AccessibilityGetDescription()
529 [EditorBrowsable(EditorBrowsableState.Never)]
530 protected virtual bool AccessibilityDoAction(string name)
535 [EditorBrowsable(EditorBrowsableState.Never)]
536 protected virtual AccessibilityStates AccessibilityCalculateStates()
538 var states = new AccessibilityStates();
539 states.Set(AccessibilityState.Highlightable, this.AccessibilityHighlightable);
540 states.Set(AccessibilityState.Focusable, this.Focusable);
541 states.Set(AccessibilityState.Focused, this.State == States.Focused);
542 states.Set(AccessibilityState.Highlighted, this.IsHighlighted);
543 states.Set(AccessibilityState.Enabled, this.State != States.Disabled);
544 states.Set(AccessibilityState.Sensitive, this.Sensitive);
545 states.Set(AccessibilityState.Animated, this.AccessibilityAnimated);
546 states.Set(AccessibilityState.Visible, true);
547 states.Set(AccessibilityState.Showing, this.Visibility);
548 states.Set(AccessibilityState.Defunct, !this.IsOnWindow);
552 [EditorBrowsable(EditorBrowsableState.Never)]
553 protected virtual int AccessibilityGetActionCount()
555 return AccessibilityActions.Length;
558 [EditorBrowsable(EditorBrowsableState.Never)]
559 protected virtual string AccessibilityGetActionName(int index)
561 if (index >= 0 && index < AccessibilityActions.Length)
562 return AccessibilityActions[index];
567 [EditorBrowsable(EditorBrowsableState.Never)]
568 protected virtual bool AccessibilityShouldReportZeroChildren()
573 [EditorBrowsable(EditorBrowsableState.Never)]
574 protected virtual double AccessibilityGetMinimum()
579 [EditorBrowsable(EditorBrowsableState.Never)]
580 protected virtual double AccessibilityGetCurrent()
585 [EditorBrowsable(EditorBrowsableState.Never)]
586 protected virtual double AccessibilityGetMaximum()
591 [EditorBrowsable(EditorBrowsableState.Never)]
592 protected virtual bool AccessibilitySetCurrent(double value)
597 [EditorBrowsable(EditorBrowsableState.Never)]
598 protected virtual double AccessibilityGetMinimumIncrement()
603 [EditorBrowsable(EditorBrowsableState.Never)]
604 protected virtual bool AccessibilityIsScrollable()
609 [EditorBrowsable(EditorBrowsableState.Never)]
610 protected virtual string AccessibilityGetText(int startOffset, int endOffset)
615 [EditorBrowsable(EditorBrowsableState.Never)]
616 protected virtual int AccessibilityGetCharacterCount()
621 [EditorBrowsable(EditorBrowsableState.Never)]
622 protected virtual int AccessibilityGetCaretOffset()
627 [EditorBrowsable(EditorBrowsableState.Never)]
628 protected virtual bool AccessibilitySetCaretOffset(int offset)
633 [EditorBrowsable(EditorBrowsableState.Never)]
634 protected virtual AccessibilityRange AccessibilityGetTextAtOffset(int offset, TextBoundary boundary)
636 return new AccessibilityRange();
639 [EditorBrowsable(EditorBrowsableState.Never)]
640 protected virtual AccessibilityRange AccessibilityGetSelection(int selectionNum)
642 return new AccessibilityRange();
645 [EditorBrowsable(EditorBrowsableState.Never)]
646 protected virtual bool AccessibilityRemoveSelection(int selectionNum)
651 [EditorBrowsable(EditorBrowsableState.Never)]
652 protected virtual bool AccessibilitySetSelection(int selectionNum, int startOffset, int endOffset)
657 [EditorBrowsable(EditorBrowsableState.Never)]
658 protected virtual bool AccessibilityCopyText(int startPosition, int endPosition)
663 [EditorBrowsable(EditorBrowsableState.Never)]
664 protected virtual bool AccessibilityCutText(int startPosition, int endPosition)
670 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
671 /// It is absolute by default.
672 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
674 [EditorBrowsable(EditorBrowsableState.Never)]
675 public VisualTransformPolicyType CornerRadiusPolicy
677 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
678 set => SetValue(CornerRadiusPolicyProperty, value);
682 /// The current state of the view.
684 /// <since_tizen> 3 </since_tizen>
689 return (States)GetValue(StateProperty);
693 SetValue(StateProperty, value);
694 NotifyPropertyChanged();
699 /// The current sub state of the view.
701 /// <since_tizen> 3 </since_tizen>
702 public States SubState
706 return (States)GetValue(SubStateProperty);
710 SetValue(SubStateProperty, value);
711 NotifyPropertyChanged();
716 /// Displays a tooltip
718 /// <since_tizen> 3 </since_tizen>
719 public Tizen.NUI.PropertyMap Tooltip
723 return (PropertyMap)GetValue(TooltipProperty);
727 SetValue(TooltipProperty, value);
728 NotifyPropertyChanged();
733 /// Displays a tooltip as a text.
735 /// <since_tizen> 3 </since_tizen>
736 public string TooltipText
740 using (var propertyValue = GetProperty(Property.TOOLTIP))
742 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
744 return retrivedValue;
746 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
747 return "error to get TooltipText";
752 var temp = new Tizen.NUI.PropertyValue(value);
753 SetProperty(View.Property.TOOLTIP, temp);
755 NotifyPropertyChanged();
760 /// The Child property of FlexContainer.<br />
761 /// The proportion of the free space in the container, the flex item will receive.<br />
762 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
764 /// <since_tizen> 3 </since_tizen>
765 [Obsolete("Deprecated in API8, will be removed in API10.")]
770 return (float)GetValue(FlexProperty);
774 SetValue(FlexProperty, value);
775 NotifyPropertyChanged();
780 /// The Child property of FlexContainer.<br />
781 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
783 /// <since_tizen> 3 </since_tizen>
784 [Obsolete("Deprecated in API8, will be removed in API10.")]
789 return (int)GetValue(AlignSelfProperty);
793 SetValue(AlignSelfProperty, value);
794 NotifyPropertyChanged();
799 /// The Child property of FlexContainer.<br />
800 /// The space around the flex item.<br />
803 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
805 /// <since_tizen> 3 </since_tizen>
806 [Obsolete("Deprecated in API8, will be removed in API10.")]
807 public Vector4 FlexMargin
811 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
812 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
816 SetValue(FlexMarginProperty, value);
817 NotifyPropertyChanged();
822 /// The top-left cell this child occupies, if not set, the first available cell is used.
825 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
827 /// <since_tizen> 3 </since_tizen>
828 public Vector2 CellIndex
832 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
833 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
837 SetValue(CellIndexProperty, value);
838 NotifyPropertyChanged();
843 /// The number of rows this child occupies, if not set, the default value is 1.
845 /// <since_tizen> 3 </since_tizen>
850 return (float)GetValue(RowSpanProperty);
854 SetValue(RowSpanProperty, value);
855 NotifyPropertyChanged();
860 /// The number of columns this child occupies, if not set, the default value is 1.
862 /// <since_tizen> 3 </since_tizen>
863 public float ColumnSpan
867 return (float)GetValue(ColumnSpanProperty);
871 SetValue(ColumnSpanProperty, value);
872 NotifyPropertyChanged();
877 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
879 /// <since_tizen> 3 </since_tizen>
880 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
884 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
888 SetValue(CellHorizontalAlignmentProperty, value);
889 NotifyPropertyChanged();
894 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
896 /// <since_tizen> 3 </since_tizen>
897 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
901 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
905 SetValue(CellVerticalAlignmentProperty, value);
906 NotifyPropertyChanged();
911 /// The left focusable view.<br />
912 /// This will return null if not set.<br />
913 /// This will also return null if the specified left focusable view is not on a window.<br />
915 /// <since_tizen> 3 </since_tizen>
916 public View LeftFocusableView
918 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
921 return (View)GetValue(LeftFocusableViewProperty);
925 SetValue(LeftFocusableViewProperty, value);
926 NotifyPropertyChanged();
931 /// The right focusable view.<br />
932 /// This will return null if not set.<br />
933 /// This will also return null if the specified right focusable view is not on a window.<br />
935 /// <since_tizen> 3 </since_tizen>
936 public View RightFocusableView
938 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
941 return (View)GetValue(RightFocusableViewProperty);
945 SetValue(RightFocusableViewProperty, value);
946 NotifyPropertyChanged();
951 /// The up focusable view.<br />
952 /// This will return null if not set.<br />
953 /// This will also return null if the specified up focusable view is not on a window.<br />
955 /// <since_tizen> 3 </since_tizen>
956 public View UpFocusableView
958 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
961 return (View)GetValue(UpFocusableViewProperty);
965 SetValue(UpFocusableViewProperty, value);
966 NotifyPropertyChanged();
971 /// The down focusable view.<br />
972 /// This will return null if not set.<br />
973 /// This will also return null if the specified down focusable view is not on a window.<br />
975 /// <since_tizen> 3 </since_tizen>
976 public View DownFocusableView
978 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
981 return (View)GetValue(DownFocusableViewProperty);
985 SetValue(DownFocusableViewProperty, value);
986 NotifyPropertyChanged();
991 /// Whether the view should be focusable by keyboard navigation.
993 /// <since_tizen> 3 </since_tizen>
994 public bool Focusable
998 SetValue(FocusableProperty, value);
999 NotifyPropertyChanged();
1003 return (bool)GetValue(FocusableProperty);
1008 /// Retrieves the position of the view.<br />
1009 /// The coordinates are relative to the view's parent.<br />
1011 /// <since_tizen> 3 </since_tizen>
1012 public Position CurrentPosition
1016 return GetCurrentPosition();
1021 /// Sets the size of a view for the width and the height.<br />
1022 /// Geometry can be scaled to fit within this area.<br />
1023 /// This does not interfere with the view's scale factor.<br />
1024 /// The views default depth is the minimum of width and height.<br />
1027 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
1028 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
1030 /// <since_tizen> 3 </since_tizen>
1031 public Size2D Size2D
1035 Size2D temp = (Size2D)GetValue(Size2DProperty);
1036 int width = temp.Width;
1037 int height = temp.Height;
1039 if (this.Layout == null)
1041 if (width < 0) { width = 0; }
1042 if (height < 0) { height = 0; }
1045 return new Size2D(OnSize2DChanged, width, height);
1049 SetValue(Size2DProperty, value);
1051 NotifyPropertyChanged();
1056 /// Retrieves the size of the view.<br />
1057 /// The coordinates are relative to the view's parent.<br />
1059 /// <since_tizen> 3 </since_tizen>
1060 public Size2D CurrentSize
1064 return GetCurrentSize();
1069 /// Retrieves and sets the view's opacity.<br />
1071 /// <since_tizen> 3 </since_tizen>
1072 public float Opacity
1076 return (float)GetValue(OpacityProperty);
1080 SetValue(OpacityProperty, value);
1081 selectorData?.Opacity.UpdateIfNeeds(this, value);
1082 NotifyPropertyChanged();
1087 /// Sets the position of the view for X and Y.<br />
1088 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1089 /// If the position inheritance is disabled, sets the world position.<br />
1092 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1093 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1095 /// <since_tizen> 3 </since_tizen>
1096 public Position2D Position2D
1100 Position2D temp = (Position2D)GetValue(Position2DProperty);
1101 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1105 SetValue(Position2DProperty, value);
1106 NotifyPropertyChanged();
1111 /// Retrieves the screen postion of the view.<br />
1113 /// <since_tizen> 3 </since_tizen>
1114 public Vector2 ScreenPosition
1118 Vector2 temp = new Vector2(0.0f, 0.0f);
1119 var pValue = GetProperty(View.Property.ScreenPosition);
1127 /// Determines whether the pivot point should be used to determine the position of the view.
1128 /// This is false by default.
1130 /// <remarks>If false, then the top-left of the view is used for the position.
1131 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1133 /// <since_tizen> 3 </since_tizen>
1134 public bool PositionUsesPivotPoint
1138 return (bool)GetValue(PositionUsesPivotPointProperty);
1142 SetValue(PositionUsesPivotPointProperty, value);
1143 NotifyPropertyChanged();
1148 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1150 /// <since_tizen> 3 </since_tizen>
1151 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1153 "View view = new View(); " +
1154 "view.PivotPoint = PivotPoint.Center; " +
1155 "view.PositionUsesPivotPoint = true;" +
1156 " Deprecated in API5: Will be removed in API8")]
1157 [EditorBrowsable(EditorBrowsableState.Never)]
1158 public bool PositionUsesAnchorPoint
1163 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1164 pValue.Get(out temp);
1170 var temp = new Tizen.NUI.PropertyValue(value);
1171 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1173 NotifyPropertyChanged();
1178 /// Queries whether the view is connected to the stage.<br />
1179 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1181 /// <since_tizen> 3 </since_tizen>
1182 public bool IsOnWindow
1191 /// Gets the depth in the hierarchy for the view.
1193 /// <since_tizen> 3 </since_tizen>
1194 public int HierarchyDepth
1198 return GetHierarchyDepth();
1203 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1206 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1207 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1208 /// The values set by this property will likely change.
1210 /// <since_tizen> 3 </since_tizen>
1211 public int SiblingOrder
1215 return (int)GetValue(SiblingOrderProperty);
1219 SetValue(SiblingOrderProperty, value);
1221 LayoutGroup layout = Layout as LayoutGroup;
1222 layout?.ChangeLayoutSiblingOrder(value);
1224 NotifyPropertyChanged();
1229 /// Returns the natural size of the view.
1232 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1234 /// <since_tizen> 5 </since_tizen>
1235 public Vector3 NaturalSize
1239 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1240 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1246 /// Returns the natural size (Size2D) of the view.
1249 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1251 /// <since_tizen> 4 </since_tizen>
1252 public Size2D NaturalSize2D
1256 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1257 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1259 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1266 /// Gets or sets the origin of a view within its parent's area.<br />
1267 /// 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 />
1268 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1269 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1271 /// <pre>The view has been initialized.</pre>
1272 /// <since_tizen> 3 </since_tizen>
1273 public Position ParentOrigin
1277 Position tmp = (Position)GetValue(ParentOriginProperty);
1278 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1282 SetValue(ParentOriginProperty, value);
1283 NotifyPropertyChanged();
1288 /// Gets or sets the anchor-point of a view.<br />
1289 /// 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 />
1290 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1291 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1292 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1293 /// <pre>The view has been initialized.</pre>
1296 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1298 /// <since_tizen> 3 </since_tizen>
1299 public Position PivotPoint
1303 Position tmp = (Position)GetValue(PivotPointProperty);
1304 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1308 SetValue(PivotPointProperty, value);
1309 NotifyPropertyChanged();
1314 /// Gets or sets the size width of the view.
1318 /// Animatable - This property can be animated using <c>Animation</c> class.
1321 /// <since_tizen> 3 </since_tizen>
1322 public float SizeWidth
1326 return (float)GetValue(SizeWidthProperty);
1330 SetValue(SizeWidthProperty, value);
1331 NotifyPropertyChanged();
1336 /// Gets or sets the size height of the view.
1340 /// Animatable - This property can be animated using <c>Animation</c> class.
1343 /// <since_tizen> 3 </since_tizen>
1344 public float SizeHeight
1348 return (float)GetValue(SizeHeightProperty);
1352 SetValue(SizeHeightProperty, value);
1353 NotifyPropertyChanged();
1358 /// Gets or sets the position of the view.<br />
1359 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1360 /// If the position inheritance is disabled, sets the world position.<br />
1364 /// Animatable - This property can be animated using <c>Animation</c> class.
1366 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1368 /// <since_tizen> 3 </since_tizen>
1369 public Position Position
1373 Position tmp = (Position)GetValue(PositionProperty);
1374 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1378 SetValue(PositionProperty, value);
1379 NotifyPropertyChanged();
1384 /// Gets or sets the position X of the view.
1388 /// Animatable - This property can be animated using <c>Animation</c> class.
1391 /// <since_tizen> 3 </since_tizen>
1392 public float PositionX
1396 return (float)GetValue(PositionXProperty);
1400 SetValue(PositionXProperty, value);
1401 NotifyPropertyChanged();
1406 /// Gets or sets the position Y of the view.
1410 /// Animatable - This property can be animated using <c>Animation</c> class.
1413 /// <since_tizen> 3 </since_tizen>
1414 public float PositionY
1418 return (float)GetValue(PositionYProperty);
1422 SetValue(PositionYProperty, value);
1423 NotifyPropertyChanged();
1428 /// Gets or sets the position Z of the view.
1432 /// Animatable - This property can be animated using <c>Animation</c> class.
1435 /// <since_tizen> 3 </since_tizen>
1436 public float PositionZ
1440 return (float)GetValue(PositionZProperty);
1444 SetValue(PositionZProperty, value);
1445 NotifyPropertyChanged();
1450 /// Gets or sets the world position of the view.
1452 /// <since_tizen> 3 </since_tizen>
1453 public Vector3 WorldPosition
1457 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1458 var pValue = GetProperty(View.Property.WorldPosition);
1466 /// Gets or sets the orientation of the view.<br />
1467 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1471 /// This is an asynchronous method.
1474 /// Animatable - This property can be animated using <c>Animation</c> class.
1477 /// <since_tizen> 3 </since_tizen>
1478 public Rotation Orientation
1482 return (Rotation)GetValue(OrientationProperty);
1486 SetValue(OrientationProperty, value);
1487 NotifyPropertyChanged();
1492 /// Gets or sets the world orientation of the view.<br />
1494 /// <since_tizen> 3 </since_tizen>
1495 public Rotation WorldOrientation
1499 Rotation temp = new Rotation();
1500 var pValue = GetProperty(View.Property.WorldOrientation);
1508 /// Gets or sets the scale factor applied to the view.<br />
1512 /// Animatable - This property can be animated using <c>Animation</c> class.
1514 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1516 /// <since_tizen> 3 </since_tizen>
1517 public Vector3 Scale
1521 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1522 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1526 SetValue(ScaleProperty, value);
1527 NotifyPropertyChanged();
1532 /// Gets or sets the scale X factor applied to the view.
1536 /// Animatable - This property can be animated using <c>Animation</c> class.
1539 /// <since_tizen> 3 </since_tizen>
1544 return (float)GetValue(ScaleXProperty);
1548 SetValue(ScaleXProperty, value);
1549 NotifyPropertyChanged();
1554 /// Gets or sets the scale Y factor applied to the view.
1558 /// Animatable - This property can be animated using <c>Animation</c> class.
1561 /// <since_tizen> 3 </since_tizen>
1566 return (float)GetValue(ScaleYProperty);
1570 SetValue(ScaleYProperty, value);
1571 NotifyPropertyChanged();
1576 /// Gets or sets the scale Z factor applied to the view.
1580 /// Animatable - This property can be animated using <c>Animation</c> class.
1583 /// <since_tizen> 3 </since_tizen>
1588 return (float)GetValue(ScaleZProperty);
1592 SetValue(ScaleZProperty, value);
1593 NotifyPropertyChanged();
1598 /// Gets the world scale of the view.
1600 /// <since_tizen> 3 </since_tizen>
1601 public Vector3 WorldScale
1605 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1606 var pValue = GetProperty(View.Property.WorldScale);
1614 /// Retrieves the visibility flag of the view.
1618 /// If the view is not visible, then the view and its children will not be rendered.
1619 /// 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.
1622 /// Animatable - This property can be animated using <c>Animation</c> class.
1625 /// <since_tizen> 3 </since_tizen>
1626 public bool Visibility
1631 var pValue = GetProperty(View.Property.VISIBLE);
1632 pValue.Get(out temp);
1639 /// Gets the view's world color.
1641 /// <since_tizen> 3 </since_tizen>
1642 public Vector4 WorldColor
1646 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1647 var pValue = GetProperty(View.Property.WorldColor);
1655 /// Gets or sets the view's name.
1657 /// <since_tizen> 3 </since_tizen>
1662 return (string)GetValue(NameProperty);
1666 SetValue(NameProperty, value);
1667 NotifyPropertyChanged();
1672 /// Get the number of children held by the view.
1674 /// <since_tizen> 3 </since_tizen>
1675 public new uint ChildCount
1679 return Convert.ToUInt32(Children.Count);
1684 /// Gets the view's ID.
1687 /// <since_tizen> 3 </since_tizen>
1697 /// Gets or sets the status of whether the view should emit touch or hover signals.
1699 /// <since_tizen> 3 </since_tizen>
1700 public bool Sensitive
1704 return (bool)GetValue(SensitiveProperty);
1708 SetValue(SensitiveProperty, value);
1709 NotifyPropertyChanged();
1714 /// 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.
1716 /// <since_tizen> 3 </since_tizen>
1717 public bool LeaveRequired
1721 return (bool)GetValue(LeaveRequiredProperty);
1725 SetValue(LeaveRequiredProperty, value);
1726 NotifyPropertyChanged();
1731 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1733 /// <since_tizen> 3 </since_tizen>
1734 public bool InheritOrientation
1738 return (bool)GetValue(InheritOrientationProperty);
1742 SetValue(InheritOrientationProperty, value);
1743 NotifyPropertyChanged();
1748 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1750 /// <since_tizen> 3 </since_tizen>
1751 public bool InheritScale
1755 return (bool)GetValue(InheritScaleProperty);
1759 SetValue(InheritScaleProperty, value);
1760 NotifyPropertyChanged();
1765 /// Gets or sets the status of how the view and its children should be drawn.<br />
1766 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1767 /// 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 />
1768 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1769 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1770 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1772 /// <since_tizen> 3 </since_tizen>
1773 public DrawModeType DrawMode
1777 return (DrawModeType)GetValue(DrawModeProperty);
1781 SetValue(DrawModeProperty, value);
1782 NotifyPropertyChanged();
1787 /// Gets or sets the relative to parent size factor of the view.<br />
1788 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1789 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1792 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1794 /// <since_tizen> 3 </since_tizen>
1795 public Vector3 SizeModeFactor
1799 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1800 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1804 SetValue(SizeModeFactorProperty, value);
1805 NotifyPropertyChanged();
1810 /// Gets or sets the width resize policy to be used.
1812 /// <since_tizen> 3 </since_tizen>
1813 public ResizePolicyType WidthResizePolicy
1817 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1821 SetValue(WidthResizePolicyProperty, value);
1822 NotifyPropertyChanged();
1827 /// Gets or sets the height resize policy to be used.
1829 /// <since_tizen> 3 </since_tizen>
1830 public ResizePolicyType HeightResizePolicy
1834 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1838 SetValue(HeightResizePolicyProperty, value);
1839 NotifyPropertyChanged();
1844 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1845 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1847 /// <since_tizen> 3 </since_tizen>
1848 public SizeScalePolicyType SizeScalePolicy
1852 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1856 SetValue(SizeScalePolicyProperty, value);
1857 NotifyPropertyChanged();
1862 /// Gets or sets the status of whether the width size is dependent on the height size.
1864 /// <since_tizen> 3 </since_tizen>
1865 public bool WidthForHeight
1869 return (bool)GetValue(WidthForHeightProperty);
1873 SetValue(WidthForHeightProperty, value);
1874 NotifyPropertyChanged();
1879 /// Gets or sets the status of whether the height size is dependent on the width size.
1881 /// <since_tizen> 3 </since_tizen>
1882 public bool HeightForWidth
1886 return (bool)GetValue(HeightForWidthProperty);
1890 SetValue(HeightForWidthProperty, value);
1891 NotifyPropertyChanged();
1896 /// Gets or sets the padding for use in layout.
1899 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1901 /// <since_tizen> 5 </since_tizen>
1902 public Extents Padding
1906 // If View has a Layout then padding in stored in the base Layout class
1909 return Layout.Padding;
1913 Extents temp = (Extents)GetValue(PaddingProperty);
1914 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1916 // Two return points to prevent creating a zeroed Extent native object before assignment
1920 Extents padding = value;
1923 // Layout set so store Padding in LayoutItem instead of in View.
1924 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1925 // the position and sizes measure in the Layouting.
1926 Layout.Padding = value;
1927 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1928 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1929 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1931 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1935 SetValue(PaddingProperty, padding);
1936 NotifyPropertyChanged();
1941 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1943 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1945 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1947 /// <since_tizen> 3 </since_tizen>
1948 public Size2D MinimumSize
1952 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1953 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1959 throw new ArgumentNullException(nameof(value));
1963 // Note: it only works if minimum size is >= than natural size.
1964 // To force the size it should be done through the width&height spec or Size2D.
1965 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1966 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1967 layout.RequestLayout();
1969 SetValue(MinimumSizeProperty, value);
1970 NotifyPropertyChanged();
1975 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1978 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1980 /// <since_tizen> 3 </since_tizen>
1981 public Size2D MaximumSize
1985 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1986 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1990 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1991 // MATCH_PARENT spec + parent container size can be used to limit
1994 layout.RequestLayout();
1996 SetValue(MaximumSizeProperty, value);
1997 NotifyPropertyChanged();
2002 /// Gets or sets whether a child view inherits it's parent's position.<br />
2003 /// Default is to inherit.<br />
2004 /// 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 />
2006 /// <since_tizen> 3 </since_tizen>
2007 public bool InheritPosition
2011 return (bool)GetValue(InheritPositionProperty);
2015 SetValue(InheritPositionProperty, value);
2016 NotifyPropertyChanged();
2021 /// Gets or sets the clipping behavior (mode) of it's children.
2023 /// <since_tizen> 3 </since_tizen>
2024 public ClippingModeType ClippingMode
2028 return (ClippingModeType)GetValue(ClippingModeProperty);
2032 SetValue(ClippingModeProperty, value);
2033 NotifyPropertyChanged();
2038 /// Gets the number of renderers held by the view.
2040 /// <since_tizen> 3 </since_tizen>
2041 public uint RendererCount
2045 return GetRendererCount();
2050 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2053 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2055 /// <since_tizen> 3 </since_tizen>
2056 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2058 "View view = new View(); " +
2059 "view.PivotPoint = PivotPoint.Center; " +
2060 "view.PositionUsesPivotPoint = true;")]
2061 [EditorBrowsable(EditorBrowsableState.Never)]
2062 public Position AnchorPoint
2066 Position temp = new Position(0.0f, 0.0f, 0.0f);
2067 var pValue = GetProperty(View.Property.AnchorPoint);
2070 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2076 var temp = new Tizen.NUI.PropertyValue(value);
2077 SetProperty(View.Property.AnchorPoint, temp);
2079 NotifyPropertyChanged();
2084 /// Sets the size of a view for the width, the height and the depth.<br />
2085 /// Geometry can be scaled to fit within this area.<br />
2086 /// This does not interfere with the view's scale factor.<br />
2087 /// The views default depth is the minimum of width and height.<br />
2091 /// Animatable - This property can be animated using <c>Animation</c> class.
2093 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2095 /// <since_tizen> 5 </since_tizen>
2100 Size tmp = (Size)GetValue(SizeProperty);
2101 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2105 SetValue(SizeProperty, value);
2106 NotifyPropertyChanged();
2111 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2113 /// <since_tizen> 3 </since_tizen>
2114 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2116 "Container parent = view.GetParent(); " +
2117 "View view = parent as View;")]
2118 [EditorBrowsable(EditorBrowsableState.Never)]
2119 public new View Parent
2124 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2125 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2126 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2128 if (basehandle is Layer layer)
2130 ret = new View(Layer.getCPtr(layer).Handle, false);
2131 NUILog.Error("This Parent property is deprecated, should do not be used");
2135 ret = basehandle as View;
2138 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2139 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2141 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2147 /// Gets/Sets whether inherit parent's the layout Direction.
2149 /// <since_tizen> 4 </since_tizen>
2150 public bool InheritLayoutDirection
2154 return (bool)GetValue(InheritLayoutDirectionProperty);
2158 SetValue(InheritLayoutDirectionProperty, value);
2159 NotifyPropertyChanged();
2164 /// Gets/Sets the layout Direction.
2166 /// <since_tizen> 4 </since_tizen>
2167 public ViewLayoutDirectionType LayoutDirection
2171 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2175 SetValue(LayoutDirectionProperty, value);
2176 NotifyPropertyChanged();
2177 layout?.RequestLayout();
2182 /// Gets or sets the Margin for use in layout.
2185 /// Margin property is supported by Layout algorithms and containers.
2186 /// Please Set Layout if you want to use Margin property.
2187 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2189 /// <since_tizen> 4 </since_tizen>
2190 public Extents Margin
2194 // If View has a Layout then margin is stored in Layout.
2197 return Layout.Margin;
2201 // If Layout not set then return margin stored in View.
2202 Extents temp = (Extents)GetValue(MarginProperty);
2203 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2205 // Two return points to prevent creating a zeroed Extent native object before assignment
2211 // Layout set so store Margin in LayoutItem instead of View.
2212 // If View stores the Margin too then the Legacy Size Negotiation will
2213 // overwrite the position and size values measured in the Layouting.
2214 Layout.Margin = value;
2215 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2216 layout?.RequestLayout();
2220 SetValue(MarginProperty, value);
2222 NotifyPropertyChanged();
2223 layout?.RequestLayout();
2228 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2230 /// <since_tizen> 6 </since_tizen>
2231 public int WidthSpecification
2239 if (value == widthPolicy)
2242 widthPolicy = value;
2243 if (widthPolicy >= 0)
2245 if (heightPolicy >= 0) // Policy an exact value
2247 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2248 Size2D = new Size2D(widthPolicy, heightPolicy);
2251 layout?.RequestLayout();
2256 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2258 /// <since_tizen> 6 </since_tizen>
2259 public int HeightSpecification
2263 return heightPolicy;
2267 if (value == heightPolicy)
2270 heightPolicy = value;
2271 if (heightPolicy >= 0)
2273 if (widthPolicy >= 0) // Policy an exact value
2275 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2276 Size2D = new Size2D(widthPolicy, heightPolicy);
2279 layout?.RequestLayout();
2284 /// Gets the List of transitions for this View.
2286 /// <since_tizen> 6 </since_tizen>
2287 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2291 if (layoutTransitions == null)
2293 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2295 return layoutTransitions;
2300 /// Set a layout transitions for this View.
2302 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2304 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2306 /// <since_tizen> 6 </since_tizen>
2307 public LayoutTransition LayoutTransition
2311 return layoutTransition;
2317 throw new global::System.ArgumentNullException(nameof(value));
2319 if (layoutTransitions == null)
2321 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2324 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2326 AttachTransitionsToChildren(value);
2328 layoutTransition = value;
2333 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2336 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2338 /// <since_tizen> 4 </since_tizen>
2339 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2340 [EditorBrowsable(EditorBrowsableState.Never)]
2341 public Extents PaddingEX
2345 Extents temp = new Extents(0, 0, 0, 0);
2346 var pValue = GetProperty(View.Property.PADDING);
2349 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2355 var temp = new Tizen.NUI.PropertyValue(value);
2356 SetProperty(View.Property.PADDING, temp);
2358 NotifyPropertyChanged();
2359 layout?.RequestLayout();
2364 /// The Color of View. This is an RGBA value.
2368 /// Animatable - This property can be animated using <c>Animation</c> class.
2370 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2372 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2373 [EditorBrowsable(EditorBrowsableState.Never)]
2378 Color temp = (Color)GetValue(ColorProperty);
2379 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2383 SetValue(ColorProperty, value);
2384 selectorData?.Color.UpdateIfNeeds(this, value);
2385 NotifyPropertyChanged();
2390 /// Set the layout on this View. Replaces any existing Layout.
2392 /// <since_tizen> 6 </since_tizen>
2393 public LayoutItem Layout
2401 // Do nothing if layout provided is already set on this View.
2402 if (value == layout)
2407 LayoutingDisabled = false;
2410 // If new layout being set already has a owner then that owner receives a replacement default layout.
2411 // First check if the layout to be set already has a owner.
2412 if (value?.Owner != null)
2414 // Previous owner of the layout gets a default layout as a replacement.
2415 value.Owner.Layout = new AbsoluteLayout();
2417 // Copy Margin and Padding to replacement LayoutGroup.
2418 if (value.Owner.Layout != null)
2420 value.Owner.Layout.Margin = value.Margin;
2421 value.Owner.Layout.Padding = value.Padding;
2425 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2426 // View if no replacement. Previously margin and padding values would have been moved from
2427 // the View to the layout.
2428 if (layout != null) // Existing layout
2432 // Existing layout being replaced so copy over margin and padding values.
2433 value.Margin = layout.Margin;
2434 value.Padding = layout.Padding;
2438 // Layout not being replaced so restore margin and padding to View.
2439 SetValue(MarginProperty, layout.Margin);
2440 SetValue(PaddingProperty, layout.Padding);
2441 NotifyPropertyChanged();
2446 // First Layout to be added to the View hence copy
2448 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2451 if (false == (this is TextLabel))
2453 if (Margin.Top != 0 || Margin.Bottom != 0 || Margin.Start != 0 || Margin.End != 0)
2455 // If View already has a margin set then store it in Layout instead.
2456 value.Margin = Margin;
2457 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2458 NotifyPropertyChanged();
2461 if (Padding.Top != 0 || Padding.Bottom != 0 || Padding.Start != 0 || Padding.End != 0)
2463 // If View already has a padding set then store it in Layout instead.
2464 value.Padding = Padding;
2465 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2466 NotifyPropertyChanged();
2473 // Remove existing layout from it's parent layout group.
2476 value.SetPositionByLayout = !excludeLayouting;
2478 // Set layout to this view
2484 /// The weight of the View, used to share available space in a layout with siblings.
2486 /// <since_tizen> 6 </since_tizen>
2496 layout?.RequestLayout();
2501 /// Whether to load the BackgroundImage synchronously.
2502 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2503 /// Note: For Normal Quad images only.
2505 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2506 [EditorBrowsable(EditorBrowsableState.Never)]
2507 public bool BackgroundImageSynchronosLoading
2511 return backgroundImageSynchronosLoading;
2515 backgroundImageSynchronosLoading = value;
2517 string bgUrl = null;
2518 var pValue = Background.Find(ImageVisualProperty.URL);
2519 pValue?.Get(out bgUrl);
2522 if (!string.IsNullOrEmpty(bgUrl))
2524 PropertyMap bgMap = this.Background;
2525 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2526 bgMap.Add("synchronousLoading", temp);
2533 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2534 [EditorBrowsable(EditorBrowsableState.Never)]
2535 public Vector2 UpdateSizeHint
2539 return (Vector2)GetValue(UpdateSizeHintProperty);
2543 SetValue(UpdateSizeHintProperty, value);
2544 NotifyPropertyChanged();
2549 /// Enable/Disable ControlState propagation for children.
2550 /// It is false by default.
2551 /// If the View needs to share ControlState with descendants, please set it true.
2552 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2554 [EditorBrowsable(EditorBrowsableState.Never)]
2555 public bool EnableControlStatePropagation
2557 get => controlStatePropagation;
2560 controlStatePropagation = value;
2562 foreach (View child in Children)
2564 child.EnableControlStatePropagation = value;
2570 /// If this property is set to true, the View can have a touch related ControlState (such as Pressed) when touch.
2571 /// By default, it is false in View, true in Control.
2572 /// Note that if the value is true, the View will be a touch receptor.
2574 [EditorBrowsable(EditorBrowsableState.Never)]
2575 public bool EnableControlState
2579 return (bool)GetValue(EnableControlStateProperty);
2583 SetValue(EnableControlStateProperty, value);
2588 /// Whether the actor grab all touches even if touch leaves its boundary.
2590 /// <returns>true, if it grab all touch after start</returns>
2591 [EditorBrowsable(EditorBrowsableState.Never)]
2592 public bool GrabTouchAfterLeave
2597 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2598 pValue.Get(out temp);
2604 var temp = new Tizen.NUI.PropertyValue(value);
2605 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2607 NotifyPropertyChanged();
2612 /// Determines which blend equation will be used to render renderers of this actor.
2614 /// <returns>blend equation enum currently assigned</returns>
2615 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2616 [EditorBrowsable(EditorBrowsableState.Never)]
2617 public BlendEquationType BlendEquation
2622 var pValue = GetProperty(View.Property.BlendEquation);
2623 pValue.Get(out temp);
2625 return (BlendEquationType)temp;
2629 var temp = new Tizen.NUI.PropertyValue((int)value);
2630 SetProperty(View.Property.BlendEquation, temp);
2632 NotifyPropertyChanged();
2637 /// If the value is true, the View will change its style as the theme changes.
2638 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2640 [EditorBrowsable(EditorBrowsableState.Never)]
2641 public bool ThemeChangeSensitive
2643 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2644 set => SetValue(ThemeChangeSensitiveProperty, value);
2648 /// Create Style, it is abstract function and must be override.
2650 [EditorBrowsable(EditorBrowsableState.Never)]
2651 protected virtual ViewStyle CreateViewStyle()
2653 return new ViewStyle();
2657 /// Called after the View's ControlStates changed.
2659 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2660 [EditorBrowsable(EditorBrowsableState.Never)]
2661 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2667 [EditorBrowsable(EditorBrowsableState.Never)]
2668 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2673 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2674 [EditorBrowsable(EditorBrowsableState.Never)]
2675 public virtual void ApplyStyle(ViewStyle viewStyle)
2677 if (null == viewStyle || this.viewStyle == viewStyle) return;
2679 this.viewStyle = viewStyle;
2681 Dictionary<string, BindableProperty> bindablePropertyOfView;
2682 Type viewType = GetType();
2684 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2685 Type styleType = viewStyle.GetType();
2687 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2688 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2690 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2692 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2694 BindableProperty viewProperty;
2695 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2697 if (null != viewProperty && viewProperty != StyleNameProperty)
2699 object value = viewStyle.GetValue(keyValuePair.Value);
2703 SetValue(viewProperty, value);
2711 /// Used to restore the transition.
2713 [EditorBrowsable(EditorBrowsableState.Never)]
2714 public IList<Transition> TransitionList
2717 } = new List<Transition>();
2720 /// Get whether the View is culled or not.
2721 /// True means that the View is out of the view frustum.
2724 /// Hidden-API (Inhouse-API).
2726 [EditorBrowsable(EditorBrowsableState.Never)]
2732 var pValue = GetProperty(View.Property.Culled);
2733 pValue.Get(out temp);