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

Handles events that are triggered by the mouse driver. More...

#include <mouse.h>

Inheritance diagram for MaxOS::drivers::peripherals::MouseEventHandler:
MaxOS::common::EventHandler< MouseEvents > MaxOS::gui::WidgetMoverResizer< 1, 1, 0, 0 > MaxOS::gui::WidgetMoverResizer< 0, 1, 0, -1 > MaxOS::gui::WidgetMoverResizer< 0, 0, 0, 1 > MaxOS::gui::WidgetMoverResizer< 1, 0, -1, 0 > MaxOS::gui::WidgetMoverResizer< 0, 0, 1, 0 > MaxOS::gui::WidgetMoverResizer< 1, 1, -1, -1 > MaxOS::gui::WidgetMoverResizer< 0, 1, 1, -1 > MaxOS::gui::WidgetMoverResizer< 1, 0, -1, 1 > MaxOS::gui::WidgetMoverResizer< 0, 0, 1, 1 > MaxOS::gui::Desktop MaxOS::gui::WidgetMoverResizer< Left, Top, Width, Height >

Public Member Functions

common::Event< MouseEvents > * on_event (common::Event< MouseEvents > *) override
 Handles the triggered event and calls the appropriate function.
 
virtual void on_mouse_down_event (uint8_t button)
 Called when the mouse is pressed.
 
virtual void on_mouse_up_event (uint8_t button)
 Called when the mouse is released.
 
virtual void on_mouse_move_event (int8_t x, int8_t y)
 Called when the mouse is moved.
 
- Public Member Functions inherited from MaxOS::common::EventHandler< MouseEvents >
virtual Event< MouseEvents > * on_event (Event< MouseEvents > *event)
 This function is called when an event is raised.
 

Detailed Description

Handles events that are triggered by the mouse driver.

Definition at line 72 of file mouse.h.

Member Function Documentation

◆ on_event()

Event< MouseEvents > * MouseEventHandler::on_event ( common::Event< MouseEvents > *  event)
override

Handles the triggered event and calls the appropriate function.

Parameters
eventThe event that was triggered
Returns
The event that was triggered with the modified data

Definition at line 25 of file mouse.cpp.

25 {
26 switch(event->type) {
27
28 case MouseEvents::MOVE:
30 ((MouseMoveEvent*) event)->y);
31 break;
32
33 case MouseEvents::DOWN:
34 this->on_mouse_down_event(((MouseDownEvent*) event)->button);
35 break;
36
37 case MouseEvents::UP:
38 this->on_mouse_up_event(((MouseUpEvent*) event)->button);
39 break;
40
41 }
42
43 return event;
44}
Stores the left, top, width and height of a rectangle.
Definition rectangle.h:22
Event that is triggered when a mouse button is pressed, holds the button that was pressed.
Definition mouse.h:50
virtual void on_mouse_down_event(uint8_t button)
Called when the mouse is pressed.
Definition mouse.cpp:51
virtual void on_mouse_up_event(uint8_t button)
Called when the mouse is released.
Definition mouse.cpp:60
virtual void on_mouse_move_event(int8_t x, int8_t y)
Called when the mouse is moved.
Definition mouse.cpp:70
Event that is triggered when the mouse moves, holds the x and y coordinates.
Definition mouse.h:38
Event that is triggered when a mouse button is released, holds the button that was released.
Definition mouse.h:61

References on_mouse_down_event(), on_mouse_move_event(), and on_mouse_up_event().

◆ on_mouse_down_event()

void MouseEventHandler::on_mouse_down_event ( uint8_t  button)
virtual

Called when the mouse is pressed.

Parameters
buttonThe button that was pressed

Reimplemented in MaxOS::gui::Desktop.

Definition at line 51 of file mouse.cpp.

51 {
52
53}

Referenced by on_event().

◆ on_mouse_move_event()

◆ on_mouse_up_event()

void MouseEventHandler::on_mouse_up_event ( uint8_t  button)
virtual

Called when the mouse is released.

Parameters
buttonThe button that was released

Reimplemented in MaxOS::gui::Desktop.

Definition at line 60 of file mouse.cpp.

60 {
61
62}

Referenced by on_event().


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