Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# TQWSInputMethod Class Reference

The TQWSInputMethod class provides international input methods for TQt/Embedded. More...

`#include <qwindowsystem_qws.h>`

List of all member functions.

## Public Members

- TQWSInputMethod ()
- virtual ~TQWSInputMethod ()
- virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ) = 0
- virtual void reset ()
- virtual void setMicroFocus ( int x, int y )
- virtual void setFont ( const TQFont & )

## Protected Members

- void sendIMEvent ( TQWSServer::IMState state, const TQString & txt, int cpos, int selLen = 0 )

## Detailed Description

The TQWSInputMethod class provides international input methods for TQt/Embedded.

Subclass this class to implement your own input method.

An input methods consists of a keyboard filter and optionally a graphical interface. The keyboard filter intercepts key events from physical or virtual keyboards by implementing the filter() function.

Use sendIMEvent() to send composition events. Composition starts with the input method sending an `IMStart` event, followed by a number of `IMCompose` events and ending with an `IMEnd` event or when the virtual reset() function is called.

The functions setMicroFocus() and setFont() can be reimplemented to receive more information about the state of the focus widget.

Use TQWSServer::setCurrentInputMethod() to install an input method.

See also TQt/Embedded.

## Member Function Documentation

### TQWSInputMethod::TQWSInputMethod ()

Constructs a new input method

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

Destructs the input method uninstalling it if it is currently installed.

### bool TQWSInputMethod::filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat )`[pure virtual]`

This function must be implemented in subclasses to handle key input from physical or virtual keyboards. Returning TRUE will block the event from further processing.

The Unicode value is given in unicode and the key code in keycode. Keyboard modifiers are OR-ed together in modifiers. If isPress is TRUE this is a key press; otherwise it is a key release. If autoRepeat is TRUE this is an auto-repeated key press.

All normal key events should be blocked while in compose mode (i.e., between `IMStart` and `IMEnd`).

### void TQWSInputMethod::reset ()`[virtual]`

Implemented in subclasses to reset the state of the input method.

### void TQWSInputMethod::sendIMEvent ( TQWSServer::IMState state, const TQString & txt, int cpos, int selLen = 0 )`[protected]`

Causes a TQIMEvent to be sent to the focus widget. state may be one of TQWSServer::IMStart, TQWSServer::IMCompose or TQWSServer::IMEnd.

txt is the text being composed (or the finished text if state is `IMEnd`). cpos is the current cursor position.

If state is `IMCompose`, selLen is the number of characters in the composition string (starting at cpos) that should be marked as selected by the input widget receiving the event.

### void TQWSInputMethod::setFont ( const TQFont & )`[virtual]`

Implemented in subclasses to handle font changes in the focus widget.

This functionality is provided for future expansion; it is not used in this version of TQt/Embedded.

### void TQWSInputMethod::setMicroFocus ( int x, int y )`[virtual]`

Implemented in subclasses to handle microFocusHint changes in the focus widget. x and y are the global coordinates of the text cursor.

This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.