1.8 |
Basic class for interpreting mouse events. More...
Public Types | |
using | MouseCallback = std::function< void(Event &event)> |
Type for mouse event callback. More... | |
Public Member Functions | |
MouseGesture () noexcept | |
EGT_NODISCARD bool | active () const |
Is active? More... | |
EGT_NODISCARD bool | dragging () const |
Is dragging? More... | |
Event | handle (const Event &event) |
Pass the raw EventId to this function to get the emulated mouse event. More... | |
EGT_NODISCARD const DisplayPoint & | mouse_start () const |
Get pointer start position. More... | |
void | on_async_event (MouseCallback callback) |
Register a callback function to handle the async mouse events. More... | |
void | start (const DisplayPoint &point) |
Start. More... | |
void | stop () |
Stop any active dragging state. More... | |
Protected Types | |
using | CallbackArray = std::vector< MouseCallback > |
Type for array of registered callbacks. More... | |
Protected Member Functions | |
void | invoke_handlers (Event &event) |
Invoke an event on each of the handlers. More... | |
Protected Attributes | |
bool | m_active {false} |
Currently processing subsequent events. More... | |
CallbackArray | m_callbacks |
Registered callback functions. More... | |
bool | m_dragging {false} |
Currently in the dragging state. More... | |
PeriodicTimer | m_long_click_timer |
Async timer for detecting long clicks. More... | |
DisplayPoint | m_mouse_start_pos |
The starting position of the mouse. More... | |
Basic class for interpreting mouse events.
For now, this only supports single mouse click, long click, and drag events. The premise behind this class is to interpret raw mouse events and turn them into higher level meaning. Because some of those events can be asynchronous, all events are generated through callbacks registered with on_async_event().
|
protected |
Type for array of registered callbacks.
using MouseCallback = std::function<void(Event& event)> |
Type for mouse event callback.
|
noexcept |
|
inline |
Is active?
|
inline |
Is dragging?
Pass the raw EventId to this function to get the emulated mouse event.
|
protected |
Invoke an event on each of the handlers.
|
inline |
Get pointer start position.
void on_async_event | ( | MouseCallback | callback | ) |
Register a callback function to handle the async mouse events.
void start | ( | const DisplayPoint & | point | ) |
Start.
void stop | ( | ) |
Stop any active dragging state.
|
protected |
Currently processing subsequent events.
|
protected |
Registered callback functions.
|
protected |
Currently in the dragging state.
|
protected |
Async timer for detecting long clicks.
|
protected |
The starting position of the mouse.