Skip to content

Commit

Permalink
[NUI] Change DefaultBorder property (Samsung#6099)
Browse files Browse the repository at this point in the history
* [NUI] DefaultBorder changes

* [NUI] DefaultBorder adding isUsingXaml condition

* [NUI] DefaultBorder adding declaration of Tizen.NUI
  • Loading branch information
Clarik authored and bshsqa committed May 13, 2024
1 parent 2b2f3ae commit 09b481b
Showing 1 changed file with 106 additions and 24 deletions.
130 changes: 106 additions & 24 deletions src/Tizen.NUI/src/public/Window/DefaultBorder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using System;
using System.ComponentModel;
using Tizen.NUI.BaseComponents;
using Tizen.NUI;
using Tizen.NUI.Binding;

namespace Tizen.NUI
Expand All @@ -28,6 +29,19 @@ namespace Tizen.NUI
[EditorBrowsable(EditorBrowsableState.Never)]
public class DefaultBorder : BindableObject, IDisposable, IBorderInterface
{
static DefaultBorder()
{
if(NUIApplication.IsUsingXaml)
{
BorderLineThicknessProperty = BindableProperty.Create(nameof(BorderLineThickness), typeof(uint), typeof(DefaultBorder), default(uint), propertyChanged: SetInternalBorderLineThicknessProperty, defaultValueCreator: GetInternalBorderLineThicknessProperty);

MinSizeProperty = BindableProperty.Create(nameof(MinSize), typeof(Size2D), typeof(DefaultBorder), default(Size2D), propertyChanged: SetInternalMinSizeProperty, defaultValueCreator: GetInternalMinSizeProperty);

MaxSizeProperty = BindableProperty.Create(nameof(MaxSize), typeof(Size2D), typeof(DefaultBorder), default(Size2D), propertyChanged: SetInternalMaxSizeProperty, defaultValueCreator: GetInternalMaxSizeProperty);

ResizePolicyProperty = BindableProperty.Create(nameof(ResizePolicy), typeof(Window.BorderResizePolicyType), typeof(DefaultBorder), default(Window.BorderResizePolicyType), propertyChanged: SetInternalResizePolicyProperty, defaultValueCreator: GetInternalResizePolicyProperty);
}
}
#region Constant Fields
private static readonly string ResourcePath = FrameworkInformation.ResourcePath;
private static readonly string MinimalizeIcon = ResourcePath + "minimalize.png";
Expand Down Expand Up @@ -86,68 +100,80 @@ public class DefaultBorder : BindableObject, IDisposable, IBorderInterface
#region Methods

[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly BindableProperty BorderLineThicknessProperty = BindableProperty.Create(nameof(BorderLineThickness), typeof(uint), typeof(DefaultBorder), default(uint), propertyChanged: (bindable, oldValue, newValue) =>
public static readonly BindableProperty BorderLineThicknessProperty = null;

internal static void SetInternalBorderLineThicknessProperty(BindableObject bindable, object oldValue, object newValue)
{
var instance = (DefaultBorder)bindable;
if (newValue != null)
{
instance.borderLineThickness = (uint)newValue;
instance.UpdateProperty();
}
},
defaultValueCreator: (bindable) =>
}

internal static object GetInternalBorderLineThicknessProperty(BindableObject bindable)
{
var instance = (DefaultBorder)bindable;
return instance.borderLineThickness;
});
}

[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly BindableProperty MinSizeProperty = BindableProperty.Create(nameof(MinSize), typeof(Size2D), typeof(DefaultBorder), default(Size2D), propertyChanged: (bindable, oldValue, newValue) =>
public static readonly BindableProperty MinSizeProperty = null;

internal static void SetInternalMinSizeProperty(BindableObject bindable, object oldValue, object newValue)
{
var instance = (DefaultBorder)bindable;
if (newValue != null)
{
instance.minSize = (Size2D)newValue;
instance.UpdateProperty();
}
},
defaultValueCreator: (bindable) =>
}

internal static object GetInternalMinSizeProperty(BindableObject bindable)
{
var instance = (DefaultBorder)bindable;
return instance.minSize;
});
}

