1.8
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Input Class Reference

Base Input device class. More...

Inheritance diagram for Input:
Inheritance graph
[legend]

Public Member Functions

 Input ()
 
 Input (const Input &)=delete
 
 Input (Input &&) noexcept
 
virtual ~Input () noexcept
 
Inputoperator= (const Input &)=delete
 
Inputoperator= (Input &&) noexcept
 

Static Public Member Functions

static Objectglobal_input ()
 Get a reference to the global input Object. More...
 

Protected Member Functions

virtual void dispatch (Event &event)
 Dispatch an event from this input. More...
 

Protected Attributes

bool m_dispatching {false}
 Currently dispatching an event when true. More...
 
std::unique_ptr< detail::MouseGesturem_mouse
 The mouse gesture handler for this input. More...
 

Static Protected Attributes

static Object m_global_handler
 This is the single global input handler. More...
 

Detailed Description

Base Input device class.

An input device must inherit from this class and call dispatch() in order to dispatch events to the rest of the framework.

Constructor & Destructor Documentation

◆ Input() [1/3]

Input ( )

◆ Input() [2/3]

Input ( const Input )
delete

◆ Input() [3/3]

Input ( Input &&  )
noexcept

◆ ~Input()

virtual ~Input ( )
virtualnoexcept

Member Function Documentation

◆ dispatch()

virtual void dispatch ( Event event)
protectedvirtual

Dispatch an event from this input.

◆ global_input()

static Object& global_input ( )
inlinestatic

Get a reference to the global input Object.

This allows you to connect to any Event dispatched from any Input device.

Example

// receive any EventId::keyboard_down event from any Input device
Input::global_input().on_event([this](Event & event)
{
switch (event.key().keycode)
{
...
}
static Object & global_input()
Get a reference to the global input Object.
Definition: input.h:66
RegisterHandle on_event(const EventCallback &handler, const FilterFlags &mask={})
Add an event handler to be called when the widget generates an event.
@ keyboard_down
Keyboard event.

◆ operator=() [1/2]

Input& operator= ( const Input )
delete

◆ operator=() [2/2]

Input& operator= ( Input &&  )
noexcept

Member Data Documentation

◆ m_dispatching

bool m_dispatching {false}
protected

Currently dispatching an event when true.

◆ m_global_handler

Object m_global_handler
staticprotected

This is the single global input handler.

Anything can attach to this object and receive all events unfiltered.

This can be useful for debugging, or simply capturing any events.

◆ m_mouse

std::unique_ptr<detail::MouseGesture> m_mouse
protected

The mouse gesture handler for this input.