From: dongsug.song Date: Tue, 9 Nov 2021 11:43:52 +0000 (+0900) Subject: [NUI] Change Color, Position2D, and etc properties to own only one instance X-Git-Tag: accepted/tizen/unified/20231205.024657~1316 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fdcb3be1e2454f6ecd0748c1c56d2e6b23de7cc8;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Change Color, Position2D, and etc properties to own only one instance --- diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index f3f4a18..25ad045 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -52,6 +52,19 @@ namespace Tizen.NUI.BaseComponents 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; static View() @@ -337,7 +350,7 @@ namespace Tizen.NUI.BaseComponents /// /// /// - /// The property cascade chaining set is possible. For example, this (view.BackgroundColor.X = 0.1f;) is possible. + /// The property cascade chaining set is not recommended. /// /// /// Animatable - This property can be animated using Animation class. @@ -346,13 +359,23 @@ namespace Tizen.NUI.BaseComponents /// /// /// + /// + /// 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 { - Color temp = (Color)GetValue(BackgroundColorProperty); - return new Color(OnBackgroundColorChanged, temp.R, temp.G, temp.B, temp.A); + return (Color)GetValue(BackgroundColorProperty); } set { @@ -757,16 +780,26 @@ namespace Tizen.NUI.BaseComponents /// The top-left cell this child occupies, if not set, the first available cell is used. /// /// - /// The property cascade chaining set is possible. For example, this (view.CellIndex.X = 0.1f;) is possible. + /// 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 { - Vector2 temp = (Vector2)GetValue(CellIndexProperty); - return new Vector2(OnCellIndexChanged, temp.X, temp.Y); + return (Vector2)GetValue(CellIndexProperty); } set { @@ -1009,9 +1042,19 @@ namespace Tizen.NUI.BaseComponents /// The views default depth is the minimum of width and height.
/// /// - /// This NUI object (Size2D) typed property can be configured by multiple cascade setting.
- /// For example, this code ( view.Size2D.Width = 100; view.Size2D.Height = 100; ) is equivalent to this ( view.Size2D = new Size2D(100, 100); ).
+ /// 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 { @@ -1079,16 +1122,25 @@ namespace Tizen.NUI.BaseComponents /// If the position inheritance is disabled, sets the world position.
/// /// - /// This NUI object (Position2D) typed property can be configured by multiple cascade setting.
- /// For example, this code ( view.Position2D.X = 100; view.Position2D.Y = 100; ) is equivalent to this ( view.Position2D = new Position2D(100, 100); ).
- ///
+ /// 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 { - Position2D temp = (Position2D)GetValue(Position2DProperty); - return new Position2D(OnPosition2DChanged, temp.X, temp.Y); + return (Position2D)GetValue(Position2DProperty); } set { @@ -1294,15 +1346,25 @@ namespace Tizen.NUI.BaseComponents ///
The view has been initialized.
/// /// - /// The property cascade chaining set is possible. For example, this (view.PivotPoint.X = 0.1f;) is possible. - /// + /// 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 { - Position tmp = (Position)GetValue(PivotPointProperty); - return new Position(OnPivotPointChanged, tmp.X, tmp.Y, tmp.Z); + return (Position)GetValue(PivotPointProperty); } set { @@ -1373,15 +1435,25 @@ namespace Tizen.NUI.BaseComponents /// animation.AnimateTo(view, "Position", new Position(50, 0)); /// /// - /// The property cascade chaining set is possible. For example, this (view.Position.X = 1.0f;) is possible. + /// 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 { - Position tmp = (Position)GetValue(PositionProperty); - return new Position(OnPositionChanged, tmp.X, tmp.Y, tmp.Z); + return (Position)GetValue(PositionProperty); } set { @@ -1536,15 +1608,25 @@ namespace Tizen.NUI.BaseComponents /// animation.AnimateTo(view, "Scale", new Vector3(1.5f, 1.5f, 1.0f)); /// /// - /// The property cascade chaining set is possible. For example, this (view.Scale.X = 0.1f;) is possible. + /// 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 { - Vector3 temp = (Vector3)GetValue(ScaleProperty); - return new Vector3(OnScaleChanged, temp.X, temp.Y, temp.Z); + return (Vector3)GetValue(ScaleProperty); } set { @@ -1827,15 +1909,25 @@ namespace Tizen.NUI.BaseComponents /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.
/// /// - /// The property cascade chaining set is possible. For example, this (view.DecorationBoundingBox.X = 0.1f;) is possible. + /// 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 { - Vector3 temp = (Vector3)GetValue(SizeModeFactorProperty); - return new Vector3(OnSizeModeFactorChanged, temp.X, temp.Y, temp.Z); + return (Vector3)GetValue(SizeModeFactorProperty); } set { @@ -1940,8 +2032,19 @@ namespace Tizen.NUI.BaseComponents /// Gets or sets the padding for use in layout. /// /// - /// The property cascade chaining set is possible. For example, this (view.Padding.X = 0.1f;) is possible. + /// 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 { @@ -1954,8 +2057,7 @@ namespace Tizen.NUI.BaseComponents } else { - Extents temp = (Extents)GetValue(PaddingProperty); - return new Extents(OnPaddingChanged, temp.Start, temp.End, temp.Top, temp.Bottom); + return (Extents)GetValue(PaddingProperty); } // Two return points to prevent creating a zeroed Extent native object before assignment } @@ -1986,15 +2088,25 @@ namespace Tizen.NUI.BaseComponents /// /// Thrown when value is null. /// - /// The property cascade chaining set is possible. For example, this (view.MinimumSize.Width = 1;) is possible. + /// 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 { - Size2D tmp = (Size2D)GetValue(MinimumSizeProperty); - return new Size2D(OnMinimumSizeChanged, tmp.Width, tmp.Height); + return (Size2D)GetValue(MinimumSizeProperty); } set { @@ -2018,16 +2130,23 @@ namespace Tizen.NUI.BaseComponents /// /// Gets or sets the maximum size the view can be assigned in size negotiation. /// - /// - /// The property cascade chaining set is possible. For example, this (view.MaximumSize.Width = 1;) is possible. - /// + /// + /// 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 { - Size2D tmp = (Size2D)GetValue(MaximumSizeProperty); - return new Size2D(OnMaximumSizeChanged, tmp.Width, tmp.Height); + return (Size2D)GetValue(MaximumSizeProperty); } set { @@ -2149,15 +2268,25 @@ namespace Tizen.NUI.BaseComponents /// animation.AnimateTo(view, "Size", new Size(100, 100)); /// /// - /// The property cascade chaining set is possible. For example, this (view.Size.Width = 1.0f;) is possible. + /// 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 { - Size tmp = (Size)GetValue(SizeProperty); - return new Size(OnSizeChanged, tmp.Width, tmp.Height, tmp.Depth); + return (Size)GetValue(SizeProperty); } set { @@ -2243,8 +2372,19 @@ namespace Tizen.NUI.BaseComponents /// /// Margin property is supported by Layout algorithms and containers. /// Please Set Layout if you want to use Margin property. - /// The property cascade chaining set is possible. For example, this (view.Margin.X = 0.1f;) is possible. + /// 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 { @@ -2258,8 +2398,7 @@ namespace Tizen.NUI.BaseComponents else { // If Layout not set then return margin stored in View. - Extents temp = (Extents)GetValue(MarginProperty); - return new Extents(OnMarginChanged, temp.Start, temp.End, temp.Top, temp.Bottom); + return (Extents)GetValue(MarginProperty); } // Two return points to prevent creating a zeroed Extent native object before assignment } @@ -2522,16 +2661,25 @@ namespace Tizen.NUI.BaseComponents /// /// Animatable - This property can be animated using Animation class. /// - /// The property cascade chaining set is possible. For example, this (view.Color.X = 0.1f;) is possible. + /// The property cascade chaining set is not recommended. /// - /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + /// + /// 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 { - Color temp = (Color)GetValue(ColorProperty); - return new Color(OnColorChanged, temp.R, temp.G, temp.B, temp.A); + return (Color)GetValue(ColorProperty); } set { diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewBindableProperty.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewBindableProperty.cs index 44af62c..031f3d0 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewBindableProperty.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewBindableProperty.cs @@ -15,6 +15,7 @@ * */ +using global::System; using System.ComponentModel; using Tizen.NUI.Binding; @@ -85,97 +86,124 @@ namespace Tizen.NUI.BaseComponents /// BackgroundColorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty BackgroundColorProperty = BindableProperty.Create(nameof(BackgroundColor), typeof(Color), typeof(View), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => - { - var view = (View)bindable; + public static readonly BindableProperty BackgroundColorProperty = BindableProperty.Create(nameof(BackgroundColor), typeof(Color), typeof(View), null, + propertyChanged: (bindable, oldValue, newValue) => + { + var view = (View)bindable; - view.themeData?.selectorData?.ClearBackground(view); + view.themeData?.selectorData?.ClearBackground(view); - if (newValue is Selector selector) - { - if (selector.HasAll()) view.SetBackgroundColor(selector.All); - else view.EnsureSelectorData().BackgroundColor = new TriggerableSelector(view, selector, view.SetBackgroundColor, true); - } - else + if (newValue is Selector selector) + { + if (selector.HasAll()) view.SetBackgroundColor(selector.All); + else view.EnsureSelectorData().BackgroundColor = new TriggerableSelector(view, selector, view.SetBackgroundColor, true); + } + else + { + view.SetBackgroundColor((Color)newValue); + } + }, + defaultValueCreator: (bindable) => { - view.SetBackgroundColor((Color)newValue); - } - }), - defaultValueCreator: (bindable) => - { - var view = (View)bindable; - Color backgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.0f); + var view = (View)bindable; - Tizen.NUI.PropertyMap background = view.Background; - int visualType = 0; - background.Find(Visual.Property.Type)?.Get(out visualType); - if (visualType == (int)Visual.Type.Color) - { - background.Find(ColorVisualProperty.MixColor)?.Get(backgroundColor); - } + if (view.internalBackgroundColor == null) + { + view.internalBackgroundColor = new Color(view.OnBackgroundColorChanged, 0, 0, 0, 0); + } - return backgroundColor; - }); + PropertyMap background = view.Background; + int visualType = 0; + background.Find(Visual.Property.Type)?.Get(out visualType); + if (visualType == (int)Visual.Type.Color) + { + background.Find(ColorVisualProperty.MixColor)?.Get(view.internalBackgroundColor); + } + + background?.Dispose(); + background = null; + + return view.internalBackgroundColor; + } + ); /// /// ColorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ColorProperty = BindableProperty.Create(nameof(Color), typeof(Color), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) => - { - var view = (View)bindable; + public static readonly BindableProperty ColorProperty = BindableProperty.Create(nameof(Color), typeof(Color), typeof(View), null, + propertyChanged: (bindable, oldValue, newValue) => + { + var view = (View)bindable; - view.themeData?.selectorData?.Color?.Reset(view); + view.themeData?.selectorData?.Color?.Reset(view); - if (newValue is Selector selector) - { - if (selector.HasAll()) view.SetColor(selector.All); - else view.EnsureSelectorData().Color = new TriggerableSelector(view, selector, view.SetColor, true); - } - else + if (newValue is Selector selector) + { + if (selector.HasAll()) view.SetColor(selector.All); + else view.EnsureSelectorData().Color = new TriggerableSelector(view, selector, view.SetColor, true); + } + else + { + view.SetColor((Color)newValue); + } + }, + defaultValueCreator: (bindable) => { - view.SetColor((Color)newValue); + var view = (View)bindable; + var tmpProperty = view.GetProperty(Interop.ActorProperty.ColorGet()); + + if (view.internalColor == null) + { + view.internalColor = new Color(view.OnColorChanged, 0, 0, 0, 0); + } + + tmpProperty?.Get(view.internalColor); + tmpProperty?.Dispose(); + + return view.internalColor; } - }, - defaultValueCreator: (bindable) => - { - var view = (View)bindable; - Color color = new Color(0.0f, 0.0f, 0.0f, 0.0f); - view.GetProperty(Interop.ActorProperty.ColorGet()).Get(color); - return color; - }); + ); + /// BackgroundImageProperty [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty BackgroundImageProperty = BindableProperty.Create(nameof(BackgroundImage), typeof(string), typeof(View), default(string), propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => - { - var view = (View)bindable; - - if (view.themeData?.selectorData != null) + public static readonly BindableProperty BackgroundImageProperty = BindableProperty.Create(nameof(BackgroundImage), typeof(string), typeof(View), default(string), + propertyChanged: (bindable, oldValue, newValue) => { - view.themeData.selectorData.BackgroundColor?.Reset(view); - view.themeData.selectorData.BackgroundImage?.Reset(view); - } + var view = (View)bindable; - if (newValue is Selector selector) - { - if (selector.HasAll()) view.SetBackgroundImage(selector.All); - else view.EnsureSelectorData().BackgroundImage = new TriggerableSelector(view, selector, view.SetBackgroundImage, true); - } - else + if (view.themeData?.selectorData != null) + { + view.themeData.selectorData.BackgroundColor?.Reset(view); + view.themeData.selectorData.BackgroundImage?.Reset(view); + } + + if (newValue is Selector selector) + { + if (selector.HasAll()) view.SetBackgroundImage(selector.All); + else view.EnsureSelectorData().BackgroundImage = new TriggerableSelector(view, selector, view.SetBackgroundImage, true); + } + else + { + view.SetBackgroundImage((string)newValue); + } + }, + defaultValueCreator: (bindable) => { - view.SetBackgroundImage((string)newValue); + var view = (View)bindable; + string backgroundImage = ""; + + PropertyMap background = view.Background; + background.Find(ImageVisualProperty.URL)?.Get(out backgroundImage); + + background?.Dispose(); + background = null; + + return backgroundImage; } - }), - defaultValueCreator: (bindable) => - { - var view = (View)bindable; - string backgroundImage = ""; + ); - Tizen.NUI.PropertyMap background = view.Background; - background.Find(ImageVisualProperty.URL)?.Get(out backgroundImage); - return backgroundImage; - }); /// BackgroundImageBorderProperty [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty BackgroundImageBorderProperty = BindableProperty.Create(nameof(BackgroundImageBorder), typeof(Rectangle), typeof(View), default(Rectangle), propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => @@ -200,27 +228,37 @@ namespace Tizen.NUI.BaseComponents return view.backgroundExtraData?.BackgroundImageBorder; }); + /// /// BackgroundProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty BackgroundProperty = BindableProperty.Create(nameof(Background), typeof(PropertyMap), typeof(View), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => - { - var view = (View)bindable; - if (newValue != null) + public static readonly BindableProperty BackgroundProperty = BindableProperty.Create(nameof(Background), typeof(PropertyMap), typeof(View), null, + propertyChanged: (bindable, oldValue, newValue) => { - Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.BACKGROUND, new Tizen.NUI.PropertyValue((PropertyMap)newValue)); + var view = (View)bindable; + if (newValue != null) + { + var propertyValue = new PropertyValue((PropertyMap)newValue); + Object.SetProperty(view.SwigCPtr, Property.BACKGROUND, propertyValue); + + view.backgroundExtraData = null; - view.backgroundExtraData = null; + propertyValue.Dispose(); + propertyValue = null; + } + }, + defaultValueCreator: (bindable) => + { + var view = (View)bindable; + PropertyMap tmp = new PropertyMap(); + var propertyValue = Object.GetProperty(view.SwigCPtr, Property.BACKGROUND); + propertyValue.Get(tmp); + propertyValue.Dispose(); + propertyValue = null; + return tmp; } - }), - defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => - { - var view = (View)bindable; - Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); - Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.BACKGROUND).Get(temp); - return temp; - })); + ); /// /// StateProperty @@ -360,21 +398,32 @@ namespace Tizen.NUI.BaseComponents /// CellIndexProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty CellIndexProperty = BindableProperty.Create(nameof(CellIndex), typeof(Vector2), typeof(View), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => - { - var view = (View)bindable; - if (newValue != null) + public static readonly BindableProperty CellIndexProperty = BindableProperty.Create(nameof(CellIndex), typeof(Vector2), typeof(View), null, + propertyChanged: (bindable, oldValue, newValue) => { - Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, TableView.ChildProperty.CellIndex, new Tizen.NUI.PropertyValue((Vector2)newValue)); + var view = (View)bindable; + if (newValue != null) + { + var tmp = new PropertyValue((Vector2)newValue); + Object.SetProperty(view.SwigCPtr, TableView.ChildProperty.CellIndex, tmp); + tmp.Dispose(); + } + }, + defaultValueCreator: (bindable) => + { + var view = (View)bindable; + if (view.internalCellIndex == null) + { + view.internalCellIndex = new Vector2(view.OnCellIndexChanged, 0, 0); + } + + var tmp = Object.GetProperty(view.SwigCPtr, TableView.ChildProperty.CellIndex); + tmp?.Get(view.internalCellIndex); + tmp?.Dispose(); + + return view.internalCellIndex; } - }), - defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => - { - var view = (View)bindable; - Vector2 temp = new Vector2(0.0f, 0.0f); - Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, TableView.ChildProperty.CellIndex).Get(temp); - return temp; - })); + ); /// /// RowSpanProperty @@ -608,9 +657,9 @@ namespace Tizen.NUI.BaseComponents /// [EditorBrowsable(EditorBrowsableState.Never)] public static readonly BindableProperty Size2DProperty = BindableProperty.Create(nameof(Size2D), typeof(Size2D), typeof(View), null, - propertyChanged: ((bindable, oldValue, newValue) => + propertyChanged: (bindable, oldValue, newValue) => { - View view = (View)bindable; + var view = (View)bindable; if (newValue != null) { view.SetSize(((Size2D)newValue).Width, ((Size2D)newValue).Height, 0); @@ -620,29 +669,32 @@ namespace Tizen.NUI.BaseComponents view.layout?.RequestLayout(); } - }), - defaultValueCreator: ((bindable) => + }, + defaultValueCreator: (bindable) => { - View view = (View)bindable; + var view = (View)bindable; var tmp = new Size(0, 0, 0); - Object.GetProperty(view.SwigCPtr, Property.SIZE).Get(tmp); - - int tmpWidth = (int)tmp?.Width; - int tmpHeight = (int)tmp?.Height; - tmp?.Dispose(); - tmp = null; + var tmpProperty = Object.GetProperty(view.SwigCPtr, Property.SIZE); + tmpProperty?.Get(tmp); if (view.internalSize2D == null) { - view.internalSize2D = new Size2D(view.OnSize2DChanged, tmpWidth, tmpHeight); + view.internalSize2D = new Size2D(view.OnSize2DChanged, (int)tmp?.Width, (int)tmp?.Height); } else { - if (view.internalSize2D.Width != tmpWidth) { view.internalSize2D.Width = tmpWidth; } - if (view.internalSize2D.Height != tmpHeight) { view.internalSize2D.Height = tmpHeight; } + if (view.internalSize2D.SwigCPtr.Handle != global::System.IntPtr.Zero) + { + Interop.Vector2.WidthSet(view.internalSize2D.SwigCPtr, (float)tmp?.Width); + Interop.Vector2.HeightSet(view.internalSize2D.SwigCPtr, (float)tmp?.Height); + } } + + tmpProperty?.Dispose(); + tmp?.Dispose(); + return view.internalSize2D; - }) + } ); /// @@ -677,21 +729,41 @@ namespace Tizen.NUI.BaseComponents /// Position2DProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty Position2DProperty = BindableProperty.Create(nameof(Position2D), typeof(Position2D), typeof(View), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => - { - var view = (View)bindable; - if (newValue != null) + public static readonly BindableProperty Position2DProperty = BindableProperty.Create(nameof(Position2D), typeof(Position2D), typeof(View), null, + propertyChanged: (bindable, oldValue, newValue) => + { + var view = (View)bindable; + if (newValue != null) + { + view.SetPosition(((Position2D)newValue).X, ((Position2D)newValue).Y, 0); + } + }, + defaultValueCreator: (bindable) => { - Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.POSITION, new Tizen.NUI.PropertyValue(new Position((Position2D)newValue))); + var view = (View)bindable; + var tmp = new Position(0, 0, 0); + var tmpProperty = Object.GetProperty(view.SwigCPtr, Property.POSITION); + tmpProperty?.Get(tmp); + + if (view.internalPosition2D == null) + { + view.internalPosition2D = new Position2D(view.OnPosition2DChanged, (int)tmp?.X, (int)tmp?.Y); + } + else + { + if (view.internalPosition2D.SwigCPtr.Handle != IntPtr.Zero) + { + Interop.Vector2.XSet(view.internalPosition2D.SwigCPtr, (float)tmp?.X); + Interop.Vector2.YSet(view.internalPosition2D.SwigCPtr, (float)tmp?.Y); + } + } + + tmpProperty?.Dispose(); + tmp?.Dispose(); + + return view.internalPosition2D; } - }), - defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => - { - var view = (View)bindable; - Position temp = new Position(0.0f, 0.0f, 0.0f); - Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.POSITION).Get(temp); - return new Position2D(temp); - })); + ); /// /// PositionUsesPivotPointProperty @@ -787,21 +859,29 @@ namespace Tizen.NUI.BaseComponents /// PivotPointProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty PivotPointProperty = BindableProperty.Create(nameof(PivotPoint), typeof(Position), typeof(View), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => - { - var view = (View)bindable; - if (newValue != null) + public static readonly BindableProperty PivotPointProperty = BindableProperty.Create(nameof(PivotPoint), typeof(Position), typeof(View), null, + propertyChanged: (bindable, oldValue, newValue) => { - Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AnchorPoint, new Tizen.NUI.PropertyValue((Position)newValue)); + var view = (View)bindable; + if (newValue != null) + { + view.SetAnchorPoint((Position)newValue); + } + }, + defaultValueCreator: (bindable) => + { + var view = (View)bindable; + if (view.internalPivotPoint == null) + { + view.internalPivotPoint = new Position(view.OnPivotPointChanged, 0, 0, 0); + } + var tmp = Object.GetProperty(view.SwigCPtr, Property.AnchorPoint); + tmp?.Get(view.internalPivotPoint); + tmp?.Dispose(); + + return view.internalPivotPoint; } - }), - defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => - { - var view = (View)bindable; - Position temp = new Position(0.0f, 0.0f, 0.0f); - Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AnchorPoint).Get(temp); - return temp; - })); + ); /// /// SizeWidthProperty @@ -849,21 +929,30 @@ namespace Tizen.NUI.BaseComponents /// PositionProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty PositionProperty = BindableProperty.Create(nameof(Position), typeof(Position), typeof(View), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => - { - var view = (View)bindable; - if (newValue != null) + public static readonly BindableProperty PositionProperty = BindableProperty.Create(nameof(Position), typeof(Position), typeof(View), null, + propertyChanged: (bindable, oldValue, newValue) => { - Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.POSITION, new Tizen.NUI.PropertyValue((Position)newValue)); + var view = (View)bindable; + if (newValue != null) + { + view.SetPosition(((Position)newValue).X, ((Position)newValue).Y, ((Position)newValue).Z); + } + }, + defaultValueCreator: (bindable) => + { + var view = (View)bindable; + var tmpProperty = Object.GetProperty(view.SwigCPtr, Property.POSITION); + + if (view.internalPosition == null) + { + view.internalPosition = new Position(view.OnPositionChanged, 0, 0, 0); + } + tmpProperty?.Get(view.internalPosition); + tmpProperty?.Dispose(); + + return view.internalPosition; } - }), - defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => - { - var view = (View)bindable; - Position temp = new Position(0.0f, 0.0f, 0.0f); - Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.POSITION).Get(temp); - return temp; - })); + ); /// /// PositionXProperty @@ -949,21 +1038,30 @@ namespace Tizen.NUI.BaseComponents /// ScaleProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty ScaleProperty = BindableProperty.Create(nameof(Scale), typeof(Vector3), typeof(View), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => - { - var view = (View)bindable; - if (newValue != null) + public static readonly BindableProperty ScaleProperty = BindableProperty.Create(nameof(Scale), typeof(Vector3), typeof(View), null, + propertyChanged: (bindable, oldValue, newValue) => + { + var view = (View)bindable; + if (newValue != null) + { + view.SetScale((Vector3)newValue); + } + }, + defaultValueCreator: (bindable) => { - Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.SCALE, new Tizen.NUI.PropertyValue((Vector3)newValue)); + var view = (View)bindable; + if (view.internalScale == null) + { + view.internalScale = new Vector3(view.OnScaleChanged, 0, 0, 0); + } + + var tmpPropery = Object.GetProperty(view.SwigCPtr, Property.SCALE); + tmpPropery?.Get(view.internalScale); + tmpPropery?.Dispose(); + + return view.internalScale; } - }), - defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => - { - var view = (View)bindable; - Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f); - Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.SCALE).Get(temp); - return temp; - })); + ); /// /// ScaleXProperty @@ -1029,21 +1127,23 @@ namespace Tizen.NUI.BaseComponents /// NameProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty NameProperty = BindableProperty.Create(nameof(Name), typeof(string), typeof(View), string.Empty, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => - { - var view = (View)bindable; - if (newValue != null) + public static readonly BindableProperty NameProperty = BindableProperty.Create(nameof(Name), typeof(string), typeof(View), string.Empty, + propertyChanged: (bindable, oldValue, newValue) => + { + var view = (View)bindable; + if (newValue != null) + { + view.SetName((string)newValue); + } + }, + defaultValueCreator: (bindable) => { - Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.NAME, new Tizen.NUI.PropertyValue((string)newValue)); + var view = (View)bindable; + string temp; + temp = view.GetName(); + return temp; } - }), - defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => - { - var view = (View)bindable; - string temp; - Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.NAME).Get(out temp); - return temp; - })); + ); /// /// SensitiveProperty @@ -1172,21 +1272,31 @@ namespace Tizen.NUI.BaseComponents /// SizeModeFactorProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty SizeModeFactorProperty = BindableProperty.Create(nameof(SizeModeFactor), typeof(Vector3), typeof(View), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => - { - var view = (View)bindable; - if (newValue != null) + public static readonly BindableProperty SizeModeFactorProperty = BindableProperty.Create(nameof(SizeModeFactor), typeof(Vector3), typeof(View), null, + propertyChanged: (bindable, oldValue, newValue) => { - Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.SizeModeFactor, new Tizen.NUI.PropertyValue((Vector3)newValue)); + var view = (View)bindable; + if (newValue != null) + { + var tmp = new PropertyValue((Vector3)newValue); + Object.SetProperty(view.SwigCPtr, Property.SizeModeFactor, tmp); + tmp?.Dispose(); + } + }, + defaultValueCreator: (bindable) => + { + var view = (View)bindable; + if (view.internalSizeModeFactor == null) + { + view.internalSizeModeFactor = new Vector3(view.OnSizeModeFactorChanged, 0, 0, 0); + } + var tmp = Object.GetProperty(view.SwigCPtr, Property.SizeModeFactor); + tmp?.Get(view.internalSizeModeFactor); + tmp?.Dispose(); + + return view.internalSizeModeFactor; } - }), - defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => - { - var view = (View)bindable; - Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f); - Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.SizeModeFactor).Get(temp); - return temp; - })); + ); /// /// WidthResizePolicyProperty @@ -1377,96 +1487,122 @@ namespace Tizen.NUI.BaseComponents /// PaddingProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty PaddingProperty = BindableProperty.Create(nameof(Padding), typeof(Extents), typeof(View), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => - { - var view = (View)bindable; - if (newValue != null) + public static readonly BindableProperty PaddingProperty = BindableProperty.Create(nameof(Padding), typeof(Extents), typeof(View), null, + propertyChanged: (bindable, oldValue, newValue) => { - Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.PADDING, new Tizen.NUI.PropertyValue((Extents)newValue)); + var view = (View)bindable; + if (newValue != null) + { + var tmp = new PropertyValue((Extents)newValue); + Object.SetProperty(view.SwigCPtr, View.Property.PADDING, tmp); + tmp?.Dispose(); + } + }, + defaultValueCreator: (bindable) => + { + var view = (View)bindable; + if (view.internalPadding == null) + { + view.internalPadding = new Extents(view.OnPaddingChanged, 0, 0, 0, 0); + } + + var tmp = Object.GetProperty(view.SwigCPtr, Property.PADDING); + tmp?.Get(view.internalPadding); + tmp?.Dispose(); + + return view.internalPadding; } - }), - defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => - { - var view = (View)bindable; - Extents temp = new Extents(0, 0, 0, 0); - Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.PADDING).Get(temp); - return temp; - })); + ); /// /// SizeProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty SizeProperty = BindableProperty.Create(nameof(Size), typeof(Size), typeof(View), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => - { - var view = (View)bindable; - if (newValue != null) + public static readonly BindableProperty SizeProperty = BindableProperty.Create(nameof(Size), typeof(Size), typeof(View), null, + propertyChanged: (bindable, oldValue, newValue) => { - Size size = (Size)newValue; - // Set Specification so when layouts measure this View it matches the value set here. - // All Views are currently Layouts. - view.WidthSpecification = (int)System.Math.Ceiling(size.Width); - view.HeightSpecification = (int)System.Math.Ceiling(size.Height); - Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.SIZE, new Tizen.NUI.PropertyValue(size)); + var view = (View)bindable; + if (newValue != null) + { + // Set Specification so when layouts measure this View it matches the value set here. + // All Views are currently Layouts. + view.WidthSpecification = (int)System.Math.Ceiling(((Size)newValue).Width); + view.HeightSpecification = (int)System.Math.Ceiling(((Size)newValue).Height); + + view.SetSize(((Size)newValue).Width, ((Size)newValue).Height, ((Size)newValue).Depth); + } + }, + defaultValueCreator: (bindable) => + { + var view = (View)bindable; + + var tmpProperty = Object.GetProperty(view.SwigCPtr, Property.SIZE); + if (view.internalSize == null) + { + view.internalSize = new Size(view.OnSizeChanged, 0, 0, 0); + } + tmpProperty?.Get(view.internalSize); + tmpProperty?.Dispose(); + + return view.internalSize; } - }), - defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => - { - var view = (View)bindable; - Size temp = new Size(0, 0, 0); - Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.SIZE).Get(temp); - return temp; - })); + ); /// /// MinimumSizeProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty MinimumSizeProperty = BindableProperty.Create(nameof(MinimumSize), typeof(Size2D), typeof(View), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => - { - var view = (View)bindable; - Size2D temp = newValue as Size2D; - if (temp != null) + public static readonly BindableProperty MinimumSizeProperty = BindableProperty.Create(nameof(MinimumSize), typeof(Size2D), typeof(View), null, + propertyChanged: (bindable, oldValue, newValue) => { - Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.MinimumSize, new Tizen.NUI.PropertyValue(temp)); - } - else + var view = (View)bindable; + if (newValue != null) + { + view.SetMinimumSize((Size2D)newValue); + } + }, + defaultValueCreator: (bindable) => { - Tizen.Log.Fatal("NUI", $"[ERROR] can't set MinimumSizeProperty!"); + var view = (View)bindable; + if (view.internalMinimumSize == null) + { + view.internalMinimumSize = new Size2D(view.OnMinimumSizeChanged, 0, 0); + } + var tmp = Object.GetProperty(view.SwigCPtr, Property.MinimumSize); + tmp?.Get(view.internalMinimumSize); + tmp?.Dispose(); + + return view.internalMinimumSize; } - }), - defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => - { - var view = (View)bindable; - Size2D temp = new Size2D(0, 0); - Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.MinimumSize).Get(temp); - return temp; - })); + ); /// /// MaximumSizeProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty MaximumSizeProperty = BindableProperty.Create(nameof(MaximumSize), typeof(Size2D), typeof(View), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => - { - var view = (View)bindable; - Size2D temp = newValue as Size2D; - if (temp != null) + public static readonly BindableProperty MaximumSizeProperty = BindableProperty.Create(nameof(MaximumSize), typeof(Size2D), typeof(View), null, + propertyChanged: (bindable, oldValue, newValue) => { - Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.MaximumSize, new Tizen.NUI.PropertyValue(temp)); - } - else + var view = (View)bindable; + if (newValue != null) + { + view.SetMaximumSize((Size2D)newValue); + } + }, + defaultValueCreator: (bindable) => { - Tizen.Log.Fatal("NUI", $"[ERROR] can't set MaximumSizeProperty!"); + var view = (View)bindable; + if (view.internalMaximumSize == null) + { + view.internalMaximumSize = new Size2D(view.OnMaximumSizeChanged, 0, 0); + } + var tmp = Object.GetProperty(view.SwigCPtr, Property.MaximumSize); + tmp?.Get(view.internalMaximumSize); + tmp?.Dispose(); + + return view.internalMaximumSize; } - }), - defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => - { - var view = (View)bindable; - Size2D temp = new Size2D(0, 0); - Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.MaximumSize).Get(temp); - return temp; - })); + ); /// /// InheritPositionProperty @@ -1558,21 +1694,31 @@ namespace Tizen.NUI.BaseComponents /// MarginProperty /// [EditorBrowsable(EditorBrowsableState.Never)] - public static readonly BindableProperty MarginProperty = BindableProperty.Create(nameof(Margin), typeof(Extents), typeof(View), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) => - { - var view = (View)bindable; - if (newValue != null) + public static readonly BindableProperty MarginProperty = BindableProperty.Create(nameof(Margin), typeof(Extents), typeof(View), null, + propertyChanged: (bindable, oldValue, newValue) => { - Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.MARGIN, new Tizen.NUI.PropertyValue((Extents)newValue)); + var view = (View)bindable; + if (newValue != null) + { + var tmp = new PropertyValue((Extents)newValue); + Object.SetProperty(view.SwigCPtr, Property.MARGIN, tmp); + tmp?.Dispose(); + } + }, + defaultValueCreator: (bindable) => + { + var view = (View)bindable; + if (view.internalMargin == null) + { + view.internalMargin = new Extents(view.OnMarginChanged, 0, 0, 0, 0); + } + var tmp = Object.GetProperty(view.SwigCPtr, Property.MARGIN); + tmp?.Get(view.internalMargin); + tmp?.Dispose(); + + return view.internalMargin; } - }), - defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) => - { - var view = (View)bindable; - Extents temp = new Extents(0, 0, 0, 0); - Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.MARGIN).Get(temp); - return temp; - })); + ); /// /// UpdateSizeHintProperty @@ -2220,8 +2366,10 @@ namespace Tizen.NUI.BaseComponents { if (string.IsNullOrEmpty(value)) { + var empty = new PropertyValue(); // Clear background - Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, View.Property.BACKGROUND, new PropertyValue()); + Object.SetProperty(SwigCPtr, Property.BACKGROUND, empty); + empty.Dispose(); return; } @@ -2233,33 +2381,62 @@ namespace Tizen.NUI.BaseComponents if (backgroundExtraData == null) { - Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, View.Property.BACKGROUND, new PropertyValue(value)); + var propertyValue = new PropertyValue(value); + Object.SetProperty(SwigCPtr, Property.BACKGROUND, propertyValue); BackgroundImageSynchronousLoading = backgroundImageSynchronousLoading; - + propertyValue?.Dispose(); return; } - PropertyMap map = new PropertyMap(); - - map.Add(ImageVisualProperty.URL, new PropertyValue(value)) - .Add(Visual.Property.CornerRadius, new PropertyValue(backgroundExtraData.CornerRadius == null ? new PropertyValue() : new PropertyValue(backgroundExtraData.CornerRadius))) - .Add(Visual.Property.CornerRadiusPolicy, new PropertyValue((int)(backgroundExtraData.CornerRadiusPolicy))) - .Add(Visual.Property.BorderlineWidth, new PropertyValue(backgroundExtraData.BorderlineWidth)) - .Add(Visual.Property.BorderlineColor, new PropertyValue(backgroundExtraData.BorderlineColor == null ? new PropertyValue(Color.Black) : new PropertyValue(backgroundExtraData.BorderlineColor))) - .Add(Visual.Property.BorderlineOffset, new PropertyValue(backgroundExtraData.BorderlineOffset)) - .Add(ImageVisualProperty.SynchronousLoading, new PropertyValue(backgroundImageSynchronousLoading)); + var map = new PropertyMap(); + var url = new PropertyValue(value); + var cornerRadiusValue = backgroundExtraData.CornerRadius == null ? new PropertyValue() : new PropertyValue(backgroundExtraData.CornerRadius); + var cornerRadius = new PropertyValue(cornerRadiusValue); + var cornerRadiusPolicy = new PropertyValue((int)(backgroundExtraData.CornerRadiusPolicy)); + var borderlineWidth = new PropertyValue(backgroundExtraData.BorderlineWidth); + var borderlineColorValue = backgroundExtraData.BorderlineColor == null ? new PropertyValue(Color.Black) : new PropertyValue(backgroundExtraData.BorderlineColor); + var borderlineColor = new PropertyValue(borderlineColorValue); + var borderlineOffset = new PropertyValue(backgroundExtraData.BorderlineOffset); + var synchronousLoading = new PropertyValue(backgroundImageSynchronousLoading); + var npatchType = new PropertyValue((int)Visual.Type.NPatch); + var border = new PropertyValue(backgroundExtraData.BackgroundImageBorder); + var imageType = new PropertyValue((int)Visual.Type.Image); + + map.Add(ImageVisualProperty.URL, url) + .Add(Visual.Property.CornerRadius, cornerRadius) + .Add(Visual.Property.CornerRadiusPolicy, cornerRadiusPolicy) + .Add(Visual.Property.BorderlineWidth, borderlineWidth) + .Add(Visual.Property.BorderlineColor, borderlineColor) + .Add(Visual.Property.BorderlineOffset, borderlineOffset) + .Add(ImageVisualProperty.SynchronousLoading, synchronousLoading); if (backgroundExtraData.BackgroundImageBorder != null) { - map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch)) - .Add(NpatchImageVisualProperty.Border, new PropertyValue(backgroundExtraData.BackgroundImageBorder)); + map.Add(Visual.Property.Type, npatchType) + .Add(NpatchImageVisualProperty.Border, border); } else { - map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image)); - } - - Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, View.Property.BACKGROUND, new PropertyValue(map)); + map.Add(Visual.Property.Type, imageType); + } + + var mapValue = new PropertyValue(map); + Object.SetProperty(SwigCPtr, Property.BACKGROUND, mapValue); + + imageType?.Dispose(); + border?.Dispose(); + npatchType?.Dispose(); + synchronousLoading?.Dispose(); + borderlineOffset?.Dispose(); + borderlineColor?.Dispose(); + borderlineColorValue?.Dispose(); + borderlineWidth?.Dispose(); + cornerRadiusPolicy?.Dispose(); + cornerRadius?.Dispose(); + cornerRadiusValue?.Dispose(); + url?.Dispose(); + map?.Dispose(); + mapValue?.Dispose(); } private void SetBackgroundImageBorder(Rectangle value) @@ -2305,22 +2482,45 @@ namespace Tizen.NUI.BaseComponents if (backgroundExtraData == null) { - Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, View.Property.BACKGROUND, new PropertyValue(value)); + var background = new PropertyValue(value); + Object.SetProperty(SwigCPtr, Property.BACKGROUND, background); + background?.Dispose(); return; } - PropertyMap map = new PropertyMap(); - - map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color)) - .Add(ColorVisualProperty.MixColor, new PropertyValue(value)) - .Add(Visual.Property.CornerRadius, new PropertyValue(new PropertyValue(backgroundExtraData.CornerRadius == null ? new PropertyValue() : new PropertyValue(backgroundExtraData.CornerRadius)))) - .Add(Visual.Property.CornerRadiusPolicy, new PropertyValue((int)(backgroundExtraData.CornerRadiusPolicy))) - .Add(Visual.Property.BorderlineWidth, new PropertyValue(backgroundExtraData.BorderlineWidth)) - .Add(Visual.Property.BorderlineColor, new PropertyValue(backgroundExtraData.BorderlineColor == null ? new PropertyValue(Color.Black) : new PropertyValue(backgroundExtraData.BorderlineColor))) - .Add(Visual.Property.BorderlineOffset, new PropertyValue(backgroundExtraData.BorderlineOffset)); - - - Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, View.Property.BACKGROUND, new PropertyValue(map)); + var map = new PropertyMap(); + var colorType = new PropertyValue((int)Visual.Type.Color); + var mixColor = new PropertyValue(value); + var cornerRadiusValue = backgroundExtraData.CornerRadius == null ? new PropertyValue() : new PropertyValue(backgroundExtraData.CornerRadius); + var cornerRadius = new PropertyValue(cornerRadiusValue); + var cornerRadiusPolicy = new PropertyValue((int)(backgroundExtraData.CornerRadiusPolicy)); + var borderlineWidth = new PropertyValue(backgroundExtraData.BorderlineWidth); + var borderlineColorValue = backgroundExtraData.BorderlineColor == null ? new PropertyValue(Color.Black) : new PropertyValue(backgroundExtraData.BorderlineColor); + var borderlineColor = new PropertyValue(borderlineColorValue); + var borderlineOffset = new PropertyValue(backgroundExtraData.BorderlineOffset); + + map.Add(Visual.Property.Type, colorType) + .Add(ColorVisualProperty.MixColor, mixColor) + .Add(Visual.Property.CornerRadius, cornerRadius) + .Add(Visual.Property.CornerRadiusPolicy, cornerRadiusPolicy) + .Add(Visual.Property.BorderlineWidth, borderlineWidth) + .Add(Visual.Property.BorderlineColor, borderlineColor) + .Add(Visual.Property.BorderlineOffset, borderlineOffset); + + var mapValue = new PropertyValue(map); + Object.SetProperty(SwigCPtr, Property.BACKGROUND, mapValue); + + borderlineOffset?.Dispose(); + borderlineColor?.Dispose(); + borderlineColorValue?.Dispose(); + borderlineWidth?.Dispose(); + cornerRadiusPolicy?.Dispose(); + cornerRadius?.Dispose(); + cornerRadiusValue?.Dispose(); + mixColor?.Dispose(); + colorType?.Dispose(); + map?.Dispose(); + mapValue?.Dispose(); } private void SetColor(Color value) diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs index a9f2213..6db4c8d 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs @@ -594,7 +594,7 @@ namespace Tizen.NUI.BaseComponents } backgroundResourceLoadedEventHandler += value; } - + remove { backgroundResourceLoadedEventHandler -= value; @@ -708,93 +708,39 @@ namespace Tizen.NUI.BaseComponents return ret; } - private void OnSize2DChanged(int? width, int? height) + private void OnColorChanged(float r, float g, float b, float a) { - PropertyValue temp = null; - if (width != null) - { - temp = new PropertyValue((float)width); - Object.SetProperty(SwigCPtr, Property.SizeWidth, temp); - } - if (height != null) - { - temp = new PropertyValue((float)height); - Object.SetProperty(SwigCPtr, Property.SizeHeight, temp); - } - temp?.Dispose(); + Color = new Color(r, g, b, a); } - private void OnMinimumSizeChanged(int? width, int? height) + private void OnMinimumSizeChanged(int width, int height) { - if (width != null && height != null) - { - MinimumSize = new Size2D((int)width, (int)height); - } - else if (width != null && height == null) - { - MinimumSize = new Size2D((int)width, (int)this.GetMinimumSize().Height); - } - else if (width == null && height != null) - { - MinimumSize = new Size2D((int)this.GetMinimumSize().Width, (int)height); - } - else - { - //both are null, do nothing. - } + MinimumSize = new Size2D(width, height); } - private void OnMaximumSizeChanged(int? width, int? height) + private void OnMaximumSizeChanged(int width, int height) { - if (width != null && height != null) - { - MaximumSize = new Size2D((int)width, (int)height); - } - else if (width != null && height == null) - { - MaximumSize = new Size2D((int)width, (int)this.GetMaximumSize().Height); - } - else if (width == null && height != null) - { - MaximumSize = new Size2D((int)this.GetMaximumSize().Width, (int)height); - } - else - { - //both are null, do nothing. - } + MaximumSize = new Size2D(width, height); } private void OnPosition2DChanged(int x, int y) { - Position2D = new Position2D(x, y); + SetPosition((float)x, (float)y, 0); } - private void OnSizeChanged(float? width, float? height, float? depth) + private void OnPositionChanged(float x, float y, float z) { - PropertyValue temp; - if (width != null) - { - temp = new Tizen.NUI.PropertyValue((float)width); - Tizen.NUI.Object.SetProperty(this.SwigCPtr, View.Property.SizeWidth, temp); - temp.Dispose(); - } - if (height != null) - { - temp = new Tizen.NUI.PropertyValue((float)height); - Tizen.NUI.Object.SetProperty(this.SwigCPtr, View.Property.SizeHeight, temp); - temp.Dispose(); - } - if (depth != null) - { - temp = new Tizen.NUI.PropertyValue((float)depth); - Tizen.NUI.Object.SetProperty(this.SwigCPtr, View.Property.SizeDepth, temp); - temp.Dispose(); - } + SetPosition(x, y, z); } - private void OnPositionChanged(float x, float y, float z) + private void OnSize2DChanged(int width, int height) + { + SetSize((float)width, (float)height, 0); + } + + private void OnSizeChanged(float width, float height, float depth) { - Position = new Position(x, y, z); + SetSize(width, height, depth); } private void OnParentOriginChanged(float x, float y, float z) diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs index 11de701..064a2c4 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs @@ -1155,8 +1155,35 @@ namespace Tizen.NUI.BaseComponents //_mergedStyle = null; - + + internalMaximumSize?.Dispose(); + internalMaximumSize = null; + internalMinimumSize?.Dispose(); + internalMinimumSize = null; + internalMargin?.Dispose(); + internalMargin = null; + internalPadding?.Dispose(); + internalPadding = null; + internalSizeModeFactor?.Dispose(); + internalSizeModeFactor = null; + internalCellIndex?.Dispose(); + internalCellIndex = null; + internalBackgroundColor?.Dispose(); + internalBackgroundColor = null; + internalColor?.Dispose(); + internalColor = null; + internalPivotPoint?.Dispose(); + internalPivotPoint = null; + internalPosition?.Dispose(); + internalPosition = null; + internalPosition2D?.Dispose(); + internalPosition2D = null; + internalScale?.Dispose(); + internalScale = null; + internalSize?.Dispose(); + internalSize = null; internalSize2D?.Dispose(); + internalSize2D = null; if (type == DisposeTypes.Explicit) { @@ -1446,11 +1473,6 @@ namespace Tizen.NUI.BaseComponents Margin = new Extents(start, end, top, bottom); } - private void OnColorChanged(float r, float g, float b, float a) - { - Color = new Color(r, g, b, a); - } - private void OnAnchorPointChanged(float x, float y, float z) { AnchorPoint = new Position(x, y, z); diff --git a/src/Tizen.NUI/src/public/Common/Color.cs b/src/Tizen.NUI/src/public/Common/Color.cs index f9a91ca..bae508a 100755 --- a/src/Tizen.NUI/src/public/Common/Color.cs +++ b/src/Tizen.NUI/src/public/Common/Color.cs @@ -1104,7 +1104,7 @@ namespace Tizen.NUI Interop.Vector4.RSet(SwigCPtr, ValueCheck(value)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - callback?.Invoke(R, G, B, A); + callback?.Invoke(value, G, B, A); } get { @@ -1137,7 +1137,7 @@ namespace Tizen.NUI Interop.Vector4.GSet(SwigCPtr, ValueCheck(value)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - callback?.Invoke(R, G, B, A); + callback?.Invoke(R, value, B, A); } get { @@ -1170,7 +1170,7 @@ namespace Tizen.NUI Interop.Vector4.BSet(SwigCPtr, ValueCheck(value)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - callback?.Invoke(R, G, B, A); + callback?.Invoke(R, G, value, A); } get { @@ -1203,7 +1203,7 @@ namespace Tizen.NUI Interop.Vector4.ASet(SwigCPtr, ValueCheck(value)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - callback?.Invoke(R, G, B, A); + callback?.Invoke(R, G, B, value); } get { diff --git a/src/Tizen.NUI/src/public/Common/Extents.cs b/src/Tizen.NUI/src/public/Common/Extents.cs index e3581bd..b24478a 100755 --- a/src/Tizen.NUI/src/public/Common/Extents.cs +++ b/src/Tizen.NUI/src/public/Common/Extents.cs @@ -147,7 +147,7 @@ namespace Tizen.NUI Interop.Extents.StartSet(SwigCPtr, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - callback?.Invoke(Start, End, Top, Bottom); + callback?.Invoke(value, End, Top, Bottom); } get { @@ -180,7 +180,7 @@ namespace Tizen.NUI Interop.Extents.EndSet(SwigCPtr, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - callback?.Invoke(Start, End, Top, Bottom); + callback?.Invoke(Start, value, Top, Bottom); } get { @@ -213,7 +213,7 @@ namespace Tizen.NUI Interop.Extents.TopSet(SwigCPtr, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - callback?.Invoke(Start, End, Top, Bottom); + callback?.Invoke(Start, End, value, Bottom); } get { @@ -246,7 +246,7 @@ namespace Tizen.NUI Interop.Extents.BottomSet(SwigCPtr, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - callback?.Invoke(Start, End, Top, Bottom); + callback?.Invoke(Start, End, Top, value); } get { diff --git a/src/Tizen.NUI/src/public/Common/Position.cs b/src/Tizen.NUI/src/public/Common/Position.cs index cd73776..15062d9 100755 --- a/src/Tizen.NUI/src/public/Common/Position.cs +++ b/src/Tizen.NUI/src/public/Common/Position.cs @@ -540,7 +540,7 @@ namespace Tizen.NUI Interop.Vector3.XSet(SwigCPtr, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - callback?.Invoke(X, Y, Z); + callback?.Invoke(value, Y, Z); } get { @@ -573,7 +573,7 @@ namespace Tizen.NUI Interop.Vector3.YSet(SwigCPtr, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - callback?.Invoke(X, Y, Z); + callback?.Invoke(X, value, Z); } get { @@ -606,7 +606,7 @@ namespace Tizen.NUI Interop.Vector3.ZSet(SwigCPtr, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - callback?.Invoke(X, Y, Z); + callback?.Invoke(X, Y, value); } get { diff --git a/src/Tizen.NUI/src/public/Common/Position2D.cs b/src/Tizen.NUI/src/public/Common/Position2D.cs index 556ddfd..01b797e 100755 --- a/src/Tizen.NUI/src/public/Common/Position2D.cs +++ b/src/Tizen.NUI/src/public/Common/Position2D.cs @@ -106,7 +106,7 @@ namespace Tizen.NUI Interop.Vector2.XSet(SwigCPtr, (float)value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - callback?.Invoke(X, Y); + callback?.Invoke(value, Y); } get { @@ -139,7 +139,7 @@ namespace Tizen.NUI Interop.Vector2.YSet(SwigCPtr, (float)value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - callback?.Invoke(X, Y); + callback?.Invoke(X, value); } get { diff --git a/src/Tizen.NUI/src/public/Common/Size.cs b/src/Tizen.NUI/src/public/Common/Size.cs index fcdc98e..2d8d589 100755 --- a/src/Tizen.NUI/src/public/Common/Size.cs +++ b/src/Tizen.NUI/src/public/Common/Size.cs @@ -114,7 +114,7 @@ namespace Tizen.NUI Interop.Vector3.WidthSet(SwigCPtr, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - callback?.Invoke(value, null, null); + callback?.Invoke(value, Height, Depth); } get { @@ -147,7 +147,7 @@ namespace Tizen.NUI Interop.Vector3.HeightSet(SwigCPtr, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - callback?.Invoke(null, value, null); + callback?.Invoke(Width, value, Depth); } get { @@ -180,7 +180,7 @@ namespace Tizen.NUI Interop.Vector3.DepthSet(SwigCPtr, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - callback?.Invoke(null, null, value); + callback?.Invoke(Width, Height, value); } get { @@ -464,7 +464,7 @@ namespace Tizen.NUI return ret; } - internal delegate void SizeChangedCallback(float? width, float? height, float? depth); + internal delegate void SizeChangedCallback(float width, float height, float depth); internal Size(SizeChangedCallback cb, float w, float h, float d) : this(Interop.Vector3.NewVector3(w, h, d), true) { diff --git a/src/Tizen.NUI/src/public/Common/Size2D.cs b/src/Tizen.NUI/src/public/Common/Size2D.cs index d50854f..91199a4 100755 --- a/src/Tizen.NUI/src/public/Common/Size2D.cs +++ b/src/Tizen.NUI/src/public/Common/Size2D.cs @@ -66,7 +66,7 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - internal delegate void Size2DChangedCallback(int? width, int? height); + internal delegate void Size2DChangedCallback(int width, int height); /// /// Hidden API (Inhouse API). @@ -127,7 +127,7 @@ namespace Tizen.NUI Interop.Vector2.WidthSet(SwigCPtr, (float)value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - callback?.Invoke(value, null); + callback?.Invoke(value, Height); } get { @@ -160,7 +160,7 @@ namespace Tizen.NUI Interop.Vector2.HeightSet(SwigCPtr, (float)value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - callback?.Invoke(null, value); + callback?.Invoke(Width, value); } get {