// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved. using System.Collections.Generic; namespace FlaxEngine.GUI { /// /// Rich text box control which can gather text input from the user and present text in highly formatted and stylized way. /// public partial class RichTextBox : RichTextBoxBase { private TextBlockStyle _textStyle; /// /// The default text style applied to the whole text. /// [EditorOrder(20)] public TextBlockStyle TextStyle { get => _textStyle; set { _textStyle = value; UpdateTextBlocks(); } } /// /// The collection of custom text styles to apply (named). /// [EditorOrder(30)] public Dictionary Styles = new Dictionary(); /// /// The collection of custom images/sprites that can be inlined in text (named). /// [EditorOrder(40)] public Dictionary Images = new Dictionary(); /// /// Initializes a new instance of the class. /// public RichTextBox() { var style = Style.Current; _textStyle = new TextBlockStyle { Font = new FontReference(style.FontMedium), Color = style.Foreground, BackgroundSelectedBrush = new SolidColorBrush(style.BackgroundSelected), }; } /// protected override void OnSizeChanged() { base.OnSizeChanged(); // Refresh textblocks since thos emight depend on control size (eg. align right) UpdateTextBlocks(); } } }