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 //ToDo: this has memory leak and this is not used currently. will be fixed soon by using Event subscribing pattern.
105 //_onWindowSendEventCallback = SendViewAddedEventToWindow;
106 //this.OnWindowSignal().Connect(_onWindowSendEventCallback);
114 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
125 /// The event that is triggered when the View's ControlState is changed.
127 [EditorBrowsable(EditorBrowsableState.Never)]
128 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
130 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
134 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
136 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
137 [EditorBrowsable(EditorBrowsableState.Never)]
138 public bool LayoutSet
147 /// Flag to allow Layouting to be disabled for Views.
148 /// Once a View has a Layout set then any children added to Views from then on will receive
149 /// automatic Layouts.
151 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
152 [EditorBrowsable(EditorBrowsableState.Never)]
153 public static bool LayoutingDisabled { get; set; } = true;
155 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
156 [EditorBrowsable(EditorBrowsableState.Never)]
157 public ViewStyle ViewStyle
161 if (null == viewStyle)
163 ApplyStyle(CreateViewStyle());
171 /// Get/Set the control state.
173 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
174 [EditorBrowsable(EditorBrowsableState.Never)]
175 public ControlState ControlState
179 return controlStates;
183 if (controlStates == value)
188 var prevState = controlStates;
190 controlStates = value;
192 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
194 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
196 if (controlStatePropagation)
198 foreach (View child in Children)
200 child.ControlState = value;
204 OnControlStateChanged(changeInfo);
206 ControlStateChangedEvent?.Invoke(this, changeInfo);
210 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
211 [EditorBrowsable(EditorBrowsableState.Never)]
212 public bool ExcludeLayouting
216 return excludeLayouting;
220 excludeLayouting = value;
221 if (Layout != null && Layout.SetPositionByLayout == value)
223 Layout.SetPositionByLayout = !value;
224 Layout.RequestLayout();
229 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
230 [EditorBrowsable(EditorBrowsableState.Never)]
231 public bool IsResourcesCreated
235 return Application.Current.IsResourcesCreated;
239 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
240 [EditorBrowsable(EditorBrowsableState.Never)]
241 public ResourceDictionary XamlResources
245 return Application.Current.XamlResources;
249 Application.Current.XamlResources = value;
254 /// The StyleName, type string.
255 /// The value indicates DALi style name defined in json theme file.
257 /// <since_tizen> 3 </since_tizen>
258 public string StyleName
262 return (string)GetValue(StyleNameProperty);
266 SetValue(StyleNameProperty, value);
267 NotifyPropertyChanged();
272 /// The KeyInputFocus, type bool.
274 [EditorBrowsable(EditorBrowsableState.Never)]
275 public bool KeyInputFocus
279 return (bool)GetValue(KeyInputFocusProperty);
283 SetValue(KeyInputFocusProperty, value);
284 NotifyPropertyChanged();
289 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
293 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
296 /// Animatable - This property can be animated using <c>Animation</c> class.
298 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
302 /// <since_tizen> 3 </since_tizen>
303 public Color BackgroundColor
307 Color temp = (Color)GetValue(BackgroundColorProperty);
308 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
312 SetValue(BackgroundColorProperty, value);
313 if (selectorData != null)
315 selectorData.BackgroundImage.Reset(this);
316 selectorData.BackgroundColor.UpdateIfNeeds(this, value);
318 NotifyPropertyChanged();
323 /// The mutually exclusive with "backgroundColor" and "background" type Map.
325 /// <since_tizen> 3 </since_tizen>
326 public string BackgroundImage
330 return (string)GetValue(BackgroundImageProperty);
334 SetValue(BackgroundImageProperty, value);
335 if (selectorData != null)
337 selectorData.BackgroundColor.Reset(this);
338 selectorData.BackgroundImage.UpdateIfNeeds(this, value);
340 NotifyPropertyChanged();
345 /// Get or set the border of background image.
347 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
348 [EditorBrowsable(EditorBrowsableState.Never)]
349 public Rectangle BackgroundImageBorder
353 return (Rectangle)GetValue(BackgroundImageBorderProperty);
357 SetValue(BackgroundImageBorderProperty, value);
358 selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value);
359 NotifyPropertyChanged();
364 /// The background of view.
366 /// <since_tizen> 3 </since_tizen>
367 public Tizen.NUI.PropertyMap Background
371 return (PropertyMap)GetValue(BackgroundProperty);
375 SetValue(BackgroundProperty, value);
376 NotifyPropertyChanged();
381 /// Describes a shadow as an image for a View.
382 /// It is null by default.
385 /// Getter returns copied instance of current shadow.
388 /// The mutually exclusive with "BoxShadow".
392 /// Animatable - This property can be animated using <c>Animation</c> class.
393 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
395 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
397 /// Animatable sub-property : Offset.
400 [EditorBrowsable(EditorBrowsableState.Never)]
401 public ImageShadow ImageShadow
405 return (ImageShadow)GetValue(ImageShadowProperty);
409 SetValue(ImageShadowProperty, value);
410 if (selectorData != null)
412 selectorData.BoxShadow.Reset(this);
413 selectorData.ImageShadow.UpdateIfNeeds(this, value);
415 NotifyPropertyChanged();
420 /// Describes a box shaped shadow drawing for a View.
421 /// It is null by default.
424 /// Gettter returns copied instance of current shadow.
427 /// The mutually exclusive with "ImageShadow".
431 /// Animatable - This property can be animated using <c>Animation</c> class.
432 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
434 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
436 /// Animatable sub-property : Offset, Color, BlurRadius.
439 [EditorBrowsable(EditorBrowsableState.Never)]
440 public Shadow BoxShadow
444 return (Shadow)GetValue(BoxShadowProperty);
448 SetValue(BoxShadowProperty, value);
449 if (selectorData != null)
451 selectorData.ImageShadow.Reset(this);
452 selectorData.BoxShadow.UpdateIfNeeds(this, value);
454 NotifyPropertyChanged();
459 /// The radius for the rounded corners of the View.
460 /// This will rounds background and shadow edges.
461 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
465 /// Animatable - This property can be animated using <c>Animation</c> class.
468 [EditorBrowsable(EditorBrowsableState.Never)]
469 public float CornerRadius
473 return (float)GetValue(CornerRadiusProperty);
477 SetValue(CornerRadiusProperty, value);
478 NotifyPropertyChanged();
486 [EditorBrowsable(EditorBrowsableState.Never)]
487 protected bool IsHighlighted
491 return Accessibility.AccessibilityManager.Instance.GetCurrentFocusView() == this;
495 [EditorBrowsable(EditorBrowsableState.Never)]
496 protected static readonly string AccessibilityActivateAction = "activate";
497 [EditorBrowsable(EditorBrowsableState.Never)]
498 protected static readonly string AccessibilityReadingSkippedAction = "ReadingSkipped";
499 [EditorBrowsable(EditorBrowsableState.Never)]
500 protected static readonly string AccessibilityReadingCancelledAction = "ReadingCancelled";
501 [EditorBrowsable(EditorBrowsableState.Never)]
502 protected static readonly string AccessibilityReadingStoppedAction = "ReadingStopped";
503 [EditorBrowsable(EditorBrowsableState.Never)]
504 protected static readonly string AccessibilityReadingPausedAction = "ReadingPaused";
505 [EditorBrowsable(EditorBrowsableState.Never)]
506 protected static readonly string AccessibilityReadingResumedAction = "ReadingResumed";
508 [EditorBrowsable(EditorBrowsableState.Never)]
509 private static readonly string[] AccessibilityActions = {
510 AccessibilityActivateAction,
511 AccessibilityReadingSkippedAction,
512 AccessibilityReadingCancelledAction,
513 AccessibilityReadingStoppedAction,
514 AccessibilityReadingPausedAction,
515 AccessibilityReadingResumedAction,
518 [EditorBrowsable(EditorBrowsableState.Never)]
519 protected virtual string AccessibilityGetName()
524 [EditorBrowsable(EditorBrowsableState.Never)]
525 protected virtual string AccessibilityGetDescription()
530 [EditorBrowsable(EditorBrowsableState.Never)]
531 protected virtual bool AccessibilityDoAction(string name)
536 [EditorBrowsable(EditorBrowsableState.Never)]
537 protected virtual AccessibilityStates AccessibilityCalculateStates()
539 var states = new AccessibilityStates();
540 states.Set(AccessibilityState.Highlightable, this.AccessibilityHighlightable);
541 states.Set(AccessibilityState.Focusable, this.Focusable);
542 states.Set(AccessibilityState.Focused, this.State == States.Focused);
543 states.Set(AccessibilityState.Highlighted, this.IsHighlighted);
544 states.Set(AccessibilityState.Enabled, this.State != States.Disabled);
545 states.Set(AccessibilityState.Sensitive, this.Sensitive);
546 states.Set(AccessibilityState.Animated, this.AccessibilityAnimated);
547 states.Set(AccessibilityState.Visible, true);
548 states.Set(AccessibilityState.Showing, this.Visibility);
549 states.Set(AccessibilityState.Defunct, !this.IsOnWindow);
553 [EditorBrowsable(EditorBrowsableState.Never)]
554 protected virtual int AccessibilityGetActionCount()
556 return AccessibilityActions.Length;
559 [EditorBrowsable(EditorBrowsableState.Never)]
560 protected virtual string AccessibilityGetActionName(int index)
562 if (index >= 0 && index < AccessibilityActions.Length)
563 return AccessibilityActions[index];
568 [EditorBrowsable(EditorBrowsableState.Never)]
569 protected virtual bool AccessibilityShouldReportZeroChildren()
574 [EditorBrowsable(EditorBrowsableState.Never)]
575 protected virtual double AccessibilityGetMinimum()
580 [EditorBrowsable(EditorBrowsableState.Never)]
581 protected virtual double AccessibilityGetCurrent()
586 [EditorBrowsable(EditorBrowsableState.Never)]
587 protected virtual double AccessibilityGetMaximum()
592 [EditorBrowsable(EditorBrowsableState.Never)]
593 protected virtual bool AccessibilitySetCurrent(double value)
598 [EditorBrowsable(EditorBrowsableState.Never)]
599 protected virtual double AccessibilityGetMinimumIncrement()
604 [EditorBrowsable(EditorBrowsableState.Never)]
605 protected virtual bool AccessibilityIsScrollable()
610 [EditorBrowsable(EditorBrowsableState.Never)]
611 protected virtual string AccessibilityGetText(int startOffset, int endOffset)
616 [EditorBrowsable(EditorBrowsableState.Never)]
617 protected virtual int AccessibilityGetCharacterCount()
622 [EditorBrowsable(EditorBrowsableState.Never)]
623 protected virtual int AccessibilityGetCaretOffset()
628 [EditorBrowsable(EditorBrowsableState.Never)]
629 protected virtual bool AccessibilitySetCaretOffset(int offset)
634 [EditorBrowsable(EditorBrowsableState.Never)]
635 protected virtual AccessibilityRange AccessibilityGetTextAtOffset(int offset, TextBoundary boundary)
637 return new AccessibilityRange();
640 [EditorBrowsable(EditorBrowsableState.Never)]
641 protected virtual AccessibilityRange AccessibilityGetSelection(int selectionNum)
643 return new AccessibilityRange();
646 [EditorBrowsable(EditorBrowsableState.Never)]
647 protected virtual bool AccessibilityRemoveSelection(int selectionNum)
652 [EditorBrowsable(EditorBrowsableState.Never)]
653 protected virtual bool AccessibilitySetSelection(int selectionNum, int startOffset, int endOffset)
658 [EditorBrowsable(EditorBrowsableState.Never)]
659 protected virtual bool AccessibilityCopyText(int startPosition, int endPosition)
664 [EditorBrowsable(EditorBrowsableState.Never)]
665 protected virtual bool AccessibilityCutText(int startPosition, int endPosition)
671 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
672 /// It is absolute by default.
673 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
675 [EditorBrowsable(EditorBrowsableState.Never)]
676 public VisualTransformPolicyType CornerRadiusPolicy
678 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
679 set => SetValue(CornerRadiusPolicyProperty, value);
683 /// The current state of the view.
685 /// <since_tizen> 3 </since_tizen>
690 return (States)GetValue(StateProperty);
694 SetValue(StateProperty, value);
695 NotifyPropertyChanged();
700 /// The current sub state of the view.
702 /// <since_tizen> 3 </since_tizen>
703 public States SubState
707 return (States)GetValue(SubStateProperty);
711 SetValue(SubStateProperty, value);
712 NotifyPropertyChanged();
717 /// Displays a tooltip
719 /// <since_tizen> 3 </since_tizen>
720 public Tizen.NUI.PropertyMap Tooltip
724 return (PropertyMap)GetValue(TooltipProperty);
728 SetValue(TooltipProperty, value);
729 NotifyPropertyChanged();
734 /// Displays a tooltip as a text.
736 /// <since_tizen> 3 </since_tizen>
737 public string TooltipText
741 using (var propertyValue = GetProperty(Property.TOOLTIP))
743 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
745 return retrivedValue;
747 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
748 return "error to get TooltipText";
753 var temp = new Tizen.NUI.PropertyValue(value);
754 SetProperty(View.Property.TOOLTIP, temp);
756 NotifyPropertyChanged();
761 /// The Child property of FlexContainer.<br />
762 /// The proportion of the free space in the container, the flex item will receive.<br />
763 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
765 /// <since_tizen> 3 </since_tizen>
766 [Obsolete("Deprecated in API8, will be removed in API10.")]
771 return (float)GetValue(FlexProperty);
775 SetValue(FlexProperty, value);
776 NotifyPropertyChanged();
781 /// The Child property of FlexContainer.<br />
782 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
784 /// <since_tizen> 3 </since_tizen>
785 [Obsolete("Deprecated in API8, will be removed in API10.")]
790 return (int)GetValue(AlignSelfProperty);
794 SetValue(AlignSelfProperty, value);
795 NotifyPropertyChanged();
800 /// The Child property of FlexContainer.<br />
801 /// The space around the flex item.<br />
804 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
806 /// <since_tizen> 3 </since_tizen>
807 [Obsolete("Deprecated in API8, will be removed in API10.")]
808 public Vector4 FlexMargin
812 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
813 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
817 SetValue(FlexMarginProperty, value);
818 NotifyPropertyChanged();
823 /// The top-left cell this child occupies, if not set, the first available cell is used.
826 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
828 /// <since_tizen> 3 </since_tizen>
829 public Vector2 CellIndex
833 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
834 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
838 SetValue(CellIndexProperty, value);
839 NotifyPropertyChanged();
844 /// The number of rows this child occupies, if not set, the default value is 1.
846 /// <since_tizen> 3 </since_tizen>
851 return (float)GetValue(RowSpanProperty);
855 SetValue(RowSpanProperty, value);
856 NotifyPropertyChanged();
861 /// The number of columns this child occupies, if not set, the default value is 1.
863 /// <since_tizen> 3 </since_tizen>
864 public float ColumnSpan
868 return (float)GetValue(ColumnSpanProperty);
872 SetValue(ColumnSpanProperty, value);
873 NotifyPropertyChanged();
878 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
880 /// <since_tizen> 3 </since_tizen>
881 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
885 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
889 SetValue(CellHorizontalAlignmentProperty, value);
890 NotifyPropertyChanged();
895 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
897 /// <since_tizen> 3 </since_tizen>
898 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
902 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
906 SetValue(CellVerticalAlignmentProperty, value);
907 NotifyPropertyChanged();
912 /// The left focusable view.<br />
913 /// This will return null if not set.<br />
914 /// This will also return null if the specified left focusable view is not on a window.<br />
916 /// <since_tizen> 3 </since_tizen>
917 public View LeftFocusableView
919 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
922 return (View)GetValue(LeftFocusableViewProperty);
926 SetValue(LeftFocusableViewProperty, value);
927 NotifyPropertyChanged();
932 /// The right focusable view.<br />
933 /// This will return null if not set.<br />
934 /// This will also return null if the specified right focusable view is not on a window.<br />
936 /// <since_tizen> 3 </since_tizen>
937 public View RightFocusableView
939 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
942 return (View)GetValue(RightFocusableViewProperty);
946 SetValue(RightFocusableViewProperty, value);
947 NotifyPropertyChanged();
952 /// The up focusable view.<br />
953 /// This will return null if not set.<br />
954 /// This will also return null if the specified up focusable view is not on a window.<br />
956 /// <since_tizen> 3 </since_tizen>
957 public View UpFocusableView
959 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
962 return (View)GetValue(UpFocusableViewProperty);
966 SetValue(UpFocusableViewProperty, value);
967 NotifyPropertyChanged();
972 /// The down focusable view.<br />
973 /// This will return null if not set.<br />
974 /// This will also return null if the specified down focusable view is not on a window.<br />
976 /// <since_tizen> 3 </since_tizen>
977 public View DownFocusableView
979 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
982 return (View)GetValue(DownFocusableViewProperty);
986 SetValue(DownFocusableViewProperty, value);
987 NotifyPropertyChanged();
992 /// Whether the view should be focusable by keyboard navigation.
994 /// <since_tizen> 3 </since_tizen>
995 public bool Focusable
999 SetValue(FocusableProperty, value);
1000 NotifyPropertyChanged();
1004 return (bool)GetValue(FocusableProperty);
1009 /// Retrieves the position of the view.<br />
1010 /// The coordinates are relative to the view's parent.<br />
1012 /// <since_tizen> 3 </since_tizen>
1013 public Position CurrentPosition
1017 return GetCurrentPosition();
1022 /// Sets the size of a view for the width and the height.<br />
1023 /// Geometry can be scaled to fit within this area.<br />
1024 /// This does not interfere with the view's scale factor.<br />
1025 /// The views default depth is the minimum of width and height.<br />
1028 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
1029 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
1031 /// <since_tizen> 3 </since_tizen>
1032 public Size2D Size2D
1036 Size2D temp = (Size2D)GetValue(Size2DProperty);
1037 int width = temp.Width;
1038 int height = temp.Height;
1040 if (this.Layout == null)
1042 if (width < 0) { width = 0; }
1043 if (height < 0) { height = 0; }
1046 return new Size2D(OnSize2DChanged, width, height);
1050 SetValue(Size2DProperty, value);
1052 NotifyPropertyChanged();
1057 /// Retrieves the size of the view.<br />
1058 /// The coordinates are relative to the view's parent.<br />
1060 /// <since_tizen> 3 </since_tizen>
1061 public Size2D CurrentSize
1065 return GetCurrentSize();
1070 /// Retrieves and sets the view's opacity.<br />
1072 /// <since_tizen> 3 </since_tizen>
1073 public float Opacity
1077 return (float)GetValue(OpacityProperty);
1081 SetValue(OpacityProperty, value);
1082 selectorData?.Opacity.UpdateIfNeeds(this, value);
1083 NotifyPropertyChanged();
1088 /// Sets the position of the view for X and Y.<br />
1089 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1090 /// If the position inheritance is disabled, sets the world position.<br />
1093 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1094 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1096 /// <since_tizen> 3 </since_tizen>
1097 public Position2D Position2D
1101 Position2D temp = (Position2D)GetValue(Position2DProperty);
1102 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1106 SetValue(Position2DProperty, value);
1107 NotifyPropertyChanged();
1112 /// Retrieves the screen postion of the view.<br />
1114 /// <since_tizen> 3 </since_tizen>
1115 public Vector2 ScreenPosition
1119 Vector2 temp = new Vector2(0.0f, 0.0f);
1120 var pValue = GetProperty(View.Property.ScreenPosition);
1128 /// Determines whether the pivot point should be used to determine the position of the view.
1129 /// This is false by default.
1131 /// <remarks>If false, then the top-left of the view is used for the position.
1132 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1134 /// <since_tizen> 3 </since_tizen>
1135 public bool PositionUsesPivotPoint
1139 return (bool)GetValue(PositionUsesPivotPointProperty);
1143 SetValue(PositionUsesPivotPointProperty, value);
1144 NotifyPropertyChanged();
1149 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1151 /// <since_tizen> 3 </since_tizen>
1152 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1154 "View view = new View(); " +
1155 "view.PivotPoint = PivotPoint.Center; " +
1156 "view.PositionUsesPivotPoint = true;" +
1157 " Deprecated in API5: Will be removed in API8")]
1158 [EditorBrowsable(EditorBrowsableState.Never)]
1159 public bool PositionUsesAnchorPoint
1164 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1165 pValue.Get(out temp);
1171 var temp = new Tizen.NUI.PropertyValue(value);
1172 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1174 NotifyPropertyChanged();
1179 /// Queries whether the view is connected to the stage.<br />
1180 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1182 /// <since_tizen> 3 </since_tizen>
1183 public bool IsOnWindow
1192 /// Gets the depth in the hierarchy for the view.
1194 /// <since_tizen> 3 </since_tizen>
1195 public int HierarchyDepth
1199 return GetHierarchyDepth();
1204 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1207 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1208 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1209 /// The values set by this property will likely change.
1211 /// <since_tizen> 3 </since_tizen>
1212 public int SiblingOrder
1216 return (int)GetValue(SiblingOrderProperty);
1220 SetValue(SiblingOrderProperty, value);
1222 LayoutGroup layout = Layout as LayoutGroup;
1223 layout?.ChangeLayoutSiblingOrder(value);
1225 NotifyPropertyChanged();
1230 /// Returns the natural size of the view.
1233 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1235 /// <since_tizen> 5 </since_tizen>
1236 public Vector3 NaturalSize
1240 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1241 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1247 /// Returns the natural size (Size2D) of the view.
1250 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1252 /// <since_tizen> 4 </since_tizen>
1253 public Size2D NaturalSize2D
1257 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1258 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1260 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1267 /// Gets or sets the origin of a view within its parent's area.<br />
1268 /// 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 />
1269 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1270 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1272 /// <pre>The view has been initialized.</pre>
1273 /// <since_tizen> 3 </since_tizen>
1274 public Position ParentOrigin
1278 Position tmp = (Position)GetValue(ParentOriginProperty);
1279 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1283 SetValue(ParentOriginProperty, value);
1284 NotifyPropertyChanged();
1289 /// Gets or sets the anchor-point of a view.<br />
1290 /// 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 />
1291 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1292 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1293 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1294 /// <pre>The view has been initialized.</pre>
1297 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1299 /// <since_tizen> 3 </since_tizen>
1300 public Position PivotPoint
1304 Position tmp = (Position)GetValue(PivotPointProperty);
1305 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1309 SetValue(PivotPointProperty, value);
1310 NotifyPropertyChanged();
1315 /// Gets or sets the size width of the view.
1319 /// Animatable - This property can be animated using <c>Animation</c> class.
1322 /// <since_tizen> 3 </since_tizen>
1323 public float SizeWidth
1327 return (float)GetValue(SizeWidthProperty);
1331 SetValue(SizeWidthProperty, value);
1332 NotifyPropertyChanged();
1337 /// Gets or sets the size height of the view.
1341 /// Animatable - This property can be animated using <c>Animation</c> class.
1344 /// <since_tizen> 3 </since_tizen>
1345 public float SizeHeight
1349 return (float)GetValue(SizeHeightProperty);
1353 SetValue(SizeHeightProperty, value);
1354 NotifyPropertyChanged();
1359 /// Gets or sets the position of the view.<br />
1360 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1361 /// If the position inheritance is disabled, sets the world position.<br />
1365 /// Animatable - This property can be animated using <c>Animation</c> class.
1367 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1369 /// <since_tizen> 3 </since_tizen>
1370 public Position Position
1374 Position tmp = (Position)GetValue(PositionProperty);
1375 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1379 SetValue(PositionProperty, value);
1380 NotifyPropertyChanged();
1385 /// Gets or sets the position X of the view.
1389 /// Animatable - This property can be animated using <c>Animation</c> class.
1392 /// <since_tizen> 3 </since_tizen>
1393 public float PositionX
1397 return (float)GetValue(PositionXProperty);
1401 SetValue(PositionXProperty, value);
1402 NotifyPropertyChanged();
1407 /// Gets or sets the position Y of the view.
1411 /// Animatable - This property can be animated using <c>Animation</c> class.
1414 /// <since_tizen> 3 </since_tizen>
1415 public float PositionY
1419 return (float)GetValue(PositionYProperty);
1423 SetValue(PositionYProperty, value);
1424 NotifyPropertyChanged();
1429 /// Gets or sets the position Z of the view.
1433 /// Animatable - This property can be animated using <c>Animation</c> class.
1436 /// <since_tizen> 3 </since_tizen>
1437 public float PositionZ
1441 return (float)GetValue(PositionZProperty);
1445 SetValue(PositionZProperty, value);
1446 NotifyPropertyChanged();
1451 /// Gets or sets the world position of the view.
1453 /// <since_tizen> 3 </since_tizen>
1454 public Vector3 WorldPosition
1458 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1459 var pValue = GetProperty(View.Property.WorldPosition);
1467 /// Gets or sets the orientation of the view.<br />
1468 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1472 /// This is an asynchronous method.
1475 /// Animatable - This property can be animated using <c>Animation</c> class.
1478 /// <since_tizen> 3 </since_tizen>
1479 public Rotation Orientation
1483 return (Rotation)GetValue(OrientationProperty);
1487 SetValue(OrientationProperty, value);
1488 NotifyPropertyChanged();
1493 /// Gets or sets the world orientation of the view.<br />
1495 /// <since_tizen> 3 </since_tizen>
1496 public Rotation WorldOrientation
1500 Rotation temp = new Rotation();
1501 var pValue = GetProperty(View.Property.WorldOrientation);
1509 /// Gets or sets the scale factor applied to the view.<br />
1513 /// Animatable - This property can be animated using <c>Animation</c> class.
1515 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1517 /// <since_tizen> 3 </since_tizen>
1518 public Vector3 Scale
1522 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1523 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1527 SetValue(ScaleProperty, value);
1528 NotifyPropertyChanged();
1533 /// Gets or sets the scale X factor applied to the view.
1537 /// Animatable - This property can be animated using <c>Animation</c> class.
1540 /// <since_tizen> 3 </since_tizen>
1545 return (float)GetValue(ScaleXProperty);
1549 SetValue(ScaleXProperty, value);
1550 NotifyPropertyChanged();
1555 /// Gets or sets the scale Y factor applied to the view.
1559 /// Animatable - This property can be animated using <c>Animation</c> class.
1562 /// <since_tizen> 3 </since_tizen>
1567 return (float)GetValue(ScaleYProperty);
1571 SetValue(ScaleYProperty, value);
1572 NotifyPropertyChanged();
1577 /// Gets or sets the scale Z factor applied to the view.
1581 /// Animatable - This property can be animated using <c>Animation</c> class.
1584 /// <since_tizen> 3 </since_tizen>
1589 return (float)GetValue(ScaleZProperty);
1593 SetValue(ScaleZProperty, value);
1594 NotifyPropertyChanged();
1599 /// Gets the world scale of the view.
1601 /// <since_tizen> 3 </since_tizen>
1602 public Vector3 WorldScale
1606 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1607 var pValue = GetProperty(View.Property.WorldScale);
1615 /// Retrieves the visibility flag of the view.
1619 /// If the view is not visible, then the view and its children will not be rendered.
1620 /// 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.
1623 /// Animatable - This property can be animated using <c>Animation</c> class.
1626 /// <since_tizen> 3 </since_tizen>
1627 public bool Visibility
1632 var pValue = GetProperty(View.Property.VISIBLE);
1633 pValue.Get(out temp);
1640 /// Gets the view's world color.
1642 /// <since_tizen> 3 </since_tizen>
1643 public Vector4 WorldColor
1647 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1648 var pValue = GetProperty(View.Property.WorldColor);
1656 /// Gets or sets the view's name.
1658 /// <since_tizen> 3 </since_tizen>
1663 return (string)GetValue(NameProperty);
1667 SetValue(NameProperty, value);
1668 NotifyPropertyChanged();
1673 /// Get the number of children held by the view.
1675 /// <since_tizen> 3 </since_tizen>
1676 public new uint ChildCount
1680 return Convert.ToUInt32(Children.Count);
1685 /// Gets the view's ID.
1688 /// <since_tizen> 3 </since_tizen>
1698 /// Gets or sets the status of whether the view should emit touch or hover signals.
1700 /// <since_tizen> 3 </since_tizen>
1701 public bool Sensitive
1705 return (bool)GetValue(SensitiveProperty);
1709 SetValue(SensitiveProperty, value);
1710 NotifyPropertyChanged();
1715 /// 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.
1717 /// <since_tizen> 3 </since_tizen>
1718 public bool LeaveRequired
1722 return (bool)GetValue(LeaveRequiredProperty);
1726 SetValue(LeaveRequiredProperty, value);
1727 NotifyPropertyChanged();
1732 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1734 /// <since_tizen> 3 </since_tizen>
1735 public bool InheritOrientation
1739 return (bool)GetValue(InheritOrientationProperty);
1743 SetValue(InheritOrientationProperty, value);
1744 NotifyPropertyChanged();
1749 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1751 /// <since_tizen> 3 </since_tizen>
1752 public bool InheritScale
1756 return (bool)GetValue(InheritScaleProperty);
1760 SetValue(InheritScaleProperty, value);
1761 NotifyPropertyChanged();
1766 /// Gets or sets the status of how the view and its children should be drawn.<br />
1767 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1768 /// 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 />
1769 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1770 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1771 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1773 /// <since_tizen> 3 </since_tizen>
1774 public DrawModeType DrawMode
1778 return (DrawModeType)GetValue(DrawModeProperty);
1782 SetValue(DrawModeProperty, value);
1783 NotifyPropertyChanged();
1788 /// Gets or sets the relative to parent size factor of the view.<br />
1789 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1790 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1793 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1795 /// <since_tizen> 3 </since_tizen>
1796 public Vector3 SizeModeFactor
1800 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1801 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1805 SetValue(SizeModeFactorProperty, value);
1806 NotifyPropertyChanged();
1811 /// Gets or sets the width resize policy to be used.
1813 /// <since_tizen> 3 </since_tizen>
1814 public ResizePolicyType WidthResizePolicy
1818 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1822 SetValue(WidthResizePolicyProperty, value);
1823 NotifyPropertyChanged();
1828 /// Gets or sets the height resize policy to be used.
1830 /// <since_tizen> 3 </since_tizen>
1831 public ResizePolicyType HeightResizePolicy
1835 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1839 SetValue(HeightResizePolicyProperty, value);
1840 NotifyPropertyChanged();
1845 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1846 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1848 /// <since_tizen> 3 </since_tizen>
1849 public SizeScalePolicyType SizeScalePolicy
1853 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1857 SetValue(SizeScalePolicyProperty, value);
1858 NotifyPropertyChanged();
1863 /// Gets or sets the status of whether the width size is dependent on the height size.
1865 /// <since_tizen> 3 </since_tizen>
1866 public bool WidthForHeight
1870 return (bool)GetValue(WidthForHeightProperty);
1874 SetValue(WidthForHeightProperty, value);
1875 NotifyPropertyChanged();
1880 /// Gets or sets the status of whether the height size is dependent on the width size.
1882 /// <since_tizen> 3 </since_tizen>
1883 public bool HeightForWidth
1887 return (bool)GetValue(HeightForWidthProperty);
1891 SetValue(HeightForWidthProperty, value);
1892 NotifyPropertyChanged();
1897 /// Gets or sets the padding for use in layout.
1900 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1902 /// <since_tizen> 5 </since_tizen>
1903 public Extents Padding
1907 // If View has a Layout then padding in stored in the base Layout class
1910 return Layout.Padding;
1914 Extents temp = (Extents)GetValue(PaddingProperty);
1915 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1917 // Two return points to prevent creating a zeroed Extent native object before assignment
1921 Extents padding = value;
1924 // Layout set so store Padding in LayoutItem instead of in View.
1925 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1926 // the position and sizes measure in the Layouting.
1927 Layout.Padding = value;
1928 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1929 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1930 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1932 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1936 SetValue(PaddingProperty, padding);
1937 NotifyPropertyChanged();
1942 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1944 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1946 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1948 /// <since_tizen> 3 </since_tizen>
1949 public Size2D MinimumSize
1953 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1954 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1960 throw new ArgumentNullException(nameof(value));
1964 // Note: it only works if minimum size is >= than natural size.
1965 // To force the size it should be done through the width&height spec or Size2D.
1966 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1967 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1968 layout.RequestLayout();
1970 SetValue(MinimumSizeProperty, value);
1971 NotifyPropertyChanged();
1976 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1979 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1981 /// <since_tizen> 3 </since_tizen>
1982 public Size2D MaximumSize
1986 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1987 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1991 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1992 // MATCH_PARENT spec + parent container size can be used to limit
1995 layout.RequestLayout();
1997 SetValue(MaximumSizeProperty, value);
1998 NotifyPropertyChanged();
2003 /// Gets or sets whether a child view inherits it's parent's position.<br />
2004 /// Default is to inherit.<br />
2005 /// 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 />
2007 /// <since_tizen> 3 </since_tizen>
2008 public bool InheritPosition
2012 return (bool)GetValue(InheritPositionProperty);
2016 SetValue(InheritPositionProperty, value);
2017 NotifyPropertyChanged();
2022 /// Gets or sets the clipping behavior (mode) of it's children.
2024 /// <since_tizen> 3 </since_tizen>
2025 public ClippingModeType ClippingMode
2029 return (ClippingModeType)GetValue(ClippingModeProperty);
2033 SetValue(ClippingModeProperty, value);
2034 NotifyPropertyChanged();
2039 /// Gets the number of renderers held by the view.
2041 /// <since_tizen> 3 </since_tizen>
2042 public uint RendererCount
2046 return GetRendererCount();
2051 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2054 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2056 /// <since_tizen> 3 </since_tizen>
2057 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2059 "View view = new View(); " +
2060 "view.PivotPoint = PivotPoint.Center; " +
2061 "view.PositionUsesPivotPoint = true;")]
2062 [EditorBrowsable(EditorBrowsableState.Never)]
2063 public Position AnchorPoint
2067 Position temp = new Position(0.0f, 0.0f, 0.0f);
2068 var pValue = GetProperty(View.Property.AnchorPoint);
2071 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2077 var temp = new Tizen.NUI.PropertyValue(value);
2078 SetProperty(View.Property.AnchorPoint, temp);
2080 NotifyPropertyChanged();
2085 /// Sets the size of a view for the width, the height and the depth.<br />
2086 /// Geometry can be scaled to fit within this area.<br />
2087 /// This does not interfere with the view's scale factor.<br />
2088 /// The views default depth is the minimum of width and height.<br />
2092 /// Animatable - This property can be animated using <c>Animation</c> class.
2094 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2096 /// <since_tizen> 5 </since_tizen>
2101 Size tmp = (Size)GetValue(SizeProperty);
2102 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2106 SetValue(SizeProperty, value);
2107 NotifyPropertyChanged();
2112 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2114 /// <since_tizen> 3 </since_tizen>
2115 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2117 "Container parent = view.GetParent(); " +
2118 "View view = parent as View;")]
2119 [EditorBrowsable(EditorBrowsableState.Never)]
2120 public new View Parent
2125 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2126 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2127 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2129 if (basehandle is Layer layer)
2131 ret = new View(Layer.getCPtr(layer).Handle, false);
2132 NUILog.Error("This Parent property is deprecated, should do not be used");
2136 ret = basehandle as View;
2139 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2140 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2142 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2148 /// Gets/Sets whether inherit parent's the layout Direction.
2150 /// <since_tizen> 4 </since_tizen>
2151 public bool InheritLayoutDirection
2155 return (bool)GetValue(InheritLayoutDirectionProperty);
2159 SetValue(InheritLayoutDirectionProperty, value);
2160 NotifyPropertyChanged();
2165 /// Gets/Sets the layout Direction.
2167 /// <since_tizen> 4 </since_tizen>
2168 public ViewLayoutDirectionType LayoutDirection
2172 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2176 SetValue(LayoutDirectionProperty, value);
2177 NotifyPropertyChanged();
2178 layout?.RequestLayout();
2183 /// Gets or sets the Margin for use in layout.
2186 /// Margin property is supported by Layout algorithms and containers.
2187 /// Please Set Layout if you want to use Margin property.
2188 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2190 /// <since_tizen> 4 </since_tizen>
2191 public Extents Margin
2195 // If View has a Layout then margin is stored in Layout.
2198 return Layout.Margin;
2202 // If Layout not set then return margin stored in View.
2203 Extents temp = (Extents)GetValue(MarginProperty);
2204 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2206 // Two return points to prevent creating a zeroed Extent native object before assignment
2212 // Layout set so store Margin in LayoutItem instead of View.
2213 // If View stores the Margin too then the Legacy Size Negotiation will
2214 // overwrite the position and size values measured in the Layouting.
2215 Layout.Margin = value;
2216 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2217 layout?.RequestLayout();
2221 SetValue(MarginProperty, value);
2223 NotifyPropertyChanged();
2224 layout?.RequestLayout();
2229 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2231 /// <since_tizen> 6 </since_tizen>
2232 public int WidthSpecification
2240 if (value == widthPolicy)
2243 widthPolicy = value;
2244 if (widthPolicy >= 0)
2246 if (heightPolicy >= 0) // Policy an exact value
2248 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2249 Size2D = new Size2D(widthPolicy, heightPolicy);
2252 layout?.RequestLayout();
2257 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2259 /// <since_tizen> 6 </since_tizen>
2260 public int HeightSpecification
2264 return heightPolicy;
2268 if (value == heightPolicy)
2271 heightPolicy = value;
2272 if (heightPolicy >= 0)
2274 if (widthPolicy >= 0) // Policy an exact value
2276 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2277 Size2D = new Size2D(widthPolicy, heightPolicy);
2280 layout?.RequestLayout();
2285 /// Gets the List of transitions for this View.
2287 /// <since_tizen> 6 </since_tizen>
2288 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2292 if (layoutTransitions == null)
2294 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2296 return layoutTransitions;
2301 /// Set a layout transitions for this View.
2303 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2305 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2307 /// <since_tizen> 6 </since_tizen>
2308 public LayoutTransition LayoutTransition
2312 return layoutTransition;
2318 throw new global::System.ArgumentNullException(nameof(value));
2320 if (layoutTransitions == null)
2322 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2325 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2327 AttachTransitionsToChildren(value);
2329 layoutTransition = value;
2334 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2337 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2339 /// <since_tizen> 4 </since_tizen>
2340 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2341 [EditorBrowsable(EditorBrowsableState.Never)]
2342 public Extents PaddingEX
2346 Extents temp = new Extents(0, 0, 0, 0);
2347 var pValue = GetProperty(View.Property.PADDING);
2350 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2356 var temp = new Tizen.NUI.PropertyValue(value);
2357 SetProperty(View.Property.PADDING, temp);
2359 NotifyPropertyChanged();
2360 layout?.RequestLayout();
2365 /// The Color of View. This is an RGBA value.
2369 /// Animatable - This property can be animated using <c>Animation</c> class.
2371 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2373 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2374 [EditorBrowsable(EditorBrowsableState.Never)]
2379 Color temp = (Color)GetValue(ColorProperty);
2380 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2384 SetValue(ColorProperty, value);
2385 selectorData?.Color.UpdateIfNeeds(this, value);
2386 NotifyPropertyChanged();
2391 /// Set the layout on this View. Replaces any existing Layout.
2393 /// <since_tizen> 6 </since_tizen>
2394 public LayoutItem Layout
2402 // Do nothing if layout provided is already set on this View.
2403 if (value == layout)
2408 LayoutingDisabled = false;
2411 // If new layout being set already has a owner then that owner receives a replacement default layout.
2412 // First check if the layout to be set already has a owner.
2413 if (value?.Owner != null)
2415 // Previous owner of the layout gets a default layout as a replacement.
2416 value.Owner.Layout = new AbsoluteLayout();
2418 // Copy Margin and Padding to replacement LayoutGroup.
2419 if (value.Owner.Layout != null)
2421 value.Owner.Layout.Margin = value.Margin;
2422 value.Owner.Layout.Padding = value.Padding;
2426 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2427 // View if no replacement. Previously margin and padding values would have been moved from
2428 // the View to the layout.
2429 if (layout != null) // Existing layout
2433 // Existing layout being replaced so copy over margin and padding values.
2434 value.Margin = layout.Margin;
2435 value.Padding = layout.Padding;
2439 // Layout not being replaced so restore margin and padding to View.
2440 SetValue(MarginProperty, layout.Margin);
2441 SetValue(PaddingProperty, layout.Padding);
2442 NotifyPropertyChanged();
2447 // First Layout to be added to the View hence copy
2449 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2452 if (false == (this is TextLabel))
2454 if (Margin.Top != 0 || Margin.Bottom != 0 || Margin.Start != 0 || Margin.End != 0)
2456 // If View already has a margin set then store it in Layout instead.
2457 value.Margin = Margin;
2458 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2459 NotifyPropertyChanged();
2462 if (Padding.Top != 0 || Padding.Bottom != 0 || Padding.Start != 0 || Padding.End != 0)
2464 // If View already has a padding set then store it in Layout instead.
2465 value.Padding = Padding;
2466 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2467 NotifyPropertyChanged();
2474 // Remove existing layout from it's parent layout group.
2477 value.SetPositionByLayout = !excludeLayouting;
2479 // Set layout to this view
2485 /// The weight of the View, used to share available space in a layout with siblings.
2487 /// <since_tizen> 6 </since_tizen>
2497 layout?.RequestLayout();
2502 /// Whether to load the BackgroundImage synchronously.
2503 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2504 /// Note: For Normal Quad images only.
2506 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2507 [EditorBrowsable(EditorBrowsableState.Never)]
2508 public bool BackgroundImageSynchronosLoading
2512 return backgroundImageSynchronosLoading;
2516 backgroundImageSynchronosLoading = value;
2518 string bgUrl = null;
2519 var pValue = Background.Find(ImageVisualProperty.URL);
2520 pValue?.Get(out bgUrl);
2523 if (!string.IsNullOrEmpty(bgUrl))
2525 PropertyMap bgMap = this.Background;
2526 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2527 bgMap.Add("synchronousLoading", temp);
2534 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2535 [EditorBrowsable(EditorBrowsableState.Never)]
2536 public Vector2 UpdateSizeHint
2540 return (Vector2)GetValue(UpdateSizeHintProperty);
2544 SetValue(UpdateSizeHintProperty, value);
2545 NotifyPropertyChanged();
2550 /// Enable/Disable ControlState propagation for children.
2551 /// It is false by default.
2552 /// If the View needs to share ControlState with descendants, please set it true.
2553 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2555 [EditorBrowsable(EditorBrowsableState.Never)]
2556 public bool EnableControlStatePropagation
2558 get => controlStatePropagation;
2561 controlStatePropagation = value;
2563 foreach (View child in Children)
2565 child.EnableControlStatePropagation = value;
2571 /// If this property is set to true, the View can have a touch related ControlState (such as Pressed) when touch.
2572 /// By default, it is false in View, true in Control.
2573 /// Note that if the value is true, the View will be a touch receptor.
2575 [EditorBrowsable(EditorBrowsableState.Never)]
2576 public bool EnableControlState
2580 return (bool)GetValue(EnableControlStateProperty);
2584 SetValue(EnableControlStateProperty, value);
2589 /// Whether the actor grab all touches even if touch leaves its boundary.
2591 /// <returns>true, if it grab all touch after start</returns>
2592 [EditorBrowsable(EditorBrowsableState.Never)]
2593 public bool GrabTouchAfterLeave
2598 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2599 pValue.Get(out temp);
2605 var temp = new Tizen.NUI.PropertyValue(value);
2606 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2608 NotifyPropertyChanged();
2613 /// Determines which blend equation will be used to render renderers of this actor.
2615 /// <returns>blend equation enum currently assigned</returns>
2616 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2617 [EditorBrowsable(EditorBrowsableState.Never)]
2618 public BlendEquationType BlendEquation
2623 var pValue = GetProperty(View.Property.BlendEquation);
2624 pValue.Get(out temp);
2626 return (BlendEquationType)temp;
2630 var temp = new Tizen.NUI.PropertyValue((int)value);
2631 SetProperty(View.Property.BlendEquation, temp);
2633 NotifyPropertyChanged();
2638 /// If the value is true, the View will change its style as the theme changes.
2639 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2641 [EditorBrowsable(EditorBrowsableState.Never)]
2642 public bool ThemeChangeSensitive
2644 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2645 set => SetValue(ThemeChangeSensitiveProperty, value);
2649 /// Create Style, it is abstract function and must be override.
2651 [EditorBrowsable(EditorBrowsableState.Never)]
2652 protected virtual ViewStyle CreateViewStyle()
2654 return new ViewStyle();
2658 /// Called after the View's ControlStates changed.
2660 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2661 [EditorBrowsable(EditorBrowsableState.Never)]
2662 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2668 [EditorBrowsable(EditorBrowsableState.Never)]
2669 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2674 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2675 [EditorBrowsable(EditorBrowsableState.Never)]
2676 public virtual void ApplyStyle(ViewStyle viewStyle)
2678 if (null == viewStyle || this.viewStyle == viewStyle) return;
2680 this.viewStyle = viewStyle;
2682 Dictionary<string, BindableProperty> bindablePropertyOfView;
2683 Type viewType = GetType();
2685 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2686 Type styleType = viewStyle.GetType();
2688 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2689 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2691 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2693 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2695 BindableProperty viewProperty;
2696 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2698 if (null != viewProperty && viewProperty != StyleNameProperty)
2700 object value = viewStyle.GetValue(keyValuePair.Value);
2704 SetValue(viewProperty, value);
2712 /// Used to restore the transition.
2714 [EditorBrowsable(EditorBrowsableState.Never)]
2715 public IList<Transition> TransitionList
2718 } = new List<Transition>();
2721 /// Get whether the View is culled or not.
2722 /// True means that the View is out of the view frustum.
2725 /// Hidden-API (Inhouse-API).
2727 [EditorBrowsable(EditorBrowsableState.Never)]
2733 var pValue = GetProperty(View.Property.Culled);
2734 pValue.Get(out temp);