ScummVM API documentation
Ultima::Ultima4::KeyHandler Class Reference

#include <key_handler_controller.h>

Classes

struct  GetChoice
 
struct  ReadBuffer
 

Public Types

typedef bool(* Callback) (int, void *)
 
typedef struct Ultima::Ultima4::KeyHandler::ReadBuffer ReadBuffer
 
typedef struct Ultima::Ultima4::KeyHandler::GetChoice GetChoice
 

Public Member Functions

 KeyHandler (Callback func, void *data=nullptr, bool asyncronous=true)
 
bool operator== (Callback cb) const
 
bool handle (int key)
 
virtual bool isKeyIgnored (int key)
 

Static Public Member Functions

static bool globalHandler (int key)
 
static bool defaultHandler (int key, void *data)
 
static bool ignoreKeys (int key, void *data)
 

Protected Attributes

Callback _handler
 
bool _async
 
void * _data
 

Detailed Description

A class for handling keystrokes.

Member Typedef Documentation

◆ ReadBuffer

Additional information to be passed as data param for read buffer key handler

◆ GetChoice

Additional information to be passed as data param for get choice key handler

Member Function Documentation

◆ globalHandler()

static bool Ultima::Ultima4::KeyHandler::globalHandler ( int  key)
static

Handles any and all keystrokes. Generally used to exit the application, switch applications, minimize, maximize, etc.

◆ defaultHandler()

static bool Ultima::Ultima4::KeyHandler::defaultHandler ( int  key,
void *  data 
)
static

A default key handler that should be valid everywhere

◆ ignoreKeys()

static bool Ultima::Ultima4::KeyHandler::ignoreKeys ( int  key,
void *  data 
)
static

A key handler that ignores keypresses

◆ handle()

bool Ultima::Ultima4::KeyHandler::handle ( int  key)

Handles a keypress. First it makes sure the key combination is not ignored by the current key handler. Then, it passes the keypress through the global key handler. If the global handler does not process the keystroke, then the key handler handles it itself by calling its handler callback function.

◆ isKeyIgnored()

virtual bool Ultima::Ultima4::KeyHandler::isKeyIgnored ( int  key)
virtual

Returns true if the key or key combination is always ignored by xu4


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