2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.Binding;
22 using Tizen.NUI.Components;
24 namespace Tizen.NUI.BaseComponents
27 /// View is the base class for all views.
29 /// <since_tizen> 3 </since_tizen>
30 public partial class View : Container, IResourcesProvider
32 internal BackgroundExtraData backgroundExtraData;
34 private bool layoutSet = false;
35 private LayoutItem layout; // Exclusive layout assigned to this View.
37 // List of transitions paired with the condition that uses the transition.
38 private Dictionary<TransitionCondition, TransitionList> layoutTransitions;
39 private int widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
40 private int heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
41 private float weight = 0.0f; // Weighting of child View in a Layout
42 private bool backgroundImageSynchronosLoading = false;
43 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
44 private bool controlStatePropagation = false;
45 private ViewStyle viewStyle;
46 private bool themeChangeSensitive = false;
47 private bool excludeLayouting = false;
48 private LayoutTransition layoutTransition;
50 private ControlState controlStates = ControlState.Normal;
55 /// Creates a new instance of a view.
57 /// <since_tizen> 3 </since_tizen>
58 public View() : this(Interop.View.New(), true)
60 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
63 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
64 [EditorBrowsable(EditorBrowsableState.Never)]
65 public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle)
70 /// Create a new instance of a View with setting the status of shown or hidden.
72 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
73 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
74 [EditorBrowsable(EditorBrowsableState.Never)]
75 public View(bool shown) : this(Interop.View.New(), true)
77 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
81 internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true)
83 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
89 backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData);
92 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
94 InitializeStyle(viewStyle);
97 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn)
101 PositionUsesPivotPoint = false;
104 onWindowSendEventCallback = SendViewAddedEventToWindow;
105 this.OnWindowSignal().Connect(onWindowSendEventCallback);
113 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true)
115 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124 /// The event that is triggered when the View's ControlState is changed.
126 [EditorBrowsable(EditorBrowsableState.Never)]
127 public event EventHandler<ControlStateChangedEventArgs> ControlStateChangedEvent;
129 internal event EventHandler<ControlStateChangedEventArgs> ControlStateChangeEventInternal;
133 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
135 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
136 [EditorBrowsable(EditorBrowsableState.Never)]
137 public bool LayoutSet
146 /// Flag to allow Layouting to be disabled for Views.
147 /// Once a View has a Layout set then any children added to Views from then on will receive
148 /// automatic Layouts.
150 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
151 [EditorBrowsable(EditorBrowsableState.Never)]
152 public static bool LayoutingDisabled { get; set; } = true;
155 /// The style instance applied to this view.
156 /// Note that please do not modify the ViewStyle.
157 /// Modifying ViewStyle will affect other views with same ViewStyle.
159 [EditorBrowsable(EditorBrowsableState.Never)]
160 protected ViewStyle ViewStyle
164 if (null == viewStyle)
166 ApplyStyle(CreateViewStyle());
174 /// Get/Set the control state.
175 /// Note that the ControlState only available for the classes derived from Control.
176 /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system,
177 /// please set <see cref="EnableControlState"/> to true.
179 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
180 [EditorBrowsable(EditorBrowsableState.Never)]
181 public ControlState ControlState
185 return controlStates;
189 if (controlStates == value)
194 var prevState = controlStates;
196 controlStates = value;
198 var changeInfo = new ControlStateChangedEventArgs(prevState, value);
200 ControlStateChangeEventInternal?.Invoke(this, changeInfo);
202 if (controlStatePropagation)
204 foreach (View child in Children)
206 child.ControlState = value;
210 OnControlStateChanged(changeInfo);
212 ControlStateChangedEvent?.Invoke(this, changeInfo);
216 /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
217 [EditorBrowsable(EditorBrowsableState.Never)]
218 public bool ExcludeLayouting
222 return excludeLayouting;
226 excludeLayouting = value;
227 if (Layout != null && Layout.SetPositionByLayout == value)
229 Layout.SetPositionByLayout = !value;
230 Layout.RequestLayout();
235 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
236 [EditorBrowsable(EditorBrowsableState.Never)]
237 public bool IsResourcesCreated
241 return Application.Current.IsResourcesCreated;
245 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
246 [EditorBrowsable(EditorBrowsableState.Never)]
247 public ResourceDictionary XamlResources
251 return Application.Current.XamlResources;
255 Application.Current.XamlResources = value;
260 /// The StyleName, type string.
261 /// The value indicates DALi style name defined in json theme file.
263 /// <since_tizen> 3 </since_tizen>
264 public string StyleName
268 return (string)GetValue(StyleNameProperty);
272 SetValue(StyleNameProperty, value);
273 NotifyPropertyChanged();
278 /// The KeyInputFocus, type bool.
280 [EditorBrowsable(EditorBrowsableState.Never)]
281 public bool KeyInputFocus
285 return (bool)GetValue(KeyInputFocusProperty);
289 SetValue(KeyInputFocusProperty, value);
290 NotifyPropertyChanged();
295 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
299 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
302 /// Animatable - This property can be animated using <c>Animation</c> class.
304 /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a));
308 /// <since_tizen> 3 </since_tizen>
309 public Color BackgroundColor
313 Color temp = (Color)GetValue(BackgroundColorProperty);
314 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
318 SetValue(BackgroundColorProperty, value);
319 if (selectorData != null)
321 selectorData.BackgroundImage?.Reset(this);
322 selectorData.BackgroundColor?.Reset(this);
324 NotifyPropertyChanged();
329 /// The mutually exclusive with "backgroundColor" and "background" type Map.
331 /// <since_tizen> 3 </since_tizen>
332 public string BackgroundImage
336 return (string)GetValue(BackgroundImageProperty);
340 SetValue(BackgroundImageProperty, value);
341 if (selectorData != null)
343 selectorData.BackgroundColor?.Reset(this);
344 selectorData.BackgroundImage?.Reset(this);
346 NotifyPropertyChanged();
351 /// Get or set the border of background image.
353 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
354 [EditorBrowsable(EditorBrowsableState.Never)]
355 public Rectangle BackgroundImageBorder
359 return (Rectangle)GetValue(BackgroundImageBorderProperty);
363 SetValue(BackgroundImageBorderProperty, value);
364 selectorData?.BackgroundImageBorder?.Reset(this);
365 NotifyPropertyChanged();
370 /// The background of view.
372 /// <since_tizen> 3 </since_tizen>
373 public Tizen.NUI.PropertyMap Background
377 return (PropertyMap)GetValue(BackgroundProperty);
381 SetValue(BackgroundProperty, value);
382 NotifyPropertyChanged();
387 /// Describes a shadow as an image for a View.
388 /// It is null by default.
391 /// Getter returns copied instance of current shadow.
394 /// The mutually exclusive with "BoxShadow".
398 /// Animatable - This property can be animated using <c>Animation</c> class.
399 /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset".
401 /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10));
403 /// Animatable sub-property : Offset.
406 [EditorBrowsable(EditorBrowsableState.Never)]
407 public ImageShadow ImageShadow
411 return (ImageShadow)GetValue(ImageShadowProperty);
415 SetValue(ImageShadowProperty, value);
416 if (selectorData != null)
418 selectorData.BoxShadow?.Reset(this);
419 selectorData.ImageShadow?.Reset(this);
421 NotifyPropertyChanged();
426 /// Describes a box shaped shadow drawing for a View.
427 /// It is null by default.
430 /// Getter returns copied instance of current shadow.
433 /// The mutually exclusive with "ImageShadow".
437 /// Animatable - This property can be animated using <c>Animation</c> class.
438 /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius".
440 /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f);
442 /// Animatable sub-property : Offset, Color, BlurRadius.
445 [EditorBrowsable(EditorBrowsableState.Never)]
446 public Shadow BoxShadow
450 return (Shadow)GetValue(BoxShadowProperty);
454 SetValue(BoxShadowProperty, value);
455 if (selectorData != null)
457 selectorData.ImageShadow?.Reset(this);
458 selectorData.BoxShadow?.Reset(this);
460 NotifyPropertyChanged();
465 /// The radius for the rounded corners of the View.
466 /// This will rounds background and shadow edges.
467 /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
471 /// Animatable - This property can be animated using <c>Animation</c> class.
474 [EditorBrowsable(EditorBrowsableState.Never)]
475 public float CornerRadius
479 return (float)GetValue(CornerRadiusProperty);
483 SetValue(CornerRadiusProperty, value);
484 NotifyPropertyChanged();
492 [EditorBrowsable(EditorBrowsableState.Never)]
493 protected bool IsHighlighted
497 return Accessibility.AccessibilityManager.Instance.GetCurrentFocusView() == this;
501 [EditorBrowsable(EditorBrowsableState.Never)]
502 protected static readonly string AccessibilityActivateAction = "activate";
503 [EditorBrowsable(EditorBrowsableState.Never)]
504 protected static readonly string AccessibilityReadingSkippedAction = "ReadingSkipped";
505 [EditorBrowsable(EditorBrowsableState.Never)]
506 protected static readonly string AccessibilityReadingCancelledAction = "ReadingCancelled";
507 [EditorBrowsable(EditorBrowsableState.Never)]
508 protected static readonly string AccessibilityReadingStoppedAction = "ReadingStopped";
509 [EditorBrowsable(EditorBrowsableState.Never)]
510 protected static readonly string AccessibilityReadingPausedAction = "ReadingPaused";
511 [EditorBrowsable(EditorBrowsableState.Never)]
512 protected static readonly string AccessibilityReadingResumedAction = "ReadingResumed";
514 [EditorBrowsable(EditorBrowsableState.Never)]
515 private static readonly string[] AccessibilityActions = {
516 AccessibilityActivateAction,
517 AccessibilityReadingSkippedAction,
518 AccessibilityReadingCancelledAction,
519 AccessibilityReadingStoppedAction,
520 AccessibilityReadingPausedAction,
521 AccessibilityReadingResumedAction,
524 [EditorBrowsable(EditorBrowsableState.Never)]
525 protected virtual string AccessibilityGetName()
530 [EditorBrowsable(EditorBrowsableState.Never)]
531 protected virtual string AccessibilityGetDescription()
536 [EditorBrowsable(EditorBrowsableState.Never)]
537 protected virtual bool AccessibilityDoAction(string name)
542 [EditorBrowsable(EditorBrowsableState.Never)]
543 protected virtual AccessibilityStates AccessibilityCalculateStates()
545 var states = new AccessibilityStates();
546 states.Set(AccessibilityState.Highlightable, this.AccessibilityHighlightable);
547 states.Set(AccessibilityState.Focusable, this.Focusable);
548 states.Set(AccessibilityState.Focused, this.State == States.Focused);
549 states.Set(AccessibilityState.Highlighted, this.IsHighlighted);
550 states.Set(AccessibilityState.Enabled, this.State != States.Disabled);
551 states.Set(AccessibilityState.Sensitive, this.Sensitive);
552 states.Set(AccessibilityState.Animated, this.AccessibilityAnimated);
553 states.Set(AccessibilityState.Visible, true);
554 states.Set(AccessibilityState.Showing, this.Visibility);
555 states.Set(AccessibilityState.Defunct, !this.IsOnWindow);
559 [EditorBrowsable(EditorBrowsableState.Never)]
560 protected virtual int AccessibilityGetActionCount()
562 return AccessibilityActions.Length;
565 [EditorBrowsable(EditorBrowsableState.Never)]
566 protected virtual string AccessibilityGetActionName(int index)
568 if (index >= 0 && index < AccessibilityActions.Length)
569 return AccessibilityActions[index];
574 [EditorBrowsable(EditorBrowsableState.Never)]
575 protected virtual bool AccessibilityShouldReportZeroChildren()
580 [EditorBrowsable(EditorBrowsableState.Never)]
581 protected virtual double AccessibilityGetMinimum()
586 [EditorBrowsable(EditorBrowsableState.Never)]
587 protected virtual double AccessibilityGetCurrent()
592 [EditorBrowsable(EditorBrowsableState.Never)]
593 protected virtual double AccessibilityGetMaximum()
598 [EditorBrowsable(EditorBrowsableState.Never)]
599 protected virtual bool AccessibilitySetCurrent(double value)
604 [EditorBrowsable(EditorBrowsableState.Never)]
605 protected virtual double AccessibilityGetMinimumIncrement()
610 [EditorBrowsable(EditorBrowsableState.Never)]
611 protected virtual bool AccessibilityIsScrollable()
616 [EditorBrowsable(EditorBrowsableState.Never)]
617 protected virtual string AccessibilityGetText(int startOffset, int endOffset)
622 [EditorBrowsable(EditorBrowsableState.Never)]
623 protected virtual int AccessibilityGetCharacterCount()
628 [EditorBrowsable(EditorBrowsableState.Never)]
629 protected virtual int AccessibilityGetCaretOffset()
634 [EditorBrowsable(EditorBrowsableState.Never)]
635 protected virtual bool AccessibilitySetCaretOffset(int offset)
640 [EditorBrowsable(EditorBrowsableState.Never)]
641 protected virtual AccessibilityRange AccessibilityGetTextAtOffset(int offset, TextBoundary boundary)
643 return new AccessibilityRange();
646 [EditorBrowsable(EditorBrowsableState.Never)]
647 protected virtual AccessibilityRange AccessibilityGetSelection(int selectionNum)
649 return new AccessibilityRange();
652 [EditorBrowsable(EditorBrowsableState.Never)]
653 protected virtual bool AccessibilityRemoveSelection(int selectionNum)
658 [EditorBrowsable(EditorBrowsableState.Never)]
659 protected virtual bool AccessibilitySetSelection(int selectionNum, int startOffset, int endOffset)
664 [EditorBrowsable(EditorBrowsableState.Never)]
665 protected virtual bool AccessibilityCopyText(int startPosition, int endPosition)
670 [EditorBrowsable(EditorBrowsableState.Never)]
671 protected virtual bool AccessibilityCutText(int startPosition, int endPosition)
677 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
678 /// It is absolute by default.
679 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
681 [EditorBrowsable(EditorBrowsableState.Never)]
682 public VisualTransformPolicyType CornerRadiusPolicy
684 get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty);
685 set => SetValue(CornerRadiusPolicyProperty, value);
689 /// The current state of the view.
691 /// <since_tizen> 3 </since_tizen>
696 return (States)GetValue(StateProperty);
700 SetValue(StateProperty, value);
701 NotifyPropertyChanged();
706 /// The current sub state of the view.
708 /// <since_tizen> 3 </since_tizen>
709 public States SubState
713 return (States)GetValue(SubStateProperty);
717 SetValue(SubStateProperty, value);
718 NotifyPropertyChanged();
723 /// Displays a tooltip
725 /// <since_tizen> 3 </since_tizen>
726 public Tizen.NUI.PropertyMap Tooltip
730 return (PropertyMap)GetValue(TooltipProperty);
734 SetValue(TooltipProperty, value);
735 NotifyPropertyChanged();
740 /// Displays a tooltip as a text.
742 /// <since_tizen> 3 </since_tizen>
743 public string TooltipText
747 using (var propertyValue = GetProperty(Property.TOOLTIP))
749 if (propertyValue != null && propertyValue.Get(out string retrivedValue))
751 return retrivedValue;
753 NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!");
754 return "error to get TooltipText";
759 var temp = new Tizen.NUI.PropertyValue(value);
760 SetProperty(View.Property.TOOLTIP, temp);
762 NotifyPropertyChanged();
767 /// The Child property of FlexContainer.<br />
768 /// The proportion of the free space in the container, the flex item will receive.<br />
769 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
771 /// <since_tizen> 3 </since_tizen>
772 [Obsolete("Deprecated in API8, will be removed in API10.")]
777 return (float)GetValue(FlexProperty);
781 SetValue(FlexProperty, value);
782 NotifyPropertyChanged();
787 /// The Child property of FlexContainer.<br />
788 /// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.<br />
790 /// <since_tizen> 3 </since_tizen>
791 [Obsolete("Deprecated in API8, will be removed in API10.")]
796 return (int)GetValue(AlignSelfProperty);
800 SetValue(AlignSelfProperty, value);
801 NotifyPropertyChanged();
806 /// The Child property of FlexContainer.<br />
807 /// The space around the flex item.<br />
810 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
812 /// <since_tizen> 3 </since_tizen>
813 [Obsolete("Deprecated in API8, will be removed in API10.")]
814 public Vector4 FlexMargin
818 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
819 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
823 SetValue(FlexMarginProperty, value);
824 NotifyPropertyChanged();
829 /// The top-left cell this child occupies, if not set, the first available cell is used.
832 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
834 /// <since_tizen> 3 </since_tizen>
835 public Vector2 CellIndex
839 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
840 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
844 SetValue(CellIndexProperty, value);
845 NotifyPropertyChanged();
850 /// The number of rows this child occupies, if not set, the default value is 1.
852 /// <since_tizen> 3 </since_tizen>
857 return (float)GetValue(RowSpanProperty);
861 SetValue(RowSpanProperty, value);
862 NotifyPropertyChanged();
867 /// The number of columns this child occupies, if not set, the default value is 1.
869 /// <since_tizen> 3 </since_tizen>
870 public float ColumnSpan
874 return (float)GetValue(ColumnSpanProperty);
878 SetValue(ColumnSpanProperty, value);
879 NotifyPropertyChanged();
884 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
886 /// <since_tizen> 3 </since_tizen>
887 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
891 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
895 SetValue(CellHorizontalAlignmentProperty, value);
896 NotifyPropertyChanged();
901 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
903 /// <since_tizen> 3 </since_tizen>
904 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
908 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
912 SetValue(CellVerticalAlignmentProperty, value);
913 NotifyPropertyChanged();
918 /// The left focusable view.<br />
919 /// This will return null if not set.<br />
920 /// This will also return null if the specified left focusable view is not on a window.<br />
922 /// <since_tizen> 3 </since_tizen>
923 public View LeftFocusableView
925 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
928 return (View)GetValue(LeftFocusableViewProperty);
932 SetValue(LeftFocusableViewProperty, value);
933 NotifyPropertyChanged();
938 /// The right focusable view.<br />
939 /// This will return null if not set.<br />
940 /// This will also return null if the specified right focusable view is not on a window.<br />
942 /// <since_tizen> 3 </since_tizen>
943 public View RightFocusableView
945 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
948 return (View)GetValue(RightFocusableViewProperty);
952 SetValue(RightFocusableViewProperty, value);
953 NotifyPropertyChanged();
958 /// The up focusable view.<br />
959 /// This will return null if not set.<br />
960 /// This will also return null if the specified up focusable view is not on a window.<br />
962 /// <since_tizen> 3 </since_tizen>
963 public View UpFocusableView
965 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
968 return (View)GetValue(UpFocusableViewProperty);
972 SetValue(UpFocusableViewProperty, value);
973 NotifyPropertyChanged();
978 /// The down focusable view.<br />
979 /// This will return null if not set.<br />
980 /// This will also return null if the specified down focusable view is not on a window.<br />
982 /// <since_tizen> 3 </since_tizen>
983 public View DownFocusableView
985 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
988 return (View)GetValue(DownFocusableViewProperty);
992 SetValue(DownFocusableViewProperty, value);
993 NotifyPropertyChanged();
998 /// Whether the view should be focusable by keyboard navigation.
1000 /// <since_tizen> 3 </since_tizen>
1001 public bool Focusable
1005 SetValue(FocusableProperty, value);
1006 NotifyPropertyChanged();
1010 return (bool)GetValue(FocusableProperty);
1015 /// Retrieves the position of the view.<br />
1016 /// The coordinates are relative to the view's parent.<br />
1018 /// <since_tizen> 3 </since_tizen>
1019 public Position CurrentPosition
1023 return GetCurrentPosition();
1028 /// Sets the size of a view for the width and the height.<br />
1029 /// Geometry can be scaled to fit within this area.<br />
1030 /// This does not interfere with the view's scale factor.<br />
1031 /// The views default depth is the minimum of width and height.<br />
1034 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
1035 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
1037 /// <since_tizen> 3 </since_tizen>
1038 public Size2D Size2D
1042 Size2D temp = (Size2D)GetValue(Size2DProperty);
1043 int width = temp.Width;
1044 int height = temp.Height;
1046 if (this.Layout == null)
1048 if (width < 0) { width = 0; }
1049 if (height < 0) { height = 0; }
1052 return new Size2D(OnSize2DChanged, width, height);
1056 SetValue(Size2DProperty, value);
1058 NotifyPropertyChanged();
1063 /// Retrieves the size of the view.<br />
1064 /// The coordinates are relative to the view's parent.<br />
1066 /// <since_tizen> 3 </since_tizen>
1067 public Size2D CurrentSize
1071 return GetCurrentSize();
1076 /// Retrieves and sets the view's opacity.<br />
1078 /// <since_tizen> 3 </since_tizen>
1079 public float Opacity
1083 return (float)GetValue(OpacityProperty);
1087 SetValue(OpacityProperty, value);
1088 selectorData?.Opacity?.Reset(this);
1089 NotifyPropertyChanged();
1094 /// Sets the position of the view for X and Y.<br />
1095 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
1096 /// If the position inheritance is disabled, sets the world position.<br />
1099 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
1100 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
1102 /// <since_tizen> 3 </since_tizen>
1103 public Position2D Position2D
1107 Position2D temp = (Position2D)GetValue(Position2DProperty);
1108 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
1112 SetValue(Position2DProperty, value);
1113 NotifyPropertyChanged();
1118 /// Retrieves the screen position of the view.<br />
1120 /// <since_tizen> 3 </since_tizen>
1121 public Vector2 ScreenPosition
1125 Vector2 temp = new Vector2(0.0f, 0.0f);
1126 var pValue = GetProperty(View.Property.ScreenPosition);
1134 /// Determines whether the pivot point should be used to determine the position of the view.
1135 /// This is false by default.
1137 /// <remarks>If false, then the top-left of the view is used for the position.
1138 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
1140 /// <since_tizen> 3 </since_tizen>
1141 public bool PositionUsesPivotPoint
1145 return (bool)GetValue(PositionUsesPivotPointProperty);
1149 SetValue(PositionUsesPivotPointProperty, value);
1150 NotifyPropertyChanged();
1155 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
1157 /// <since_tizen> 3 </since_tizen>
1158 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
1160 "View view = new View(); " +
1161 "view.PivotPoint = PivotPoint.Center; " +
1162 "view.PositionUsesPivotPoint = true;" +
1163 " Deprecated in API5: Will be removed in API8")]
1164 [EditorBrowsable(EditorBrowsableState.Never)]
1165 public bool PositionUsesAnchorPoint
1170 var pValue = GetProperty(View.Property.PositionUsesAnchorPoint);
1171 pValue.Get(out temp);
1177 var temp = new Tizen.NUI.PropertyValue(value);
1178 SetProperty(View.Property.PositionUsesAnchorPoint, temp);
1180 NotifyPropertyChanged();
1185 /// Queries whether the view is connected to the stage.<br />
1186 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
1188 /// <since_tizen> 3 </since_tizen>
1189 public bool IsOnWindow
1198 /// Gets the depth in the hierarchy for the view.
1200 /// <since_tizen> 3 </since_tizen>
1201 public int HierarchyDepth
1205 return GetHierarchyDepth();
1210 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
1213 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
1214 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
1215 /// The values set by this property will likely change.
1217 /// <since_tizen> 3 </since_tizen>
1218 public int SiblingOrder
1222 return (int)GetValue(SiblingOrderProperty);
1226 SetValue(SiblingOrderProperty, value);
1228 LayoutGroup layout = Layout as LayoutGroup;
1229 layout?.ChangeLayoutSiblingOrder(value);
1231 NotifyPropertyChanged();
1236 /// Returns the natural size of the view.
1239 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1241 /// <since_tizen> 5 </since_tizen>
1242 public Vector3 NaturalSize
1246 Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1247 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1253 /// Returns the natural size (Size2D) of the view.
1256 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
1258 /// <since_tizen> 4 </since_tizen>
1259 public Size2D NaturalSize2D
1263 Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true);
1264 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
1266 Size2D sz = new Size2D((int)temp.Width, (int)temp.Height);
1273 /// Gets or sets the origin of a view within its parent's area.<br />
1274 /// 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 />
1275 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
1276 /// A view's position is the distance between this origin and the view's anchor-point.<br />
1278 /// <pre>The view has been initialized.</pre>
1279 /// <since_tizen> 3 </since_tizen>
1280 public Position ParentOrigin
1284 Position tmp = (Position)GetValue(ParentOriginProperty);
1285 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
1289 SetValue(ParentOriginProperty, value);
1290 NotifyPropertyChanged();
1295 /// Gets or sets the anchor-point of a view.<br />
1296 /// 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 />
1297 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
1298 /// A view position is the distance between its parent-origin and this anchor-point.<br />
1299 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
1300 /// <pre>The view has been initialized.</pre>
1303 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
1305 /// <since_tizen> 3 </since_tizen>
1306 public Position PivotPoint
1310 Position tmp = (Position)GetValue(PivotPointProperty);
1311 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
1315 SetValue(PivotPointProperty, value);
1316 NotifyPropertyChanged();
1321 /// Gets or sets the size width of the view.
1325 /// Animatable - This property can be animated using <c>Animation</c> class.
1328 /// <since_tizen> 3 </since_tizen>
1329 public float SizeWidth
1333 return (float)GetValue(SizeWidthProperty);
1337 SetValue(SizeWidthProperty, value);
1338 NotifyPropertyChanged();
1343 /// Gets or sets the size height of the view.
1347 /// Animatable - This property can be animated using <c>Animation</c> class.
1350 /// <since_tizen> 3 </since_tizen>
1351 public float SizeHeight
1355 return (float)GetValue(SizeHeightProperty);
1359 SetValue(SizeHeightProperty, value);
1360 NotifyPropertyChanged();
1365 /// Gets or sets the position of the view.<br />
1366 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
1367 /// If the position inheritance is disabled, sets the world position.<br />
1371 /// Animatable - This property can be animated using <c>Animation</c> class.
1373 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1375 /// <since_tizen> 3 </since_tizen>
1376 public Position Position
1380 Position tmp = (Position)GetValue(PositionProperty);
1381 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1385 SetValue(PositionProperty, value);
1386 NotifyPropertyChanged();
1391 /// Gets or sets the position X of the view.
1395 /// Animatable - This property can be animated using <c>Animation</c> class.
1398 /// <since_tizen> 3 </since_tizen>
1399 public float PositionX
1403 return (float)GetValue(PositionXProperty);
1407 SetValue(PositionXProperty, value);
1408 NotifyPropertyChanged();
1413 /// Gets or sets the position Y of the view.
1417 /// Animatable - This property can be animated using <c>Animation</c> class.
1420 /// <since_tizen> 3 </since_tizen>
1421 public float PositionY
1425 return (float)GetValue(PositionYProperty);
1429 SetValue(PositionYProperty, value);
1430 NotifyPropertyChanged();
1435 /// Gets or sets the position Z of the view.
1439 /// Animatable - This property can be animated using <c>Animation</c> class.
1442 /// <since_tizen> 3 </since_tizen>
1443 public float PositionZ
1447 return (float)GetValue(PositionZProperty);
1451 SetValue(PositionZProperty, value);
1452 NotifyPropertyChanged();
1457 /// Gets or sets the world position of the view.
1459 /// <since_tizen> 3 </since_tizen>
1460 public Vector3 WorldPosition
1464 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1465 var pValue = GetProperty(View.Property.WorldPosition);
1473 /// Gets or sets the orientation of the view.<br />
1474 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1478 /// This is an asynchronous method.
1481 /// Animatable - This property can be animated using <c>Animation</c> class.
1484 /// <since_tizen> 3 </since_tizen>
1485 public Rotation Orientation
1489 return (Rotation)GetValue(OrientationProperty);
1493 SetValue(OrientationProperty, value);
1494 NotifyPropertyChanged();
1499 /// Gets or sets the world orientation of the view.<br />
1501 /// <since_tizen> 3 </since_tizen>
1502 public Rotation WorldOrientation
1506 Rotation temp = new Rotation();
1507 var pValue = GetProperty(View.Property.WorldOrientation);
1515 /// Gets or sets the scale factor applied to the view.<br />
1519 /// Animatable - This property can be animated using <c>Animation</c> class.
1521 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1523 /// <since_tizen> 3 </since_tizen>
1524 public Vector3 Scale
1528 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1529 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1533 SetValue(ScaleProperty, value);
1534 NotifyPropertyChanged();
1539 /// Gets or sets the scale X factor applied to the view.
1543 /// Animatable - This property can be animated using <c>Animation</c> class.
1546 /// <since_tizen> 3 </since_tizen>
1551 return (float)GetValue(ScaleXProperty);
1555 SetValue(ScaleXProperty, value);
1556 NotifyPropertyChanged();
1561 /// Gets or sets the scale Y factor applied to the view.
1565 /// Animatable - This property can be animated using <c>Animation</c> class.
1568 /// <since_tizen> 3 </since_tizen>
1573 return (float)GetValue(ScaleYProperty);
1577 SetValue(ScaleYProperty, value);
1578 NotifyPropertyChanged();
1583 /// Gets or sets the scale Z factor applied to the view.
1587 /// Animatable - This property can be animated using <c>Animation</c> class.
1590 /// <since_tizen> 3 </since_tizen>
1595 return (float)GetValue(ScaleZProperty);
1599 SetValue(ScaleZProperty, value);
1600 NotifyPropertyChanged();
1605 /// Gets the world scale of the view.
1607 /// <since_tizen> 3 </since_tizen>
1608 public Vector3 WorldScale
1612 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1613 var pValue = GetProperty(View.Property.WorldScale);
1621 /// Retrieves the visibility flag of the view.
1625 /// If the view is not visible, then the view and its children will not be rendered.
1626 /// 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.
1629 /// Animatable - This property can be animated using <c>Animation</c> class.
1632 /// <since_tizen> 3 </since_tizen>
1633 public bool Visibility
1638 var pValue = GetProperty(View.Property.VISIBLE);
1639 pValue.Get(out temp);
1646 /// Gets the view's world color.
1648 /// <since_tizen> 3 </since_tizen>
1649 public Vector4 WorldColor
1653 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1654 var pValue = GetProperty(View.Property.WorldColor);
1662 /// Gets or sets the view's name.
1664 /// <since_tizen> 3 </since_tizen>
1669 return (string)GetValue(NameProperty);
1673 SetValue(NameProperty, value);
1674 NotifyPropertyChanged();
1679 /// Get the number of children held by the view.
1681 /// <since_tizen> 3 </since_tizen>
1682 public new uint ChildCount
1686 return Convert.ToUInt32(Children.Count);
1691 /// Gets the view's ID.
1694 /// <since_tizen> 3 </since_tizen>
1704 /// Gets or sets the status of whether the view should emit touch or hover signals.
1706 /// <since_tizen> 3 </since_tizen>
1707 public bool Sensitive
1711 return (bool)GetValue(SensitiveProperty);
1715 SetValue(SensitiveProperty, value);
1716 NotifyPropertyChanged();
1721 /// 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.
1723 /// <since_tizen> 3 </since_tizen>
1724 public bool LeaveRequired
1728 return (bool)GetValue(LeaveRequiredProperty);
1732 SetValue(LeaveRequiredProperty, value);
1733 NotifyPropertyChanged();
1738 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1740 /// <since_tizen> 3 </since_tizen>
1741 public bool InheritOrientation
1745 return (bool)GetValue(InheritOrientationProperty);
1749 SetValue(InheritOrientationProperty, value);
1750 NotifyPropertyChanged();
1755 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1757 /// <since_tizen> 3 </since_tizen>
1758 public bool InheritScale
1762 return (bool)GetValue(InheritScaleProperty);
1766 SetValue(InheritScaleProperty, value);
1767 NotifyPropertyChanged();
1772 /// Gets or sets the status of how the view and its children should be drawn.<br />
1773 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1774 /// 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 />
1775 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1776 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1777 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1779 /// <since_tizen> 3 </since_tizen>
1780 public DrawModeType DrawMode
1784 return (DrawModeType)GetValue(DrawModeProperty);
1788 SetValue(DrawModeProperty, value);
1789 NotifyPropertyChanged();
1794 /// Gets or sets the relative to parent size factor of the view.<br />
1795 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1796 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1799 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1801 /// <since_tizen> 3 </since_tizen>
1802 public Vector3 SizeModeFactor
1806 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1807 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1811 SetValue(SizeModeFactorProperty, value);
1812 NotifyPropertyChanged();
1817 /// Gets or sets the width resize policy to be used.
1819 /// <since_tizen> 3 </since_tizen>
1820 public ResizePolicyType WidthResizePolicy
1824 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1828 SetValue(WidthResizePolicyProperty, value);
1829 NotifyPropertyChanged();
1834 /// Gets or sets the height resize policy to be used.
1836 /// <since_tizen> 3 </since_tizen>
1837 public ResizePolicyType HeightResizePolicy
1841 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1845 SetValue(HeightResizePolicyProperty, value);
1846 NotifyPropertyChanged();
1851 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1852 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1854 /// <since_tizen> 3 </since_tizen>
1855 public SizeScalePolicyType SizeScalePolicy
1859 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1863 SetValue(SizeScalePolicyProperty, value);
1864 NotifyPropertyChanged();
1869 /// Gets or sets the status of whether the width size is dependent on the height size.
1871 /// <since_tizen> 3 </since_tizen>
1872 public bool WidthForHeight
1876 return (bool)GetValue(WidthForHeightProperty);
1880 SetValue(WidthForHeightProperty, value);
1881 NotifyPropertyChanged();
1886 /// Gets or sets the status of whether the height size is dependent on the width size.
1888 /// <since_tizen> 3 </since_tizen>
1889 public bool HeightForWidth
1893 return (bool)GetValue(HeightForWidthProperty);
1897 SetValue(HeightForWidthProperty, value);
1898 NotifyPropertyChanged();
1903 /// Gets or sets the padding for use in layout.
1906 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1908 /// <since_tizen> 5 </since_tizen>
1909 public Extents Padding
1913 // If View has a Layout then padding in stored in the base Layout class
1916 return Layout.Padding;
1920 Extents temp = (Extents)GetValue(PaddingProperty);
1921 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1923 // Two return points to prevent creating a zeroed Extent native object before assignment
1927 Extents padding = value;
1930 // Layout set so store Padding in LayoutItem instead of in View.
1931 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1932 // the position and sizes measure in the Layouting.
1933 Layout.Padding = value;
1934 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1935 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1936 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind.
1938 padding = new Extents(0, 0, 0, 0); // Reset value stored in View.
1942 SetValue(PaddingProperty, padding);
1943 NotifyPropertyChanged();
1948 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1950 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
1952 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1954 /// <since_tizen> 3 </since_tizen>
1955 public Size2D MinimumSize
1959 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1960 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1966 throw new ArgumentNullException(nameof(value));
1970 // Note: it only works if minimum size is >= than natural size.
1971 // To force the size it should be done through the width&height spec or Size2D.
1972 layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1973 layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1974 layout.RequestLayout();
1976 SetValue(MinimumSizeProperty, value);
1977 NotifyPropertyChanged();
1982 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1985 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1987 /// <since_tizen> 3 </since_tizen>
1988 public Size2D MaximumSize
1992 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1993 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1997 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1998 // MATCH_PARENT spec + parent container size can be used to limit
2001 layout.RequestLayout();
2003 SetValue(MaximumSizeProperty, value);
2004 NotifyPropertyChanged();
2009 /// Gets or sets whether a child view inherits it's parent's position.<br />
2010 /// Default is to inherit.<br />
2011 /// 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 />
2013 /// <since_tizen> 3 </since_tizen>
2014 public bool InheritPosition
2018 return (bool)GetValue(InheritPositionProperty);
2022 SetValue(InheritPositionProperty, value);
2023 NotifyPropertyChanged();
2028 /// Gets or sets the clipping behavior (mode) of it's children.
2030 /// <since_tizen> 3 </since_tizen>
2031 public ClippingModeType ClippingMode
2035 return (ClippingModeType)GetValue(ClippingModeProperty);
2039 SetValue(ClippingModeProperty, value);
2040 NotifyPropertyChanged();
2045 /// Gets the number of renderers held by the view.
2047 /// <since_tizen> 3 </since_tizen>
2048 public uint RendererCount
2052 return GetRendererCount();
2057 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
2060 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
2062 /// <since_tizen> 3 </since_tizen>
2063 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
2065 "View view = new View(); " +
2066 "view.PivotPoint = PivotPoint.Center; " +
2067 "view.PositionUsesPivotPoint = true;")]
2068 [EditorBrowsable(EditorBrowsableState.Never)]
2069 public Position AnchorPoint
2073 Position temp = new Position(0.0f, 0.0f, 0.0f);
2074 var pValue = GetProperty(View.Property.AnchorPoint);
2077 Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
2083 var temp = new Tizen.NUI.PropertyValue(value);
2084 SetProperty(View.Property.AnchorPoint, temp);
2086 NotifyPropertyChanged();
2091 /// Sets the size of a view for the width, the height and the depth.<br />
2092 /// Geometry can be scaled to fit within this area.<br />
2093 /// This does not interfere with the view's scale factor.<br />
2094 /// The views default depth is the minimum of width and height.<br />
2098 /// Animatable - This property can be animated using <c>Animation</c> class.
2100 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
2102 /// <since_tizen> 5 </since_tizen>
2107 Size tmp = (Size)GetValue(SizeProperty);
2108 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
2112 SetValue(SizeProperty, value);
2113 NotifyPropertyChanged();
2118 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
2120 /// <since_tizen> 3 </since_tizen>
2121 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
2123 "Container parent = view.GetParent(); " +
2124 "View view = parent as View;")]
2125 [EditorBrowsable(EditorBrowsableState.Never)]
2126 public new View Parent
2131 IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr);
2132 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
2133 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
2135 if (basehandle is Layer layer)
2137 ret = new View(Layer.getCPtr(layer).Handle, false);
2138 NUILog.Error("This Parent property is deprecated, should do not be used");
2142 ret = basehandle as View;
2145 Interop.BaseHandle.DeleteBaseHandle(CPtr);
2146 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
2148 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
2154 /// Gets/Sets whether inherit parent's the layout Direction.
2156 /// <since_tizen> 4 </since_tizen>
2157 public bool InheritLayoutDirection
2161 return (bool)GetValue(InheritLayoutDirectionProperty);
2165 SetValue(InheritLayoutDirectionProperty, value);
2166 NotifyPropertyChanged();
2171 /// Gets/Sets the layout Direction.
2173 /// <since_tizen> 4 </since_tizen>
2174 public ViewLayoutDirectionType LayoutDirection
2178 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
2182 SetValue(LayoutDirectionProperty, value);
2183 NotifyPropertyChanged();
2184 layout?.RequestLayout();
2189 /// Gets or sets the Margin for use in layout.
2192 /// Margin property is supported by Layout algorithms and containers.
2193 /// Please Set Layout if you want to use Margin property.
2194 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
2196 /// <since_tizen> 4 </since_tizen>
2197 public Extents Margin
2201 // If View has a Layout then margin is stored in Layout.
2204 return Layout.Margin;
2208 // If Layout not set then return margin stored in View.
2209 Extents temp = (Extents)GetValue(MarginProperty);
2210 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2212 // Two return points to prevent creating a zeroed Extent native object before assignment
2218 // Layout set so store Margin in LayoutItem instead of View.
2219 // If View stores the Margin too then the Legacy Size Negotiation will
2220 // overwrite the position and size values measured in the Layouting.
2221 Layout.Margin = value;
2222 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2223 layout?.RequestLayout();
2227 SetValue(MarginProperty, value);
2229 NotifyPropertyChanged();
2230 layout?.RequestLayout();
2235 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2237 /// <since_tizen> 6 </since_tizen>
2238 public int WidthSpecification
2246 if (value == widthPolicy)
2249 widthPolicy = value;
2250 if (widthPolicy >= 0)
2252 if (heightPolicy >= 0) // Policy an exact value
2254 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2255 Size2D = new Size2D(widthPolicy, heightPolicy);
2258 layout?.RequestLayout();
2263 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
2265 /// <since_tizen> 6 </since_tizen>
2266 public int HeightSpecification
2270 return heightPolicy;
2274 if (value == heightPolicy)
2277 heightPolicy = value;
2278 if (heightPolicy >= 0)
2280 if (widthPolicy >= 0) // Policy an exact value
2282 // Create Size2D only both _widthPolicy and _heightPolicy are set.
2283 Size2D = new Size2D(widthPolicy, heightPolicy);
2286 layout?.RequestLayout();
2291 /// Gets the List of transitions for this View.
2293 /// <since_tizen> 6 </since_tizen>
2294 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
2298 if (layoutTransitions == null)
2300 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2302 return layoutTransitions;
2307 /// Set a layout transitions for this View.
2309 /// <exception cref="ArgumentNullException"> Thrown when value is null. </exception>
2311 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
2313 /// <since_tizen> 6 </since_tizen>
2314 public LayoutTransition LayoutTransition
2318 return layoutTransition;
2324 throw new global::System.ArgumentNullException(nameof(value));
2326 if (layoutTransitions == null)
2328 layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
2331 LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true);
2333 AttachTransitionsToChildren(value);
2335 layoutTransition = value;
2340 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2343 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2345 /// <since_tizen> 4 </since_tizen>
2346 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2347 [EditorBrowsable(EditorBrowsableState.Never)]
2348 public Extents PaddingEX
2352 Extents temp = new Extents(0, 0, 0, 0);
2353 var pValue = GetProperty(View.Property.PADDING);
2356 Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2362 var temp = new Tizen.NUI.PropertyValue(value);
2363 SetProperty(View.Property.PADDING, temp);
2365 NotifyPropertyChanged();
2366 layout?.RequestLayout();
2371 /// The Color of View. This is an RGBA value.
2375 /// Animatable - This property can be animated using <c>Animation</c> class.
2377 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2379 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2380 [EditorBrowsable(EditorBrowsableState.Never)]
2385 Color temp = (Color)GetValue(ColorProperty);
2386 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2390 SetValue(ColorProperty, value);
2391 selectorData?.Color?.Reset(this);
2392 NotifyPropertyChanged();
2397 /// Set the layout on this View. Replaces any existing Layout.
2399 /// <since_tizen> 6 </since_tizen>
2400 public LayoutItem Layout
2408 // Do nothing if layout provided is already set on this View.
2409 if (value == layout)
2414 LayoutingDisabled = false;
2417 // If new layout being set already has a owner then that owner receives a replacement default layout.
2418 // First check if the layout to be set already has a owner.
2419 if (value?.Owner != null)
2421 // Previous owner of the layout gets a default layout as a replacement.
2422 value.Owner.Layout = new AbsoluteLayout();
2424 // Copy Margin and Padding to replacement LayoutGroup.
2425 if (value.Owner.Layout != null)
2427 value.Owner.Layout.Margin = value.Margin;
2428 value.Owner.Layout.Padding = value.Padding;
2432 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2433 // View if no replacement. Previously margin and padding values would have been moved from
2434 // the View to the layout.
2435 if (layout != null) // Existing layout
2439 // Existing layout being replaced so copy over margin and padding values.
2440 value.Margin = layout.Margin;
2441 value.Padding = layout.Padding;
2445 // Layout not being replaced so restore margin and padding to View.
2446 SetValue(MarginProperty, layout.Margin);
2447 SetValue(PaddingProperty, layout.Padding);
2448 NotifyPropertyChanged();
2453 // First Layout to be added to the View hence copy
2455 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2458 if (Margin.Top != 0 || Margin.Bottom != 0 || Margin.Start != 0 || Margin.End != 0)
2460 // If View already has a margin set then store it in Layout instead.
2461 value.Margin = Margin;
2462 SetValue(MarginProperty, new Extents(0, 0, 0, 0));
2463 NotifyPropertyChanged();
2466 if (Padding.Top != 0 || Padding.Bottom != 0 || Padding.Start != 0 || Padding.End != 0)
2468 // If View already has a padding set then store it in Layout instead.
2469 value.Padding = Padding;
2471 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
2472 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
2473 if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType()))
2475 SetValue(PaddingProperty, new Extents(0, 0, 0, 0));
2476 NotifyPropertyChanged();
2482 // Remove existing layout from it's parent layout group.
2485 value.SetPositionByLayout = !excludeLayouting;
2487 // Set layout to this view
2493 /// The weight of the View, used to share available space in a layout with siblings.
2495 /// <since_tizen> 6 </since_tizen>
2505 layout?.RequestLayout();
2510 /// Whether to load the BackgroundImage synchronously.
2511 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2512 /// Note: For Normal Quad images only.
2514 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2515 [EditorBrowsable(EditorBrowsableState.Never)]
2516 public bool BackgroundImageSynchronosLoading
2520 return backgroundImageSynchronosLoading;
2524 backgroundImageSynchronosLoading = value;
2526 string bgUrl = null;
2527 var pValue = Background.Find(ImageVisualProperty.URL);
2528 pValue?.Get(out bgUrl);
2531 if (!string.IsNullOrEmpty(bgUrl))
2533 PropertyMap bgMap = this.Background;
2534 var temp = new PropertyValue(backgroundImageSynchronosLoading);
2535 bgMap.Add("synchronousLoading", temp);
2542 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2543 [EditorBrowsable(EditorBrowsableState.Never)]
2544 public Vector2 UpdateSizeHint
2548 return (Vector2)GetValue(UpdateSizeHintProperty);
2552 SetValue(UpdateSizeHintProperty, value);
2553 NotifyPropertyChanged();
2558 /// Enable/Disable ControlState propagation for children.
2559 /// It is false by default.
2560 /// If the View needs to share ControlState with descendants, please set it true.
2561 /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively.
2563 [EditorBrowsable(EditorBrowsableState.Never)]
2564 public bool EnableControlStatePropagation
2566 get => controlStatePropagation;
2569 controlStatePropagation = value;
2571 foreach (View child in Children)
2573 child.EnableControlStatePropagation = value;
2579 /// By default, it is false in View, true in Control.
2580 /// Note that if the value is true, the View will be a touch receptor.
2582 [EditorBrowsable(EditorBrowsableState.Never)]
2583 public bool EnableControlState
2587 return (bool)GetValue(EnableControlStateProperty);
2591 SetValue(EnableControlStateProperty, value);
2596 /// Whether the actor grab all touches even if touch leaves its boundary.
2598 /// <returns>true, if it grab all touch after start</returns>
2599 [EditorBrowsable(EditorBrowsableState.Never)]
2600 public bool GrabTouchAfterLeave
2605 var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart);
2606 pValue.Get(out temp);
2612 var temp = new Tizen.NUI.PropertyValue(value);
2613 SetProperty(View.Property.CaptureAllTouchAfterStart, temp);
2615 NotifyPropertyChanged();
2620 /// Determines which blend equation will be used to render renderers of this actor.
2622 /// <returns>blend equation enum currently assigned</returns>
2623 /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API.
2624 [EditorBrowsable(EditorBrowsableState.Never)]
2625 public BlendEquationType BlendEquation
2630 var pValue = GetProperty(View.Property.BlendEquation);
2631 pValue.Get(out temp);
2633 return (BlendEquationType)temp;
2637 var temp = new Tizen.NUI.PropertyValue((int)value);
2638 SetProperty(View.Property.BlendEquation, temp);
2640 NotifyPropertyChanged();
2645 /// If the value is true, the View will change its style as the theme changes.
2646 /// It is false by default, but turned to true when setting StyleName (by setting property or using specified constructor).
2648 [EditorBrowsable(EditorBrowsableState.Never)]
2649 public bool ThemeChangeSensitive
2651 get => (bool)GetValue(ThemeChangeSensitiveProperty);
2652 set => SetValue(ThemeChangeSensitiveProperty, value);
2656 /// Create Style, it is abstract function and must be override.
2658 [EditorBrowsable(EditorBrowsableState.Never)]
2659 protected virtual ViewStyle CreateViewStyle()
2661 return new ViewStyle();
2665 /// Called after the View's ControlStates changed.
2667 /// <param name="controlStateChangedInfo">The information including state changed variables.</param>
2668 [EditorBrowsable(EditorBrowsableState.Never)]
2669 protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo)
2675 [EditorBrowsable(EditorBrowsableState.Never)]
2676 protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e)
2681 private bool IsViewPropertyDirty(BindableProperty styleProperty)
2683 if (dirtyPropertySet.Count == 0)
2688 if (styleProperty.ReturnType.IsGenericType && styleProperty.ReturnType.GetGenericTypeDefinition() == typeof(Selector<>))
2690 return dirtyPropertySet.Contains(styleProperty.PropertyName.Substring(0, styleProperty.PropertyName.Length - 8));
2693 return dirtyPropertySet.Contains(styleProperty.PropertyName);
2697 /// Apply style instance to the view.
2698 /// Basically it sets the bindable property to the value of the bindable property with same name in the style.
2700 [EditorBrowsable(EditorBrowsableState.Never)]
2701 public virtual void ApplyStyle(ViewStyle viewStyle)
2703 if (viewStyle == null || this.viewStyle == viewStyle) return;
2705 this.viewStyle = viewStyle;
2707 if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0)
2713 if (dirtyPropertySet == null)
2715 dirtyPropertySet = new HashSet<string>();
2718 BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView);
2720 if (bindablePropertyOfView == null)
2725 var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count];
2726 viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties);
2728 foreach (var sourceProperty in dirtyStyleProperties)
2730 if (blockSetDirty && IsViewPropertyDirty(sourceProperty))
2732 // Skip applying theme style for a property set by user.
2736 var sourceValue = viewStyle.GetValue(sourceProperty);
2738 if (sourceValue == null)
2743 bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
2745 if (destinationProperty != null)
2747 SetValue(destinationProperty, sourceValue);
2753 /// Used to restore the transition.
2755 [EditorBrowsable(EditorBrowsableState.Never)]
2756 public IList<Transition> TransitionList
2759 } = new List<Transition>();
2762 /// Get whether the View is culled or not.
2763 /// True means that the View is out of the view frustum.
2766 /// Hidden-API (Inhouse-API).
2768 [EditorBrowsable(EditorBrowsableState.Never)]
2774 var pValue = GetProperty(View.Property.Culled);
2775 pValue.Get(out temp);