@@ -18,6 +18,16 @@ namespace FlaxEngine
|
|||||||
[NoSerialize]
|
[NoSerialize]
|
||||||
private Font _cachedFont;
|
private Font _cachedFont;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="FontReference"/> struct.
|
||||||
|
/// </summary>
|
||||||
|
public FontReference()
|
||||||
|
{
|
||||||
|
_font = null;
|
||||||
|
_size = 30;
|
||||||
|
_cachedFont = null;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="FontReference"/> struct.
|
/// Initializes a new instance of the <see cref="FontReference"/> struct.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -61,9 +71,7 @@ namespace FlaxEngine
|
|||||||
if (_font != value)
|
if (_font != value)
|
||||||
{
|
{
|
||||||
_font = value;
|
_font = value;
|
||||||
|
_cachedFont = null;
|
||||||
if (_cachedFont)
|
|
||||||
_cachedFont = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,9 +88,7 @@ namespace FlaxEngine
|
|||||||
if (_size != value)
|
if (_size != value)
|
||||||
{
|
{
|
||||||
_size = value;
|
_size = value;
|
||||||
|
_cachedFont = null;
|
||||||
if (_cachedFont)
|
|
||||||
_cachedFont = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,9 +110,7 @@ namespace FlaxEngine
|
|||||||
/// Determines whether the specified <see cref="FontReference" /> is equal to this instance.
|
/// Determines whether the specified <see cref="FontReference" /> is equal to this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="other">The <see cref="FontReference" /> to compare with this instance.</param>
|
/// <param name="other">The <see cref="FontReference" /> to compare with this instance.</param>
|
||||||
/// <returns>
|
/// <returns><c>true</c> if the specified <see cref="FontReference" /> is equal to this instance; otherwise, <c>false</c>.</returns>
|
||||||
/// <c>true</c> if the specified <see cref="FontReference" /> is equal to this instance; otherwise, <c>false</c>.
|
|
||||||
/// </returns>
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public bool Equals(FontReference other)
|
public bool Equals(FontReference other)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -185,8 +185,8 @@ namespace FlaxEngine.GUI
|
|||||||
AutoFocus = false;
|
AutoFocus = false;
|
||||||
var style = Style.Current;
|
var style = Style.Current;
|
||||||
Font = new FontReference(style.FontMedium);
|
Font = new FontReference(style.FontMedium);
|
||||||
TextColor = Style.Current.Foreground;
|
TextColor = style.Foreground;
|
||||||
TextColorHighlighted = Style.Current.Foreground;
|
TextColorHighlighted = style.Foreground;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -196,8 +196,8 @@ namespace FlaxEngine.GUI
|
|||||||
AutoFocus = false;
|
AutoFocus = false;
|
||||||
var style = Style.Current;
|
var style = Style.Current;
|
||||||
Font = new FontReference(style.FontMedium);
|
Font = new FontReference(style.FontMedium);
|
||||||
TextColor = Style.Current.Foreground;
|
TextColor = style.Foreground;
|
||||||
TextColorHighlighted = Style.Current.Foreground;
|
TextColorHighlighted = style.Foreground;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -9,12 +9,7 @@ namespace FlaxEngine.GUI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class RichTextBox : RichTextBoxBase
|
public class RichTextBox : RichTextBoxBase
|
||||||
{
|
{
|
||||||
private TextBlockStyle _textStyle = new TextBlockStyle
|
private TextBlockStyle _textStyle;
|
||||||
{
|
|
||||||
Font = new FontReference(Style.Current.FontMedium),
|
|
||||||
Color = Style.Current.Foreground,
|
|
||||||
BackgroundSelectedBrush = new SolidColorBrush(Style.Current.BackgroundSelected),
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The text style applied to the whole text.
|
/// 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 />
|
/// <inheritdoc />
|
||||||
protected override void OnParseTextBlocks()
|
protected override void OnParseTextBlocks()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace FlaxEngine.GUI
|
|||||||
[EditorOrder(10)]
|
[EditorOrder(10)]
|
||||||
public Font FontTitle
|
public Font FontTitle
|
||||||
{
|
{
|
||||||
get => _fontTitle.GetFont();
|
get => _fontTitle?.GetFont();
|
||||||
set => _fontTitle = new FontReference(value);
|
set => _fontTitle = new FontReference(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ namespace FlaxEngine.GUI
|
|||||||
[EditorOrder(20)]
|
[EditorOrder(20)]
|
||||||
public Font FontLarge
|
public Font FontLarge
|
||||||
{
|
{
|
||||||
get => _fontLarge.GetFont();
|
get => _fontLarge?.GetFont();
|
||||||
set => _fontLarge = new FontReference(value);
|
set => _fontLarge = new FontReference(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ namespace FlaxEngine.GUI
|
|||||||
[EditorOrder(30)]
|
[EditorOrder(30)]
|
||||||
public Font FontMedium
|
public Font FontMedium
|
||||||
{
|
{
|
||||||
get => _fontMedium.GetFont();
|
get => _fontMedium?.GetFont();
|
||||||
set => _fontMedium = new FontReference(value);
|
set => _fontMedium = new FontReference(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ namespace FlaxEngine.GUI
|
|||||||
[EditorOrder(40)]
|
[EditorOrder(40)]
|
||||||
public Font FontSmall
|
public Font FontSmall
|
||||||
{
|
{
|
||||||
get => _fontSmall.GetFont();
|
get => _fontSmall?.GetFont();
|
||||||
set => _fontSmall = new FontReference(value);
|
set => _fontSmall = new FontReference(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user