X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FBaseComponents%2FStyle%2FTextLabelStyle.cs;h=a5a9aa5f79939b83b9af4cea107b1186c22fad92;hb=86065d1d6c8225a8ab1ee43a0ddbf5dc9e883894;hp=4facd3d8bfcf2c80ce5245015a01ba5a1d2a0fbc;hpb=2a68a2cc7e558d87a4d891df548058a9e94ac301;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.NUI/src/public/BaseComponents/Style/TextLabelStyle.cs b/src/Tizen.NUI/src/public/BaseComponents/Style/TextLabelStyle.cs index 4facd3d..a5a9aa5 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/Style/TextLabelStyle.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/Style/TextLabelStyle.cs @@ -27,85 +27,70 @@ namespace Tizen.NUI.BaseComponents [EditorBrowsable(EditorBrowsableState.Never)] public class TextLabelStyle : ViewStyle { - private bool? multiLine; - private HorizontalAlignment? horizontalAlignment; - private VerticalAlignment? verticalAlignment; - private bool? enableMarkup; - private bool? enableAutoScroll; - private int? autoScrollSpeed; - private int? autoScrollLoopCount; - private float? autoScrollGap; - private float? lineSpacing; - private string emboss; - private float? pixelSize; - private bool? ellipsis; - private float? autoScrollLoopDelay; - private AutoScrollStopMode? autoScrollStopMode; - private LineWrapMode? lineWrapMode; - private VerticalLineAlignment? verticalLineAlignment; - private bool? matchSystemLanguageDirection; - - static TextLabelStyle() { } - /// 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 TranslatableTextSelectorProperty = BindableProperty.Create(nameof(TranslatableTextSelector), typeof(Selector), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TranslatableTextSelectorProperty = BindableProperty.Create("TranslatableTextSelector", typeof(Selector), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) => { var textFieldStyle = (TextLabelStyle)bindable; - textFieldStyle.TranslatableTextSelector.Clone((Selector)newValue); + if (null == textFieldStyle.translatableTextSelector) textFieldStyle.translatableTextSelector = new Selector(); + textFieldStyle.translatableTextSelector.Clone(null == newValue ? new Selector() : (Selector)newValue); }, defaultValueCreator: (bindable) => { var textFieldStyle = (TextLabelStyle)bindable; - return textFieldStyle.TranslatableTextSelector; + return textFieldStyle.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(nameof(TextSelector), typeof(Selector), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TextSelectorProperty = BindableProperty.Create("TextSelector", typeof(Selector), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) => { var textFieldStyle = (TextLabelStyle)bindable; - textFieldStyle.TextSelector.Clone((Selector)newValue); + if (null == textFieldStyle.textSelector) textFieldStyle.textSelector = new Selector(); + textFieldStyle.textSelector.Clone(null == newValue ? new Selector() : (Selector)newValue); }, defaultValueCreator: (bindable) => { var textFieldStyle = (TextLabelStyle)bindable; - return textFieldStyle.TextSelector; + return textFieldStyle.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(nameof(FontFamilySelector), typeof(Selector), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty FontFamilySelectorProperty = BindableProperty.Create("FontFamilySelector", typeof(Selector), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) => { var textFieldStyle = (TextLabelStyle)bindable; - textFieldStyle.FontFamilySelector.Clone((Selector)newValue); + if (null == textFieldStyle.fontFamilySelector) textFieldStyle.fontFamilySelector = new Selector(); + textFieldStyle.fontFamilySelector.Clone(null == newValue ? new Selector() : (Selector)newValue); }, defaultValueCreator: (bindable) => { var textFieldStyle = (TextLabelStyle)bindable; - return textFieldStyle.FontFamilySelector; + return textFieldStyle.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(nameof(PointSizeSelector), typeof(Selector), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty PointSizeSelectorProperty = BindableProperty.Create("PointSizeSelector", typeof(Selector), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) => { var textFieldStyle = (TextLabelStyle)bindable; - textFieldStyle.PointSizeSelector.Clone((Selector)newValue); + if (null == textFieldStyle.pointSizeSelector) textFieldStyle.pointSizeSelector = new Selector(); + textFieldStyle.pointSizeSelector.Clone(null == newValue ? new Selector() : (Selector)newValue); }, defaultValueCreator: (bindable) => { var textFieldStyle = (TextLabelStyle)bindable; - return textFieldStyle.PointSizeSelector; + return textFieldStyle.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(nameof(TextColorSelector), typeof(Selector), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty TextColorSelectorProperty = BindableProperty.Create("TextColorSelector", typeof(Selector), typeof(TextLabelStyle), null, propertyChanged: (bindable, oldValue, newValue) => { var textFieldStyle = (TextLabelStyle)bindable; - textFieldStyle.TextColorSelector.Clone((Selector)newValue); + if (null == textFieldStyle.textColorSelector) textFieldStyle.textColorSelector = new Selector(); + textFieldStyle.textColorSelector.Clone(null == newValue ? new Selector() : (Selector)newValue); }, defaultValueCreator: (bindable) => { var textFieldStyle = (TextLabelStyle)bindable; - return textFieldStyle.TextColorSelector; + return textFieldStyle.textColorSelector; }); /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API. @@ -313,389 +298,225 @@ namespace Tizen.NUI.BaseComponents return textLabelStyle.matchSystemLanguageDirection; }); + private bool? multiLine; + private HorizontalAlignment? horizontalAlignment; + private VerticalAlignment? verticalAlignment; + private bool? enableMarkup; + private bool? enableAutoScroll; + private int? autoScrollSpeed; + private int? autoScrollLoopCount; + private float? autoScrollGap; + private float? lineSpacing; + private string emboss; + private float? pixelSize; + private bool? ellipsis; + private float? autoScrollLoopDelay; + private AutoScrollStopMode? autoScrollStopMode; + private LineWrapMode? lineWrapMode; + private VerticalLineAlignment? verticalLineAlignment; + private bool? matchSystemLanguageDirection; private Selector translatableTextSelector; - private Selector TranslatableTextSelector - { - get - { - if (null == translatableTextSelector) - { - translatableTextSelector = new Selector(); - } - return translatableTextSelector; - } - } + private Selector fontFamilySelector; + private Selector textSelector; + private Selector textColorSelector; + private Selector pointSizeSelector; + + static TextLabelStyle() { } + /// 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 TranslatableText { get { - return (Selector)GetValue(TranslatableTextSelectorProperty); - } - set - { - SetValue(TranslatableTextSelectorProperty, value); + Selector tmp = (Selector)GetValue(TranslatableTextSelectorProperty); + return (null != tmp) ? tmp : translatableTextSelector = new Selector(); } + set => SetValue(TranslatableTextSelectorProperty, value); } - private Selector fontFamilySelector; - private Selector FontFamilySelector - { - get - { - if (null == fontFamilySelector) - { - fontFamilySelector = new Selector(); - } - return 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 Selector FontFamily { get { - return (Selector)GetValue(FontFamilySelectorProperty); - } - set - { - SetValue(FontFamilySelectorProperty, value); + Selector tmp = (Selector)GetValue(FontFamilySelectorProperty); + return (null != tmp) ? tmp : fontFamilySelector = new Selector(); } + set => SetValue(FontFamilySelectorProperty, 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 bool? MultiLine { - get - { - bool? temp = (bool?)GetValue(MultiLineProperty); - return temp; - } - set - { - SetValue(MultiLineProperty, value); - } + get => (bool?)GetValue(MultiLineProperty); + set => SetValue(MultiLineProperty, 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 HorizontalAlignment? HorizontalAlignment { - get - { - HorizontalAlignment? temp = (HorizontalAlignment?)GetValue(HorizontalAlignmentProperty); - return temp; - } - set - { - SetValue(HorizontalAlignmentProperty, value); - } + get => (HorizontalAlignment?)GetValue(HorizontalAlignmentProperty); + set => SetValue(HorizontalAlignmentProperty, 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 VerticalAlignment? VerticalAlignment { - get - { - VerticalAlignment? temp = (VerticalAlignment?)GetValue(VerticalAlignmentProperty); - return temp; - } - set - { - SetValue(VerticalAlignmentProperty, value); - } + get => (VerticalAlignment?)GetValue(VerticalAlignmentProperty); + set => SetValue(VerticalAlignmentProperty, 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 bool? EnableMarkup { - get - { - bool? temp = (bool?)GetValue(EnableMarkupProperty); - return temp; - } - set - { - SetValue(EnableMarkupProperty, value); - } + get => (bool?)GetValue(EnableMarkupProperty); + set => SetValue(EnableMarkupProperty, 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 bool? EnableAutoScroll { - get - { - bool? temp = (bool?)GetValue(EnableAutoScrollProperty); - return temp; - } - set - { - SetValue(EnableAutoScrollProperty, value); - } + get => (bool?)GetValue(EnableAutoScrollProperty); + set => SetValue(EnableAutoScrollProperty, 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 int? AutoScrollSpeed { - get - { - int? temp = (int?)GetValue(AutoScrollSpeedProperty); - return temp; - } - set - { - SetValue(AutoScrollSpeedProperty, value); - } + get => (int?)GetValue(AutoScrollSpeedProperty); + set => SetValue(AutoScrollSpeedProperty, 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 int? AutoScrollLoopCount { - get - { - int? temp = (int?)GetValue(AutoScrollLoopCountProperty); - return temp; - } - set - { - SetValue(AutoScrollLoopCountProperty, value); - } + get => (int?)GetValue(AutoScrollLoopCountProperty); + set => SetValue(AutoScrollLoopCountProperty, 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 float? AutoScrollGap { - get - { - float? temp = (float?)GetValue(AutoScrollGapProperty); - return temp; - } - set - { - SetValue(AutoScrollGapProperty, value); - } + get => (float?)GetValue(AutoScrollGapProperty); + set => SetValue(AutoScrollGapProperty, 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 float? LineSpacing { - get - { - float? temp = (float?)GetValue(LineSpacingProperty); - return temp; - } - set - { - SetValue(LineSpacingProperty, value); - } + get => (float?)GetValue(LineSpacingProperty); + set => SetValue(LineSpacingProperty, 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 string Emboss { - get - { - string temp = (string)GetValue(EmbossProperty); - return temp; - } - set - { - SetValue(EmbossProperty, value); - } + get => (string)GetValue(EmbossProperty); + set => SetValue(EmbossProperty, 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 float? PixelSize { - get - { - float? temp = (float?)GetValue(PixelSizeProperty); - return temp; - } - set - { - SetValue(PixelSizeProperty, value); - } + get => (float?)GetValue(PixelSizeProperty); + set => SetValue(PixelSizeProperty, 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 bool? Ellipsis { - get - { - bool? temp = (bool?)GetValue(EllipsisProperty); - return temp; - } - set - { - SetValue(EllipsisProperty, value); - } + get => (bool?)GetValue(EllipsisProperty); + set => SetValue(EllipsisProperty, 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 float? AutoScrollLoopDelay { - get - { - float? temp = (float?)GetValue(AutoScrollLoopDelayProperty); - return temp; - } - set - { - SetValue(AutoScrollLoopDelayProperty, value); - } + get => (float?)GetValue(AutoScrollLoopDelayProperty); + set => SetValue(AutoScrollLoopDelayProperty, 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 AutoScrollStopMode? AutoScrollStopMode { - get - { - AutoScrollStopMode? temp = (AutoScrollStopMode?)GetValue(AutoScrollStopModeProperty); - return temp; - } - set - { - SetValue(AutoScrollStopModeProperty, value); - } + get => (AutoScrollStopMode?)GetValue(AutoScrollStopModeProperty); + set => SetValue(AutoScrollStopModeProperty, 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 LineWrapMode? LineWrapMode { - get - { - LineWrapMode? temp = (LineWrapMode?)GetValue(LineWrapModeProperty); - return temp; - } - set - { - SetValue(LineWrapModeProperty, value); - } + get => (LineWrapMode?)GetValue(LineWrapModeProperty); + set => SetValue(LineWrapModeProperty, 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 VerticalLineAlignment? VerticalLineAlignment { - get - { - VerticalLineAlignment? temp = (VerticalLineAlignment?)GetValue(VerticalLineAlignmentProperty); - return temp; - } - set - { - SetValue(VerticalLineAlignmentProperty, value); - } + get => (VerticalLineAlignment?)GetValue(VerticalLineAlignmentProperty); + set => SetValue(VerticalLineAlignmentProperty, 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 bool? MatchSystemLanguageDirection { - get - { - bool? temp = (bool?)GetValue(MatchSystemLanguageDirectionProperty); - return temp; - } - set - { - SetValue(MatchSystemLanguageDirectionProperty, value); - } + get => (bool?)GetValue(MatchSystemLanguageDirectionProperty); + set => SetValue(MatchSystemLanguageDirectionProperty, value); } - private Selector textSelector; - private Selector TextSelector - { - get - { - if (null == textSelector) - { - textSelector = new Selector(); - } - return 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 Selector Text { get { - return (Selector)GetValue(TextSelectorProperty); - } - set - { - SetValue(TextSelectorProperty, value); + Selector tmp = (Selector)GetValue(TextSelectorProperty); + return (null != tmp) ? tmp : textSelector = new Selector(); } + set => SetValue(TextSelectorProperty, value); } - private Selector textColorSelector; - private Selector TextColorSelector - { - get - { - if (null == textColorSelector) - { - textColorSelector = new Selector(); - } - return textColorSelector; - } - } /// 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 TextColor { get { - return (Selector)GetValue(TextColorSelectorProperty); - } - set - { - SetValue(TextColorSelectorProperty, value); + Selector tmp = (Selector)GetValue(TextColorSelectorProperty); + return (null != tmp) ? tmp : textColorSelector = new Selector(); } + set => SetValue(TextColorSelectorProperty, value); } - private Selector pointSizeSelector; - private Selector PointSizeSelector - { - get - { - if (null == pointSizeSelector) - { - pointSizeSelector = new Selector(); - } - return 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 Selector PointSize { get { - return (Selector)GetValue(PointSizeSelectorProperty); - } - set - { - SetValue(PointSizeSelectorProperty, value); + Selector tmp = (Selector)GetValue(PointSizeSelectorProperty); + return (null != tmp) ? tmp : pointSizeSelector = new Selector(); } + set => SetValue(PointSizeSelectorProperty, value); } } }