#include <glwx.h>
Public Member Functions | |
GUITextBox (const std::string &callback="", const std::string &fieldText="") | |
virtual void | render (float clockTick) |
virtual void | checkMouseEvents (MouseEvent &evt, int extraInfo, bool reservedBits=false) |
virtual void | checkKeyboardEvents (KeyEvent &evt, int extraInfo) |
virtual bool | loadXMLSettings (const TiXmlElement *node) |
virtual const Tuple4i & | getWindowBounds () |
void | setText (const std::string &text) |
const std::string & | getText () const |
bool | textChanged () |
void | setBordersColor (const Tuple3f &color) |
void | setBordersColor (float r, float g, float b) |
const Tuple3f & | getBordersColor () const |
void | setPadding (const Tuple2i &p) |
void | setPadding (int x, int y) |
const Tuple2i & | getPadding () const |
Protected Attributes | |
Tuple2i | padding |
Tuple3f | bordersColor |
Tuple3f | textColor |
float | blinkerTimer |
size_t | blinkerPosition |
size_t | textStartIndex |
size_t | textEndIndex |
bool | blinkerOn |
Private Member Functions | |
void | setupText (int type, char info=0) |
void | setupBlinker (size_t mouseX) |
Definition at line 690 of file glwx.h.
GUITextBox::GUITextBox | ( | const std::string & | callback = "" , |
|
const std::string & | fieldText = "" | |||
) |
Definition at line 3 of file GUITextBox.cpp.
References blinkerOn, blinkerPosition, blinkerTimer, GUIRectangle::dimensions, GUIFontManager::getDefaultFont(), GUIFont::getFontObject(), GUIAlphaElement::label, padding, setBordersColor(), GUIAlphaElement::setColor(), GUIRectangle::setDimensions(), setPadding(), GUIText::setString(), textEndIndex, textStartIndex, GUIRectangle::widgetType, and WT_TEXT_BOX.
void GUITextBox::render | ( | float | clockTick | ) | [virtual] |
Implements GUIAlphaElement.
Definition at line 70 of file GUITextBox.cpp.
References blinkerOn, blinkerPosition, blinkerTimer, bordersColor, GUIAlphaElement::color, GUIText::getColor(), getWindowBounds(), GUIAlphaElement::label, GUIAlphaElement::modifyCurrentAlpha(), padding, GUIRectangle::parent, GUIText::print(), textEndIndex, textStartIndex, GUIRectangle::visible, and GUIRectangle::windowBounds.
void GUITextBox::checkMouseEvents | ( | MouseEvent & | evt, | |
int | extraInfo, | |||
bool | reservedBits = false | |||
) | [virtual] |
Reimplemented from GUIRectangle.
Definition at line 116 of file GUITextBox.cpp.
References blinkerOn, GUIRectangle::checkMouseEvents(), GUIRectangle::clicked, GUIRectangle::focused, MouseEvent::getX(), GUIRectangle::mouseOver, GUIRectangle::pressed, GUIRectangle::released, and setupBlinker().
void GUITextBox::checkKeyboardEvents | ( | KeyEvent & | evt, | |
int | extraInfo | |||
) | [virtual] |
Reimplemented from GUIRectangle.
Definition at line 130 of file GUITextBox.cpp.
References GUIRectangle::active, KeyEvent::displayable(), GUIRectangle::focused, GUIText::forceUpdate(), KeyEvent::getKeyChar(), KeyEvent::getKeyID(), GUIText::getString(), KE_PRESSED, GUIAlphaElement::label, setupText(), KeyEvent::setUsed(), TE_BACKSPACE_DELETE, TE_INSERT_CHAR, TE_SIMPLE_DELETE, and GUIRectangle::update.
bool GUITextBox::loadXMLSettings | ( | const TiXmlElement * | node | ) | [virtual] |
Reimplemented from GUIAlphaElement.
Definition at line 24 of file GUITextBox.cpp.
References bordersColor, GUIAlphaElement::loadXMLSettings(), setBordersColor(), and Logger::writeErrorLog().
Referenced by GUIPanel::loadXMLSettings().
const Tuple4i & GUITextBox::getWindowBounds | ( | ) | [virtual] |
Reimplemented from GUIRectangle.
Definition at line 280 of file GUITextBox.cpp.
References blinkerPosition, GUIText::computeDimensions(), GUIRectangle::computeWindowBounds(), GUIRectangle::dimensions, GUIText::getHeight(), GUIAlphaElement::label, padding, GUIRectangle::parent, setupText(), TE_PARSE_VISIBLE, GUIRectangle::update, and GUIRectangle::windowBounds.
Referenced by render(), and setupBlinker().
void GUITextBox::setText | ( | const std::string & | text | ) |
const std::string& GUITextBox::getText | ( | ) | const |
bool GUITextBox::textChanged | ( | ) |
void GUITextBox::setBordersColor | ( | const Tuple3f & | color | ) |
void GUITextBox::setBordersColor | ( | float | r, | |
float | g, | |||
float | b | |||
) |
const Tuple3f & GUITextBox::getBordersColor | ( | ) | const |
void GUITextBox::setPadding | ( | const Tuple2i & | p | ) |
void GUITextBox::setPadding | ( | int | x, | |
int | y | |||
) |
const Tuple2i & GUITextBox::getPadding | ( | ) | const |
void GUITextBox::setupText | ( | int | type, | |
char | info = 0 | |||
) | [private] |
Definition at line 191 of file GUITextBox.cpp.
References blinkerPosition, GUIText::clear(), GUIFontManager::getCharacterWidth(), GUIFontManager::getFont(), GUIText::getFontIndex(), GUIFont::getFontObject(), GUIText::getString(), GUIRectangle::getWidth(), GUIAlphaElement::label, padding, GUIText::setString(), setupBlinker(), start, TE_BACKSPACE_DELETE, TE_INSERT_CHAR, TE_PARSE_VISIBLE, TE_SIMPLE_DELETE, textEndIndex, and GUIRectangle::windowBounds.
Referenced by checkKeyboardEvents(), and getWindowBounds().
void GUITextBox::setupBlinker | ( | size_t | mouseX | ) | [private] |
Definition at line 168 of file GUITextBox.cpp.
References GUIRectangle::active, blinkerOn, blinkerPosition, GUIRectangle::focused, GUIFontManager::getFont(), GUIText::getFontIndex(), GUIFont::getFontObject(), GUIText::getString(), getWindowBounds(), GUIAlphaElement::label, and padding.
Referenced by checkMouseEvents(), and setupText().
Tuple2i GUITextBox::padding [protected] |
Definition at line 715 of file glwx.h.
Referenced by getPadding(), getWindowBounds(), GUITextBox(), render(), setPadding(), setupBlinker(), and setupText().
Tuple3f GUITextBox::bordersColor [protected] |
Definition at line 716 of file glwx.h.
Referenced by getBordersColor(), loadXMLSettings(), render(), and setBordersColor().
Tuple3f GUITextBox::textColor [protected] |
float GUITextBox::blinkerTimer [protected] |
size_t GUITextBox::blinkerPosition [protected] |
Definition at line 719 of file glwx.h.
Referenced by getWindowBounds(), GUITextBox(), render(), setupBlinker(), and setupText().
size_t GUITextBox::textStartIndex [protected] |
size_t GUITextBox::textEndIndex [protected] |
bool GUITextBox::blinkerOn [protected] |
Definition at line 722 of file glwx.h.
Referenced by checkMouseEvents(), GUITextBox(), render(), and setupBlinker().