private EventHandler<StateChangedEventArgs> stateChangeHandler;
- private bool isSelected = false;
- private bool isEnabled = true;
private bool isPressed = false;
-
- private StringSelector textSelector = new StringSelector();
- private StringSelector translatableTextSelector = new StringSelector();
- private ColorSelector textColorSelector = new ColorSelector();
- private FloatSelector pointSizeSelector = new FloatSelector();
-
- private StringSelector iconURLSelector = new StringSelector();
+ private bool styleApplied = false;
/// <summary>
/// The ButtonExtension instance that is injected by ButtonStyle.
[EditorBrowsable(EditorBrowsableState.Never)]
protected void UpdateState()
{
+ if (!styleApplied) return;
+
ControlState sourceState = ControlState;
ControlState targetState;
[EditorBrowsable(EditorBrowsableState.Never)]
protected virtual void MeasureText()
{
- if (Style.IconRelativeOrientation == null || Icon == null || TextLabel == null)
+ if (Icon == null || TextLabel == null)
{
return;
}
TextLabel.WidthResizePolicy = ResizePolicyType.Fixed;
TextLabel.HeightResizePolicy = ResizePolicyType.Fixed;
- int textPaddingStart = Style.TextPadding.Start;
- int textPaddingEnd = Style.TextPadding.End;
- int textPaddingTop = Style.TextPadding.Top;
- int textPaddingBottom = Style.TextPadding.Bottom;
+ int textPaddingStart = buttonStyle.TextPadding.Start;
+ int textPaddingEnd = buttonStyle.TextPadding.End;
+ int textPaddingTop = buttonStyle.TextPadding.Top;
+ int textPaddingBottom = buttonStyle.TextPadding.Bottom;
- int iconPaddingStart = Style.IconPadding.Start;
- int iconPaddingEnd = Style.IconPadding.End;
- int iconPaddingTop = Style.IconPadding.Top;
- int iconPaddingBottom = Style.IconPadding.Bottom;
+ int iconPaddingStart = buttonStyle.IconPadding.Start;
+ int iconPaddingEnd = buttonStyle.IconPadding.End;
+ int iconPaddingTop = buttonStyle.IconPadding.Top;
+ int iconPaddingBottom = buttonStyle.IconPadding.Bottom;
if (IconRelativeOrientation == IconOrientation.Top || IconRelativeOrientation == IconOrientation.Bottom)
{
[EditorBrowsable(EditorBrowsableState.Never)]
protected virtual void LayoutChild()
{
- if (Style.IconRelativeOrientation == null || Icon == null || TextLabel == null)
+ if (Icon == null || TextLabel == null)
{
return;
}
var buttonIcon = Icon;
var buttonText = TextLabel;
- int textPaddingStart = Style.TextPadding.Start;
- int textPaddingEnd = Style.TextPadding.End;
- int textPaddingTop = Style.TextPadding.Top;
- int textPaddingBottom = Style.TextPadding.Bottom;
+ int textPaddingStart = buttonStyle.TextPadding.Start;
+ int textPaddingEnd = buttonStyle.TextPadding.End;
+ int textPaddingTop = buttonStyle.TextPadding.Top;
+ int textPaddingBottom = buttonStyle.TextPadding.Bottom;
- int iconPaddingStart = Style.IconPadding.Start;
- int iconPaddingEnd = Style.IconPadding.End;
- int iconPaddingTop = Style.IconPadding.Top;
- int iconPaddingBottom = Style.IconPadding.Bottom;
+ int iconPaddingStart = buttonStyle.IconPadding.Start;
+ int iconPaddingEnd = buttonStyle.IconPadding.End;
+ int iconPaddingTop = buttonStyle.IconPadding.Top;
+ int iconPaddingBottom = buttonStyle.IconPadding.Bottom;
switch (IconRelativeOrientation)
{
ButtonStyle buttonStyle = StyleManager.Instance.GetViewStyle(StyleName) as ButtonStyle;
if (buttonStyle != null)
{
- Style.CopyFrom(buttonStyle);
+ ApplyStyle(buttonStyle);
UpdateUIContent();
}
}
var stateEnabled = !controlStateChangedInfo.CurrentState.Contains(ControlState.Disabled);
- if (isEnabled != stateEnabled)
+ if (IsEnabled != stateEnabled)
{
- isEnabled = stateEnabled;
+ IsEnabled = stateEnabled;
}
var statePressed = controlStateChangedInfo.CurrentState.Contains(ControlState.Pressed);
/// <since_tizen> 6 </since_tizen>
private void Initialize()
{
- var style = (ButtonStyle)Style;
EnableControlStatePropagation = true;
UpdateState();
LayoutDirectionChanged += OnLayoutDirectionChanged;
MeasureText();
LayoutChild();
- Sensitive = isEnabled;
+ Sensitive = IsEnabled;
}
private void OnLayoutDirectionChanged(object sender, LayoutDirectionChangedEventArgs e)
var instance = (Button)bindable;
if (newValue != null)
{
- if (instance.Style != null && instance.Style.IconRelativeOrientation != (IconOrientation?)newValue)
+ if (instance.buttonStyle != null && instance.buttonStyle.IconRelativeOrientation != (IconOrientation?)newValue)
{
- instance.Style.IconRelativeOrientation = (IconOrientation?)newValue;
+ instance.buttonStyle.IconRelativeOrientation = (IconOrientation?)newValue;
instance.UpdateUIContent();
}
}
defaultValueCreator: (bindable) =>
{
var instance = (Button)bindable;
- return instance.Style?.IconRelativeOrientation;
+ return instance.buttonStyle?.IconRelativeOrientation;
});
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
var instance = (Button)bindable;
if (newValue != null)
{
- instance.isEnabled = (bool)newValue;
- instance.UpdateState();
+ if (instance.buttonStyle != null && (!instance.styleApplied || instance.buttonStyle.IsEnabled != (bool)newValue))
+ {
+ instance.buttonStyle.IsEnabled = (bool)newValue;
+ instance.UpdateState();
+ }
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Button)bindable;
- return instance.isEnabled;
+ return instance.buttonStyle?.IsEnabled ?? 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)]
var instance = (Button)bindable;
if (newValue != null)
{
- instance.isSelected = (bool)newValue;
- instance.UpdateState();
+ if (instance.buttonStyle != null && instance.IsSelectable && (!instance.styleApplied || instance.buttonStyle.IsSelected != (bool)newValue))
+ {
+ instance.buttonStyle.IsSelected = (bool)newValue;
+ instance.UpdateState();
+ }
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Button)bindable;
- return instance.isSelected;
+ return instance.IsSelectable && (instance.buttonStyle.IsSelected ?? false);
});
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
var instance = (Button)bindable;
if (newValue != null)
{
- instance.Style.IsSelectable = (bool)newValue;
+ if (instance.buttonStyle != null && (!instance.styleApplied || instance.buttonStyle.IsSelectable != (bool)newValue))
+ {
+ instance.buttonStyle.IsSelectable = (bool)newValue;
+ }
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Button)bindable;
- return instance.Style?.IsSelectable ?? false;
+ return instance.buttonStyle?.IsSelectable ?? false;
});
/// 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 static readonly BindableProperty IconPaddingProperty = BindableProperty.Create(nameof(IconPadding), typeof(Extents), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Button)bindable;
- if (null != newValue && null != instance.Style?.IconPadding)
+ if (null != newValue && null != instance.buttonStyle?.IconPadding)
{
- instance.Style.IconPadding.CopyFrom((Extents)newValue);
+ instance.buttonStyle.IconPadding.CopyFrom((Extents)newValue);
instance.UpdateUIContent();
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Button)bindable;
- return instance.Style?.IconPadding;
+ return instance.buttonStyle?.IconPadding;
});
/// 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 static readonly BindableProperty TextPaddingProperty = BindableProperty.Create(nameof(TextPadding), typeof(Extents), typeof(Button), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Button)bindable;
- if (null != newValue && null != instance.Style?.TextPadding)
+ if (null != newValue && null != instance.buttonStyle?.TextPadding)
{
- instance.Style.TextPadding.CopyFrom((Extents)newValue);
+ instance.buttonStyle.TextPadding.CopyFrom((Extents)newValue);
instance.UpdateUIContent();
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Button)bindable;
- return instance.Style?.TextPadding;
+ return instance.buttonStyle?.TextPadding;
});
static Button() { }
/// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
/// </remarks>
/// <since_tizen> 8 </since_tizen>
- public new ButtonStyle Style => ViewStyle as ButtonStyle;
+ public new ButtonStyle Style
+ {
+ get
+ {
+ var result = (ButtonStyle)ViewStyle.Clone();
+ result.CopyPropertiesFromView(this);
+ result.Text.CopyPropertiesFromView(TextLabel);
+ result.Icon.CopyPropertiesFromView(Icon);
+ result.Overlay.CopyPropertiesFromView(OverlayImage);
+ return result;
+ }
+ }
/// <summary>
/// The text of Button.
{
get
{
- return Style?.Text?.Text?.GetValue(ControlState);
+ return TextLabel.Text;
}
set
{
- if (null != Style?.Text)
- {
- Style.Text.Text = value;
- }
+ TextLabel.Text = value;
}
}
{
get
{
- return Style?.Text?.TranslatableText?.All;
+ return TextLabel.TranslatableText;
}
set
{
- if (null != Style?.Text)
- {
- Style.Text.TranslatableText = value;
- }
+ TextLabel.TranslatableText = value;
}
}
{
get
{
- return Style?.Text?.PointSize?.All ?? 0;
+ return TextLabel.PointSize;
}
set
{
- if (null != Style?.Text)
- {
- Style.Text.PointSize = value;
- }
+ TextLabel.PointSize = value;
}
}
{
get
{
- return Style?.Text?.FontFamily.All;
+ return TextLabel.FontFamily;
}
set
{
- if (null != Style?.Text)
- {
- Style.Text.FontFamily = value;
- }
+ TextLabel.FontFamily = value;
}
}
{
get
{
- return Style?.Text?.TextColor?.All;
+ return TextLabel.TextColor;
}
set
{
- if (null != Style?.Text)
- {
- Style.Text.TextColor = value;
- }
+ TextLabel.TextColor = value;
}
}
{
get
{
- return Style?.Text?.HorizontalAlignment ?? HorizontalAlignment.Center;
+ return TextLabel.HorizontalAlignment;
}
set
{
- if (null != Style?.Text)
- {
- Style.Text.HorizontalAlignment = value;
- }
+ TextLabel.HorizontalAlignment = value;
}
}
{
get
{
- return Style?.Icon?.ResourceUrl?.All;
+ return Icon.ResourceUrl;
}
set
{
- if (null != Style?.Icon)
- {
- Style.Icon.ResourceUrl = value;
- }
+ Icon.ResourceUrl = value;
}
}
/// <summary>
/// Text string selector in Button.
+ /// Getter returns copied selector value if exist, null otherwise.
/// </summary>
/// <since_tizen> 6 </since_tizen>
public StringSelector TextSelector
{
- get
- {
- return textSelector;
- }
- set
- {
- if (value == null || textSelector == null)
- {
- Tizen.Log.Fatal("NUI", "[Exception] Button.TextSelector is null");
- throw new NullReferenceException("Button.TextSelector is null");
- }
- else
- {
- textSelector.Clone(value);
- }
- }
+ get => buttonText == null ? null : new StringSelector((Selector<string>)buttonText.GetValue(TextLabel.TextSelectorProperty));
+ set => buttonText?.SetValue(TextLabel.TextSelectorProperty, value);
}
/// <summary>
/// Translateable text string selector in Button.
+ /// Getter returns copied selector value if exist, null otherwise.
/// </summary>
/// <since_tizen> 6 </since_tizen>
public StringSelector TranslatableTextSelector
{
- get
- {
- return translatableTextSelector;
- }
- set
- {
- if (value == null || translatableTextSelector == null)
- {
- Tizen.Log.Fatal("NUI", "[Exception] Button.TranslatableTextSelector is null");
- throw new NullReferenceException("Button.TranslatableTextSelector is null");
- }
- else
- {
- translatableTextSelector.Clone(value);
- }
- }
+ get => buttonText == null ? null : new StringSelector((Selector<string>)buttonText.GetValue(TextLabel.TranslatableTextSelectorProperty));
+ set => buttonText?.SetValue(TextLabel.TranslatableTextSelectorProperty, value);
}
/// <summary>
/// Text color selector in Button.
+ /// Getter returns copied selector value if exist, null otherwise.
/// </summary>
/// <since_tizen> 6 </since_tizen>
public ColorSelector TextColorSelector
{
- get
- {
- return textColorSelector;
- }
- set
- {
- if (value == null || textColorSelector == null)
- {
- Tizen.Log.Fatal("NUI", "[Exception] Button.textColorSelector is null");
- throw new NullReferenceException("Button.textColorSelector is null");
- }
- else
- {
- textColorSelector.Clone(value);
- }
- }
+ get => buttonText == null ? null : new ColorSelector((Selector<Color>)buttonText.GetValue(TextLabel.TextColorSelectorProperty));
+ set => buttonText?.SetValue(TextLabel.TextColorSelectorProperty, value);
}
/// <summary>
/// Text font size selector in Button.
+ /// Getter returns copied selector value if exist, null otherwise.
/// </summary>
/// <since_tizen> 6 </since_tizen>
public FloatSelector PointSizeSelector
{
- get
- {
- return pointSizeSelector;
- }
- set
- {
- if (value == null || pointSizeSelector == null)
- {
- Tizen.Log.Fatal("NUI", "[Exception] Button.pointSizeSelector is null");
- throw new NullReferenceException("Button.pointSizeSelector is null");
- }
- else
- {
- pointSizeSelector.Clone(value);
- }
- }
+ get => buttonText == null ? null : new FloatSelector((Selector<float?>)buttonText.GetValue(TextLabel.PointSizeSelectorProperty));
+ set => buttonText?.SetValue(TextLabel.PointSizeSelectorProperty, value);
}
/// <summary>
/// Icon image's resource url selector in Button.
+ /// Getter returns copied selector value if exist, null otherwise.
/// </summary>
/// <since_tizen> 6 </since_tizen>
public StringSelector IconURLSelector
{
- get
- {
- return iconURLSelector;
- }
- set
- {
- if (value == null || iconURLSelector == null)
- {
- Tizen.Log.Fatal("NUI", "[Exception] Button.iconURLSelector is null");
- throw new NullReferenceException("Button.iconURLSelector is null");
- }
- else
- {
- iconURLSelector.Clone(value);
- }
- }
+ get => buttonIcon == null ? null : new StringSelector((Selector<string>)buttonText.GetValue(ImageView.ResourceUrlSelectorProperty));
+ set => buttonIcon?.SetValue(ImageView.ResourceUrlSelectorProperty, value);
}
/// <summary>
set => SetValue(TextPaddingProperty, value);
}
+ private ButtonStyle buttonStyle => ViewStyle as ButtonStyle;
+
/// <summary>
/// Called after a key event is received by the view that has had its focus set.
/// </summary>
{
if (key.KeyPressedName == "Return")
{
- bool clicked = isPressed && isEnabled;
+ bool clicked = isPressed && IsEnabled;
isPressed = false;
- if (Style.IsSelectable != null && Style.IsSelectable == true)
+ if (IsSelectable)
{
IsSelected = !IsSelected;
}
return true;
case PointStateType.Up:
{
- bool clicked = isPressed && isEnabled;
+ bool clicked = isPressed && IsEnabled;
isPressed = false;
- if (Style.IsSelectable != null && Style.IsSelectable == true)
+ if (IsSelectable)
{
Extension?.SetTouchInfo(touch);
IsSelected = !IsSelected;
/// <since_tizen> 8 </since_tizen>
public override void ApplyStyle(ViewStyle viewStyle)
{
+ styleApplied = false;
+
base.ApplyStyle(viewStyle);
- ButtonStyle buttonStyle = viewStyle as ButtonStyle;
if (null != buttonStyle)
{
Extension = buttonStyle.CreateExtension();
Icon?.ApplyStyle(buttonStyle.Icon);
}
}
+
+ styleApplied = true;
}
/// <summary>
{
foreach (Button btn in btGroup.itemGroup)
{
- btn.Style.SizeHeight = (float)newValue;
+ btn.SizeHeight = (float)newValue;
}
btGroup.itemheight = (float)newValue;
}
{
foreach (Button btn in btGroup.itemGroup)
{
- btn.Style.Text.PointSize = (float)newValue;
+ btn.TextLabel.PointSize = (float)newValue;
}
btGroup.itemPointSize = (float)newValue;
}
{
foreach (Button btn in btGroup.itemGroup)
{
- btn.Style.Text.FontFamily = (string)newValue;
+ btn.TextLabel.FontFamily = (string)newValue;
}
btGroup.itemFontFamily = (string)newValue;
}
{
foreach (Button btn in btGroup.itemGroup)
{
- btn.Style.Text.TextColor = (Color)newValue;
+ btn.TextLabel.TextColor = (Color)newValue;
}
btGroup.itemTextColor = (Color)newValue;
}
{
foreach (Button btn in btGroup.itemGroup)
{
- btn.Style.Text.HorizontalAlignment = (HorizontalAlignment)newValue;
+ btn.TextLabel.HorizontalAlignment = (HorizontalAlignment)newValue;
}
btGroup.itemTextAlignment = (HorizontalAlignment)newValue;
}
{
foreach (Button btn in btGroup.itemGroup)
{
- btn.Style.Overlay.BackgroundColor = (Selector<Color>)newValue;
+ btn.OverlayImage.BackgroundColor = ((Selector<Color>)newValue).All;
}
btGroup.overLayBackgroundColorSelector = (Selector<Color>)newValue;
}
if (btGroup.itemGroup != null && newValue != null)
{
foreach (Button btn in btGroup.itemGroup)
- {
- if (btn.Style.BackgroundImage == null)
- {
- btn.Style.BackgroundImage = new Selector<string>();
- }
- btn.Style.BackgroundImage = (string)newValue;
+ {
+ btn.BackgroundImage = (string)newValue;
}
btGroup.itemBackgroundImageUrl = (string)newValue;
}
var shadow = (ImageShadow)newValue;
foreach (Button btn in btGroup.itemGroup)
{
- btn.Style.ImageShadow = new ImageShadow(shadow);
+ btn.ImageShadow = new ImageShadow(shadow);
}
btGroup.itemImageShadow = new ImageShadow(shadow);
}
{
for (int i = Count - 1; i >= 0; i--)
{
- itemGroup[i].Style.PositionX = pos;
+ itemGroup[i].PositionX = pos;
pos += (int)(itemGroup[i].Size.Width);
}
}
{
for (int i = 0; i < Count; i++)
{
- itemGroup[i].Style.PositionX = pos;
+ itemGroup[i].PositionX = pos;
pos += (int)(itemGroup[i].Size.Width);
}
}
*
*/
using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
namespace Tizen.NUI.Components
{
base.ItemGroup = value;
}
}
+
+ /// <inheritdoc/>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override void ApplyStyle(ViewStyle viewStyle)
+ {
+ if (viewStyle is ButtonStyle buttonStyle)
+ {
+ if (buttonStyle.IsSelectable == null)
+ {
+ buttonStyle.IsSelectable = true;
+ }
+
+ base.ApplyStyle(buttonStyle);
+ }
+ }
}
}
/// 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 ControlStyle Style => ViewStyle as ControlStyle;
+ public new ControlStyle Style => (ControlStyle)ViewStyle.Clone();
static Control() { }
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- protected virtual void RegisterDetectionOfSubstyleChanges() { }
-
- /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
protected override ViewStyle CreateViewStyle()
{
return new ControlStyle();
private void Initialize()
{
- ControlState = ControlState.Normal;
-
- RegisterDetectionOfSubstyleChanges();
-
LeaveRequired = true;
StateFocusableOnTouchMode = false;
var instance = (DropDown)bindable;
if (newValue != null)
{
- instance.listPadding.CopyFrom((Extents)newValue);
+ instance.dropDownStyle.ListPadding.CopyFrom((Extents)newValue);
instance.UpdateDropDown();
}
},
defaultValueCreator: (bindable) =>
{
var instance = (DropDown)bindable;
- return instance.listPadding;
+ return instance.dropDownStyle.ListPadding;
});
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
if (newValue != null)
{
int selectedItemIndex = (int)newValue;
- if (selectedItemIndex == instance.selectedItemIndex || instance.adapter == null || selectedItemIndex < 0 || selectedItemIndex >= instance.adapter.GetItemCount())
+ if (selectedItemIndex == instance.dropDownStyle.SelectedItemIndex || instance.adapter == null || selectedItemIndex < 0 || selectedItemIndex >= instance.adapter.GetItemCount())
{
return;
}
defaultValueCreator: (bindable) =>
{
var instance = (DropDown)bindable;
- return instance.selectedItemIndex;
+ return instance.dropDownStyle.SelectedItemIndex;
});
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
var instance = (DropDown)bindable;
if (newValue != null)
{
- instance.listMargin.CopyFrom((Extents)newValue);
+ instance.dropDownStyle.ListMargin.CopyFrom((Extents)newValue);
instance.UpdateDropDown();
}
},
defaultValueCreator: (bindable) =>
{
var instance = (DropDown)bindable;
- return instance.listMargin;
+ return instance.dropDownStyle.ListMargin;
});
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
var instance = (DropDown)bindable;
if (newValue != null)
{
- instance.listRelativeOrientation = (ListOrientation)newValue;
+ instance.dropDownStyle.ListRelativeOrientation = (ListOrientation)newValue;
instance.UpdateDropDown();
}
},
defaultValueCreator: (bindable) =>
{
var instance = (DropDown)bindable;
- return instance.listRelativeOrientation;
+ return instance.dropDownStyle.ListRelativeOrientation;
});
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
var instance = (DropDown)bindable;
if (newValue != null)
{
- instance.spaceBetweenButtonTextAndIcon = (int)newValue;
+ instance.dropDownStyle.SpaceBetweenButtonTextAndIcon = (int)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (DropDown)bindable;
- return instance.spaceBetweenButtonTextAndIcon;
+ return instance.dropDownStyle.SpaceBetweenButtonTextAndIcon;
});
#region DropDown
private DropDownItemView selectedItemView = null;
private TapGestureDetector tapGestureDetector = null;
- private Extents listMargin = new Extents(0, 0, 0, 0);
- private Extents listPadding = new Extents(0, 0, 0, 0);
- private ListOrientation listRelativeOrientation = ListOrientation.Left;
- private int selectedItemIndex = -1;
- private int spaceBetweenButtonTextAndIcon = 0;
private bool itemPressed = false;
static DropDown() { }
/// </remarks>
/// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- //public new DropDownStyle Style
- //{
- // get
- // {
- // return new DropDownStyle(ViewStyle as DropDownStyle);
- // }
- //}
- public new DropDownStyle Style => ViewStyle as DropDownStyle;
+ public new DropDownStyle Style
+ {
+ get
+ {
+ var result = new DropDownStyle(dropDownStyle);
+ result.CopyPropertiesFromView(this);
+ result.Button.CopyPropertiesFromView(Button);
+ result.HeaderText.CopyPropertiesFromView(HeaderText);
+ result.ListBackgroundImage.CopyPropertiesFromView(ListBackgroundImage);
+ return result;
+ }
+ }
/// <summary>
/// Space between button text and button icon in DropDown.
set => SetValue(ListPaddingProperty, value);
}
+ private DropDownStyle dropDownStyle => ViewStyle as DropDownStyle;
+
/// <summary>
/// Add list item by item data. The added item will be added to end of all items automatically.
/// </summary>
if (index < 0 || index >= adapter?.GetItemCount()) return;
if (null == dropDownMenuFullList) return;
- if (selectedItemIndex == index)
+ if (dropDownStyle.SelectedItemIndex == index)
{
- selectedItemIndex = -1;
+ dropDownStyle.SelectedItemIndex = -1;
}
- else if(selectedItemIndex > index)
+ else if(dropDownStyle.SelectedItemIndex > index)
{
- selectedItemIndex--;
+ dropDownStyle.SelectedItemIndex--;
}
adapter?.RemoveData(index);
return;
}
- if (selectedItemIndex >= index)
+ if (dropDownStyle.SelectedItemIndex >= index)
{
- selectedItemIndex++;
+ dropDownStyle.SelectedItemIndex++;
}
adapter.InsertData(index, item);
protected void UpdateDropDown()
{
if (null == scrollableBase || null == listBackgroundImage || null == dropDownMenuFullList) return;
- if (null == Style.ListBackgroundImage.Size) return;
+ if (null == ListBackgroundImage.Size) return;
// Resize and position scrolling list within the drop down list container. Can be used to position list in relation to the background image.
- scrollableBase.Size = Style.ListBackgroundImage.Size - new Size((listPadding.Start + listPadding.End), (listPadding.Top + listPadding.Bottom), 0);
- scrollableBase.Position2D = new Position2D(listPadding.Start, listPadding.Top);
+ scrollableBase.Size = ListBackgroundImage.Size - new Size((dropDownStyle.ListPadding.Start + dropDownStyle.ListPadding.End), (dropDownStyle.ListPadding.Top + dropDownStyle.ListPadding.Bottom), 0);
+ scrollableBase.Position2D = new Position2D(dropDownStyle.ListPadding.Start, dropDownStyle.ListPadding.Top);
int listBackgroundImageX = 0;
int listBackgroundImageY = 0;
- if (listRelativeOrientation == ListOrientation.Left)
+ if (dropDownStyle.ListRelativeOrientation == ListOrientation.Left)
{
- listBackgroundImageX = (int)listMargin.Start;
- listBackgroundImageY = (int)listMargin.Top;
+ listBackgroundImageX = (int)dropDownStyle.ListMargin.Start;
+ listBackgroundImageY = (int)dropDownStyle.ListMargin.Top;
}
- else if (listRelativeOrientation == ListOrientation.Right)
+ else if (dropDownStyle.ListRelativeOrientation == ListOrientation.Right)
{
- listBackgroundImageX = -(int)listMargin.End;
- listBackgroundImageY = (int)listMargin.Top;
+ listBackgroundImageX = -(int)dropDownStyle.ListMargin.End;
+ listBackgroundImageY = (int)dropDownStyle.ListMargin.Top;
}
listBackgroundImage.Position2D = new Position2D(listBackgroundImageX, listBackgroundImageY);
dropDownMenuFullList?.Layout?.RequestLayout();
float buttonTextWidth = 0;
if (null != buttonText)
{
- buttonText.Text = Style.Button.Text.Text.All;
- buttonText.PointSize = Style.Button.Text.PointSize?.GetValue(ControlState) ?? StyleManager.PointSizeNormal;
+ buttonText.Text = Button.TextLabel.Text;
+ buttonText.PointSize = Button.TextLabel.PointSize;
buttonTextWidth = buttonText.NaturalSize.Width;
}
- float fitWidth = (Style.Button.Icon.Size?.Width ?? 48) + Style.SpaceBetweenButtonTextAndIcon + buttonTextWidth;
+ float fitWidth = (Button.Icon.Size?.Width ?? 48) + dropDownStyle.SpaceBetweenButtonTextAndIcon + buttonTextWidth;
fitWidth += (button.IconPadding.Start + button.IconPadding.End);
button.Size.Width = Math.Max(button.Size.Width, fitWidth);
RelayoutRequest();
}
}
// Set selection icon on View
- if (selectedItemIndex > 0)
+ if (dropDownStyle.SelectedItemIndex > 0)
{
- SetListItemToSelected((uint)selectedItemIndex, selectedItemView);
+ SetListItemToSelected((uint)dropDownStyle.SelectedItemIndex, selectedItemView);
}
}
private void SetListItemToSelected(uint index)
{
- if (dropDownMenuFullList == null || index == selectedItemIndex)
+ if (dropDownMenuFullList == null || index == dropDownStyle.SelectedItemIndex)
{
return;
}
if (selectedItemView != null)
{
selectedItemView.IsSelected = false;
- adapter.GetData(selectedItemIndex).IsSelected = false;
+ adapter.GetData(dropDownStyle.SelectedItemIndex).IsSelected = false;
}
if (view == null || index >= dropDownMenuFullList.ChildCount)
{
- selectedItemIndex = -1;
+ dropDownStyle.SelectedItemIndex = -1;
selectedItemView = null;
return;
}
- selectedItemIndex = (int)index;
+ dropDownStyle.SelectedItemIndex = (int)index;
selectedItemView = view;
selectedItemView.IsSelected = true;
- adapter.GetData(selectedItemIndex).IsSelected = true;
+ adapter.GetData(dropDownStyle.SelectedItemIndex).IsSelected = true;
dropDownMenuFullList.Layout?.RequestLayout();
}
var lottieStyle = (ILottieButtonStyle)button.Style;
lottieView.URL = lottieStyle.LottieUrl;
lottieView.StopBehavior = LottieAnimationView.StopBehaviorType.MaximumFrame;
- lottieStyle.PlayRange?.GetValue(ControlState.Normal)?.Show(lottieView, true);
+ if (lottieStyle.PlayRange != null && lottieStyle.PlayRange.GetValue(ControlState.Normal, out var result))
+ {
+ result.Show(lottieView, true);
+ }
}
internal static void UpdateLottieView(Button button, ControlState previousState, LottieAnimationView lottieView)
{
- ((ILottieButtonStyle)button.Style).PlayRange?.GetValue(button.ControlState)?.Show(lottieView, !previousState.Contains(ControlState.Pressed));
+ var lottieStyle = ((ILottieButtonStyle)button.Style);
+ if (lottieStyle.PlayRange != null && lottieStyle.PlayRange.GetValue(button.ControlState, out var result))
+ {
+ result.Show(lottieView, !previousState.Contains(ControlState.Pressed));
+ }
}
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual ImageView OnCreateThumb(Switch switchButton, ImageView thumb)
{
+ if (switchButton.IsSelected)
+ {
+ OnSelectedChanged(switchButton);
+ }
return thumb;
}
var instance = (Loading)bindable;
if (newValue != null)
{
- instance.Style.Images = (string[])newValue;
+ instance.loadingStyle.Images = (string[])newValue;
instance.imageVisual.URLS = new List<string>((string[])newValue);
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Loading)bindable;
- return instance.Style.Images;
+ return instance.loadingStyle.Images;
});
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
int frameRate = (int)newValue;
if (0 != frameRate) //It will crash if 0
{
- instance.Style.FrameRate.All = frameRate;
+ instance.loadingStyle.FrameRate.All = frameRate;
instance.imageVisual.FrameDelay = 1000.0f / frameRate;
}
}
defaultValueCreator: (bindable) =>
{
var instance = (Loading)bindable;
- return instance.Style.FrameRate?.All ?? (int)(1000/16.6f);
+ return instance.loadingStyle.FrameRate?.All ?? (int)(1000/16.6f);
});
private AnimatedImageVisual imageVisual = null;
+ private LoadingStyle loadingStyle => ViewStyle as LoadingStyle;
static Loading() { }
/// <summary>
/// Get style of loading.
+ /// Return a copied Style instance of Loading
/// </summary>
+ /// <remarks>
+ /// It returns copied Style instance and changing it does not effect to the Loading.
+ /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
+ /// </remarks>>
/// <since_tizen> 8 </since_tizen>
- public new LoadingStyle Style => ViewStyle as LoadingStyle;
+ public new LoadingStyle Style
+ {
+ get
+ {
+ var result = new LoadingStyle(loadingStyle);
+ result.CopyPropertiesFromView(this);
+ return result;
+ }
+ }
/// <summary>
/// Gets or sets loading image resource array.
private void UpdateVisual()
{
- if (null != Style.Images)
+ if (null != loadingStyle.Images)
{
- imageVisual.URLS = new List<string>(Style.Images);
+ imageVisual.URLS = new List<string>(loadingStyle.Images);
}
- if (null != Style.FrameRate?.All && 0 != Style.FrameRate.All.Value)
+ if (null != loadingStyle.FrameRate?.All && 0 != loadingStyle.FrameRate.All.Value)
{
- imageVisual.FrameDelay = 1000.0f / (float)Style.FrameRate.All.Value;
+ imageVisual.FrameDelay = 1000.0f / (float)loadingStyle.FrameRate.All.Value;
}
- if (null != Style.LoadingSize)
+ if (null != loadingStyle.LoadingSize)
{
- this.Size = new Size2D((int)Style.LoadingSize.Width, (int)Style.LoadingSize.Height);
+ this.Size = new Size2D((int)loadingStyle.LoadingSize.Width, (int)loadingStyle.LoadingSize.Height);
}
}
}
private int indicatorCount = 0;
private int selectedIndex = -1;
+ private PaginationStyle paginationStyle => ViewStyle as PaginationStyle;
static Pagination() { }
/// <summary>
/// Get style of pagination.
/// </summary>
+ /// This will be public opened in tizen_next after ACR done. Before ACR, need to be hidden as inhouse API.
/// <since_tizen> 8 </since_tizen>
- public new PaginationStyle Style => ViewStyle as PaginationStyle;
+ public new PaginationStyle Style
+ {
+ get
+ {
+ var result = new PaginationStyle(paginationStyle);
+ result.CopyPropertiesFromView(this);
+ return result;
+ }
+ }
/// <summary>
/// Gets or sets the size of the indicator.
{
get
{
- return Style?.IndicatorSize;
+ return paginationStyle?.IndicatorSize;
}
set
{
- if (value == null || Style == null)
+ if (value == null || paginationStyle == null)
{
return;
}
- Style.IndicatorSize = value;
+ paginationStyle.IndicatorSize = value;
UpdateVisual();
}
}
{
get
{
- return Style?.IndicatorImageUrl;
+ return paginationStyle?.IndicatorImageUrl;
}
set
{
- if (value == null || Style == null)
+ if (value == null || paginationStyle == null)
{
return;
}
- Style.IndicatorImageUrl = value;
+ paginationStyle.IndicatorImageUrl = value;
UpdateVisual();
}
}
{
get
{
- return (int)Style?.IndicatorSpacing;
+ return (int)paginationStyle?.IndicatorSpacing;
}
set
{
- Style.IndicatorSpacing = value;
+ paginationStyle.IndicatorSpacing = value;
UpdateVisual();
}
}
protected virtual void SelectOut(VisualMap selectOutIndicator)
{
if (!(selectOutIndicator is ImageVisual visual)) return;
- visual.URL = Style?.IndicatorImageUrl.Normal;
+ visual.URL = paginationStyle?.IndicatorImageUrl.Normal;
visual.Opacity = 0.5f;
}
protected virtual void SelectIn(VisualMap selectInIndicator)
{
if (!(selectInIndicator is ImageVisual visual)) return;
- visual.URL = Style?.IndicatorImageUrl.Selected;
+ visual.URL = paginationStyle?.IndicatorImageUrl.Selected;
visual.Opacity = 1.0f;
}
private void CreateIndicator()
{
- if (Style == null)
+ if (paginationStyle == null)
{
return;
}
ImageVisual indicator = new ImageVisual
{
- URL = Style.IndicatorImageUrl.Normal,
- Size = new Size2D((int)Style.IndicatorSize.Width, (int)Style.IndicatorSize.Height),
+ URL = paginationStyle.IndicatorImageUrl.Normal,
+ Size = new Size2D((int)paginationStyle.IndicatorSize.Width, (int)paginationStyle.IndicatorSize.Height),
Opacity = 0.5f,
};
- indicator.Position = new Vector2((int)(Style.IndicatorSize.Width + Style.IndicatorSpacing) * indicatorList.Count, 0);
+ indicator.Position = new Position2D((int)(paginationStyle.IndicatorSize.Width + paginationStyle.IndicatorSpacing) * indicatorList.Count, 0);
container.AddVisual("Indicator" + indicatorList.Count, indicator);
indicatorList.Add(indicator);
}
private void UpdateContainer()
{
- if (Style == null)
+ if (paginationStyle == null)
{
return;
}
if (indicatorList.Count > 0)
{
- container.SizeWidth = (Style.IndicatorSize.Width + Style.IndicatorSpacing) * indicatorList.Count - Style.IndicatorSpacing;
+ container.SizeWidth = (paginationStyle.IndicatorSize.Width + paginationStyle.IndicatorSpacing) * indicatorList.Count - paginationStyle.IndicatorSpacing;
}
else
{
container.SizeWidth = 0;
}
- container.SizeHeight = Style.IndicatorSize.Height;
+ container.SizeHeight = paginationStyle.IndicatorSize.Height;
container.PositionX = (int)((this.SizeWidth - container.SizeWidth) / 2);
}
private void UpdateVisual()
{
- if (null == Style.IndicatorSize) return;
- if (null == Style.IndicatorImageUrl) return;
+ if (null == paginationStyle.IndicatorSize) return;
+ if (null == paginationStyle.IndicatorImageUrl) return;
if (indicatorCount < 0) return;
for (int i = 0; i < indicatorList.Count; i++)
{
ImageVisual indicator = indicatorList[i];
- indicator.URL = Style.IndicatorImageUrl.Normal;
- indicator.Size = new Size2D((int)Style.IndicatorSize.Width, (int)Style.IndicatorSize.Height);
- indicator.Position = new Vector2((int)(Style.IndicatorSize.Width + Style.IndicatorSpacing) * i, 0);
+ indicator.URL = paginationStyle.IndicatorImageUrl.Normal;
+ indicator.Size = new Size2D((int)paginationStyle.IndicatorSize.Width, (int)paginationStyle.IndicatorSize.Height);
+ indicator.Position = new Position2D((int)(paginationStyle.IndicatorSize.Width + paginationStyle.IndicatorSpacing) * i, 0);
}
}
}
public static readonly BindableProperty ButtonHeightProperty = BindableProperty.Create(nameof(ButtonHeight), typeof(int), typeof(Popup), default(int), propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
- if (newValue != null && instance?.Style?.Buttons?.Size != null )
+ if (newValue != null && instance?.popupStyle?.Buttons?.Size != null )
{
- instance.Style.Buttons.Size.Height = (int)newValue;
+ instance.popupStyle.Buttons.Size.Height = (int)newValue;
instance.btGroup.Itemheight = (int)newValue;
instance.UpdateView();
}
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return (int)(instance.Style?.Buttons?.Size?.Height ?? 0);
+ return (int)(instance.popupStyle?.Buttons?.Size?.Height ?? 0);
});
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
var instance = (Popup)bindable;
if (newValue != null)
{
- if (instance.Style?.Buttons?.Text != null)
+ if (instance.popupStyle?.Buttons?.Text != null)
{
- instance.Style.Buttons.Text.PointSize = (float)newValue;
+ instance.popupStyle.Buttons.Text.PointSize = (float)newValue;
}
instance.btGroup.ItemPointSize = (float)newValue;
}
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style?.Buttons?.Text?.PointSize?.All ?? 0;
+ return instance.popupStyle?.Buttons?.Text?.PointSize?.All ?? 0;
});
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
var instance = (Popup)bindable;
if (newValue != null)
{
- instance.Style.Buttons.Text.FontFamily = (string)newValue;
+ instance.popupStyle.Buttons.Text.FontFamily = (string)newValue;
instance.btGroup.ItemFontFamily = (string)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style?.Buttons?.Text?.FontFamily.All;
+ return instance.popupStyle?.Buttons?.Text?.FontFamily.All;
});
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
var instance = (Popup)bindable;
if (newValue != null)
{
- if (instance.Style?.Buttons?.Text != null)
+ if (instance.popupStyle?.Buttons?.Text != null)
{
- instance.Style.Buttons.Text.TextColor = (Color)newValue;
+ instance.popupStyle.Buttons.Text.TextColor = (Color)newValue;
}
instance.btGroup.ItemTextColor = (Color)newValue;
}
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style?.Buttons?.Text?.TextColor?.All;
+ return instance.popupStyle?.Buttons?.Text?.TextColor?.All;
});
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
var instance = (Popup)bindable;
if (newValue != null)
{
- instance.Style.Buttons.Overlay.BackgroundColor = (Selector<Color>)newValue;
+ instance.popupStyle.Buttons.Overlay.BackgroundColor = (Selector<Color>)newValue;
instance.btGroup.OverLayBackgroundColorSelector = (Selector<Color>)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style?.Buttons?.Overlay?.BackgroundColor;
+ return instance.popupStyle?.Buttons?.Overlay?.BackgroundColor;
});
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
var instance = (Popup)bindable;
if (newValue != null)
{
- instance.Style.Buttons.Text.HorizontalAlignment = (HorizontalAlignment)newValue;
+ instance.popupStyle.Buttons.Text.HorizontalAlignment = (HorizontalAlignment)newValue;
instance.btGroup.ItemTextAlignment = (HorizontalAlignment)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style?.Buttons?.Text?.HorizontalAlignment ?? HorizontalAlignment.Center;
+ return instance.popupStyle?.Buttons?.Text?.HorizontalAlignment ?? HorizontalAlignment.Center;
});
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
var instance = (Popup)bindable;
if (newValue != null)
{
- if (instance.Style.Buttons.BackgroundImage == null)
+ if (instance.popupStyle.Buttons.BackgroundImage == null)
{
- instance.Style.Buttons.BackgroundImage = new Selector<string>();
+ instance.popupStyle.Buttons.BackgroundImage = new Selector<string>();
}
+ instance.popupStyle.Buttons.BackgroundColor = new Selector<Color>();
+ instance.popupStyle.Buttons.BackgroundImage = (string)newValue;
instance.btGroup.ItemBackgroundImageUrl = (string)newValue;
- instance.Style.Buttons.BackgroundImage = (string)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style?.Buttons?.BackgroundImage?.All;
+ return instance.popupStyle?.Buttons?.BackgroundImage?.All;
});
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
var instance = (Popup)bindable;
if (newValue != null)
{
- if (instance.Style.Buttons.BackgroundImageBorder == null)
+ if (instance.popupStyle.Buttons.BackgroundImageBorder == null)
{
- instance.Style.Buttons.BackgroundImageBorder = new Selector<Rectangle>();
+ instance.popupStyle.Buttons.BackgroundImageBorder = new Selector<Rectangle>();
}
- instance.Style.Buttons.BackgroundImageBorder = (Rectangle)newValue;
+ instance.popupStyle.Buttons.BackgroundImageBorder = (Rectangle)newValue;
instance.btGroup.ItemBackgroundBorder = (Rectangle)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style?.Buttons?.BackgroundImageBorder?.All;
+ return instance.popupStyle?.Buttons?.BackgroundImageBorder?.All;
});
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
var instance = (Popup)bindable;
ImageShadow shadow = (ImageShadow)newValue;
instance.btGroup.ItemImageShadow = new ImageShadow(shadow);
- instance.Style.Buttons.ImageShadow = new ImageShadow(shadow);
+ instance.popupStyle.Buttons.ImageShadow = new ImageShadow(shadow);
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style?.Buttons?.ImageShadow?.All;
+ return instance.popupStyle?.Buttons?.ImageShadow?.All;
});
+ private PopupStyle popupStyle => ViewStyle as PopupStyle;
private TextLabel titleText;
private ButtonGroup btGroup = null;
private Window window = null;
[EditorBrowsable(EditorBrowsableState.Never)]
public void AddButton(string buttonText)
{
- if (Style.Buttons != null)
+ if (popupStyle.Buttons != null)
{
- Button btn = new Button(Style.Buttons);
- btn.Style.Text.Text = buttonText;
+ Button btn = new Button(popupStyle.Buttons);
+ btn.Text = buttonText;
btn.ClickEvent += ButtonClickEvent;
btGroup.AddItem(btn);
UpdateView();
[EditorBrowsable(EditorBrowsableState.Never)]
public void AddButton(string buttonText, ButtonStyle style)
{
- if (Style.Buttons != null && style != null)
+ if (popupStyle.Buttons != null && style != null)
{
- Style.Buttons.CopyFrom(style);
+ popupStyle.Buttons.CopyFrom(style);
AddButton(buttonText);
}
}
/// Get style of popup.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public new PopupStyle Style => ViewStyle as PopupStyle;
+ public new PopupStyle Style
+ {
+ get
+ {
+ var result = new PopupStyle(popupStyle);
+ result.CopyPropertiesFromView(this);
+ result.Title.CopyPropertiesFromView(titleText);
+ return result;
+ }
+ }
/// <summary>
/// Popup Title.
{
get
{
- return Style?.Title?.Text?.All;
+ return popupStyle?.Title?.Text?.All;
}
set
{
if (value != null)
{
- if (Style?.Title != null)
+ if (popupStyle?.Title != null)
{
- Style.Title.Text = value;
+ popupStyle.Title.Text = value;
}
}
}
{
get
{
- return Style?.Title?.PointSize?.All ?? 0;
+ return popupStyle?.Title?.PointSize?.All ?? 0;
}
set
{
- if (Style?.Title != null)
+ if (popupStyle?.Title != null)
{
- Style.Title.PointSize = value;
+ popupStyle.Title.PointSize = value;
}
}
}
{
get
{
- return Style?.Title?.TextColor?.All;
+ return popupStyle?.Title?.TextColor?.All;
}
set
{
- if (Style?.Title != null)
+ if (popupStyle?.Title != null)
{
- Style.Title.TextColor = value;
+ popupStyle.Title.TextColor = value;
}
}
}
{
get
{
- return Style?.Title?.HorizontalAlignment ?? HorizontalAlignment.Center;
+ return popupStyle?.Title?.HorizontalAlignment ?? HorizontalAlignment.Center;
}
set
{
- Style.Title.HorizontalAlignment = value;
+ popupStyle.Title.HorizontalAlignment = value;
}
}
{
get
{
- return Style?.Title?.Position ?? new Position(0, 0, 0);
+ return popupStyle?.Title?.Position ?? new Position(0, 0, 0);
}
set
{
- Style.Title.Position = value;
+ popupStyle.Title.Position = value;
}
}
{
get
{
- return (int)(Style?.Title?.Size?.Height ?? 0);
+ return (int)(popupStyle?.Title?.Size?.Height ?? 0);
}
set
{
- if (Style?.Title?.Size != null)
+ if (popupStyle?.Title?.Size != null)
{
- Style.Title.Size.Height = value;
+ popupStyle.Title.Size.Height = value;
}
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
{
- PopupStyle popupStyle = StyleManager.Instance.GetViewStyle(StyleName) as PopupStyle;
- if (popupStyle != null)
+ PopupStyle ppStyle = StyleManager.Instance.GetViewStyle(StyleName) as PopupStyle;
+ if (ppStyle != null)
{
- string strSaveTitleText = TitleText;
- Style.CopyFrom(popupStyle);
- Style.Title.Text = strSaveTitleText;
+ ApplyStyle(ppStyle);
UpdateView();
}
}
private void UpdateView()
{
- btGroup.UpdateButton(Style.Buttons);
+ btGroup.UpdateButton(popupStyle.Buttons);
UpdateContentView();
UpdateTitle();
}
{
if (e.PropertyName.Equals("LayoutDirection"))
{
- btGroup.UpdateButton(Style.Buttons);
+ btGroup.UpdateButton(popupStyle.Buttons);
}
}
int titleY = 0;
int titleH = 0;
int buttonH = 0;
- string strText = Style.Title.Text.All;
- if (!string.IsNullOrEmpty(strText) && Style.Title.Size != null)
+ string strText = Title.Text;
+ if (!string.IsNullOrEmpty(strText) && Title.Size != null)
{
titleH = (int)titleText.Size.Height;
}
- if (!string.IsNullOrEmpty(strText) && Style.Title.Position != null)
+ if (!string.IsNullOrEmpty(strText) && Title.Position != null)
{
- titleX = (int)Style.Title.Position.X;
- titleY = (int)Style.Title.Position.Y;
+ titleX = (int)Title.Position.X;
+ titleY = (int)Title.Position.Y;
}
- if (btGroup.Count != 0 && Style?.Buttons?.Size != null )
+ if (btGroup.Count != 0 && popupStyle?.Buttons?.Size != null )
{
- buttonH = (int)Style.Buttons.Size.Height;
+ buttonH = (int)popupStyle.Buttons.Size.Height;
}
ContentView.Size = new Size(Size.Width - titleX * 2, Size.Height - titleY - titleH - buttonH);
ContentView.Position = new Position(titleX, titleY + titleH);
private void UpdateTitle()
{
- if (titleText != null && string.IsNullOrEmpty(Style.Title.Text.All) && Style.Title.Size != null)
+ if (titleText != null && string.IsNullOrEmpty(popupStyle.Title.Text.All) && popupStyle.Title.Size != null)
{
titleText.RaiseToTop();
}
private float minValue = 0;
private float currentValue = 0;
private float bufferValue = 0;
+ private ProgressStyle progressStyle => ViewStyle as ProgressStyle;
static Progress() { }
/// <summary>
/// Get style of progress.
/// </summary>
/// <since_tizen> 8 </since_tizen>
- public new ProgressStyle Style => ViewStyle as ProgressStyle;
+ public new ProgressStyle Style
+ {
+ get
+ {
+ var result = new ProgressStyle(progressStyle);
+ result.CopyPropertiesFromView(this);
+ result.Track.CopyPropertiesFromView(trackImage);
+ result.Progress.CopyPropertiesFromView(progressImage);
+ result.Buffer.CopyPropertiesFromView(bufferImage);
+ return result;
+ }
+ }
/// <summary>
/// The property to get/set Track image object URL of the Progress.
{
get
{
- return Style?.Track?.ResourceUrl?.All;
+ return progressStyle?.Track?.ResourceUrl?.All;
}
set
{
- if (null != Style?.Track)
+ if (null != progressStyle?.Track)
{
- Style.Track.ResourceUrl = value;
+ progressStyle.Track.ResourceUrl = value;
}
}
}
{
get
{
- return Style?.Progress?.ResourceUrl?.All;
+ return progressStyle?.Progress?.ResourceUrl?.All;
}
set
{
- if (null != Style?.Progress)
+ if (null != progressStyle?.Progress)
{
- Style.Progress.ResourceUrl = value;
+ progressStyle.Progress.ResourceUrl = value;
}
}
}
{
get
{
- return Style?.Buffer?.ResourceUrl?.All;
+ return progressStyle?.Buffer?.ResourceUrl?.All;
}
set
{
- if (null != Style?.Buffer)
+ if (null != progressStyle?.Buffer)
{
- Style.Buffer.ResourceUrl = value;
+ progressStyle.Buffer.ResourceUrl = value;
RelayoutRequest();
}
}
{
get
{
- return Style?.Track?.BackgroundColor?.All;
+ return progressStyle?.Track?.BackgroundColor?.All;
}
set
{
- if (null != Style?.Track)
+ if (null != progressStyle?.Track)
{
- Style.Track.BackgroundColor = value;
+ progressStyle.Track.BackgroundColor = value;
}
}
}
{
get
{
- return Style?.Progress?.BackgroundColor?.All;
+ return progressStyle?.Progress?.BackgroundColor?.All;
}
set
{
- if (null != Style?.Progress)
+ if (null != progressStyle?.Progress)
{
- Style.Progress.BackgroundColor = value;
+ progressStyle.Progress.BackgroundColor = value;
}
}
}
{
get
{
- return Style?.Buffer?.BackgroundColor?.All;
+ return progressStyle?.Buffer?.BackgroundColor?.All;
}
set
{
- if (null != Style?.Buffer)
+ if (null != progressStyle?.Buffer)
{
- Style.Buffer.BackgroundColor = value;
+ progressStyle.Buffer.BackgroundColor = value;
}
}
}
ProgressStyle tempStyle = StyleManager.Instance.GetViewStyle(StyleName) as ProgressStyle;
if (null != tempStyle)
{
- Style.CopyFrom(tempStyle);
+ progressStyle.CopyFrom(tempStyle);
RelayoutRequest();
}
}
PivotPoint = NUI.PivotPoint.TopLeft
};
Add(trackImage);
- trackImage.ApplyStyle(Style.Track);
+ trackImage.ApplyStyle(progressStyle.Track);
}
}
PivotPoint = Tizen.NUI.PivotPoint.TopLeft
};
Add(progressImage);
- progressImage.ApplyStyle(Style.Progress);
+ progressImage.ApplyStyle(progressStyle.Progress);
}
}
PivotPoint = Tizen.NUI.PivotPoint.TopLeft
};
Add(bufferImage);
- bufferImage.ApplyStyle(Style.Buffer);
+ bufferImage.ApplyStyle(progressStyle.Buffer);
}
}
}
*
*/
using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
namespace Tizen.NUI.Components
{
}
}
+ /// <inheritdoc/>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override void ApplyStyle(ViewStyle viewStyle)
+ {
+ if (viewStyle is ButtonStyle buttonStyle)
+ {
+ if (buttonStyle.IsSelectable == null)
+ {
+ buttonStyle.IsSelectable = true;
+ }
+
+ base.ApplyStyle(buttonStyle);
+ }
+ }
+
/// <summary>
/// Set CheckState to true after selecting RadioButton.
/// </summary>
var instance = ((Scrollbar)bindable);
var thickness = (float?)newValue;
- instance.Style.TrackThickness = thickness;
+ instance.scrollbarStyle.TrackThickness = thickness;
instance.UpdateTrackThickness(thickness ?? 0);
},
defaultValueCreator: (bindable) =>
{
- return ((Scrollbar)bindable).Style.TrackThickness ?? 0;
+ return ((Scrollbar)bindable).scrollbarStyle.TrackThickness ?? 0;
});
/// <summary>Bindable property of ThumbThickness</summary>
var instance = ((Scrollbar)bindable);
var thickness = (float?)newValue;
- instance.Style.ThumbThickness = thickness;
+ instance.scrollbarStyle.ThumbThickness = thickness;
instance.UpdateThumbThickness(thickness ?? 0);
},
defaultValueCreator: (bindable) =>
{
- return ((Scrollbar)bindable).Style.ThumbThickness ?? 0;
+ return ((Scrollbar)bindable).scrollbarStyle.ThumbThickness ?? 0;
});
/// <summary>Bindable property of TrackColor</summary>
var instance = ((Scrollbar)bindable);
var color = (Color)newValue;
- instance.Style.TrackColor = color;
+ instance.scrollbarStyle.TrackColor = color;
instance.UpdateTrackColor(color);
},
defaultValueCreator: (bindable) =>
{
- return ((Scrollbar)bindable).Style.TrackColor;
+ return ((Scrollbar)bindable).scrollbarStyle.TrackColor;
});
/// <summary>Bindable property of ThumbColor</summary>
var instance = ((Scrollbar)bindable);
var color = (Color)newValue;
- instance.Style.ThumbColor = color;
+ instance.scrollbarStyle.ThumbColor = color;
instance.UpdateThumbColor(color);
},
defaultValueCreator: (bindable) =>
{
- return ((Scrollbar)bindable).Style.ThumbColor;
+ return ((Scrollbar)bindable).scrollbarStyle.ThumbColor;
});
/// <summary>Bindable property of TrackPadding</summary>
var instance = ((Scrollbar)bindable);
var trackPadding = (Extents)newValue;
- instance.Style.TrackPadding = trackPadding;
+ instance.scrollbarStyle.TrackPadding = trackPadding;
instance.UpdateTrackPadding(trackPadding);
},
defaultValueCreator: (bindable) =>
{
- return ((Scrollbar)bindable).Style.TrackPadding;
+ return ((Scrollbar)bindable).scrollbarStyle.TrackPadding;
});
private ColorVisual trackVisual;
private Animation thumbSizeAnimation;
private Calculator calculator;
private Size containerSize = new Size(0, 0);
+ private ScrollbarStyle scrollbarStyle => ViewStyle as ScrollbarStyle;
#endregion Fields
/// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
- public new ScrollbarStyle Style => ViewStyle as ScrollbarStyle;
+ public new ScrollbarStyle Style
+ {
+ get
+ {
+ var result = new ScrollbarStyle(scrollbarStyle);
+ result.CopyPropertiesFromView(this);
+ return result;
+ }
+ }
/// <summary>
/// The thickness of the track.
private void Initialize()
{
- if (null == Style) return;
- Style.IsSelectable = true;
+ IsSelectable = true;
}
private void OnSelect()
bool isFocused = false;
bool isPressed = false;
- private StringSelector thumbImageURLSelector = new StringSelector();
-
private void Initialize()
{
currentSlidedOffset = 0;
}
else
{
- if (lowIndicatorImage != null && Style != null && Style.LowIndicatorImage != null && Style.LowIndicatorImage.Size != null)
+ if (lowIndicatorImage != null && lowIndicatorImage != null && lowIndicatorImage.Size != null)
{
- lowIndicatorImage.Size = Style.LowIndicatorImage.Size;
+ lowIndicatorImage.Size = sliderStyle.LowIndicatorImage.Size;
}
- if (lowIndicatorText != null && Style != null && Style.LowIndicator != null && Style.LowIndicator.Size != null)
+ if (lowIndicatorText != null && lowIndicatorText != null && lowIndicatorText.Size != null)
{
- lowIndicatorText.Size = Style.LowIndicator.Size;
+ lowIndicatorText.Size = sliderStyle.LowIndicator.Size;
}
}
}
}
else
{
- if (Style != null && Style.TrackThickness != null)
+ if (sliderStyle != null && sliderStyle.TrackThickness != null)
{
- curTrackThickness = Style.TrackThickness.Value;
+ curTrackThickness = sliderStyle.TrackThickness.Value;
}
}
return curTrackThickness;
}
else
{
- if (Style != null && Style.TrackPadding != null)
+ if (sliderStyle != null && sliderStyle.TrackPadding != null)
{
- curSpace = Style.TrackPadding.Start;
+ curSpace = sliderStyle.TrackPadding.Start;
}
}
return curSpace;
private IndicatorType CurrentIndicatorType()
{
IndicatorType type = IndicatorType.None;
- if (Style != null)
+ if (sliderStyle != null)
{
- type = (IndicatorType)Style.IndicatorType;
+ type = (IndicatorType)sliderStyle.IndicatorType;
}
return type;
}
}
else
{
- if (Style != null && Style.LowIndicatorImage != null && Style.LowIndicatorImage.Size != null)
+ if (sliderStyle != null && sliderStyle.LowIndicatorImage != null && sliderStyle.LowIndicatorImage.Size != null)
{
- size = Style.LowIndicatorImage.Size;
+ size = sliderStyle.LowIndicatorImage.Size;
}
}
return size;
}
else
{
- if (Style != null && Style.HighIndicatorImage != null && Style.HighIndicatorImage.Size != null)
+ if (sliderStyle != null && sliderStyle.HighIndicatorImage != null && sliderStyle.HighIndicatorImage.Size != null)
{
- size = Style.HighIndicatorImage.Size;
+ size = sliderStyle.HighIndicatorImage.Size;
}
}
return size;
}
else
{
- if (Style != null && Style.LowIndicator != null && Style.LowIndicator.Size != null)
+ if (sliderStyle != null && sliderStyle.LowIndicator != null && sliderStyle.LowIndicator.Size != null)
{
- size = Style.LowIndicator.Size;
+ size = sliderStyle.LowIndicator.Size;
}
}
return size;
}
else
{
- if (Style != null && Style.HighIndicator != null && Style.HighIndicator.Size != null)
+ if (sliderStyle != null && sliderStyle.HighIndicator != null && sliderStyle.HighIndicator.Size != null)
{
- size = Style.HighIndicator.Size;
+ size = sliderStyle.HighIndicator.Size;
}
}
return size;
}
/// <summary>
- /// Get style of slider.
+ /// Return a copied Style instance of Slider
/// </summary>
+ /// <remarks>
+ /// It returns copied Style instance and changing it does not effect to the Slider.
+ /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
+ /// </remarks>
/// <since_tizen> 8 </since_tizen>
- public new SliderStyle Style => ViewStyle as SliderStyle;
+ public new SliderStyle Style
+ {
+ get
+ {
+ var result = new SliderStyle(sliderStyle);
+ result.CopyPropertiesFromView(this);
+ result.Track.CopyPropertiesFromView(bgTrackImage);
+ result.Progress.CopyPropertiesFromView(slidedTrackImage);
+ result.Thumb.CopyPropertiesFromView(thumbImage);
+ result.LowIndicatorImage.CopyPropertiesFromView(lowIndicatorImage);
+ result.HighIndicatorImage.CopyPropertiesFromView(highIndicatorImage);
+ result.LowIndicator.CopyPropertiesFromView(lowIndicatorText);
+ result.HighIndicator.CopyPropertiesFromView(highIndicatorText);
+ return result;
+ }
+ }
+
+ /// <summary>
+ /// Return a copied Style instance of Slider
+ /// </summary>
+ private SliderStyle sliderStyle => ViewStyle as SliderStyle;
/// <summary>
/// Gets or sets the direction type of slider.
{
get
{
- return Style.Thumb?.Size;
+ return thumbImage?.Size;
}
set
{
- Style.Thumb.Size = value;
+ if (null != thumbImage)
+ {
+ thumbImage.Size = value;
+ sliderStyle.Thumb.Size = value;
+ }
}
}
{
get
{
- return Style?.Thumb?.ResourceUrl?.All;
+ return thumbImage?.ResourceUrl;
}
set
{
- if (null != Style?.Thumb)
+ if (null != thumbImage)
{
- Style.Thumb.ResourceUrl = value;
+ thumbImage.ResourceUrl = value;
+ sliderStyle.Thumb.ResourceUrl = value;
}
}
}
/// <summary>
/// Gets or sets the resource url selector of the thumb image object.
+ /// Getter returns copied selector value if exist, null otherwise.
/// </summary>
/// <since_tizen> 6 </since_tizen>
public StringSelector ThumbImageURLSelector
{
- get
- {
- return thumbImageURLSelector;
- }
- set
- {
- if (value == null || thumbImageURLSelector == null)
- {
- Tizen.Log.Fatal("NUI", "[Exception] Slider.ThumbImageURLSelector is null");
- throw new NullReferenceException("Slider.ThumbImageURLSelector is null");
- }
- else
- {
- thumbImageURLSelector.Clone(value);
- }
- }
+ get => thumbImage == null ? null : new StringSelector((Selector<string>)thumbImage.GetValue(ImageView.ResourceUrlSelectorProperty));
+ set => thumbImage?.SetValue(ImageView.ResourceUrlSelectorProperty, value);
}
/// <summary>
{
get
{
- return Style?.Track?.BackgroundColor?.All;
+ return bgTrackImage?.BackgroundColor;
}
set
{
- if (null != Style?.Track)
+ if (null != bgTrackImage)
{
- Style.Track.BackgroundColor = value;
+ bgTrackImage.BackgroundColor = value;
+ sliderStyle.Track.BackgroundColor = value;
}
}
}
{
get
{
- return Style?.Progress?.BackgroundColor?.All;
+ return slidedTrackImage?.BackgroundColor;
}
set
{
- if (null != Style?.Progress)
+ if (null != slidedTrackImage)
{
- Style.Progress.BackgroundColor = value;
+ slidedTrackImage.BackgroundColor = value;
+ sliderStyle.Progress.BackgroundColor = value;
}
}
}
{
get
{
- return Style?.LowIndicatorImage?.ResourceUrl?.All;
+ return lowIndicatorImage?.ResourceUrl;
}
set
{
- if (null != Style?.LowIndicatorImage)
+ if (null != lowIndicatorImage)
{
- Style.LowIndicatorImage.ResourceUrl = value;
+ lowIndicatorImage.ResourceUrl = value;
+ sliderStyle.LowIndicatorImage.ResourceUrl = value;
}
}
}
{
get
{
- return Style?.HighIndicatorImage?.ResourceUrl?.All;
+ return highIndicatorImage?.ResourceUrl;
}
set
{
- if (null != Style?.HighIndicatorImage)
+ if (null != highIndicatorImage)
{
- Style.HighIndicatorImage.ResourceUrl = value;
+ highIndicatorImage.ResourceUrl = value;
+ sliderStyle.HighIndicatorImage.ResourceUrl = value;
}
}
}
{
get
{
- return Style?.LowIndicator?.Text?.All;
+ return lowIndicatorText?.Text;
}
set
{
- if (null != Style?.LowIndicator)
+ if (null != lowIndicatorText)
{
- Style.LowIndicator.Text= value;
+ lowIndicatorText.Text= value;
+ sliderStyle.LowIndicator.Text= value;
}
}
}
{
get
{
- return Style?.HighIndicator?.Text?.All;
+ return highIndicatorText?.Text;
}
set
{
- if (null != Style?.HighIndicator)
+ if (null != highIndicatorText)
{
- Style.HighIndicator.Text = value;
+ highIndicatorText.Text = value;
+ sliderStyle.HighIndicator.Text = value;
}
}
}
{
get
{
- return Style.HighIndicator.Size;
+ return highIndicatorText?.Size;
}
set
{
- Style.HighIndicator.Size = value;
+ if (null != highIndicatorText)
+ {
+ highIndicatorText.Size = value;
+ sliderStyle.HighIndicator.Size = value;
+ }
}
}
SliderStyle sliderStyle = StyleManager.Instance.GetViewStyle(StyleName) as SliderStyle;
if (sliderStyle != null)
{
- Style?.CopyFrom(sliderStyle);
+ ApplyStyle(sliderStyle);
RelayoutRequest();
}
}
public event EventHandler<SelectEventArgs> SelectedEvent;
/// <summary>
- /// Get style of switch.
+ /// Return a copied Style instance of Switch
/// </summary>
+ /// <remarks>
+ /// It returns copied Style instance and changing it does not effect to the Switch.
+ /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
+ /// </remarks>
/// <since_tizen> 8 </since_tizen>
- public new SwitchStyle Style => ViewStyle as SwitchStyle;
+ public new SwitchStyle Style
+ {
+ get
+ {
+ var result = new SwitchStyle(ViewStyle as SwitchStyle);
+ result.CopyPropertiesFromView(this);
+ result.Track.CopyPropertiesFromView(Track);
+ result.Thumb.CopyPropertiesFromView(Thumb);
+ return result;
+ }
+ }
/// <summary>
/// Apply style to switch.
/// <since_tizen> 6 </since_tizen>
public StringSelector SwitchBackgroundImageURLSelector
{
- get
- {
- StringSelector strSl = new StringSelector();
- strSl.Clone(Style?.Track?.ResourceUrl);
- return strSl;
- }
- set
- {
- if (null != value && null != Style?.Track)
- {
- Style.Track.ResourceUrl = value;
- }
- }
+ get => track == null ? null : new StringSelector((Selector<string>)thumb.GetValue(ImageView.ResourceUrlSelectorProperty));
+ set => track?.SetValue(ImageView.ResourceUrlSelectorProperty, value);
}
/// <summary>
{
get
{
- return Style?.Thumb?.ResourceUrl?.All;
+ return Thumb.ResourceUrl;
}
set
{
- if (null != value && null != Style?.Thumb)
- {
- Style.Thumb.ResourceUrl = value;
- }
+ Thumb.ResourceUrl = value;
}
}
/// <summary>
/// Handler image's resource url selector in Switch.
+ /// Getter returns copied selector value if exist, null otherwise.
/// </summary>
/// <since_tizen> 6 </since_tizen>
public StringSelector SwitchHandlerImageURLSelector
{
- get
- {
- StringSelector strSl = new StringSelector();
- strSl.Clone(Style?.Thumb?.ResourceUrl);
- return strSl;
- }
- set
- {
- if (null != value && null != Style?.Thumb)
- {
- Style.Thumb.ResourceUrl = value;
- }
- }
+ get => thumb == null ? null : new StringSelector((Selector<string>)thumb.GetValue(ImageView.ResourceUrlSelectorProperty));
+ set => thumb?.SetValue(ImageView.ResourceUrlSelectorProperty, value);
}
/// <summary>
{
get
{
- return Style?.Thumb?.Size;
+ return Thumb.Size;
}
set
{
- if (null != Style?.Thumb)
- {
- Style.Thumb.Size = value;
- }
+ Thumb.Size = value;
}
}
private void Initialize()
{
- Style.IsSelectable = true;
+ IsSelectable = true;
}
/// <summary>
SwitchStyle switchStyle = StyleManager.Instance.GetViewStyle(StyleName) as SwitchStyle;
if (null != switchStyle)
{
- Style.CopyFrom(switchStyle);
+ ApplyStyle(switchStyle);
}
}
private Animation underlineAni = null;
private bool isNeedAnimation = false;
private Extents space;
+ private TabStyle tabStyle => ViewStyle as TabStyle;
+
static Tab() { }
/// <summary>
public event EventHandler<ItemChangedEventArgs> ItemChangedEvent;
/// <summary>
- /// Get style of tab.
+ /// Return a copied Style instance of Tab
/// </summary>
+ /// <remarks>
+ /// It returns copied Style instance and changing it does not effect to the Tab.
+ /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
+ /// </remarks>
/// <since_tizen> 8 </since_tizen>
- public new TabStyle Style => ViewStyle as TabStyle;
+ public new TabStyle Style
+ {
+ get
+ {
+ var result = new TabStyle(tabStyle);
+ result.CopyPropertiesFromView(this);
+ result.UnderLine.CopyPropertiesFromView(underline);
+ return result;
+ }
+ }
[EditorBrowsable(EditorBrowsableState.Never)]
public View Underline
{
get
{
- return Style?.UseTextNaturalSize ?? false;
+ return tabStyle?.UseTextNaturalSize ?? false;
}
set
{
- if (null != Style)
+ if (null != tabStyle)
{
- Style.UseTextNaturalSize = value;
+ tabStyle.UseTextNaturalSize = value;
RelayoutRequest();
}
}
{
get
{
- return Style?.ItemSpace ?? 0;
+ return tabStyle?.ItemSpace ?? 0;
}
set
{
- if (null != Style)
+ if (null != tabStyle)
{
- Style.ItemSpace = value;
+ tabStyle.ItemSpace = value;
RelayoutRequest();
}
}
}
set
{
- if(null != value && null != Style?.ItemPadding)
+ if(null != value && null != tabStyle?.ItemPadding)
{
- Style.ItemPadding.CopyFrom(value);
+ tabStyle.ItemPadding.CopyFrom(value);
if (null == space)
{
space = new Extents((ushort start, ushort end, ushort top, ushort bottom) =>
{
- Style.ItemPadding.Start = start;
- Style.ItemPadding.End = end;
- Style.ItemPadding.Top = top;
- Style.ItemPadding.Bottom = bottom;
+ tabStyle.ItemPadding.Start = start;
+ tabStyle.ItemPadding.End = end;
+ tabStyle.ItemPadding.Top = top;
+ tabStyle.ItemPadding.Bottom = bottom;
RelayoutRequest();
}, value.Start, value.End, value.Top, value.Bottom);
}
{
get
{
- return Style?.UnderLine?.Size;
+ return Underline.Size;
}
set
{
- if (null != Style?.UnderLine)
+ if (null != tabStyle?.UnderLine)
{
- Style.UnderLine.Size = value;
+ tabStyle.UnderLine.Size = value;
}
+ Underline.Size = value;
}
}
{
get
{
- return Style?.UnderLine?.BackgroundColor?.All;
+ return Underline.BackgroundColor;
}
set
{
- if (null != Style?.UnderLine)
+ if (null != tabStyle?.BackgroundColor)
{
- Style.UnderLine.BackgroundColor = value;
+ tabStyle.UnderLine.BackgroundColor = value;
}
+ Underline.BackgroundColor = value;
}
}
{
get
{
- return Style?.Text?.PointSize?.All ?? 0;
+ return tabStyle?.Text?.PointSize?.All ?? 0;
}
set
{
- if (null != Style?.Text)
+ if (null != tabStyle?.Text)
{
- Style.Text.PointSize = value;
+ tabStyle.Text.PointSize = value;
+ RelayoutRequest();
}
}
}
{
get
{
- return Style?.Text?.FontFamily?.All;
+ return tabStyle?.Text?.FontFamily?.All;
}
set
{
- if (null != Style?.Text)
+ if (null != tabStyle?.Text)
{
- Style.Text.FontFamily = value;
+ tabStyle.Text.FontFamily = value;
+ RelayoutRequest();
}
}
}
{
get
{
- return Style?.Text?.TextColor?.All;
+ return tabStyle?.Text?.TextColor?.All;
}
set
{
- if (null != Style?.Text)
+ if (null != tabStyle?.Text)
{
- Style.Text.TextColor = value;
+ tabStyle.Text.TextColor = value;
+ RelayoutRequest();
}
}
}
TabStyle tabStyle = StyleManager.Instance.GetViewStyle(StyleName) as TabStyle;
if (tabStyle != null)
{
- Style.CopyFrom(tabStyle);
+ ApplyStyle(tabStyle);
}
}
return;
}
- int preX = (int)Style.ItemPadding.Start;
+ int preX = (int)tabStyle?.ItemPadding.Start;
int preW = 0;
- int itemSpace = Style.ItemSpace;
+ int itemSpace = (null != tabStyle) ? tabStyle.ItemSpace : 0;
if (LayoutDirection == ViewLayoutDirectionType.LTR)
{
- if (Style.UseTextNaturalSize == true)
+ if (tabStyle?.UseTextNaturalSize == true)
{
for (int i = 0; i < totalNum; i++)
{
}
else
{
- preW = (Size2D.Width - (int)Style.ItemPadding.Start - (int)Style.ItemPadding.End) / totalNum;
+ preW = (Size2D.Width - (int)tabStyle?.ItemPadding.Start - (int)tabStyle?.ItemPadding.End) / totalNum;
for (int i = 0; i < totalNum; i++)
{
itemList[i].Position2D.X = preX;
}
else
{
- preX = (int)Style.ItemPadding.End;
- if (Style.UseTextNaturalSize == true)
+ preX = (int)tabStyle?.ItemPadding.End;
+ if (tabStyle?.UseTextNaturalSize == true)
{
int w = Size2D.Width;
for (int i = 0; i < totalNum; i++)
}
else
{
- preW = (Size2D.Width - (int)Style.ItemPadding.Start - (int)Style.ItemPadding.End) / totalNum;
+ preW = (Size2D.Width - (int)tabStyle?.ItemPadding.Start - (int)tabStyle?.ItemPadding.End) / totalNum;
for (int i = totalNum - 1; i >= 0; i--)
{
itemList[i].Position2D.X = preX;
private void AddItemByIndex(TabItemData itemData, int index)
{
- if (null == itemData) return;
+ if (null == itemData || null == tabStyle) return;
int h = 0;
- int topSpace = (int)Style.ItemPadding.Top;
- if (Style.UnderLine != null && Style.UnderLine.Size != null)
+ int topSpace = (int)tabStyle.ItemPadding.Top;
+ if (Underline.Size != null)
{
- h = (int)Style.UnderLine.Size.Height;
+ h = (int)Underline.Size.Height;
}
Tab.TabItem item = new TabItem();
- item.TextItem.ApplyStyle(Style.Text);
+ item.TextItem.ApplyStyle(tabStyle.Text);
item.Text = itemData.Text;
item.Size2D.Height = Size2D.Height - h - topSpace;
private void UpdateUnderLinePos()
{
- if (underline == null || Style.UnderLine == null || Style.UnderLine.Size == null
- || itemList == null || itemList.Count <= 0)
+ if (underline == null || Underline.Size == null || itemList == null || itemList.Count <= 0)
{
return;
}
- Style.UnderLine.Size.Width = itemList[curIndex].Size2D.Width;
+ Underline.Size.Width = itemList[curIndex].Size2D.Width;
- underline.Size2D = new Size2D(itemList[curIndex].Size2D.Width, (int)Style.UnderLine.Size.Height);
- underline.BackgroundColor = Style.UnderLine.BackgroundColor.All;
+ underline.Size2D = new Size2D(itemList[curIndex].Size2D.Width, (int)Underline.Size.Height);
+ underline.BackgroundColor = tabStyle.UnderLine.BackgroundColor.All;
if (isNeedAnimation)
{
CreateUnderLineAnimation();
if (newValue != null)
{
instance.strText = (string)(newValue);
- instance.Style.Text.Text = instance.strText;
+ if (null != instance.textLabel)
+ {
+ instance.textLabel.Text = instance.strText;
+ }
}
},
defaultValueCreator: (bindable) =>
var instance = (Toast)bindable;
if (newValue != null)
{
- instance.Style.Duration = (uint)newValue;
+ instance.toastStyle.Duration = (uint)newValue;
+ if (instance.timer == null)
+ {
+ instance.timer = new Timer(instance.duration);
+ }
instance.timer.Interval = (uint)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Toast)bindable;
- return instance.Style.Duration ?? instance.duration;
+ return instance.toastStyle.Duration ?? instance.duration;
});
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
private string strText = null;
private Timer timer = null;
private readonly uint duration = 3000;
+ private ToastStyle toastStyle => ViewStyle as ToastStyle;
/// <summary>
- /// Get style of toast.
+ /// Return a copied Style instance of Toast
/// </summary>
+ /// <remarks>
+ /// It returns copied Style instance and changing it does not effect to the Toast.
+ /// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
+ /// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
- public new ToastStyle Style => ViewStyle as ToastStyle;
+ public new ToastStyle Style
+ {
+ get
+ {
+ var result = new ToastStyle(toastStyle);
+ result.CopyPropertiesFromView(this);
+ result.Text.CopyPropertiesFromView(textLabel);
+ return result;
+ }
+ }
static Toast() { }
/// <summary>
{
get
{
- return (float)Style?.Text?.PointSize?.All;
+ return (float)textLabel?.PointSize;
}
set
{
- if (null != Style?.Text)
+ if (null != textLabel)
{
- Style.Text.PointSize = value;
+ textLabel.PointSize = value;
}
}
}
{
get
{
- return Style?.Text?.FontFamily?.All;
+ return textLabel?.FontFamily;
}
set
{
- if (null != Style?.Text)
+ if (null != textLabel)
{
- Style.Text.FontFamily = value;
+ textLabel.FontFamily = value;
}
}
}
{
get
{
- return Style?.Text?.TextColor?.All;
+ return textLabel?.TextColor;
}
set
{
- if (null != Style?.Text)
+ if (null != textLabel)
{
- Style.Text.TextColor = value;
+ textLabel.TextColor = value;
}
}
}
{
get
{
- return Style?.Text?.HorizontalAlignment ?? HorizontalAlignment.Center;
+ return textLabel?.HorizontalAlignment ?? HorizontalAlignment.Center;
}
set
{
- if (null != Style?.Text)
+ if (null != textLabel)
{
- Style.Text.HorizontalAlignment = value;
+ textLabel.HorizontalAlignment = value;
}
}
}
{
get
{
- return Style.Text.Padding;
+ return textLabel?.Padding;
}
set
{
- if (null != value && null != Style.Text)
+ if (null != value && null != textLabel)
{
- Style.Text.Padding.CopyFrom(value);
+ textLabel.Padding.CopyFrom(value);
}
}
}
}
this.VisibilityChanged += OnVisibilityChanged;
- timer = new Timer(Style.Duration ?? duration);
+ timer = new Timer(toastStyle.Duration ?? duration);
timer.Tick += OnTick;
}
{
Url = StyleManager.GetFrameworkResourcePath("nui_component_default_popup_shadow.png"),
Border = new Rectangle(24, 24, 24, 24),
- Offset = new Vector2(-24, -24),
Extents = new Vector2(48, 48),
},
Title = new TextLabelStyle
Track = new ImageViewStyle
{
Size = new Size(96, 60),
+ WidthResizePolicy = ResizePolicyType.Fixed,
+ HeightResizePolicy = ResizePolicyType.Fixed,
ResourceUrl = new Selector<string>
{
Normal = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_track_n.png"),
public static readonly BindableProperty IsSelectedProperty = BindableProperty.Create(nameof(IsSelected), typeof(bool?), typeof(ButtonStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var buttonStyle = (ButtonStyle)bindable;
- if (buttonStyle.IsSelectable != null && buttonStyle.IsSelectable == true)
- {
- buttonStyle.isSelected = (bool?)newValue;
- }
+ buttonStyle.isSelected = (bool?)newValue;
},
defaultValueCreator: (bindable) =>
{
{
Icon?.CopyFrom(buttonStyle.Icon);
}
-
- IsSelectable = buttonStyle.IsSelectable;
- IconRelativeOrientation = buttonStyle.IconRelativeOrientation;
}
}
WidthResizePolicy = ResizePolicyType.FillToParent,
HeightResizePolicy = ResizePolicyType.FillToParent
};
- Overlay.PropertyChanged += SubStyleCalledEvent;
Text = new TextLabelStyle()
{
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center
};
- Text.PropertyChanged += SubStyleCalledEvent;
Icon = new ImageViewStyle()
{
ParentOrigin = Tizen.NUI.ParentOrigin.Center,
PivotPoint = Tizen.NUI.PivotPoint.Center,
};
- Icon.PropertyChanged += SubStyleCalledEvent;
IconRelativeOrientation = Button.IconOrientation.Left;
}
- private void SubStyleCalledEvent(object sender, global::System.EventArgs e)
- {
- OnPropertyChanged();
- }
-
private void OnIconPaddingChanged(ushort start, ushort end, ushort top, ushort bottom)
{
IconPadding = new Extents(start, end, top, bottom);
InitSubstyle();
}
+
/// <summary>
/// Creates a new instance of a ControlStyle with style.
/// </summary>
/// <since_tizen> 8 </since_tizen>
public PaginationStyle(PaginationStyle style) : base(style)
{
- if (null == style) return;
+ if (null == style) return;
this.CopyFrom(style);
}
[EditorBrowsable(EditorBrowsableState.Never)]
public PopupStyle(PopupStyle style) : base(style)
{
- InitSubStyle();
+ Title = new TextLabelStyle();
+ Buttons = new ButtonStyle();
this.CopyFrom(style);
}
Title = new TextLabelStyle()
{
- Size = new Size(0, 0),
PositionUsesPivotPoint = true,
ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
return;
}
- InitSubStyle();
+ IsSelectable = true;
+ Track = new ImageViewStyle();
+ Thumb = new ImageViewStyle();
this.CopyFrom(style);
}
private void InitSubStyle()
{
+ IsSelectable = true;
Track = new ImageViewStyle()
{
PositionUsesPivotPoint = true,
}
ItemSpace = style.ItemSpace;
UseTextNaturalSize = style.UseTextNaturalSize;
-
- if (null != style.UnderLine)
- {
- UnderLine?.CopyFrom(style.UnderLine);
- }
-
- if (null != style.Text)
- {
- Text?.CopyFrom(style.Text);
- }
}
/// <summary>
/// <since_tizen> 6 </since_tizen>
/// 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 IntSelector Clone()
+ public new IntSelector Clone()
{
- IntSelector selector = new IntSelector();
- selector.Clone(this);
- return selector;
+ return (IntSelector)base.Clone();
}
}
public class FloatSelector : Selector<float?>
{
/// <summary>
+ /// Default constructor.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public FloatSelector() : base()
+ {
+ }
+
+ /// <summary>
+ /// Constructor with base class object.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public FloatSelector(Selector<float?> selector) : base(selector)
+ {
+ }
+
+ /// <summary>
/// Float selector clone function.
/// </summary>
/// <since_tizen> 6 </since_tizen>
/// 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 FloatSelector Clone()
+ public new FloatSelector Clone()
{
- FloatSelector selector = new FloatSelector();
- selector.Clone(this);
- return selector;
+ return (FloatSelector)base.Clone();
}
}
/// <summary>
/// <since_tizen> 6 </since_tizen>
/// 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 BoolSelector Clone()
+ public new BoolSelector Clone()
{
- BoolSelector selector = new BoolSelector();
- selector.Clone(this);
- return selector;
+ return (BoolSelector)base.Clone();
}
}
/// <summary>
public class StringSelector : Selector<string>
{
/// <summary>
+ /// Default constructor.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public StringSelector() : base()
+ {
+ }
+
+ /// <summary>
+ /// Constructor with base class object.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public StringSelector(Selector<string> selector) : base(selector)
+ {
+ }
+
+ /// <summary>
/// String selector clone function.
/// </summary>
/// <since_tizen> 6 </since_tizen>
/// 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 StringSelector Clone()
+ public new StringSelector Clone()
{
- StringSelector selector = new StringSelector();
- selector.Clone(this);
- return selector;
+ return (StringSelector)base.Clone();
}
}
public class ColorSelector : Selector<Color>
{
/// <summary>
+ /// Default constructor.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ColorSelector() : base()
+ {
+ }
+
+ /// <summary>
+ /// Constructor with base class object.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ColorSelector(Selector<Color> selector) : base(selector)
+ {
+ }
+
+ /// <summary>
/// Color selector clone function.
/// </summary>
/// <since_tizen> 6 </since_tizen>
/// 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 ColorSelector Clone()
+ public new ColorSelector Clone()
{
- ColorSelector selector = new ColorSelector();
- selector.Clone(this);
- return selector;
+ return (ColorSelector)base.Clone();
}
}
/// <since_tizen> 6 </since_tizen>
/// 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 Size2DSelector Clone()
+ public new Size2DSelector Clone()
{
- Size2DSelector selector = new Size2DSelector();
- selector.Clone(this);
- return selector;
+ return (Size2DSelector)base.Clone();
}
}
/// <summary>
/// <since_tizen> 6 </since_tizen>
/// 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 Position2DSelector Clone()
+ public new Position2DSelector Clone()
{
- Position2DSelector selector = new Position2DSelector();
- selector.Clone(this);
- return selector;
+ return (Position2DSelector)base.Clone();
}
}
/// <since_tizen> 6 </since_tizen>
/// 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 PositionSelector Clone()
+ public new PositionSelector Clone()
{
- PositionSelector selector = new PositionSelector();
- selector.Clone(this);
- return selector;
+ return (PositionSelector)base.Clone();
}
}
/// <since_tizen> 6 </since_tizen>
/// 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 Vector2Selector Clone()
+ public new Vector2Selector Clone()
{
- Vector2Selector selector = new Vector2Selector();
- selector.Clone(this);
- return selector;
+ return (Vector2Selector)base.Clone();
}
}
/// <since_tizen> 6 </since_tizen>
/// 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 Vector3Selector Clone()
+ public new Vector3Selector Clone()
{
- Vector3Selector selector = new Vector3Selector();
- selector.Clone(this);
- return selector;
+ return (Vector3Selector)base.Clone();
}
}
/// <since_tizen> 6 </since_tizen>
/// 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 RectangleSelector Clone()
+ public new RectangleSelector Clone()
{
- RectangleSelector selector = new RectangleSelector();
- selector.Clone(this);
- return selector;
+ return (RectangleSelector)base.Clone();
}
}
/// <since_tizen> 6 </since_tizen>
/// 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 HorizontalAlignmentSelector Clone()
+ public new HorizontalAlignmentSelector Clone()
{
- HorizontalAlignmentSelector selector = new HorizontalAlignmentSelector();
- selector.Clone(this);
- return selector;
+ return (HorizontalAlignmentSelector)base.Clone();
}
}
/// <summary>
/// <since_tizen> 6 </since_tizen>
/// 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 VerticalAlignmentSelector Clone()
+ public new VerticalAlignmentSelector Clone()
{
- VerticalAlignmentSelector selector = new VerticalAlignmentSelector();
- selector.Clone(this);
- return selector;
+ return (VerticalAlignmentSelector)base.Clone();
}
}
/// <since_tizen> 6 </since_tizen>
/// 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 AutoScrollStopModeSelector Clone()
+ public new AutoScrollStopModeSelector Clone()
{
- AutoScrollStopModeSelector selector = new AutoScrollStopModeSelector();
- selector.Clone(this);
- return selector;
+ return (AutoScrollStopModeSelector)base.Clone();
}
}
/// <since_tizen> 6 </since_tizen>
/// 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 ResizePolicyTypeSelector Clone()
+ public new ResizePolicyTypeSelector Clone()
{
- ResizePolicyTypeSelector selector = new ResizePolicyTypeSelector();
- selector.Clone(this);
- return selector;
+ return (ResizePolicyTypeSelector)base.Clone();
}
}
public static readonly BindableProperty ThicknessProperty = BindableProperty.Create(nameof(Thickness), typeof(float), typeof(CircularProgress), default(float), propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = ((CircularProgress)bindable);
-
- // TODO Set viewStyle.Thickness after style refactoring done.
-
instance.UpdateVisualThickness((float)newValue);
},
defaultValueCreator: (bindable) =>
{
- return ((CircularProgress)bindable).Style.Thickness;
+ var instance = (CircularProgress)bindable;
+ return instance.trackVisual == null ? 0 : instance.trackVisual.Thickness;
});
/// <summary>Bindable property of MaxValue</summary>
public static readonly BindableProperty TrackColorProperty = BindableProperty.Create(nameof(TrackColor), typeof(Color), typeof(CircularProgress), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (CircularProgress)bindable;
-
- // TODO : Set viewStyle.TrackColor after style refactoring done.
-
instance.UpdateTrackVisualColor((Color)newValue);
},
defaultValueCreator: (bindable) =>
{
- return ((CircularProgress)bindable).Style.TrackColor;
+ return ((CircularProgress)bindable).trackVisual?.MixColor;
});
/// <summary>Bindable property of ProgressColor</summary>
public static readonly BindableProperty ProgressColorProperty = BindableProperty.Create(nameof(ProgressColor), typeof(Color), typeof(CircularProgress), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (CircularProgress)bindable;
-
- // TODO : Set viewStyle.ProgressColor after style refactoring done.
-
instance.UpdateProgressVisualColor((Color)newValue);
},
defaultValueCreator: (bindable) =>
{
- return ((CircularProgress)bindable).Style.ProgressColor;
+ return ((CircularProgress)bindable).progressVisual?.MixColor;
});
/// <summary>Bindable property of IsEnabled</summary>
/// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
- public new CircularProgressStyle Style => ViewStyle as CircularProgressStyle;
+ public new CircularProgressStyle Style
+ {
+ get
+ {
+ var result = new CircularProgressStyle(ViewStyle as CircularProgressStyle);
+ result.CopyPropertiesFromView(this);
+ return result;
+ }
+ }
/// <summary>
/// The thickness of the track and progress.
public static readonly BindableProperty ThicknessProperty = BindableProperty.Create(nameof(Thickness), typeof(float), typeof(CircularScrollbar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = ((CircularScrollbar)bindable);
- var thickness = (float?)newValue;
-
- instance.Style.Thickness = thickness;
- instance.UpdateVisualThickness(thickness ?? 0);
+ instance.UpdateVisualThickness((float?)newValue ?? 0);
},
defaultValueCreator: (bindable) =>
{
- return ((CircularScrollbar)bindable).Style.Thickness ?? 0;
+ var instance = (CircularScrollbar)bindable;
+ return instance.trackVisual == null ? 0 : instance.trackVisual.Thickness;
});
/// <summary>Bindable property of TrackSweepAngle</summary>
public static readonly BindableProperty TrackSweepAngleProperty = BindableProperty.Create(nameof(TrackSweepAngle), typeof(float), typeof(CircularScrollbar), default(float), propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = ((CircularScrollbar)bindable);
- var angle = (float?)newValue;
-
- instance.Style.TrackSweepAngle = angle;
- instance.UpdateTrackVisualSweepAngle(angle ?? 0);
+ instance.UpdateTrackVisualSweepAngle((float?)newValue ?? 0);
},
defaultValueCreator: (bindable) =>
{
- return ((CircularScrollbar)bindable).Style.TrackSweepAngle ?? 0;
+ var instance = (CircularScrollbar)bindable;
+ return instance.trackVisual == null ? 0 : instance.trackVisual.SweepAngle;
});
/// <summary>Bindable property of TrackColor</summary>
public static readonly BindableProperty TrackColorProperty = BindableProperty.Create(nameof(TrackColor), typeof(Color), typeof(CircularScrollbar), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = ((CircularScrollbar)bindable);
- var color = (Color)newValue;
-
- instance.Style.TrackColor = color;
- instance.UpdateTrackVisualColor(color);
+ instance.UpdateTrackVisualColor((Color)newValue);
},
defaultValueCreator: (bindable) =>
{
- return ((CircularScrollbar)bindable).Style.TrackColor;
+ return ((CircularScrollbar)bindable).trackVisual?.MixColor;
});
/// <summary>Bindable property of ThumbColor</summary>
public static readonly BindableProperty ThumbColorProperty = BindableProperty.Create(nameof(ThumbColor), typeof(Color), typeof(CircularScrollbar), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = ((CircularScrollbar)bindable);
- var color = (Color)newValue;
-
- instance.Style.ThumbColor = color;
- instance.UpdateThumbVisualColor(color);
+ instance.UpdateThumbVisualColor((Color)newValue);
},
defaultValueCreator: (bindable) =>
{
- return ((CircularScrollbar)bindable).Style.ThumbColor;
+ return ((CircularScrollbar)bindable).thumbVisual?.MixColor;
});
private ArcVisual trackVisual;
/// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
- public new CircularScrollbarStyle Style => ViewStyle as CircularScrollbarStyle;
+ public new CircularScrollbarStyle Style
+ {
+ get
+ {
+ var result = new CircularScrollbarStyle(ViewStyle as CircularScrollbarStyle);
+ result.CopyPropertiesFromView(this);
+ return result;
+ }
+ }
/// <summary>
/// The thickness of the scrollbar and track.
public static readonly BindableProperty ThicknessProperty = BindableProperty.Create(nameof(Thickness), typeof(float), typeof(CircularSlider), default(float), propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = ((CircularSlider)bindable);
-
- // TODO Set viewStyle.Thickness after style refactoring done.
-
instance.UpdateVisualThickness((float)newValue);
},
defaultValueCreator: (bindable) =>
{
- return ((CircularSlider)bindable).Style.Thickness;
+ var instance = (CircularSlider)bindable;
+ return instance.trackVisual == null ? 0 : instance.trackVisual.Thickness;
});
/// <summary>Bindable property of MaxValue</summary>
public static readonly BindableProperty TrackColorProperty = BindableProperty.Create(nameof(TrackColor), typeof(Color), typeof(CircularSlider), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (CircularSlider)bindable;
-
- // TODO : Set viewStyle.TrackColor after style refactoring done.
-
instance.UpdateTrackVisualColor((Color)newValue);
},
defaultValueCreator: (bindable) =>
{
- return ((CircularSlider)bindable).Style.TrackColor;
+ return ((CircularSlider)bindable).trackVisual?.MixColor;
});
/// <summary>Bindable property of ProgressColor</summary>
public static readonly BindableProperty ProgressColorProperty = BindableProperty.Create(nameof(ProgressColor), typeof(Color), typeof(CircularSlider), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (CircularSlider)bindable;
-
- // TODO : Set viewStyle.ProgressColor after style refactoring done.
-
instance.UpdateProgressVisualColor((Color)newValue);
},
defaultValueCreator: (bindable) =>
{
- return ((CircularSlider)bindable).Style.ProgressColor;
+ return ((CircularSlider)bindable).progressVisual?.MixColor;
});
/// <summary>Bindable property of ThumbSize</summary>
public static readonly BindableProperty ThumbColorProperty = BindableProperty.Create(nameof(ThumbColor), typeof(Color), typeof(CircularSlider), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (CircularSlider)bindable;
-
- // TODO : Set viewStyle.ThumbColor after style refactoring done.
-
instance.UpdateThumbVisualColor((Color)newValue);
},
defaultValueCreator: (bindable) =>
{
- return ((CircularSlider)bindable).Style.ThumbColor;
+ return ((CircularSlider)bindable).thumbVisual?.MixColor;
});
/// <summary>Bindable property of IsEnabled</summary>
/// Style setting is possible by using constructor or the function of ApplyStyle(ViewStyle viewStyle)
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
- public new CircularSliderStyle Style => ViewStyle as CircularSliderStyle;
+ public new CircularSliderStyle Style
+ {
+ get
+ {
+ var result = new CircularSliderStyle(ViewStyle as CircularSliderStyle);
+ result.CopyPropertiesFromView(this);
+ return result;
+ }
+ }
/// <summary>
/// The thickness of the track and progress.
leftButton.PositionUsesPivotPoint = true;
leftButton.ParentOrigin = NUI.ParentOrigin.CenterLeft;
leftButton.PivotPoint = NUI.PivotPoint.CenterLeft;
- leftButton.Style.Overlay.SiblingOrder = 100;
+ leftButton.OverlayImage.SiblingOrder = 100;
button.PositionUsesPivotPoint = true;
button.ParentOrigin = NUI.ParentOrigin.CenterRight;
button.PivotPoint = NUI.PivotPoint.CenterRight;
- button.Style.Overlay.SiblingOrder = 100;
+ button.OverlayImage.SiblingOrder = 100;
}
}
else
buttonList.Add(index, button);
Add(button);
button.RaiseToTop();
- button.Style.Overlay.SiblingOrder = 100; //will be fixed.
+ button.OverlayImage.SiblingOrder = 100; //will be fixed.
if (position == ButtonPosition.Left)
{
button.PositionUsesPivotPoint = true;
Initialize();
}
- public TextLabelStyle Style => ViewStyle as TextLabelStyle;
+ /// <summary>
+ /// Return a copied Style instance of the Title.
+ /// </summary>
+ /// <remarks>
+ /// It returns copied style instance so that changing it does not effect to the view.
+ /// Style setting is possible by using constructor or the function of <see cref="View.ApplyStyle"/>.
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public new TextLabelStyle Style => ViewStyle as TextLabelStyle;
+
/// <summary>
/// The constructor of the Title class with specific Style.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly BindableProperty BorderProperty = BindableProperty.Create("Border", typeof(Rectangle), typeof(ImageView), null, propertyChanged: (bindable, oldValue, newValue) =>
{
+ var imageView = (ImageView)bindable;
if(newValue != null)
{
- var imageView = (ImageView)bindable;
imageView._border = (Rectangle)newValue;
imageView.UpdateImage(NpatchImageVisualProperty.Border, new PropertyValue(imageView._border));
}
return ret;
});
+ internal static readonly BindableProperty ResourceUrlSelectorProperty = BindableProperty.Create("ResourceUrlSelector", typeof(Selector<string>), typeof(ImageView), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var imageView = (ImageView)bindable;
+ imageView.resourceUrlSelector.Update(imageView, (Selector<string>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var imageView = (ImageView)bindable;
+ return imageView.resourceUrlSelector.Get(imageView);
+ });
+
+ internal static readonly BindableProperty BorderSelectorProperty = BindableProperty.Create("BorderSelector", typeof(Selector<Rectangle>), typeof(ImageView), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var imageView = (ImageView)bindable;
+ imageView.borderSelector.Update(imageView, (Selector<Rectangle>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var imageView = (ImageView)bindable;
+ return imageView.borderSelector.Get(imageView);
+ });
+
private EventHandler<ResourceReadyEventArgs> _resourceReadyEventHandler;
private ResourceReadyEventCallbackType _resourceReadyEventCallback;
private EventHandler<ResourceLoadedEventArgs> _resourceLoadedEventHandler;
private string _alphaMaskUrl = null;
private int _desired_width = -1;
private int _desired_height = -1;
+ private readonly TriggerableSelector<string> resourceUrlSelector = new TriggerableSelector<string>(ResourceUrlProperty);
+ private readonly TriggerableSelector<Rectangle> borderSelector = new TriggerableSelector<Rectangle>(BorderProperty);
/// 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 ImageViewStyle Style => ViewStyle as ImageViewStyle;
+ public new ImageViewStyle Style => new ImageViewStyle(this);
/// <summary>
/// Creates an initialized ImageView.
set
{
SetValue(ResourceUrlProperty, value);
+ resourceUrlSelector.UpdateIfNeeds(this, value);
NotifyPropertyChanged();
}
}
set
{
SetValue(BorderProperty, value);
+ borderSelector.UpdateIfNeeds(this, value);
NotifyPropertyChanged();
}
}
return ret;
}
- internal override void UpdateCornerRadius(float value, bool needToListenStateChanged)
+ internal override void UpdateCornerRadius(float value)
{
- base.UpdateCornerRadius(value, needToListenStateChanged);
+ base.UpdateCornerRadius(value);
UpdateImage(0, null);
}
return (ResourceLoadingStatusType)Interop.View.View_GetVisualResourceStatus(this.swigCPtr, Property.IMAGE);
}
- internal static readonly BindableProperty ResourceUrlSelectorProperty = BindableProperty.Create("ResourceUrlSelector", typeof(Selector<string>), typeof(ImageView), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var imageView = (ImageView)bindable;
- imageView.resourceUrlSelector.Clone((Selector<string>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var imageView = (ImageView)bindable;
- return imageView.resourceUrlSelector;
- });
- private TriggerableSelector<string> _resourceUrlSelector;
- private TriggerableSelector<string> resourceUrlSelector
- {
- get
- {
- if (null == _resourceUrlSelector)
- {
- _resourceUrlSelector = new TriggerableSelector<string>(this, ResourceUrlProperty);
- }
- return _resourceUrlSelector;
- }
- }
-
- internal static readonly BindableProperty BorderSelectorProperty = BindableProperty.Create("BorderSelector", typeof(Selector<Rectangle>), typeof(ImageView), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var imageView = (ImageView)bindable;
- imageView.borderSelector.Clone((Selector<Rectangle>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var imageView = (ImageView)bindable;
- return imageView.borderSelector;
- });
- private TriggerableSelector<Rectangle> _borderSelector;
- private TriggerableSelector<Rectangle> borderSelector
- {
- get
- {
- if (null == _borderSelector)
- {
- _borderSelector = new TriggerableSelector<Rectangle>(this, BorderProperty);
- }
- return _borderSelector;
- }
- }
-
/// <summary>
/// you can override it to clean-up your own resources.
/// </summary>
//You should release all of your own disposable objects here.
_border?.Dispose();
_border = null;
+ borderSelector.Reset(this);
+ resourceUrlSelector.Reset(this);
}
base.Dispose(type);
public static readonly BindableProperty ResourceUrlSelectorProperty = BindableProperty.Create("ResourceUrlSelector", typeof(Selector<string>), typeof(ImageViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var imageViewStyle = (ImageViewStyle)bindable;
- if (null == imageViewStyle.resourceUrlSelector) imageViewStyle.resourceUrlSelector = new Selector<string>();
- imageViewStyle.resourceUrlSelector.Clone(null == newValue ? new Selector<string>() : (Selector<string>)newValue);
+ imageViewStyle.resourceUrlSelector = ((Selector<string>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
public static readonly BindableProperty BorderSelectorProperty = BindableProperty.Create("BorderSelector", typeof(Selector<Rectangle>), typeof(ImageViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var imageViewStyle = (ImageViewStyle)bindable;
- if (null == imageViewStyle.borderSelector) imageViewStyle.borderSelector = new Selector<Rectangle>();
- imageViewStyle.borderSelector.Clone(null == newValue ? new Selector<Rectangle>() : (Selector<Rectangle>)newValue);
+ imageViewStyle.borderSelector = ((Selector<Rectangle>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
static ImageViewStyle() { }
+ /// <summary>
+ /// Create an empty instance.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ImageViewStyle()
+ {
+ }
+
+ /// <summary>
+ /// Create an instance and set properties from the given ImageView.
+ /// </summary>
+ /// <param name="imageView">The ImageView instance that includes property data.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ImageViewStyle(ImageView imageView) : base(imageView)
+ {
+ }
+
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public bool? PreMultipliedAlpha
[EditorBrowsable(EditorBrowsableState.Never)]
public class Selector<T> : StateValueCollection<T>
{
+ private readonly bool cloneable = typeof(T).IsAssignableFrom(typeof(ICloneable));
+
/// <since_tizen> 6 </since_tizen>
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
public static implicit operator Selector<T>(T value)
{
- Selector<T> selector = new Selector<T>();
- selector.All = value;
- return selector;
+ return new Selector<T>(value);
}
/// Default Contructor
[EditorBrowsable(EditorBrowsableState.Never)]
public Selector(T value) : this()
{
- All = value;
+ All = cloneable ? (T)((ICloneable)value)?.Clone() : value;
+ }
+
+ /// Copy constructor
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Selector(Selector<T> value) : this()
+ {
+ Clone(value);
}
+
/// <summary>
/// All State.
/// </summary>
/// </summary>
/// <since_tizen> 6 </since_tizen>
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ /// <returns>True if the selector has a given state value, false otherwise.</returns>
[EditorBrowsable(EditorBrowsableState.Never)]
- public T GetValue(ControlState state)
+ public bool GetValue(ControlState state, out T result)
{
if (All != null)
{
- return All;
+ result = All;
+
+ return true;
}
- StateValuePair<T> value = Find(x => x.State == state);
- if (value.Value != null)
+ result = default;
+
+ int index = StateValueList.FindIndex(x => x.State == state);
+ if (index >= 0)
{
- return value.Value;
+ result = StateValueList[index].Value;
+ return true;
}
if (state.IsCombined)
{
- value = Find(x => state.Contains(x.State));
- if (value.Value != null)
+ index = StateValueList.FindIndex(x => state.Contains(x.State));
+ if (index >= 0)
{
- return value.Value;
+ result = StateValueList[index].Value;
+ return true;
}
}
- return Other;
+ index = StateValueList.FindIndex(x => x.State == ControlState.Other);
+ if (index >= 0)
+ {
+ result = StateValueList[index].Value;
+ return true;
+ }
+
+ return false;
}
- /// <summary>
- /// Clone function.
- /// </summary>
- /// <since_tizen> 6 </since_tizen>
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ /// <inheritdoc/>
[EditorBrowsable(EditorBrowsableState.Never)]
- public void Clone(Selector<T> selector)
+ public override void Clear()
{
- All = selector.All;
- Normal = selector.Normal;
- Focused = selector.Focused;
- Pressed = selector.Pressed;
- Disabled = selector.Disabled;
- Selected = selector.Selected;
- DisabledSelected = selector.DisabledSelected;
- DisabledFocused = selector.DisabledFocused;
- SelectedFocused = selector.SelectedFocused;
- Other = selector.Other;
+ All = default;
+ base.Clear();
}
- internal void Clone<U>(Selector<U> other) where U : T, Tizen.NUI.Internal.ICloneable
+ /// <inheritdoc/>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override string ToString()
{
- // TODO Apply constraint to the Selector (not to Clone method)
-
- All = (T)(other.All)?.Clone();
- Normal = (T)(other.Normal)?.Clone();
- Focused = (T)(other.Focused)?.Clone();
- Pressed = (T)(other.Pressed)?.Clone();
- Disabled = (T)(other.Disabled)?.Clone();
- Selected = (T)(other.Selected)?.Clone();
- DisabledSelected = (T)(other.DisabledSelected)?.Clone();
- DisabledFocused = (T)(other.DisabledFocused)?.Clone();
- SelectedFocused = (T)(other.SelectedFocused)?.Clone();
- Other = (T)(other.Other)?.Clone();
- }
+ string result = $"[All, {All}]";
- internal bool HasMultiValue()
- {
- return All == null;
- }
- }
+ foreach (var item in StateValueList)
+ {
+ result += $", {item}";
+ }
- /// 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 class TriggerableSelector<T> : Selector<T>
- {
- public TriggerableSelector(View view, BindableProperty bindableProperty)
- {
- targetView = view;
- targetBindableProperty = bindableProperty;
- view.ControlStateChangeEventInternal += OnViewControlState;
+ return result;
}
/// <summary>
- /// Clone function.
+ /// Clone itself.
+ /// If type T implements ICloneable, it calls Clone() method to clone values, otherwise use operator=.
/// </summary>
/// <since_tizen> 6 </since_tizen>
/// 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 new void Clone(Selector<T> selector)
+ public Selector<T> Clone()
{
- base.Clone(selector);
-
- if (null != targetView && null != GetValue(targetView.ControlState))
- {
- targetView.SetValue(targetBindableProperty, GetValue(targetView.ControlState));
- }
+ var cloned = new Selector<T>();
+ cloned.Clone(this);
+ return cloned;
}
- private void OnViewControlState(object obj, View.ControlStateChangedEventArgs controlStateChangedInfo)
+ /// <summary>
+ /// Copy values from other selector.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Clone(Selector<T> other)
{
- View view = obj as View;
- if (null != view && null != GetValue(controlStateChangedInfo.CurrentState))
+ Clear();
+
+ if (cloneable)
{
- view.SetValue(targetBindableProperty, GetValue(controlStateChangedInfo.CurrentState));
+ All = (T)((ICloneable)other.All)?.Clone();
+ foreach (var item in other.StateValueList)
+ {
+ AddWithoutCheck(new StateValuePair<T>(item.State, (T)((ICloneable)item.Value)?.Clone()));
+ }
+ }
+ else
+ {
+ All = other.All;
+ foreach (var item in other.StateValueList)
+ {
+ AddWithoutCheck(item);
+ }
}
}
- private View targetView;
- private BindableProperty targetBindableProperty;
+ internal bool HasMultiValue()
+ {
+ return StateValueList.Count > 1;
+ }
}
/// <summary>
- /// A class that helps binding a non-selector property in View to selector property in ViewStyle.
+ /// This will be attached to a View to detect ControlState change.
/// </summary>
- internal class ViewSelector<T>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class TriggerableSelector<T>
{
- protected Selector<T> selector;
- protected View view;
- protected EventHandler<View.ControlStateChangedEventArgs> controlStateChanged;
+ /// <summary>
+ /// Create an TriggerableSelector.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public delegate T ValueGetter(View view);
- internal ViewSelector(View view, EventHandler<View.ControlStateChangedEventArgs> controlStateChanged)
- {
- if (view == null || controlStateChanged == null)
- {
- throw new global::System.ArgumentNullException();
- }
- this.view = view;
- this.controlStateChanged = controlStateChanged;
- this.selector = null;
- }
+ private readonly BindableProperty targetBindableProperty;
+ private readonly ValueGetter propertyGetter;
+ private bool dirty = true;
+ private Selector<T> selector;
- internal T GetValue()
+ /// <summary>
+ /// Create an TriggerableSelector.
+ /// </summary>
+ /// <param name="targetBindableProperty">The TriggerableSelector will change this bindable property value when the view's ControlState has changed.</param>
+ /// <param name="propertyGetter">It is optional value in case the target bindable property getter is not proper to use.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TriggerableSelector(BindableProperty targetBindableProperty, ValueGetter propertyGetter = null)
{
- return selector == null ? default(T) : selector.GetValue(view.ControlState);
+ this.targetBindableProperty = targetBindableProperty;
+ this.propertyGetter = propertyGetter;
}
- internal void Set(object value)
+ /// <summary>
+ /// Return the containing selector. It can be null.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Selector<T> Get(View view)
{
- bool hadMultiValue = HasMultiValue();
- var type = value?.GetType();
+ if (!dirty) return selector;
- if (type == typeof(T))
- {
- CopyValueToSelector((T)value);
- }
- else if (type == typeof(Selector<T>))
- {
- CopySelectorToSelector((Selector<T>)value);
- }
- else if (type == Nullable.GetUnderlyingType(typeof(T)))
+ T value = default;
+
+ if (propertyGetter != null)
{
- CopyValueToSelector((T)value);
+ value = propertyGetter(view);
}
else
{
- selector = null;
+ value = (T)view.GetValue(targetBindableProperty);
}
- if (hadMultiValue != HasMultiValue())
- {
- if (hadMultiValue) view.ControlStateChangeEventInternal -= controlStateChanged;
- else view.ControlStateChangeEventInternal += controlStateChanged;
- }
- }
+ Selector<T> converted = value == null ? null : new Selector<T>(value);
+ Update(view, converted);
- protected virtual void CopyValueToSelector(T value)
- {
- selector = new Selector<T>();
- selector.All = value;
+ return selector;
}
- protected virtual void CopySelectorToSelector(Selector<T> value)
+ /// <summary>
+ /// Update containing selector from the other selector.
+ /// </summary>
+ /// <param name="view">The View that is affected by this TriggerableSelector.</param>
+ /// <param name="otherSelector">The copy target.</param>
+ /// <param name="updateView">Whether it updates the target view after update the selector or not.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Update(View view, Selector<T> otherSelector, bool updateView = false)
{
- selector = new Selector<T>();
- selector.Clone(value);
- }
+ Reset(view);
- internal void Clear()
- {
- if (HasMultiValue())
+ if (otherSelector == null)
{
- view.ControlStateChangeEventInternal -= controlStateChanged;
+ return;
}
- selector = null;
- }
-
- internal bool IsEmpty()
- {
- return selector == null;
- }
- protected bool HasMultiValue()
- {
- return (selector != null && selector.All == null);
- }
- }
-
- /// <summary>
- /// ViewSelector class for ICloneable type
- /// </summary>
- internal class CloneableViewSelector<T> : ViewSelector<T> where T : Tizen.NUI.Internal.ICloneable
- {
- internal CloneableViewSelector(View view, EventHandler<View.ControlStateChangedEventArgs> controlStateChanged) : base(view, controlStateChanged)
- {
- }
+ selector = otherSelector.Clone();
- protected override void CopyValueToSelector(T value)
- {
- selector = new Selector<T>();
- selector.All = (T)((T)value).Clone();
- }
+ if (otherSelector.HasMultiValue())
+ {
+ view.ControlStateChangeEventInternal += OnViewControlState;
+ }
- protected override void CopySelectorToSelector(Selector<T> value)
- {
- selector = new Selector<T>();
- selector.Clone<T>((Selector<T>)value);
+ if (updateView && otherSelector.GetValue(view.ControlState, out var value))
+ {
+ view.SetValue(targetBindableProperty, value);
+ }
}
- }
- internal static class SelectorHelper
- {
/// <summary>
- /// For the object type of T or Selector T, convert it to Selector T and return the cloned one.
- /// Otherwise, return null. <br/>
+ /// Update containing selector value from a single value.
+ /// Note that, it updates lazily if possible.
+ /// If you need to udpate directly, please use <seealso cref="Update" />.
/// </summary>
- static internal Selector<T> CopyCloneable<T>(object value) where T : class, Tizen.NUI.Internal.ICloneable
+ /// <param name="view">The View that is affected by this TriggerableSelector.</param>
+ /// <param name="value">The copy target.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void UpdateIfNeeds(View view, T value)
{
- if (null != value)
+ if (selector != null && selector.HasMultiValue())
{
- var type = value.GetType();
-
- if (type == typeof(Selector<T>))
- {
- var result = new Selector<T>();
- result.Clone<T>((Selector<T>)value);
- return result;
- }
-
- if (type == typeof(T))
- {
- return new Selector<T>((T)((T)value).Clone());
- }
+ Selector<T> converted = value == null ? null : new Selector<T>(value);
+ Update(view, converted);
+ return;
}
- return null;
+ dirty = true;
}
/// <summary>
- /// For the value type of T or Selector T, convert it to Selector T and return the cloned one.
- /// Otherwise, return null. <br/>
+ /// Reset selector and listeners.
/// </summary>
- static internal Selector<T> CopyValue<T>(object value)
+ /// <param name="view">The View that is affected by this TriggerableSelector.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Reset(View view)
{
- if (null != value)
- {
- var type = value.GetType();
-
- if (type == typeof(Selector<T>))
- {
- var result = new Selector<T>();
- result.Clone((Selector<T>)value);
- return result;
- }
+ view.ControlStateChangeEventInternal -= OnViewControlState;
+ selector?.Clear();
+ selector = null;
+ dirty = false;
+ }
- if (type == typeof(T))
- {
- return new Selector<T>((T)value);
- }
+ private void OnViewControlState(object obj, View.ControlStateChangedEventArgs controlStateChangedInfo)
+ {
+ View view = obj as View;
+ if (null != view && selector.GetValue(controlStateChangedInfo.CurrentState, out var value))
+ {
+ view.SetValue(targetBindableProperty, value);
}
-
- return null;
}
}
}
/// <inheritdoc/>
[EditorBrowsable(EditorBrowsableState.Never)]
- public void Clear() => StateValueList.Clear();
+ public virtual void Clear() => StateValueList.Clear();
/// <inheritdoc/>
[EditorBrowsable(EditorBrowsableState.Never)]
/// <returns>The first element that matches the conditions defined by the specified predicate,
/// if found; otherwise, the default value for type <see cref="StateValuePair{T}"/>.</returns>
public StateValuePair<T> Find(Predicate<StateValuePair<T>> match) => StateValueList.Find(match);
+
+ /// <summary>
+ /// Add a <see cref="StateValuePair{T}"/> without duplication check.
+ /// </summary>
+ /// <param name="item">The StateValuePair item to add.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ internal void AddWithoutCheck(StateValuePair<T> item) => StateValueList.Add(item);
}
}
\ No newline at end of file
public static readonly BindableProperty TranslatableTextSelectorProperty = BindableProperty.Create("TranslatableTextSelector", typeof(Selector<string>), typeof(TextFieldStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var textFieldStyle = (TextFieldStyle)bindable;
- if (null == textFieldStyle.translatableTextSelector)
- {
- textFieldStyle.translatableTextSelector = new Selector<string>();
- }
- textFieldStyle.translatableTextSelector.Clone(null == newValue ? new Selector<string>() : (Selector<string>)newValue);
+ textFieldStyle.translatableTextSelector = ((Selector<string>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
public static readonly BindableProperty TranslatablePlaceholderTextSelectorProperty = BindableProperty.Create("TranslatablePlaceholderTextSelector", typeof(Selector<string>), typeof(TextFieldStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var textFieldStyle = (TextFieldStyle)bindable;
- if (null == textFieldStyle.translatablePlaceholderTextSelector)
- {
- textFieldStyle.translatablePlaceholderTextSelector = new Selector<string>();
- }
- textFieldStyle.translatablePlaceholderTextSelector.Clone(null == newValue ? new Selector<string>() : (Selector<string>)newValue);
+ textFieldStyle.translatablePlaceholderTextSelector = ((Selector<string>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
public static readonly BindableProperty TextSelectorProperty = BindableProperty.Create(nameof(Text), typeof(Selector<string>), typeof(TextFieldStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var textFieldStyle = (TextFieldStyle)bindable;
- if (null == textFieldStyle.textSelector)
- {
- textFieldStyle.textSelector = new Selector<string>();
- }
- textFieldStyle.textSelector.Clone(null == newValue ? new Selector<string>() : (Selector<string>)newValue);
+ textFieldStyle.textSelector = ((Selector<string>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
public static readonly BindableProperty FontFamilySelectorProperty = BindableProperty.Create("FontFamilySelector", typeof(Selector<string>), typeof(TextFieldStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var textFieldStyle = (TextFieldStyle)bindable;
- if (null == textFieldStyle.fontFamilySelector)
- {
- textFieldStyle.fontFamilySelector = new Selector<string>();
- }
- textFieldStyle.fontFamilySelector.Clone(null == newValue ? new Selector<string>() : (Selector<string>)newValue);
+ textFieldStyle.fontFamilySelector = ((Selector<string>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
public static readonly BindableProperty PointSizeSelectorProperty = BindableProperty.Create("PointSizeSelector", typeof(Selector<float?>), typeof(TextFieldStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var textFieldStyle = (TextFieldStyle)bindable;
- if (null == textFieldStyle.pointSizeSelector)
- {
- textFieldStyle.pointSizeSelector = new Selector<float?>();
- }
- textFieldStyle.pointSizeSelector.Clone(null == newValue ? new Selector<float?>() : (Selector<float?>)newValue);
+ textFieldStyle.pointSizeSelector = ((Selector<float?>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
public static readonly BindableProperty TextColorSelectorProperty = BindableProperty.Create("TextColorSelector", typeof(Selector<Color>), typeof(TextFieldStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var textFieldStyle = (TextFieldStyle)bindable;
- if (null == textFieldStyle.textColorSelector)
- {
- textFieldStyle.textColorSelector = new Selector<Color>();
- }
- textFieldStyle.textColorSelector.Clone(null == newValue ? new Selector<Color>() : (Selector<Color>)newValue);
+ textFieldStyle.textColorSelector = ((Selector<Color>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
public static readonly BindableProperty PlaceholderTextColorSelectorProperty = BindableProperty.Create("PlaceholderTextColorSelector", typeof(Selector<Vector4>), typeof(TextFieldStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var textFieldStyle = (TextFieldStyle)bindable;
- if (null == textFieldStyle.placeholderTextColorSelector)
- {
- textFieldStyle.placeholderTextColorSelector = new Selector<Vector4>();
- }
- textFieldStyle.placeholderTextColorSelector.Clone(null == newValue ? new Selector<Vector4>() : (Selector<Vector4>)newValue);
+ textFieldStyle.placeholderTextColorSelector = ((Selector<Vector4>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
public static readonly BindableProperty PrimaryCursorColorSelectorProperty = BindableProperty.Create("PrimaryCursorColorSelector", typeof(Selector<Vector4>), typeof(TextFieldStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var textFieldStyle = (TextFieldStyle)bindable;
- if (null == textFieldStyle.primaryCursorColorSelector)
- {
- textFieldStyle.primaryCursorColorSelector = new Selector<Vector4>();
- }
- textFieldStyle.primaryCursorColorSelector.Clone(null == newValue ? new Selector<Vector4>() : (Selector<Vector4>)newValue);
+ textFieldStyle.primaryCursorColorSelector = ((Selector<Vector4>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
static TextFieldStyle() { }
+ /// <summary>
+ /// Create an empty instance.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TextFieldStyle()
+ {
+ }
+
+ /// <summary>
+ /// Create an instance and set properties from the given TextField.
+ /// </summary>
+ /// <param name="textField">The TextField instance that includes property data.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TextFieldStyle(TextField textField) : base(textField)
+ {
+ }
+
/// 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 Selector<string> TranslatableText
[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly BindableProperty TranslatableTextSelectorProperty = BindableProperty.Create("TranslatableTextSelector", typeof(Selector<string>), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
- var textFieldStyle = (TextLabelStyle)bindable;
- if (null == textFieldStyle.translatableTextSelector) textFieldStyle.translatableTextSelector = new Selector<string>();
- textFieldStyle.translatableTextSelector.Clone(null == newValue ? new Selector<string>() : (Selector<string>)newValue);
+ ((TextLabelStyle)bindable).translatableTextSelector = ((Selector<string>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
- var textFieldStyle = (TextLabelStyle)bindable;
- return textFieldStyle.translatableTextSelector;
+ return ((TextLabelStyle)bindable).translatableTextSelector;
});
/// 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 static readonly BindableProperty TextSelectorProperty = BindableProperty.Create("TextSelector", typeof(Selector<string>), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
- var textFieldStyle = (TextLabelStyle)bindable;
- if (null == textFieldStyle.textSelector) textFieldStyle.textSelector = new Selector<string>();
- textFieldStyle.textSelector.Clone(null == newValue ? new Selector<string>() : (Selector<string>)newValue);
+ ((TextLabelStyle)bindable).textSelector = ((Selector<string>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
- var textFieldStyle = (TextLabelStyle)bindable;
- return textFieldStyle.textSelector;
+ return ((TextLabelStyle)bindable).textSelector;
});
/// 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 static readonly BindableProperty FontFamilySelectorProperty = BindableProperty.Create("FontFamilySelector", typeof(Selector<string>), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
- var textFieldStyle = (TextLabelStyle)bindable;
- if (null == textFieldStyle.fontFamilySelector) textFieldStyle.fontFamilySelector = new Selector<string>();
- textFieldStyle.fontFamilySelector.Clone(null == newValue ? new Selector<string>() : (Selector<string>)newValue);
+ ((TextLabelStyle)bindable).fontFamilySelector = ((Selector<string>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
- var textFieldStyle = (TextLabelStyle)bindable;
- return textFieldStyle.fontFamilySelector;
+ return ((TextLabelStyle)bindable).fontFamilySelector;
});
/// 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 static readonly BindableProperty PointSizeSelectorProperty = BindableProperty.Create("PointSizeSelector", typeof(Selector<float?>), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
- var textFieldStyle = (TextLabelStyle)bindable;
- if (null == textFieldStyle.pointSizeSelector) textFieldStyle.pointSizeSelector = new Selector<float?>();
- textFieldStyle.pointSizeSelector.Clone(null == newValue ? new Selector<float?>() : (Selector<float?>)newValue);
+ ((TextLabelStyle)bindable).pointSizeSelector = ((Selector<float?>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
- var textFieldStyle = (TextLabelStyle)bindable;
- return textFieldStyle.pointSizeSelector;
+ return ((TextLabelStyle)bindable).pointSizeSelector;
});
/// 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 static readonly BindableProperty TextColorSelectorProperty = BindableProperty.Create("TextColorSelector", typeof(Selector<Color>), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
- var textFieldStyle = (TextLabelStyle)bindable;
- if (null == textFieldStyle.textColorSelector) textFieldStyle.textColorSelector = new Selector<Color>();
- textFieldStyle.textColorSelector.Clone(null == newValue ? new Selector<Color>() : (Selector<Color>)newValue);
+ ((TextLabelStyle)bindable).textColorSelector = ((Selector<Color>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
- var textFieldStyle = (TextLabelStyle)bindable;
- return textFieldStyle.textColorSelector;
+ return ((TextLabelStyle)bindable).textColorSelector;
});
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
});
/// A BindableProperty for ImageShadow
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty TextShadowProperty = BindableProperty.Create(nameof(TextShadow), typeof(Selector<TextShadow>), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty TextShadowProperty = BindableProperty.Create("TextShadowSelector", typeof(Selector<TextShadow>), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
- var textLabelStyle = (TextLabelStyle)bindable;
- textLabelStyle.textShadow = SelectorHelper.CopyCloneable<TextShadow>(newValue);
+ ((TextLabelStyle)bindable).textShadow = ((Selector<TextShadow>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
- var textLabelStyle = (TextLabelStyle)bindable;
- return textLabelStyle.textShadow;
+ return ((TextLabelStyle)bindable).textShadow;
});
private bool? multiLine;
static TextLabelStyle() { }
+ /// <summary>
+ /// Create an empty instance.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TextLabelStyle()
+ {
+ }
+
+ /// <summary>
+ /// Create an instance and set properties from the given TextLabel.
+ /// </summary>
+ /// <param name="textLabel">The TextLabel instance that includes property data.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TextLabelStyle(TextLabel textLabel) : base(textLabel)
+ {
+ }
+
/// 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 Selector<string> TranslatableText
*
*/
using System;
+using System.Collections.Generic;
using System.ComponentModel;
using Tizen.NUI.Binding;
public partial class ViewStyle : BindableObject
{
private string styleName;
- private string backgroundImage;
private View.States? state;
private View.States? subState;
private float? flex;
private View upFocusableView;
private View downFocusableView;
private bool? focusable;
- private Size2D size2D;
- private Position2D position2D;
private bool? positionUsesPivotPoint;
private int? siblingOrder;
private Position parentOrigin;
private Position pivotPoint;
- private float? sizeWidth;
- private float? sizeHeight;
private Position position;
- private float? positionX;
- private float? positionY;
- private float? positionZ;
private Rotation orientation;
private Vector3 scale;
- private float? scaleX;
- private float? scaleY;
- private float? scaleZ;
private string name;
private bool? sensitive;
private bool? leaveRequired;
}
}
+ /// <summary>
+ /// Create an instance and set properties from the given view.
+ /// </summary>
+ /// <param name="view">The View that includes property data.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ViewStyle(View view)
+ {
+ CopyPropertiesFromView(view);
+ }
+
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public string StyleName
set => SetValue(CornerRadiusProperty, value);
}
+ /// <summary>
+ /// Set style's bindable properties from the view.
+ /// </summary>
+ /// <param name="view">The view that includes property data.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public virtual void CopyPropertiesFromView(View view)
+ {
+ if (view == null) return;
+
+ BindableProperty.GetBindablePropertysOfType(GetType(), out var styleProperties);
+ BindableProperty.GetBindablePropertysOfType(view.GetType(), out var viewProperties);
+
+
+ if (styleProperties == null || viewProperties == null) return;
+
+ foreach (var stylePropertyItem in styleProperties)
+ {
+ viewProperties.TryGetValue(stylePropertyItem.Key, out var viewProperty);
+
+ if (viewProperty == null) continue;
+
+ SetValue(stylePropertyItem.Value, view.GetValue(viewProperty));
+ }
+ }
+
internal ViewStyle CreateInstance()
{
- return (ViewStyle)Activator.CreateInstance(GetType());;
+ return (ViewStyle)Activator.CreateInstance(GetType());
}
internal ViewStyle Clone()
public static readonly BindableProperty BackgroundImageSelectorProperty = BindableProperty.Create("BackgroundImageSelector", typeof(Selector<string>), typeof(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var viewStyle = (ViewStyle)bindable;
- if (null == viewStyle.backgroundImageSelector) viewStyle.backgroundImageSelector = new Selector<string>();
- viewStyle.backgroundImageSelector.Clone(null == newValue ? new Selector<string>() : (Selector<string>)newValue);
+
+ if (newValue == null)
+ {
+ viewStyle.backgroundImageSelector = null;
+ }
+ else
+ {
+ viewStyle.backgroundImageSelector = ((Selector<string>)newValue).Clone();
+ viewStyle.backgroundColorSelector = null;
+ }
},
defaultValueCreator: (bindable) =>
{
public static readonly BindableProperty Size2DProperty = BindableProperty.Create(nameof(Size2D), typeof(Size2D), typeof(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var viewStyle = (ViewStyle)bindable;
- viewStyle.size2D = (Size2D)newValue;
+ viewStyle.size = newValue == null ? null : new Size((Size2D)newValue);
},
defaultValueCreator: (bindable) =>
{
var viewStyle = (ViewStyle)bindable;
- return viewStyle.size2D;
+ return viewStyle.size == null ? null : (Size2D)viewStyle.size;
});
/// 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 static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
- var viewStyle = (ViewStyle)bindable;
- if (null == viewStyle.opacitySelector) viewStyle.opacitySelector = new Selector<float?>();
- viewStyle.opacitySelector.Clone(null == newValue ? new Selector<float?>() : (Selector<float?>)newValue);
+ ((ViewStyle)bindable).opacitySelector = ((Selector<float?>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
public static readonly BindableProperty Position2DProperty = BindableProperty.Create(nameof(Position2D), typeof(Position2D), typeof(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var viewStyle = (ViewStyle)bindable;
- viewStyle.position2D = (Position2D)newValue;
+ viewStyle.position = newValue == null ? null : new Position((Position2D)newValue);
},
defaultValueCreator: (bindable) =>
{
var viewStyle = (ViewStyle)bindable;
- return viewStyle.position2D;
+ return viewStyle.position == null ? null : new Position2D(viewStyle.position);
});
/// 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 static readonly BindableProperty SizeWidthProperty = BindableProperty.Create(nameof(SizeWidth), typeof(float?), typeof(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var viewStyle = (ViewStyle)bindable;
- viewStyle.sizeWidth = (float?)newValue;
+ if (newValue != null)
+ {
+ if (viewStyle.size == null)
+ {
+ viewStyle.size = new Size();
+ }
+ viewStyle.size.Width = (float)newValue;
+ }
},
defaultValueCreator: (bindable) =>
{
- var viewStyle = (ViewStyle)bindable;
- return viewStyle.sizeWidth;
+ return ((ViewStyle)bindable).size?.Width;
});
/// 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 static readonly BindableProperty SizeHeightProperty = BindableProperty.Create(nameof(SizeHeight), typeof(float?), typeof(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var viewStyle = (ViewStyle)bindable;
- viewStyle.sizeHeight = (float?)newValue;
+ if (newValue != null)
+ {
+ if (viewStyle.size == null)
+ {
+ viewStyle.size = new Size();
+ }
+ viewStyle.size.Height = (float)newValue;
+ }
},
defaultValueCreator: (bindable) =>
{
- var viewStyle = (ViewStyle)bindable;
- return viewStyle.sizeHeight;
+ return ((ViewStyle)bindable).size?.Height;
});
/// 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 static readonly BindableProperty PositionXProperty = BindableProperty.Create(nameof(PositionX), typeof(float?), typeof(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var viewStyle = (ViewStyle)bindable;
- viewStyle.positionX = (float?)newValue;
+ if (newValue != null)
+ {
+ if (viewStyle.position == null)
+ {
+ viewStyle.position = new Position();
+ }
+ viewStyle.position.X = (float)newValue;
+ }
},
defaultValueCreator: (bindable) =>
{
- var viewStyle = (ViewStyle)bindable;
- return viewStyle.positionX;
+ return ((ViewStyle)bindable).position?.X;
});
/// 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 static readonly BindableProperty PositionYProperty = BindableProperty.Create(nameof(PositionY), typeof(float?), typeof(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var viewStyle = (ViewStyle)bindable;
- viewStyle.positionY = (float?)newValue;
+ if (newValue != null)
+ {
+ if (viewStyle.position == null)
+ {
+ viewStyle.position = new Position();
+ }
+ viewStyle.position.Y = (float)newValue;
+ }
},
defaultValueCreator: (bindable) =>
{
- var viewStyle = (ViewStyle)bindable;
- return viewStyle.positionY;
+ return ((ViewStyle)bindable).position?.Y;
});
/// 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 static readonly BindableProperty PositionZProperty = BindableProperty.Create(nameof(PositionZ), typeof(float?), typeof(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var viewStyle = (ViewStyle)bindable;
- viewStyle.positionZ = (float?)newValue;
+ if (newValue != null)
+ {
+ if (viewStyle.position == null)
+ {
+ viewStyle.position = new Position();
+ }
+ viewStyle.position.Z = (float)newValue;
+ }
},
defaultValueCreator: (bindable) =>
{
- var viewStyle = (ViewStyle)bindable;
- return viewStyle.positionZ;
+ return ((ViewStyle)bindable).position?.Z;
});
/// 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 static readonly BindableProperty ScaleXProperty = BindableProperty.Create(nameof(ScaleX), typeof(float?), typeof(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var viewStyle = (ViewStyle)bindable;
- viewStyle.scaleX = (float?)newValue;
+ if (newValue != null)
+ {
+ if (viewStyle.scale == null)
+ {
+ viewStyle.scale = new Vector3();
+ }
+ viewStyle.scale.X = (float)newValue;
+ }
},
defaultValueCreator: (bindable) =>
{
- var viewStyle = (ViewStyle)bindable;
- return viewStyle.scaleX;
+ return ((ViewStyle)bindable).scale?.X;
});
/// 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 static readonly BindableProperty ScaleYProperty = BindableProperty.Create(nameof(ScaleY), typeof(float?), typeof(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var viewStyle = (ViewStyle)bindable;
- viewStyle.scaleY = (float?)newValue;
+ if (newValue != null)
+ {
+ if (viewStyle.scale == null)
+ {
+ viewStyle.scale = new Vector3();
+ }
+ viewStyle.scale.Y = (float)newValue;
+ }
},
defaultValueCreator: (bindable) =>
{
- var viewStyle = (ViewStyle)bindable;
- return viewStyle.scaleY;
+ return ((ViewStyle)bindable).scale?.Y;
});
/// 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 static readonly BindableProperty ScaleZProperty = BindableProperty.Create(nameof(ScaleZ), typeof(float?), typeof(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var viewStyle = (ViewStyle)bindable;
- viewStyle.scaleZ = (float?)newValue;
+ if (newValue != null)
+ {
+ if (viewStyle.scale == null)
+ {
+ viewStyle.scale = new Vector3();
+ }
+ viewStyle.scale.Z = (float)newValue;
+ }
},
defaultValueCreator: (bindable) =>
{
- var viewStyle = (ViewStyle)bindable;
- return viewStyle.scaleZ;
+ return ((ViewStyle)bindable).scale?.Z;
});
/// 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 static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var viewStyle = (ViewStyle)bindable;
- if (null == viewStyle.backgroundColorSelector) viewStyle.backgroundColorSelector = new Selector<Color>();
- viewStyle.backgroundColorSelector.Clone(null == newValue ? new Selector<Color>() : (Selector<Color>)newValue);
+
+ if (newValue == null)
+ {
+ viewStyle.backgroundColorSelector = null;
+ }
+ else
+ {
+ viewStyle.backgroundColorSelector = ((Selector<Color>)newValue).Clone();
+ viewStyle.backgroundImageSelector = null;
+ }
+
},
defaultValueCreator: (bindable) =>
{
[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly BindableProperty ColorSelectorProperty = BindableProperty.Create("ColorSelector", typeof(Selector<Color>), typeof(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
- var viewStyle = (ViewStyle)bindable;
- if (null == viewStyle.colorSelector) viewStyle.colorSelector = new Selector<Color>();
- viewStyle.colorSelector.Clone(null == newValue ? new Selector<Color>() : (Selector<Color>)newValue);
+ ((ViewStyle)bindable).colorSelector = ((Selector<Color>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly BindableProperty BackgroundImageBorderSelectorProperty = BindableProperty.Create("BackgroundImageBorderSelector", typeof(Selector<Rectangle>), typeof(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
- var viewStyle = (ViewStyle)bindable;
- if (null == viewStyle.backgroundImageBorderSelector) viewStyle.backgroundImageBorderSelector = new Selector<Rectangle>();
-
- viewStyle.backgroundImageBorderSelector.Clone(newValue == null ? new Selector<Rectangle>() : (Selector<Rectangle>)newValue);
+ ((ViewStyle)bindable).backgroundImageBorderSelector = ((Selector<Rectangle>)newValue)?.Clone();
},
defaultValueCreator: (bindable) =>
{
{
var viewStyle = (ViewStyle)bindable;
- viewStyle.imageShadow = (Selector<ImageShadow>)newValue;
-
+ viewStyle.imageShadow = ((Selector<ImageShadow>)newValue)?.Clone();
viewStyle.boxShadow = null;
},
defaultValueCreator: (bindable) =>
{
var viewStyle = (ViewStyle)bindable;
- viewStyle.boxShadow = (Selector<Shadow>)newValue;
-
+ viewStyle.boxShadow = ((Selector<Shadow>)newValue)?.Clone();
viewStyle.imageShadow = null;
},
defaultValueCreator: (bindable) =>
[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create("CornerRadiusSelector", typeof(Selector<float?>), typeof(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
- var viewStyle = (ViewStyle)bindable;
- viewStyle.cornerRadius = (Selector<float?>)(newValue);
+ ((ViewStyle)bindable).cornerRadius = ((Selector<float?>)(newValue))?.Clone();
},
defaultValueCreator: (bindable) =>
{
private string textFieldPlaceHolderTextSid = null;
private bool systemlangTextFlag = false;
private InputMethodContext inputMethodCotext = null;
+ private TextFieldSelectorData selectorData;
static TextField() { }
/// 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 TextFieldStyle Style => ViewStyle as TextFieldStyle;
+ public new TextFieldStyle Style => new TextFieldStyle(this);
/// <summary>
/// Creates the TextField control.
}
set
{
+ selectorData?.TranslatableText.UpdateIfNeeds(this, value);
SetValue(TranslatableTextProperty, value);
}
}
set
{
SetValue(TranslatablePlaceholderTextProperty, value);
+ selectorData?.TranslatablePlaceholderText.UpdateIfNeeds(this, value);
}
}
private string translatablePlaceholderText
set
{
SetValueAndForceSendChangeSignal(TextProperty, value);
+ selectorData?.Text.UpdateIfNeeds(this, value);
NotifyPropertyChanged();
}
}
set
{
SetValue(FontFamilyProperty, value);
+ selectorData?.FontFamily.UpdateIfNeeds(this, value);
NotifyPropertyChanged();
}
}
set
{
SetValue(PointSizeProperty, value);
+ selectorData?.PointSize.UpdateIfNeeds(this, value);
NotifyPropertyChanged();
}
}
set
{
SetValue(TextColorProperty, value);
+ selectorData?.TextColor.UpdateIfNeeds(this, value);
NotifyPropertyChanged();
}
}
set
{
SetValue(PlaceholderTextColorProperty, value);
+ selectorData?.PlaceholderTextColor.UpdateIfNeeds(this, value);
NotifyPropertyChanged();
}
}
set
{
SetValue(PrimaryCursorColorProperty, value);
+ selectorData?.PrimaryCursorColor.UpdateIfNeeds(this, value);
NotifyPropertyChanged();
}
}
}
}
+ private TextFieldSelectorData SelectorData
+ {
+ get
+ {
+ if (selectorData == null)
+ {
+ selectorData = new TextFieldSelectorData();
+ }
+ return selectorData;
+ }
+ }
+
/// <summary>
/// Get the InputMethodContext instance.
/// </summary>
return;
}
+ if (type == DisposeTypes.Explicit)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+ selectorData?.Reset(this);
+ }
+
//Release your own unmanaged resources here.
//You should not access any managed member here except static instance.
//because the execution order of Finalizes is non-deterministic.
}
}
- internal static readonly BindableProperty TranslatableTextSelectorProperty = BindableProperty.Create("TranslatableTextSelector", typeof(Selector<string>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textField = (TextField)bindable;
- textField.translatableTextSelector.Clone((Selector<string>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textField = (TextField)bindable;
- return textField.translatableTextSelector;
- });
- internal static readonly BindableProperty TranslatablePlaceholderTextSelectorProperty = BindableProperty.Create("TranslatablePlaceholderTextSelector", typeof(Selector<string>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textField = (TextField)bindable;
- textField.translatablePlaceholderTextSelector.Clone((Selector<string>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textField = (TextField)bindable;
- return textField.translatablePlaceholderTextSelector;
- });
- internal static readonly BindableProperty TextSelectorProperty = BindableProperty.Create("TextSelector", typeof(Selector<string>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textField = (TextField)bindable;
- textField.textSelector.Clone((Selector<string>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textField = (TextField)bindable;
- return textField.textSelector;
- });
- internal static readonly BindableProperty FontFamilySelectorProperty = BindableProperty.Create("FontFamilySelector", typeof(Selector<string>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textField = (TextField)bindable;
- textField.fontFamilySelector.Clone((Selector<string>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textField = (TextField)bindable;
- return textField.fontFamilySelector;
- });
- internal static readonly BindableProperty PointSizeSelectorProperty = BindableProperty.Create("PointSizeSelector", typeof(Selector<float?>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textField = (TextField)bindable;
- textField.pointSizeSelector.Clone((Selector<float?>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textField = (TextField)bindable;
- return textField.pointSizeSelector;
- });
- internal static readonly BindableProperty TextColorSelectorProperty = BindableProperty.Create("TextColorSelector", typeof(Selector<Color>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textField = (TextField)bindable;
- textField.textColorSelector.Clone((Selector<Color>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textField = (TextField)bindable;
- return textField.textColorSelector;
- });
- internal static readonly BindableProperty PlaceholderTextColorSelectorProperty = BindableProperty.Create("PlaceholderTextColorSelector", typeof(Selector<Vector4>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textField = (TextField)bindable;
- textField.placeholderTextColorSelector.Clone((Selector<Vector4>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textField = (TextField)bindable;
- return textField.placeholderTextColorSelector;
- });
- internal static readonly BindableProperty PrimaryCursorColorSelectorProperty = BindableProperty.Create("PrimaryCursorColorSelector", typeof(Selector<Vector4>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textField = (TextField)bindable;
- textField.primaryCursorColorSelector.Clone((Selector<Vector4>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textField = (TextField)bindable;
- return textField.primaryCursorColorSelector;
- });
-
- private TriggerableSelector<string> _translatableTextSelector;
- private TriggerableSelector<string> translatableTextSelector
- {
- get
- {
- if (null == _translatableTextSelector)
- {
- _translatableTextSelector = new TriggerableSelector<string>(this, TranslatableTextProperty);
- }
- return _translatableTextSelector;
- }
- }
-
- private TriggerableSelector<string> _translatablePlaceholderTextSelector;
- private TriggerableSelector<string> translatablePlaceholderTextSelector
- {
- get
- {
- if (null == _translatablePlaceholderTextSelector)
- {
- _translatablePlaceholderTextSelector = new TriggerableSelector<string>(this, TranslatablePlaceholderTextProperty);
- }
- return _translatablePlaceholderTextSelector;
- }
- }
-
- private TriggerableSelector<string> _textSelector;
- private TriggerableSelector<string> textSelector
- {
- get
- {
- if (null == _textSelector)
- {
- _textSelector = new TriggerableSelector<string>(this, TextProperty);
- }
- return _textSelector;
- }
- }
-
- private TriggerableSelector<string> _fontFamilySelector;
- private TriggerableSelector<string> fontFamilySelector
- {
- get
- {
- if (null == _fontFamilySelector)
- {
- _fontFamilySelector = new TriggerableSelector<string>(this, FontFamilyProperty);
- }
- return _fontFamilySelector;
- }
- }
-
- private TriggerableSelector<Color> _textColorSelector;
- private TriggerableSelector<Color> textColorSelector
- {
- get
- {
- if (null == _textColorSelector)
- {
- _textColorSelector = new TriggerableSelector<Color>(this, TextColorProperty);
- }
- return _textColorSelector;
- }
- }
-
- private TriggerableSelector<float?> _pointSizeSelector;
- private TriggerableSelector<float?> pointSizeSelector
- {
- get
- {
- if (null == _pointSizeSelector)
- {
- _pointSizeSelector = new TriggerableSelector<float?>(this, PointSizeProperty);
- }
- return _pointSizeSelector;
- }
- }
-
- private TriggerableSelector<Vector4> _placeholderTextColorSelector;
- private TriggerableSelector<Vector4> placeholderTextColorSelector
- {
- get
- {
- if (null == _placeholderTextColorSelector)
- {
- _placeholderTextColorSelector = new TriggerableSelector<Vector4>(this, PlaceholderTextColorProperty);
- }
- return _placeholderTextColorSelector;
- }
- }
-
- private TriggerableSelector<Vector4> _primaryCursorColorSelector;
- private TriggerableSelector<Vector4> primaryCursorColorSelector
- {
- get
- {
- if (null == _primaryCursorColorSelector)
- {
- _primaryCursorColorSelector = new TriggerableSelector<Vector4>(this, PrimaryCursorColorProperty);
- }
- return _primaryCursorColorSelector;
- }
- }
-
private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
{
DecorationBoundingBox = new Rectangle(x, y, width, height);
Tizen.NUI.Object.GetProperty(textField.swigCPtr, TextField.Property.MATCH_SYSTEM_LANGUAGE_DIRECTION).Get(out temp);
return (bool)temp;
});
+
+ #region Selectors
+ internal static readonly BindableProperty TranslatableTextSelectorProperty = BindableProperty.Create("TranslatableTextSelector", typeof(Selector<string>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = (TextField)bindable;
+ textField.SelectorData.TranslatableText.Update(textField, (Selector<string>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = (TextField)bindable;
+ return textField.SelectorData.TranslatableText.Get(textField);
+ });
+ internal static readonly BindableProperty TranslatablePlaceholderTextSelectorProperty = BindableProperty.Create("TranslatablePlaceholderTextSelector", typeof(Selector<string>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = (TextField)bindable;
+ textField.SelectorData.TranslatablePlaceholderText.Update(textField, (Selector<string>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = (TextField)bindable;
+ return textField.SelectorData.TranslatablePlaceholderText.Get(textField);
+ });
+ internal static readonly BindableProperty TextSelectorProperty = BindableProperty.Create("TextSelector", typeof(Selector<string>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = (TextField)bindable;
+ textField.SelectorData.Text.Update(textField, (Selector<string>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = (TextField)bindable;
+ return textField.SelectorData.Text.Get(textField);
+ });
+ internal static readonly BindableProperty FontFamilySelectorProperty = BindableProperty.Create("FontFamilySelector", typeof(Selector<string>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = (TextField)bindable;
+ textField.SelectorData.FontFamily.Update(textField, (Selector<string>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = (TextField)bindable;
+ return textField.SelectorData.FontFamily.Get(textField);
+ });
+ internal static readonly BindableProperty PointSizeSelectorProperty = BindableProperty.Create("PointSizeSelector", typeof(Selector<float?>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = (TextField)bindable;
+ textField.SelectorData.PointSize.Update(textField, (Selector<float?>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = (TextField)bindable;
+ return textField.SelectorData.PointSize.Get(textField);
+ });
+ internal static readonly BindableProperty TextColorSelectorProperty = BindableProperty.Create("TextColorSelector", typeof(Selector<Color>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = (TextField)bindable;
+ textField.SelectorData.TextColor.Update(textField, (Selector<Color>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = (TextField)bindable;
+ return textField.SelectorData.TextColor.Get(textField);
+ });
+ internal static readonly BindableProperty PlaceholderTextColorSelectorProperty = BindableProperty.Create("PlaceholderTextColorSelector", typeof(Selector<Vector4>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = (TextField)bindable;
+ textField.SelectorData.PlaceholderTextColor.Update(textField, (Selector<Vector4>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = (TextField)bindable;
+ return textField.SelectorData.PlaceholderTextColor.Get(textField);
+ });
+ internal static readonly BindableProperty PrimaryCursorColorSelectorProperty = BindableProperty.Create("PrimaryCursorColorSelector", typeof(Selector<Vector4>), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textField = (TextField)bindable;
+ textField.SelectorData.PrimaryCursorColor.Update(textField, (Selector<Vector4>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textField = (TextField)bindable;
+ return textField.SelectorData.PrimaryCursorColor.Get(textField);
+ });
+ #endregion
}
}
--- /dev/null
+/*
+ * Copyright(c) 2020 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.
+ *
+ */
+
+namespace Tizen.NUI.BaseComponents
+{
+ /// <summary>
+ /// The class storing extra data for a TextField to optimize size of it.
+ /// </summary>
+ internal class TextFieldSelectorData : TextLabelSelectorData
+ {
+ public TriggerableSelector<string> TranslatablePlaceholderText { get; } = new TriggerableSelector<string>(TextField.TranslatablePlaceholderTextProperty);
+ public TriggerableSelector<Vector4> PlaceholderTextColor { get; } = new TriggerableSelector<Vector4>(TextField.PlaceholderTextColorProperty, delegate (View view)
+ {
+ Vector4 color = new Vector4();
+ if (view.GetProperty(TextField.Property.PLACEHOLDER_TEXT_COLOR).Get(color))
+ {
+ return color;
+ }
+ return null;
+ });
+
+ public TriggerableSelector<Vector4> PrimaryCursorColor { get; } = new TriggerableSelector<Vector4>(TextField.PrimaryCursorColorProperty, delegate (View view)
+ {
+ Vector4 color = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
+ if (view.GetProperty(TextField.Property.PRIMARY_CURSOR_COLOR).Get(color))
+ {
+ return color;
+ }
+ return null;
+ });
+
+ public override void Reset(View view)
+ {
+ TranslatablePlaceholderText.Reset(view);
+ PlaceholderTextColor.Reset(view);
+ PrimaryCursorColor.Reset(view);
+
+ base.Reset(view);
+ }
+ }
+}
private string textLabelSid = null;
private bool systemlangTextFlag = false;
+ private TextLabelSelectorData selectorData;
- private CloneableViewSelector<TextShadow> textShadow;
-
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ /// <summary>
+ /// Return a copied Style instance of the TextLabel.
+ /// </summary>
+ /// <remarks>
+ /// It returns copied style instance so that changing it does not effect to the view.
+ /// Style setting is possible by using constructor or the function of <see cref="View.ApplyStyle"/>.
+ /// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
- public TextLabelStyle Style => ViewStyle as TextLabelStyle;
+ public new TextLabelStyle Style => new TextLabelStyle(this);
/// <summary>
/// Creates the TextLabel control.
set
{
SetValue(TranslatableTextProperty, value);
+ selectorData?.TranslatableText.UpdateIfNeeds(this, value);
}
}
private string translatableText
{
get
{
- string temp = (string)GetValue(TranslatableTextProperty);
return textLabelSid;
}
set
set
{
SetValue(TextProperty, value);
+ selectorData?.Text.UpdateIfNeeds(this, value);
NotifyPropertyChangedAndRequestLayout();
}
}
set
{
SetValue(FontFamilyProperty, value);
+ selectorData?.FontFamily.UpdateIfNeeds(this, value);
NotifyPropertyChangedAndRequestLayout();
}
}
set
{
SetValue(PointSizeProperty, value);
+ selectorData?.PointSize.UpdateIfNeeds(this, value);
NotifyPropertyChangedAndRequestLayout();
}
}
set
{
SetValue(TextColorProperty, value);
+ selectorData?.TextColor.UpdateIfNeeds(this, value);
NotifyPropertyChanged();
}
}
{
get
{
- var value = (TextShadow)GetValue(TextShadowProperty);
- return value == null ? null : new TextShadow(value, OnTextShadowChanged);
+ return (TextShadow)GetValue(TextShadowProperty);
}
set
{
SetValue(TextShadowProperty, value);
+ selectorData?.TextShadow.UpdateIfNeeds(this, value);
NotifyPropertyChanged();
}
}
}
}
+ private TextLabelSelectorData SelectorData
+ {
+ get
+ {
+ if (selectorData == null)
+ {
+ selectorData = new TextLabelSelectorData();
+ }
+ return selectorData;
+ }
+ }
+
/// <summary>
/// Downcasts a handle to textLabel handle
/// </summary>
return ret;
}
+ /// <inheritdoc/>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+ selectorData?.Reset(this);
+ }
+
+ base.Dispose(type);
+ }
+
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextLabel obj)
{
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
return new TextLabelStyle();
}
- internal static readonly BindableProperty TranslatableTextSelectorProperty = BindableProperty.Create("TranslatableTextSelector", typeof(Selector<string>), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textLabel = (TextLabel)bindable;
- textLabel.TranslatableTextSelector.Clone((Selector<string>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textLabel = (TextLabel)bindable;
- return textLabel.TranslatableTextSelector;
- });
- internal static readonly BindableProperty TextSelectorProperty = BindableProperty.Create("TextSelector", typeof(Selector<string>), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textLabel = (TextLabel)bindable;
- textLabel.textSelector.Clone((Selector<string>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textLabel = (TextLabel)bindable;
- return textLabel.textSelector;
- });
- internal static readonly BindableProperty FontFamilySelectorProperty = BindableProperty.Create("FontFamilySelector", typeof(Selector<string>), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textLabel = (TextLabel)bindable;
- textLabel.fontFamilySelector.Clone((Selector<string>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textLabel = (TextLabel)bindable;
- return textLabel.fontFamilySelector;
- });
- internal static readonly BindableProperty PointSizeSelectorProperty = BindableProperty.Create("PointSizeSelector", typeof(Selector<float?>), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textLabel = (TextLabel)bindable;
- textLabel.pointSizeSelector.Clone((Selector<float?>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textLabel = (TextLabel)bindable;
- return textLabel.pointSizeSelector;
- });
- internal static readonly BindableProperty TextColorSelectorProperty = BindableProperty.Create("TextColorSelector", typeof(Selector<Color>), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var textLabel = (TextLabel)bindable;
- textLabel.textColorSelector.Clone((Selector<Color>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var textLabel = (TextLabel)bindable;
- return textLabel.textColorSelector;
- });
-
- private TriggerableSelector<string> translatableTextSelector;
- private TriggerableSelector<string> TranslatableTextSelector
- {
- get
- {
- if (null == translatableTextSelector)
- {
- translatableTextSelector = new TriggerableSelector<string>(this, TranslatableTextProperty);
- }
- return translatableTextSelector;
- }
- }
-
- private TriggerableSelector<string> _textSelector;
- private TriggerableSelector<string> textSelector
- {
- get
- {
- if (null == _textSelector)
- {
- _textSelector = new TriggerableSelector<string>(this, TextProperty);
- }
- return _textSelector;
- }
- }
-
- private TriggerableSelector<string> _fontFamilySelector;
- private TriggerableSelector<string> fontFamilySelector
- {
- get
- {
- if (null == _fontFamilySelector)
- {
- _fontFamilySelector = new TriggerableSelector<string>(this, FontFamilyProperty);
- }
- return _fontFamilySelector;
- }
- }
-
- private TriggerableSelector<Color> _textColorSelector;
- private TriggerableSelector<Color> textColorSelector
- {
- get
- {
- if (null == _textColorSelector)
- {
- _textColorSelector = new TriggerableSelector<Color>(this, TextColorProperty);
- }
- return _textColorSelector;
- }
- }
-
- private TriggerableSelector<float?> _pointSizeSelector;
- private TriggerableSelector<float?> pointSizeSelector
- {
- get
- {
- if (null == _pointSizeSelector)
- {
- _pointSizeSelector = new TriggerableSelector<float?>(this, PointSizeProperty);
- }
- return _pointSizeSelector;
- }
- }
-
/// <summary>
/// Invoked whenever the binding context of the textlabel changes. Implement this method to add class handling for this event.
/// </summary>
{
UnderlineColor = new Vector4(x, y, z, w);
}
-
- private void OnTextShadowChanged(TextShadow instance)
- {
- TextShadow = instance;
- }
-
- private void OnControlStateChangedForShadow(object obj, ControlStateChangedEventArgs controlStateChangedInfo)
- {
- UpdateTextShadowVisual();
- }
-
- private void UpdateTextShadowVisual()
- {
- TextShadow shadow = (textShadow != null && !textShadow.IsEmpty()) ? textShadow.GetValue() : textShadow?.GetValue();
- Object.SetProperty(swigCPtr, Property.SHADOW, TextShadow.ToPropertyValue(shadow));
- }
}
}
var textLabel = (TextLabel)bindable;
if (newValue != null)
{
- (textLabel.textShadow ?? (textLabel.textShadow = new CloneableViewSelector<TextShadow>(textLabel, textLabel.OnControlStateChangedForShadow))).Set(newValue);
- Object.SetProperty(textLabel.swigCPtr, Property.SHADOW, TextShadow.ToPropertyValue(textLabel.textShadow.GetValue()));
+ Object.SetProperty(textLabel.swigCPtr, Property.SHADOW, TextShadow.ToPropertyValue((TextShadow)newValue));
}
},
defaultValueCreator: (bindable) =>
{
var textLabel = (TextLabel)bindable;
- return textLabel.textShadow?.GetValue();
+ PropertyMap temp = new PropertyMap();
+ Tizen.NUI.Object.GetProperty(textLabel.swigCPtr, TextLabel.Property.SHADOW).Get(temp);
+ return temp.Empty() ? null : new TextShadow(temp);
});
/// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
return temp;
});
+
+ #region Selectors
+ internal static readonly BindableProperty TranslatableTextSelectorProperty = BindableProperty.Create("TranslatableTextSelector", typeof(Selector<string>), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = (TextLabel)bindable;
+ textLabel.SelectorData.TranslatableText.Update(textLabel, (Selector<string>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = (TextLabel)bindable;
+ return textLabel.SelectorData.TranslatableText.Get(textLabel);
+ });
+ internal static readonly BindableProperty TextSelectorProperty = BindableProperty.Create("TextSelector", typeof(Selector<string>), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = (TextLabel)bindable;
+ textLabel.SelectorData.Text.Update(textLabel, (Selector<string>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = (TextLabel)bindable;
+ return textLabel.SelectorData.Text.Get(textLabel);
+ });
+ internal static readonly BindableProperty FontFamilySelectorProperty = BindableProperty.Create("FontFamilySelector", typeof(Selector<string>), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = (TextLabel)bindable;
+ textLabel.SelectorData.FontFamily.Update(textLabel, (Selector<string>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = (TextLabel)bindable;
+ return textLabel.SelectorData.FontFamily.Get(textLabel);
+ });
+ internal static readonly BindableProperty PointSizeSelectorProperty = BindableProperty.Create("PointSizeSelector", typeof(Selector<float?>), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = (TextLabel)bindable;
+ textLabel.SelectorData.PointSize.Update(textLabel, (Selector<float?>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = (TextLabel)bindable;
+ return textLabel.SelectorData.PointSize.Get(textLabel);
+ });
+ internal static readonly BindableProperty TextColorSelectorProperty = BindableProperty.Create("TextColorSelector", typeof(Selector<Color>), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = (TextLabel)bindable;
+ textLabel.SelectorData.TextColor.Update(textLabel, (Selector<Color>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = (TextLabel)bindable;
+ return textLabel.SelectorData.TextColor.Get(textLabel);
+ });
+
+ internal static readonly BindableProperty TextShadowSelectorProperty = BindableProperty.Create("TextShadowSelector", typeof(Selector<TextShadow>), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var textLabel = (TextLabel)bindable;
+ textLabel.SelectorData.TextShadow.Update(textLabel, (Selector<TextShadow>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = (TextLabel)bindable;
+ return textLabel.SelectorData.TextShadow.Get(textLabel);
+ });
+ #endregion
+
}
}
--- /dev/null
+/*
+ * Copyright(c) 2020 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.
+ *
+ */
+
+namespace Tizen.NUI.BaseComponents
+{
+ /// <summary>
+ /// The class storing extra data for a TextLabel to optimize size of it.
+ /// </summary>
+ internal class TextLabelSelectorData
+ {
+ public TriggerableSelector<string> TranslatableText { get; } = new TriggerableSelector<string>(TextLabel.TranslatableTextProperty);
+ public TriggerableSelector<string> Text { get; } = new TriggerableSelector<string>(TextLabel.TextProperty);
+ public TriggerableSelector<string> FontFamily { get; } = new TriggerableSelector<string>(TextLabel.FontFamilyProperty);
+ public TriggerableSelector<Color> TextColor { get; } = new TriggerableSelector<Color>(TextLabel.TextColorProperty, GetTextColor);
+ public TriggerableSelector<float?> PointSize { get; } = new TriggerableSelector<float?>(TextLabel.PointSizeProperty);
+ public TriggerableSelector<TextShadow> TextShadow { get; } = new TriggerableSelector<TextShadow>(TextLabel.TextShadowProperty);
+
+ public virtual void Reset(View view)
+ {
+ TranslatableText.Reset(view);
+ Text.Reset(view);
+ FontFamily.Reset(view);
+ TextColor.Reset(view);
+ PointSize.Reset(view);
+ TextShadow.Reset(view);
+ }
+
+ private static Color GetTextColor(View view)
+ {
+ Color color = new Color();
+ if (view.GetProperty(TextLabel.Property.TEXT_COLOR).Get(color))
+ {
+ return color;
+ }
+ return null;
+ }
+ }
+}
private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
private string[] transitionNames;
private bool controlStatePropagation = false;
+ private ViewStyle viewStyle;
internal Size2D sizeSetExplicitly = new Size2D(); // Store size set by API, will be used in place of NaturalSize if not set.
internal BackgroundExtraData backgroundExtraData;
static View() {}
+
/// <summary>
- /// The Style instance binded with this View.
+ /// Return a copied Style instance of View.
/// </summary>
- private ViewStyle viewStyle;
+ /// <remarks>
+ /// It returns copied Style instance and changing it does not effect to the View.
+ /// </remarks>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ViewStyle Style => new ViewStyle(this);
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
[EditorBrowsable(EditorBrowsableState.Never)]
public View(ViewStyle viewStyle) : this(Interop.View.View_New(), true)
{
- this.ViewStyle.CopyFrom(viewStyle);
+ ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
}
/// <summary>
internal View(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : this(cPtr, cMemoryOwn, shown)
{
- if (this.viewStyle == null)
- {
- ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
- }
- else
- {
- this.viewStyle.CopyFrom(viewStyle);
- }
+ ApplyStyle((viewStyle == null) ? GetViewStyle() : viewStyle.Clone());
}
internal View(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.View.View_SWIGUpcast(cPtr), cMemoryOwn)
}
set
{
- if (viewStyle != null)
- {
- viewStyle.BackgroundImage = null;
- viewStyle.BackgroundColor = value;
- }
- else
+ SetValue(BackgroundColorProperty, value);
+ if (selectorData != null)
{
- SetValue(BackgroundColorProperty, value);
+ selectorData.BackgroundImage.Reset(this);
+ selectorData.BackgroundColor.UpdateIfNeeds(this, value);
}
-
NotifyPropertyChanged();
}
}
}
set
{
- if (viewStyle != null)
- {
- viewStyle.BackgroundColor = null;
- viewStyle.BackgroundImage = value;
- }
- else
+ SetValue(BackgroundImageProperty, value);
+ if (selectorData != null)
{
- SetValue(BackgroundImageProperty, value);
+ selectorData.BackgroundColor.Reset(this);
+ selectorData.BackgroundImage.UpdateIfNeeds(this, value);
}
-
NotifyPropertyChanged();
}
}
}
set
{
- if (viewStyle != null)
- {
- viewStyle.BackgroundImageBorder = value;
- }
- else
- {
- SetValue(BackgroundImageBorderProperty, value);
- }
-
+ SetValue(BackgroundImageBorderProperty, value);
+ selectorData?.BackgroundImageBorder.UpdateIfNeeds(this, value);
NotifyPropertyChanged();
}
}
/// It is null by default.
/// </summary>
/// <remarks>
- /// Gettter returns copied instance of current shadow.
+ /// Getter returns copied instance of current shadow.
/// </remarks>
/// <remarks>
/// The mutually exclusive with "BoxShadow".
set
{
SetValue(ImageShadowProperty, value);
+ if (selectorData != null)
+ {
+ selectorData.BoxShadow.Reset(this);
+ selectorData.ImageShadow.UpdateIfNeeds(this, value);
+ }
NotifyPropertyChanged();
}
}
set
{
SetValue(BoxShadowProperty, value);
+ if (selectorData != null)
+ {
+ selectorData.ImageShadow.Reset(this);
+ selectorData.BoxShadow.UpdateIfNeeds(this, value);
+ }
NotifyPropertyChanged();
}
}
set
{
SetValue(CornerRadiusProperty, value);
+ selectorData?.CornerRadius.UpdateIfNeeds(this, value);
NotifyPropertyChanged();
}
}
}
set
{
- if (viewStyle != null)
- {
- viewStyle.Opacity = value;
- }
- else
- {
- SetValue(OpacityProperty, value);
- }
-
+ SetValue(OpacityProperty, value);
+ selectorData?.Opacity.UpdateIfNeeds(this, value);
NotifyPropertyChanged();
}
}
}
set
{
- if (viewStyle != null)
- {
- viewStyle.Color = value;
- }
- else
- {
- SetValue(ColorProperty, value);
- }
-
+ SetValue(ColorProperty, value);
+ selectorData?.Color.UpdateIfNeeds(this, value);
NotifyPropertyChanged();
}
}
{
}
- internal static readonly BindableProperty BackgroundImageSelectorProperty = BindableProperty.Create("BackgroundImageSelector", typeof(Selector<string>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var view = (View)bindable;
- view.backgroundImageSelector.Clone((Selector<string>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var view = (View)bindable;
- return view.backgroundImageSelector;
- });
- private TriggerableSelector<string> _backgroundImageSelector;
- private TriggerableSelector<string> backgroundImageSelector
- {
- get
- {
- if (null == _backgroundImageSelector)
- {
- _backgroundImageSelector = new TriggerableSelector<string>(this, BackgroundImageProperty);
- }
- return _backgroundImageSelector;
- }
- }
- internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var view = (View)bindable;
- view.backgroundColorSelector.Clone((Selector<Color>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var view = (View)bindable;
- return view.backgroundColorSelector;
- });
- private TriggerableSelector<Color> _backgroundColorSelector;
- private TriggerableSelector<Color> backgroundColorSelector
- {
- get
- {
- if (null == _backgroundColorSelector)
- {
- _backgroundColorSelector = new TriggerableSelector<Color>(this, BackgroundColorProperty);
- }
- return _backgroundColorSelector;
- }
- }
-
- internal static readonly BindableProperty ColorSelectorProperty = BindableProperty.Create("ColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var view = (View)bindable;
- view.colorSelector.Clone((Selector<Color>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var view = (View)bindable;
- return view.colorSelector;
- });
-
- private TriggerableSelector<Color> _colorSelector;
- private TriggerableSelector<Color> colorSelector
- {
- get
- {
- if (null == _colorSelector)
- {
- _colorSelector = new TriggerableSelector<Color>(this, ColorProperty);
- }
- return _colorSelector;
- }
- }
-
- internal static readonly BindableProperty BackgroundImageBorderSelectorProperty = BindableProperty.Create("BackgroundImageBorderSelector", typeof(Selector<Rectangle>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var view = (View)bindable;
- view.backgroundImageBorderSelector.Clone((Selector<Rectangle>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var view = (View)bindable;
- return view.backgroundImageBorderSelector;
- });
- private TriggerableSelector<Rectangle> _backgroundImageBorderSelector;
- private TriggerableSelector<Rectangle> backgroundImageBorderSelector
- {
- get
- {
- if (null == _backgroundImageBorderSelector)
- {
- _backgroundImageBorderSelector = new TriggerableSelector<Rectangle>(this, BackgroundImageBorderProperty);
- }
- return _backgroundImageBorderSelector;
- }
- }
- internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
- {
- var view = (View)bindable;
- view.opacitySelector.Clone((Selector<float?>)newValue);
- },
- defaultValueCreator: (bindable) =>
- {
- var view = (View)bindable;
- return view.opacitySelector;
- });
- private TriggerableSelector<float?> _opacitySelector;
- private TriggerableSelector<float?> opacitySelector
- {
- get
- {
- if (null == _opacitySelector)
- {
- _opacitySelector = new TriggerableSelector<float?>(this, OpacityProperty);
- }
- return _opacitySelector;
- }
- }
-
/// 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 virtual void ApplyStyle(ViewStyle viewStyle)
{
- if (null == viewStyle)
- {
- return;
- }
-
- if (this.viewStyle == viewStyle)
- {
- return;
- }
-
- if (null != this.viewStyle)
- {
- simpleBinding.Clear();
- }
+ if (null == viewStyle || this.viewStyle == viewStyle) return;
this.viewStyle = viewStyle;
{
SetValue(viewProperty, value);
}
-
- simpleBinding.Bind(viewStyle, keyValuePair.Value, this, viewProperty, BindingDirection.TwoWay);
}
}
}
}
-
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
- private BundledPipe simpleBinding = new BundledPipe();
}
}
public static readonly BindableProperty BackgroundColorProperty = BindableProperty.Create("BackgroundColor", typeof(Color), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var view = (View)bindable;
-
if (newValue != null)
{
if (view.backgroundExtraData == null)
public static readonly BindableProperty OpacityProperty = BindableProperty.Create("Opacity", typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
{
var view = (View)bindable;
+
if (newValue != null)
{
Tizen.NUI.Object.SetProperty(view.swigCPtr, View.Property.OPACITY, new Tizen.NUI.PropertyValue((float)newValue));
public static readonly BindableProperty ImageShadowProperty = BindableProperty.Create(nameof(ImageShadow), typeof(ImageShadow), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var shadow = (ImageShadow)newValue;
-
var view = (View)bindable;
-
- view.SetValue(View.ImageShadowSelectorProperty, shadow == null ? null : new Selector<ImageShadow>() { All = shadow, });
+ Tizen.NUI.Object.SetProperty(view.swigCPtr, View.Property.SHADOW, shadow == null ? new PropertyValue() : shadow.ToPropertyValue(view));
},
defaultValueCreator: (bindable) =>
{
var view = (View)bindable;
- if (view.viewStyle != null)
- {
- return view.viewStyle.ImageShadow?.GetValue(view.ControlState);
- }
-
PropertyMap map = new PropertyMap();
-
Tizen.NUI.Object.GetProperty(view.swigCPtr, View.Property.SHADOW).Get(map);
var shadow = new ImageShadow(map);
-
return shadow.IsEmpty() ? null : shadow;
});
/// <summary>
- /// ImageShadow Selector Property for binding to ViewStyle
+ /// Shadow Property
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty ImageShadowSelectorProperty = BindableProperty.Create("ImageShadowSelector", typeof(Selector<ImageShadow>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty BoxShadowProperty = BindableProperty.Create(nameof(BoxShadow), typeof(Shadow), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
{
+ var shadow = (Shadow)newValue;
var view = (View)bindable;
-
- var shadowSelector = (Selector<ImageShadow>)newValue;
-
- view.UpdateShadow(shadowSelector?.GetValue(view.ControlState), shadowSelector == null ? false : shadowSelector.HasMultiValue());
+ Tizen.NUI.Object.SetProperty(view.swigCPtr, View.Property.SHADOW, shadow == null ? new PropertyValue() : shadow.ToPropertyValue(view));
},
defaultValueCreator: (bindable) =>
{
var view = (View)bindable;
- return view.viewStyle?.ImageShadow;
+ PropertyMap map = new PropertyMap();
+ Tizen.NUI.Object.GetProperty(view.swigCPtr, View.Property.SHADOW).Get(map);
+
+ var shadow = new Shadow(map);
+ return shadow.IsEmpty() ? null : shadow;
});
/// <summary>
- /// Shadow Property
+ /// CornerRadius Property
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty BoxShadowProperty = BindableProperty.Create(nameof(BoxShadow), typeof(Shadow), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create(nameof(CornerRadius), typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
{
- var shadow = (Shadow)newValue;
-
var view = (View)bindable;
-
- view.SetValue(View.BoxShadowSelectorProperty, shadow == null ? null : new Selector<Shadow>() { All = shadow, });
+ view.UpdateCornerRadius((float)newValue);
},
defaultValueCreator: (bindable) =>
{
var view = (View)bindable;
-
- if (view.viewStyle != null)
- {
- return view.viewStyle.BoxShadow?.GetValue(view.ControlState);
- }
-
- PropertyMap map = new PropertyMap();
-
- Tizen.NUI.Object.GetProperty(view.swigCPtr, View.Property.SHADOW).Get(map);
-
- var shadow = new Shadow(map);
-
- return shadow.IsEmpty() ? null : shadow;
+ return view.backgroundExtraData == null ? 0 : view.backgroundExtraData.CornerRadius;
});
/// <summary>
- /// BoxShadow Selector Property for binding to ViewStyle
+ /// XamlStyleProperty
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty BoxShadowSelectorProperty = BindableProperty.Create("BoxShadowSelector", typeof(Selector<Shadow>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty XamlStyleProperty = BindableProperty.Create("XamlStyle", typeof(Style), typeof(View), default(Style), propertyChanged: (bindable, oldvalue, newvalue) => ((View)bindable)._mergedStyle.Style = (Style)newvalue);
+
+
+ #region Selectors
+ internal static readonly BindableProperty BackgroundImageSelectorProperty = BindableProperty.Create("BackgroundImageSelector", typeof(Selector<string>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = (View)bindable;
+ view.SelectorData.BackgroundImage.Update(view, (Selector<string>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
{
var view = (View)bindable;
+ return view.SelectorData.BackgroundImage.Get(view);
+ });
- var shadowSelector = (Selector<Shadow>)newValue;
+ internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = (View)bindable;
+ view.SelectorData.BackgroundColor.Update(view, (Selector<Color>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = (View)bindable;
+ return view.SelectorData.BackgroundColor.Get(view);
+ });
- view.UpdateShadow(shadowSelector?.GetValue(view.ControlState), shadowSelector == null ? false : shadowSelector.HasMultiValue());
+ internal static readonly BindableProperty BackgroundImageBorderSelectorProperty = BindableProperty.Create("BackgroundImageBorderSelector", typeof(Selector<Rectangle>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = (View)bindable;
+ view.SelectorData.BackgroundImageBorder.Update(view, (Selector<Rectangle>)newValue, true);
},
defaultValueCreator: (bindable) =>
{
var view = (View)bindable;
+ return view.SelectorData.BackgroundImageBorder.Get(view);
+ });
- return view.viewStyle?.BoxShadow;
+ internal static readonly BindableProperty ColorSelectorProperty = BindableProperty.Create("ColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = (View)bindable;
+ view.SelectorData.Color.Update(view, (Selector<Color>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = (View)bindable;
+ return view.SelectorData.Color.Get(view);
+ });
+
+ internal static readonly BindableProperty OpacitySelectorProperty = BindableProperty.Create("OpacitySelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = (View)bindable;
+ view.SelectorData.Opacity.Update(view, (Selector<float?>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = (View)bindable;
+ return view.SelectorData.Opacity.Get(view);
});
/// <summary>
- /// CornerRadius Property
+ /// ImageShadow Selector Property for binding to ViewStyle
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create(nameof(CornerRadius), typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ImageShadowSelectorProperty = BindableProperty.Create("ImageShadowSelector", typeof(Selector<ImageShadow>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var view = (View)bindable;
-
- view.SetValue(View.CornerRadiusSelectorProperty, new Selector<float?>() { All = (float)newValue, });
+ view.SelectorData.ImageShadow.Update(view, (Selector<ImageShadow>)newValue, true);
},
defaultValueCreator: (bindable) =>
{
var view = (View)bindable;
-
- return view.backgroundExtraData == null ? 0 : view.backgroundExtraData.CornerRadius;
+ return view.SelectorData.ImageShadow.Get(view);
});
/// <summary>
- /// CornerRadius Selector Property
+ /// BoxShadow Selector Property for binding to ViewStyle
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty CornerRadiusSelectorProperty = BindableProperty.Create("CornerRadiusSelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty BoxShadowSelectorProperty = BindableProperty.Create("BoxShadowSelector", typeof(Selector<Shadow>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var view = (View)bindable;
-
- var cornerRadiusSelector = (Selector<float?>)newValue;
-
- view.UpdateCornerRadius(cornerRadiusSelector?.GetValue(view.ControlState) ?? 0, cornerRadiusSelector == null ? false : cornerRadiusSelector.HasMultiValue());
+ view.SelectorData.BoxShadow.Update(view, (Selector<Shadow>)newValue, true);
},
defaultValueCreator: (bindable) =>
{
var view = (View)bindable;
-
- return view.viewStyle?.CornerRadius;
+ return view.SelectorData.BoxShadow.Get(view);
});
/// <summary>
- /// XamlStyleProperty
+ /// CornerRadius Selector Property
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty XamlStyleProperty = BindableProperty.Create("XamlStyle", typeof(Style), typeof(View), default(Style), propertyChanged: (bindable, oldvalue, newvalue) => ((View)bindable)._mergedStyle.Style = (Style)newvalue);
+ public static readonly BindableProperty CornerRadiusSelectorProperty = BindableProperty.Create("CornerRadiusSelector", typeof(Selector<float?>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = (View)bindable;
+ view.SelectorData.CornerRadius.Update(view, (Selector<float?>)newValue, true);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = (View)bindable;
+ return view.SelectorData.CornerRadius.Get(view);
+ });
+ #endregion
}
}
public partial class View
{
private MergedStyle mergedStyle = null;
+ private ViewSelectorData selectorData;
+
internal MergedStyle _mergedStyle
{
get
}
}
+ private ViewSelectorData SelectorData
+ {
+ get
+ {
+ if (selectorData == null)
+ {
+ selectorData = new ViewSelectorData();
+ }
+ return selectorData;
+ }
+ }
+
internal void Raise()
{
var parentChildren = GetParent()?.Children;
return (ResourceLoadingStatusType)Interop.View.View_GetVisualResourceStatus(this.swigCPtr, Property.BACKGROUND);
}
- internal virtual void UpdateCornerRadius(float value, bool needToListenStateChanged)
+ internal virtual void UpdateCornerRadius(float value)
{
- ControlStateChangeEventInternal -= OnControlStateChangedForCornerRadius;
-
- if (needToListenStateChanged)
- {
- ControlStateChangeEventInternal += OnControlStateChangedForCornerRadius;
- }
-
if (value != 0)
{
(backgroundExtraData ?? (backgroundExtraData = new BackgroundExtraData())).CornerRadius = value;
//_mergedStyle = null;
+ if (type == DisposeTypes.Explicit)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+ selectorData?.Reset(this);
+ }
+
//Release your own unmanaged resources here.
//You should not access any managed member here except static instance.
//because the execution order of Finalizes is non-deterministic.
view.InternalParent = null;
}
- simpleBinding.Dispose();
- simpleBinding = null;
-
- viewStyle = null;
-
base.Dispose(type);
}
SizeModeFactor = new Vector3(x, y, z);
}
- private void OnControlStateChangedForShadow(object obj, ControlStateChangedEventArgs controlStateChangedInfo)
- {
- var boxShadowSelector = (Selector<Shadow>)GetValue(BoxShadowSelectorProperty);
-
- if (boxShadowSelector != null)
- {
- ShadowBase prevShadow = boxShadowSelector.GetValue(controlStateChangedInfo.PreviousState);
-
- var boxShadow = boxShadowSelector.GetValue(controlStateChangedInfo.CurrentState);
-
- if (boxShadow == prevShadow)
- {
- return;
- }
-
- Tizen.NUI.Object.SetProperty(swigCPtr, View.Property.SHADOW, boxShadow == null ? new PropertyValue() : boxShadow.ToPropertyValue(this));
-
- return;
- }
-
- var imageShadowSelector = (Selector<ImageShadow>)GetValue(ImageShadowSelectorProperty);
-
- if (imageShadowSelector != null)
- {
- ShadowBase prevShadow = imageShadowSelector?.GetValue(controlStateChangedInfo.PreviousState);
-
- var imageShadow = imageShadowSelector.GetValue(controlStateChangedInfo.CurrentState);
-
- if (imageShadow == prevShadow)
- {
- return;
- }
-
- Tizen.NUI.Object.SetProperty(swigCPtr, View.Property.SHADOW, imageShadow == null ? new PropertyValue() : imageShadow.ToPropertyValue(this));
- }
- }
-
- private void UpdateShadow(ShadowBase shadow, bool needToListenStateChanged)
- {
- ControlStateChangeEventInternal -= OnControlStateChangedForShadow;
-
- if (shadow == null)
- {
- Tizen.NUI.Object.SetProperty(swigCPtr, View.Property.SHADOW, new PropertyValue());
- }
- else
- {
- Tizen.NUI.Object.SetProperty(swigCPtr, View.Property.SHADOW, shadow.ToPropertyValue(this));
- }
-
- if (needToListenStateChanged)
- {
- ControlStateChangeEventInternal += OnControlStateChangedForShadow;
- }
- }
-
- private void OnControlStateChangedForCornerRadius(object obj, ControlStateChangedEventArgs controlStateChangedInfo)
- {
- var selector = (Selector<float?>)GetValue(CornerRadiusSelectorProperty);
-
- if (selector == null)
- {
- return;
- }
-
- float? currentCornerRadius = selector.GetValue(controlStateChangedInfo.CurrentState);
-
- if (selector.GetValue(controlStateChangedInfo.PreviousState) == currentCornerRadius)
- {
- UpdateCornerRadius(currentCornerRadius ?? 0, true);
- }
- }
-
private void UpdateShadowCornerRadius(float value)
{
// TODO Update corner radius property only whe DALi supports visual property update.
--- /dev/null
+/*
+ * Copyright(c) 2020 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.
+ *
+ */
+
+namespace Tizen.NUI.BaseComponents
+{
+ /// <summary>
+ /// The class storing extra data for a View to optimize size of it.
+ /// </summary>
+ internal class ViewSelectorData
+ {
+ public TriggerableSelector<Color> BackgroundColor { get; } = new TriggerableSelector<Color>(View.BackgroundColorProperty, delegate(View view)
+ {
+ var background = view.Background;
+ int visualType = 0;
+ background.Find(Visual.Property.Type)?.Get(out visualType);
+
+ if (visualType == (int)Visual.Type.Color)
+ {
+ Color backgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
+ background.Find(ColorVisualProperty.MixColor)?.Get(backgroundColor);
+ return backgroundColor;
+ }
+ return null;
+ });
+ public TriggerableSelector<string> BackgroundImage { get; } = new TriggerableSelector<string>(View.BackgroundImageProperty, delegate(View view)
+ {
+ var background = view.Background;
+ int visualType = 0;
+ background.Find(Visual.Property.Type)?.Get(out visualType);
+
+ if ((visualType == (int)Visual.Type.Image) || (visualType == (int)Visual.Type.NPatch))
+ {
+ string backgroundImage = "";
+ background.Find(ImageVisualProperty.URL)?.Get(out backgroundImage);
+ return backgroundImage;
+ }
+ return null;
+ });
+ public TriggerableSelector<Rectangle> BackgroundImageBorder { get; } = new TriggerableSelector<Rectangle>(View.BackgroundImageBorderProperty);
+ public TriggerableSelector<Color> Color { get; } = new TriggerableSelector<Color>(View.ColorProperty, delegate(View view)
+ {
+ Color color = new Color();
+ if (view.GetProperty(Interop.ActorProperty.Actor_Property_COLOR_get()).Get(color))
+ {
+ return color;
+ }
+ return null;
+ });
+ public TriggerableSelector<float?> Opacity { get; } = new TriggerableSelector<float?>(View.OpacityProperty);
+ public TriggerableSelector<ImageShadow> ImageShadow { get; } = new TriggerableSelector<ImageShadow>(View.ImageShadowProperty);
+ public TriggerableSelector<Shadow> BoxShadow { get; } = new TriggerableSelector<Shadow>(View.BoxShadowProperty);
+ public TriggerableSelector<float?> CornerRadius { get; } = new TriggerableSelector<float?>(View.CornerRadiusProperty);
+
+ public void Reset(View view)
+ {
+ BackgroundColor.Reset(view);
+ BackgroundImage.Reset(view);
+ BackgroundImageBorder.Reset(view);
+ Color.Reset(view);
+ Opacity.Reset(view);
+ ImageShadow.Reset(view);
+ BoxShadow.Reset(view);
+ CornerRadius.Reset(view);
+ }
+ }
+}
}
}
+ /// <summary>
+ /// The copy constructor.
+ /// </summary>
+ /// <param name="other">The copy target.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Color(Color other) : this(other.R, other.G, other.B, other.A)
+ {
+ }
+
internal Color(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
{
hashDummy = false;
}
/// <summary>
+ /// The copy constructor.
+ /// </summary>
+ /// <param name="other">The copy target.</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2(Vector2 other) : this(other.X, other.Y)
+ {
+ }
+
+ /// <summary>
/// The constructor.
/// </summary>
/// <param name="vec3">Vector3 to create this vector from.</param>
+++ /dev/null
-/*
- * Copyright(c) 2020 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.ComponentModel;
-
-namespace Tizen.NUI.Internal
-{
-
- /// <summary>
- /// The class that offer Clone method.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public interface ICloneable
- {
- /// <summary>
- /// Clone object
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- object Clone();
- }
-}
-
-
*
*/
- using System.ComponentModel;
+using System;
+using System.ComponentModel;
namespace Tizen.NUI
{
/// The Shadow composed of image for View
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public class ImageShadow : ShadowBase
+ public class ImageShadow : ShadowBase, ICloneable
{
private static readonly Rectangle noBorder = new Rectangle();
[EditorBrowsable(EditorBrowsableState.Never)]
public ImageShadow() : base()
{
- Border = noBorder;
+ Border = new Rectangle(noBorder);
}
/// <summary>
public ImageShadow(string url, Rectangle border, Vector2 offset, Vector2 extents) : base(offset, extents)
{
Url = url;
- Border = border;
+ Border = new Rectangle(border);
}
/// <summary>
}
}
+ /// <inheritdoc/>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object Clone() => new ImageShadow(this);
+
internal override bool IsEmpty()
{
return string.IsNullOrEmpty(Url);
*
*/
- using System.ComponentModel;
+using System;
+using System.ComponentModel;
namespace Tizen.NUI
{
/// Represents a shadow with color and blur radius for a View.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public class Shadow : ShadowBase
+ public class Shadow : ShadowBase, ICloneable
{
private static readonly Color noColor = new Color(0, 0, 0, 0);
public Shadow(float blurRadius, Vector2 offset, Color color, Vector2 extents) : base(offset, extents)
{
BlurRadius = blurRadius;
- Color = color;
+ Color = new Color(color);
}
/// <summary>
}
}
+ /// <inheritdoc/>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object Clone() => new Shadow(this);
+
internal override bool IsEmpty()
{
return (Color == null || Color.A == 0);
[EditorBrowsable(EditorBrowsableState.Never)]
protected ShadowBase(Vector2 offset, Vector2 extents)
{
- Offset = offset;
- Extents = extents;
+ Offset = new Vector2(offset);
+ Extents = new Vector2(extents);
}
/// <summary></summary>
*
*/
+using System;
using System.ComponentModel;
namespace Tizen.NUI
/// The Text Shadow for TextLabel.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public class TextShadow : Internal.ICloneable
+ public class TextShadow : ICloneable
{
- private PropertyMap propertyMap = null;
+ private readonly PropertyMap propertyMap = null;
internal delegate void PropertyChangedCallback(TextShadow instance);
- internal PropertyChangedCallback OnPropertyChanged = null;
/// <summary>
/// Constructor
[EditorBrowsable(EditorBrowsableState.Never)]
public float BlurRadius { get; } = 0.0f;
- internal TextShadow(TextShadow other, PropertyChangedCallback callback = null)
+ internal TextShadow(PropertyMap propertyMap)
+ {
+ this.propertyMap = new PropertyMap(propertyMap);
+ }
+
+ internal TextShadow(TextShadow other)
{
propertyMap = new PropertyMap();
BlurRadius = other.BlurRadius;
propertyMap["blurRadius"] = new PropertyValue(BlurRadius);
-
- OnPropertyChanged = callback;
}
static internal PropertyValue ToPropertyValue(TextShadow instance)