/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ * 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.
*
*/
using System;
-using System.Collections.Generic;
using System.ComponentModel;
+using System.Collections.Generic;
using Tizen.NUI.Binding;
namespace Tizen.NUI.BaseComponents
{
/// <summary>
- /// The base class for Children attributes in Components.
+ /// The base class of style attributes for a view.
/// </summary>
- /// 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 partial class ViewStyle : BindableObject
+ /// <since_tizen> 9 </since_tizen>
+ public partial class ViewStyle : BindableObject, IDisposable
{
- private string styleName;
- private View.States? state;
- private View.States? subState;
- private float? flex;
- private int? alignSelf;
- private Vector4 flexMargin;
- private Vector2 cellIndex;
- private float? rowSpan;
- private float? columnSpan;
- private HorizontalAlignmentType? cellHorizontalAlignment;
- private VerticalAlignmentType? cellVerticalAlignment;
- private View leftFocusableView;
- private View rightFocusableView;
- private View upFocusableView;
- private View downFocusableView;
+ private bool disposed = false;
private bool? focusable;
private bool? positionUsesPivotPoint;
- private int? siblingOrder;
private Position parentOrigin;
private Position pivotPoint;
private Position position;
private Rotation orientation;
- private Vector3 scale;
- private string name;
- private bool? sensitive;
- private bool? leaveRequired;
- private bool? inheritOrientation;
- private bool? inheritScale;
private DrawModeType? drawMode;
private Vector3 sizeModeFactor;
private ResizePolicyType? widthResizePolicy;
private ResizePolicyType? heightResizePolicy;
- private SizeScalePolicyType? sizeScalePolicy;
private bool? widthForHeight;
private bool? heightForWidth;
private Extents padding;
private Size2D minimumSize;
private Size2D maximumSize;
- private bool? inheritPosition;
private ClippingModeType? clippingMode;
private Size size;
- private bool? inheritLayoutDirection;
- private ViewLayoutDirectionType? layoutDirection;
private Extents margin;
- private float? weight;
+ private bool? themeChangeSensitive;
+ private Vector4 cornerRadius;
private Selector<ImageShadow> imageShadow;
private Selector<Shadow> boxShadow;
private Selector<string> backgroundImageSelector;
- private Selector<float?> cornerRadius;
private Selector<float?> opacitySelector;
private Selector<Color> backgroundColorSelector;
private Selector<Rectangle> backgroundImageBorderSelector;
private Selector<Color> colorSelector;
+ private VisualTransformPolicyType? cornerRadiusPolicy;
- static ViewStyle() {}
+ static ViewStyle() { }
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <summary>
+ /// Create an empty style instance.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
public ViewStyle() { }
/// 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 ViewStyle(ViewStyle viewAttributes)
{
- if (null != viewAttributes)
- {
- this.CopyFrom(viewAttributes);
- }
+ CopyFrom(viewAttributes);
}
/// <summary>
- /// Create an instance and set properties from the given view.
+ /// Gets or sets the image resource url of the background of view.
+ /// The mutually exclusive with "BackgroundColor". Setting it overwrites existing "BackgroundColor".
/// </summary>
- /// <param name="view">The View that includes property data.</param>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public ViewStyle(View view)
- {
- CopyPropertiesFromView(view);
- }
-
- /// 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 string StyleName
- {
- get => (string)GetValue(StyleNameProperty);
- set => SetValue(StyleNameProperty, value);
- }
-
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <since_tizen> 9 </since_tizen>
public Selector<string> BackgroundImage
{
get
{
- Selector<string> image = (Selector<string>)GetValue(BackgroundImageSelectorProperty);
+ Selector<string> image = (Selector<string>)GetValue(BackgroundImageProperty);
return (null != image) ? image : backgroundImageSelector = new Selector<string>();
}
- set => SetValue(BackgroundImageSelectorProperty, value);
- }
-
- /// 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 View.States? State
- {
- get => (View.States?)GetValue(StateProperty);
- set => SetValue(StateProperty, value);
- }
-
- /// 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 View.States? SubState
- {
- get => (View.States?)GetValue(SubStateProperty);
- set => SetValue(SubStateProperty, value);
- }
-
- /// 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 float? Flex
- {
- get => (float?)GetValue(FlexProperty);
- set => SetValue(FlexProperty, value);
- }
-
- /// 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 int? AlignSelf
- {
- get => (int?)GetValue(AlignSelfProperty);
- set => SetValue(AlignSelfProperty, value);
- }
-
- /// 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 Vector4 FlexMargin
- {
- get => (Vector4)GetValue(FlexMarginProperty);
- set => SetValue(FlexMarginProperty, value);
- }
-
- /// 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 CellIndex
- {
- get => (Vector2)GetValue(CellIndexProperty);
- set => SetValue(CellIndexProperty, value);
- }
-
- /// 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 float? RowSpan
- {
- get => (float?)GetValue(RowSpanProperty);
- set => SetValue(RowSpanProperty, value);
- }
-
- /// 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 float? ColumnSpan
- {
- get => (float?)GetValue(ColumnSpanProperty);
- set => SetValue(ColumnSpanProperty, value);
- }
-
- /// 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 HorizontalAlignmentType? CellHorizontalAlignment
- {
- get => (HorizontalAlignmentType?)GetValue(CellHorizontalAlignmentProperty);
- set => SetValue(CellHorizontalAlignmentProperty, value);
- }
-
- /// 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 VerticalAlignmentType? CellVerticalAlignment
- {
- get => (VerticalAlignmentType?)GetValue(CellVerticalAlignmentProperty);
- set => SetValue(CellVerticalAlignmentProperty, value);
- }
-
- /// 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 View LeftFocusableView
- {
- get => (View)GetValue(LeftFocusableViewProperty);
- set => SetValue(LeftFocusableViewProperty, value);
- }
-
- /// 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 View RightFocusableView
- {
- get => (View)GetValue(RightFocusableViewProperty);
- set => SetValue(RightFocusableViewProperty, value);
- }
-
- /// 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 View UpFocusableView
- {
- get => (View)GetValue(UpFocusableViewProperty);
- set => SetValue(UpFocusableViewProperty, value);
- }
-
- /// 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 View DownFocusableView
- {
- get => (View)GetValue(DownFocusableViewProperty);
- set => SetValue(DownFocusableViewProperty, value);
+ set => SetValue(BackgroundImageProperty, value);
}
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
}
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [Obsolete("Deprecated. Please use Size instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public Size2D Size2D
{
set => SetValue(Size2DProperty, value);
}
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <summary>
+ /// Defines view's opacity value.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
public Selector<float?> Opacity
{
get
{
- Selector<float?> opacity = (Selector<float?>)GetValue(OpacitySelectorProperty);
+ Selector<float?> opacity = (Selector<float?>)GetValue(OpacityProperty);
return (null != opacity) ? opacity : opacitySelector = new Selector<float?>();
}
- set => SetValue(OpacitySelectorProperty, value);
+ set => SetValue(OpacityProperty, value);
}
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [Obsolete("Deprecated. Please use Position instead.")]
[EditorBrowsable(EditorBrowsableState.Never)]
public Position2D Position2D
{
set => SetValue(Position2DProperty, value);
}
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <summary>
+ /// Determines whether the pivot point should be used to determine the position of the view.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
public bool? PositionUsesPivotPoint
{
get => (bool?)GetValue(PositionUsesPivotPointProperty);
set => SetValue(PositionUsesPivotPointProperty, value);
}
- /// 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 int? SiblingOrder
- {
- get => (int?)GetValue(SiblingOrderProperty);
- set => SetValue(SiblingOrderProperty, value);
- }
-
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <summary>
+ /// Gets or sets the origin of a view within its parent's area.<br />
+ /// 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 />
+ /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).<br />
+ /// A view's position is the distance between this origin and the view's anchor-point.<br />
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
public Position ParentOrigin
{
get => (Position)GetValue(ParentOriginProperty);
set => SetValue(ParentOriginProperty, value);
}
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <summary>
+ /// Gets or sets the pivot point of a view.<br />
+ /// 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 />
+ /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).<br />
+ /// A view position is the distance between its parent origin and this pivot point.<br />
+ /// A view's orientation is the rotation from its default orientation, the rotation is centered around its pivot point.<br />
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
public Position PivotPoint
{
get => (Position)GetValue(PivotPointProperty);
set => SetValue(PivotPointProperty, value);
}
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <summary>
+ /// Gets or sets the width of the view.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
public float? SizeWidth
{
get => (float?)GetValue(SizeWidthProperty);
set => SetValue(SizeWidthProperty, value);
}
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <summary>
+ /// Gets or sets the height of the view.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
public float? SizeHeight
{
get => (float?)GetValue(SizeHeightProperty);
set => SetValue(SizeHeightProperty, value);
}
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <summary>
+ /// Gets or sets the position of the view.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
public Position Position
{
get => (Position)GetValue(PositionProperty);
/// 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 float? PositionZ
- {
- get => (float?)GetValue(PositionZProperty);
- set => SetValue(PositionZProperty, value);
- }
-
- /// 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 Rotation Orientation
{
get => (Rotation)GetValue(OrientationProperty);
/// 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 Vector3 Scale
- {
- get => (Vector3)GetValue(ScaleProperty);
- set => SetValue(ScaleProperty, value);
- }
-
- /// 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 float? ScaleX
- {
- get => (float?)GetValue(ScaleXProperty);
- set => SetValue(ScaleXProperty, value);
- }
-
- /// 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 float? ScaleY
- {
- get => (float?)GetValue(ScaleYProperty);
- set => SetValue(ScaleYProperty, value);
- }
-
- /// 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 float? ScaleZ
- {
- get => (float?)GetValue(ScaleZProperty);
- set => SetValue(ScaleZProperty, value);
- }
-
- /// 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 string Name
- {
- get => (string)GetValue(NameProperty);
- set => SetValue(NameProperty, value);
- }
-
- /// 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 bool? Sensitive
- {
- get => (bool?)GetValue(SensitiveProperty);
- set => SetValue(SensitiveProperty, value);
- }
-
- /// 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 bool? LeaveRequired
- {
- get => (bool?)GetValue(LeaveRequiredProperty);
- set => SetValue(LeaveRequiredProperty, value);
- }
-
- /// 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 bool? InheritOrientation
- {
- get => (bool?)GetValue(InheritOrientationProperty);
- set => SetValue(InheritOrientationProperty, value);
- }
-
- /// 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 bool? InheritScale
- {
- get => (bool?)GetValue(InheritScaleProperty);
- set => SetValue(InheritScaleProperty, value);
- }
-
- /// 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 DrawModeType? DrawMode
{
get => (DrawModeType?)GetValue(DrawModeProperty);
set => SetValue(DrawModeProperty, value);
}
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <summary>
+ /// Gets or sets the relative to parent size factor of the view.<br />
+ /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.<br />
+ /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.<br />
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
public Vector3 SizeModeFactor
{
get => (Vector3)GetValue(SizeModeFactorProperty);
set => SetValue(SizeModeFactorProperty, value);
}
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <summary>
+ /// Gets or sets the width resize policy to be used.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
public ResizePolicyType? WidthResizePolicy
{
get => (ResizePolicyType?)GetValue(WidthResizePolicyProperty);
set => SetValue(WidthResizePolicyProperty, value);
}
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <summary>
+ /// Gets or sets the height resize policy to be used.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
public ResizePolicyType? HeightResizePolicy
{
get => (ResizePolicyType?)GetValue(HeightResizePolicyProperty);
/// 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 SizeScalePolicyType? SizeScalePolicy
- {
- get => (SizeScalePolicyType?)GetValue(SizeScalePolicyProperty);
- set => SetValue(SizeScalePolicyProperty, value);
- }
-
- /// 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 bool? WidthForHeight
{
get => (bool?)GetValue(WidthForHeightProperty);
set => SetValue(HeightForWidthProperty, value);
}
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <summary>
+ /// Gets or sets the padding for use in layout.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
public Extents Padding
{
- get
- {
- Extents tmp = (Extents)GetValue(PaddingProperty);
- return (null != tmp) ? tmp : padding = new Extents(OnPaddingChanged, 0, 0, 0, 0);
- }
+ get => (Extents)GetValue(PaddingProperty) ?? (padding = new Extents());
set => SetValue(PaddingProperty, value);
}
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <summary>
+ /// Gets or sets the minimum size the view can be assigned in size negotiation.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
public Size2D MinimumSize
{
get => (Size2D)GetValue(MinimumSizeProperty);
set => SetValue(MinimumSizeProperty, value);
}
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <summary>
+ /// Gets or sets the maximum size the view can be assigned in size negotiation.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
public Size2D MaximumSize
{
get => (Size2D)GetValue(MaximumSizeProperty);
/// 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 bool? InheritPosition
- {
- get => (bool?)GetValue(InheritPositionProperty);
- set => SetValue(InheritPositionProperty, value);
- }
-
- /// 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 ClippingModeType? ClippingMode
{
get => (ClippingModeType?)GetValue(ClippingModeProperty);
set => SetValue(ClippingModeProperty, value);
}
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <summary>
+ /// Sets the size of a view for the width, the height, and the depth.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
public Size Size
{
- get
- {
- Size tmp = (Size)GetValue(SizeProperty);
- return (null != tmp) ? tmp : size = new Size((float width, float height, float depth) => { Size = new Size(width, height, depth); }, 0, 0, 0);
- }
+ get => (Size)GetValue(SizeProperty);
set => SetValue(SizeProperty, value);
}
- /// 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 bool? InheritLayoutDirection
- {
- get => (bool?)GetValue(InheritLayoutDirectionProperty);
- set => SetValue(InheritLayoutDirectionProperty, value);
- }
-
- /// 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 ViewLayoutDirectionType? LayoutDirection
- {
- get => (ViewLayoutDirectionType?)GetValue(LayoutDirectionProperty);
- set => SetValue(LayoutDirectionProperty, value);
- }
-
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <summary>
+ /// Gets or sets the Margin for use in layout.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
public Extents Margin
{
- get
- {
- Extents tmp = (Extents)GetValue(MarginProperty);
- return (null != tmp) ? tmp : margin = new Extents(OnMarginChanged, 0, 0, 0, 0);
- }
+ get => (Extents)GetValue(MarginProperty) ?? (margin = new Extents());
set => SetValue(MarginProperty, value);
}
- /// 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 float? Weight
- {
- get => (float?)GetValue(WeightProperty);
- set => SetValue(WeightProperty, value);
- }
-
- /// <summary> View BackgroundColor </summary>
- /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <summary>
+ /// Gets or sets the color of the background of view.
+ /// The mutually exclusive with "BackgroundImage". Setting it overwrites existing "BackgroundImage".
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
public Selector<Color> BackgroundColor
{
get
{
- Selector<Color> color = (Selector<Color>)GetValue(BackgroundColorSelectorProperty);
+ Selector<Color> color = (Selector<Color>)GetValue(BackgroundColorProperty);
return (null != color) ? color : backgroundColorSelector = new Selector<Color>();
}
- set => SetValue(BackgroundColorSelectorProperty, value);
+ set => SetValue(BackgroundColorProperty, value);
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public Selector<Color> Color
{
- get
- {
- Selector<Color> color = (Selector<Color>)GetValue(ColorSelectorProperty);
- return (null != color) ? color : colorSelector = new Selector<Color>();
- }
- set => SetValue(ColorSelectorProperty, value);
+ get => (Selector<Color>)GetValue(ColorProperty) ?? (colorSelector = new Selector<Color>());
+ set => SetValue(ColorProperty, value);
}
/// <summary>View BackgroundBorder</summary>
{
get
{
- Selector<Rectangle> border = (Selector<Rectangle>)GetValue(BackgroundImageBorderSelectorProperty);
+ Selector<Rectangle> border = (Selector<Rectangle>)GetValue(BackgroundImageBorderProperty);
return (null != border) ? border : backgroundImageBorderSelector = new Selector<Rectangle>();
}
- set => SetValue(BackgroundImageBorderSelectorProperty, value);
+ set => SetValue(BackgroundImageBorderProperty, value);
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public Selector<ImageShadow> ImageShadow
{
- get => (Selector<ImageShadow>)GetValue(ImageShadowSelectorProperty);
- set => SetValue(ImageShadowSelectorProperty, value);
+ get => (Selector<ImageShadow>)GetValue(ImageShadowProperty);
+ set => SetValue(ImageShadowProperty, value);
}
/// <summary>
/// Describes a box shaped shadow drawing for a View.
- /// It is null by default.
/// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// <since_tizen> 9 </since_tizen>
public Selector<Shadow> BoxShadow
{
- get => (Selector<Shadow>)GetValue(BoxShadowSelectorProperty);
- set => SetValue(BoxShadowSelectorProperty, value);
+ get => (Selector<Shadow>)GetValue(BoxShadowProperty);
+ set => SetValue(BoxShadowProperty, value);
}
/// <summary>
- /// The radius for the rounded corners of the View
+ /// The radius for the rounded corners of the View.
+ /// 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).
/// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public Selector<float?> CornerRadius
+ /// <since_tizen> 9 </since_tizen>
+ public Vector4 CornerRadius
{
- get => (Selector<float?>)GetValue(CornerRadiusProperty);
+ get => (Vector4)GetValue(CornerRadiusProperty);
set => SetValue(CornerRadiusProperty, value);
}
/// <summary>
- /// Set style's bindable properties from the view.
+ /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] 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.
+ /// </summary>
+ /// <since_tizen> 9 </since_tizen>
+ public VisualTransformPolicyType? CornerRadiusPolicy
+ {
+ get => (VisualTransformPolicyType?)GetValue(CornerRadiusPolicyProperty);
+ set => SetValue(CornerRadiusPolicyProperty, value);
+ }
+
+ /// <summary>
+ /// The ThemeChangeSensitive value of the View.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool? ThemeChangeSensitive
+ {
+ get => (bool?)GetValue(ThemeChangeSensitiveProperty);
+ set => SetValue(ThemeChangeSensitiveProperty, value);
+ }
+
+
+ /// <summary>
+ /// Allow null properties when merging it into other Theme.
+ /// If the value is true, the null properties reset target properties of the other ViewStyle with same key when merge.
+ /// It is used in <seealso cref="Theme.Merge(string)"/>, <seealso cref="Theme.Merge(Theme)"/>.
+ /// It is also used in <seealso cref="Theme.GetStyle(string)"/> when the Theme has a parent and needs to merge.
+ /// Please note that it is false by default.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool SolidNull { get; set; } = false;
+
+ /// <summary>
+ /// HashSet of dirty properties. Internal use only.
+ /// </summary>
+ internal HashSet<BindableProperty> DirtyProperties { get; private set; }
+
+ /// <summary>Create a cloned ViewStyle.</summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ViewStyle Clone()
+ {
+ var cloned = CreateInstance();
+ cloned.CopyFrom(this);
+
+ return cloned;
+ }
+
+ /// <summary>
+ /// Release instance.
/// </summary>
- /// <param name="view">The view that includes property data.</param>
+ /// <since_tizen> 9 </since_tizen>
+ public void Dispose()
+ {
+ Dispose(true);
+ global::System.GC.SuppressFinalize(this);
+ }
+
+ /// <inheritdoc/>
[EditorBrowsable(EditorBrowsableState.Never)]
- public virtual void CopyPropertiesFromView(View view)
+ public override void CopyFrom(BindableObject other)
{
- if (view == null) return;
+ var source = other as ViewStyle;
+
+ if (source == null || source.DirtyProperties == null || source.DirtyProperties.Count == 0)
+ {
+ return;
+ }
- BindableProperty.GetBindablePropertysOfType(GetType(), out var styleProperties);
- BindableProperty.GetBindablePropertysOfType(view.GetType(), out var viewProperties);
-
+ BindableProperty.GetBindablePropertysOfType(GetType(), out var thisBindableProperties);
- if (styleProperties == null || viewProperties == null) return;
+ if (thisBindableProperties == null)
+ {
+ return;
+ }
- foreach (var stylePropertyItem in styleProperties)
+ foreach (var sourceProperty in source.DirtyProperties)
{
- viewProperties.TryGetValue(stylePropertyItem.Key, out var viewProperty);
+ var sourceValue = source.GetValue(sourceProperty);
- if (viewProperty == null) continue;
+ if (sourceValue == null)
+ {
+ continue;
+ }
- SetValue(stylePropertyItem.Value, view.GetValue(viewProperty));
+ thisBindableProperties.TryGetValue(sourceProperty.PropertyName, out var destinationProperty);
+
+ if (destinationProperty != null)
+ {
+ SetValue(destinationProperty, sourceValue);
+ }
}
}
- internal ViewStyle CreateInstance()
+ /// <summary>
+ /// Release instance.
+ /// </summary>
+ /// <param name="disposing"> If it true, the method has been called by a user's code. Otherwise the method has been called by the finalizer. </param>
+ /// <since_tizen> 9 </since_tizen>
+ protected virtual void Dispose(bool disposing)
{
- return (ViewStyle)Activator.CreateInstance(GetType());
+ if (disposed)
+ {
+ return;
+ }
+
+ if (disposing)
+ {
+ // Dispose managed state (managed objects).
+ margin?.Dispose();
+ maximumSize?.Dispose();
+ minimumSize?.Dispose();
+ orientation?.Dispose();
+ padding?.Dispose();
+ parentOrigin?.Dispose();
+ pivotPoint?.Dispose();
+ position?.Dispose();
+ size?.Dispose();
+ sizeModeFactor?.Dispose();
+ }
+
+ disposed = true;
}
- internal ViewStyle Clone()
+ /// <summary>
+ /// Method that is called when a bound property is changed.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void OnPropertyChangedWithData(BindableProperty property)
{
- var cloned = CreateInstance();
- cloned.CopyFrom(this);
+ base.OnPropertyChangedWithData(property);
- return cloned;
+ if (property != null)
+ {
+ (DirtyProperties ?? (DirtyProperties = new HashSet<BindableProperty>())).Add(property);
+ }
}
- private void OnPaddingChanged(ushort start, ushort end, ushort top, ushort bottom)
+ internal ViewStyle CreateInstance()
{
- Padding = new Extents(start, end, top, bottom);
+ return (ViewStyle)Activator.CreateInstance(GetType());
}
- private void OnMarginChanged(ushort start, ushort end, ushort top, ushort bottom)
+ /// <summary>Merge other style into the current style without creating new one.</summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ internal void MergeDirectly(ViewStyle other)
{
- Margin = new Extents(start, end, top, bottom);
+ CopyFrom(other);
+ }
+ }
+
+ /// <summary> Extension methods for ViewStyle class.</summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static class ViewStyleExtension
+ {
+ /// <summary>Merge two styles into the new one.</summary>
+ /// <exception cref="ArgumentException">Thrown when failed because of an invalid parameter.</exception>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static TOut Merge<TOut>(this TOut value, TOut other) where TOut : Tizen.NUI.BaseComponents.ViewStyle
+ {
+ var newStyle = value.Clone() as TOut;
+
+ newStyle?.CopyFrom(other);
+
+ return newStyle;
}
}
}