2 * Copyright(c) 2019 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
33 /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout.
35 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
36 [EditorBrowsable(EditorBrowsableState.Never)]
37 public bool layoutSet = false;
40 /// Flag to allow Layouting to be disabled for Views.
41 /// Once a View has a Layout set then any children added to Views from then on will receive
42 /// automatic Layouts.
44 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
45 [EditorBrowsable(EditorBrowsableState.Never)]
46 public static bool layoutingDisabled{get; set;} = true;
48 private LayoutItem _layout; // Exclusive layout assigned to this View.
50 // List of transitions paired with the condition that uses the transition.
51 private Dictionary<TransitionCondition, TransitionList> _layoutTransitions;
52 private int _widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
53 private int _heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
54 private float _weight = 0.0f; // Weighting of child View in a Layout
55 private MeasureSpecification _measureSpecificationWidth; // Layout width and internal Mode
56 private MeasureSpecification _measureSpecificationHeight; // Layout height and internal Mode
57 private bool _backgroundImageSynchronosLoading = false;
58 private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
59 private string[] transitionNames;
60 private Rectangle backgroundImageBorder;
62 private ViewSelector<ImageShadow> imageShadow;
64 private ViewSelector<Shadow> boxShadow;
66 internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
70 private ViewStyle viewStyle;
71 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
72 [EditorBrowsable(EditorBrowsableState.Never)]
73 public ViewStyle ViewStyle
77 if (null == viewStyle)
79 ApplyStyle(GetViewStyle());
87 /// Creates a new instance of a view.
89 /// <since_tizen> 3 </since_tizen>
90 public View() : this(Interop.View.View_New(), true)
92 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
95 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
96 [EditorBrowsable(EditorBrowsableState.Never)]
97 public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true)
99 this.ViewStyle.CopyFrom(viewStyle);
103 /// Create a new instance of a View with setting the status of shown or hidden.
105 /// <param name="shown">false : Not displayed (hidden), true : displayed (shown)</param>
106 /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
107 [EditorBrowsable(EditorBrowsableState.Never)]
108 public View(bool shown) : this(Interop.View.View_New(), true)
110 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
114 internal View(View uiControl, bool shown = true) : this(Interop.View.new_View__SWIG_1(View.getCPtr(uiControl)), true)
116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
125 this.ViewStyle.CopyFrom(viewStyle);
128 internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
132 PositionUsesPivotPoint = false;
135 _onWindowSendEventCallback = SendViewAddedEventToWindow;
136 this.OnWindowSignal().Connect(_onWindowSendEventCallback);
144 internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true)
146 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154 internal delegate void ControlStateChangesDelegate(View obj, ControlStates state);
155 internal event ControlStateChangesDelegate ControlStateChangeEvent;
157 private ControlStates controlStates;
159 /// Get/Set the control state.
161 /// <since_tizen> 6 </since_tizen>
162 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
163 [EditorBrowsable(EditorBrowsableState.Never)]
164 public ControlStates ControlState
168 return controlStates;
172 if (controlStates != value)
174 controlStates = value;
176 ControlStateChangeEvent?.Invoke(this, value);
178 if (true == OnControlStateChanged(value))
180 foreach (View child in Children)
182 child.ControlState = value;
189 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
190 [EditorBrowsable(EditorBrowsableState.Never)]
191 public bool IsResourcesCreated
195 return Application.Current.IsResourcesCreated;
199 /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
200 [EditorBrowsable(EditorBrowsableState.Never)]
201 public ResourceDictionary XamlResources
205 return Application.Current.XamlResources;
209 Application.Current.XamlResources = value;
214 /// The StyleName, type string.
216 /// <since_tizen> 3 </since_tizen>
217 public string StyleName
221 return (string)GetValue(StyleNameProperty);
225 SetValue(StyleNameProperty, value);
226 NotifyPropertyChanged();
231 /// The mutually exclusive with "backgroundImage" and "background" type Vector4.
234 /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible.
236 /// <since_tizen> 3 </since_tizen>
237 public Color BackgroundColor
241 Color temp = (Color)GetValue(BackgroundColorProperty);
242 return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A);
246 SetValue(BackgroundColorProperty, value);
247 NotifyPropertyChanged();
252 /// The mutually exclusive with "backgroundColor" and "background" type Map.
254 /// <since_tizen> 3 </since_tizen>
255 public string BackgroundImage
259 return (string)GetValue(BackgroundImageProperty);
263 SetValue(BackgroundImageProperty, value);
264 NotifyPropertyChanged();
269 /// Get or set the border of background image.
271 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
272 [EditorBrowsable(EditorBrowsableState.Never)]
273 public Rectangle BackgroundImageBorder
277 return (Rectangle)GetValue(BackgroundImageBorderProperty);
281 SetValue(BackgroundImageBorderProperty, value);
282 NotifyPropertyChanged();
287 /// The background of view.
289 /// <since_tizen> 3 </since_tizen>
290 public Tizen.NUI.PropertyMap Background
294 return (PropertyMap)GetValue(BackgroundProperty);
298 SetValue(BackgroundProperty, value);
299 NotifyPropertyChanged();
304 /// Describes a shadow as an image for a View.
305 /// It is null by default.
308 /// The mutually exclusive with "BoxShadow".
310 [EditorBrowsable(EditorBrowsableState.Never)]
311 public ImageShadow ImageShadow
315 var value = (ImageShadow)GetValue(ImageShadowProperty);
316 return value == null ? null : new ImageShadow(value, OnImageShadowChanged);
320 SetValue(ImageShadowProperty, value);
321 NotifyPropertyChanged();
326 /// Describes a box shaped shadow drawing for a View.
327 /// It is null by default.
330 /// The mutually exclusive with "ImageShadow".
332 [EditorBrowsable(EditorBrowsableState.Never)]
333 public Shadow BoxShadow
337 var value = (Shadow)GetValue(BoxShadowProperty);
338 return value == null ? null : new Shadow(value, OnBoxShadowChanged);
342 SetValue(BoxShadowProperty, value);
343 NotifyPropertyChanged();
348 /// The current state of the view.
350 /// <since_tizen> 3 </since_tizen>
355 return (States)GetValue(StateProperty);
359 SetValue(StateProperty, value);
360 NotifyPropertyChanged();
365 /// The current sub state of the view.
367 /// <since_tizen> 3 </since_tizen>
368 public States SubState
372 return (States)GetValue(SubStateProperty);
376 SetValue(SubStateProperty, value);
377 NotifyPropertyChanged();
382 /// Displays a tooltip
384 /// <since_tizen> 3 </since_tizen>
385 public Tizen.NUI.PropertyMap Tooltip
389 return (PropertyMap)GetValue(TooltipProperty);
393 SetValue(TooltipProperty, value);
394 NotifyPropertyChanged();
399 /// Displays a tooltip as a text.
401 /// <since_tizen> 3 </since_tizen>
402 public string TooltipText
406 SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value));
407 NotifyPropertyChanged();
412 /// The Child property of FlexContainer.<br />
413 /// The proportion of the free space in the container, the flex item will receive.<br />
414 /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.<br />
416 /// <since_tizen> 3 </since_tizen>
421 return (float)GetValue(FlexProperty);
425 SetValue(FlexProperty, value);
426 NotifyPropertyChanged();
431 /// The Child property of FlexContainer.<br />
432 /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.<br />
434 /// <since_tizen> 3 </since_tizen>
439 return (int)GetValue(AlignSelfProperty);
443 SetValue(AlignSelfProperty, value);
444 NotifyPropertyChanged();
449 /// The Child property of FlexContainer.<br />
450 /// The space around the flex item.<br />
453 /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible.
455 /// <since_tizen> 3 </since_tizen>
456 public Vector4 FlexMargin
460 Vector4 temp = (Vector4)GetValue(FlexMarginProperty);
461 return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W);
465 SetValue(FlexMarginProperty, value);
466 NotifyPropertyChanged();
471 /// The top-left cell this child occupies, if not set, the first available cell is used.
474 /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible.
476 /// <since_tizen> 3 </since_tizen>
477 public Vector2 CellIndex
481 Vector2 temp = (Vector2)GetValue(CellIndexProperty);
482 return new Vector2(OnCellIndexChanged, temp.X, temp.Y);
486 SetValue(CellIndexProperty, value);
487 NotifyPropertyChanged();
492 /// The number of rows this child occupies, if not set, the default value is 1.
494 /// <since_tizen> 3 </since_tizen>
499 return (float)GetValue(RowSpanProperty);
503 SetValue(RowSpanProperty, value);
504 NotifyPropertyChanged();
509 /// The number of columns this child occupies, if not set, the default value is 1.
511 /// <since_tizen> 3 </since_tizen>
512 public float ColumnSpan
516 return (float)GetValue(ColumnSpanProperty);
520 SetValue(ColumnSpanProperty, value);
521 NotifyPropertyChanged();
526 /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'.
528 /// <since_tizen> 3 </since_tizen>
529 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment
533 return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty);
537 SetValue(CellHorizontalAlignmentProperty, value);
538 NotifyPropertyChanged();
543 /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'.
545 /// <since_tizen> 3 </since_tizen>
546 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment
550 return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty);
554 SetValue(CellVerticalAlignmentProperty, value);
555 NotifyPropertyChanged();
560 /// The left focusable view.<br />
561 /// This will return null if not set.<br />
562 /// This will also return null if the specified left focusable view is not on a window.<br />
564 /// <since_tizen> 3 </since_tizen>
565 public View LeftFocusableView
567 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
570 return (View)GetValue(LeftFocusableViewProperty);
574 SetValue(LeftFocusableViewProperty, value);
575 NotifyPropertyChanged();
580 /// The right focusable view.<br />
581 /// This will return null if not set.<br />
582 /// This will also return null if the specified right focusable view is not on a window.<br />
584 /// <since_tizen> 3 </since_tizen>
585 public View RightFocusableView
587 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
590 return (View)GetValue(RightFocusableViewProperty);
594 SetValue(RightFocusableViewProperty, value);
595 NotifyPropertyChanged();
600 /// The up focusable view.<br />
601 /// This will return null if not set.<br />
602 /// This will also return null if the specified up focusable view is not on a window.<br />
604 /// <since_tizen> 3 </since_tizen>
605 public View UpFocusableView
607 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
610 return (View)GetValue(UpFocusableViewProperty);
614 SetValue(UpFocusableViewProperty, value);
615 NotifyPropertyChanged();
620 /// The down focusable view.<br />
621 /// This will return null if not set.<br />
622 /// This will also return null if the specified down focusable view is not on a window.<br />
624 /// <since_tizen> 3 </since_tizen>
625 public View DownFocusableView
627 // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa.
630 return (View)GetValue(DownFocusableViewProperty);
634 SetValue(DownFocusableViewProperty, value);
635 NotifyPropertyChanged();
640 /// Whether the view should be focusable by keyboard navigation.
642 /// <since_tizen> 3 </since_tizen>
643 public bool Focusable
647 SetValue(FocusableProperty, value);
648 NotifyPropertyChanged();
652 return (bool)GetValue(FocusableProperty);
657 /// Retrieves the position of the view.<br />
658 /// The coordinates are relative to the view's parent.<br />
660 /// <since_tizen> 3 </since_tizen>
661 public Position CurrentPosition
665 return GetCurrentPosition();
670 /// Sets the size of a view for the width and the height.<br />
671 /// Geometry can be scaled to fit within this area.<br />
672 /// This does not interfere with the view's scale factor.<br />
673 /// The views default depth is the minimum of width and height.<br />
676 /// This NUI object (Size2D) typed property can be configured by multiple cascade setting. <br />
677 /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ). <br />
679 /// <since_tizen> 3 </since_tizen>
684 Size2D temp = (Size2D)GetValue(Size2DProperty);
685 return new Size2D(OnSize2DChanged, temp.Width, temp.Height);
689 sizeSetExplicitly = value; // Store size set by API, will be used in place of NaturalSize if not set.
690 SetValue(Size2DProperty, value);
691 // Set Specification so when layouts measure this View it matches the value set here.
692 // All Views are currently Layouts.
693 MeasureSpecificationWidth = new MeasureSpecification(new LayoutLength(value.Width), MeasureSpecification.ModeType.Exactly);
694 MeasureSpecificationHeight = new MeasureSpecification(new LayoutLength(value.Height), MeasureSpecification.ModeType.Exactly);
695 _widthPolicy = value.Width;
696 _heightPolicy = value.Height;
697 _layout?.RequestLayout();
698 NotifyPropertyChanged();
703 /// Retrieves the size of the view.<br />
704 /// The coordinates are relative to the view's parent.<br />
706 /// <since_tizen> 3 </since_tizen>
707 public Size2D CurrentSize
711 return GetCurrentSize();
716 /// Retrieves and sets the view's opacity.<br />
718 /// <since_tizen> 3 </since_tizen>
723 return (float)GetValue(OpacityProperty);
727 SetValue(OpacityProperty, value);
728 NotifyPropertyChanged();
733 /// Sets the position of the view for X and Y.<br />
734 /// By default, sets the position vector between the parent origin and the pivot point (default).<br />
735 /// If the position inheritance is disabled, sets the world position.<br />
738 /// This NUI object (Position2D) typed property can be configured by multiple cascade setting. <br />
739 /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ). <br />
741 /// <since_tizen> 3 </since_tizen>
742 public Position2D Position2D
746 Position2D temp = (Position2D)GetValue(Position2DProperty);
747 return new Position2D(OnPosition2DChanged, temp.X, temp.Y);
751 SetValue(Position2DProperty, value);
752 NotifyPropertyChanged();
757 /// Retrieves the screen postion of the view.<br />
759 /// <since_tizen> 3 </since_tizen>
760 public Vector2 ScreenPosition
764 Vector2 temp = new Vector2(0.0f, 0.0f);
765 GetProperty(View.Property.SCREEN_POSITION).Get(temp);
771 /// Determines whether the pivot point should be used to determine the position of the view.
772 /// This is true by default.
774 /// <remarks>If false, then the top-left of the view is used for the position.
775 /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position.
777 /// <since_tizen> 3 </since_tizen>
778 public bool PositionUsesPivotPoint
782 return (bool)GetValue(PositionUsesPivotPointProperty);
786 SetValue(PositionUsesPivotPointProperty, value);
787 NotifyPropertyChanged();
792 /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead!
794 /// <since_tizen> 3 </since_tizen>
795 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " +
797 "View view = new View(); " +
798 "view.PivotPoint = PivotPoint.Center; " +
799 "view.PositionUsesPivotPoint = true;" +
800 " Deprecated in API5: Will be removed in API8")]
801 [EditorBrowsable(EditorBrowsableState.Never)]
802 public bool PositionUsesAnchorPoint
807 GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp);
812 SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
813 NotifyPropertyChanged();
818 /// Queries whether the view is connected to the stage.<br />
819 /// When a view is connected, it will be directly or indirectly parented to the root view.<br />
821 /// <since_tizen> 3 </since_tizen>
822 public bool IsOnWindow
831 /// Gets the depth in the hierarchy for the view.
833 /// <since_tizen> 3 </since_tizen>
834 public int HierarchyDepth
838 return GetHierarchyDepth();
843 /// Sets the sibling order of the view so the depth position can be defined within the same parent.
846 /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0.
847 /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order.
848 /// The values set by this property will likely change.
850 /// <since_tizen> 3 </since_tizen>
851 public int SiblingOrder
855 return (int)GetValue(SiblingOrderProperty);
859 SetValue(SiblingOrderProperty, value);
860 NotifyPropertyChanged();
865 /// Returns the natural size of the view.
868 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
870 /// <since_tizen> 5 </since_tizen>
871 public Vector3 NaturalSize
875 Vector3 ret = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
876 if (NDalicPINVOKE.SWIGPendingException.Pending)
877 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
883 /// Returns the natural size (Size2D) of the view.
886 /// Deriving classes stipulate the natural size and by default a view has a zero natural size.
888 /// <since_tizen> 4 </since_tizen>
889 public Size2D NaturalSize2D
893 Vector3 temp = new Vector3(Interop.Actor.Actor_GetNaturalSize(swigCPtr), true);
894 if (NDalicPINVOKE.SWIGPendingException.Pending)
895 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
897 return new Size2D((int)temp.Width, (int)temp.Height);
902 /// Gets or sets the origin of a view within its parent's area.<br />
903 /// 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 />
904 /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
905 /// A view's position is the distance between this origin and the view's anchor-point.<br />
907 /// <pre>The view has been initialized.</pre>
908 /// <since_tizen> 3 </since_tizen>
909 public Position ParentOrigin
913 Position tmp = (Position)GetValue(ParentOriginProperty);
914 return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z);
918 SetValue(ParentOriginProperty, value);
919 NotifyPropertyChanged();
924 /// Gets or sets the anchor-point of a view.<br />
925 /// 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 />
926 /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
927 /// A view position is the distance between its parent-origin and this anchor-point.<br />
928 /// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.<br />
929 /// <pre>The view has been initialized.</pre>
932 /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible.
934 /// <since_tizen> 3 </since_tizen>
935 public Position PivotPoint
939 Position tmp = (Position)GetValue(PivotPointProperty);
940 return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z);
944 SetValue(PivotPointProperty, value);
945 NotifyPropertyChanged();
950 /// Gets or sets the size width of the view.
954 /// Animatable - This property can be animated using <c>Animation</c> class.
957 /// <since_tizen> 3 </since_tizen>
958 public float SizeWidth
962 return (float)GetValue(SizeWidthProperty);
966 SetValue(SizeWidthProperty, value);
967 WidthSpecification = (int)Math.Ceiling(value);
968 NotifyPropertyChanged();
973 /// Gets or sets the size height of the view.
977 /// Animatable - This property can be animated using <c>Animation</c> class.
980 /// <since_tizen> 3 </since_tizen>
981 public float SizeHeight
985 return (float)GetValue(SizeHeightProperty);
989 SetValue(SizeHeightProperty, value);
990 HeightSpecification = (int)Math.Ceiling(value);
991 NotifyPropertyChanged();
996 /// Gets or sets the position of the view.<br />
997 /// By default, sets the position vector between the parent origin and pivot point (default).<br />
998 /// If the position inheritance is disabled, sets the world position.<br />
1002 /// Animatable - This property can be animated using <c>Animation</c> class.
1004 /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible.
1006 /// <since_tizen> 3 </since_tizen>
1007 public Position Position
1011 Position tmp = (Position)GetValue(PositionProperty);
1012 return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z);
1016 SetValue(PositionProperty, value);
1017 NotifyPropertyChanged();
1022 /// Gets or sets the position X of the view.
1026 /// Animatable - This property can be animated using <c>Animation</c> class.
1029 /// <since_tizen> 3 </since_tizen>
1030 public float PositionX
1034 return (float)GetValue(PositionXProperty);
1038 SetValue(PositionXProperty, value);
1039 NotifyPropertyChanged();
1044 /// Gets or sets the position Y of the view.
1048 /// Animatable - This property can be animated using <c>Animation</c> class.
1051 /// <since_tizen> 3 </since_tizen>
1052 public float PositionY
1056 return (float)GetValue(PositionYProperty);
1060 SetValue(PositionYProperty, value);
1061 NotifyPropertyChanged();
1066 /// Gets or sets the position Z of the view.
1070 /// Animatable - This property can be animated using <c>Animation</c> class.
1073 /// <since_tizen> 3 </since_tizen>
1074 public float PositionZ
1078 return (float)GetValue(PositionZProperty);
1082 SetValue(PositionZProperty, value);
1083 NotifyPropertyChanged();
1088 /// Gets or sets the world position of the view.
1090 /// <since_tizen> 3 </since_tizen>
1091 public Vector3 WorldPosition
1095 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1096 GetProperty(View.Property.WORLD_POSITION).Get(temp);
1102 /// Gets or sets the orientation of the view.<br />
1103 /// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.<br />
1107 /// This is an asynchronous method.
1110 /// Animatable - This property can be animated using <c>Animation</c> class.
1113 /// <since_tizen> 3 </since_tizen>
1114 public Rotation Orientation
1118 return (Rotation)GetValue(OrientationProperty);
1122 SetValue(OrientationProperty, value);
1123 NotifyPropertyChanged();
1128 /// Gets or sets the world orientation of the view.<br />
1130 /// <since_tizen> 3 </since_tizen>
1131 public Rotation WorldOrientation
1135 Rotation temp = new Rotation();
1136 GetProperty(View.Property.WORLD_ORIENTATION).Get(temp);
1142 /// Gets or sets the scale factor applied to the view.<br />
1146 /// Animatable - This property can be animated using <c>Animation</c> class.
1148 /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible.
1150 /// <since_tizen> 3 </since_tizen>
1151 public Vector3 Scale
1155 Vector3 temp = (Vector3)GetValue(ScaleProperty);
1156 return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z);
1160 SetValue(ScaleProperty, value);
1161 NotifyPropertyChanged();
1166 /// Gets or sets the scale X factor applied to the view.
1170 /// Animatable - This property can be animated using <c>Animation</c> class.
1173 /// <since_tizen> 3 </since_tizen>
1178 return (float)GetValue(ScaleXProperty);
1182 SetValue(ScaleXProperty, value);
1183 NotifyPropertyChanged();
1188 /// Gets or sets the scale Y factor applied to the view.
1192 /// Animatable - This property can be animated using <c>Animation</c> class.
1195 /// <since_tizen> 3 </since_tizen>
1200 return (float)GetValue(ScaleYProperty);
1204 SetValue(ScaleYProperty, value);
1205 NotifyPropertyChanged();
1210 /// Gets or sets the scale Z factor applied to the view.
1214 /// Animatable - This property can be animated using <c>Animation</c> class.
1217 /// <since_tizen> 3 </since_tizen>
1222 return (float)GetValue(ScaleZProperty);
1226 SetValue(ScaleZProperty, value);
1227 NotifyPropertyChanged();
1232 /// Gets the world scale of the view.
1234 /// <since_tizen> 3 </since_tizen>
1235 public Vector3 WorldScale
1239 Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f);
1240 GetProperty(View.Property.WORLD_SCALE).Get(temp);
1246 /// Retrieves the visibility flag of the view.
1250 /// If the view is not visible, then the view and its children will not be rendered.
1251 /// 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.
1254 /// Animatable - This property can be animated using <c>Animation</c> class.
1257 /// <since_tizen> 3 </since_tizen>
1258 public bool Visibility
1263 GetProperty(View.Property.VISIBLE).Get(out temp);
1269 /// Gets the view's world color.
1271 /// <since_tizen> 3 </since_tizen>
1272 public Vector4 WorldColor
1276 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1277 GetProperty(View.Property.WORLD_COLOR).Get(temp);
1283 /// Gets or sets the view's name.
1285 /// <since_tizen> 3 </since_tizen>
1290 return (string)GetValue(NameProperty);
1294 SetValue(NameProperty, value);
1295 NotifyPropertyChanged();
1300 /// Get the number of children held by the view.
1302 /// <since_tizen> 3 </since_tizen>
1303 public new uint ChildCount
1307 return GetChildCount();
1312 /// Gets the view's ID.
1315 /// <since_tizen> 3 </since_tizen>
1325 /// Gets or sets the status of whether the view should emit touch or hover signals.
1327 /// <since_tizen> 3 </since_tizen>
1328 public bool Sensitive
1332 return (bool)GetValue(SensitiveProperty);
1336 SetValue(SensitiveProperty, value);
1337 NotifyPropertyChanged();
1342 /// 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.
1344 /// <since_tizen> 3 </since_tizen>
1345 public bool LeaveRequired
1349 return (bool)GetValue(LeaveRequiredProperty);
1353 SetValue(LeaveRequiredProperty, value);
1354 NotifyPropertyChanged();
1359 /// Gets or sets the status of whether a child view inherits it's parent's orientation.
1361 /// <since_tizen> 3 </since_tizen>
1362 public bool InheritOrientation
1366 return (bool)GetValue(InheritOrientationProperty);
1370 SetValue(InheritOrientationProperty, value);
1371 NotifyPropertyChanged();
1376 /// Gets or sets the status of whether a child view inherits it's parent's scale.
1378 /// <since_tizen> 3 </since_tizen>
1379 public bool InheritScale
1383 return (bool)GetValue(InheritScaleProperty);
1387 SetValue(InheritScaleProperty, value);
1388 NotifyPropertyChanged();
1393 /// Gets or sets the status of how the view and its children should be drawn.<br />
1394 /// Not all views are renderable, but DrawMode can be inherited from any view.<br />
1395 /// 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 />
1396 /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.<br />
1397 /// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.<br />
1398 /// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.<br />
1400 /// <since_tizen> 3 </since_tizen>
1401 public DrawModeType DrawMode
1405 return (DrawModeType)GetValue(DrawModeProperty);
1409 SetValue(DrawModeProperty, value);
1410 NotifyPropertyChanged();
1415 /// Gets or sets the relative to parent size factor of the view.<br />
1416 /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
1417 /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
1420 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
1422 /// <since_tizen> 3 </since_tizen>
1423 public Vector3 SizeModeFactor
1427 Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty);
1428 return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z);
1432 SetValue(SizeModeFactorProperty, value);
1433 NotifyPropertyChanged();
1438 /// Gets or sets the width resize policy to be used.
1440 /// <since_tizen> 3 </since_tizen>
1441 public ResizePolicyType WidthResizePolicy
1445 return (ResizePolicyType)GetValue(WidthResizePolicyProperty);
1449 SetValue(WidthResizePolicyProperty, value);
1450 // Match ResizePolicy to new Layouting.
1451 // Parent relative policies can not be mapped at this point as parent size unknown.
1454 case ResizePolicyType.UseNaturalSize:
1456 WidthSpecification = LayoutParamPolicies.WrapContent;
1459 case ResizePolicyType.FillToParent:
1461 WidthSpecification = LayoutParamPolicies.MatchParent;
1464 case ResizePolicyType.FitToChildren:
1466 WidthSpecification = LayoutParamPolicies.WrapContent;
1472 NotifyPropertyChanged();
1477 /// Gets or sets the height resize policy to be used.
1479 /// <since_tizen> 3 </since_tizen>
1480 public ResizePolicyType HeightResizePolicy
1484 return (ResizePolicyType)GetValue(HeightResizePolicyProperty);
1488 SetValue(HeightResizePolicyProperty, value);
1489 // Match ResizePolicy to new Layouting.
1490 // Parent relative policies can not be mapped at this point as parent size unknown.
1493 case ResizePolicyType.UseNaturalSize:
1495 HeightSpecification = LayoutParamPolicies.WrapContent;
1498 case ResizePolicyType.FillToParent:
1500 HeightSpecification = LayoutParamPolicies.MatchParent;
1503 case ResizePolicyType.FitToChildren:
1505 HeightSpecification = LayoutParamPolicies.WrapContent;
1511 NotifyPropertyChanged();
1516 /// Gets or sets the policy to use when setting size with size negotiation.<br />
1517 /// Defaults to SizeScalePolicyType.UseSizeSet.<br />
1519 /// <since_tizen> 3 </since_tizen>
1520 public SizeScalePolicyType SizeScalePolicy
1524 return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty);
1528 SetValue(SizeScalePolicyProperty, value);
1529 NotifyPropertyChanged();
1534 /// Gets or sets the status of whether the width size is dependent on the height size.
1536 /// <since_tizen> 3 </since_tizen>
1537 public bool WidthForHeight
1541 return (bool)GetValue(WidthForHeightProperty);
1545 SetValue(WidthForHeightProperty, value);
1546 NotifyPropertyChanged();
1551 /// Gets or sets the status of whether the height size is dependent on the width size.
1553 /// <since_tizen> 3 </since_tizen>
1554 public bool HeightForWidth
1558 return (bool)GetValue(HeightForWidthProperty);
1562 SetValue(HeightForWidthProperty, value);
1563 NotifyPropertyChanged();
1568 /// Gets or sets the padding for use in layout.
1571 /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible.
1573 /// <since_tizen> 5 </since_tizen>
1574 public Extents Padding
1578 // If View has a Layout then padding in stored in the base Layout class
1581 return Layout.Padding;
1585 Extents temp = (Extents)GetValue(PaddingProperty);
1586 return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1588 // Two return points to prevent creating a zeroed Extent native object before assignment
1592 Extents padding = value;
1595 // Layout set so store Padding in LayoutItem instead of in View.
1596 // If View stores the Padding value then Legacy Size Negotiation will overwrite
1597 // the position and sizes measure in the Layouting.
1598 Layout.Padding = value;
1599 // If Layout is a LayoutItem then it could be a View that handles it's own padding.
1600 // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths.
1601 if( Layout.GetType() != typeof(LayoutItem)) // If a Layout container of some kind.
1603 padding = new Extents(0,0,0,0); // Reset value stored in View.
1605 _layout?.RequestLayout();
1607 SetValue(PaddingProperty, padding);
1608 NotifyPropertyChanged();
1609 _layout?.RequestLayout();
1614 /// Gets or sets the minimum size the view can be assigned in size negotiation.
1617 /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible.
1619 /// <since_tizen> 3 </since_tizen>
1620 public Size2D MinimumSize
1624 Size2D tmp = (Size2D)GetValue(MinimumSizeProperty);
1625 return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height);
1629 if (_layout != null)
1631 // Note: it only works if minimum size is >= than natural size.
1632 // To force the size it should be done through the width&height spec or Size2D.
1633 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width);
1634 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height);
1635 _layout.RequestLayout();
1637 SetValue(MinimumSizeProperty, value);
1638 NotifyPropertyChanged();
1643 /// Gets or sets the maximum size the view can be assigned in size negotiation.
1646 /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible.
1648 /// <since_tizen> 3 </since_tizen>
1649 public Size2D MaximumSize
1653 Size2D tmp = (Size2D)GetValue(MaximumSizeProperty);
1654 return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height);
1658 // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout.
1659 // MATCH_PARENT spec + parent container size can be used to limit
1660 if (_layout != null)
1662 // Note: it only works if minimum size is >= than natural size.
1663 // To force the size it should be done through the width&height spec or Size2D.
1664 _layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Width);
1665 _layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Height);
1666 _layout.RequestLayout();
1668 SetValue(MaximumSizeProperty, value);
1669 NotifyPropertyChanged();
1674 /// Gets or sets whether a child view inherits it's parent's position.<br />
1675 /// Default is to inherit.<br />
1676 /// 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 />
1678 /// <since_tizen> 3 </since_tizen>
1679 public bool InheritPosition
1683 return (bool)GetValue(InheritPositionProperty);
1687 SetValue(InheritPositionProperty, value);
1688 NotifyPropertyChanged();
1693 /// Gets or sets the clipping behavior (mode) of it's children.
1695 /// <since_tizen> 3 </since_tizen>
1696 public ClippingModeType ClippingMode
1700 return (ClippingModeType)GetValue(ClippingModeProperty);
1704 SetValue(ClippingModeProperty, value);
1705 NotifyPropertyChanged();
1710 /// Gets the number of renderers held by the view.
1712 /// <since_tizen> 3 </since_tizen>
1713 public uint RendererCount
1717 return GetRendererCount();
1722 /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead!
1725 /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible.
1727 /// <since_tizen> 3 </since_tizen>
1728 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " +
1730 "View view = new View(); " +
1731 "view.PivotPoint = PivotPoint.Center; " +
1732 "view.PositionUsesPivotPoint = true;")]
1733 [EditorBrowsable(EditorBrowsableState.Never)]
1734 public Position AnchorPoint
1738 Position temp = new Position(0.0f, 0.0f, 0.0f);
1739 GetProperty(View.Property.ANCHOR_POINT).Get(temp);
1740 return new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z);
1744 SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value));
1745 NotifyPropertyChanged();
1750 /// Sets the size of a view for the width, the height and the depth.<br />
1751 /// Geometry can be scaled to fit within this area.<br />
1752 /// This does not interfere with the view's scale factor.<br />
1753 /// The views default depth is the minimum of width and height.<br />
1757 /// Animatable - This property can be animated using <c>Animation</c> class.
1759 /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible.
1761 /// <since_tizen> 5 </since_tizen>
1766 Size tmp = (Size)GetValue(SizeProperty);
1767 return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth);
1771 SetValue(SizeProperty, value);
1772 // Set Specification so when layouts measure this View it matches the value set here.
1773 // All Views are currently Layouts.
1774 WidthSpecification = (int)Math.Ceiling(value.Width);
1775 HeightSpecification = (int)Math.Ceiling(value.Height);
1776 NotifyPropertyChanged();
1781 /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead!
1783 /// <since_tizen> 3 </since_tizen>
1784 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " +
1786 "Container parent = view.GetParent(); " +
1787 "View view = parent as View;")]
1788 [EditorBrowsable(EditorBrowsableState.Never)]
1789 public new View Parent
1794 IntPtr cPtr = Interop.Actor.Actor_GetParent(swigCPtr);
1795 HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
1796 BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle);
1798 if (basehandle is Layer layer)
1800 ret = new View(Layer.getCPtr(layer).Handle, false);
1801 NUILog.Error("This Parent property is deprecated, shoud do not be used");
1805 ret = basehandle as View;
1808 Interop.BaseHandle.delete_BaseHandle(CPtr);
1809 CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
1811 if (NDalicPINVOKE.SWIGPendingException.Pending)
1812 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1818 /// Gets/Sets whether inherit parent's the layout Direction.
1820 /// <since_tizen> 4 </since_tizen>
1821 public bool InheritLayoutDirection
1825 return (bool)GetValue(InheritLayoutDirectionProperty);
1829 SetValue(InheritLayoutDirectionProperty, value);
1830 NotifyPropertyChanged();
1835 /// Gets/Sets the layout Direction.
1837 /// <since_tizen> 4 </since_tizen>
1838 public ViewLayoutDirectionType LayoutDirection
1842 return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty);
1846 SetValue(LayoutDirectionProperty, value);
1847 NotifyPropertyChanged();
1848 _layout?.RequestLayout();
1853 /// Gets or sets the Margin for use in layout.
1856 /// Margin property is supported by Layout algorithms and containers.
1857 /// Please Set Layout if you want to use Margin property.
1858 /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible.
1860 /// <since_tizen> 4 </since_tizen>
1861 public Extents Margin
1865 // If View has a Layout then margin is stored in Layout.
1868 return Layout.Margin;
1872 // If Layout not set then return margin stored in View.
1873 Extents temp = (Extents)GetValue(MarginProperty);
1874 return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
1876 // Two return points to prevent creating a zeroed Extent native object before assignment
1882 // Layout set so store Margin in LayoutItem instead of View.
1883 // If View stores the Margin too then the Legacy Size Negotiation will
1884 // overwrite the position and size values measured in the Layouting.
1885 Layout.Margin = value;
1886 SetValue(MarginProperty, new Extents(0,0,0,0));
1887 _layout?.RequestLayout();
1891 SetValue(MarginProperty, value);
1893 NotifyPropertyChanged();
1894 _layout?.RequestLayout();
1899 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1901 /// <since_tizen> 6 </since_tizen>
1902 public int WidthSpecification
1906 return _widthPolicy;
1910 _widthPolicy = value;
1911 if (_widthPolicy >= 0)
1913 _measureSpecificationWidth = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1915 if(_heightPolicy>=0) // Policy an exact value
1917 Size2D.Width = _widthPolicy;
1921 // Store _heightPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1922 // Size2D height will store the specification value (negative number) this will then be applied to the
1923 // HeightSpecification when the Size2D callback is invoked.
1924 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1927 _layout?.RequestLayout();
1932 /// The required policy for this dimension, LayoutParamPolicies enum or exact value.
1934 /// <since_tizen> 6 </since_tizen>
1935 public int HeightSpecification
1939 return _heightPolicy;
1943 _heightPolicy = value;
1944 if (_heightPolicy >= 0)
1946 _measureSpecificationHeight = new MeasureSpecification( new LayoutLength(value), MeasureSpecification.ModeType.Exactly );
1948 if(_widthPolicy>=0) // Policy an exact value
1950 Size2D.Height = _heightPolicy;
1954 // Store widthPolicy in the Size2D memember as will be reset to 0 by a Size2D callback.
1955 // Size2D height will store the specification value (negative number) this will then be applied to the
1956 // HeightSpecification when the Size2D callback is invoked.
1957 Size2D = new Size2D(_widthPolicy,_heightPolicy);
1961 _layout?.RequestLayout();
1966 /// Gets the List of transitions for this View.
1968 /// <since_tizen> 6 </since_tizen>
1969 public Dictionary<TransitionCondition, TransitionList> LayoutTransitions
1973 if (_layoutTransitions == null)
1975 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
1977 return _layoutTransitions;
1982 /// Set a layout transitions for this View.
1985 /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View.
1987 /// <since_tizen> 6 </since_tizen>
1988 public LayoutTransition LayoutTransition
1992 if (_layoutTransitions == null)
1994 _layoutTransitions = new Dictionary<TransitionCondition, TransitionList>();
1996 LayoutTransitionsHelper.AddTransitionForCondition(_layoutTransitions,value.Condition,value, true);
1998 AttachTransitionsToChildren(value);
2003 /// Deprecated in API5; Will be removed in API8. Please use Padding instead.
2006 /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible.
2008 /// <since_tizen> 4 </since_tizen>
2009 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")]
2010 [EditorBrowsable(EditorBrowsableState.Never)]
2011 public Extents PaddingEX
2015 Extents temp = new Extents(0, 0, 0, 0);
2016 GetProperty(View.Property.PADDING).Get(temp);
2017 return new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom);
2021 SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value));
2022 NotifyPropertyChanged();
2023 _layout?.RequestLayout();
2027 /// <since_tizen> 6 </since_tizen>
2028 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2029 [EditorBrowsable(EditorBrowsableState.Never)]
2030 public Style XamlStyle
2034 return (Style)GetValue(XamlStyleProperty);
2038 SetValue(XamlStyleProperty, value);
2043 /// The Color of View. This is an RGBA value.
2047 /// Animatable - This property can be animated using <c>Animation</c> class.
2049 /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible.
2051 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2052 [EditorBrowsable(EditorBrowsableState.Never)]
2057 Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
2058 GetProperty(Interop.ActorProperty.Actor_Property_COLOR_get()).Get(temp);
2059 return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A);
2068 /// Set the layout on this View. Replaces any existing Layout.
2070 /// <since_tizen> 6 </since_tizen>
2071 public LayoutItem Layout
2079 // Do nothing if layout provided is already set on this View.
2080 if (value == _layout)
2085 Log.Info("NUI", "Setting Layout on:" + Name + "\n");
2086 layoutingDisabled = false;
2089 // If new layout being set already has a owner then that owner receives a replacement default layout.
2090 // First check if the layout to be set already has a owner.
2091 if (value?.Owner != null)
2093 // Previous owner of the layout gets a default layout as a replacement.
2094 value.Owner.Layout = new LayoutGroup();
2096 // Copy Margin and Padding to replacement LayoutGroup.
2097 value.Owner.Layout.Margin = value.Margin;
2098 value.Owner.Layout.Padding = value.Padding;
2101 // Copy Margin and Padding to new layout being set or restore padding and margin back to
2102 // View if no replacement. Previously margin and padding values would have been moved from
2103 // the View to the layout.
2104 if (_layout != null ) // Existing layout
2108 // Existing layout being replaced so copy over margin and padding values.
2109 value.Margin = _layout.Margin;
2110 value.Padding = _layout.Padding;
2114 // Layout not being replaced so restore margin and padding to View.
2115 SetValue(MarginProperty, _layout.Margin);
2116 SetValue(PaddingProperty, _layout.Padding);
2117 NotifyPropertyChanged();
2122 // First Layout to be added to the View hence copy
2124 // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View)
2127 if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0)
2129 // If View already has a margin set then store it in Layout instead.
2130 value.Margin = Margin;
2131 SetValue(MarginProperty, new Extents(0,0,0,0));
2132 NotifyPropertyChanged();
2135 if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0)
2137 // If View already has a padding set then store it in Layout instead.
2138 value.Padding = Padding;
2139 SetValue(PaddingProperty, new Extents(0,0,0,0));
2140 NotifyPropertyChanged();
2145 // Remove existing layout from it's parent layout group.
2146 _layout?.Unparent();
2148 // Set layout to this view
2154 /// The weight of the View, used to share available space in a layout with siblings.
2156 /// <since_tizen> 6 </since_tizen>
2166 _layout?.RequestLayout();
2171 /// Whether to load the BackgroundImage synchronously.
2172 /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously.
2173 /// Note: For Normal Quad images only.
2175 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
2176 [EditorBrowsable(EditorBrowsableState.Never)]
2177 public bool BackgroundImageSynchronosLoading
2181 return _backgroundImageSynchronosLoading;
2185 _backgroundImageSynchronosLoading = value;
2188 Background.Find(Visual.Property.Type)?.Get(out visualType);
2189 if (visualType == (int)Visual.Type.Image)
2191 Background.Find(ImageVisualProperty.URL)?.Get(out bgUrl);
2194 if (bgUrl.Length != 0)
2196 PropertyMap bgMap = this.Background;
2197 bgMap.Add("synchronousLoading", new PropertyValue(_backgroundImageSynchronosLoading));
2203 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2204 [EditorBrowsable(EditorBrowsableState.Never)]
2205 public Vector2 UpdateSizeHint
2209 return (Vector2)GetValue(UpdateSizeHintProperty);
2213 SetValue(UpdateSizeHintProperty, value);
2214 NotifyPropertyChanged();
2218 /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
2219 [EditorBrowsable(EditorBrowsableState.Never)]
2220 public string[] TransitionNames
2224 return transitionNames;
2228 transitionNames = value;
2234 /// Get Style, it is abstract function and must be override.
2236 /// <since_tizen> 6 </since_tizen>
2237 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2238 [EditorBrowsable(EditorBrowsableState.Never)]
2239 protected virtual ViewStyle GetViewStyle()
2241 return new ViewStyle();
2244 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2245 [EditorBrowsable(EditorBrowsableState.Never)]
2246 protected virtual bool OnControlStateChanged(ControlStates currentState)
2248 //If need to apply the state to all child, return true;
2251 internal static readonly BindableProperty BackgroundImageSelectorProperty = BindableProperty.Create("BackgroundImageSelector", typeof(Selector<string>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2253 var view = (View)bindable;
2254 view.backgroundImageSelector.Clone((Selector<string>)newValue);
2256 defaultValueCreator: (bindable) =>
2258 var view = (View)bindable;
2259 return view.backgroundImageSelector;
2261 private TriggerableSelector<string> _backgroundImageSelector;
2262 private TriggerableSelector<string> backgroundImageSelector
2266 if (null == _backgroundImageSelector)
2268 _backgroundImageSelector = new TriggerableSelector<string>(this, BackgroundImageProperty);
2270 return _backgroundImageSelector;
2273 internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2275 var view = (View)bindable;
2276 view.backgroundColorSelector.Clone((Selector<Color>)newValue);
2278 defaultValueCreator: (bindable) =>
2280 var view = (View)bindable;
2281 return view.backgroundColorSelector;
2283 private TriggerableSelector<Color> _backgroundColorSelector;
2284 private TriggerableSelector<Color> backgroundColorSelector
2288 if (null == _backgroundColorSelector)
2290 _backgroundColorSelector = new TriggerableSelector<Color>(this, BackgroundColorProperty);
2292 return _backgroundColorSelector;
2295 internal static readonly BindableProperty BackgroundImageBorderSelectorProperty = BindableProperty.Create("BackgroundImageBorderSelector", typeof(Selector<Rectangle>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2297 var view = (View)bindable;
2298 view.backgroundImageBorderSelector.Clone((Selector<Rectangle>)newValue);
2300 defaultValueCreator: (bindable) =>
2302 var view = (View)bindable;
2303 return view.backgroundImageBorderSelector;
2305 private TriggerableSelector<Rectangle> _backgroundImageBorderSelector;
2306 private TriggerableSelector<Rectangle> backgroundImageBorderSelector
2310 if (null == _backgroundImageBorderSelector)
2312 _backgroundImageBorderSelector = new TriggerableSelector<Rectangle>(this, BackgroundImageBorderProperty);
2314 return _backgroundImageBorderSelector;
2317 internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
2319 var view = (View)bindable;
2320 view.opacitySelector.Clone((Selector<float?>)newValue);
2322 defaultValueCreator: (bindable) =>
2324 var view = (View)bindable;
2325 return view.opacitySelector;
2327 private TriggerableSelector<float?> _opacitySelector;
2328 private TriggerableSelector<float?> opacitySelector
2332 if (null == _opacitySelector)
2334 _opacitySelector = new TriggerableSelector<float?>(this, OpacityProperty);
2336 return _opacitySelector;
2340 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2341 [EditorBrowsable(EditorBrowsableState.Never)]
2342 public virtual void ApplyStyle(ViewStyle viewStyle)
2344 if (null == viewStyle)
2349 if (this.viewStyle == viewStyle)
2354 if (null != this.viewStyle)
2356 simpleBinding.Clear();
2359 this.viewStyle = viewStyle;
2361 Dictionary<string, BindableProperty> bindablePropertyOfView;
2362 Type viewType = GetType();
2364 Dictionary<string, BindableProperty> bindablePropertyOfStyle;
2365 Type styleType = viewStyle.GetType();
2367 BindableProperty.GetBindablePropertysOfType(viewType, out bindablePropertyOfView);
2368 BindableProperty.GetBindablePropertysOfType(styleType, out bindablePropertyOfStyle);
2370 if (null != bindablePropertyOfView && null != bindablePropertyOfStyle)
2372 foreach (KeyValuePair<string, BindableProperty> keyValuePair in bindablePropertyOfStyle)
2374 BindableProperty viewProperty;
2375 bindablePropertyOfView.TryGetValue(keyValuePair.Key, out viewProperty);
2377 if (null != viewProperty)
2379 object value = viewStyle.GetValue(keyValuePair.Value);
2383 SetValue(viewProperty, value);
2386 simpleBinding.Bind(viewStyle, keyValuePair.Value, this, viewProperty, BindingDirection.TwoWay);
2392 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
2393 [EditorBrowsable(EditorBrowsableState.Never)]
2394 private BundledPipe simpleBinding = new BundledPipe();