ImFusion SDK 4.3
InputEventMapper< T > Class Template Reference

#include <ImFusion/GUI/InputEventMapper.h>

Specialization of InputEventMapperBase with a templated action enumeration type to increase type safety. More...

+ Inheritance diagram for InputEventMapper< T >:

Detailed Description

template<typename T>
class ImFusion::GUI::InputEventMapper< T >

Specialization of InputEventMapperBase with a templated action enumeration type to increase type safety.

See the documentation of InputEventMapperBase for details and usage examples.

Public Member Functions

bool addMapping (T action, MouseEvent::Button button, Flags< InputEvent::KeyboardModifier > modifiers)
 Adds a new mouse interaction metaphor and map it to the given action.
 
bool addMapping (T action, KeyEvent::Key button, Flags< InputEvent::KeyboardModifier > modifiers)
 Adds a new keyboard interaction metaphor and map it to the given action.
 
int removeMapping (T action)
 Removes all existing mappings for the given action and returns the number of mappings removed.
 
bool removeMapping (T action, MouseEvent::Button button, Flags< InputEvent::KeyboardModifier > modifiers)
 Removes the given mouse interaction mapping.
 
bool removeMapping (T action, KeyEvent::Key button, Flags< InputEvent::KeyboardModifier > modifiers)
 Removes the given keyboard interaction mapping.
 
std::optional< T > matchAny (const InputEvent &event) const
 
std::optional< T > matchAny (MouseEvent::Button button, Flags< InputEvent::KeyboardModifier > modifiers) const
 
std::optional< T > matchAny (KeyEvent::Key key, Flags< InputEvent::KeyboardModifier > modifiers) const
 
std::vector< T > matchAll (const InputEvent &event) const
 
std::vector< T > matchAll (MouseEvent::Button button, Flags< InputEvent::KeyboardModifier > modifiers) const
 
std::vector< T > matchAll (KeyEvent::Key key, Flags< InputEvent::KeyboardModifier > modifiers) const
 
bool matches (const InputEvent &event, T action) const
 
bool matches (MouseEvent::Button button, Flags< InputEvent::KeyboardModifier > modifiers, T action) const
 
bool matches (KeyEvent::Key key, Flags< InputEvent::KeyboardModifier > modifiers, T action) const
 
- Public Member Functions inherited from InputEventMapperBase
bool allowsDuplicateMappings () const
 Returns whether it should allow a single mouse/keyboard combination map to multiple different actions.
 
void setAllowDuplicateMappings (bool value)
 Sets whether it should allow a single mouse/keyboard combination map to multiple different actions.
 
bool addMapping (int32_t action, MouseEvent::Button button, Flags< InputEvent::KeyboardModifier > modifiers)
 Adds a new mouse interaction metaphor and map it to the given action.
 
bool addMapping (int32_t action, KeyEvent::Key key, Flags< InputEvent::KeyboardModifier > modifiers)
 Adds a new keyboard interaction metaphor and map it to the given action.
 
int removeMapping (int32_t action)
 Removes all existing mappings for the given action and returns the number of mappings removed.
 
bool removeMapping (int32_t action, MouseEvent::Button button, Flags< InputEvent::KeyboardModifier > modifiers)
 Removes the given mouse interaction mapping.
 
bool removeMapping (int32_t action, KeyEvent::Key key, Flags< InputEvent::KeyboardModifier > modifiers)
 Removes the given keyboard interaction mapping.
 
void clear ()
 Removes all existing mappings.
 
std::optional< int32_t > matchAny (const InputEvent &event) const
 Matches the given event against the defined mappings and returns the first corresponding action value.
 
std::optional< int32_t > matchAny (MouseEvent::Button button, Flags< InputEvent::KeyboardModifier > modifiers) const
 Matches the given mouse interaction against the defined mappings and returns the first corresponding action value.
 
std::optional< int32_t > matchAny (KeyEvent::Key key, Flags< InputEvent::KeyboardModifier > modifiers) const
 Matches the given keyboard interaction against the defined mappings and returns the first corresponding action value.
 
std::vector< int32_t > matchAll (const InputEvent &event) const
 Matches the given event against the defined mappings and returns all corresponding action values.
 
std::vector< int32_t > matchAll (MouseEvent::Button button, Flags< InputEvent::KeyboardModifier > modifiers) const
 Matches the given mouse interaction against the defined mappings and returns all corresponding action values.
 
std::vector< int32_t > matchAll (KeyEvent::Key key, Flags< InputEvent::KeyboardModifier > modifiers) const
 Matches the given keyboard interaction against the defined mappings and returns all corresponding action values.
 
