Milo  0.1
Milo:EquationManipulationProgram
Private Attributes | List of all members
UI::KeyEvent Class Reference

#include <ui.h>

Public Member Functions

Constructors
 KeyEvent (Keyboard key, enum Modifiers md=NO_MOD)
 
 KeyEvent (char key, enum Modifiers md=NO_MOD)
 
 KeyEvent (const std::string &key)
 
constexpr KeyEvent (const KeyEvent &e)
 
KeyEvent class accessors
Keyboard getKey () const
 
enum Modifiers getModifiers () const
 
bool noMod () const
 
bool shiftMod () const
 
bool altMod () const
 
 operator bool () const
 
Help member functions
std::size_t hash () const
 
bool equals (const KeyEvent e) const
 
KeyEvent & operator= (const KeyEvent &e)
 
std::string toString () const
 

Private Attributes

Keyboard m_key
 Key code.
 
enum Modifiers m_mod
 Modifiers state.
 

Detailed Description

Milo UI Key Event. All milo UI key events are uniquely stored in this class. It is designed to uniquely designate an event for the unordered map of events to function calls.

Constructor & Destructor Documentation

UI::KeyEvent::KeyEvent ( Keyboard  key,
enum Modifiers  md = NO_MOD 
)
inline

Universal event constructor.

Parameters
keyKey code.
mModifiers for key.
UI::KeyEvent::KeyEvent ( char  key,
enum Modifiers  md = NO_MOD 
)
inline

Default key event constructor. Construct an event for ascii code with no modifier keys.

Parameters
keyAscii character.
UI::KeyEvent::KeyEvent ( const std::string &  key)

Key event constructor that reads key event from string of format [[[CTRL]_ALT]_SHIFT]-letter.

constexpr UI::KeyEvent::KeyEvent ( const KeyEvent &  e)
inline

Copy constructor that can be a constexpr

Member Function Documentation

bool UI::KeyEvent::altMod ( ) const
inline

Check key event for alt key modifier.

Returns
True if there is alt key modifier.
bool UI::KeyEvent::equals ( const KeyEvent  e) const
inline

Return true is this key event is equal to parameter

Parameters
eKey event to compare
Returns
True if equal
Keyboard UI::KeyEvent::getKey ( ) const
inline
Returns
Key code.
enum Modifiers UI::KeyEvent::getModifiers ( ) const
inline
Returns
Modifiers state.
std::size_t UI::KeyEvent::hash ( ) const
inline

Calculate hash for this class object. Used by unordered map.

Returns
Hash value.
bool UI::KeyEvent::noMod ( ) const
inline

Check key event for no key modifiers.

Returns
True if there are no key modifiers.
UI::KeyEvent::operator bool ( ) const
inline

Return true if valid key

KeyEvent& UI::KeyEvent::operator= ( const KeyEvent &  e)
inline

Assign value of key event paramter

Parameters
eKey event to assign
Returns
Reference to this key event
bool UI::KeyEvent::shiftMod ( ) const
inline

Check key event for shift key modifier.

Returns
True if there is shift key modifier.
string KeyEvent::toString ( ) const

Create string representing event.

Returns
String representing event

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