FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
FIFE::CommandLine Class Reference

A Command line widget. More...

#include <commandline.h>

Inherits TextField.

+ Collaboration diagram for FIFE::CommandLine:

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
 

Detailed Description

A Command line widget.

Definition at line 43 of file commandline.h.

Member Typedef Documentation

◆ type_callback

typedef std::function<void(std::string)> FIFE::CommandLine::type_callback

Definition at line 45 of file commandline.h.

Constructor & Destructor Documentation

◆ CommandLine()

FIFE::CommandLine::CommandLine ( )

◆ ~CommandLine()

FIFE::CommandLine::~CommandLine ( )

Destructor.

Definition at line 50 of file commandline.cpp.

Member Function Documentation

◆ drawCaret()

void FIFE::CommandLine::drawCaret ( fcn::Graphics *  graphics,
int32_t  x 
)
virtual

Definition at line 136 of file commandline.cpp.

References m_caretVisible.

◆ keyPressed()

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

◆ setCallback()

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

+ Here is the caller graph for this function:

◆ startBlinking()

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

+ Here is the caller graph for this function:

◆ stopBlinking()

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

+ Here is the caller graph for this function:

◆ toggleCaretVisible()

void FIFE::CommandLine::toggleCaretVisible ( )

Toggle the caret visibility.

Definition at line 53 of file commandline.cpp.

References m_caretVisible.

Referenced by CommandLine().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_blinkTimer

Timer FIFE::CommandLine::m_blinkTimer
private

Definition at line 79 of file commandline.h.

Referenced by CommandLine(), startBlinking(), and stopBlinking().

◆ m_callback

type_callback FIFE::CommandLine::m_callback
private

Definition at line 74 of file commandline.h.

Referenced by keyPressed(), and setCallback().

◆ m_caretVisible

bool FIFE::CommandLine::m_caretVisible
private

Definition at line 78 of file commandline.h.

Referenced by drawCaret(), stopBlinking(), and toggleCaretVisible().

◆ m_cmdline

std::string FIFE::CommandLine::m_cmdline
private

Definition at line 77 of file commandline.h.

Referenced by keyPressed().

◆ m_history

std::vector<std::string> FIFE::CommandLine::m_history
private

Definition at line 75 of file commandline.h.

Referenced by keyPressed().

◆ m_history_position

size_t FIFE::CommandLine::m_history_position
private

Definition at line 76 of file commandline.h.

Referenced by keyPressed().

◆ m_suppressBlinkTimer

Timer FIFE::CommandLine::m_suppressBlinkTimer
private

Definition at line 80 of file commandline.h.

Referenced by CommandLine(), startBlinking(), and stopBlinking().


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