bool matches (const InputEvent &event, int32_t action) const
 Returns true if the given event matches the given action.
 
bool matches (MouseEvent::Button button, Flags< InputEvent::KeyboardModifier > modifiers, int32_t action) const
 Returns true if the given mouse interaction matches the given action.
 
bool matches (KeyEvent::Key key, Flags< InputEvent::KeyboardModifier > modifiers, int32_t action) const
 Returns true if the given keyboard interaction matches the given action.
 
void configure (const Properties *p) override
 Configure this object instance by de-serializing the given Properties.
 
void configuration (Properties *p) const override
 Serialize the current object configuration into the given Properties object.
 
- Public Member Functions inherited from Configurable
virtual void configureDefaults ()
 Retrieve the properties of this object, replaces values with their defaults and sets it again.
 
void registerParameter (ParameterBase *param)
 Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
 
void unregisterParameter (const ParameterBase *param)
 Remove the given Parameter or SubProperty from the list of registered parameters.
 
 Configurable (const Configurable &rhs)
 
 Configurable (Configurable &&rhs) noexcept
 
Configurableoperator= (const Configurable &)
 
Configurableoperator= (Configurable &&) noexcept
 

Additional Inherited Members

- Public Attributes inherited from Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
 
- Protected Attributes inherited from InputEventMapperBase
std::vector< MouseMappingm_mouseMappings
 
std::vector< KeyboardMappingm_keyboardMappings
 
bool m_allowDuplicateMappings = false
 
- Protected Attributes inherited from Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.
 

Member Function Documentation

◆ addMapping() [1/2]

template<typename T>
bool addMapping ( T action,
MouseEvent::Button button,
Flags< InputEvent::KeyboardModifier > modifiers )
inline

Adds a new mouse interaction metaphor and map it to the given action.

Returns false if the given action was not added due to a conflict (same button+modifiers but different action and allowsDuplicateMappings() is off). You can use matchAny() to query in advance if a particular mapping will conflict, e.g. matchAny(button, modifiers) != action.

◆ addMapping() [2/2]

template<typename T>
bool addMapping ( T action,
KeyEvent::Key button,
Flags< InputEvent::KeyboardModifier > modifiers )
inline

Adds a new keyboard interaction metaphor and map it to the given action.

Returns false if the given action was not added due to a conflict (same button+modifiers but different action and allowsDuplicateMappings() is off). You can use matchAny() to query in advance if a particular mapping will conflict, e.g. matchAny(button, modifiers) != action.

◆ removeMapping() [1/3]

template<typename T>
int removeMapping ( T action)
inline

Removes all existing mappings for the given action and returns the number of mappings removed.

◆ removeMapping() [2/3]

template<typename T>
bool removeMapping ( T action,
MouseEvent::Button button,
Flags< InputEvent::KeyboardModifier > modifiers )
inline

Removes the given mouse interaction mapping.

◆ removeMapping() [3/3]

template<typename T>
bool removeMapping ( T action,
KeyEvent::Key button,
Flags< InputEvent::KeyboardModifier > modifiers )
inline

Removes the given keyboard interaction mapping.

◆ matchAny() [1/3]

template<typename T>
std::optional< T > matchAny ( const InputEvent & event) const
inline

◆ matchAny() [2/3]

template<typename T>
std::optional< T > matchAny ( MouseEvent::Button button,
Flags< InputEvent::KeyboardModifier > modifiers ) const
inline

◆ matchAny() [3/3]

template<typename T>
std::optional< T > matchAny ( KeyEvent::Key key,
Flags< InputEvent::KeyboardModifier > modifiers ) const
inline

◆ matchAll() [1/3]

template<typename T>
std::vector< T > matchAll ( const InputEvent & event) const
inline

◆ matchAll() [2/3]

template<typename T>
std::vector< T > matchAll ( MouseEvent::Button button,
Flags< InputEvent::KeyboardModifier > modifiers ) const
inline

◆ matchAll() [3/3]

template<typename T>
std::vector< T > matchAll ( KeyEvent::Key key,
Flags< InputEvent::KeyboardModifier > modifiers ) const
inline

◆ matches() [1/3]

template<typename T>
bool matches ( const InputEvent & event,
T action ) const
inline

◆ matches() [2/3]

template<typename T>
bool matches ( MouseEvent::Button button,
Flags< InputEvent::KeyboardModifier > modifiers,
T action ) const
inline

◆ matches() [3/3]

template<typename T>
bool matches ( KeyEvent::Key key,
Flags< InputEvent::KeyboardModifier > modifiers,
T action ) const
inline


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close