var textLabelStyle = (TextLabelStyle)bindable;
return textLabelStyle.matchSystemLanguageDirection;
});
+ /// 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) =>
+ {
+ var textLabelStyle = (TextLabelStyle)bindable;
+ textLabelStyle.textShadow = SelectorHelper.CopyCloneable<TextShadow>(newValue);
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabelStyle = (TextLabelStyle)bindable;
+ return textLabelStyle.textShadow;
+ });
private bool? multiLine;
private HorizontalAlignment? horizontalAlignment;
private Selector<string> textSelector;
private Selector<Color> textColorSelector;
private Selector<float?> pointSizeSelector;
+ private Selector<TextShadow> textShadow;
static TextLabelStyle() { }
}
set => SetValue(PointSizeSelectorProperty, value);
}
+
+ /// 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<TextShadow> TextShadow
+ {
+ get => (Selector<TextShadow>)GetValue(TextShadowProperty);
+ set => SetValue(TextShadowProperty, value);
+ }
}
}
});
/// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty TextShadowProperty = BindableProperty.Create(nameof(TextShadow), typeof(TextShadow), typeof(TextLabel), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ 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()));
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var textLabel = (TextLabel)bindable;
+ return textLabel.textShadow?.GetValue();
+ });
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
public static readonly BindableProperty EmbossProperty = BindableProperty.Create(nameof(Emboss), typeof(string), typeof(TextLabel), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
{
var textLabel = (TextLabel)bindable;
private string textLabelSid = null;
private bool systemlangTextFlag = false;
+ 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.
[EditorBrowsable(EditorBrowsableState.Never)]
public TextLabelStyle Style => ViewStyle as TextLabelStyle;
}
}
+ /// <summary>
+ /// Describes a text shadow for a TextLabel.
+ /// It is null by default.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TextShadow TextShadow
+ {
+ get
+ {
+ var value = (TextShadow)GetValue(TextShadowProperty);
+ return value == null ? null : new TextShadow(value, OnTextShadowChanged);
+ }
+ set
+ {
+ SetValue(TextShadowProperty, value);
+ NotifyPropertyChanged();
+ }
+ }
+
/// <summary>
/// The Emboss property.<br />
/// The default emboss parameters.<br />
UnderlineColor = new Vector4(x, y, z, w);
}
+ private void OnTextShadowChanged(TextShadow instance)
+ {
+ TextShadow = instance;
+ }
+
+ private void OnControlStateChangedForShadow(View obj, Components.ControlStates state)
+ {
+ UpdateTextShadowVisual();
+ }
+
+ private void UpdateTextShadowVisual()
+ {
+ TextShadow shadow = (textShadow != null && !textShadow.IsEmpty()) ? textShadow.GetValue() : textShadow?.GetValue();
+ Object.SetProperty(swigCPtr, Property.SHADOW, TextShadow.ToPropertyValue(shadow));
+ }
}
}
--- /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
+{
+ /// <summary>
+ /// The Text Shadow for TextLabel.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class TextShadow : Internal.ICloneable
+ {
+ private PropertyMap propertyMap = null;
+
+ internal delegate void PropertyChangedCallback(TextShadow instance);
+ internal PropertyChangedCallback OnPropertyChanged = null;
+
+ /// <summary>
+ /// Constructor
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public TextShadow(Color color, Vector2 offset, float blurRadius)
+ {
+ propertyMap = new PropertyMap();
+
+ Color = color;
+ propertyMap["color"] = PropertyValue.CreateWithGuard(Color);
+
+ Offset = offset;
+ propertyMap["offset"] = PropertyValue.CreateWithGuard(Offset);
+
+ BlurRadius = blurRadius;
+ propertyMap["blurRadius"] = new PropertyValue(BlurRadius);
+ }
+
+ /// <summary>
+ /// Deep copy method
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object Clone()
+ {
+ return new TextShadow(Color, Offset, BlurRadius);
+ }
+
+ /// <summary>
+ /// Deep copy method (static)
+ /// This provides nullity check.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static object Clone(TextShadow instance)
+ {
+ return instance == null ? null : new TextShadow(instance.Color, instance.Offset, instance.BlurRadius);
+ }
+
+ /// <summary>
+ /// The color for the shadow of text.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Color Color { get; } = Color.Black;
+
+ /// <summary>
+ /// The offset for the shadow of text.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Vector2 Offset { get; } = Vector2.Zero;
+
+ /// <summary>
+ /// The blur radius of the shadow of text.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float BlurRadius { get; } = 0.0f;
+
+ internal TextShadow(TextShadow other, PropertyChangedCallback callback = null)
+ {
+ propertyMap = new PropertyMap();
+
+ Color = other.Color;
+ propertyMap["color"] = PropertyValue.CreateWithGuard(Color);
+
+ Offset = other.Offset;
+ propertyMap["offset"] = PropertyValue.CreateWithGuard(Offset);
+
+ BlurRadius = other.BlurRadius;
+ propertyMap["blurRadius"] = new PropertyValue(BlurRadius);
+
+ OnPropertyChanged = callback;
+ }
+
+ static internal PropertyValue ToPropertyValue(TextShadow instance)
+ {
+ if (instance == null)
+ {
+ return new PropertyValue();
+ }
+
+ return new PropertyValue(instance.propertyMap);
+ }
+ }
+}
textButton.Style.BackgroundImageBorder = new Rectangle(4, 4, 5, 5);
textButton.Size2D = new Size2D(300, 80);
textButton.Position2D = new Position2D(100, 100);
+ textButton.Style.Text.TextShadow = new TextShadow(Color.Blue, new Vector2(2.0f, 2.0f), 5.0f);
textButton.Style.Text.Text = "Button";
root.Add(textButton);