ClanLib  2.3.7
Public Member Functions | Protected Member Functions | List of all members
CL_InputDeviceProvider Class Referenceabstract

Interface for implementing a CL_InputDevice source. More...

#include <input_device_provider.h>

Inheritance diagram for CL_InputDeviceProvider:
Inheritance graph
[legend]

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. More...
 
Attributes
virtual CL_String get_name () const =0
 Returns the human readable name of the device (i.e. 'Microsoft Sidewinder 3D'). More...
 
virtual CL_String get_device_name () const =0
 Return the hardware id/device for this device (i.e. /dev/input/js0) More...
 
virtual CL_InputDevice::Type get_type () const =0
 Returns the input device type. More...
 
virtual CL_String get_key_name (int id) const =0
 Friendly key name for specified identifier (A, B, Leertaste, Backspace, Mouse Left, ...). More...
 
virtual bool supports_keyid_mapping () const
 Returns true if this provider implements keyid to/from string mapping. More...
 
virtual CL_String keyid_to_string (int keycode) const
 Returns a generic string name for the specified key code. More...
 
virtual int string_to_keyid (const CL_String &str) const
 Returns the key code for the specified generic string key name. More...
 
virtual bool get_keycode (int keycode) const =0
 Returns true if the passed key code is down for this device. More...
 
virtual int get_x () const =0
 Returns the x position of the device. More...
 
virtual int get_y () const =0
 Returns the y position of the device. More...
 
virtual float get_axis (int index) const =0
 Returns the the current position of a joystick axis. More...
 
virtual int get_axis_count () const =0
 Returns the number of axes available on this device. More...
 
virtual int get_button_count () const =0
 Returns the number of buttons available on this device. More...
 
virtual bool in_proximity () const =0
 Returns the input device is in proximity mode. (Atm applicapble only to tablet.) More...
 
Operations
virtual void init (CL_Signal_v1< const CL_InputEvent & > *sig_provider_event)=0
 Initialize input device provider. More...
 
virtual void set_position (int x, int y)=0
 Sets the position of the device. More...
 
virtual bool poll (bool peek_only)=0
 Update device. More...
 

Protected Member Functions

virtual void on_dispose ()=0
 

Detailed Description

Interface for implementing a CL_InputDevice source.

Constructor & Destructor Documentation

virtual CL_InputDeviceProvider::~CL_InputDeviceProvider ( )
inlinevirtual

Member Function Documentation

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
inlinevirtual

Returns a generic string name for the specified key code.

virtual void CL_DisposableObject::on_dispose ( )
protectedpure virtualinherited
virtual bool CL_InputDeviceProvider::poll ( bool  peek_only)
pure virtual

Update device.

Parameters
peek_onlyTreat as a request to see if an event would occur
Returns
true when the device event has occurred
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
inlinevirtual

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

virtual bool CL_InputDeviceProvider::supports_keyid_mapping ( ) const
inlinevirtual

Returns true if this provider implements keyid to/from string mapping.

void CL_DisposableObject::throw_if_disposed ( ) const
inherited

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