/* * Copyright(c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ using System; using System.Collections.Generic; using System.ComponentModel; using System.Runtime.InteropServices; using Tizen.NUI.Binding; namespace Tizen.NUI.BaseComponents { /// /// View is the base class for all views. /// /// 3 public partial class View : Container, IResourcesProvider { private static HashSet positionPropertyGroup = new HashSet(); private static HashSet sizePropertyGroup = new HashSet(); private static HashSet scalePropertyGroup = new HashSet(); internal BackgroundExtraData backgroundExtraData; private bool layoutSet = false; private LayoutItem layout; // Exclusive layout assigned to this View. // List of transitions paired with the condition that uses the transition. private Dictionary layoutTransitions; private int widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy private int heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy private float weight = 0.0f; // Weighting of child View in a Layout private bool backgroundImageSynchronosLoading = false; private bool excludeLayouting = false; private LayoutTransition layoutTransition; private TransitionOptions transitionOptions = null; private ThemeData themeData; // List of constraints private Constraint widthConstraint = null; private Constraint heightConstraint = null; static View() { RegisterPropertyGroup(PositionProperty, positionPropertyGroup); RegisterPropertyGroup(Position2DProperty, positionPropertyGroup); RegisterPropertyGroup(PositionXProperty, positionPropertyGroup); RegisterPropertyGroup(PositionYProperty, positionPropertyGroup); RegisterPropertyGroup(SizeProperty, sizePropertyGroup); RegisterPropertyGroup(Size2DProperty, sizePropertyGroup); RegisterPropertyGroup(SizeWidthProperty, sizePropertyGroup); RegisterPropertyGroup(SizeHeightProperty, sizePropertyGroup); RegisterPropertyGroup(ScaleProperty, scalePropertyGroup); RegisterPropertyGroup(ScaleXProperty, scalePropertyGroup); RegisterPropertyGroup(ScaleYProperty, scalePropertyGroup); RegisterPropertyGroup(ScaleZProperty, scalePropertyGroup); } /// /// Creates a new instance of a view. /// /// 3 public View() : this(Interop.View.New(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI). [EditorBrowsable(EditorBrowsableState.Never)] public View(ViewStyle viewStyle) : this(Interop.View.New(), true, viewStyle) { } /// /// Create a new instance of a View with setting the status of shown or hidden. /// /// false : Not displayed (hidden), true : displayed (shown) /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI). [EditorBrowsable(EditorBrowsableState.Never)] public View(bool shown) : this(Interop.View.New(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); SetVisible(shown); } internal View(View uiControl, bool shown = true) : this(Interop.View.NewView(View.getCPtr(uiControl)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); if (!shown) { SetVisible(false); } backgroundExtraData = uiControl.backgroundExtraData == null ? null : new BackgroundExtraData(uiControl.backgroundExtraData); } internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown) { InitializeStyle(viewStyle); } internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(cPtr, cMemoryOwn) { if (HasBody()) { PositionUsesPivotPoint = false; } onWindowSendEventCallback = SendViewAddedEventToWindow; this.OnWindowSignal().Connect(onWindowSendEventCallback); if (!shown) { SetVisible(false); } } internal View(ViewImpl implementation, bool shown = true) : this(Interop.View.NewViewInternal(ViewImpl.getCPtr(implementation)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); if (!shown) { SetVisible(false); } } /// /// The event that is triggered when the View's ControlState is changed. /// [EditorBrowsable(EditorBrowsableState.Never)] public event EventHandler ControlStateChangedEvent; internal event EventHandler ControlStateChangeEventInternal; /// /// Flag to indicate if layout set explicitly via API call or View was automatically given a Layout. /// /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public bool LayoutSet { get { return layoutSet; } } /// /// Flag to allow Layouting to be disabled for Views. /// Once a View has a Layout set then any children added to Views from then on will receive /// automatic Layouts. /// /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public static bool LayoutingDisabled { get; set; } = true; /// /// Deprecate. Please do not use this. /// The style instance applied to this view. /// Note that please do not modify the ViewStyle. /// Modifying ViewStyle will affect other views with same ViewStyle. /// [EditorBrowsable(EditorBrowsableState.Never)] protected ViewStyle ViewStyle { get { if (themeData == null) themeData = new ThemeData(); if (themeData.viewStyle == null) { ApplyStyle(CreateViewStyle()); } return themeData.viewStyle; } } /// /// Get/Set the control state. /// Note that the ControlState only available for the classes derived from Control. /// If the classes that are not derived from Control (such as View, ImageView and TextLabel) want to use this system, /// please set to true. /// /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public ControlState ControlState { get { return themeData == null ? ControlState.Normal : themeData.controlStates; } protected set { if (ControlState == value) { return; } var prevState = ControlState; if (themeData == null) themeData = new ThemeData(); themeData.controlStates = value; var changeInfo = new ControlStateChangedEventArgs(prevState, value); ControlStateChangeEventInternal?.Invoke(this, changeInfo); if (themeData.ControlStatePropagation) { foreach (View child in Children) { child.ControlState = value; } } OnControlStateChanged(changeInfo); ControlStateChangedEvent?.Invoke(this, changeInfo); } } /// /// Gets / Sets the status of whether the view is excluded from its parent's layouting or not. /// /// This will be public opened later after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public bool ExcludeLayouting { get { return excludeLayouting; } set { excludeLayouting = value; if (Layout != null && Layout.SetPositionByLayout == value) { Layout.SetPositionByLayout = !value; Layout.RequestLayout(); } } } /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public bool IsResourcesCreated { get { return Application.Current.IsResourcesCreated; } } /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public ResourceDictionary XamlResources { get { return Application.Current.XamlResources; } set { Application.Current.XamlResources = value; } } /// /// The StyleName, type string. /// The value indicates DALi style name defined in json theme file. /// /// 3 public string StyleName { get { return (string)GetValue(StyleNameProperty); } set { SetValue(StyleNameProperty, value); NotifyPropertyChanged(); } } /// /// The KeyInputFocus, type bool. /// [EditorBrowsable(EditorBrowsableState.Never)] public bool KeyInputFocus { get { return (bool)GetValue(KeyInputFocusProperty); } set { SetValue(KeyInputFocusProperty, value); NotifyPropertyChanged(); } } /// /// The mutually exclusive with "backgroundImage" and "background" type Vector4. /// /// /// /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible. /// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a)); /// /// /// /// 3 public Color BackgroundColor { get { Color temp = (Color)GetValue(BackgroundColorProperty); return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A); } set { SetValue(BackgroundColorProperty, value); NotifyPropertyChanged(); } } /// /// The mutually exclusive with "backgroundColor" and "background" type Map. /// /// 3 public string BackgroundImage { get { return (string)GetValue(BackgroundImageProperty); } set { SetValue(BackgroundImageProperty, value); NotifyPropertyChanged(); } } /// /// Get or set the border of background image. /// /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public Rectangle BackgroundImageBorder { get { return (Rectangle)GetValue(BackgroundImageBorderProperty); } set { SetValue(BackgroundImageBorderProperty, value); NotifyPropertyChanged(); } } /// /// The background of view. /// /// 3 public Tizen.NUI.PropertyMap Background { get { return (PropertyMap)GetValue(BackgroundProperty); } set { SetValue(BackgroundProperty, value); NotifyPropertyChanged(); } } /// /// Describes a shadow as an image for a View. /// It is null by default. /// /// /// Getter returns copied instance of current shadow. /// /// /// The mutually exclusive with "BoxShadow". /// /// /// /// Animatable - This property can be animated using Animation class. /// To animate this property, specify a sub-property with separator ".", for example, "ImageShadow.Offset". /// /// animation.AnimateTo(view, "ImageShadow.Offset", new Vector2(10, 10)); /// /// Animatable sub-property : Offset. /// /// [EditorBrowsable(EditorBrowsableState.Never)] public ImageShadow ImageShadow { get { return (ImageShadow)GetValue(ImageShadowProperty); } set { SetValue(ImageShadowProperty, value); NotifyPropertyChanged(); } } /// /// Describes a box shaped shadow drawing for a View. /// It is null by default. /// /// /// The mutually exclusive with "ImageShadow". /// /// /// /// Animatable - This property can be animated using Animation class. /// To animate this property, specify a sub-property with separator ".", for example, "BoxShadow.BlurRadius". /// /// animation.AnimateTo(view, "BoxShadow.BlurRadius", 10.0f); /// /// Animatable sub-property : Offset, Color, BlurRadius. /// /// /// 9 public Shadow BoxShadow { get { return (Shadow)GetValue(BoxShadowProperty); } set { SetValue(BoxShadowProperty, value); NotifyPropertyChanged(); } } /// /// The radius for the rounded corners of the View. /// This will rounds background and shadow edges. /// The values in Vector4 are used in clockwise order from top-left to bottom-left : Vector4(top-left-corner, top-right-corner, bottom-right-corner, bottom-left-corner). /// Each radius will clamp internally to the half of smaller of the view's width or height. /// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "CornerRadius", new Vector4(10, 10, 10, 10)); /// /// /// /// 9 public Vector4 CornerRadius { get { return (Vector4)GetValue(CornerRadiusProperty); } set { SetValue(CornerRadiusProperty, value); NotifyPropertyChanged(); } } /// /// Whether the CornerRadius property value is relative (percentage [0.0f to 0.5f] of the view size) or absolute (in world units). /// It is absolute by default. /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height. /// /// 9 public VisualTransformPolicyType CornerRadiusPolicy { get => (VisualTransformPolicyType)GetValue(CornerRadiusPolicyProperty); set => SetValue(CornerRadiusPolicyProperty, value); } /// /// The width for the borderline of the View. /// Note that, an image background may not have borderline if it uses a Border property. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "BorderlineWidth", 100.0f); /// /// /// /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public float BorderlineWidth { get { return (float)GetValue(BorderlineWidthProperty); } set { SetValue(BorderlineWidthProperty, value); NotifyPropertyChanged(); } } /// /// The color for the borderline of the View. /// It is Color.Black by default. /// This color is affected by View Opacity. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "BorderlineColor", new Color(r, g, b, a)); /// /// /// /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public Color BorderlineColor { get { return (Color)GetValue(BorderlineColorProperty); } set { SetValue(BorderlineColorProperty, value); NotifyPropertyChanged(); } } /// /// The Relative offset for the borderline of the View. /// recommand [-1.0f to 1.0f] range. /// If -1.0f, borderline draw inside of View. /// If 1.0f, borderline draw outside of View. /// If 0.0f, borderline draw half at inside and half at outside. /// It is 0.0f by default. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "BorderlineOffset", -1.0f); /// /// /// /// This will be public opened after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public float BorderlineOffset { get { return (float)GetValue(BorderlineOffsetProperty); } set { SetValue(BorderlineOffsetProperty, value); NotifyPropertyChanged(); } } /// /// The current state of the view. /// /// 3 public States State { get { return (States)GetValue(StateProperty); } set { SetValue(StateProperty, value); NotifyPropertyChanged(); } } /// /// The current sub state of the view. /// /// 3 public States SubState { get { return (States)GetValue(SubStateProperty); } set { SetValue(SubStateProperty, value); NotifyPropertyChanged(); } } /// /// Displays a tooltip /// /// 3 public Tizen.NUI.PropertyMap Tooltip { get { return (PropertyMap)GetValue(TooltipProperty); } set { SetValue(TooltipProperty, value); NotifyPropertyChanged(); } } /// /// Displays a tooltip as a text. /// /// 3 public string TooltipText { get { using (var propertyValue = GetProperty(Property.TOOLTIP)) { if (propertyValue != null && propertyValue.Get(out string retrivedValue)) { return retrivedValue; } NUILog.Error($"[ERROR] Fail to get TooltipText! Return error MSG (error to get TooltipText)!"); return "error to get TooltipText"; } } set { var temp = new Tizen.NUI.PropertyValue(value); SetProperty(View.Property.TOOLTIP, temp); temp.Dispose(); NotifyPropertyChanged(); } } /// /// The Child property of FlexContainer.
/// The proportion of the free space in the container, the flex item will receive.
/// If all items in the container set this property, their sizes will be proportional to the specified flex factor.
///
/// 3 [Obsolete("Deprecated in API8, will be removed in API10.")] public float Flex { get { return (float)GetValue(FlexProperty); } set { SetValue(FlexProperty, value); NotifyPropertyChanged(); } } /// /// The Child property of FlexContainer.
/// The alignment of the flex item along the cross axis, which, if set, overrides the default alignment for all items in the container.
///
/// 3 [Obsolete("Deprecated in API8, will be removed in API10.")] public int AlignSelf { get { return (int)GetValue(AlignSelfProperty); } set { SetValue(AlignSelfProperty, value); NotifyPropertyChanged(); } } /// /// The Child property of FlexContainer.
/// The space around the flex item.
///
/// /// The property cascade chaining set is possible. For example, this (view.FlexMargin.X = 0.1f;) is possible. /// /// 3 [Obsolete("Deprecated in API8, will be removed in API10.")] public Vector4 FlexMargin { get { Vector4 temp = (Vector4)GetValue(FlexMarginProperty); return new Vector4(OnFlexMarginChanged, temp.X, temp.Y, temp.Z, temp.W); } set { SetValue(FlexMarginProperty, value); NotifyPropertyChanged(); } } /// /// The top-left cell this child occupies, if not set, the first available cell is used. /// /// /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible. /// Also, this property is for class. Please use the property for the child position of . /// /// 3 public Vector2 CellIndex { get { Vector2 temp = (Vector2)GetValue(CellIndexProperty); return new Vector2(OnCellIndexChanged, temp.X, temp.Y); } set { SetValue(CellIndexProperty, value); NotifyPropertyChanged(); } } /// /// The number of rows this child occupies, if not set, the default value is 1. /// /// /// This property is for class. Please use the property for the child position of . /// /// 3 public float RowSpan { get { return (float)GetValue(RowSpanProperty); } set { SetValue(RowSpanProperty, value); NotifyPropertyChanged(); } } /// /// The number of columns this child occupies, if not set, the default value is 1. /// /// /// This property is for class. Please use the property for the child position of . /// /// 3 public float ColumnSpan { get { return (float)GetValue(ColumnSpanProperty); } set { SetValue(ColumnSpanProperty, value); NotifyPropertyChanged(); } } /// /// The horizontal alignment of this child inside the cells, if not set, the default value is 'left'. /// /// /// This property is for class. Please use the property for the child position of . /// /// 3 public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment { get { return (HorizontalAlignmentType)GetValue(CellHorizontalAlignmentProperty); } set { SetValue(CellHorizontalAlignmentProperty, value); NotifyPropertyChanged(); } } /// /// The vertical alignment of this child inside the cells, if not set, the default value is 'top'. /// /// /// This property is for class. Please use the property for the child position of . /// /// 3 public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment { get { return (VerticalAlignmentType)GetValue(CellVerticalAlignmentProperty); } set { SetValue(CellVerticalAlignmentProperty, value); NotifyPropertyChanged(); } } /// /// The left focusable view.
/// This will return null if not set.
/// This will also return null if the specified left focusable view is not on a window.
///
/// 3 public View LeftFocusableView { // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa. get { return (View)GetValue(LeftFocusableViewProperty); } set { SetValue(LeftFocusableViewProperty, value); NotifyPropertyChanged(); } } /// /// The right focusable view.
/// This will return null if not set.
/// This will also return null if the specified right focusable view is not on a window.
///
/// 3 public View RightFocusableView { // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa. get { return (View)GetValue(RightFocusableViewProperty); } set { SetValue(RightFocusableViewProperty, value); NotifyPropertyChanged(); } } /// /// The up focusable view.
/// This will return null if not set.
/// This will also return null if the specified up focusable view is not on a window.
///
/// 3 public View UpFocusableView { // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa. get { return (View)GetValue(UpFocusableViewProperty); } set { SetValue(UpFocusableViewProperty, value); NotifyPropertyChanged(); } } /// /// The down focusable view.
/// This will return null if not set.
/// This will also return null if the specified down focusable view is not on a window.
///
/// 3 public View DownFocusableView { // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa. get { return (View)GetValue(DownFocusableViewProperty); } set { SetValue(DownFocusableViewProperty, value); NotifyPropertyChanged(); } } /// /// Whether the view should be focusable by keyboard navigation. /// /// 3 public bool Focusable { set { SetValue(FocusableProperty, value); NotifyPropertyChanged(); } get { return (bool)GetValue(FocusableProperty); } } /// /// Whether this view can focus by touch. /// If Focusable is false, FocusableInTouch is disabled. /// If you want to have focus on touch, you need to set both Focusable and FocusableInTouch settings to true. /// [EditorBrowsable(EditorBrowsableState.Never)] public bool FocusableInTouch { set { SetValue(FocusableInTouchProperty, value); NotifyPropertyChanged(); } get { return (bool)GetValue(FocusableInTouchProperty); } } /// /// Retrieves the position of the view.
/// The coordinates are relative to the view's parent.
///
/// 3 public Position CurrentPosition { get { return GetCurrentPosition(); } } /// /// Sets the size of a view for the width and the height.
/// Geometry can be scaled to fit within this area.
/// This does not interfere with the view's scale factor.
/// The views default depth is the minimum of width and height.
///
/// /// This NUI object (Size2D) typed property can be configured by multiple cascade setting.
/// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ).
///
/// 3 public Size2D Size2D { get { Size2D temp = (Size2D)GetValue(Size2DProperty); int width = temp.Width; int height = temp.Height; if (this.Layout == null) { if (width < 0) { width = 0; } if (height < 0) { height = 0; } } return new Size2D(OnSize2DChanged, width, height); } set { SetValue(Size2DProperty, value); NotifyPropertyChanged(); } } /// /// Retrieves the size of the view.
/// The coordinates are relative to the view's parent.
///
/// 3 public Size2D CurrentSize { get { return GetCurrentSize(); } } /// /// Retrieves and sets the view's opacity.
///
/// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "Opacity", 0.5f); /// /// /// /// 3 public float Opacity { get { return (float)GetValue(OpacityProperty); } set { SetValue(OpacityProperty, value); NotifyPropertyChanged(); } } /// /// Sets the position of the view for X and Y.
/// By default, sets the position vector between the parent origin and the pivot point (default).
/// If the position inheritance is disabled, sets the world position.
///
/// /// This NUI object (Position2D) typed property can be configured by multiple cascade setting.
/// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ).
///
/// 3 public Position2D Position2D { get { Position2D temp = (Position2D)GetValue(Position2DProperty); return new Position2D(OnPosition2DChanged, temp.X, temp.Y); } set { SetValue(Position2DProperty, value); NotifyPropertyChanged(); } } /// /// Retrieves the screen position of the view.
///
/// 3 public Vector2 ScreenPosition { get { Vector2 temp = new Vector2(0.0f, 0.0f); var pValue = GetProperty(View.Property.ScreenPosition); pValue.Get(temp); pValue.Dispose(); return temp; } } /// /// Determines whether the pivot point should be used to determine the position of the view. /// This is false by default. /// /// If false, then the top-left of the view is used for the position. /// Setting this to false will allow scaling or rotation around the pivot point without affecting the view's position. /// /// 3 public bool PositionUsesPivotPoint { get { return (bool)GetValue(PositionUsesPivotPointProperty); } set { SetValue(PositionUsesPivotPointProperty, value); NotifyPropertyChanged(); } } /// /// Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! /// /// 3 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PositionUsesPivotPoint instead! " + "Like: " + "View view = new View(); " + "view.PivotPoint = PivotPoint.Center; " + "view.PositionUsesPivotPoint = true;" + " Deprecated in API5: Will be removed in API8")] [EditorBrowsable(EditorBrowsableState.Never)] public bool PositionUsesAnchorPoint { get { bool temp = false; var pValue = GetProperty(View.Property.PositionUsesAnchorPoint); pValue.Get(out temp); pValue.Dispose(); return temp; } set { var temp = new Tizen.NUI.PropertyValue(value); SetProperty(View.Property.PositionUsesAnchorPoint, temp); temp.Dispose(); NotifyPropertyChanged(); } } /// /// Queries whether the view is connected to the stage.
/// When a view is connected, it will be directly or indirectly parented to the root view.
///
/// 3 public bool IsOnWindow { get { return OnWindow(); } } /// /// Gets the depth in the hierarchy for the view. /// /// 3 public int HierarchyDepth { get { return GetHierarchyDepth(); } } /// /// Sets the sibling order of the view so the depth position can be defined within the same parent. /// /// /// Note the initial value is 0. SiblingOrder should be bigger than 0 or equal to 0. /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove, and LowerBelow will override the sibling order. /// The values set by this property will likely change. /// /// 3 public int SiblingOrder { get { return (int)GetValue(SiblingOrderProperty); } set { SetValue(SiblingOrderProperty, value); LayoutGroup layout = Layout as LayoutGroup; layout?.ChangeLayoutSiblingOrder(value); NotifyPropertyChanged(); } } /// /// Returns the natural size of the view. /// /// /// Deriving classes stipulate the natural size and by default a view has a zero natural size. /// /// 5 public Vector3 NaturalSize { get { Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); return ret; } } /// /// Returns the natural size (Size2D) of the view. /// /// /// Deriving classes stipulate the natural size and by default a view has a zero natural size. /// /// 4 public Size2D NaturalSize2D { get { Vector3 temp = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); Size2D sz = new Size2D((int)temp.Width, (int)temp.Height); temp.Dispose(); return sz; } } /// /// Gets or sets the origin of a view within its parent's area.
/// 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.
/// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).
/// A view's position is the distance between this origin and the view's anchor-point.
///
///
The view has been initialized.
/// 3 public Position ParentOrigin { get { Position tmp = (Position)GetValue(ParentOriginProperty); return new Position(OnParentOriginChanged, tmp.X, tmp.Y, tmp.Z); } set { SetValue(ParentOriginProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the anchor-point of a view.
/// 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.
/// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).
/// A view position is the distance between its parent-origin and this anchor-point.
/// A view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.
///
The view has been initialized.
///
/// /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible. /// /// 3 public Position PivotPoint { get { Position tmp = (Position)GetValue(PivotPointProperty); return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z); } set { SetValue(PivotPointProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the size width of the view. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "SizeWidth", 500.0f); /// /// /// /// 3 public float SizeWidth { get { return (float)GetValue(SizeWidthProperty); } set { SetValue(SizeWidthProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the size height of the view. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// /// animation.AnimateTo(view, "SizeHeight", 500.0f); /// /// /// 3 public float SizeHeight { get { return (float)GetValue(SizeHeightProperty); } set { SetValue(SizeHeightProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the position of the view.
/// By default, sets the position vector between the parent origin and pivot point (default).
/// If the position inheritance is disabled, sets the world position.
///
/// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "Position", new Position(50, 0)); /// /// /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible. /// /// 3 public Position Position { get { Position tmp = (Position)GetValue(PositionProperty); return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z); } set { SetValue(PositionProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the position X of the view. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "PositionX", 50.0f); /// /// /// /// 3 public float PositionX { get { return (float)GetValue(PositionXProperty); } set { SetValue(PositionXProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the position Y of the view. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "PositionY", 50.0f); /// /// /// /// 3 public float PositionY { get { return (float)GetValue(PositionYProperty); } set { SetValue(PositionYProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the position Z of the view. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "PositionZ", 50.0f); /// /// /// /// 3 public float PositionZ { get { return (float)GetValue(PositionZProperty); } set { SetValue(PositionZProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the world position of the view. /// /// 3 public Vector3 WorldPosition { get { Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f); var pValue = GetProperty(View.Property.WorldPosition); pValue.Get(temp); pValue.Dispose(); return temp; } } /// /// Gets or sets the orientation of the view.
/// The view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.
///
/// /// /// This is an asynchronous method. /// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "Orientation", new Rotation(new Radian((float)Math.PI), Vector3.XAxis)); /// /// /// /// 3 public Rotation Orientation { get { return (Rotation)GetValue(OrientationProperty); } set { SetValue(OrientationProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the world orientation of the view.
///
/// 3 public Rotation WorldOrientation { get { Rotation temp = new Rotation(); var pValue = GetProperty(View.Property.WorldOrientation); pValue.Get(temp); pValue.Dispose(); return temp; } } /// /// Gets or sets the scale factor applied to the view.
///
/// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "Scale", new Vector3(1.5f, 1.5f, 1.0f)); /// /// /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible. /// /// 3 public Vector3 Scale { get { Vector3 temp = (Vector3)GetValue(ScaleProperty); return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z); } set { SetValue(ScaleProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the scale X factor applied to the view. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "ScaleX", 1.5f); /// /// /// /// 3 public float ScaleX { get { return (float)GetValue(ScaleXProperty); } set { SetValue(ScaleXProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the scale Y factor applied to the view. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "ScaleY", 1.5f); /// /// /// /// 3 public float ScaleY { get { return (float)GetValue(ScaleYProperty); } set { SetValue(ScaleYProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the scale Z factor applied to the view. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "ScaleZ", 1.5f); /// /// /// /// 3 public float ScaleZ { get { return (float)GetValue(ScaleZProperty); } set { SetValue(ScaleZProperty, value); NotifyPropertyChanged(); } } /// /// Gets the world scale of the view. /// /// 3 public Vector3 WorldScale { get { Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f); var pValue = GetProperty(View.Property.WorldScale); pValue.Get(temp); pValue.Dispose(); return temp; } } /// /// Retrieves the visibility flag of the view. /// /// /// /// If the view is not visible, then the view and its children will not be rendered. /// 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. /// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "Visibility", false); /// /// /// /// 3 public bool Visibility { get { bool temp = false; var pValue = GetProperty(View.Property.VISIBLE); pValue.Get(out temp); pValue.Dispose(); return temp; } } /// /// Gets the view's world color. /// /// 3 public Vector4 WorldColor { get { Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); var pValue = GetProperty(View.Property.WorldColor); pValue.Get(temp); pValue.Dispose(); return temp; } } /// /// Gets or sets the view's name. /// /// 3 public string Name { get { return (string)GetValue(NameProperty); } set { SetValue(NameProperty, value); NotifyPropertyChanged(); } } /// /// Get the number of children held by the view. /// /// 3 public new uint ChildCount { get { return Convert.ToUInt32(Children.Count); } } /// /// Gets the view's ID. /// Read-only /// /// 3 public uint ID { get { return GetId(); } } /// /// Gets or sets the status of whether the view should emit touch or hover signals. /// If a View is made insensitive, then the View and its children are not hittable. /// /// 3 public bool Sensitive { get { return (bool)GetValue(SensitiveProperty); } set { SetValue(SensitiveProperty, value); NotifyPropertyChanged(); } } /// /// 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. /// /// 3 public bool LeaveRequired { get { return (bool)GetValue(LeaveRequiredProperty); } set { SetValue(LeaveRequiredProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the status of whether a child view inherits it's parent's orientation. /// /// 3 public bool InheritOrientation { get { return (bool)GetValue(InheritOrientationProperty); } set { SetValue(InheritOrientationProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the status of whether a child view inherits it's parent's scale. /// /// 3 public bool InheritScale { get { return (bool)GetValue(InheritScaleProperty); } set { SetValue(InheritScaleProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the status of how the view and its children should be drawn.
/// Not all views are renderable, but DrawMode can be inherited from any view.
/// 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.
/// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.
/// Overlay views are drawn in a separate pass, after all non-overlay views within the layer.
/// For overlay views, the drawing order is with respect to tree levels of views, and depth-testing will not be used.
///
/// 3 public DrawModeType DrawMode { get { return (DrawModeType)GetValue(DrawModeProperty); } set { SetValue(DrawModeProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the relative to parent size factor of the view.
/// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.
/// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.
///
/// /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible. /// /// 3 public Vector3 SizeModeFactor { get { Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty); return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z); } set { SetValue(SizeModeFactorProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the width resize policy to be used. /// /// 3 public ResizePolicyType WidthResizePolicy { get { return (ResizePolicyType)GetValue(WidthResizePolicyProperty); } set { SetValue(WidthResizePolicyProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the height resize policy to be used. /// /// 3 public ResizePolicyType HeightResizePolicy { get { return (ResizePolicyType)GetValue(HeightResizePolicyProperty); } set { SetValue(HeightResizePolicyProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the policy to use when setting size with size negotiation.
/// Defaults to SizeScalePolicyType.UseSizeSet.
///
/// 3 public SizeScalePolicyType SizeScalePolicy { get { return (SizeScalePolicyType)GetValue(SizeScalePolicyProperty); } set { SetValue(SizeScalePolicyProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the status of whether the width size is dependent on the height size. /// /// 3 public bool WidthForHeight { get { return (bool)GetValue(WidthForHeightProperty); } set { SetValue(WidthForHeightProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the status of whether the height size is dependent on the width size. /// /// 3 public bool HeightForWidth { get { return (bool)GetValue(HeightForWidthProperty); } set { SetValue(HeightForWidthProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the padding for use in layout. /// /// /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible. /// /// 5 public Extents Padding { get { // If View has a Layout then padding in stored in the base Layout class if (Layout != null) { return Layout.Padding; } else { Extents temp = (Extents)GetValue(PaddingProperty); return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom); } // Two return points to prevent creating a zeroed Extent native object before assignment } set { Extents padding = value; if (Layout != null) { // Layout set so store Padding in LayoutItem instead of in View. // If View stores the Padding value then Legacy Size Negotiation will overwrite // the position and sizes measure in the Layouting. Layout.Padding = value; // If Layout is a LayoutItem then it could be a View that handles it's own padding. // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths. if (typeof(LayoutGroup).IsAssignableFrom(Layout.GetType())) // If a Layout container of some kind. { padding = new Extents(0, 0, 0, 0); // Reset value stored in View. } } SetValue(PaddingProperty, padding); NotifyPropertyChanged(); } } /// /// Gets or sets the minimum size the view can be assigned in size negotiation. /// /// Thrown when value is null. /// /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible. /// /// 3 public Size2D MinimumSize { get { Size2D tmp = (Size2D)GetValue(MinimumSizeProperty); return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height); } set { if (value == null) { throw new ArgumentNullException(nameof(value)); } if (layout != null) { // Note: it only works if minimum size is >= than natural size. // To force the size it should be done through the width&height spec or Size2D. layout.MinimumWidth = new Tizen.NUI.LayoutLength(value.Width); layout.MinimumHeight = new Tizen.NUI.LayoutLength(value.Height); layout.RequestLayout(); } SetValue(MinimumSizeProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the maximum size the view can be assigned in size negotiation. /// /// /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible. /// /// 3 public Size2D MaximumSize { get { Size2D tmp = (Size2D)GetValue(MaximumSizeProperty); return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height); } set { // We don't have Layout.Maximum(Width|Height) so we cannot apply it to layout. // MATCH_PARENT spec + parent container size can be used to limit if (layout != null) { layout.RequestLayout(); } SetValue(MaximumSizeProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets whether a child view inherits it's parent's position.
/// Default is to inherit.
/// 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.
///
/// 3 public bool InheritPosition { get { return (bool)GetValue(InheritPositionProperty); } set { SetValue(InheritPositionProperty, value); NotifyPropertyChanged(); } } /// /// Gets or sets the clipping behavior (mode) of it's children. /// /// 3 public ClippingModeType ClippingMode { get { return (ClippingModeType)GetValue(ClippingModeProperty); } set { SetValue(ClippingModeProperty, value); NotifyPropertyChanged(); } } /// /// Gets the number of renderers held by the view. /// /// 3 public uint RendererCount { get { return GetRendererCount(); } } /// /// Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! /// /// /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible. /// /// 3 [Obsolete("Deprecated in API5; Will be removed in API8. Please use PivotPoint instead! " + "Like: " + "View view = new View(); " + "view.PivotPoint = PivotPoint.Center; " + "view.PositionUsesPivotPoint = true;")] [EditorBrowsable(EditorBrowsableState.Never)] public Position AnchorPoint { get { Position temp = new Position(0.0f, 0.0f, 0.0f); var pValue = GetProperty(View.Property.AnchorPoint); pValue.Get(temp); pValue.Dispose(); Position ret = new Position(OnAnchorPointChanged, temp.X, temp.Y, temp.Z); temp.Dispose(); return ret; } set { var temp = new Tizen.NUI.PropertyValue(value); SetProperty(View.Property.AnchorPoint, temp); temp.Dispose(); NotifyPropertyChanged(); } } /// /// Sets the size of a view for the width, the height and the depth.
/// Geometry can be scaled to fit within this area.
/// This does not interfere with the view's scale factor.
/// The views default depth is the minimum of width and height.
///
/// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "Size", new Size(100, 100)); /// /// /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible. /// /// 5 public Size Size { get { Size tmp = (Size)GetValue(SizeProperty); return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth); } set { SetValue(SizeProperty, value); NotifyPropertyChanged(); } } /// /// Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! /// /// 3 [Obsolete("Deprecated in API5; Will be removed in API8. Please use 'Container GetParent() for derived class' instead! " + "Like: " + "Container parent = view.GetParent(); " + "View view = parent as View;")] [EditorBrowsable(EditorBrowsableState.Never)] public new View Parent { get { View ret; IntPtr cPtr = Interop.Actor.GetParent(SwigCPtr); HandleRef CPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(CPtr.Handle); if (basehandle is Layer layer) { ret = new View(Layer.getCPtr(layer).Handle, false); NUILog.Error("This Parent property is deprecated, should do not be used"); } else { ret = basehandle as View; } Interop.BaseHandle.DeleteBaseHandle(CPtr); CPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); return ret; } } /// /// Gets/Sets whether inherit parent's the layout Direction. /// /// 4 public bool InheritLayoutDirection { get { return (bool)GetValue(InheritLayoutDirectionProperty); } set { SetValue(InheritLayoutDirectionProperty, value); NotifyPropertyChanged(); } } /// /// Gets/Sets the layout Direction. /// /// 4 public ViewLayoutDirectionType LayoutDirection { get { return (ViewLayoutDirectionType)GetValue(LayoutDirectionProperty); } set { SetValue(LayoutDirectionProperty, value); NotifyPropertyChanged(); layout?.RequestLayout(); } } /// /// Gets or sets the Margin for use in layout. /// /// /// Margin property is supported by Layout algorithms and containers. /// Please Set Layout if you want to use Margin property. /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible. /// /// 4 public Extents Margin { get { // If View has a Layout then margin is stored in Layout. if (Layout != null) { return Layout.Margin; } else { // If Layout not set then return margin stored in View. Extents temp = (Extents)GetValue(MarginProperty); return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom); } // Two return points to prevent creating a zeroed Extent native object before assignment } set { if (Layout != null) { // Layout set so store Margin in LayoutItem instead of View. // If View stores the Margin too then the Legacy Size Negotiation will // overwrite the position and size values measured in the Layouting. Layout.Margin = value; SetValue(MarginProperty, new Extents(0, 0, 0, 0)); layout?.RequestLayout(); } else { SetValue(MarginProperty, value); } NotifyPropertyChanged(); layout?.RequestLayout(); } } /// /// The required policy for this dimension, values or exact value. /// /// /// /// // matchParentView matches its size to its parent size. /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent; /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent; /// /// // wrapContentView wraps its children with their desired size. /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent; /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent; /// /// // exactSizeView shows itself with an exact size. /// exactSizeView.WidthSpecification = 100; /// exactSizeView.HeightSpecification = 100; /// /// /// 6 public int WidthSpecification { get { return widthPolicy; } set { if (value == widthPolicy) return; widthPolicy = value; if (widthPolicy >= 0) { if (heightPolicy >= 0) // Policy an exact value { // Create Size2D only both _widthPolicy and _heightPolicy are set. Size2D = new Size2D(widthPolicy, heightPolicy); } } layout?.RequestLayout(); } } /// /// The required policy for this dimension, values or exact value. /// /// /// /// // matchParentView matches its size to its parent size. /// matchParentView.WidthSpecification = LayoutParamPolicies.MatchParent; /// matchParentView.HeightSpecification = LayoutParamPolicies.MatchParent; /// /// // wrapContentView wraps its children with their desired size. /// wrapContentView.WidthSpecification = LayoutParamPolicies.WrapContent; /// wrapContentView.HeightSpecification = LayoutParamPolicies.WrapContent; /// /// // exactSizeView shows itself with an exact size. /// exactSizeView.WidthSpecification = 100; /// exactSizeView.HeightSpecification = 100; /// /// /// 6 public int HeightSpecification { get { return heightPolicy; } set { if (value == heightPolicy) return; heightPolicy = value; if (heightPolicy >= 0) { if (widthPolicy >= 0) // Policy an exact value { // Create Size2D only both _widthPolicy and _heightPolicy are set. Size2D = new Size2D(widthPolicy, heightPolicy); } } layout?.RequestLayout(); } } /// /// Gets the List of transitions for this View. /// /// 6 public Dictionary LayoutTransitions { get { if (layoutTransitions == null) { layoutTransitions = new Dictionary(); } return layoutTransitions; } } /// /// Sets a layout transitions for this View. /// /// Thrown when value is null. /// /// Use LayoutTransitions to receive a collection of LayoutTransitions set on the View. /// /// 6 public LayoutTransition LayoutTransition { get { return layoutTransition; } set { if (value == null) { throw new global::System.ArgumentNullException(nameof(value)); } if (layoutTransitions == null) { layoutTransitions = new Dictionary(); } LayoutTransitionsHelper.AddTransitionForCondition(layoutTransitions, value.Condition, value, true); AttachTransitionsToChildren(value); layoutTransition = value; } } /// /// Deprecated in API5; Will be removed in API8. Please use Padding instead. /// /// /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible. /// /// 4 [Obsolete("Deprecated in API5; Will be removed in API8. Please use Padding instead.")] [EditorBrowsable(EditorBrowsableState.Never)] public Extents PaddingEX { get { Extents temp = new Extents(0, 0, 0, 0); var pValue = GetProperty(View.Property.PADDING); pValue.Get(temp); pValue.Dispose(); Extents ret = new Extents(OnPaddingEXChanged, temp.Start, temp.End, temp.Top, temp.Bottom); temp.Dispose(); return ret; } set { var temp = new Tizen.NUI.PropertyValue(value); SetProperty(View.Property.PADDING, temp); temp.Dispose(); NotifyPropertyChanged(); layout?.RequestLayout(); } } /// /// The Color of View. This is an RGBA value. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible. /// /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public Color Color { get { Color temp = (Color)GetValue(ColorProperty); return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A); } set { SetValue(ColorProperty, value); NotifyPropertyChanged(); } } /// /// Set the layout on this View. Replaces any existing Layout. /// /// /// If this Layout is set as null explicitly, it means this View itself and it's child Views will not use Layout anymore. /// /// 6 public LayoutItem Layout { get { return layout; } set { // Do nothing if layout provided is already set on this View. if (value == layout) { return; } LayoutingDisabled = false; layoutSet = true; // If new layout being set already has a owner then that owner receives a replacement default layout. // First check if the layout to be set already has a owner. if (value?.Owner != null) { // Previous owner of the layout gets a default layout as a replacement. value.Owner.Layout = new AbsoluteLayout(); // Copy Margin and Padding to replacement LayoutGroup. if (value.Owner.Layout != null) { value.Owner.Layout.Margin = value.Margin; value.Owner.Layout.Padding = value.Padding; } } // Copy Margin and Padding to new layout being set or restore padding and margin back to // View if no replacement. Previously margin and padding values would have been moved from // the View to the layout. if (layout != null) // Existing layout { if (value != null) { // Existing layout being replaced so copy over margin and padding values. value.Margin = layout.Margin; value.Padding = layout.Padding; } else { // Layout not being replaced so restore margin and padding to View. SetValue(MarginProperty, layout.Margin); SetValue(PaddingProperty, layout.Padding); NotifyPropertyChanged(); } } else { // First Layout to be added to the View hence copy // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View) if (value != null) { Extents margin = Margin; Extents padding = Padding; if (margin.Top != 0 || margin.Bottom != 0 || margin.Start != 0 || margin.End != 0) { // If View already has a margin set then store it in Layout instead. value.Margin = margin; SetValue(MarginProperty, new Extents(0, 0, 0, 0)); NotifyPropertyChanged(); } if (padding.Top != 0 || padding.Bottom != 0 || padding.Start != 0 || padding.End != 0) { // If View already has a padding set then store it in Layout instead. value.Padding = padding; // If Layout is a LayoutItem then it could be a View that handles it's own padding. // Let the View keeps it's padding. Still store Padding in Layout to reduce code paths. if (typeof(LayoutGroup).IsAssignableFrom(value.GetType())) { SetValue(PaddingProperty, new Extents(0, 0, 0, 0)); NotifyPropertyChanged(); } } } } // Remove existing layout from it's parent layout group. layout?.Unparent(); value.SetPositionByLayout = !excludeLayouting; // Set layout to this view SetLayout(value); } } /// /// The weight of the View, used to share available space in a layout with siblings. /// /// 6 public float Weight { get { return weight; } set { weight = value; layout?.RequestLayout(); } } /// /// Whether to load the BackgroundImage synchronously. /// If not specified, the default is false, i.e. the BackgroundImage is loaded asynchronously. /// Note: For Normal Quad images only. /// /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public bool BackgroundImageSynchronosLoading { get { return backgroundImageSynchronosLoading; } set { backgroundImageSynchronosLoading = value; string bgUrl = null; var pValue = Background.Find(ImageVisualProperty.URL); pValue?.Get(out bgUrl); pValue?.Dispose(); if (!string.IsNullOrEmpty(bgUrl)) { PropertyMap bgMap = this.Background; var temp = new PropertyValue(backgroundImageSynchronosLoading); bgMap.Add("synchronousLoading", temp); temp.Dispose(); Background = bgMap; } } } /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public Vector2 UpdateSizeHint { get { return (Vector2)GetValue(UpdateSizeHintProperty); } set { SetValue(UpdateSizeHintProperty, value); NotifyPropertyChanged(); } } /// /// Enable/Disable ControlState propagation for children. /// It is false by default. /// If the View needs to share ControlState with descendants, please set it true. /// Please note that, changing the value will also changes children's EnableControlStatePropagation value recursively. /// [EditorBrowsable(EditorBrowsableState.Never)] public bool EnableControlStatePropagation { get => themeData?.ControlStatePropagation ?? false; set { if (EnableControlStatePropagation == value) return; if (themeData == null) themeData = new ThemeData(); themeData.ControlStatePropagation = value; foreach (View child in Children) { child.EnableControlStatePropagation = value; } } } /// /// By default, it is false in View, true in Control. /// Note that if the value is true, the View will be a touch receptor. /// [EditorBrowsable(EditorBrowsableState.Never)] public bool EnableControlState { get { return (bool)GetValue(EnableControlStateProperty); } set { SetValue(EnableControlStateProperty, value); } } /// /// Whether the actor grab all touches even if touch leaves its boundary. /// /// true, if it grab all touch after start [EditorBrowsable(EditorBrowsableState.Never)] public bool GrabTouchAfterLeave { get { bool temp = false; var pValue = GetProperty(View.Property.CaptureAllTouchAfterStart); pValue.Get(out temp); pValue.Dispose(); return temp; } set { var temp = new Tizen.NUI.PropertyValue(value); SetProperty(View.Property.CaptureAllTouchAfterStart, temp); temp.Dispose(); NotifyPropertyChanged(); } } /// /// Determines which blend equation will be used to render renderers of this actor. /// /// blend equation enum currently assigned /// This will be public opened in next tizen after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public BlendEquationType BlendEquation { get { int temp = 0; var pValue = GetProperty(View.Property.BlendEquation); pValue.Get(out temp); pValue.Dispose(); return (BlendEquationType)temp; } set { var temp = new Tizen.NUI.PropertyValue((int)value); SetProperty(View.Property.BlendEquation, temp); temp.Dispose(); NotifyPropertyChanged(); } } /// /// If the value is true, the View will change its style as the theme changes. /// The default value is false in normal case but it can be true when the NUIApplication is created with . /// /// 9 public bool ThemeChangeSensitive { get => (bool)GetValue(ThemeChangeSensitiveProperty); set => SetValue(ThemeChangeSensitiveProperty, value); } /// /// Create Style, it is abstract function and must be override. /// [EditorBrowsable(EditorBrowsableState.Never)] protected virtual ViewStyle CreateViewStyle() { return new ViewStyle(); } /// /// Called after the View's ControlStates changed. /// /// The information including state changed variables. [EditorBrowsable(EditorBrowsableState.Never)] protected virtual void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo) { } /// /// [EditorBrowsable(EditorBrowsableState.Never)] protected virtual void OnThemeChanged(object sender, ThemeChangedEventArgs e) { if (string.IsNullOrEmpty(styleName)) ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(GetType())); else ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(styleName)); } /// /// Apply style instance to the view. /// Basically it sets the bindable property to the value of the bindable property with same name in the style. /// /// 9 public virtual void ApplyStyle(ViewStyle viewStyle) { if (viewStyle == null || themeData?.viewStyle == viewStyle) return; if (themeData == null) themeData = new ThemeData(); themeData.viewStyle = viewStyle; if (viewStyle.DirtyProperties == null || viewStyle.DirtyProperties.Count == 0) { // Nothing to apply return; } BindableProperty.GetBindablePropertysOfType(GetType(), out var bindablePropertyOfView); if (bindablePropertyOfView == null) { return; } var dirtyStyleProperties = new BindableProperty[viewStyle.DirtyProperties.Count]; viewStyle.DirtyProperties.CopyTo(dirtyStyleProperties); foreach (var sourceProperty in dirtyStyleProperties) { var sourceValue = viewStyle.GetValue(sourceProperty); if (sourceValue == null) { continue; } bindablePropertyOfView.TryGetValue(sourceProperty.PropertyName, out var destinationProperty); if (destinationProperty != null) { SetValue(destinationProperty, sourceValue); } } } /// /// Get whether the View is culled or not. /// True means that the View is out of the view frustum. /// /// /// Hidden-API (Inhouse-API). /// [EditorBrowsable(EditorBrowsableState.Never)] public bool Culled { get { bool temp = false; var pValue = GetProperty(View.Property.Culled); pValue.Get(out temp); pValue.Dispose(); return temp; } } /// /// Set or Get TransitionOptions for the page transition. /// This property is used to define how this view will be transitioned during Page switching. /// /// 9 public TransitionOptions TransitionOptions { set { transitionOptions = value; } get { return transitionOptions; } } } }