uicore::InputDevice Class Referenceabstract

InputDevice. More...

#include <input_device.h>

Public Types

enum  Type { keyboard, pointer, joystick, unknown }
 Input device types. More...
 

Public Member Functions

virtual float axis (int axisid) const =0
 Returns the the current position of a joystick axis. (Joysticks only) More...
 
virtual std::vector< int > axis_ids () const =0
 Returns the number of axes available on this device. (Joysticks only) More...
 
virtual int button_count () const =0
 Returns the number of buttons available on this device. If used on a keyboard or mouse, this function returns -1. More...
 
virtual std::string device_name () const =0
 Return the hardware id/device for this device (i.e. /dev/input/js0) More...
 
virtual Point device_position () const =0
 Returns the current devicesice-supplied x and y position of the device. (Pointing devices only) The returned positional value is in the scale of the physical pixel on the screen. More...
 
virtual int hat (int index) const =0
 Returns the current position of a joystick hat. (Joysticks only) More...
 
virtual std::string key_name (int id) const =0
 Retrieves the localized friendly key name for specified identifier (i.e. A, B, Leertaste, Backspace, Mouse Left, ...). More...
 
virtual bool keycode (int keycode) const =0
 Returns true if the passed key code is down for this device. See keys.h for list of key codes. More...
 
virtual std::string keyid_to_string (int keycode) const =0
 Returns a generic string name for the specified key code. More...
 
virtual std::string name () const =0
 Returns the human readable name of the device (i.e. 'Microsoft Sidewinder 3D'). More...
 
virtual Pointf position () const =0
 Returns the current device-independent x and y position (DIP) of the device. (Pointing devices only) The returned positional value is scaled to the pixel ratio of the display. More...
 
virtual void set_device_position (int x, int y)=0
 Sets the actual position of the device. (Pointing devices only) More...
 
virtual void set_position (float x, float y)=0
 Sets the display-independent position of the device. (Pointing devices only) More...
 
virtual Signal< void(const InputEvent &)> & sig_axis_move ()=0
 Signal emitted when axis is moved. More...
 
virtual Signal< void(const InputEvent &)> & sig_key_dblclk ()=0
 Signal emitted when the mouse is double-clicked. More...
 
virtual Signal< void(const InputEvent &)> & sig_key_down ()=0
 Signal emitted when key is pressed. More...
 
virtual Signal< void(const InputEvent &)> & sig_key_up ()=0
 Signal emitted when key is released. More...
 
virtual Signal< void(const InputEvent &)> & sig_pointer_move ()=0
 Signal emitted when pointer is moved (absolute movement). More...
 
virtual Signal< void(const InputEvent &)> & sig_proximity_change ()=0
 Signal emitted when proximity is entered or exited. More...
 
virtual int string_to_keyid (const std::string &str) const =0
 Returns the key code for the specified generic string key name. More...
 
virtual Type type () const =0
 Returns the input device type. More...
 

Detailed Description

Member Enumeration Documentation

Input device types.

Enumerator
keyboard 
pointer 
joystick 
unknown 

Member Function Documentation

virtual float uicore::InputDevice::axis ( int  axisid) const
pure virtual

Returns the the current position of a joystick axis. (Joysticks only)

virtual std::vector<int> uicore::InputDevice::axis_ids ( ) const
pure virtual

Returns the number of axes available on this device. (Joysticks only)

virtual int uicore::InputDevice::button_count ( ) const
pure virtual

Returns the number of buttons available on this device. If used on a keyboard or mouse, this function returns -1.

virtual std::string uicore::InputDevice::device_name ( ) const
pure virtual

Return the hardware id/device for this device (i.e. /dev/input/js0)

virtual Point uicore::InputDevice::device_position ( ) const
pure virtual

Returns the current devicesice-supplied x and y position of the device. (Pointing devices only) The returned positional value is in the scale of the physical pixel on the screen.

virtual int uicore::InputDevice::hat ( int  index) const
pure virtual

Returns the current position of a joystick hat. (Joysticks only)

Returns
Hat direction in degrees (0-360), or -1 if the hat is centered.
virtual std::string uicore::InputDevice::key_name ( int  id) const
pure virtual

Retrieves the localized friendly key name for specified identifier (i.e. A, B, Leertaste, Backspace, Mouse Left, ...).

Note
The returned name for the key may be localized by the system; it
virtual bool uicore::InputDevice::keycode ( int  keycode) const
pure virtual

Returns true if the passed key code is down for this device. See keys.h for list of key codes.

virtual std::string uicore::InputDevice::keyid_to_string ( int  keycode) const
pure virtual

Returns a generic string name for the specified key code.

virtual std::string uicore::InputDevice::name ( ) const
pure virtual

Returns the human readable name of the device (i.e. 'Microsoft Sidewinder 3D').

virtual Pointf uicore::InputDevice::position ( ) const
pure virtual

Returns the current device-independent x and y position (DIP) of the device. (Pointing devices only) The returned positional value is scaled to the pixel ratio of the display.

virtual void uicore::InputDevice::set_device_position ( int  x,
int  y 
)
pure virtual

Sets the actual position of the device. (Pointing devices only)

virtual void uicore::InputDevice::set_position ( float  x,
float  y 
)
pure virtual

Sets the display-independent position of the device. (Pointing devices only)

virtual Signal<void(const InputEvent &)>& uicore::InputDevice::sig_axis_move ( )
pure virtual

Signal emitted when axis is moved.

virtual Signal<void(const InputEvent &)>& uicore::InputDevice::sig_key_dblclk ( )
pure virtual

Signal emitted when the mouse is double-clicked.

virtual Signal<void(const InputEvent &)>& uicore::InputDevice::sig_key_down ( )
pure virtual

Signal emitted when key is pressed.

virtual Signal<void(const InputEvent &)>& uicore::InputDevice::sig_key_up ( )
pure virtual

Signal emitted when key is released.

virtual Signal<void(const InputEvent &)>& uicore::InputDevice::sig_pointer_move ( )
pure virtual

Signal emitted when pointer is moved (absolute movement).

virtual Signal<void(const InputEvent &)>& uicore::InputDevice::sig_proximity_change ( )
pure virtual

Signal emitted when proximity is entered or exited.

virtual int uicore::InputDevice::string_to_keyid ( const std::string str) const
pure virtual

Returns the key code for the specified generic string key name.

virtual Type uicore::InputDevice::type ( ) const
pure virtual

Returns the input device type.


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