libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
MouseEvent Class Reference

Event delivered for mouse input. More...

#include <mouseevent.h>

Inheritance diagram for MouseEvent:
Collaboration diagram for MouseEvent:

Public Types

enum  Button : uint8_t { NoButton = 0x00 , LeftButton = 0x01 , MiddleButton = 0x02 , RightButton = 0x04 }
 Mouse button flags (bit values for combining).
 
enum  Action : uint8_t {
  Press , Release , Move , DoubleClick ,
  ScrollUp , ScrollDown
}
 Mouse action enumeration.
 
enum  Modifier : uint8_t {
  NoModifier = 0x00 , ShiftModifier = 0x01 , CtrlModifier = 0x02 , AltModifier = 0x04 ,
  MetaModifier = 0x08
}
 Modifier flags (same as KeyEvent).
 
- Public Types inherited from Event
using Type = uint32_t
 Integer type used to identify event kinds.
 

Public Member Functions

 MouseEvent (const Point2Di32 &pos, Button button, Action action, uint8_t modifiers=NoModifier, uint8_t buttons=0)
 Constructs a MouseEvent.
 
const Point2Di32pos () const
 Returns the mouse position (column, row).
 
int x () const
 Returns the X coordinate (column).
 
int y () const
 Returns the Y coordinate (row).
 
Button button () const
 Returns the mouse button.
 
Action action () const
 Returns the mouse action.
 
uint8_t modifiers () const
 Returns the modifier flags.
 
uint8_t buttons () const
 Returns the bitmask of all currently pressed buttons.
 
- Public Member Functions inherited from Event
 Event (Type type)
 Constructs an Event with the given type.
 
virtual ~Event ()=default
 Virtual destructor.
 
Type type () const
 Returns the type identifier for this event.
 
bool isAccepted () const
 Returns whether this event has been accepted.
 
void accept ()
 Marks the event as accepted.
 
void ignore ()
 Marks the event as ignored (not accepted).
 

Static Public Member Functions

static String buttonName (Button button)
 Returns a human-readable name for the given button.
 
static String buttonsString (uint8_t buttons)
 Returns a human-readable string for a button bitmask (e.g. "Left Right").
 
static String actionName (Action action)
 Returns a human-readable name for the given action.
 
- Static Public Member Functions inherited from Event
static Type registerType ()
 Allocates and returns a unique event type ID.
 

Static Public Attributes

static const Type Mouse
 Event type ID for MouseEvent.
 
- Static Public Attributes inherited from Event
static constexpr Type InvalidType = 0
 Sentinel value representing an invalid or unset event type.
 
static const Type Timer
 Event type for TimerEvent.
 
static const Type DeferredCall
 Event type for deferred callable delivery.
 
static const Type SignalEvent
 Event type for cross-thread signal dispatch.
 
static const Type Quit
 Event type requesting an EventLoop to quit.
 

Detailed Description

Event delivered for mouse input.

Carries the mouse position, button, action type, and modifier flags. Registered via Event::registerType().

Constructor & Destructor Documentation

◆ MouseEvent()

MouseEvent::MouseEvent ( const Point2Di32 pos,
Button  button,
Action  action,
uint8_t  modifiers = NoModifier,
uint8_t  buttons = 0 
)
inline

Constructs a MouseEvent.

Parameters
posThe mouse position (column, row).
buttonThe button that triggered this event.
actionThe action type.
modifiersThe modifier flags.
buttonsBitmask of all currently pressed buttons.

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