diff --git a/Source/Engine/UI/GUI/Common/RichTextBoxBase.cs b/Source/Engine/UI/GUI/Common/RichTextBoxBase.cs index 58e5bdaac..eedaa10c2 100644 --- a/Source/Engine/UI/GUI/Common/RichTextBoxBase.cs +++ b/Source/Engine/UI/GUI/Common/RichTextBoxBase.cs @@ -61,7 +61,7 @@ namespace FlaxEngine.GUI /// /// Updates the text blocks. /// - protected void UpdateTextBlocks() + protected virtual void UpdateTextBlocks() { Profiler.BeginEvent("RichTextBoxBase.UpdateTextBlocks"); diff --git a/Source/Engine/UI/GUI/Common/TextBoxBase.cs b/Source/Engine/UI/GUI/Common/TextBoxBase.cs index ccf346ed6..1d4fd2362 100644 --- a/Source/Engine/UI/GUI/Common/TextBoxBase.cs +++ b/Source/Engine/UI/GUI/Common/TextBoxBase.cs @@ -422,7 +422,7 @@ namespace FlaxEngine.GUI /// /// Clears all text from the text box control. /// - public void Clear() + public virtual void Clear() { Text = string.Empty; } @@ -430,7 +430,7 @@ namespace FlaxEngine.GUI /// /// Clear selection range /// - public void ClearSelection() + public virtual void ClearSelection() { OnSelectingEnd(); SetSelection(-1); @@ -439,7 +439,7 @@ namespace FlaxEngine.GUI /// /// Resets the view offset (text scroll view). /// - public void ResetViewOffset() + public virtual void ResetViewOffset() { TargetViewOffset = Vector2.Zero; } @@ -455,7 +455,7 @@ namespace FlaxEngine.GUI /// /// Copies the current selection in the text box to the Clipboard. /// - public void Copy() + public virtual void Copy() { var selectedText = SelectedText; if (selectedText.Length > 0) @@ -468,7 +468,7 @@ namespace FlaxEngine.GUI /// /// Moves the current selection in the text box to the Clipboard. /// - public void Cut() + public virtual void Cut() { var selectedText = SelectedText; if (selectedText.Length > 0) @@ -490,7 +490,7 @@ namespace FlaxEngine.GUI /// /// Replaces the current selection in the text box with the contents of the Clipboard. /// - public void Paste() + public virtual void Paste() { if (IsReadOnly) return; @@ -508,7 +508,7 @@ namespace FlaxEngine.GUI /// /// Duplicates the current selection in the text box. /// - public void Duplicate() + public virtual void Duplicate() { if (IsReadOnly) return; @@ -526,7 +526,7 @@ namespace FlaxEngine.GUI /// /// Ensures that the caret is visible in the TextBox window, by scrolling the TextBox control surface if necessary. /// - public void ScrollToCaret() + public virtual void ScrollToCaret() { // If it's empty if (_text.Length == 0) @@ -547,7 +547,7 @@ namespace FlaxEngine.GUI /// /// Selects all text in the text box. /// - public void SelectAll() + public virtual void SelectAll() { if (TextLength > 0) { @@ -558,7 +558,7 @@ namespace FlaxEngine.GUI /// /// Sets the selection to empty value. /// - public void Deselect() + public virtual void Deselect() { SetSelection(-1); } @@ -568,7 +568,7 @@ namespace FlaxEngine.GUI /// /// The location (in control-space). /// The character index under the location - public int CharIndexAtPoint(ref Vector2 location) + public virtual int CharIndexAtPoint(ref Vector2 location) { return HitTestText(location + _viewOffset); } @@ -577,7 +577,7 @@ namespace FlaxEngine.GUI /// Inserts the specified character (at the current selection). /// /// The character. - public void Insert(char c) + public virtual void Insert(char c) { Insert(c.ToString()); } @@ -586,7 +586,7 @@ namespace FlaxEngine.GUI /// Inserts the specified text (at the current selection). /// /// The string. - public void Insert(string str) + public virtual void Insert(string str) { if (IsReadOnly) return; @@ -622,7 +622,12 @@ namespace FlaxEngine.GUI OnTextChanged(); } - private void MoveRight(bool shift, bool ctrl) + /// + /// Moves the caret right. + /// + /// Shift is held. + /// Control is held. + protected virtual void MoveRight(bool shift, bool ctrl) { if (HasSelection && !shift) { @@ -647,7 +652,12 @@ namespace FlaxEngine.GUI } } - private void MoveLeft(bool shift, bool ctrl) + /// + /// Moves the caret left. + /// + /// Shift is held. + /// Control is held. + protected virtual void MoveLeft(bool shift, bool ctrl) { if (HasSelection && !shift) { @@ -672,7 +682,12 @@ namespace FlaxEngine.GUI } } - private void MoveDown(bool shift, bool ctrl) + /// + /// Moves the caret down. + /// + /// Shift is held. + /// Control is held. + protected virtual void MoveDown(bool shift, bool ctrl) { if (HasSelection && !shift) { @@ -693,7 +708,12 @@ namespace FlaxEngine.GUI } } - private void MoveUp(bool shift, bool ctrl) + /// + /// Moves the caret up. + /// + /// Shift is held. + /// Control is held. + protected virtual void MoveUp(bool shift, bool ctrl) { if (HasSelection && !shift) { @@ -719,7 +739,7 @@ namespace FlaxEngine.GUI /// /// The caret position. /// If set to true with auto-scroll. - protected void SetSelection(int caret, bool withScroll = true) + protected virtual void SetSelection(int caret, bool withScroll = true) { SetSelection(caret, caret); } @@ -730,7 +750,7 @@ namespace FlaxEngine.GUI /// The selection start character. /// The selection end character. /// If set to true with auto-scroll. - protected void SetSelection(int start, int end, bool withScroll = true) + protected virtual void SetSelection(int start, int end, bool withScroll = true) { // Update parameters int textLength = _text.Length;