Empirical
Public Member Functions | List of all members
emp::web::KeypressManager Class Reference

#include <KeypressManager.h>

Public Member Functions

 KeypressManager ()
 
 ~KeypressManager ()
 
int GetFunCount () const
 
int GetNextOrder () const
 
void AddKeydownCallback (std::function< bool(const KeyboardEvent &)> cb_fun, int order=-1)
 
void AddKeydownCallback (char key, std::function< void()> cb_fun, int order=-1)
 
void AddKeydownCallback (const std::string &key_set, const std::function< void()> &cb_fun, int order)
 
void AddKeydownCallback (const std::string &key_set, const std::function< void()> &cb_fun)
 Provide a whole set of keys that should all trigger the same function; use default ordering. More...
 

Constructor & Destructor Documentation

emp::web::KeypressManager::KeypressManager ( )
inline
emp::web::KeypressManager::~KeypressManager ( )
inline

Member Function Documentation

void emp::web::KeypressManager::AddKeydownCallback ( std::function< bool(const KeyboardEvent &)>  cb_fun,
int  order = -1 
)
inline

Link a function to the KeypressManager that is called for any unresolved keypress. The function must take in an html5::KeyboardEvent (which includes information about the specific key pressed as well as any modifiers such as SHIFT or CTRL) and it must return a boolean value indicating whether it has resolved the keypress.

void emp::web::KeypressManager::AddKeydownCallback ( char  key,
std::function< void()>  cb_fun,
int  order = -1 
)
inline

Link a specific key to a target function to be called when that key is pressed. The function my return a void and take no arguments.

void emp::web::KeypressManager::AddKeydownCallback ( const std::string &  key_set,
const std::function< void()> &  cb_fun,
int  order 
)
inline

Provide a whole set of keys that should all trigger the same function, including an ordering for priority.

void emp::web::KeypressManager::AddKeydownCallback ( const std::string &  key_set,
const std::function< void()> &  cb_fun 
)
inline

Provide a whole set of keys that should all trigger the same function; use default ordering.

int emp::web::KeypressManager::GetFunCount ( ) const
inline
int emp::web::KeypressManager::GetNextOrder ( ) const
inline

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