Class RichTextBoxBase
Base class for all rich text box controls which can gather text input from the user and present text in highly formatted and stylized way.
Implements
Namespace: FlaxEngine.GUI
Assembly: FlaxEngine.CSharp.dll
Syntax
public abstract class RichTextBoxBase : TextBoxBase, IComparable, IDrawable
Constructors
RichTextBoxBase()
Fields
_textBlocks
The text blocks.
Declaration
protected List<TextBlock> _textBlocks
Field Value
System.Collections.Generic.List<TextBlock>
|
Methods
DrawSelf()
Draws the control.
Declaration
public override void DrawSelf()
Overrides
GetCharPosition(Int32, out Single)
Calculates character position for given character index.
Declaration
public override Float2 GetCharPosition(int index, out float height)
Parameters
System.Int32
index
The text position to get it's coordinates. |
System.Single
height
The character height (at the given character position). |
Returns
Float2
The character position (upper left corner which can be used for a caret position). |
Overrides
GetNearestTextBlock(Int32, out TextBlock, Boolean)
Gets the text block or the nearest text block of the character at the given index.
Declaration
public bool GetNearestTextBlock(int index, out TextBlock result, bool snapToNext = false)
Parameters
System.Int32
index
The character index. |
TextBlock
result
The result text block descriptor. |
System.Boolean
snapToNext
If true, the when the index is between two text blocks, it will return the next block. |
Returns
System.Boolean
True if a text block is found, otherwise false. |
GetTextBlock(Int32, out TextBlock)
Gets the text block of the character at the given index.
Declaration
public bool GetTextBlock(int index, out TextBlock result)
Parameters
System.Int32
index
The character index. |
TextBlock
result
The result text block descriptor. |
Returns
System.Boolean
True if got text block, otherwise false. |
GetTextSize()
Calculates total text size. Called by OnTextChanged() to cache the text size.
Declaration
public override Float2 GetTextSize()
Returns
Float2
The total text size. |
Overrides
HitTestText(Float2)
Calculates hit character index at given location.
Declaration
public override int HitTestText(Float2 location)
Parameters
Float2
location
The location to test. |
Returns
System.Int32
The selected character position index (can be equal to text length if location is outside of the layout rectangle). |
Overrides
OnDestroy()
Method called when managed instance should be destroyed
Declaration
public override void OnDestroy()
Overrides
OnMouseDoubleClick(Float2, MouseButton)
When mouse double clicks over control's area
Declaration
public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
Parameters
Float2
location
Mouse location in Control Space |
MouseButton
button
Mouse buttons state (flags) |
Returns
System.Boolean
True if event has been handled, otherwise false |
Overrides
OnParseTextBlocks()
Called when text blocks needs to be updated from the current text.
Declaration
protected virtual void OnParseTextBlocks()
OnTextChanged()
Action called when text gets modified.
Declaration
protected override void OnTextChanged()
Overrides
SetSelection(Int32, Int32, Boolean)
Sets the selection.
Declaration
protected override void SetSelection(int start, int end, bool withScroll = true)
Parameters
System.Int32
start
The selection start character. |
System.Int32
end
The selection end character. |
System.Boolean
withScroll
If set to |
Overrides
UpdateTextBlocks()
Updates the text blocks.
Declaration
public virtual void UpdateTextBlocks()