/*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2019-2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.StyleName, new Tizen.NUI.PropertyValue(styleName));
view.styleName = styleName;
- view.UpdateStyle();
- view.ThemeChangeSensitive = true;
+
+ if (string.IsNullOrEmpty(styleName)) return;
+
+ var style = ThemeManager.GetUpdateStyleWithoutClone(styleName);
+
+ if (style == null) return;
+
+ view.ApplyStyle(style);
+ view.SetThemeApplied();
}
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
public static readonly BindableProperty BackgroundColorProperty = BindableProperty.Create(nameof(BackgroundColor), typeof(Color), typeof(View), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
{
var view = (View)bindable;
- if (newValue != null)
- {
- if (view.backgroundExtraData == null)
- {
- Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.BACKGROUND, new PropertyValue((Color)newValue));
- return;
- }
- PropertyMap map = new PropertyMap();
+ view.themeData?.selectorData?.ClearBackground(view);
- map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color))
- .Add(ColorVisualProperty.MixColor, new PropertyValue((Color)newValue))
- .Add(Visual.Property.CornerRadius, new PropertyValue(view.backgroundExtraData.CornerRadius));
-
- Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.BACKGROUND, new PropertyValue(map));
+ if (newValue is Selector<Color> selector)
+ {
+ if (selector.HasAll()) view.SetBackgroundColor(selector.All);
+ else view.EnsureSelectorData().BackgroundColor = new TriggerableSelector<Color>(view, selector, view.SetBackgroundColor, true);
+ }
+ else
+ {
+ view.SetBackgroundColor((Color)newValue);
}
}),
defaultValueCreator: (bindable) =>
public static readonly BindableProperty ColorProperty = BindableProperty.Create(nameof(Color), typeof(Color), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var view = (View)bindable;
- if (newValue != null)
+
+ view.themeData?.selectorData?.Color?.Reset(view);
+
+ if (newValue is Selector<Color> selector)
+ {
+ if (selector.HasAll()) view.SetColor(selector.All);
+ else view.EnsureSelectorData().Color = new TriggerableSelector<Color>(view, selector, view.SetColor, true);
+ }
+ else
{
view.SetColor((Color)newValue);
}
view.GetProperty(Interop.ActorProperty.ColorGet()).Get(color);
return color;
});
-
/// <summary> BackgroundImageProperty </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly BindableProperty BackgroundImageProperty = BindableProperty.Create(nameof(BackgroundImage), typeof(string), typeof(View), default(string), propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
{
var view = (View)bindable;
- string url = (string)newValue;
- if (string.IsNullOrEmpty(url))
+ if (view.themeData?.selectorData != null)
{
- // Clear background
- Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.BACKGROUND, new PropertyValue());
- return;
- }
-
- if (view.backgroundExtraData == null)
- {
- Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.BACKGROUND, new PropertyValue(url));
- view.BackgroundImageSynchronosLoading = view.backgroundImageSynchronosLoading;
-
- return;
+ view.themeData.selectorData.BackgroundColor?.Reset(view);
+ view.themeData.selectorData.BackgroundImage?.Reset(view);
}
- PropertyMap map = new PropertyMap();
-
- map.Add(ImageVisualProperty.URL, new PropertyValue(url))
- .Add(Visual.Property.CornerRadius, new PropertyValue(view.backgroundExtraData.CornerRadius))
- .Add(ImageVisualProperty.SynchronousLoading, new PropertyValue(view.backgroundImageSynchronosLoading));
-
- if (view.backgroundExtraData.BackgroundImageBorder != null)
+ if (newValue is Selector<string> selector)
{
- map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch))
- .Add(NpatchImageVisualProperty.Border, new PropertyValue(view.backgroundExtraData.BackgroundImageBorder));
+ if (selector.HasAll()) view.SetBackgroundImage(selector.All);
+ else view.EnsureSelectorData().BackgroundImage = new TriggerableSelector<string>(view, selector, view.SetBackgroundImage, true);
}
else
{
- map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
+ view.SetBackgroundImage((string)newValue);
}
-
- Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.BACKGROUND, new PropertyValue(map));
}),
defaultValueCreator: (bindable) =>
{
{
var view = (View)bindable;
- bool isEmptyValue = Rectangle.IsNullOrZero((Rectangle)newValue);
-
- var backgroundImageBorder = isEmptyValue ? null : (Rectangle)newValue;
-
- (view.backgroundExtraData ?? (view.backgroundExtraData = new BackgroundExtraData())).BackgroundImageBorder = backgroundImageBorder;
+ view.themeData?.selectorData?.BackgroundImageBorder?.Reset(view);
- if (isEmptyValue)
+ if (newValue is Selector<Rectangle> selector)
{
- return;
+ if (selector.HasAll()) view.SetBackgroundImageBorder(selector.All);
+ else view.EnsureSelectorData().BackgroundImageBorder = new TriggerableSelector<Rectangle>(view, selector, view.SetBackgroundImageBorder, true);
}
-
- PropertyMap map = view.Background;
-
- if (map.Empty())
- {
- return;
- }
-
- map[NpatchImageVisualProperty.Border] = new PropertyValue(backgroundImageBorder);
-
- int visualType = 0;
-
- map.Find(Visual.Property.Type)?.Get(out visualType);
-
- if (visualType == (int)Visual.Type.Image)
+ else
{
- map[Visual.Property.Type] = new PropertyValue((int)Visual.Type.NPatch);
+ view.SetBackgroundImageBorder((Rectangle)newValue);
}
-
- Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.BACKGROUND, new PropertyValue(map));
-
}),
defaultValueCreator: (bindable) =>
{
});
/// <summary>
+ /// FocusableChildrenProperty
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty FocusableChildrenProperty = BindableProperty.Create(nameof(FocusableChildren), typeof(bool), typeof(View), true, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = (View)bindable;
+ if (newValue != null) { view.SetKeyboardFocusableChildren((bool)newValue); }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = (View)bindable;
+ return view.AreChildrenKeyBoardFocusable();
+ });
+
+ /// <summary>
+ /// FocusableInTouchProperty
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty FocusableInTouchProperty = BindableProperty.Create(nameof(FocusableInTouch), typeof(bool), typeof(View), false, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = (View)bindable;
+ if (newValue != null) { view.SetFocusableInTouch((bool)newValue); }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = (View)bindable;
+ return view.IsFocusableInTouch();
+ });
+
+ /// <summary>
/// Size2DProperty
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
{
var view = (View)bindable;
- if (newValue != null)
+ view.themeData?.selectorData?.Opacity?.Reset(view);
+
+ if (newValue is Selector<float?> selector)
+ {
+ if (selector.HasAll()) view.SetOpacity(selector.All);
+ else view.EnsureSelectorData().Opacity = new TriggerableSelector<float?>(view, selector, view.SetOpacity, true);
+ }
+ else
{
- Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.OPACITY, new Tizen.NUI.PropertyValue((float)newValue));
+ view.SetOpacity((float?)newValue);
}
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
var view = (View)bindable;
if (newValue != null)
{
- Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.WidthResizePolicy, new Tizen.NUI.PropertyValue((int)newValue));
+ if((ResizePolicyType)newValue == ResizePolicyType.KeepSizeFollowingParent)
+ {
+ if(view.widthConstraint == null)
+ {
+ view.widthConstraint = new EqualConstraintWithParentFloat((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.SizeWidth, View.Property.SizeWidth);
+ view.widthConstraint.Apply();
+ }
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.WidthResizePolicy, new Tizen.NUI.PropertyValue((int)ResizePolicyType.FillToParent));
+ }
+ else
+ {
+ view.widthConstraint?.Remove();
+ view.widthConstraint?.Dispose();
+ view.widthConstraint = null;
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.WidthResizePolicy, new Tizen.NUI.PropertyValue((int)newValue));
+ }
// Match ResizePolicy to new Layouting.
// Parent relative policies can not be mapped at this point as parent size unknown.
switch ((ResizePolicyType)newValue)
var view = (View)bindable;
if (newValue != null)
{
- Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.HeightResizePolicy, new Tizen.NUI.PropertyValue((int)newValue));
+ if((ResizePolicyType)newValue == ResizePolicyType.KeepSizeFollowingParent)
+ {
+ if(view.heightConstraint == null)
+ {
+ view.heightConstraint = new EqualConstraintWithParentFloat((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.SizeHeight, View.Property.SizeHeight);
+ view.heightConstraint.Apply();
+ }
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.HeightResizePolicy, new Tizen.NUI.PropertyValue((int)ResizePolicyType.FillToParent));
+ }
+ else
+ {
+ view.heightConstraint?.Remove();
+ view.heightConstraint?.Dispose();
+ view.heightConstraint = null;
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.HeightResizePolicy, new Tizen.NUI.PropertyValue((int)newValue));
+ }
// Match ResizePolicy to new Layouting.
// Parent relative policies can not be mapped at this point as parent size unknown.
switch ((ResizePolicyType)newValue)
if (newValue != null)
{
Size size = (Size)newValue;
- Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.SIZE, new Tizen.NUI.PropertyValue(size));
// Set Specification so when layouts measure this View it matches the value set here.
// All Views are currently Layouts.
view.WidthSpecification = (int)System.Math.Ceiling(size.Width);
view.HeightSpecification = (int)System.Math.Ceiling(size.Height);
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.SIZE, new Tizen.NUI.PropertyValue(size));
}
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly BindableProperty ImageShadowProperty = BindableProperty.Create(nameof(ImageShadow), typeof(ImageShadow), typeof(View), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
{
- var shadow = (ImageShadow)newValue;
var view = (View)bindable;
- Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.SHADOW, shadow == null ? new PropertyValue() : shadow.ToPropertyValue(view));
+
+ view.themeData?.selectorData?.ClearShadow(view);
+
+ if (newValue is Selector<ImageShadow> selector)
+ {
+ if (selector.HasAll()) view.SetShadow(selector.All);
+ else view.EnsureSelectorData().ImageShadow = new TriggerableSelector<ImageShadow>(view, selector, view.SetShadow, true);
+ }
+ else
+ {
+ view.SetShadow((ImageShadow)newValue);
+ }
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
{
[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly BindableProperty BoxShadowProperty = BindableProperty.Create(nameof(BoxShadow), typeof(Shadow), typeof(View), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
{
- var shadow = (Shadow)newValue;
var view = (View)bindable;
- Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.SHADOW, shadow == null ? new PropertyValue() : shadow.ToPropertyValue(view));
+
+ view.themeData?.selectorData?.ClearShadow(view);
+
+ if (newValue is Selector<Shadow> selector)
+ {
+ if (selector.HasAll()) view.SetShadow(selector.All);
+ else view.EnsureSelectorData().BoxShadow = new TriggerableSelector<Shadow>(view, selector, view.SetShadow, true);
+ }
+ else
+ {
+ view.SetShadow((Shadow)newValue);
+ }
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
{
/// CornerRadius Property
/// </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 CornerRadiusProperty = BindableProperty.Create(nameof(CornerRadius), typeof(Vector4), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var view = (View)bindable;
- (view.backgroundExtraData ?? (view.backgroundExtraData = new BackgroundExtraData())).CornerRadius = (float)newValue;
+ (view.backgroundExtraData ?? (view.backgroundExtraData = new BackgroundExtraData())).CornerRadius = (Vector4)newValue;
view.ApplyCornerRadius();
},
defaultValueCreator: (bindable) =>
{
var view = (View)bindable;
- return view.backgroundExtraData == null ? 0 : view.backgroundExtraData.CornerRadius;
+ return view.backgroundExtraData == null ? 0.0f : view.backgroundExtraData.CornerRadius;
});
/// <summary>
{
var view = (View)bindable;
(view.backgroundExtraData ?? (view.backgroundExtraData = new BackgroundExtraData())).CornerRadiusPolicy = (VisualTransformPolicyType)newValue;
- if (view.backgroundExtraData.CornerRadius != 0)
+
+ if (view.backgroundExtraData.CornerRadius != null)
{
view.ApplyCornerRadius();
}
});
/// <summary>
+ /// BorderlineWidth Property
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty BorderlineWidthProperty = BindableProperty.Create(nameof(BorderlineWidth), typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = (View)bindable;
+ (view.backgroundExtraData ?? (view.backgroundExtraData = new BackgroundExtraData())).BorderlineWidth = (float)newValue;
+ view.ApplyBorderline();
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = (View)bindable;
+ return view.backgroundExtraData == null ? 0.0f : view.backgroundExtraData.BorderlineWidth;
+ });
+
+ /// <summary>
+ /// BorderlineColor Property
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty BorderlineColorProperty = BindableProperty.Create(nameof(BorderlineColor), typeof(Color), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = (View)bindable;
+ (view.backgroundExtraData ?? (view.backgroundExtraData = new BackgroundExtraData())).BorderlineColor = (Color)newValue;
+ view.ApplyBorderline();
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = (View)bindable;
+ return view.backgroundExtraData == null ? Color.Black : view.backgroundExtraData.BorderlineColor;
+ });
+
+ /// <summary>
+ /// BorderlineOffset Property
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty BorderlineOffsetProperty = BindableProperty.Create(nameof(BorderlineOffset), typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var view = (View)bindable;
+ (view.backgroundExtraData ?? (view.backgroundExtraData = new BackgroundExtraData())).BorderlineOffset = (float)newValue;
+ view.ApplyBorderline();
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var view = (View)bindable;
+ return view.backgroundExtraData == null ? 0.0f : view.backgroundExtraData.BorderlineOffset;
+ });
+
+ /// <summary>
/// EnableControlState property
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
{
var view = (View)bindable;
- if (view.themeChangeSensitive == (bool)newValue) return;
+ if (view.ThemeChangeSensitive == (bool)newValue) return;
+
+ if (view.themeData == null) view.themeData = new ThemeData();
- view.themeChangeSensitive = (bool)newValue;
+ view.themeData.ThemeChangeSensitive = (bool)newValue;
- if (view.themeChangeSensitive)
+ if (!view.themeData.ThemeApplied) return;
+
+ if (view.themeData.ThemeChangeSensitive && !view.themeData.ListeningThemeChangeEvent)
{
+ view.themeData.ListeningThemeChangeEvent = true;
ThemeManager.ThemeChangedInternal.Add(view.OnThemeChanged);
}
- else
+ else if (!view.themeData.ThemeChangeSensitive && view.themeData.ListeningThemeChangeEvent)
{
+ view.themeData.ListeningThemeChangeEvent = false;
ThemeManager.ThemeChangedInternal.Remove(view.OnThemeChanged);
}
},
defaultValueCreator: (bindable) =>
{
- return ((View)bindable).themeChangeSensitive;
- });
-
- #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);
- if (newValue != null) view.SelectorData.BackgroundColor.Reset(view);
- },
- defaultValueCreator: (bindable) =>
- {
- var view = (View)bindable;
- return view.SelectorData.BackgroundImage.Get(view);
+ return ((View)bindable).themeData?.ThemeChangeSensitive ?? ThemeManager.ApplicationThemeChangeSensitive;
});
- internal static readonly BindableProperty BackgroundColorSelectorProperty = BindableProperty.Create("BackgroundColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ /// <summary>
+ /// AccessibilityNameProperty
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty AccessibilityNameProperty = BindableProperty.Create(nameof(AccessibilityName), typeof(string), typeof(View), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
{
var view = (View)bindable;
- view.SelectorData.BackgroundColor.Update(view, (Selector<Color>)newValue, true);
- if (newValue != null) view.SelectorData.BackgroundImage.Reset(view);
+ if (newValue != null)
+ {
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityName, new Tizen.NUI.PropertyValue((string)newValue));
+ }
},
defaultValueCreator: (bindable) =>
{
var view = (View)bindable;
- return view.SelectorData.BackgroundColor.Get(view);
- });
- 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);
+ string temp;
+ Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityName).Get(out temp);
+ return temp;
});
- internal static readonly BindableProperty ColorSelectorProperty = BindableProperty.Create("ColorSelector", typeof(Selector<Color>), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
+ /// <summary>
+ /// AccessibilityDescriptionProperty
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty AccessibilityDescriptionProperty = BindableProperty.Create(nameof(AccessibilityDescription), typeof(string), typeof(View), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
{
var view = (View)bindable;
- view.SelectorData.Color.Update(view, (Selector<Color>)newValue, true);
+ if (newValue != null)
+ {
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityDescription, new Tizen.NUI.PropertyValue((string)newValue));
+ }
},
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);
+ string temp;
+ Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityDescription).Get(out temp);
+ return temp;
});
/// <summary>
- /// ImageShadow Selector Property for binding to ViewStyle
+ /// AccessibilityTranslationDomainProperty
/// </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 AccessibilityTranslationDomainProperty = BindableProperty.Create(nameof(AccessibilityTranslationDomain), typeof(string), typeof(View), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
{
var view = (View)bindable;
- view.SelectorData.ImageShadow.Update(view, (Selector<ImageShadow>)newValue, true);
- if (newValue != null) view.SelectorData.BoxShadow.Reset(view);
+ if (newValue != null)
+ {
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityTranslationDomain, new Tizen.NUI.PropertyValue((string)newValue));
+ }
},
defaultValueCreator: (bindable) =>
{
var view = (View)bindable;
- return view.SelectorData.ImageShadow.Get(view);
+
+ string temp;
+ Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityTranslationDomain).Get(out temp);
+ return temp;
});
/// <summary>
- /// BoxShadow Selector Property for binding to ViewStyle
+ /// AccessibilityRoleProperty
/// </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 AccessibilityRoleProperty = BindableProperty.Create(nameof(AccessibilityRole), typeof(int), typeof(View), default(int), propertyChanged: (bindable, oldValue, newValue) =>
{
var view = (View)bindable;
- view.SelectorData.BoxShadow.Update(view, (Selector<Shadow>)newValue, true);
- if (newValue != null) view.SelectorData.ImageShadow.Reset(view);
+ if (newValue != null)
+ {
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityRole, new Tizen.NUI.PropertyValue((int)newValue));
+ }
},
defaultValueCreator: (bindable) =>
{
var view = (View)bindable;
- return view.SelectorData.BoxShadow.Get(view);
+
+ int temp = 0;
+ Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityRole).Get(out temp);
+ return temp;
});
/// <summary>
- /// CornerRadius Selector Property
+ /// AccessibilityHighlightableProperty
/// </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 AccessibilityHighlightableProperty = BindableProperty.Create(nameof(AccessibilityHighlightable), typeof(bool), typeof(View), false, propertyChanged: (bindable, oldValue, newValue) =>
{
var view = (View)bindable;
- view.SelectorData.CornerRadius.Update(view, (Selector<float?>)newValue, true);
+ if (newValue != null)
+ {
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityHighlightable, new Tizen.NUI.PropertyValue((bool)newValue));
+ }
},
defaultValueCreator: (bindable) =>
{
var view = (View)bindable;
- return view.SelectorData.CornerRadius.Get(view);
+ bool temp = false;
+ Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityHighlightable).Get(out temp);
+ return temp;
});
- #endregion
+
+ private void SetBackgroundImage(string value)
+ {
+ if (string.IsNullOrEmpty(value))
+ {
+ // Clear background
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, View.Property.BACKGROUND, new PropertyValue());
+ return;
+ }
+
+ if (value.StartsWith("*Resource*"))
+ {
+ string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
+ value = value.Replace("*Resource*", resource);
+ }
+
+ if (backgroundExtraData == null)
+ {
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, View.Property.BACKGROUND, new PropertyValue(value));
+ BackgroundImageSynchronosLoading = backgroundImageSynchronosLoading;
+
+ return;
+ }
+
+ PropertyMap map = new PropertyMap();
+
+ map.Add(ImageVisualProperty.URL, new PropertyValue(value))
+ .Add(Visual.Property.CornerRadius, new PropertyValue(backgroundExtraData.CornerRadius == null ? new PropertyValue() : new PropertyValue(backgroundExtraData.CornerRadius)))
+ .Add(Visual.Property.CornerRadiusPolicy, new PropertyValue((int)(backgroundExtraData.CornerRadiusPolicy)))
+ .Add(Visual.Property.BorderlineWidth, new PropertyValue(backgroundExtraData.BorderlineWidth))
+ .Add(Visual.Property.BorderlineColor, new PropertyValue(backgroundExtraData.BorderlineColor == null ? new PropertyValue(Color.Black) : new PropertyValue(backgroundExtraData.BorderlineColor)))
+ .Add(Visual.Property.BorderlineOffset, new PropertyValue(backgroundExtraData.BorderlineOffset))
+ .Add(ImageVisualProperty.SynchronousLoading, new PropertyValue(backgroundImageSynchronosLoading));
+
+ if (backgroundExtraData.BackgroundImageBorder != null)
+ {
+ map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch))
+ .Add(NpatchImageVisualProperty.Border, new PropertyValue(backgroundExtraData.BackgroundImageBorder));
+ }
+ else
+ {
+ map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
+ }
+
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, View.Property.BACKGROUND, new PropertyValue(map));
+ }
+
+ private void SetBackgroundImageBorder(Rectangle value)
+ {
+ bool isEmptyValue = Rectangle.IsNullOrZero(value);
+
+ var backgroundImageBorder = isEmptyValue ? null : value;
+
+ (backgroundExtraData ?? (backgroundExtraData = new BackgroundExtraData())).BackgroundImageBorder = backgroundImageBorder;
+
+ if (isEmptyValue)
+ {
+ return;
+ }
+
+ PropertyMap map = Background;
+
+ if (map.Empty())
+ {
+ return;
+ }
+
+ map[NpatchImageVisualProperty.Border] = new PropertyValue(backgroundImageBorder);
+
+ int visualType = 0;
+
+ map.Find(Visual.Property.Type)?.Get(out visualType);
+
+ if (visualType == (int)Visual.Type.Image)
+ {
+ map[Visual.Property.Type] = new PropertyValue((int)Visual.Type.NPatch);
+ }
+
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, View.Property.BACKGROUND, new PropertyValue(map));
+ }
+
+ private void SetBackgroundColor(Color value)
+ {
+ if (value == null)
+ {
+ return;
+ }
+
+ if (backgroundExtraData == null)
+ {
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, View.Property.BACKGROUND, new PropertyValue(value));
+ return;
+ }
+
+ PropertyMap map = new PropertyMap();
+
+ map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color))
+ .Add(ColorVisualProperty.MixColor, new PropertyValue(value))
+ .Add(Visual.Property.CornerRadius, new PropertyValue(new PropertyValue(backgroundExtraData.CornerRadius == null ? new PropertyValue() : new PropertyValue(backgroundExtraData.CornerRadius))))
+ .Add(Visual.Property.CornerRadiusPolicy, new PropertyValue((int)(backgroundExtraData.CornerRadiusPolicy)))
+ .Add(Visual.Property.BorderlineWidth, new PropertyValue(backgroundExtraData.BorderlineWidth))
+ .Add(Visual.Property.BorderlineColor, new PropertyValue(backgroundExtraData.BorderlineColor == null ? new PropertyValue(Color.Black) : new PropertyValue(backgroundExtraData.BorderlineColor)))
+ .Add(Visual.Property.BorderlineOffset, new PropertyValue(backgroundExtraData.BorderlineOffset));
+
+
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, View.Property.BACKGROUND, new PropertyValue(map));
+ }
+
+ private void SetColor(Color value)
+ {
+ if (value == null)
+ {
+ return;
+ }
+
+ Interop.ActorInternal.SetColor(SwigCPtr, value.SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ private void SetOpacity(float? value)
+ {
+ if (value == null)
+ {
+ return;
+ }
+
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, View.Property.OPACITY, new Tizen.NUI.PropertyValue((float)value));
+ }
+
+ private void SetShadow(ShadowBase value)
+ {
+ Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)SwigCPtr, View.Property.SHADOW, value == null ? new PropertyValue() : value.ToPropertyValue(this));
+ }
}
}