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 onWindowSendSignal = this.OnWindowSignal();
106 onWindowSendSignal?.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.
172 /// Note that the ControlState only available for the classes derived from Control.
173 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
174 /// please set <see cref="EnableControlState"/> to true.
176 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
177 [EditorBrowsable(EditorBrowsableState.Never)]
178 public ControlState ControlState
182 return controlStates;
186 if (controlStates == value)
191 var prevState = controlStates;
193 controlStates = value;
195 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
197 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
199 if (controlStatePropagation)
201 foreach (View child in Children)
203 child.ControlState = value;
207 OnControlStateChanged(changeInfo);
209 ControlStateChangedEvent?.Invoke(this, changeInfo);
213 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
214 [EditorBrowsable(EditorBrowsableState.Never)]
215 public bool ExcludeLayouting
219 return excludeLayouting;
223 excludeLayouting = value;
224 if (Layout != null && Layout.SetPositionByLayout == value)
226 Layout.SetPositionByLayout = !value;
227 Layout.RequestLayout();
232 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
233 [EditorBrowsable(EditorBrowsableState.Never)]
234 public bool IsResourcesCreated
238 return Application.Current.IsResourcesCreated;
242 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
243 [EditorBrowsable(EditorBrowsableState.Never)]
244 public ResourceDictionary XamlResources
248 return Application.Current.XamlResources;
252 Application.Current.XamlResources = value;
257 /// The StyleName, type string.
258 /// The value indicates DALi style name defined in json theme file.
260 /// <since_tizen> 3 </since_tizen>
261 public string StyleName
265 return (string)GetValue(StyleNameProperty);
269 SetValue(StyleNameProperty, value);
270 NotifyPropertyChanged();
275 /// The KeyInputFocus, type bool.
277 [EditorBrowsable(EditorBrowsableState.Never)]
278 public bool KeyInputFocus
282 return (bool)GetValue(KeyInputFocusProperty);
286 SetValue(KeyInputFocusProperty, value);
287 NotifyPropertyChanged();
292 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
296 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
299 /// Animatable - This property can be animated using <c>Animation</c> class.
301 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
305 /// <since_tizen> 3 </since_tizen>
306 public Color BackgroundColor
310 Color temp = (Color)GetValue(BackgroundColorProperty);
311 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
315 SetValue(BackgroundColorProperty, value);
316 if (selectorData != null)
318 selectorData.BackgroundImage?.Reset(this);
319 selectorData.BackgroundColor?.Reset(this);
321 NotifyPropertyChanged();
326 /// The mutually exclusive with "backgroundColor" and "background" type Map.
328 /// <since_tizen> 3 </since_tizen>
329 public string BackgroundImage
333 return (string)GetValue(BackgroundImageProperty);
337 SetValue(BackgroundImageProperty, value);
338 if (selectorData != null)
340 selectorData.BackgroundColor?.Reset(this);
341 selectorData.BackgroundImage?.Reset(this);
343 NotifyPropertyChanged();
348 /// Get or set the border of background image.
350 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
351 [EditorBrowsable(EditorBrowsableState.Never)]
352 public Rectangle BackgroundImageBorder
356 return (Rectangle)GetValue(BackgroundImageBorderProperty);
360 SetValue(BackgroundImageBorderProperty, value);
361 selectorData?.BackgroundImageBorder?.Reset(this);
362 NotifyPropertyChanged();
367 /// The background of view.
369 /// <since_tizen> 3 </since_tizen>
370 public Tizen.NUI.PropertyMap Background
374 return (PropertyMap)GetValue(BackgroundProperty);
378 SetValue(BackgroundProperty, value);
379 NotifyPropertyChanged();
384 /// Describes a shadow as an image for a View.
385 /// It is null by default.
388 /// Getter returns copied instance of current shadow.
391 /// The mutually exclusive with "BoxShadow".
395 /// Animatable - This property can be animated using <c>Animation</c> class.
396 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
398 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
400 /// Animatable sub-property : Offset.
403 [EditorBrowsable(EditorBrowsableState.Never)]
404 public ImageShadow ImageShadow
408 return (ImageShadow)GetValue(ImageShadowProperty);
412 SetValue(ImageShadowProperty, value);
413 if (selectorData != null)
415 selectorData.BoxShadow?.Reset(this);
416 selectorData.ImageShadow?.Reset(this);
418 NotifyPropertyChanged();
423 /// Describes a box shaped shadow drawing for a View.
424 /// It is null by default.
427 /// Gettter returns copied instance of current shadow.
430 /// The mutually exclusive with "ImageShadow".
434 /// Animatable - This property can be animated using <c>Animation</c> class.
435 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
437 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
439 /// Animatable sub-property : Offset, Color, BlurRadius.
442 [EditorBrowsable(EditorBrowsableState.Never)]
443 public Shadow BoxShadow
447 return (Shadow)GetValue(BoxShadowProperty);
451 SetValue(BoxShadowProperty, value);
452 if (selectorData != null)
454 selectorData.ImageShadow?.Reset(this);
455 selectorData.BoxShadow?.Reset(this);
457 NotifyPropertyChanged();
462 /// The radius for the rounded corners of the View.
463 /// This will rounds background and shadow edges.
464 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
468 /// Animatable - This property can be animated using <c>Animation</c> class.
471 [EditorBrowsable(EditorBrowsableState.Never)]
472 public float CornerRadius
476 return (float)GetValue(CornerRadiusProperty);
480 SetValue(CornerRadiusProperty, value);
481 NotifyPropertyChanged();
489 [EditorBrowsable(EditorBrowsableState.Never)]
490 protected bool IsHighlighted
494 return Accessibility.AccessibilityManager.Instance.GetCurrentFocusView() == this;
498 [EditorBrowsable(EditorBrowsableState.Never)]
499 protected static readonly string AccessibilityActivateAction = "activate";
500 [EditorBrowsable(EditorBrowsableState.Never)]
501 protected static readonly string AccessibilityReadingSkippedAction = "ReadingSkipped";
502 [EditorBrowsable(EditorBrowsableState.Never)]
503 protected static readonly string AccessibilityReadingCancelledAction = "ReadingCancelled";
504 [EditorBrowsable(EditorBrowsableState.Never)]
505 protected static readonly string AccessibilityReadingStoppedAction = "ReadingStopped";
506 [EditorBrowsable(EditorBrowsableState.Never)]
507 protected static readonly string AccessibilityReadingPausedAction = "ReadingPaused";
508 [EditorBrowsable(EditorBrowsableState.Never)]
509 protected static readonly string AccessibilityReadingResumedAction = "ReadingResumed";
511 [EditorBrowsable(EditorBrowsableState.Never)]
512 private static readonly string[] AccessibilityActions = {
513 AccessibilityActivateAction,
514 AccessibilityReadingSkippedAction,
515 AccessibilityReadingCancelledAction,
516 AccessibilityReadingStoppedAction,
517 AccessibilityReadingPausedAction,
518 AccessibilityReadingResumedAction,
521 [EditorBrowsable(EditorBrowsableState.Never)]
522 protected virtual string AccessibilityGetName()
527 [EditorBrowsable(EditorBrowsableState.Never)]
528 protected virtual string AccessibilityGetDescription()
533 [EditorBrowsable(EditorBrowsableState.Never)]
534 protected virtual bool AccessibilityDoAction(string name)
539 [EditorBrowsable(EditorBrowsableState.Never)]
540 protected virtual AccessibilityStates AccessibilityCalculateStates()
542 var states = new AccessibilityStates();
543 states.Set(AccessibilityState.Highlightable, this.AccessibilityHighlightable);
544 states.Set(AccessibilityState.Focusable, this.Focusable);
545 states.Set(AccessibilityState.Focused, this.State == States.Focused);
546 states.Set(AccessibilityState.Highlighted, this.IsHighlighted);
547 states.Set(AccessibilityState.Enabled, this.State != States.Disabled);
548 states.Set(AccessibilityState.Sensitive, this.Sensitive);
549 states.Set(AccessibilityState.Animated, this.AccessibilityAnimated);
550 states.Set(AccessibilityState.Visible, true);
551 states.Set(AccessibilityState.Showing, this.Visibility);
552 states.Set(AccessibilityState.Defunct, !this.IsOnWindow);
556 [EditorBrowsable(EditorBrowsableState.Never)]
557 protected virtual int AccessibilityGetActionCount()
559 return AccessibilityActions.Length;
562 [EditorBrowsable(EditorBrowsableState.Never)]
563 protected virtual string AccessibilityGetActionName(int index)
565 if (index >= 0 && index < AccessibilityActions.Length)
566 return AccessibilityActions[index];
571 [EditorBrowsable(EditorBrowsableState.Never)]
572 protected virtual bool AccessibilityShouldReportZeroChildren()
577 [EditorBrowsable(EditorBrowsableState.Never)]
578 protected virtual double AccessibilityGetMinimum()
583 [EditorBrowsable(EditorBrowsableState.Never)]
584 protected virtual double AccessibilityGetCurrent()
589 [EditorBrowsable(EditorBrowsableState.Never)]
590 protected virtual double AccessibilityGetMaximum()
595 [EditorBrowsable(EditorBrowsableState.Never)]
596 protected virtual bool AccessibilitySetCurrent(double value)
601 [EditorBrowsable(EditorBrowsableState.Never)]
602 protected virtual double AccessibilityGetMinimumIncrement()
607 [EditorBrowsable(EditorBrowsableState.Never)]
608 protected virtual bool AccessibilityIsScrollable()
613 [EditorBrowsable(EditorBrowsableState.Never)]
614 protected virtual string AccessibilityGetText(int startOffset, int endOffset)
619 [EditorBrowsable(EditorBrowsableState.Never)]
620 protected virtual int AccessibilityGetCharacterCount()
625 [EditorBrowsable(EditorBrowsableState.Never)]
626 protected virtual int AccessibilityGetCaretOffset()
631 [EditorBrowsable(EditorBrowsableState.Never)]
632 protected virtual bool AccessibilitySetCaretOffset(int offset)
637 [EditorBrowsable(EditorBrowsableState.Never)]
638 protected virtual AccessibilityRange AccessibilityGetTextAtOffset(int offset, TextBoundary boundary)
640 return new AccessibilityRange();
643 [EditorBrowsable(EditorBrowsableState.Never)]
644 protected virtual AccessibilityRange AccessibilityGetSelection(int selectionNum)
646 return new AccessibilityRange();
649 [EditorBrowsable(EditorBrowsableState.Never)]
650 protected virtual bool AccessibilityRemoveSelection(int selectionNum)
655 [EditorBrowsable(EditorBrowsableState.Never)]
656 protected virtual bool AccessibilitySetSelection(int selectionNum, int startOffset, int endOffset)
661 [EditorBrowsable(EditorBrowsableState.Never)]
662 protected virtual bool AccessibilityCopyText(int startPosition, int endPosition)
667 [EditorBrowsable(EditorBrowsableState.Never)]
668 protected virtual bool AccessibilityCutText(int startPosition, int endPosition)
674 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
675 /// It is absolute by default.
676 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
678 [EditorBrowsable(EditorBrowsableState.Never)]
679 public VisualTransformPolicyType CornerRadiusPolicy
681 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
682 set => SetValue(CornerRadiusPolicyProperty, value);
686 /// The current state of the view.
688 /// <since_tizen> 3 </since_tizen>
693 return (States)GetValue(StateProperty);
697 SetValue(StateProperty, value);
698 NotifyPropertyChanged();
703 /// The current sub state of the view.
705 /// <since_tizen> 3 </since_tizen>
706 public States SubState
710 return (States)GetValue(SubStateProperty);
714 SetValue(SubStateProperty, value);
715 NotifyPropertyChanged();
720 /// Displays a tooltip
722 /// <since_tizen> 3 </since_tizen>
723 public Tizen.NUI.PropertyMap Tooltip
727 return (PropertyMap)GetValue(TooltipProperty);
731 SetValue(TooltipProperty, value);
732 NotifyPropertyChanged();
737 /// Displays a tooltip as a text.
739 /// <since_tizen> 3 </since_tizen>
740 public string TooltipText
744 using (var propertyValue = GetProperty(Property.TOOLTIP))
746 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
748 return retrivedValue;
750 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
751 return "error to get TooltipText";
756 var temp = new Tizen.NUI.PropertyValue(value);
757 SetProperty(View.Property.TOOLTIP, temp);
759 NotifyPropertyChanged();
764 /// The Child property of FlexContainer.<br />
765 /// The proportion of the free space in the container, the flex item will receive.<br />
766 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
768 /// <since_tizen> 3 </since_tizen>
769 [Obsolete("Deprecated in API8, will be removed in API10.")]
774 return (float)GetValue(FlexProperty);
778 SetValue(FlexProperty, value);
779 NotifyPropertyChanged();
784 /// The Child property of FlexContainer.<br />
785 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
787 /// <since_tizen> 3 </since_tizen>
788 [Obsolete("Deprecated in API8, will be removed in API10.")]
793 return (int)GetValue(AlignSelfProperty);
797 SetValue(AlignSelfProperty, value);
798 NotifyPropertyChanged();
803 /// The Child property of FlexContainer.<br />
804 /// The space around the flex item.<br />
807 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
809 /// <since_tizen> 3 </since_tizen>
810 [Obsolete("Deprecated in API8, will be removed in API10.")]
811 public Vector4 FlexMargin
815 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
816 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
820 SetValue(FlexMarginProperty, value);
821 NotifyPropertyChanged();
826 /// The top-left cell this child occupies, if not set, the first available cell is used.
829 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
831 /// <since_tizen> 3 </since_tizen>
832 public Vector2 CellIndex
836 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
837 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
841 SetValue(CellIndexProperty, value);
842 NotifyPropertyChanged();
847 /// The number of rows this child occupies, if not set, the default value is 1.
849 /// <since_tizen> 3 </since_tizen>
854 return (float)GetValue(RowSpanProperty);
858 SetValue(RowSpanProperty, value);
859 NotifyPropertyChanged();
864 /// The number of columns this child occupies, if not set, the default value is 1.
866 /// <since_tizen> 3 </since_tizen>
867 public float ColumnSpan
871 return (float)GetValue(ColumnSpanProperty);
875 SetValue(ColumnSpanProperty, value);
876 NotifyPropertyChanged();
881 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
883 /// <since_tizen> 3 </since_tizen>
884 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
888 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
892 SetValue(CellHorizontalAlignmentProperty, value);
893 NotifyPropertyChanged();
898 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
900 /// <since_tizen> 3 </since_tizen>
901 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
905 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
909 SetValue(CellVerticalAlignmentProperty, value);
910 NotifyPropertyChanged();
915 /// The left focusable view.<br />
916 /// This will return null if not set.<br />
917 /// This will also return null if the specified left focusable view is not on a window.<br />
919 /// <since_tizen> 3 </since_tizen>
920 public View LeftFocusableView
922 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
925 return (View)GetValue(LeftFocusableViewProperty);
929 SetValue(LeftFocusableViewProperty, value);
930 NotifyPropertyChanged();
935 /// The right focusable view.<br />
936 /// This will return null if not set.<br />
937 /// This will also return null if the specified right focusable view is not on a window.<br />
939 /// <since_tizen> 3 </since_tizen>
940 public View RightFocusableView
942 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
945 return (View)GetValue(RightFocusableViewProperty);
949 SetValue(RightFocusableViewProperty, value);
950 NotifyPropertyChanged();
955 /// The up focusable view.<br />
956 /// This will return null if not set.<br />
957 /// This will also return null if the specified up focusable view is not on a window.<br />
959 /// <since_tizen> 3 </since_tizen>
960 public View UpFocusableView
962 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
965 return (View)GetValue(UpFocusableViewProperty);
969 SetValue(UpFocusableViewProperty, value);
970 NotifyPropertyChanged();
975 /// The down focusable view.<br />
976 /// This will return null if not set.<br />
977 /// This will also return null if the specified down focusable view is not on a window.<br />
979 /// <since_tizen> 3 </since_tizen>
980 public View DownFocusableView
982 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
985 return (View)GetValue(DownFocusableViewProperty);
989 SetValue(DownFocusableViewProperty, value);
990 NotifyPropertyChanged();
995 /// Whether the view should be focusable by keyboard navigation.
997 /// <since_tizen> 3 </since_tizen>
998 public bool Focusable
1002 SetValue(FocusableProperty, value);
1003 NotifyPropertyChanged();
1007 return (bool)GetValue(FocusableProperty);
1012 /// Retrieves the position of the view.<br />
1013 /// The coordinates are relative to the view's parent.<br />
1015 /// <since_tizen> 3 </since_tizen>
1016 public Position CurrentPosition
1020 return GetCurrentPosition();
1025 /// Sets the size of a view for the width and the height.<br />
1026 /// Geometry can be scaled to fit within this area.<br />
1027 /// This does not interfere with the view's scale factor.<br />
1028 /// The views default depth is the minimum of width and height.<br />
1031 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
1032 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
1034 /// <since_tizen> 3 </since_tizen>
1035 public Size2D Size2D
1039 Size2D temp = (Size2D)GetValue(Size2DProperty);
1040 int width = temp.Width;
1041 int height = temp.Height;
1043 if (this.Layout == null)
1045 if (width < 0) { width = 0; }
1046 if (height < 0) { height = 0; }
1049 return new Size2D(OnSize2DChanged, width, height);
1053 SetValue(Size2DProperty, value);
1055 NotifyPropertyChanged();
1060 /// Retrieves the size of the view.<br />
1061 /// The coordinates are relative to the view's parent.<br />
1063 /// <since_tizen> 3 </since_tizen>
1064 public Size2D CurrentSize
1068 return GetCurrentSize();
1073 /// Retrieves and sets the view's opacity.<br />
1075 /// <since_tizen> 3 </since_tizen>
1076 public float Opacity
1080 return (float)GetValue(OpacityProperty);
1084 SetValue(OpacityProperty, value);
1085 selectorData?.Opacity?.Reset(this);
1086 NotifyPropertyChanged();
1091 /// Sets the position of the view for X and Y.<br />
1092 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1093 /// If the position inheritance is disabled, sets the world position.<br />
1096 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1097 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1099 /// <since_tizen> 3 </since_tizen>
1100 public Position2D Position2D
1104 Position2D temp = (Position2D)GetValue(Position2DProperty);
1105 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1109 SetValue(Position2DProperty, value);
1110 NotifyPropertyChanged();
1115 /// Retrieves the screen postion of the view.<br />
1117 /// <since_tizen> 3 </since_tizen>
1118 public Vector2 ScreenPosition
1122 Vector2 temp = new Vector2(0.0f, 0.0f);
1123 var pValue = GetProperty(View.Property.ScreenPosition);
1131 /// Determines whether the pivot point should be used to determine the position of the view.
1132 /// This is false by default.
1134 /// <remarks>If false, then the top-left of the view is used for the position.
1135 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1137 /// <since_tizen> 3 </since_tizen>
1138 public bool PositionUsesPivotPoint
1142 return (bool)GetValue(PositionUsesPivotPointProperty);
1146 SetValue(PositionUsesPivotPointProperty, value);
1147 NotifyPropertyChanged();
1152 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1154 /// <since_tizen> 3 </since_tizen>
1155 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1157 "View view = new View(); " +
1158 "view.PivotPoint = PivotPoint.Center; " +
1159 "view.PositionUsesPivotPoint = true;" +
1160 " Deprecated in API5: Will be removed in API8")]
1161 [EditorBrowsable(EditorBrowsableState.Never)]
1162 public bool PositionUsesAnchorPoint
1167 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1168 pValue.Get(out temp);
1174 var temp = new Tizen.NUI.PropertyValue(value);
1175 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1177 NotifyPropertyChanged();
1182 /// Queries whether the view is connected to the stage.<br />
1183 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1185 /// <since_tizen> 3 </since_tizen>
1186 public bool IsOnWindow
1195 /// Gets the depth in the hierarchy for the view.
1197 /// <since_tizen> 3 </since_tizen>
1198 public int HierarchyDepth
1202 return GetHierarchyDepth();
1207 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1210 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1211 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1212 /// The values set by this property will likely change.
1214 /// <since_tizen> 3 </since_tizen>
1215 public int SiblingOrder
1219 return (int)GetValue(SiblingOrderProperty);
1223 SetValue(SiblingOrderProperty, value);
1225 LayoutGroup layout = Layout as LayoutGroup;
1226 layout?.ChangeLayoutSiblingOrder(value);
1228 NotifyPropertyChanged();
1233 /// Returns the natural size of the view.
1236 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1238 /// <since_tizen> 5 </since_tizen>
1239 public Vector3 NaturalSize
1243 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1250 /// Returns the natural size (Size2D) of the view.
1253 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1255 /// <since_tizen> 4 </since_tizen>
1256 public Size2D NaturalSize2D
1260 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1261 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1263 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1270 /// Gets or sets the origin of a view within its parent's area.<br />
1271 /// 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 />
1272 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1273 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1275 /// <pre>The view has been initialized.</pre>
1276 /// <since_tizen> 3 </since_tizen>
1277 public Position ParentOrigin
1281 Position tmp = (Position)GetValue(ParentOriginProperty);
1282 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1286 SetValue(ParentOriginProperty, value);
1287 NotifyPropertyChanged();
1292 /// Gets or sets the anchor-point of a view.<br />
1293 /// 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 />
1294 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1295 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1296 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1297 /// <pre>The view has been initialized.</pre>
1300 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1302 /// <since_tizen> 3 </since_tizen>
1303 public Position PivotPoint
1307 Position tmp = (Position)GetValue(PivotPointProperty);
1308 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1312 SetValue(PivotPointProperty, value);
1313 NotifyPropertyChanged();
1318 /// Gets or sets the size width of the view.
1322 /// Animatable - This property can be animated using <c>Animation</c> class.
1325 /// <since_tizen> 3 </since_tizen>
1326 public float SizeWidth
1330 return (float)GetValue(SizeWidthProperty);
1334 SetValue(SizeWidthProperty, value);
1335 NotifyPropertyChanged();
1340 /// Gets or sets the size height of the view.
1344 /// Animatable - This property can be animated using <c>Animation</c> class.
1347 /// <since_tizen> 3 </since_tizen>
1348 public float SizeHeight
1352 return (float)GetValue(SizeHeightProperty);
1356 SetValue(SizeHeightProperty, value);
1357 NotifyPropertyChanged();
1362 /// Gets or sets the position of the view.<br />
1363 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1364 /// If the position inheritance is disabled, sets the world position.<br />
1368 /// Animatable - This property can be animated using <c>Animation</c> class.
1370 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1372 /// <since_tizen> 3 </since_tizen>
1373 public Position Position
1377 Position tmp = (Position)GetValue(PositionProperty);
1378 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1382 SetValue(PositionProperty, value);
1383 NotifyPropertyChanged();
1388 /// Gets or sets the position X of the view.
1392 /// Animatable - This property can be animated using <c>Animation</c> class.
1395 /// <since_tizen> 3 </since_tizen>
1396 public float PositionX
1400 return (float)GetValue(PositionXProperty);
1404 SetValue(PositionXProperty, value);
1405 NotifyPropertyChanged();
1410 /// Gets or sets the position Y of the view.
1414 /// Animatable - This property can be animated using <c>Animation</c> class.
1417 /// <since_tizen> 3 </since_tizen>
1418 public float PositionY
1422 return (float)GetValue(PositionYProperty);
1426 SetValue(PositionYProperty, value);
1427 NotifyPropertyChanged();
1432 /// Gets or sets the position Z of the view.
1436 /// Animatable - This property can be animated using <c>Animation</c> class.
1439 /// <since_tizen> 3 </since_tizen>
1440 public float PositionZ
1444 return (float)GetValue(PositionZProperty);
1448 SetValue(PositionZProperty, value);
1449 NotifyPropertyChanged();
1454 /// Gets or sets the world position of the view.
1456 /// <since_tizen> 3 </since_tizen>
1457 public Vector3 WorldPosition
1461 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1462 var pValue = GetProperty(View.Property.WorldPosition);
1470 /// Gets or sets the orientation of the view.<br />
1471 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1475 /// This is an asynchronous method.
1478 /// Animatable - This property can be animated using <c>Animation</c> class.
1481 /// <since_tizen> 3 </since_tizen>
1482 public Rotation Orientation
1486 return (Rotation)GetValue(OrientationProperty);
1490 SetValue(OrientationProperty, value);
1491 NotifyPropertyChanged();
1496 /// Gets or sets the world orientation of the view.<br />
1498 /// <since_tizen> 3 </since_tizen>
1499 public Rotation WorldOrientation
1503 Rotation temp = new Rotation();
1504 var pValue = GetProperty(View.Property.WorldOrientation);
1512 /// Gets or sets the scale factor applied to the view.<br />
1516 /// Animatable - This property can be animated using <c>Animation</c> class.
1518 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1520 /// <since_tizen> 3 </since_tizen>
1521 public Vector3 Scale
1525 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1526 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1530 SetValue(ScaleProperty, value);
1531 NotifyPropertyChanged();
1536 /// Gets or sets the scale X factor applied to the view.
1540 /// Animatable - This property can be animated using <c>Animation</c> class.
1543 /// <since_tizen> 3 </since_tizen>
1548 return (float)GetValue(ScaleXProperty);
1552 SetValue(ScaleXProperty, value);
1553 NotifyPropertyChanged();
1558 /// Gets or sets the scale Y factor applied to the view.
1562 /// Animatable - This property can be animated using <c>Animation</c> class.
1565 /// <since_tizen> 3 </since_tizen>
1570 return (float)GetValue(ScaleYProperty);
1574 SetValue(ScaleYProperty, value);
1575 NotifyPropertyChanged();
1580 /// Gets or sets the scale Z factor applied to the view.
1584 /// Animatable - This property can be animated using <c>Animation</c> class.
1587 /// <since_tizen> 3 </since_tizen>
1592 return (float)GetValue(ScaleZProperty);
1596 SetValue(ScaleZProperty, value);
1597 NotifyPropertyChanged();
1602 /// Gets the world scale of the view.
1604 /// <since_tizen> 3 </since_tizen>
1605 public Vector3 WorldScale
1609 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1610 var pValue = GetProperty(View.Property.WorldScale);
1618 /// Retrieves the visibility flag of the view.
1622 /// If the view is not visible, then the view and its children will not be rendered.
1623 /// 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.
1626 /// Animatable - This property can be animated using <c>Animation</c> class.
1629 /// <since_tizen> 3 </since_tizen>
1630 public bool Visibility
1635 var pValue = GetProperty(View.Property.VISIBLE);
1636 pValue.Get(out temp);
1643 /// Gets the view's world color.
1645 /// <since_tizen> 3 </since_tizen>
1646 public Vector4 WorldColor
1650 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1651 var pValue = GetProperty(View.Property.WorldColor);
1659 /// Gets or sets the view's name.
1661 /// <since_tizen> 3 </since_tizen>
1666 return (string)GetValue(NameProperty);
1670 SetValue(NameProperty, value);
1671 NotifyPropertyChanged();
1676 /// Get the number of children held by the view.
1678 /// <since_tizen> 3 </since_tizen>
1679 public new uint ChildCount
1683 return Convert.ToUInt32(Children.Count);
1688 /// Gets the view's ID.
1691 /// <since_tizen> 3 </since_tizen>
1701 /// Gets or sets the status of whether the view should emit touch or hover signals.
1703 /// <since_tizen> 3 </since_tizen>
1704 public bool Sensitive
1708 return (bool)GetValue(SensitiveProperty);
1712 SetValue(SensitiveProperty, value);
1713 NotifyPropertyChanged();
1718 /// 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.
1720 /// <since_tizen> 3 </since_tizen>
1721 public bool LeaveRequired
1725 return (bool)GetValue(LeaveRequiredProperty);
1729 SetValue(LeaveRequiredProperty, value);
1730 NotifyPropertyChanged();
1735 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1737 /// <since_tizen> 3 </since_tizen>
1738 public bool InheritOrientation
1742 return (bool)GetValue(InheritOrientationProperty);
1746 SetValue(InheritOrientationProperty, value);
1747 NotifyPropertyChanged();
1752 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1754 /// <since_tizen> 3 </since_tizen>
1755 public bool InheritScale
1759 return (bool)GetValue(InheritScaleProperty);
1763 SetValue(InheritScaleProperty, value);
1764 NotifyPropertyChanged();
1769 /// Gets or sets the status of how the view and its children should be drawn.<br />
1770 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1771 /// 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 />
1772 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1773 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1774 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1776 /// <since_tizen> 3 </since_tizen>
1777 public DrawModeType DrawMode
1781 return (DrawModeType)GetValue(DrawModeProperty);
1785 SetValue(DrawModeProperty, value);
1786 NotifyPropertyChanged();
1791 /// Gets or sets the relative to parent size factor of the view.<br />
1792 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1793 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1796 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1798 /// <since_tizen> 3 </since_tizen>
1799 public Vector3 SizeModeFactor
1803 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1804 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1808 SetValue(SizeModeFactorProperty, value);
1809 NotifyPropertyChanged();
1814 /// Gets or sets the width resize policy to be used.
1816 /// <since_tizen> 3 </since_tizen>
1817 public ResizePolicyType WidthResizePolicy
1821 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1825 SetValue(WidthResizePolicyProperty, value);
1826 NotifyPropertyChanged();
1831 /// Gets or sets the height resize policy to be used.
1833 /// <since_tizen> 3 </since_tizen>
1834 public ResizePolicyType HeightResizePolicy
1838 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1842 SetValue(HeightResizePolicyProperty, value);
1843 NotifyPropertyChanged();
1848 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1849 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1851 /// <since_tizen> 3 </since_tizen>
1852 public SizeScalePolicyType SizeScalePolicy
1856 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1860 SetValue(SizeScalePolicyProperty, value);
1861 NotifyPropertyChanged();
1866 /// Gets or sets the status of whether the width size is dependent on the height size.
1868 /// <since_tizen> 3 </since_tizen>
1869 public bool WidthForHeight
1873 return (bool)GetValue(WidthForHeightProperty);
1877 SetValue(WidthForHeightProperty, value);
1878 NotifyPropertyChanged();
1883 /// Gets or sets the status of whether the height size is dependent on the width size.
1885 /// <since_tizen> 3 </since_tizen>
1886 public bool HeightForWidth
1890 return (bool)GetValue(HeightForWidthProperty);
1894 SetValue(HeightForWidthProperty, value);
1895 NotifyPropertyChanged();
1900 /// Gets or sets the padding for use in layout.
1903 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1905 /// <since_tizen> 5 </since_tizen>
1906 public Extents Padding
1910 // If View has a Layout then padding in stored in the base Layout class
1913 return Layout.Padding;
1917 Extents temp = (Extents)GetValue(PaddingProperty);
1918 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1920 // Two return points to prevent creating a zeroed Extent native object before assignment
1924 Extents padding = value;
1927 // Layout set so store Padding in LayoutItem instead of in View.
1928 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1929 // the position and sizes measure in the Layouting.
1930 Layout.Padding = value;
1931 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1932 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1933 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1935 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1939 SetValue(PaddingProperty, padding);
1940 NotifyPropertyChanged();
1945 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1947 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1949 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1951 /// <since_tizen> 3 </since_tizen>
1952 public Size2D MinimumSize
1956 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1957 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1963 throw new ArgumentNullException(nameof(value));
1967 // Note: it only works if minimum size is >= than natural size.
1968 // To force the size it should be done through the width&height spec or Size2D.
1969 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1970 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1971 layout.RequestLayout();
1973 SetValue(MinimumSizeProperty, value);
1974 NotifyPropertyChanged();
1979 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1982 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1984 /// <since_tizen> 3 </since_tizen>
1985 public Size2D MaximumSize
1989 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1990 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1994 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1995 // MATCH_PARENT spec + parent container size can be used to limit
1998 layout.RequestLayout();
2000 SetValue(MaximumSizeProperty, value);
2001 NotifyPropertyChanged();
2006 /// Gets or sets whether a child view inherits it's parent's position.<br />
2007 /// Default is to inherit.<br />
2008 /// 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 />
2010 /// <since_tizen> 3 </since_tizen>
2011 public bool InheritPosition
2015 return (bool)GetValue(InheritPositionProperty);
2019 SetValue(InheritPositionProperty, value);
2020 NotifyPropertyChanged();
2025 /// Gets or sets the clipping behavior (mode) of it's children.
2027 /// <since_tizen> 3 </since_tizen>
2028 public ClippingModeType ClippingMode
2032 return (ClippingModeType)GetValue(ClippingModeProperty);
2036 SetValue(ClippingModeProperty, value);
2037 NotifyPropertyChanged();
2042 /// Gets the number of renderers held by the view.
2044 /// <since_tizen> 3 </since_tizen>
2045 public uint RendererCount
2049 return GetRendererCount();
2054 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2057 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2059 /// <since_tizen> 3 </since_tizen>
2060 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2062 "View view = new View(); " +
2063 "view.PivotPoint = PivotPoint.Center; " +
2064 "view.PositionUsesPivotPoint = true;")]
2065 [EditorBrowsable(EditorBrowsableState.Never)]
2066 public Position AnchorPoint
2070 Position temp = new Position(0.0f, 0.0f, 0.0f);
2071 var pValue = GetProperty(View.Property.AnchorPoint);
2074 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2080 var temp = new Tizen.NUI.PropertyValue(value);
2081 SetProperty(View.Property.AnchorPoint, temp);
2083 NotifyPropertyChanged();
2088 /// Sets the size of a view for the width, the height and the depth.<br />
2089 /// Geometry can be scaled to fit within this area.<br />
2090 /// This does not interfere with the view's scale factor.<br />
2091 /// The views default depth is the minimum of width and height.<br />
2095 /// Animatable - This property can be animated using <c>Animation</c> class.
2097 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2099 /// <since_tizen> 5 </since_tizen>
2104 Size tmp = (Size)GetValue(SizeProperty);
2105 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2109 SetValue(SizeProperty, value);
2110 NotifyPropertyChanged();
2115 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2117 /// <since_tizen> 3 </since_tizen>
2118 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2120 "Container parent = view.GetParent(); " +
2121 "View view = parent as View;")]
2122 [EditorBrowsable(EditorBrowsableState.Never)]
2123 public new View Parent
2128 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2129 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2130 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2132 if (basehandle is Layer layer)
2134 ret = new View(Layer.getCPtr(layer).Handle, false);
2135 NUILog.Error("This Parent property is deprecated, should do not be used");
2139 ret = basehandle as View;
2142 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2143 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2145 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2151 /// Gets/Sets whether inherit parent's the layout Direction.
2153 /// <since_tizen> 4 </since_tizen>
2154 public bool InheritLayoutDirection
2158 return (bool)GetValue(InheritLayoutDirectionProperty);
2162 SetValue(InheritLayoutDirectionProperty, value);
2163 NotifyPropertyChanged();
2168 /// Gets/Sets the layout Direction.
2170 /// <since_tizen> 4 </since_tizen>
2171 public ViewLayoutDirectionType LayoutDirection
2175 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2179 SetValue(LayoutDirectionProperty, value);
2180 NotifyPropertyChanged();
2181 layout?.RequestLayout();
2186 /// Gets or sets the Margin for use in layout.
2189 /// Margin property is supported by Layout algorithms and containers.
2190 /// Please Set Layout if you want to use Margin property.
2191 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2193 /// <since_tizen> 4 </since_tizen>
2194 public Extents Margin
2198 // If View has a Layout then margin is stored in Layout.
2201 return Layout.Margin;
2205 // If Layout not set then return margin stored in View.
2206 Extents temp = (Extents)GetValue(MarginProperty);
2207 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2209 // Two return points to prevent creating a zeroed Extent native object before assignment
2215 // Layout set so store Margin in LayoutItem instead of View.
2216 // If View stores the Margin too then the Legacy Size Negotiation will
2217 // overwrite the position and size values measured in the Layouting.
2218 Layout.Margin = value;
2219 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2220 layout?.RequestLayout();
2224 SetValue(MarginProperty, value);
2226 NotifyPropertyChanged();
2227 layout?.RequestLayout();
2232 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2234 /// <since_tizen> 6 </since_tizen>
2235 public int WidthSpecification
2243 if (value == widthPolicy)
2246 widthPolicy = value;
2247 if (widthPolicy >= 0)
2249 if (heightPolicy >= 0) // Policy an exact value
2251 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2252 Size2D = new Size2D(widthPolicy, heightPolicy);
2255 layout?.RequestLayout();
2260 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2262 /// <since_tizen> 6 </since_tizen>
2263 public int HeightSpecification
2267 return heightPolicy;
2271 if (value == heightPolicy)
2274 heightPolicy = value;
2275 if (heightPolicy >= 0)
2277 if (widthPolicy >= 0) // Policy an exact value
2279 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2280 Size2D = new Size2D(widthPolicy, heightPolicy);
2283 layout?.RequestLayout();
2288 /// Gets the List of transitions for this View.
2290 /// <since_tizen> 6 </since_tizen>
2291 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2295 if (layoutTransitions == null)
2297 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2299 return layoutTransitions;
2304 /// Set a layout transitions for this View.
2306 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2308 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2310 /// <since_tizen> 6 </since_tizen>
2311 public LayoutTransition LayoutTransition
2315 return layoutTransition;
2321 throw new global::System.ArgumentNullException(nameof(value));
2323 if (layoutTransitions == null)
2325 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2328 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2330 AttachTransitionsToChildren(value);
2332 layoutTransition = value;
2337 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2340 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2342 /// <since_tizen> 4 </since_tizen>
2343 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2344 [EditorBrowsable(EditorBrowsableState.Never)]
2345 public Extents PaddingEX
2349 Extents temp = new Extents(0, 0, 0, 0);
2350 var pValue = GetProperty(View.Property.PADDING);
2353 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2359 var temp = new Tizen.NUI.PropertyValue(value);
2360 SetProperty(View.Property.PADDING, temp);
2362 NotifyPropertyChanged();
2363 layout?.RequestLayout();
2368 /// The Color of View. This is an RGBA value.
2372 /// Animatable - This property can be animated using <c>Animation</c> class.
2374 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2376 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2377 [EditorBrowsable(EditorBrowsableState.Never)]
2382 Color temp = (Color)GetValue(ColorProperty);
2383 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2387 SetValue(ColorProperty, value);
2388 selectorData?.Color?.Reset(this);
2389 NotifyPropertyChanged();
2394 /// Set the layout on this View. Replaces any existing Layout.
2396 /// <since_tizen> 6 </since_tizen>
2397 public LayoutItem Layout
2405 // Do nothing if layout provided is already set on this View.
2406 if (value == layout)
2411 LayoutingDisabled = false;
2414 // If new layout being set already has a owner then that owner receives a replacement default layout.
2415 // First check if the layout to be set already has a owner.
2416 if (value?.Owner != null)
2418 // Previous owner of the layout gets a default layout as a replacement.
2419 value.Owner.Layout = new AbsoluteLayout();
2421 // Copy Margin and Padding to replacement LayoutGroup.
2422 if (value.Owner.Layout != null)
2424 value.Owner.Layout.Margin = value.Margin;
2425 value.Owner.Layout.Padding = value.Padding;
2429 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2430 // View if no replacement. Previously margin and padding values would have been moved from
2431 // the View to the layout.
2432 if (layout != null) // Existing layout
2436 // Existing layout being replaced so copy over margin and padding values.
2437 value.Margin = layout.Margin;
2438 value.Padding = layout.Padding;
2442 // Layout not being replaced so restore margin and padding to View.
2443 SetValue(MarginProperty, layout.Margin);
2444 SetValue(PaddingProperty, layout.Padding);
2445 NotifyPropertyChanged();
2450 // First Layout to be added to the View hence copy
2452 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2455 if (false == (this is TextLabel))
2457 if (Margin.Top != 0 || Margin.Bottom != 0 || Margin.Start != 0 || Margin.End != 0)
2459 // If View already has a margin set then store it in Layout instead.
2460 value.Margin = Margin;
2461 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2462 NotifyPropertyChanged();
2465 if (Padding.Top != 0 || Padding.Bottom != 0 || Padding.Start != 0 || Padding.End != 0)
2467 // If View already has a padding set then store it in Layout instead.
2468 value.Padding = Padding;
2469 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2470 NotifyPropertyChanged();
2477 // Remove existing layout from it's parent layout group.
2480 value.SetPositionByLayout = !excludeLayouting;
2482 // Set layout to this view
2488 /// The weight of the View, used to share available space in a layout with siblings.
2490 /// <since_tizen> 6 </since_tizen>
2500 layout?.RequestLayout();
2505 /// Whether to load the BackgroundImage synchronously.
2506 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2507 /// Note: For Normal Quad images only.
2509 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2510 [EditorBrowsable(EditorBrowsableState.Never)]
2511 public bool BackgroundImageSynchronosLoading
2515 return backgroundImageSynchronosLoading;
2519 backgroundImageSynchronosLoading = value;
2521 string bgUrl = null;
2522 var pValue = Background.Find(ImageVisualProperty.URL);
2523 pValue?.Get(out bgUrl);
2526 if (!string.IsNullOrEmpty(bgUrl))
2528 PropertyMap bgMap = this.Background;
2529 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2530 bgMap.Add("synchronousLoading", temp);
2537 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2538 [EditorBrowsable(EditorBrowsableState.Never)]
2539 public Vector2 UpdateSizeHint
2543 return (Vector2)GetValue(UpdateSizeHintProperty);
2547 SetValue(UpdateSizeHintProperty, value);
2548 NotifyPropertyChanged();
2553 /// Enable/Disable ControlState propagation for children.
2554 /// It is false by default.
2555 /// If the View needs to share ControlState with descendants, please set it true.
2556 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2558 [EditorBrowsable(EditorBrowsableState.Never)]
2559 public bool EnableControlStatePropagation
2561 get => controlStatePropagation;
2564 controlStatePropagation = value;
2566 foreach (View child in Children)
2568 child.EnableControlStatePropagation = value;
2574 /// By default, it is false in View, true in Control.
2575 /// Note that if the value is true, the View will be a touch receptor.
2577 [EditorBrowsable(EditorBrowsableState.Never)]
2578 public bool EnableControlState
2582 return (bool)GetValue(EnableControlStateProperty);
2586 SetValue(EnableControlStateProperty, value);
2591 /// Whether the actor grab all touches even if touch leaves its boundary.
2593 /// <returns>true, if it grab all touch after start</returns>
2594 [EditorBrowsable(EditorBrowsableState.Never)]
2595 public bool GrabTouchAfterLeave
2600 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2601 pValue.Get(out temp);
2607 var temp = new Tizen.NUI.PropertyValue(value);
2608 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2610 NotifyPropertyChanged();
2615 /// Determines which blend equation will be used to render renderers of this actor.
2617 /// <returns>blend equation enum currently assigned</returns>
2618 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2619 [EditorBrowsable(EditorBrowsableState.Never)]
2620 public BlendEquationType BlendEquation
2625 var pValue = GetProperty(View.Property.BlendEquation);
2626 pValue.Get(out temp);
2628 return (BlendEquationType)temp;
2632 var temp = new Tizen.NUI.PropertyValue((int)value);
2633 SetProperty(View.Property.BlendEquation, temp);
2635 NotifyPropertyChanged();
2640 /// If the value is true, the View will change its style as the theme changes.
2641 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2643 [EditorBrowsable(EditorBrowsableState.Never)]
2644 public bool ThemeChangeSensitive
2646 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2647 set => SetValue(ThemeChangeSensitiveProperty, value);
2651 /// Create Style, it is abstract function and must be override.
2653 [EditorBrowsable(EditorBrowsableState.Never)]
2654 protected virtual ViewStyle CreateViewStyle()
2656 return new ViewStyle();
2660 /// Called after the View's ControlStates changed.
2662 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2663 [EditorBrowsable(EditorBrowsableState.Never)]
2664 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2670 [EditorBrowsable(EditorBrowsableState.Never)]
2671 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2676 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2677 [EditorBrowsable(EditorBrowsableState.Never)]
2678 public virtual void ApplyStyle(ViewStyle viewStyle)
2680 if (null == viewStyle || this.viewStyle == viewStyle) return;
2682 this.viewStyle = viewStyle;
2684 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2690 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2692 if (bindablePropertyOfView == null)
2697 var dirtyProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2698 viewStyle.DirtyProperties.CopyTo(dirtyProperties);
2700 foreach (var sourceProperty in dirtyProperties)
2702 var sourceValue = viewStyle.GetValue(sourceProperty);
2704 if (sourceValue == null)
2709 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2711 if (destinationProperty != null)
2713 SetValue(destinationProperty, sourceValue);
2719 /// Used to restore the transition.
2721 [EditorBrowsable(EditorBrowsableState.Never)]
2722 public IList<Transition> TransitionList
2725 } = new List<Transition>();
2728 /// Get whether the View is culled or not.
2729 /// True means that the View is out of the view frustum.
2732 /// Hidden-API (Inhouse-API).
2734 [EditorBrowsable(EditorBrowsableState.Never)]
2740 var pValue = GetProperty(View.Property.Culled);
2741 pValue.Get(out temp);