/* * Copyright(c) 2022 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(); private static bool defaultGrabTouchAfterLeave = false; private static bool defaultAllowOnlyOwnTouch = false; 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 backgroundImageSynchronousLoading = false; private bool excludeLayouting = false; private LayoutTransition layoutTransition; private TransitionOptions transitionOptions = null; private ThemeData themeData; private bool isThemeChanged = false; // List of constraints private Constraint widthConstraint = null; private Constraint heightConstraint = null; private Size2D internalMaximumSize = null; private Size2D internalMinimumSize = null; private Extents internalMargin = null; private Extents internalPadding = null; private Vector3 internalSizeModeFactor = null; private Vector2 internalCellIndex = null; private Color internalBackgroundColor = null; private Color internalColor = null; private Position internalPivotPoint = null; private Position internalPosition = null; private Position2D internalPosition2D = null; private Vector3 internalScale = null; private Size internalSize = null; private Size2D internalSize2D = null; private int layoutCount = 0; private ControlState propagatableControlStates = ControlState.All; private string internalName = string.Empty; private Position internalCurrentParentOrigin = null; private Position internalCurrentAnchorPoint = null; private Vector3 internalTargetSize = null; private Size2D internalCurrentSize = null; private Position internalCurrentPosition = null; private Vector3 internalCurrentWorldPosition = null; private Vector3 internalCurrentScale = null; private Vector3 internalCurrentWorldScale = null; private Vector4 internalCurrentColor = null; private Vector4 internalCurrentWorldColor = null; private Vector2 internalCurrentScreenPosition = null; private static int aliveCount = 0; 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); RegisterAccessibilityDelegate(); } static internal new void Preload() { Container.Preload(); // Do nothing. Just call for load static values. var temporalPositionPropertyGroup = positionPropertyGroup; var temporalSizePropertyGroup = sizePropertyGroup; var temporalScalePropertyGroup = scalePropertyGroup; } /// /// Accessibility mode for controlling View's Accessible implementation. /// It is only relevant when deriving custom controls from View directly, /// as classes derived from CustomView (or any of its subclasses) get the /// Custom mode by default. /// [EditorBrowsable(EditorBrowsableState.Never)] public enum ViewAccessibilityMode { /// /// Default accessibility implementation. Overriding View.Accessibility...() /// virtual methods will have no effect. /// [EditorBrowsable(EditorBrowsableState.Never)] Default, /// /// Custom accessibility implementation. Overriding View.Accessibility...() /// will be necessary to provide accessibility support for the View. /// [EditorBrowsable(EditorBrowsableState.Never)] Custom, } private static IntPtr NewWithAccessibilityMode(ViewAccessibilityMode accessibilityMode) { switch (accessibilityMode) { case ViewAccessibilityMode.Custom: { return Interop.View.NewCustom(); } case ViewAccessibilityMode.Default: default: { return Interop.View.New(); } } } /// /// Creates a new instance of a view. /// /// 3 public View() : this(ViewAccessibilityMode.Default) { } [EditorBrowsable(EditorBrowsableState.Never)] public View(ViewAccessibilityMode accessibilityMode) : this(NewWithAccessibilityMode(accessibilityMode), 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(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) : this(cPtr, cMemoryOwn, shown, cMemoryOwn) { } internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown, bool cRegister) : base(cPtr, cMemoryOwn, cRegister) { if (HasBody()) { PositionUsesPivotPoint = false; GrabTouchAfterLeave = defaultGrabTouchAfterLeave; AllowOnlyOwnTouch = defaultAllowOnlyOwnTouch; } if (!shown) { SetVisible(false); } aliveCount++; } 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; /// /// If set to true, the property value is set to true when all Views are created. /// /// Sets value of GrabTouchAfterLeave property [EditorBrowsable(EditorBrowsableState.Never)] public static void SetDefaultGrabTouchAfterLeave(bool enable) { defaultGrabTouchAfterLeave = enable; } /// /// If set to true, the property value is set to true when all Views are created. /// /// Sets value of AllowOnlyOwnTouch property [EditorBrowsable(EditorBrowsableState.Never)] public static void SetDefaultAllowOnlyOwnTouch(bool enable) { defaultAllowOnlyOwnTouch = enable; } /// /// Deprecate. Do not use this. /// The style instance applied to this view. /// Note that 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) { ControlState allowed = child.PropagatableControlStates; if (allowed.Contains(ControlState.All)) { child.ControlState = value; } else { ControlState newControlState = child.ControlState; if (allowed.Contains(ControlState.Normal)) { if (value.Contains(ControlState.Normal)) { newControlState += ControlState.Normal; } else { newControlState -= ControlState.Normal; } } if (allowed.Contains(ControlState.Disabled)) { if (value.Contains(ControlState.Disabled)) { newControlState += ControlState.Disabled; } else { newControlState -= ControlState.Disabled; } } if (allowed.Contains(ControlState.Selected)) { if (value.Contains(ControlState.Selected)) { newControlState += ControlState.Selected; } else { newControlState -= ControlState.Selected; } } if (allowed.Contains(ControlState.Pressed)) { if (value.Contains(ControlState.Pressed)) { newControlState += ControlState.Pressed; } else { newControlState -= ControlState.Pressed; } } if (allowed.Contains(ControlState.Focused)) { if (value.Contains(ControlState.Focused)) { newControlState += ControlState.Focused; } else { newControlState -= ControlState.Focused; } } if (allowed.Contains(ControlState.Other)) { if (value.Contains(ControlState.Other)) { newControlState += ControlState.Other; } else { newControlState -= ControlState.Other; } } if (child.ControlState != newControlState) child.ControlState = newControlState; } } } 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 (bool)GetValue(ExcludeLayoutingProperty); } set { SetValue(ExcludeLayoutingProperty, value); NotifyPropertyChanged(); } } private bool InternalExcludeLayouting { get { return excludeLayouting; } set { excludeLayouting = value; if (Layout != null && Layout.SetPositionByLayout == value) { Layout.SetPositionByLayout = !value; Layout.RequestLayout(); } } } /// /// 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 not recommended. /// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "BackgroundColor", new Color(r, g, b, a)); /// /// /// /// /// This way is recommended for setting the property /// /// var view = new View(); /// view.BackgroundColor = new Color(0.5f, 0.1f, 0, 1); /// /// This way to set the property is prohibited /// /// view.BackgroundColor.R = 0.5f; //This does not guarantee a proper operation /// /// /// 3 public Color BackgroundColor { get { return (Color)GetValue(BackgroundColorProperty); } 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. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "BorderlineWidth", 100.0f); /// /// /// Note that, an image background may not have borderline if it uses the Border property. /// /// 9 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. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "BorderlineColor", new Color(r, g, b, a)); /// /// /// /// 9 public Color BorderlineColor { get { return (Color)GetValue(BorderlineColorProperty); } set { SetValue(BorderlineColorProperty, value); NotifyPropertyChanged(); } } /// /// The color selector for the borderline of the View. /// Like BackgroundColor, color selector typed BorderlineColor should be used in ViewStyle only. /// So this API is internally used only. /// internal Selector BorderlineColorSelector { get { return (Selector)GetValue(BorderlineColorSelectorProperty); } set { SetValue(BorderlineColorSelectorProperty, value); NotifyPropertyChanged(); } } /// /// The Relative offset for the borderline of the View. /// Recommended range : [-1.0f to 1.0f]. /// If -1.0f, draw borderline inside of the View. /// If 1.0f, draw borderline outside of the View. /// If 0.0f, draw borderline half inside and half outside. /// It is 0.0f by default. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// animation.AnimateTo(view, "BorderlineOffset", -1.0f); /// /// /// /// 9 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 { return GetValue(TooltipTextProperty) as string; } set { SetValue(TooltipTextProperty, value); } } private string InternalTooltipText { get { using (var propertyValue = GetProperty(Property.TOOLTIP)) { using var propertyMap = new PropertyMap(); if (propertyValue != null && propertyValue.Get(propertyMap)) { using var retrivedContentValue = propertyMap?.Find(NDalic.TooltipContent); if (retrivedContentValue != null) { using var contextPropertyMap = new PropertyMap(); if (retrivedContentValue.Get(contextPropertyMap)) { using var retrivedTextValue = contextPropertyMap?.Find(NDalic.TextVisualText); if (retrivedTextValue != null && retrivedTextValue.Get(out string retrivedValue)) { return retrivedValue; } } } } return ""; } } 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 not recommended. /// Also, this property is for class. Please use the property for the child position of . /// /// /// This way is recommended for setting the property /// /// var view = new View(); /// view.CellIndex = new Vector2(1, 3); /// /// This way to set the property is prohibited /// /// view.CellIndex.X = 1; //This does not guarantee a proper operation /// /// /// 3 public Vector2 CellIndex { get { return (Vector2)GetValue(CellIndexProperty); } 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. 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. 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. 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. 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(); } } /// /// The clockwise focusable view by rotary wheel.
/// This will return null if not set.
/// This will also return null if the specified clockwise focusable view is not on a window.
///
[EditorBrowsable(EditorBrowsableState.Never)] public View ClockwiseFocusableView { // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa. get { return (View)GetValue(ClockwiseFocusableViewProperty); } set { SetValue(ClockwiseFocusableViewProperty, value); NotifyPropertyChanged(); } } /// /// The counter clockwise focusable view by rotary wheel.
/// This will return null if not set.
/// This will also return null if the specified counter clockwise focusable view is not on a window.
///
[EditorBrowsable(EditorBrowsableState.Never)] public View CounterClockwiseFocusableView { // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa. get { return (View)GetValue(CounterClockwiseFocusableViewProperty); } set { SetValue(CounterClockwiseFocusableViewProperty, 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 the children of this view can be focusable by keyboard navigation. If user sets this to false, the children of this actor view will not be focused. /// Note : Default value is true. /// [EditorBrowsable(EditorBrowsableState.Never)] public bool FocusableChildren { set { SetValue(FocusableChildrenProperty, value); NotifyPropertyChanged(); } get { return (bool)GetValue(FocusableChildrenProperty); } } /// /// 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. /// /// /// The , , , and properties are set in the main thread. /// Therefore, it is not updated in real time when the value is changed in the render thread (for example, the value is changed during animation). /// However, , , , and properties are updated in real time, /// and users can get the current actual values through them. /// /// 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.
///
/// /// The property cascade chaining set is not recommended. /// /// /// This way is recommended for setting the property /// /// var view = new View(); /// view.Size2D = new Size2D(100, 200); /// /// This way to set the property is prohibited /// /// view.Size2D.Width = 100; //This does not guarantee a proper operation /// /// /// 3 public Size2D Size2D { get { var temp = (Size2D)GetValue(Size2DProperty); if (this.Layout == null) { if (temp.Width < 0) { temp.Width = 0; } if (temp.Height < 0) { temp.Height = 0; } } return temp; } set { SetValue(Size2DProperty, value); NotifyPropertyChanged(); } } /// /// Retrieves the size of the view. /// The coordinates are relative to the view's parent. /// /// /// The , , , and properties are set in the main thread. /// Therefore, it is not updated in real time when the value is changed in the render thread (for example, the value is changed during animation). /// However, , , , and properties are updated in real time, /// and users can get the current actual values through them. /// /// 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.
///
/// /// The property cascade chaining set is not recommended. /// /// /// This way is recommended for setting the property /// /// var view = new View(); /// view.Position2D = new Position2D(100, 200); /// /// This way to set the property is prohibited /// /// view.Position2D.X = 100; //This does not guarantee a proper operation /// /// /// 3 public Position2D Position2D { get { return (Position2D)GetValue(Position2DProperty); } set { SetValue(Position2DProperty, value); NotifyPropertyChanged(); } } /// /// Retrieves the screen position of the view.
///
/// 3 public Vector2 ScreenPosition { get { return GetCurrentScreenPosition(); } } /// /// Retrieves the screen position and size of the view.
///
/// /// The float type Rectangle class is not ready yet. /// Therefore, it transmits data in Vector4 class. /// This type should later be changed to the appropriate data type. /// [EditorBrowsable(EditorBrowsableState.Never)] public Vector4 ScreenPositionSize { get { return GetCurrentScreenPositionSize(); } } /// /// 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(); } } /// /// This has been deprecated in API5 and Will be removed in API8. Use PositionUsesPivotPoint instead. /// /// 3 [Obsolete("This has been deprecated in API5 and will be removed in API8. Use PositionUsesPivotPoint instead. " + "Like: " + "View view = new View(); " + "view.PivotPoint = PivotPoint.Center; " + "view.PositionUsesPivotPoint = true;" + " This has been deprecated in API5 and will be removed in API8")] [EditorBrowsable(EditorBrowsableState.Never)] public bool PositionUsesAnchorPoint { get { return (bool)GetValue(PositionUsesAnchorPointProperty); } set { SetValue(PositionUsesAnchorPointProperty, value); } } private bool InternalPositionUsesAnchorPoint { get { return Object.InternalGetPropertyBool(SwigCPtr, View.Property.PositionUsesAnchorPoint); } set { Object.InternalSetPropertyBool(SwigCPtr, View.Property.PositionUsesAnchorPoint, value); 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); 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 = GetNaturalSize(); 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 = GetNaturalSize(); if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); Size2D sz = null; if (temp != null) { 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 not recommended. /// /// /// This way is recommended for setting the property /// /// var view = new View(); /// view.PivotPoint = PivotPoint.Center; /// /// This way to set the property is prohibited /// /// view.PivotPoint.X = 0.5f; //This does not guarantee a proper operation /// /// /// 3 public Position PivotPoint { get { return (Position)GetValue(PivotPointProperty); } 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 not recommended. /// /// /// This way is recommended for setting the property /// /// var view = new View(); /// view.Position = new Position(100, 200.5f, 0); /// /// This way to set the property is prohibited /// /// view.Position.Y = 200.5f; //This does not guarantee a proper operation /// /// /// 3 public Position Position { get { return (Position)GetValue(PositionProperty); } 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 { return GetCurrentWorldPosition(); } } /// /// 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 not recommended. /// /// /// This way is recommended for setting the property /// /// var view = new View(); /// view.Scale = new Vector3(1.5f, 2.0f, 1.0f); /// /// This way to set the property is prohibited /// /// view.Scale.Width = 1.5f; //This does not guarantee a proper operation /// /// /// 3 public Vector3 Scale { get { return (Vector3)GetValue(ScaleProperty); } 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 { return GetCurrentWorldScale(); } } /// /// 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 { return Object.InternalGetPropertyBool(SwigCPtr, View.Property.VISIBLE); } } /// /// Gets the view's world color. /// /// 3 public Vector4 WorldColor { get { return GetCurrentWorldColor(); } } /// /// 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 be enabled user interactions. /// If a View is made disabled, then user interactions including touch, focus, and actiavation is disabled. /// /// tizen_next [EditorBrowsable(EditorBrowsableState.Never)] public bool IsEnabled { get { return (bool)GetValue(IsEnabledProperty); } set { SetValue(IsEnabledProperty, 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 not recommended. /// /// /// This way is recommended for setting the property /// /// var text = new TextField(); /// text.SizeModeFactor = new Vector3(1.0f, 0.45f, 1.0f); /// /// This way to set the property is prohibited /// /// text.SizeModeFactor.Width = 1.0f; //This does not guarantee a proper operation /// /// /// 3 public Vector3 SizeModeFactor { get { return (Vector3)GetValue(SizeModeFactorProperty); } 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 not recommended. /// /// /// This way is recommended for setting the property /// /// var view = new View(); /// view.Padding = new Extents(5, 5, 5, 5); /// /// This way to set the property is prohibited /// /// view.Padding.Start = 5; //This does not guarantee a proper operation /// /// /// 5 public Extents Padding { get { return (Extents)GetValue(PaddingProperty); } set { SetValue(PaddingProperty, value); 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 not recommended. /// /// /// This way is recommended for setting the property /// /// var view = new View(); /// view.MinimumSize = new Size2D(100, 200); /// /// This way to set the property is prohibited /// /// view.MinimumSize.Width = 100; //This does not guarantee a proper operation /// /// /// 3 public Size2D MinimumSize { get { return (Size2D)GetValue(MinimumSizeProperty); } 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. /// /// /// This way is recommended for setting the property /// /// var view = new View(); /// view.MaximumSize = new Size2D(100, 200); /// /// This way to set the property is prohibited /// /// view.MaximumSize.Height = 200; //This does not guarantee a proper operation /// /// /// 3 public Size2D MaximumSize { get { return (Size2D)GetValue(MaximumSizeProperty); } 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(); } } /// /// This has been deprecated in API5 and will be removed in API8. Use PivotPoint instead. /// /// /// The property cascade chaining set is possible. For example, this (view.AnchorPoint.X = 0.1f;) is possible. /// /// 3 [Obsolete("This has been deprecated in API5 and will be removed in API8. Use PivotPoint instead. " + "Like: " + "View view = new View(); " + "view.PivotPoint = PivotPoint.Center; " + "view.PositionUsesPivotPoint = true;")] [EditorBrowsable(EditorBrowsableState.Never)] public Position AnchorPoint { get { return GetValue(AnchorPointProperty) as Position; } set { SetValue(AnchorPointProperty, value); } } private Position InternalAnchorPoint { get { return GetCurrentAnchorPoint(); } set { SetAnchorPoint(value); 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 not recommended. /// /// /// This way is recommended for setting the property /// /// var view = new View(); /// view.Size = new Size(100.5f, 200, 0); /// /// This way to set the property is prohibited /// /// view.Size.Width = 100.5f; //This does not guarantee a proper operation /// /// /// 5 public Size Size { get { return (Size)GetValue(SizeProperty); } set { SetValue(SizeProperty, value); NotifyPropertyChanged(); } } /// /// This has been deprecated in API5 and will be removed in API8. Use 'Container GetParent() for derived class' instead. /// /// 3 [Obsolete("This has been deprecated in API5 and will be removed in API8. 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 not recommended. /// /// /// This way is recommended for setting the property /// /// var view = new View(); /// view.Margin = new Extents(10, 5, 15, 20); /// /// This way to set the property is prohibited /// /// view.Margin.Top = 15; //This does not guarantee a proper operation /// /// /// 4 public Extents Margin { get { return (Extents)GetValue(MarginProperty); } set { SetValue(MarginProperty, value); NotifyPropertyChanged(); } } /// /// 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 [Binding.TypeConverter(typeof(IntGraphicsTypeConverter))] public int WidthSpecification { get { return (int)GetValue(WidthSpecificationProperty); } set { SetValue(WidthSpecificationProperty, value); NotifyPropertyChanged(); } } private int InternalWidthSpecification { get { return widthPolicy; } set { if (value == widthPolicy) return; widthPolicy = value; if (widthPolicy >= 0) { SizeWidth = widthPolicy; } 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 [Binding.TypeConverter(typeof(IntGraphicsTypeConverter))] public int HeightSpecification { get { return (int)GetValue(HeightSpecificationProperty); } set { SetValue(HeightSpecificationProperty, value); NotifyPropertyChanged(); } } private int InternalHeightSpecification { get { return heightPolicy; } set { if (value == heightPolicy) return; heightPolicy = value; if (heightPolicy >= 0) { SizeHeight = 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 GetValue(LayoutTransitionProperty) as LayoutTransition; } set { SetValue(LayoutTransitionProperty, value); NotifyPropertyChanged(); } } private LayoutTransition InternalLayoutTransition { 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; } } /// /// This has been deprecated in API5 and will be removed in API8. Use Padding instead. /// /// /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible. /// /// 4 [Obsolete("This has been deprecated in API5 and will be removed in API8. Use Padding instead.")] [EditorBrowsable(EditorBrowsableState.Never)] public Extents PaddingEX { get { return GetValue(PaddingEXProperty) as Extents; } set { SetValue(PaddingEXProperty, value); } } private Extents InternalPaddingEX { 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. /// Each RGBA components match as , , , and . /// This property will multiply the final color of this view. (BackgroundColor, BorderlineColor, BackgroundImage, etc). /// For example, if view.BackgroundColor = Color.Yellow and view.Color = Color.Purple, this view will shown as Red. /// Inherient of color value depend on . /// /// /// /// Animatable - This property can be animated using Animation class. /// /// The property cascade chaining set is not recommended. /// /// /// This way is recommended for setting the property /// /// var view = new View(); /// view.Color = new Color(0.5f, 0.2f, 0.1f, 0.5f); /// /// This way to set the property is prohibited /// /// view.Color.A = 0.5f; //This does not guarantee a proper operation /// /// [EditorBrowsable(EditorBrowsableState.Never)] public Color Color { get { return (Color)GetValue(ColorProperty); } set { SetValue(ColorProperty, value); NotifyPropertyChanged(); } } /// /// The Red component of View.Color. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// [EditorBrowsable(EditorBrowsableState.Never)] public float ColorRed { get { return (float)GetValue(ColorRedProperty); } set { SetValue(ColorRedProperty, value); NotifyPropertyChanged(); } } /// /// The Green component of View.Color. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// [EditorBrowsable(EditorBrowsableState.Never)] public float ColorGreen { get { return (float)GetValue(ColorGreenProperty); } set { SetValue(ColorGreenProperty, value); NotifyPropertyChanged(); } } /// /// The Blue component of View.Color. /// /// /// /// Animatable - This property can be animated using Animation class. /// /// [EditorBrowsable(EditorBrowsableState.Never)] public float ColorBlue { get { return (float)GetValue(ColorBlueProperty); } set { SetValue(ColorBlueProperty, 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 GetValue(LayoutProperty) as LayoutItem; } set { SetValue(LayoutProperty, value); } } private LayoutItem InternalLayout { 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. Margin = value.Margin, 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; value.SetPositionByLayout = !excludeLayouting; } 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; bool setMargin = false; bool setPadding = false; 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)); setMargin = true; } 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; SetValue(PaddingProperty, new Extents(0, 0, 0, 0)); setPadding = true; } if (setMargin || setPadding) { NotifyPropertyChanged(); } value.SetPositionByLayout = !excludeLayouting; } } // Remove existing layout from it's parent layout group. layout?.Unparent(); // 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 (bool)GetValue(BackgroundImageSynchronosLoadingProperty); } set { SetValue(BackgroundImageSynchronosLoadingProperty, value); NotifyPropertyChanged(); } } private bool InternalBackgroundImageSynchronosLoading { get { return BackgroundImageSynchronousLoading; } set { BackgroundImageSynchronousLoading = value; } } /// /// 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_7.0 after ACR done. Before ACR, need to be hidden as inhouse API. [EditorBrowsable(EditorBrowsableState.Never)] public bool BackgroundImageSynchronousLoading { get { return (bool)GetValue(BackgroundImageSynchronousLoadingProperty); } set { SetValue(BackgroundImageSynchronousLoadingProperty, value); NotifyPropertyChanged(); } } private bool InternalBackgroundImageSynchronousLoading { get { return backgroundImageSynchronousLoading; } set { backgroundImageSynchronousLoading = value; if (!string.IsNullOrEmpty(BackgroundImage)) { PropertyMap bgMap = this.Background; var temp = new PropertyValue(backgroundImageSynchronousLoading); bgMap[ImageVisualProperty.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 Vector4 UpdateAreaHint { get { return (Vector4)GetValue(UpdateAreaHintProperty); } set { SetValue(UpdateAreaHintProperty, 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 { return (bool)GetValue(EnableControlStatePropagationProperty); } set { SetValue(EnableControlStatePropagationProperty, value); NotifyPropertyChanged(); } } private bool InternalEnableControlStatePropagation { get => themeData?.ControlStatePropagation ?? false; set { if (InternalEnableControlStatePropagation == value) return; if (themeData == null) themeData = new ThemeData(); themeData.ControlStatePropagation = value; foreach (View child in Children) { child.EnableControlStatePropagation = value; } } } /// /// The ControlStates can propagate from the parent. /// Listed ControlStates will be accepted propagation of the parent ControlState changes /// if parent view EnableControlState is true. /// . /// Default is ControlState.All, so every ControlStates will be propagated from the parent. /// [EditorBrowsable(EditorBrowsableState.Never)] public ControlState PropagatableControlStates { get { return (ControlState)GetValue(PropagatableControlStatesProperty); } set { SetValue(PropagatableControlStatesProperty, value); NotifyPropertyChanged(); } } private ControlState InternalPropagatableControlStates { get => propagatableControlStates; set => propagatableControlStates = 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 { return (bool)GetValue(GrabTouchAfterLeaveProperty); } set { SetValue(GrabTouchAfterLeaveProperty, value); } } private bool InternalGrabTouchAfterLeave { get { return Object.InternalGetPropertyBool(SwigCPtr, View.Property.CaptureAllTouchAfterStart); } set { Object.InternalSetPropertyBool(SwigCPtr, View.Property.CaptureAllTouchAfterStart, value); // Use custom HitTest callback only if GrabTouchAfterLeave is true. if (value) { RegisterHitTestCallback(); } else { UnregisterHitTestCallback(); } NotifyPropertyChanged(); } } /// /// Whether the view will only receive own touch. /// /// true, if it only receives touches that started from itself. [EditorBrowsable(EditorBrowsableState.Never)] public bool AllowOnlyOwnTouch { get { return (bool)GetValue(AllowOnlyOwnTouchProperty); } set { SetValue(AllowOnlyOwnTouchProperty, value); } } private bool InternalAllowOnlyOwnTouch { get { return Object.InternalGetPropertyBool(SwigCPtr, View.Property.AllowOnlyOwnTouch); } set { Object.InternalSetPropertyBool(SwigCPtr, View.Property.AllowOnlyOwnTouch, value); 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 { return (BlendEquationType)GetValue(BlendEquationProperty); } set { SetValue(BlendEquationProperty, value); } } private BlendEquationType InternalBlendEquation { get { return (BlendEquationType)Object.InternalGetPropertyInt(SwigCPtr, View.Property.BlendEquation); } set { Object.InternalSetPropertyInt(SwigCPtr, View.Property.BlendEquation, (int)value); 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) { isThemeChanged = true; if (string.IsNullOrEmpty(styleName)) ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(GetType())); else ApplyStyle(ThemeManager.GetUpdateStyleWithoutClone(styleName)); isThemeChanged = false; } /// /// 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); // Do not set value again when theme is changed and the value has been set already. if (isThemeChanged && ChangedPropertiesSetExcludingStyle.Contains(destinationProperty)) { continue; } if (destinationProperty != null) { InternalSetValue(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 { return Object.InternalGetPropertyBool(SwigCPtr, View.Property.Culled); } } /// /// 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 { get { return GetValue(TransitionOptionsProperty) as TransitionOptions; } set { SetValue(TransitionOptionsProperty, value); NotifyPropertyChanged(); } } private TransitionOptions InternalTransitionOptions { set { transitionOptions = value; } get { return transitionOptions; } } /// /// Called when the view is hit through TouchEvent or GestureEvent. /// If it returns true, it means that it was hit, and the touch/gesture event is called from the view. /// If it returns false, it means that it will not be hit, and the hit-test continues to the next view. /// User can override whether hit or not in HitTest. /// You can get the coordinates relative to tthe top-left of the hit view by touch.GetLocalPosition(0). /// or you can get the coordinates relative to the top-left of the screen by touch.GetScreenPosition(0). /// // The touch data [EditorBrowsable(EditorBrowsableState.Never)] protected virtual bool HitTest(Touch touch) { return true; } /// /// Retrieve the View's current Color. /// /// /// The , , , and properties are set in the main thread. /// Therefore, it is not updated in real time when the value is changed in the render thread (for example, the value is changed during animation). /// However, , , , and properties are updated in real time, /// and users can get the current actual values through them. /// [EditorBrowsable(EditorBrowsableState.Never)] public Color CurrentColor => GetCurrentColor(); /// /// Retrieve the current scale factor applied to the View. /// /// /// The , , , and properties are set in the main thread. /// Therefore, it is not updated in real time when the value is changed in the render thread (for example, the value is changed during animation). /// However, , , , and properties are updated in real time, /// and users can get the current actual values through them. /// [EditorBrowsable(EditorBrowsableState.Never)] public Vector3 CurrentScale => GetCurrentScale(); /// /// Gets the number of currently alived View object. /// [EditorBrowsable(EditorBrowsableState.Never)] public static int AliveCount => aliveCount; } }