Public Types

CL_InputDevice Class Reference
[clanDisplay Input]

CL_InputDevice. More...

#include <input_device.h>

List of all members.

Public Types

enum  Type {
  keyboard, pointer, joystick, tablet,
  unknown
}
 

Input device types.

More...

Public Member Functions

Construction

 CL_InputDevice ()
 Constructs a null instance.
 CL_InputDevice (CL_InputDeviceProvider *provider)
 Constructs a InputDevice.
 CL_InputDevice (CL_WeakPtr< CL_InputDevice_Impl > impl)
 Constructs a InputDevice.
 ~CL_InputDevice ()
Attributes

bool is_null () const
 Returns true if this object is invalid.
void throw_if_null () const
 Throw an exception if this object is invalid.
CL_InputDeviceProviderget_provider () const
 Returns the provider for this input device.
CL_String get_name () const
 Returns the human readable name of the device (i.e. 'Microsoft Sidewinder 3D').
CL_String get_device_name () const
 Return the hardware id/device for this device (i.e. /dev/input/js0).
Type get_type () const
 Returns the input device type.
CL_String get_key_name (int id) const
 Friendly key name for specified identifier (A, B, Leertaste, Backspace, Mouse Left, ...).
CL_String keyid_to_string (int keycode) const
 Returns a generic string name for the specified key code.
int string_to_keyid (const CL_String &str) const
 Returns the key code for the specified generic string key name.
bool get_keycode (int keycode) const
 Returns true if the passed key code is down for this device.
CL_Point get_position () const
 Returns the position (x,y) of the device.
int get_x () const
 Returns the x position of the device.
int get_y () const
 Returns the y position of the device.
double get_axis (int index) const
 Returns the the current position of a joystick axis.
int get_axis_count () const
 Returns the number of axes available on this device.
int get_button_count () const
 Returns the number of buttons available on this device.
bool in_proximity () const
 Returns true if the input device is in proximity (applicable for tablets).
Operations

CL_InputDeviceoperator= (const CL_InputDevice &copy)
void set_position (int x, int y)
 Sets the position of the device.
bool poll (bool peek_only)
 Update device.
Signals

CL_Signal_v2< const
CL_InputEvent &, const
CL_InputState & > & 
sig_key_down ()
 Signal emitted when key is pressed.
CL_Signal_v2< const
CL_InputEvent &, const
CL_InputState & > & 
sig_key_up ()
 Signal emitted when key is released.
CL_Signal_v2< const
CL_InputEvent &, const
CL_InputState & > & 
sig_pointer_move ()
 Signal emitted when pointer is moved (absolute movement).
CL_Signal_v2< const
CL_InputEvent &, const
CL_InputState & > & 
sig_axis_move ()
 Signal emitted when axis is moved.
CL_Signal_v2< const
CL_InputEvent &, const
CL_InputState & > & 
sig_key_dblclk ()
 Signal emitted when the mouse is double-clicked.
CL_Signal_v2< const
CL_InputEvent &, const
CL_InputState & > & 
sig_proximity_change ()
 Signal emitted when proximity is entered or exited.

Implementation



class CL_InputContext_Impl

Detailed Description

CL_InputDevice.


Member Enumeration Documentation

Input device types.

Enumerator:
keyboard 
pointer 
joystick 
tablet 
unknown 

Constructor & Destructor Documentation

CL_InputDevice::CL_InputDevice (  ) 

Constructs a null instance.

CL_InputDevice::CL_InputDevice ( CL_InputDeviceProvider provider  ) 

Constructs a InputDevice.

Parameters:
provider = Input Device Provider
CL_InputDevice::CL_InputDevice ( CL_WeakPtr< CL_InputDevice_Impl >  impl  ) 

Constructs a InputDevice.

Parameters:
impl = Weak Ptr
CL_InputDevice::~CL_InputDevice (  ) 

Member Function Documentation

double CL_InputDevice::get_axis ( int  index  )  const

Returns the the current position of a joystick axis.

int CL_InputDevice::get_axis_count (  )  const

Returns the number of axes available on this device.

int CL_InputDevice::get_button_count (  )  const

Returns the number of buttons available on this device.

If used on a keyboard, this function returns -1.

CL_String CL_InputDevice::get_device_name (  )  const

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

CL_String CL_InputDevice::get_key_name ( int  id  )  const

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.

bool CL_InputDevice::get_keycode ( int  keycode  )  const

Returns true if the passed key code is down for this device.

See keys.h for list of key codes.

CL_String CL_InputDevice::get_name (  )  const

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

CL_Point CL_InputDevice::get_position (  )  const

Returns the position (x,y) of the device.

Only valid for pointer devices.

CL_InputDeviceProvider* CL_InputDevice::get_provider (  )  const

Returns the provider for this input device.

Type CL_InputDevice::get_type (  )  const

Returns the input device type.

int CL_InputDevice::get_x (  )  const

Returns the x position of the device.

Only valid for pointer devices.

int CL_InputDevice::get_y (  )  const

Returns the y position of the device.

Only valid for pointer devices.

bool CL_InputDevice::in_proximity (  )  const

Returns true if the input device is in proximity (applicable for tablets).

Always returns false for non-tablet devices

bool CL_InputDevice::is_null (  )  const [inline]

Returns true if this object is invalid.

CL_String CL_InputDevice::keyid_to_string ( int  keycode  )  const

Returns a generic string name for the specified key code.

CL_InputDevice& CL_InputDevice::operator= ( const CL_InputDevice copy  ) 
bool CL_InputDevice::poll ( bool  peek_only  ) 

Update device.

Parameters:
peek_only Treat as a request to see if an event would occur
Returns:
true when the device event has occurred
void CL_InputDevice::set_position ( int  x,
int  y 
)

Sets the position of the device.

Only valid for mouse.

CL_Signal_v2<const CL_InputEvent &, const CL_InputState &>& CL_InputDevice::sig_axis_move (  ) 

Signal emitted when axis is moved.

CL_Signal_v2<const CL_InputEvent &, const CL_InputState &>& CL_InputDevice::sig_key_dblclk (  ) 

Signal emitted when the mouse is double-clicked.

CL_Signal_v2<const CL_InputEvent &, const CL_InputState &>& CL_InputDevice::sig_key_down (  ) 

Signal emitted when key is pressed.

CL_Signal_v2<const CL_InputEvent &, const CL_InputState &>& CL_InputDevice::sig_key_up (  ) 

Signal emitted when key is released.

CL_Signal_v2<const CL_InputEvent &, const CL_InputState &>& CL_InputDevice::sig_pointer_move (  ) 

Signal emitted when pointer is moved (absolute movement).

CL_Signal_v2<const CL_InputEvent &, const CL_InputState &>& CL_InputDevice::sig_proximity_change (  ) 

Signal emitted when proximity is entered or exited.

int CL_InputDevice::string_to_keyid ( const CL_String str  )  const

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

void CL_InputDevice::throw_if_null (  )  const

Throw an exception if this object is invalid.


Friends And Related Function Documentation

friend class CL_InputContext_Impl [friend]

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