Post merge fixes to font reference as class

#420
This commit is contained in:
Wojtek Figat
2021-06-09 12:16:50 +02:00
parent 3c2b1a232c
commit f237d5d87d
4 changed files with 33 additions and 23 deletions

View File

@@ -185,8 +185,8 @@ namespace FlaxEngine.GUI
AutoFocus = false;
var style = Style.Current;
Font = new FontReference(style.FontMedium);
TextColor = Style.Current.Foreground;
TextColorHighlighted = Style.Current.Foreground;
TextColor = style.Foreground;
TextColorHighlighted = style.Foreground;
}
/// <inheritdoc />
@@ -196,8 +196,8 @@ namespace FlaxEngine.GUI
AutoFocus = false;
var style = Style.Current;
Font = new FontReference(style.FontMedium);
TextColor = Style.Current.Foreground;
TextColorHighlighted = Style.Current.Foreground;
TextColor = style.Foreground;
TextColorHighlighted = style.Foreground;
}
/// <inheritdoc />

View File

@@ -9,12 +9,7 @@ namespace FlaxEngine.GUI
/// </summary>
public class RichTextBox : RichTextBoxBase
{
private TextBlockStyle _textStyle = new TextBlockStyle
{
Font = new FontReference(Style.Current.FontMedium),
Color = Style.Current.Foreground,
BackgroundSelectedBrush = new SolidColorBrush(Style.Current.BackgroundSelected),
};
private TextBlockStyle _textStyle;
/// <summary>
/// The text style applied to the whole text.
@@ -30,6 +25,17 @@ namespace FlaxEngine.GUI
}
}
public RichTextBox()
{
var style = Style.Current;
_textStyle = new TextBlockStyle
{
Font = new FontReference(style.FontMedium),
Color = style.Foreground,
BackgroundSelectedBrush = new SolidColorBrush(style.BackgroundSelected),
};
}
/// <inheritdoc />
protected override void OnParseTextBlocks()
{

View File

@@ -22,7 +22,7 @@ namespace FlaxEngine.GUI
[EditorOrder(10)]
public Font FontTitle
{
get => _fontTitle.GetFont();
get => _fontTitle?.GetFont();
set => _fontTitle = new FontReference(value);
}
@@ -36,7 +36,7 @@ namespace FlaxEngine.GUI
[EditorOrder(20)]
public Font FontLarge
{
get => _fontLarge.GetFont();
get => _fontLarge?.GetFont();
set => _fontLarge = new FontReference(value);
}
@@ -50,7 +50,7 @@ namespace FlaxEngine.GUI
[EditorOrder(30)]
public Font FontMedium
{
get => _fontMedium.GetFont();
get => _fontMedium?.GetFont();
set => _fontMedium = new FontReference(value);
}
@@ -64,7 +64,7 @@ namespace FlaxEngine.GUI
[EditorOrder(40)]
public Font FontSmall
{
get => _fontSmall.GetFont();
get => _fontSmall?.GetFont();
set => _fontSmall = new FontReference(value);
}