23#include "utility/event/keyboard_event.hpp"
25namespace utility::event
28 KeyboardEvent::Factory::~Factory(
void) =
default;
32 return std::make_unique<KeyboardEvent>();
35 std::shared_ptr<KeyboardEvent>
38 return std::make_unique<KeyboardEvent>();
70 _modifiers = std::bitset<sizeof(KeyModifiers) * 8>(
71 static_cast<std::size_t
>(modifiers));
78 const auto mask =
static_cast<std::size_t
>(modifier);
80 return _modifiers.none();
82 return (_modifiers.to_ulong() & mask) != 0;
98 isRepeatEvent = isRepeat;
104 return isRepeatEvent;
std::shared_ptr< KeyboardEvent > createTyped(void) const
Create a strongly-typed KeyboardEvent.
std::shared_ptr< Event > create(void) const override
Create a KeyboardEvent as a base Event pointer.
Keyboard event representation.
bool isModifierSet(const KeyModifiers modifier) const noexcept
Check if a specific key modifier is set.
KeyboardEvent & setIsRepeatEvent(const bool isRepeat) noexcept
Set whether the event is a key repeat event.
KeyboardEvent & setModifiers(const KeyModifiers modifiers) noexcept
Set the key modifiers.
KeyboardEvent & setScancode(const ScanCode scancode) noexcept
Set the keyboard scancode.
bool getIsDownEvent(void) const noexcept
Check if the event is a key down event.
KeyboardEvent(void)
Default constructor.
bool getIsRepeatEvent(void) const noexcept
Check if the event is a key repeat event.
KeyCode
Virtual key codes derived from keyboard scancodes.
KeyboardEvent & setIsDownEvent(const bool isDown) noexcept
Set whether the event is a key down event.
ScanCode getScancode(void) const noexcept
Get the keyboard scancode.
KeyModifiers
Key modifier flags.
KeyboardEvent & setKeycode(const KeyCode keycode) noexcept
Set the virtual key code.
~KeyboardEvent(void) override
Default destructor.
KeyCode getKeycode(void) const noexcept
Get the virtual key code.