/// <since_tizen> 3 </since_tizen>
public partial class TextEditor : View
{
+ static private string defaultFontFamily = "TizenSans";
+ private string fontFamily = defaultFontFamily;
+ private bool hasSystemFontTypeChanged = false;
private string textEditorTextSid = null;
private string textEditorPlaceHolderTextSid = null;
private bool systemlangTextFlag = false;
TextChanged += TextEditorTextChanged;
}
+ private bool HasStyle()
+ {
+ return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
+ }
+
/// <summary>
/// The TranslatableText property.<br />
/// The text can set the SID value.<br />
}
}
+ private string InternalFontFamily
+ {
+ get
+ {
+ if (HasStyle())
+ return fontFamily;
+ else
+ return Object.InternalGetPropertyString(this.SwigCPtr, TextEditor.Property.FontFamily);
+ }
+ set
+ {
+ string newFontFamily;
+
+ if (string.Equals(fontFamily, value)) return;
+
+ fontFamily = value;
+ if (fontFamily == Tizen.NUI.FontFamily.UseSystemSetting)
+ {
+ try
+ {
+ newFontFamily = SystemSettings.FontType;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("{0} Exception caught.", e);
+ newFontFamily = defaultFontFamily;
+ }
+ AddSystemSettingsFontTypeChanged();
+ }
+ else
+ {
+ newFontFamily = fontFamily;
+ RemoveSystemSettingsFontTypeChanged();
+ }
+
+ SetInternalFontFamily(newFontFamily);
+ }
+ }
+
+ private void SetInternalFontFamily(string fontFamily)
+ {
+ Object.InternalSetPropertyString(this.SwigCPtr, TextEditor.Property.FontFamily, (string)fontFamily);
+ }
+
/// <summary>
/// The FontStyle property.<br />
/// The requested font style to use.<br />
SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
}
+ RemoveSystemSettingsFontTypeChanged();
+
removeFontSizeChangedCallback();
//Release your own unmanaged resources here.
}
}
+ private void SystemSettingsFontTypeChanged(object sender, FontTypeChangedEventArgs e)
+ {
+ SetInternalFontFamily(e.Value);
+ }
+
+ private void AddSystemSettingsFontTypeChanged()
+ {
+ if (HasStyle() && !hasSystemFontTypeChanged)
+ {
+ try
+ {
+ SystemSettings.FontTypeChanged += SystemSettingsFontTypeChanged;
+ hasSystemFontTypeChanged = true;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("{0} Exception caught.", e);
+ hasSystemFontTypeChanged = false;
+ }
+ }
+ }
+
+ private void RemoveSystemSettingsFontTypeChanged()
+ {
+ if (hasSystemFontTypeChanged)
+ {
+ try
+ {
+ SystemSettings.FontTypeChanged -= SystemSettingsFontTypeChanged;
+ hasSystemFontTypeChanged = false;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("{0} Exception caught.", e);
+ hasSystemFontTypeChanged = true;
+ }
+ }
+ }
+
private void TextEditorTextChanged(object sender, TextChangedEventArgs e)
{
if (!isSettingTextInCSharp)
var textEditor = (TextEditor)bindable;
if (newValue != null)
{
-
- Object.InternalSetPropertyString(textEditor.SwigCPtr, TextEditor.Property.FontFamily, (string)newValue);
+ textEditor.InternalFontFamily = (string)newValue;
}
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
{
var textEditor = (TextEditor)bindable;
-
- return Object.InternalGetPropertyString(textEditor.SwigCPtr, TextEditor.Property.FontFamily);
+ return textEditor.InternalFontFamily;
}));
/// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
/// <since_tizen> 3 </since_tizen>
public partial class TextField : View
{
+ static private string defaultFontFamily = "TizenSans";
+ private string fontFamily = defaultFontFamily;
+ private bool hasSystemFontTypeChanged = false;
private string textFieldTextSid = null;
private string textFieldPlaceHolderTextSid = null;
private string textFieldPlaceHolderTextFocusedSid = null;
ExceedPolicyClip
}
+ private bool HasStyle()
+ {
+ return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
+ }
+
/// <summary>
/// The TranslatableText property.<br />
/// The text can set the SID value.<br />
}
}
+ private string InternalFontFamily
+ {
+ get
+ {
+ if (HasStyle())
+ return fontFamily;
+ else
+ return Object.InternalGetPropertyString(this.SwigCPtr, TextField.Property.FontFamily);
+ }
+ set
+ {
+ string newFontFamily;
+
+ if (string.Equals(fontFamily, value)) return;
+
+ fontFamily = value;
+ if (fontFamily == Tizen.NUI.FontFamily.UseSystemSetting)
+ {
+ try
+ {
+ newFontFamily = SystemSettings.FontType;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("{0} Exception caught.", e);
+ newFontFamily = defaultFontFamily;
+ }
+ AddSystemSettingsFontTypeChanged();
+ }
+ else
+ {
+ newFontFamily = fontFamily;
+ RemoveSystemSettingsFontTypeChanged();
+ }
+
+ SetInternalFontFamily(newFontFamily);
+ }
+ }
+
+ private void SetInternalFontFamily(string fontFamily)
+ {
+ Object.InternalSetPropertyString(this.SwigCPtr, TextField.Property.FontFamily, (string)fontFamily);
+ }
+
/// <summary>
/// The FontStyle property.<br />
/// The requested font style to use.<br />
SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
}
+ RemoveSystemSettingsFontTypeChanged();
+
removeFontSizeChangedCallback();
if (type == DisposeTypes.Explicit)
}
}
+ private void SystemSettingsFontTypeChanged(object sender, FontTypeChangedEventArgs e)
+ {
+ SetInternalFontFamily(e.Value);
+ }
+
+ private void AddSystemSettingsFontTypeChanged()
+ {
+ if (HasStyle() && !hasSystemFontTypeChanged)
+ {
+ try
+ {
+ SystemSettings.FontTypeChanged += SystemSettingsFontTypeChanged;
+ hasSystemFontTypeChanged = true;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("{0} Exception caught.", e);
+ hasSystemFontTypeChanged = false;
+ }
+ }
+ }
+
+ private void RemoveSystemSettingsFontTypeChanged()
+ {
+ if (hasSystemFontTypeChanged)
+ {
+ try
+ {
+ SystemSettings.FontTypeChanged -= SystemSettingsFontTypeChanged;
+ hasSystemFontTypeChanged = false;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("{0} Exception caught.", e);
+ hasSystemFontTypeChanged = true;
+ }
+ }
+ }
+
private void TextFieldTextChanged(object sender, TextChangedEventArgs e)
{
if (!isSettingTextInCSharp)
var textField = (TextField)bindable;
if (newValue != null)
{
-
- Object.InternalSetPropertyString(textField.SwigCPtr, TextField.Property.FontFamily, (string)newValue);
+ textField.InternalFontFamily = (string)newValue;
}
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
{
var textField = (TextField)bindable;
-
- return Object.InternalGetPropertyString(textField.SwigCPtr, TextField.Property.FontFamily);
+ return textField.InternalFontFamily;
}));
/// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
static TextLabel() { }
+ static private string defaultFontFamily = "TizenSans";
+ private string fontFamily = defaultFontFamily;
+ private bool hasSystemFontTypeChanged = false;
private string textLabelSid = null;
private bool systemlangTextFlag = false;
private TextLabelSelectorData selectorData;
}
}
+ private bool HasStyle()
+ {
+ return ThemeManager.GetStyle(this.GetType()) == null ? false : true;
+ }
+
/// <summary>
/// The TranslatableText property.<br />
/// The text can set the SID value.<br />
}
}
+ private string InternalFontFamily
+ {
+ get
+ {
+ if (HasStyle())
+ return fontFamily;
+ else
+ return Object.InternalGetPropertyString(this.SwigCPtr, TextLabel.Property.FontFamily);
+ }
+ set
+ {
+ string newFontFamily;
+
+ if (string.Equals(fontFamily, value)) return;
+
+ fontFamily = value;
+ if (fontFamily == Tizen.NUI.FontFamily.UseSystemSetting)
+ {
+ try
+ {
+ newFontFamily = SystemSettings.FontType;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("{0} Exception caught.", e);
+ newFontFamily = defaultFontFamily;
+ }
+ AddSystemSettingsFontTypeChanged();
+ }
+ else
+ {
+ newFontFamily = fontFamily;
+ RemoveSystemSettingsFontTypeChanged();
+ }
+
+ SetInternalFontFamily(newFontFamily);
+ }
+ }
+
+ private void SetInternalFontFamily(string fontFamily)
+ {
+ Object.InternalSetPropertyString(this.SwigCPtr, TextLabel.Property.FontFamily, (string)fontFamily);
+ RequestLayout();
+ }
+
/// <summary>
/// The FontStyle property.<br />
/// The requested font style to use.<br />
SystemSettings.LocaleLanguageChanged -= SystemSettings_LocaleLanguageChanged;
}
+ RemoveSystemSettingsFontTypeChanged();
+
removeFontSizeChangedCallback();
if (type == DisposeTypes.Explicit)
}
}
+ private void SystemSettingsFontTypeChanged(object sender, FontTypeChangedEventArgs e)
+ {
+ SetInternalFontFamily(e.Value);
+ }
+
+ private void AddSystemSettingsFontTypeChanged()
+ {
+ if (HasStyle() && !hasSystemFontTypeChanged)
+ {
+ try
+ {
+ SystemSettings.FontTypeChanged += SystemSettingsFontTypeChanged;
+ hasSystemFontTypeChanged = true;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("{0} Exception caught.", e);
+ hasSystemFontTypeChanged = false;
+ }
+ }
+ }
+
+ private void RemoveSystemSettingsFontTypeChanged()
+ {
+ if (hasSystemFontTypeChanged)
+ {
+ try
+ {
+ SystemSettings.FontTypeChanged -= SystemSettingsFontTypeChanged;
+ hasSystemFontTypeChanged = false;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("{0} Exception caught.", e);
+ hasSystemFontTypeChanged = true;
+ }
+ }
+ }
+
private void RequestLayout()
{
Layout?.RequestLayout();
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
{
var textLabel = (TextLabel)bindable;
-
- return Object.InternalGetPropertyString(textLabel.SwigCPtr, TextLabel.Property.FontFamily);
+ return textLabel.InternalFontFamily;
}));
/// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
{
if (value != null)
{
-
- Object.InternalSetPropertyString(SwigCPtr, TextLabel.Property.FontFamily, value);
- RequestLayout();
+ InternalFontFamily = (string)value;
}
}
}
/// <summary>
+ /// FontFamily constant.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public struct FontFamily
+ {
+ /// <summary>
+ /// UseSystemSetting
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly string UseSystemSetting = string.Empty;
+ }
+
+ /// <summary>
/// Offset has left, right, bottom, top value.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
// TextLabel style.
theme.AddStyleWithoutClone("Tizen.NUI.BaseComponents.TextLabel", new TextLabelStyle()
{
- FontFamily = "TizenSans",
+ FontFamily = Tizen.NUI.FontFamily.UseSystemSetting,
PixelSize = 24,
TextColor = new Color(0.04f, 0.05f, 0.13f, 1),
FontStyle = new PropertyMap().Add("weight", new PropertyValue("regular")),
// TextField style.
theme.AddStyleWithoutClone("Tizen.NUI.BaseComponents.TextField", new TextFieldStyle()
{
- FontFamily = "TizenSans",
+ FontFamily = Tizen.NUI.FontFamily.UseSystemSetting,
PixelSize = 24,
TextColor = new Color(0.04f, 0.05f, 0.13f, 1),
PlaceholderTextColor = new Vector4(0.79f, 0.79f, 0.79f, 1),
// TextEditor style.
theme.AddStyleWithoutClone("Tizen.NUI.BaseComponents.TextEditor", new TextEditorStyle()
{
- FontFamily = "TizenSans",
+ FontFamily = Tizen.NUI.FontFamily.UseSystemSetting,
PixelSize = 24,
TextColor = new Color(0.04f, 0.05f, 0.13f, 1),
PlaceholderTextColor = new Color(0.79f, 0.79f, 0.79f, 1),