|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# QWSMouseHandler Class Reference
[QtGui module]

The QWSMouseHandler class is a mouse driver for Qtopia Core. More...

    #include <QWSMouseHandler>

Inherited by QWSCalibratedMouseHandler.

- List of all members, including inherited members

### Public Functions

- QWSMouseHandler ( const QString & driver = QString(), const QString & device = QString() )
- virtual ~QWSMouseHandler ()
- virtual void calibrate ( const QWSPointerCalibrationData * data )
- virtual void clearCalibration ()
- void limitToScreen ( QPoint & position )
- void mouseChanged ( const QPoint & position, int state, int wheel = 0 )
- const QPoint & pos () const
- virtual void resume () = 0
- virtual void suspend () = 0

## Detailed Description

The QWSMouseHandler class is a mouse driver for Qtopia Core.

The mouse driver handles events from system devices and generates mouse events.

A QWSMouseHandler will usually open some system device in its constructor, create a QSocketNotifier on that opened device and when it receives data, it will call mouseChanged() to send the event to Qtopia Core for relaying to clients.

If you are creating a handler for a device that needs calibration or noise reduction, such as a touchscreen, you could probably make use the subclass QWSCalibratedMouseHandler.

## Member Function Documentation

### QWSMouseHandler::QWSMouseHandler ( const QString & driver = QString(), const QString & device = QString() )

Constructs a mouse handler which becomes the primary mouse handler.

Note that once created, mouse handlers are controlled by the system and should not be deleted. The driver and device arguments are passed by the QWS_MOUSE_PROTO environment variable.

See also Running Qtopia Core Applications.

### QWSMouseHandler::~QWSMouseHandler () `[virtual]`

Destroys the mouse handler.

This function should only be called from within Qtopia Core when the application terminates; do not call this function directly.

### void QWSMouseHandler::calibrate ( const QWSPointerCalibrationData * data ) `[virtual]`

This method is reimplemented in QWSCalibratedMouseHandler to set calibration information passed in data, for example, from the Qtopia calibration screen. This version does nothing.

### void QWSMouseHandler::clearCalibration () `[virtual]`

This method is reimplemented in QWSCalibratedMouseHandler to clear calibration information. This version does nothing.

### void QWSMouseHandler::limitToScreen ( QPoint & position )

Ensures that the given position is within the screen's boundaries, changing the position if necessary.

### void QWSMouseHandler::mouseChanged ( const QPoint & position, int state, int wheel = 0 )

Notifies the system of a new mouse event.

This function updates the current mouse position and sends the event to the QWSServer for delivery to the correct widget. A subclass must call this function whenever it wants to deliver a new mouse event.

The given position is the global position of the mouse cursor. The state parameter is a bitmask of Qt::MouseButtons indicating which mouse buttons are pressed. The wheel parameter is the delta value of the mouse wheel as returned by QWheelEvent::delta().

### const QPoint & QWSMouseHandler::pos () const

Returns the current mouse position.

### void QWSMouseHandler::resume () `[pure virtual]`

Must be implemented in subclasses to resume handling mouse events.

See also suspend().

### void QWSMouseHandler::suspend () `[pure virtual]`

Must be implemented in subclasses to suspend reading and handling of mouse events.

See also resume().