Provide the necessary functionalities to implement a full-text editor. TextAreas are generally used for coding or to display large text files via the TextBuffer and Stream interface.
Name | Description |
SetTextBuffer | Connect an existing TextBuffer to the current TextArea. |
Declaration void SetTextBuffer( TextBuffer *textbuffer ) Parameters
textbuffer : Reference to the TextBuffer to connect; pass nil to disconnect.
|
GetLineIndex | Helper that retrieve a line number at a specific position specified in window space. |
Declaration int GetLineIndex( const ivec2 v ) Parameters
Return Value
-1 if the point provided is outside of the TextArea; else return the nearest line number in proximity of the hit point.
|
GetCharIndex | Retrieve the nearest character index at a position specified in window space. |
Declaration int GetCharIndex( const ivec2 v ) Parameters
Return Value
-1 if the point provided is outside of the TextArea; else return the nearest characted index in proximity of the hit point.
|
GetCharPosition | Retrieve the 2D coordinates of a specific character. |
Declaration ivec2 GetCharPosition( unsigned int char_index ) Parameters
char_index : Specify the character index to retrieve the position for.
Return Value
A zeroed vector if the character index does not exists; else return its 2D coordinates.
|
GetCharLineIndex | Retrieve the line number where a character index is located. |
Declaration int GetCharLineIndex( unsigned int char_index ) Parameters
char_index : Index of the character to retrieve the line for.
Return Value
-1 if the character index provided is invalid; else return its line number.
|
GetLinePosition | Retrieve the 2D coordinates of a specific line. |
Declaration ivec2 GetLinePosition( unsigned int line_index ) Parameters
line_index : Specify the line index to retrieve the position for.
Return Value
A zeroed vector if the line index does not exists; else return its 2D coordinates.
|
AdjustScroll | Adjust the TextArea scroll based on its associated TextBuffer selection. |
Declaration void AdjustScroll( void )
|
InsertChar | Insert a character at the current TextBuffer selection. |
Declaration bool InsertChar( unsigned char ascii ) Parameters
ascii : ASCII number to insert.
Return Value
true if the character have been inserted properly; else return false (in the event the character is invalid or the TextBuffer is read-only).
|
InsertString | Insert a string of text at the current TextBuffer selection. |
Declaration bool InsertString( const char *s ) Parameters
Return Value
true if the string have been inserted properly; else return false if the TextBuffer is read-only.
|
GetSelectedString | Retrieve the current selected string in the TextBuffer. |
Declaration const char *GetSelectedString( void ) Return Value
nil if no string is selected; else return the selected string.
|
GetAlignment | Helper that calculate the pixel alignment of the TextArea taking in consideration size and margin. |
Declaration ivec2 GetAlignment( void ) Return Value
The pixel alignment to use when drawing the active TextArea.
|