A heavy-duty multi-line text editor that can display large text files. The editor provides its own scrollbars in both the horizontal and vertical directions. The widget also provides methods for saving and loading text files, as well as for searching for text strings. The text is rendered in a fixed monospace typeface.
Changed | An event generated when the text changes. The number of characters inserted is stored in pEvt.getPoint().x, the number of characters deleted in pEvt.getPoint().y, the text that was deleted in pEvt.getString(), and the current insertion position in pEvt.getIndex(). |
Method Summary: | ||
TextEditor::TextEditor | (); | |
void | TextEditor::setText | (const String& pText); |
String | TextEditor::getText | (); |
String | TextEditor::getText | (int pStart, int pEnd); |
char | TextEditor::getCharAt | (int pPos); |
void | TextEditor::clear | (); |
void | TextEditor::insert | (const String& pText); |
void | TextEditor::insert | (int pStart, const String& pText); |
void | TextEditor::remove | (int pStart, int pEnd); |
void | TextEditor::replace | (int pStart, int pEnd, const String& pText); |
void | TextEditor::replaceSelection | (const String& pText); |
void | TextEditor::append | (const String& pText); |
int | TextEditor::getLength | (); |
bool | TextEditor::loadFile | (const String& pFileName); |
bool | TextEditor::saveFile | (const String& pFileName); |
void | TextEditor::setCursorPos | (int pPos); |
int | TextEditor::getCursorPos | (); |
void | TextEditor::cut | (); |
void | TextEditor::copy | (); |
void | TextEditor::paste | (); |
int | TextEditor::getLineStartPos | (int pPos); |
int | TextEditor::getLineEndPos | (int pPos); |
void | TextEditor::select | (int pStart, int pEnd); |
void | TextEditor::selectAll | (); |
void | TextEditor::unselect | (); |
bool | TextEditor::searchForward | (int pStart, const String& pStr, int* pPos, bool (=false) pMatchCase); |
bool | TextEditor::searchBackward | (int pStart, const String& pStr, int* pPos, bool (=false) pMatchCase); |
void | TextEditor::showInsertPos | (); |
int | TextEditor::getTabWidth | (); |
void | TextEditor::setTabWidth | (int pWidth); |
TextEditor::TextEditor |
TextEditor::TextEditor(); Constructs a new text editor widget. |
void TextEditor::setText | ||||||
void TextEditor::setText(const String& pText); Sets the text in the editor. | ||||||
|
String TextEditor::getText |
String TextEditor::getText(); Returns the entire text in the editor. |
String TextEditor::getText | |||||||||
String TextEditor::getText(int pStart, int pEnd); Returns the text between the specified start and end positions. | |||||||||
|
char TextEditor::getCharAt | ||||||
char TextEditor::getCharAt(int pPos); Returns the character at the specified position. | ||||||
|
void TextEditor::clear |
void TextEditor::clear(); Removes all the text from the editor. |
void TextEditor::insert | ||||||
void TextEditor::insert(const String& pText); Inserts text at the current insertion position. | ||||||
|
void TextEditor::insert | |||||||||
void TextEditor::insert(int pStart, const String& pText); Inserts text at the given insertion position. | |||||||||
|
void TextEditor::remove | |||||||||
void TextEditor::remove(int pStart, int pEnd); Removes a range of text between the given positions. | |||||||||
|
void TextEditor::replace | ||||||||||||
void TextEditor::replace(int pStart, int pEnd, const String& pText); Replaces the range of text between the given positions with new text. | ||||||||||||
|
void TextEditor::replaceSelection | ||||||
void TextEditor::replaceSelection(const String& pText); Replaces the current selection with new text. | ||||||
|
void TextEditor::append | ||||||
void TextEditor::append(const String& pText); Appends some text to the end of the buffer. | ||||||
|
int TextEditor::getLength |
int TextEditor::getLength(); Returns the length of the text stored in the editor. |
bool TextEditor::loadFile | ||||||
bool TextEditor::loadFile(const String& pFileName); Attempts to load the text file specified, returning true on success. | ||||||
|
bool TextEditor::saveFile | ||||||
bool TextEditor::saveFile(const String& pFileName); Attempts to save the text to the file specified, returning true on success. | ||||||
|
void TextEditor::setCursorPos | ||||||
void TextEditor::setCursorPos(int pPos); Changes the current insertion position. | ||||||
|
int TextEditor::getCursorPos |
int TextEditor::getCursorPos(); Returns the current insertion position. |
void TextEditor::cut |
void TextEditor::cut(); Cuts the selected text to the clipboard. |
void TextEditor::copy |
void TextEditor::copy(); Copies the selected text to the clipboard. |
void TextEditor::paste |
void TextEditor::paste(); Pastes any text on the system clipboard into the editor, replacing any selection. |
int TextEditor::getLineStartPos | ||||||
int TextEditor::getLineStartPos(int pPos); Returns the position of the start of the line containing the specified position. | ||||||
|
int TextEditor::getLineEndPos | ||||||
int TextEditor::getLineEndPos(int pPos); Returns the position of the end of the line containing the specified position. | ||||||
|
void TextEditor::select | |||||||||
void TextEditor::select(int pStart, int pEnd); Selects the text in the specified range. | |||||||||
|
void TextEditor::selectAll |
void TextEditor::selectAll(); Selects all of the text in the editor. |
void TextEditor::unselect |
void TextEditor::unselect(); Unselects the current selection. |
bool TextEditor::searchForward | |||||||||||||||
bool TextEditor::searchForward(int pStart, const String& pStr, int* pPos, bool (=false) pMatchCase); Searches for text starting from the given position forward. Returns: Returns whether the text was found or not. | |||||||||||||||
|
bool TextEditor::searchBackward | |||||||||||||||
bool TextEditor::searchBackward(int pStart, const String& pStr, int* pPos, bool (=false) pMatchCase); Searches for text starting from the given position backwards. Returns: Returns whether the text was found or not. | |||||||||||||||
|
void TextEditor::showInsertPos |
void TextEditor::showInsertPos(); Ensures that the insertion position is visible. |
int TextEditor::getTabWidth |
int TextEditor::getTabWidth(); Returns the current tab width. |
void TextEditor::setTabWidth | ||||||
void TextEditor::setTabWidth(int pWidth); Sets the display width of tabs. | ||||||
|