FIFE
be64c707dea6b3250bd4355bf5c825d25920087d
|
A Command line widget. More...
#include <commandline.h>
Inherits TextField.
Public Types | |
typedef std::function< void(std::string)> | type_callback |
Public Member Functions | |
CommandLine () | |
Constructor. More... | |
~CommandLine () | |
Destructor. More... | |
void | keyPressed (fcn::KeyEvent &keyEvent) |
virtual void | drawCaret (fcn::Graphics *graphics, int32_t x) |
void | setCallback (const type_callback &cb) |
Set callback on pressing the ENTER key. More... | |
void | toggleCaretVisible () |
Toggle the caret visibility. More... | |
void | startBlinking () |
Start blinking the caret. More... | |
void | stopBlinking () |
Stop blinking the caret for a few seconds. More... | |
Private Attributes | |
type_callback | m_callback |
std::vector< std::string > | m_history |
size_t | m_history_position |
std::string | m_cmdline |
bool | m_caretVisible |
Timer | m_blinkTimer |
Timer | m_suppressBlinkTimer |
A Command line widget.
Definition at line 43 of file commandline.h.
typedef std::function<void(std::string)> FIFE::CommandLine::type_callback |
Definition at line 45 of file commandline.h.
FIFE::CommandLine::CommandLine | ( | ) |
Constructor.
Definition at line 40 of file commandline.cpp.
References m_blinkTimer, m_suppressBlinkTimer, FIFE::Timer::setCallback(), FIFE::Timer::setInterval(), FIFE::Timer::start(), startBlinking(), and toggleCaretVisible().
FIFE::CommandLine::~CommandLine | ( | ) |
Destructor.
Definition at line 50 of file commandline.cpp.
|
virtual |
Definition at line 136 of file commandline.cpp.
References m_caretVisible.
void FIFE::CommandLine::keyPressed | ( | fcn::KeyEvent & | keyEvent | ) |
Definition at line 68 of file commandline.cpp.
References m_callback, m_cmdline, m_history, m_history_position, and stopBlinking().
void FIFE::CommandLine::setCallback | ( | const type_callback & | cb | ) |
Set callback on pressing the ENTER key.
Definition at line 146 of file commandline.cpp.
References m_callback.
Referenced by FIFE::Console::Console().
void FIFE::CommandLine::startBlinking | ( | ) |
Start blinking the caret.
Definition at line 63 of file commandline.cpp.
References m_blinkTimer, m_suppressBlinkTimer, FIFE::Timer::start(), and FIFE::Timer::stop().
Referenced by CommandLine().
void FIFE::CommandLine::stopBlinking | ( | ) |
Stop blinking the caret for a few seconds.
Definition at line 57 of file commandline.cpp.
References m_blinkTimer, m_caretVisible, m_suppressBlinkTimer, FIFE::Timer::start(), and FIFE::Timer::stop().
Referenced by keyPressed().
void FIFE::CommandLine::toggleCaretVisible | ( | ) |
Toggle the caret visibility.
Definition at line 53 of file commandline.cpp.
References m_caretVisible.
Referenced by CommandLine().
|
private |
Definition at line 79 of file commandline.h.
Referenced by CommandLine(), startBlinking(), and stopBlinking().
|
private |
Definition at line 74 of file commandline.h.
Referenced by keyPressed(), and setCallback().
|
private |
Definition at line 78 of file commandline.h.
Referenced by drawCaret(), stopBlinking(), and toggleCaretVisible().
|
private |
Definition at line 77 of file commandline.h.
Referenced by keyPressed().
|
private |
Definition at line 75 of file commandline.h.
Referenced by keyPressed().
|
private |
Definition at line 76 of file commandline.h.
Referenced by keyPressed().
|
private |
Definition at line 80 of file commandline.h.
Referenced by CommandLine(), startBlinking(), and stopBlinking().