#include <EditWidget.h>
Inheritance diagram for EditWidget:

Public Types | |
| EDIT_ENTER = 16 | |
| EDIT_ESCAPE = 17 | |
| enum | Message { EDIT_ENTER = 16, EDIT_ESCAPE = 17 } |
Public Member Functions | |
| ENABLE_RUNTIME_CLASSTYPE () | |
| EditWidget (int X, int Y, std::string txt, bool gamefont, int fontnum, int width, int height, unsigned int maxlength=0, bool multiline=false) | |
| virtual | ~EditWidget (void) |
| virtual void | InitGump (Gump *newparent, bool take_focus=true) |
| virtual void | PaintThis (RenderSurface *, sint32 lerp_factor, bool scaled) |
| virtual void | PaintComposited (RenderSurface *surf, sint32 lerp_factor, sint32 sx, sint32 sy) |
| virtual Gump * | OnMouseMotion (int mx, int my) |
| virtual bool | OnKeyDown (int key, int mod) |
| virtual bool | OnKeyUp (int key) |
| virtual bool | OnTextInput (int unicode) |
| std::string | getText () const |
| void | setText (const std::string &t) |
Protected Member Functions | |
| void | ensureCursorVisible () |
| bool | textFits (std::string &t) |
| void | renderText () |
| Pentagram::Font * | getFont () const |
Protected Attributes | |
| std::string | text |
| std::string::size_type | cursor |
| bool | gamefont |
| int | fontnum |
| unsigned int | maxlength |
| bool | multiline |
| uint32 | cursor_changed |
| bool | cursor_visible |
| RenderedText * | cached_text |
Definition at line 34 of file EditWidget.h.
| enum EditWidget::Message |
| EditWidget::EditWidget | ( | int | X, | |
| int | Y, | |||
| std::string | txt, | |||
| bool | gamefont, | |||
| int | fontnum, | |||
| int | width, | |||
| int | height, | |||
| unsigned int | maxlength = 0, |
|||
| bool | multiline = false | |||
| ) |
| EditWidget::~EditWidget | ( | void | ) | [virtual] |
| EditWidget::ENABLE_RUNTIME_CLASSTYPE | ( | ) |
Reimplemented from Gump.
| void EditWidget::ensureCursorVisible | ( | ) | [protected] |
Definition at line 83 of file EditWidget.cpp.
References cursor_changed, and cursor_visible.
Referenced by OnKeyDown().
| Pentagram::Font * EditWidget::getFont | ( | ) | const [protected] |
Definition at line 68 of file EditWidget.cpp.
References fontnum, gamefont, FontManager::get_instance(), FontManager::getGameFont(), and FontManager::getTTFont().
Referenced by InitGump(), PaintComposited(), PaintThis(), renderText(), and textFits().
| std::string EditWidget::getText | ( | ) | const [inline] |
get the current text
Definition at line 55 of file EditWidget.h.
References text.
Referenced by U8SaveGump::ChildNotify(), and MenuGump::ChildNotify().
| void EditWidget::InitGump | ( | Gump * | newparent, | |
| bool | take_focus = true | |||
| ) | [virtual] |
Init the gump and add it to parent; call after construction When newparent is 0, this will call GUIApp::addGump().
| newparent | The Gump's new parent or 0. | |
| takefocus | If true, set parent's focus_child to this |
Reimplemented from Gump.
Definition at line 49 of file EditWidget.cpp.
References Gump::dims, font, gamefont, getFont(), Gump::InitGump(), Gump::ROUND_OUTSIDE, Gump::ScreenSpaceToGumpRect(), Gump::x, Pentagram::Rect::x, Gump::y, and Pentagram::Rect::y.
Referenced by U8SaveGump::InitGump().
| bool EditWidget::OnKeyDown | ( | int | key, | |
| int | mod | |||
| ) | [virtual] |
Reimplemented from Gump.
Definition at line 194 of file EditWidget.cpp.
References cached_text, Gump::ChildNotify(), cursor, EDIT_ENTER, EDIT_ESCAPE, ensureCursorVisible(), Gump::parent, and text.
| bool EditWidget::OnKeyUp | ( | int | key | ) | [virtual] |
| Gump * EditWidget::OnMouseMotion | ( | int | mx, | |
| int | my | |||
| ) | [virtual] |
| bool EditWidget::OnTextInput | ( | int | unicode | ) | [virtual] |
Reimplemented from Gump.
Definition at line 244 of file EditWidget.cpp.
References cached_text, cursor, maxlength, Pentagram::reverse_encoding, text, and textFits().
| void EditWidget::PaintComposited | ( | RenderSurface * | surf, | |
| sint32 | lerp_factor, | |||
| sint32 | sx, | |||
| sint32 | sy | |||
| ) | [virtual] |
Overloadable method to Paint just this gumps unscaled components that require compositing (RenderSurface is relative to parent).
Reimplemented from Gump.
Definition at line 171 of file EditWidget.cpp.
References cached_text, Gump::dims, RenderedText::draw(), RenderSurface::FillAlpha(), font, gamefont, getFont(), Gump::GumpRectToScreenSpace(), Gump::GumpToScreenSpace(), Pentagram::Rect::h, Gump::ROUND_BOTTOMRIGHT, Gump::ROUND_OUTSIDE, Pentagram::Rect::w, Pentagram::Rect::x, Gump::x, Pentagram::Rect::y, and Gump::y.
| void EditWidget::PaintThis | ( | RenderSurface * | , | |
| sint32 | lerp_factor, | |||
| bool | scaled | |||
| ) | [virtual] |
Overloadable method to Paint just this Gump (RenderSurface is relative to this).
Reimplemented from Gump.
Definition at line 155 of file EditWidget.cpp.
References cached_text, Gump::dims, RenderedText::draw(), RenderSurface::FillAlpha(), gamefont, getFont(), Pentagram::Rect::h, Gump::PaintThis(), renderText(), Pentagram::Rect::w, Pentagram::Rect::x, and Pentagram::Rect::y.
| void EditWidget::renderText | ( | ) | [protected] |
Definition at line 118 of file EditWidget.cpp.
References cached_text, cursor, cursor_changed, cursor_visible, Gump::dims, font, gamefont, getFont(), Gump::GumpRectToScreenSpace(), Pentagram::Rect::h, Gump::IsFocus(), multiline, Gump::ROUND_INSIDE, text, Pentagram::Font::TEXT_LEFT, Pentagram::Rect::w, Gump::x, and Gump::y.
Referenced by PaintThis().
| void EditWidget::setText | ( | const std::string & | t | ) |
Definition at line 76 of file EditWidget.cpp.
References cached_text, cursor, and text.
Referenced by U8SaveGump::ChildNotify().
| bool EditWidget::textFits | ( | std::string & | t | ) | [protected] |
Definition at line 89 of file EditWidget.cpp.
References Gump::dims, font, gamefont, getFont(), Gump::GumpRectToScreenSpace(), Pentagram::Rect::h, height, multiline, Gump::ROUND_INSIDE, Gump::ROUND_OUTSIDE, Gump::ScreenSpaceToGumpRect(), Pentagram::Font::TEXT_LEFT, Pentagram::Rect::w, width, Gump::x, and Gump::y.
Referenced by OnTextInput().
RenderedText* EditWidget::cached_text [protected] |
Definition at line 81 of file EditWidget.h.
Referenced by OnKeyDown(), OnTextInput(), PaintComposited(), PaintThis(), renderText(), setText(), and ~EditWidget().
std::string::size_type EditWidget::cursor [protected] |
Definition at line 67 of file EditWidget.h.
Referenced by EditWidget(), OnKeyDown(), OnTextInput(), renderText(), and setText().
uint32 EditWidget::cursor_changed [protected] |
bool EditWidget::cursor_visible [protected] |
int EditWidget::fontnum [protected] |
bool EditWidget::gamefont [protected] |
Definition at line 68 of file EditWidget.h.
Referenced by getFont(), InitGump(), PaintComposited(), PaintThis(), renderText(), and textFits().
unsigned int EditWidget::maxlength [protected] |
bool EditWidget::multiline [protected] |
std::string EditWidget::text [protected] |
Definition at line 66 of file EditWidget.h.
Referenced by EditWidget(), getText(), OnKeyDown(), OnTextInput(), renderText(), and setText().
1.4.7