FIFE
2008.0
|
#include <utf8textbox.h>
Public Member Functions | |
UTF8TextBox (const std::string &text="") | |
virtual | ~UTF8TextBox () |
virtual void | keyPressed (KeyEvent &keyEvent) |
void | setCaretColumnUTF8 (int column) |
void | setCaretRowUTF8 (int row) |
void | setCaretRowColumnUTF8 (int row, int column) |
int | getCaretColumnUTF8 () |
int | getCaretRowUTF8 () |
Protected Attributes | |
UTF8StringEditor * | mStringEditor |
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 54 of file utf8textbox.h.
gcn::UTF8TextBox::UTF8TextBox | ( | const std::string & | text = "" | ) |
|
virtual |
int gcn::UTF8TextBox::getCaretColumnUTF8 | ( | ) |
Gets caret column (UTF-8 aware).
int 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(), mStringEditor, gcn::UTF8StringEditor::nextChar(), gcn::UTF8StringEditor::prevChar(), and setCaretRowUTF8().
void gcn::UTF8TextBox::setCaretColumnUTF8 | ( | int | 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 | ( | int | row, |
int | column | ||
) |
Sets caret row and column (UTF-8 aware).
row | Caret row. |
column | Caret column. |
void gcn::UTF8TextBox::setCaretRowUTF8 | ( | int | 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 115 of file utf8textbox.h.
Referenced by keyPressed(), setCaretColumnUTF8(), setCaretRowUTF8(), and ~UTF8TextBox().