Interface for implementing a CL_InputDevice source. More...
#include <input_device_provider.h>
Public Member Functions | |
void | dispose () |
bool | is_disposed () const |
void | throw_if_disposed () const |
Construction | |
virtual | ~CL_InputDeviceProvider () |
virtual void | destroy ()=0 |
Destroys the input device provider. | |
Attributes | |
virtual CL_String | get_name () const =0 |
Returns the human readable name of the device (i.e. 'Microsoft Sidewinder 3D'). | |
virtual CL_String | get_device_name () const =0 |
Return the hardware id/device for this device (i.e. /dev/input/js0). | |
virtual CL_InputDevice::Type | get_type () const =0 |
Returns the input device type. | |
virtual CL_String | get_key_name (int id) const =0 |
Friendly key name for specified identifier (A, B, Leertaste, Backspace, Mouse Left, ...). | |
virtual bool | supports_keyid_mapping () const |
Returns true if this provider implements keyid to/from string mapping. | |
virtual CL_String | keyid_to_string (int keycode) const |
Returns a generic string name for the specified key code. | |
virtual int | string_to_keyid (const CL_String &str) const |
Returns the key code for the specified generic string key name. | |
virtual bool | get_keycode (int keycode) const =0 |
Returns true if the passed key code is down for this device. | |
virtual int | get_x () const =0 |
Returns the x position of the device. | |
virtual int | get_y () const =0 |
Returns the y position of the device. | |
virtual float | get_axis (int index) const =0 |
Returns the the current position of a joystick axis. | |
virtual int | get_axis_count () const =0 |
Returns the number of axes available on this device. | |
virtual int | get_button_count () const =0 |
Returns the number of buttons available on this device. | |
virtual bool | in_proximity () const =0 |
Returns the input device is in proximity mode. (Atm applicapble only to tablet.). | |
Operations | |
virtual void | init (CL_Signal_v1< const CL_InputEvent & > *sig_provider_event)=0 |
Initialize input device provider. | |
virtual void | set_position (int x, int y)=0 |
Sets the position of the device. | |
virtual bool | poll (bool peek_only)=0 |
Update device. | |
Protected Member Functions | |
virtual void | on_dispose ()=0 |
Interface for implementing a CL_InputDevice source.
virtual CL_InputDeviceProvider::~CL_InputDeviceProvider | ( | ) | [inline, virtual] |
virtual void CL_InputDeviceProvider::destroy | ( | ) | [pure virtual] |
Destroys the input device provider.
void CL_DisposableObject::dispose | ( | ) | [inherited] |
virtual float CL_InputDeviceProvider::get_axis | ( | int | index | ) | const [pure virtual] |
Returns the the current position of a joystick axis.
virtual int CL_InputDeviceProvider::get_axis_count | ( | ) | const [pure virtual] |
Returns the number of axes available on this device.
virtual int CL_InputDeviceProvider::get_button_count | ( | ) | const [pure virtual] |
Returns the number of buttons available on this device.
If used on a keyboard, this function returns -1.
virtual CL_String CL_InputDeviceProvider::get_device_name | ( | ) | const [pure virtual] |
Return the hardware id/device for this device (i.e. /dev/input/js0).
virtual CL_String CL_InputDeviceProvider::get_key_name | ( | int | id | ) | const [pure virtual] |
Friendly key name for specified identifier (A, B, Leertaste, Backspace, Mouse Left, ...).
Note that this key name is localized, meaning it should only be used for menus where the user view key bindings, and not configuration files and such.
virtual bool CL_InputDeviceProvider::get_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 CL_String CL_InputDeviceProvider::get_name | ( | ) | const [pure virtual] |
Returns the human readable name of the device (i.e. 'Microsoft Sidewinder 3D').
virtual CL_InputDevice::Type CL_InputDeviceProvider::get_type | ( | ) | const [pure virtual] |
Returns the input device type.
virtual int CL_InputDeviceProvider::get_x | ( | ) | const [pure virtual] |
Returns the x position of the device.
Only valid for mouse.
virtual int CL_InputDeviceProvider::get_y | ( | ) | const [pure virtual] |
Returns the y position of the device.
Only valid for mouse.
virtual bool CL_InputDeviceProvider::in_proximity | ( | ) | const [pure virtual] |
Returns the input device is in proximity mode. (Atm applicapble only to tablet.).
If used on other devices than tablet, returns false.
virtual void CL_InputDeviceProvider::init | ( | CL_Signal_v1< const CL_InputEvent & > * | sig_provider_event | ) | [pure virtual] |
Initialize input device provider.
The device field of CL_InputEvent should not be set when emitting events.
Invoking sig_provider_event is thread safe.
bool CL_DisposableObject::is_disposed | ( | ) | const [inherited] |
virtual CL_String CL_InputDeviceProvider::keyid_to_string | ( | int | keycode | ) | const [inline, virtual] |
Returns a generic string name for the specified key code.
virtual void CL_DisposableObject::on_dispose | ( | ) | [protected, pure virtual, inherited] |
virtual bool CL_InputDeviceProvider::poll | ( | bool | peek_only | ) | [pure virtual] |
Update device.
peek_only | Treat as a request to see if an event would occur |
virtual void CL_InputDeviceProvider::set_position | ( | int | x, | |
int | y | |||
) | [pure virtual] |
Sets the position of the device.
virtual int CL_InputDeviceProvider::string_to_keyid | ( | const CL_String & | str | ) | const [inline, virtual] |
Returns the key code for the specified generic string key name.
virtual bool CL_InputDeviceProvider::supports_keyid_mapping | ( | ) | const [inline, virtual] |
Returns true if this provider implements keyid to/from string mapping.
void CL_DisposableObject::throw_if_disposed | ( | ) | const [inherited] |