[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly BindableProperty MaxSizeProperty = BindableProperty.Create(nameof(MaxSize), typeof(Size2D), typeof(DefaultBorder), default(Size2D), propertyChanged: (bindable, oldValue, newValue) =>
public static readonly BindableProperty MaxSizeProperty = null;

internal static void SetInternalMaxSizeProperty(BindableObject bindable, object oldValue, object newValue)
{
var instance = (DefaultBorder)bindable;
if (newValue != null)
{
instance.maxSize = (Size2D)newValue;
instance.UpdateProperty();
}
},
defaultValueCreator: (bindable) =>
}

internal static object GetInternalMaxSizeProperty(BindableObject bindable)
{
var instance = (DefaultBorder)bindable;
return instance.maxSize;
});
}

[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly BindableProperty ResizePolicyProperty = BindableProperty.Create(nameof(ResizePolicy), typeof(Window.BorderResizePolicyType), typeof(DefaultBorder), default(Window.BorderResizePolicyType), propertyChanged: (bindable, oldValue, newValue) =>
public static readonly BindableProperty ResizePolicyProperty = null;

internal static void SetInternalResizePolicyProperty(BindableObject bindable, object oldValue, object newValue)
{
var instance = (DefaultBorder)bindable;
if (newValue != null)
{
instance.resizePolicy = (Window.BorderResizePolicyType)newValue;
instance.UpdateProperty();
}
},
defaultValueCreator: (bindable) =>
}

internal static object GetInternalResizePolicyProperty(BindableObject bindable)
{
var instance = (DefaultBorder)bindable;
return instance.resizePolicy;
});
}


/// <summary>
Expand All @@ -158,11 +184,25 @@ public uint BorderLineThickness
{
get
{
return (uint)GetValue(BorderLineThicknessProperty);
if (NUIApplication.IsUsingXaml)
{
return (uint)GetValue(BorderLineThicknessProperty);
}
else
{
return (uint)GetInternalBorderLineThicknessProperty(this);
}
}
set
{
SetValue(BorderLineThicknessProperty, value);
if (NUIApplication.IsUsingXaml)
{
SetValue(BorderLineThicknessProperty, value);
}
else
{
SetInternalBorderLineThicknessProperty(this, null, value);
}
}
}

Expand All @@ -187,11 +227,25 @@ public Size2D MinSize
{
get
{
return (Size2D)GetValue(MinSizeProperty);
if (NUIApplication.IsUsingXaml)
{
return (Size2D)GetValue(MinSizeProperty);
}
else
{
return (Size2D)GetInternalMinSizeProperty(this);
}
}
set
{
SetValue(MinSizeProperty, value);
if (NUIApplication.IsUsingXaml)
{
SetValue(MinSizeProperty, value);
}
else
{
SetInternalMinSizeProperty(this, null, value);
}
}
}

Expand All @@ -203,11 +257,25 @@ public Size2D MaxSize
{
get
{
return (Size2D)GetValue(MaxSizeProperty);
if (NUIApplication.IsUsingXaml)
{
return (Size2D)GetValue(MaxSizeProperty);
}
else
{
return (Size2D)GetInternalMaxSizeProperty(this);
}
}
set
{
SetValue(MaxSizeProperty, value);
if (NUIApplication.IsUsingXaml)
{
SetValue(MaxSizeProperty, value);
}
else
{
SetInternalMaxSizeProperty(this, null, value);
}
}
}

Expand Down Expand Up @@ -235,11 +303,25 @@ public Window.BorderResizePolicyType ResizePolicy
{
get
{
return (Window.BorderResizePolicyType)GetValue(ResizePolicyProperty);
if (NUIApplication.IsUsingXaml)
{
return (Window.BorderResizePolicyType)GetValue(ResizePolicyProperty);
}
else
{
return (Window.BorderResizePolicyType)GetInternalResizePolicyProperty(this);
}
}
set
{
SetValue(ResizePolicyProperty, value);
if (NUIApplication.IsUsingXaml)
{
SetValue(ResizePolicyProperty, value);
}
else
{
SetInternalResizePolicyProperty(this, null, value);
}
}
}

Expand Down

0 comments on commit 09b481b

Please sign in to comment.