Sparkle 0.0.1
Loading...
Searching...
No Matches
spk::Module::KeyboardModule Class Referencefinal

Dispatches keyboard events to a bound widget and tracks keyboard state. More...

#include <spk_keyboard_module.hpp>

Inheritance diagram for spk::Module::KeyboardModule:
Inheritance graph
Collaboration diagram for spk::Module::KeyboardModule:
Collaboration graph

Public Member Functions

spk::Keyboardkeyboard ()
 Accesses the managed keyboard state.
const spk::Keyboardkeyboard () const
 Accesses the managed keyboard state.
Public Member Functions inherited from spk::Module::EventBasedModule< spk::KeyboardEvent >
EventBasedModuleoperator= (const EventBasedModule &)=delete
void setWidget (spk::Widget *p_widget)
 Binds the module to a widget that will receive callbacks.
spk::Widgetwidget () const
 Returns the currently bound widget.
void insertEvent (spk::KeyboardEvent &&p_ievent)
 Queues a new event to be processed later.
bool hasEvent () const
 Checks whether the module has pending events.
void treatEvents ()
 Processes all queued events by invoking _treatEvent.

Protected Member Functions

void _treatEvent (spk::KeyboardEvent &p_ievent) override
 Handles a single keyboard event and forwards it to the widget.

Detailed Description

Dispatches keyboard events to a bound widget and tracks keyboard state.

See also
MouseModule, SystemModule
keyboard.setWidget(&rootWidget);
keyboard.keyboard().setKeyState(spk::Key::A, true);
Dispatches keyboard events to a bound widget and tracks keyboard state.
Definition spk_keyboard_module.hpp:23
spk::Keyboard & keyboard()
Accesses the managed keyboard state.
Definition spk_keyboard_module.cpp:43

Member Function Documentation

◆ _treatEvent()

void spk::Module::KeyboardModule::_treatEvent ( spk::KeyboardEvent & p_ievent)
overrideprotectedvirtual

Handles a single keyboard event and forwards it to the widget.

Parameters
p_ieventEvent to treat.

Implements spk::Module::EventBasedModule< spk::KeyboardEvent >.

Here is the call graph for this function:

◆ keyboard() [1/2]

spk::Keyboard & spk::Module::KeyboardModule::keyboard ( )

Accesses the managed keyboard state.

Returns
Mutable keyboard reference.
See also
keyboard() const

◆ keyboard() [2/2]

const spk::Keyboard & spk::Module::KeyboardModule::keyboard ( ) const

Accesses the managed keyboard state.

Returns
Const keyboard reference.
See also
keyboard()

The documentation for this class was generated from the following files:
  • includes/structure/application/module/spk_keyboard_module.hpp
  • srcs/structure/application/module/spk_keyboard_module.cpp