stmm-input-doc  0.17.0
Classes | Static Public Member Functions | List of all members
stmi::GtkDeviceManager Class Reference

Device manager that attaches to Gtk's main event loop. More...

Inheritance diagram for stmi::GtkDeviceManager:
Inheritance graph
[legend]

Classes

struct  Init
 Initialization data. More...
 

Static Public Member Functions

static std::pair< shared_ptr< GtkDeviceManager >, std::string > create (const Init &oInit) noexcept
 Creates a device manager. More...
 
static std::pair< shared_ptr< GtkDeviceManager >, std::string > create () noexcept
 Creates a device manager with default initialization. More...
 
- Static Public Member Functions inherited from stmi::DeviceManager
static int64_t getNowTimeMicroseconds () noexcept
 Current time from epoch in microseconds. More...
 

Additional Inherited Members

- Public Member Functions inherited from stmi::ParentDeviceManager
shared_ptr< DevicegetDevice (int32_t nDeviceId) const noexcept override
 Return the device with the given id. More...
 
shared_ptr< CapabilitygetCapability (const Capability::Class &oClass) const noexcept override
 Get a device manager capability of a certain class. More...
 
shared_ptr< CapabilitygetCapability (int32_t nCapabilityId) const noexcept override
 Get a device manager capability by id. More...
 
std::vector< Capability::ClassgetCapabilityClasses () const noexcept override
 The union of the device manager capability classes of all the children. More...
 
std::vector< Capability::ClassgetDeviceCapabilityClasses () const noexcept override
 The union of the device capability classes of all the children's devices. More...
 
std::vector< Event::ClassgetEventClasses () const noexcept override
 The union of the event types of all the children. More...
 
std::vector< int32_t > getDevicesWithCapabilityClass (const Capability::Class &oCapabilityClass) const noexcept override
 The union of the devices of all the children with a given capability class. More...
 
std::vector< int32_t > getDevices () const noexcept override
 The union of the devices of all the children. More...
 
bool isEventClassEnabled (const Event::Class &oEventClass) const noexcept override
 Tells whether an event class is enabled in at least one of the children. More...
 
void enableEventClass (const Event::Class &oEventClass) noexcept override
 Calls the function for all the children. More...
 
bool addAccessor (const shared_ptr< Accessor > &refAccessor) noexcept override
 Calls addAccessor() of children. More...
 
bool removeAccessor (const shared_ptr< Accessor > &refAccessor) noexcept override
 Calls removeAccessor() of children. More...
 
bool hasAccessor (const shared_ptr< Accessor > &refAccessor) noexcept override
 Tells whether an accessor is at least in one of the children. More...
 
bool addEventListener (const shared_ptr< EventListener > &refEventListener, const shared_ptr< CallIf > &refCallIf) noexcept override
 Calls addEventListener of children. More...
 
bool addEventListener (const shared_ptr< EventListener > &refEventListener) noexcept override
 Calls addEventListener of children. More...
 
bool removeEventListener (const shared_ptr< EventListener > &refEventListener, bool bFinalize) noexcept override
 Calls removeEventListener of children. More...
 
bool removeEventListener (const shared_ptr< EventListener > &refEventListener) noexcept override
 Calls removeEventListener of children. More...
 
std::vector< shared_ptr< ChildDeviceManager > > getChildren () const noexcept
 The child device managers. More...
 
virtual std::vector< shared_ptr< Capability > > getDeviceManagerCapabilities (const Capability::Class &oClass) const noexcept
 Get the device manager capabilities of a given class of all the children. More...
 
- Public Member Functions inherited from stmi::ChildDeviceManager
shared_ptr< ParentDeviceManagergetParent () const noexcept
 Gets the parent of this child device manager. More...
 
shared_ptr< ParentDeviceManagergetParent () noexcept
 Gets the parent of this child device manager. More...
 
shared_ptr< ParentDeviceManagergetRoot () const noexcept
 Returns the root device manager. More...
 
shared_ptr< ParentDeviceManagergetRoot () noexcept
 Returns the root device manager. More...
 
bool isParent () const noexcept
 Tells whether this instance is also a ParentDeviceManager. More...
 
shared_ptr< ParentDeviceManagergetAsParent () const noexcept
 If a parent returns this object as a parent. More...
 
shared_ptr< ParentDeviceManagergetAsParent () noexcept
 If a parent returns this object as a parent. More...
 
- Public Member Functions inherited from stmi::DeviceManager
virtual ~DeviceManager () noexcept=default
 
template<typename TCapa >
bool getCapability (shared_ptr< TCapa > &refCapa) const noexcept
 Request a registered device manager capability. More...
 
- Protected Member Functions inherited from stmi::ParentDeviceManager
 ParentDeviceManager () noexcept
 
void init (const std::vector< shared_ptr< ChildDeviceManager > > &aChildDeviceManager) noexcept
 Initialization. More...
 
void removeChildren () noexcept
 Removes all children. More...
 
- Protected Member Functions inherited from stmi::ChildDeviceManager
 ChildDeviceManager () noexcept
 Constructor. More...
 
- Protected Member Functions inherited from stmi::DeviceManager
 DeviceManager () noexcept
 

Detailed Description

Device manager that attaches to Gtk's main event loop.

The created device manager needs stmi::GtkAccessor-wrapped Gtk::Window references in order to receive events, which are only sent to the currently active window (provided it was added with DeviceManager::addAccessor()).

Currently the following devices are supported:

The supported events types are:

When there is a change of active window, all the keys, buttons, touches are canceled. Example: for each pressed keys a KeyEvent of type KeyEvent::KEY_RELEASE_CANCEL is sent to the listeners.

Member Function Documentation

◆ create() [1/2]

static std::pair<shared_ptr<GtkDeviceManager>, std::string> stmi::GtkDeviceManager::create ( const Init oInit)
staticnoexcept

Creates a device manager.

Before this call Gtk has to be already initialized (ex. with Gtk::Application::create()).

Parameters
oInitThe initialization data.
Returns
The created device manager and an empty string or null and the error string if creation failed.

◆ create() [2/2]

static std::pair<shared_ptr<GtkDeviceManager>, std::string> stmi::GtkDeviceManager::create ( )
inlinestaticnoexcept

Creates a device manager with default initialization.

See also
GtkDeviceManager::Init default values.