Max OS 0.3
Loading...
Searching...
No Matches
MaxOS::drivers::peripherals::KeyboardEventHandler Class Reference

Handles the events that are triggered by the Keyboard Driver. More...

#include <keyboard.h>

Inheritance diagram for MaxOS::drivers::peripherals::KeyboardEventHandler:
MaxOS::common::EventHandler< KeyboardEvents > MaxOS::gui::Widget MaxOS::gui::CompositeWidget MaxOS::gui::widgets::Button MaxOS::gui::widgets::InputBox MaxOS::gui::widgets::Text MaxOS::gui::Desktop MaxOS::gui::Window

Public Member Functions

common::Event< KeyboardEvents > * on_event (common::Event< KeyboardEvents > *) override
 Handle the trigger of an event.
 
virtual void on_key_down (KeyCode, const KeyboardState &)
 Handle the key down event.
 
virtual void on_key_up (KeyCode, const KeyboardState &)
 Handle the key up event.
 
- Public Member Functions inherited from MaxOS::common::EventHandler< KeyboardEvents >
virtual Event< KeyboardEvents > * on_event (Event< KeyboardEvents > *event)
 This function is called when an event is raised.
 

Detailed Description

Handles the events that are triggered by the Keyboard Driver.

Definition at line 274 of file keyboard.h.

Member Function Documentation

◆ on_event()

Event< KeyboardEvents > * KeyboardEventHandler::on_event ( common::Event< KeyboardEvents > *  event)
override

Handle the trigger of an event.

Parameters
eventThe event to handle
Returns
The event that was passed with the data modified

Definition at line 45 of file keyboard.cpp.

45 {
46
47 switch (event->type) {
48
49 case KeyboardEvents::KEYDOWN:
50 this->on_key_down(((KeyDownEvent *) event)->key_code, ((KeyDownEvent *) event)->keyboard_state);
51 break;
52
53 case KeyboardEvents::KEYUP:
54 this->on_key_up(((KeyUpEvent *) event)->key_code, ((KeyUpEvent *) event)->keyboard_state);
55 break;
56
57 default:
58 break;
59 }
60
61 return event;
62}
Stores the left, top, width and height of a rectangle.
Definition rectangle.h:22
Event that is triggered when a key is pressed.
Definition keyboard.h:261
Event that is triggered when a key is released.
Definition keyboard.h:248
virtual void on_key_up(KeyCode, const KeyboardState &)
Handle the key up event.
Definition keyboard.cpp:36
virtual void on_key_down(KeyCode, const KeyboardState &)
Handle the key down event.
Definition keyboard.cpp:27

References on_key_down(), and on_key_up().

◆ on_key_down()

void KeyboardEventHandler::on_key_down ( KeyCode  key_down_code,
const KeyboardState key_down_state 
)
virtual

Handle the key down event.

Parameters
key_down_codeThe keycode of the key that was pressed
key_down_stateThe state of the keyboard when the key was pressed

Reimplemented in MaxOS::gui::Desktop, and MaxOS::gui::widgets::InputBox.

Definition at line 27 of file keyboard.cpp.

27 {
28}

Referenced by on_event(), and MaxOS::gui::Desktop::on_key_down().

◆ on_key_up()

void KeyboardEventHandler::on_key_up ( KeyCode  key_up_code,
const KeyboardState key_up_state 
)
virtual

Handle the key up event.

Parameters
key_up_codeThe keycode of the key that was released
key_up_stateThe state of the keyboard when the key was released

Reimplemented in MaxOS::gui::Desktop.

Definition at line 36 of file keyboard.cpp.

36 {
37}

Referenced by on_event(), and MaxOS::gui::Desktop::on_key_up().


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