|
@@ -12,7 +12,7 @@ namespace InABox.Core
|
|
|
Single,
|
|
|
Double
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public interface IDFLayoutTextControl
|
|
|
{
|
|
|
T GetStyleProperty<T>(string property, T defaultValue);
|
|
@@ -52,6 +52,21 @@ namespace InABox.Core
|
|
|
[ColorEditor]
|
|
|
public string Background { get; set; }
|
|
|
|
|
|
+ [EditorSequence(6)]
|
|
|
+ [Caption("Horz Alignment", IncludePath = false)]
|
|
|
+ [EnumLookupEditor(typeof(DFLayoutAlignment))]
|
|
|
+ public DFLayoutAlignment HorizontalTextAlignment { get; set; }
|
|
|
+
|
|
|
+ [EditorSequence(7)]
|
|
|
+ [Caption("Vertical Alignment", IncludePath = false)]
|
|
|
+ [EnumLookupEditor(typeof(DFLayoutAlignment))]
|
|
|
+ public DFLayoutAlignment VerticalTextAlignment { get; set; }
|
|
|
+
|
|
|
+ [EditorSequence(8)]
|
|
|
+ [Caption("Allow Wrap?", IncludePath = false)]
|
|
|
+ [CheckBoxEditor]
|
|
|
+ public bool TextWrapping { get; set; }
|
|
|
+
|
|
|
[JsonIgnore]
|
|
|
[NullEditor]
|
|
|
public Color ForegroundColour { get => GetForegroundColour(); set => SetForegroundColour(value); }
|
|
@@ -59,7 +74,7 @@ namespace InABox.Core
|
|
|
[JsonIgnore]
|
|
|
[NullEditor]
|
|
|
public Color BackgroundColour { get => GetBackgroundColour(); set => SetBackgroundColour(value); }
|
|
|
-
|
|
|
+
|
|
|
protected override void Init()
|
|
|
{
|
|
|
base.Init();
|
|
@@ -69,25 +84,34 @@ namespace InABox.Core
|
|
|
Foreground = "";
|
|
|
Background = "";
|
|
|
FontSize = 0;
|
|
|
+ TextWrapping = true;
|
|
|
+ HorizontalTextAlignment = DFLayoutAlignment.Start;
|
|
|
+ VerticalTextAlignment = DFLayoutAlignment.Middle;
|
|
|
}
|
|
|
|
|
|
public void LoadProperties(IDFLayoutTextControl control)
|
|
|
{
|
|
|
- IsItalic = control.GetStyleProperty("IsItalic", false);
|
|
|
- IsBold = control.GetStyleProperty("IsBold", false);
|
|
|
- Underline = control.GetStyleProperty("Underline", UnderlineType.None);
|
|
|
- Foreground = control.GetStyleProperty("Foreground", "");
|
|
|
- Background = control.GetStyleProperty("Background", "");
|
|
|
- FontSize = control.GetStyleProperty("FontSize", 0.0);
|
|
|
+ IsItalic = control.GetStyleProperty(nameof(IsItalic), false);
|
|
|
+ IsBold = control.GetStyleProperty(nameof(IsBold), false);
|
|
|
+ Underline = control.GetStyleProperty(nameof(Underline), UnderlineType.None);
|
|
|
+ Foreground = control.GetStyleProperty(nameof(Foreground), "");
|
|
|
+ Background = control.GetStyleProperty(nameof(Background), "");
|
|
|
+ FontSize = control.GetStyleProperty(nameof(FontSize), 0.0);
|
|
|
+ TextWrapping = control.GetStyleProperty(nameof(TextWrapping), true);
|
|
|
+ HorizontalTextAlignment = control.GetStyleProperty(nameof(HorizontalTextAlignment), DFLayoutAlignment.Start);
|
|
|
+ VerticalTextAlignment = control.GetStyleProperty(nameof(VerticalTextAlignment), DFLayoutAlignment.Middle);
|
|
|
}
|
|
|
public void SaveProperties(IDFLayoutTextControl control)
|
|
|
{
|
|
|
- control.SetStyleProperty("IsItalic", IsItalic);
|
|
|
- control.SetStyleProperty("IsBold", IsBold);
|
|
|
- control.SetStyleProperty("Underline", Underline);
|
|
|
- control.SetStyleProperty("Foreground", Foreground);
|
|
|
- control.SetStyleProperty("Background", Background);
|
|
|
- control.SetStyleProperty("FontSize", FontSize);
|
|
|
+ control.SetStyleProperty(nameof(IsItalic), IsItalic);
|
|
|
+ control.SetStyleProperty(nameof(IsBold), IsBold);
|
|
|
+ control.SetStyleProperty(nameof(Underline), Underline);
|
|
|
+ control.SetStyleProperty(nameof(Foreground), Foreground);
|
|
|
+ control.SetStyleProperty(nameof(Background), Background);
|
|
|
+ control.SetStyleProperty(nameof(FontSize), FontSize);
|
|
|
+ control.SetStyleProperty(nameof(TextWrapping), TextWrapping);
|
|
|
+ control.SetStyleProperty(nameof(HorizontalTextAlignment), HorizontalTextAlignment);
|
|
|
+ control.SetStyleProperty(nameof(VerticalTextAlignment), VerticalTextAlignment);
|
|
|
}
|
|
|
|
|
|
public Color GetForegroundColour() => ColourFromString(Foreground);
|