Class GuiElementEditableTextBase
- Namespace
- Vintagestory.API.Client
- Assembly
- VintagestoryAPI.dll
public abstract class GuiElementEditableTextBase : GuiElementTextBase, IDisposable
- Inheritance
-
GuiElementEditableTextBase
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
GuiElementEditableTextBase(ICoreClientAPI, CairoFont, ElementBounds)
Initializes the text component.
public GuiElementEditableTextBase(ICoreClientAPI capi, CairoFont font, ElementBounds bounds)
Parameters
capi
ICoreClientAPIThe Client API
font
CairoFontThe font of the text.
bounds
ElementBoundsThe bounds of the component.
Fields
OnCaretPositionChanged
public Action<int, int> OnCaretPositionChanged
Field Value
OnCursorMoved
public Action<double, double> OnCursorMoved
Field Value
OnKeyPressed
Called when a keyboard key was pressed, received and handled
public Action OnKeyPressed
Field Value
OnTextChanged
public Action<string> OnTextChanged
Field Value
OnTryTextChangeText
public GuiElementEditableTextBase.OnTryTextChangeDelegate OnTryTextChangeText
Field Value
WordWrap
public bool WordWrap
Field Value
lines
protected List<string> lines
Field Value
linesStaging
Contains the same as Lines, but may momentarily have different values when an edit is being made
protected List<string> linesStaging
Field Value
pcaretPosInLine
protected int pcaretPosInLine
Field Value
pcaretPosLine
protected int pcaretPosLine
Field Value
Properties
CaretPosInLine
public int CaretPosInLine { get; set; }
Property Value
CaretPosLine
public int CaretPosLine { get; set; }
Property Value
CaretPosWithoutLineBreaks
public int CaretPosWithoutLineBreaks { get; set; }
Property Value
Focusable
Whether or not the element can be focused.
public override bool Focusable { get; }
Property Value
TextLengthWithoutLineBreaks
public int TextLengthWithoutLineBreaks { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public override void Dispose()
GetLines()
public List<string> GetLines()
Returns
GetText()
Gets the text on the element.
public override string GetText()
Returns
- string
The text of the element.
Lineize(string)
public List<string> Lineize(string text)
Parameters
text
string
Returns
LoadValue(List<string>)
Sets given texts, leaves cursor position unchanged
public void LoadValue(List<string> newLines)
Parameters
MoveCursor(int, bool)
Moves the cursor forward and backward by an amount.
public void MoveCursor(int dir, bool wholeWord = false)
Parameters
dir
intThe direction to move the cursor.
wholeWord
boolWhether or not we skip entire words moving it.
OnFocusGained()
The event fired when the element gains focus.
public override void OnFocusGained()
OnFocusLost()
The event fired when the element looses focus.
public override void OnFocusLost()
OnKeyDown(ICoreClientAPI, KeyEvent)
The event fired when a key is held down.
public override void OnKeyDown(ICoreClientAPI api, KeyEvent args)
Parameters
api
ICoreClientAPIThe client API
args
KeyEventThe key event arguments.
OnKeyPress(ICoreClientAPI, KeyEvent)
The event fired the moment a key is pressed.
public override void OnKeyPress(ICoreClientAPI api, KeyEvent args)
Parameters
api
ICoreClientAPIThe Client API.
args
KeyEventThe keyboard state when the key was pressed.
OnMouseDownOnElement(ICoreClientAPI, MouseEvent)
The event fired when the mouse is pressed while on the element. Called after OnMouseDown and tells the engine that the event is handled.
public override void OnMouseDownOnElement(ICoreClientAPI api, MouseEvent args)
Parameters
api
ICoreClientAPIThe Client API
args
MouseEventThe mouse event args.
RenderInteractiveElements(float)
Renders the element as an interactive element.
public override void RenderInteractiveElements(float deltaTime)
Parameters
deltaTime
floatThe change in time.
SetCaretPos(double, double)
Sets the position of the cursor at a given point.
public void SetCaretPos(double x, double y)
Parameters
SetCaretPos(int, int)
Sets the position of the cursor to a specific character.
public void SetCaretPos(int posInLine, int posLine = 0)
Parameters
SetMaxHeight(int)
public void SetMaxHeight(int maxheight)
Parameters
maxheight
int
SetMaxLines(int)
Sets the number of lines in the Text Area.
public void SetMaxLines(int maxlines)
Parameters
maxlines
intThe maximum number of lines.
SetValue(double)
Sets a numerical value to the text, appending it to the end of the text.
public void SetValue(double value)
Parameters
value
doubleThe value to add to the text.
SetValue(float)
Sets a numerical value to the text, appending it to the end of the text.
public void SetValue(float value)
Parameters
value
floatThe value to add to the text.
SetValue(string, bool)
Sets given text, sets the cursor to the end of the text
public void SetValue(string text, bool setCaretPosToEnd = true)