FIFE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
gcn::UTF8TextBox Class Reference

UTF-8 aware version of the TextBox class. More...

#include <utf8textbox.h>

Inherits TextBox.

+ Collaboration diagram for gcn::UTF8TextBox:

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

UTF8StringEditormStringEditor
 UTF-8 string editor suppor. More...
 

Detailed Description

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.

Author
Przemyslaw Grzywacz

Definition at line 55 of file utf8textbox.h.

Constructor & Destructor Documentation

gcn::UTF8TextBox::UTF8TextBox ( const std::string &  text = "")

Constructor.

Parameters
textInitial text.

Definition at line 37 of file utf8textbox.cpp.

gcn::UTF8TextBox::~UTF8TextBox ( )
virtual

Destructor.

Definition at line 42 of file utf8textbox.cpp.

References mStringEditor.

Member Function Documentation

int32_t gcn::UTF8TextBox::getCaretColumnUTF8 ( )

Gets caret column (UTF-8 aware).

Returns
Caret column.
int32_t gcn::UTF8TextBox::getCaretRowUTF8 ( )

Gets caret column (UTF-8 aware).

Returns
Caret row.
void gcn::UTF8TextBox::keyPressed ( KeyEvent &  keyEvent)
virtual
void gcn::UTF8TextBox::setCaretColumnUTF8 ( int32_t  column)

Sets caret column (UTF-8 aware).

Parameters
columnCaret 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).

Parameters
rowCaret row.
columnCaret column.
void gcn::UTF8TextBox::setCaretRowUTF8 ( int32_t  row)

Sets caret row (UTF-8 aware).

Parameters
rowCaret row

Definition at line 210 of file utf8textbox.cpp.

References gcn::UTF8StringEditor::countChars(), gcn::UTF8StringEditor::getOffset(), and mStringEditor.

Referenced by keyPressed().

+ Here is the caller graph for this function:

Member Data Documentation

UTF8StringEditor* gcn::UTF8TextBox::mStringEditor
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().


The documentation for this class was generated from the following files: