ScummVM API documentation
Common::Keymap Class Reference

Public Types

enum  KeymapType { kKeymapTypeGlobal , kKeymapTypeGui , kKeymapTypeGame }
 
enum  KeymapMatch { kKeymapMatchNone , kKeymapMatchPartial , kKeymapMatchExact }
 
typedef Array< Action * > ActionArray
 

Public Member Functions

 Keymap (KeymapType type, const String &id, const U32String &description)
 
 Keymap (KeymapType type, const String &id, const String &description)
 
void setConfigDomain (ConfigManager::Domain *configDomain)
 
void setHardwareInputs (HardwareInputSet *hardwareInputSet)
 
void setBackendDefaultBindings (const KeymapperDefaultBindings *backendDefaultBindings)
 
void registerMapping (Action *action, const HardwareInput &input)
 
void unregisterMapping (Action *action)
 
void resetMapping (Action *action)
 
Array< HardwareInput > getActionMapping (const Action *action) const
 
KeymapMatch getMappedActions (const Event &event, ActionArray &actions) const
 
void addAction (Action *action)
 
const ActionArray & getActions () const
 
StringArray getActionDefaultMappings (Action *action)
 
void loadMappings ()
 
void saveMappings ()
 
const String & getId () const
 
const U32String & getDescription () const
 
KeymapType getType () const
 
bool isPartialMatchAllowed () const
 
void setPartialMatchAllowed (bool partialMatchAllowed)
 
bool isEnabled () const
 
void setEnabled (bool enabled)
 

Static Public Member Functions

static Array< Keymap * > arrayOf (Keymap *keymap)
 

Member Function Documentation

◆ registerMapping()

void Common::Keymap::registerMapping ( Action *  action,
const HardwareInput &  input 
)

Registers a HardwareInput to the given Action

Parameters
actionAction in this Keymap
keypointer to HardwareInput to map
See also
Action::mapKey

◆ unregisterMapping()

void Common::Keymap::unregisterMapping ( Action *  action)

Unregisters a HardwareInput from the given Action (if one is mapped)

Parameters
actionAction in this Keymap
See also
Action::mapKey

◆ resetMapping()

void Common::Keymap::resetMapping ( Action *  action)

Reset an action's mapping to its defaults

Parameters
action

◆ getActionMapping()

Array< HardwareInput > Common::Keymap::getActionMapping ( const Action *  action) const

Find the hardware input an action is mapped to, if any

◆ getMappedActions()

KeymapMatch Common::Keymap::getMappedActions ( const Event &  event,
ActionArray &  actions 
) const

Find the Actions that a hardware input is mapped to

Parameters
hardwareInputthe input that is mapped to the required Action
actionsan array containing pointers to the actions
Returns
the matching status for the retieved actions

◆ addAction()

void Common::Keymap::addAction ( Action *  action)

Adds a new Action to this Map

Takes ownership of the action.

Parameters
actionthe Action to add

◆ getActions()

const ActionArray & Common::Keymap::getActions ( ) const
inline

Get the list of all the Actions contained in this Keymap

◆ getActionDefaultMappings()

StringArray Common::Keymap::getActionDefaultMappings ( Action *  action)

Get the default input mappings for an action.

Backend-specific mappings replace the default mappings specified when creating the keymap.

◆ loadMappings()

void Common::Keymap::loadMappings ( )

Load this keymap's mappings from the config manager.

Parameters
hwInputsthe set to retrieve hardware input pointers from

◆ saveMappings()

void Common::Keymap::saveMappings ( )

Save this keymap's mappings to the config manager

Note
Changes are not flushed to disk, to do so call ConfMan.flushToDisk()

◆ isEnabled()

bool Common::Keymap::isEnabled ( ) const
inline

Defines if the keymap is considered when mapping events

◆ arrayOf()

static Array< Keymap * > Common::Keymap::arrayOf ( Keymap *  keymap)
inlinestatic

Helper to return an array with a single keymap element


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