gcn::UTF8TextBox Class Reference

#include <utf8textbox.h>

Collaboration diagram for gcn::UTF8TextBox:
Collaboration graph
[legend]

List of all members.

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

UTF8StringEditormStringEditor

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 54 of file utf8textbox.h.


Constructor & Destructor Documentation

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

Constructor.

Parameters:
text Initial text.

Definition at line 36 of file utf8textbox.cpp.

gcn::UTF8TextBox::~UTF8TextBox (  )  [virtual]

Destructor.

Definition at line 41 of file utf8textbox.cpp.

References mStringEditor.


Member Function Documentation

int gcn::UTF8TextBox::getCaretColumnUTF8 (  ) 

Gets caret column (UTF-8 aware).

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

Gets caret column (UTF-8 aware).

Returns:
Caret row.
void gcn::UTF8TextBox::keyPressed ( KeyEvent &  keyEvent  )  [virtual]

Key pressed handler.

Overides gcn::TextField to handle UTF-8 character codes.

Parameters:
keyEvent Keyboard event.

Definition at line 46 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).

Parameters:
column Caret column.

Definition at line 203 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).

Parameters:
row Caret row.
column Caret column.
void gcn::UTF8TextBox::setCaretRowUTF8 ( int  row  ) 

Sets caret row (UTF-8 aware).

Parameters:
row Caret row

Definition at line 209 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

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().


The documentation for this class was generated from the following files:
Generated on Wed Nov 23 13:05:24 2011 for FIFE by  doxygen 1.6.3