FIFE
|
UTF-8 aware version of the TextBox class. More...
#include <utf8textbox.h>
Inherits TextBox.
Public Member Functions | |
UTF8TextBox (const std::string &text="") | |
Constructor. More... | |
virtual | ~UTF8TextBox () |
Destructor. More... | |
virtual void | keyPressed (KeyEvent &keyEvent) |
Key pressed handler. More... | |
void | setCaretColumnUTF8 (int32_t column) |
Sets caret column (UTF-8 aware). More... | |
void | setCaretRowUTF8 (int32_t row) |
Sets caret row (UTF-8 aware). More... | |
void | setCaretRowColumnUTF8 (int32_t row, int32_t column) |
Sets caret row and column (UTF-8 aware). More... | |
int32_t | getCaretColumnUTF8 () |
Gets caret column (UTF-8 aware). More... | |
int32_t | getCaretRowUTF8 () |
Gets caret column (UTF-8 aware). More... | |
Protected Attributes | |
UTF8StringEditor * | mStringEditor |
UTF-8 string editor suppor. More... | |
UTF-8 aware version of the TextBox class.
Using UTF8StringEditor, it is able to correctly edit UTF-8 multiline texts.
You will also need an UTF-8 aware font to be able to correctly display such text (so gcn::ImageFont can not be used).
TextBox::setCaretColumn(), TextBox::setCaretRow(), TextBox::setCaretRowColumn(), TextBox::getCaretColumn() and TextBox::getCaretRow() addresses byte offsets of the text. Use character versions of those methods with UTF8 suffix, they will correctly access real character positions in UTF-8 texts.
Definition at line 55 of file utf8textbox.h.
gcn::UTF8TextBox::UTF8TextBox | ( | const std::string & | text = "" | ) |
|
virtual |
int32_t gcn::UTF8TextBox::getCaretColumnUTF8 | ( | ) |
Gets caret column (UTF-8 aware).
int32_t gcn::UTF8TextBox::getCaretRowUTF8 | ( | ) |
Gets caret column (UTF-8 aware).
|
virtual |
Key pressed handler.
Overides gcn::TextField to handle UTF-8 character codes.
keyEvent | Keyboard event. |
Definition at line 47 of file utf8textbox.cpp.
References gcn::UTF8StringEditor::countChars(), gcn::UTF8StringEditor::eraseChar(), gcn::UTF8StringEditor::getOffset(), gcn::UTF8StringEditor::insertChar(), utf8::is_valid(), mStringEditor, gcn::UTF8StringEditor::nextChar(), gcn::UTF8StringEditor::prevChar(), and setCaretRowUTF8().
void gcn::UTF8TextBox::setCaretColumnUTF8 | ( | int32_t | column | ) |
Sets caret column (UTF-8 aware).
column | Caret column. |
Definition at line 204 of file utf8textbox.cpp.
References gcn::UTF8StringEditor::getOffset(), and mStringEditor.
void gcn::UTF8TextBox::setCaretRowColumnUTF8 | ( | int32_t | row, |
int32_t | column | ||
) |
Sets caret row and column (UTF-8 aware).
row | Caret row. |
column | Caret column. |
void gcn::UTF8TextBox::setCaretRowUTF8 | ( | int32_t | row | ) |
Sets caret row (UTF-8 aware).
row | Caret row |
Definition at line 210 of file utf8textbox.cpp.
References gcn::UTF8StringEditor::countChars(), gcn::UTF8StringEditor::getOffset(), and mStringEditor.
Referenced by keyPressed().
|
protected |
UTF-8 string editor suppor.
It allows the UTF8TextBox to easly traverse UTF-8 strings as well as inserting and deleting characters.
Definition at line 116 of file utf8textbox.h.
Referenced by keyPressed(), setCaretColumnUTF8(), setCaretRowUTF8(), and ~UTF8TextBox().