TQWSServer Class

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

# TQWSServer Class Reference

The TQWSServer class provides server-specific functionality in TQt/Embedded. More...

`#include <qwindowsystem_qws.h>`

List of all member functions.

## Public Members

- TQWSServer ( int flags = 0, TQObject * parent = 0, const char * name = 0 )
- ~TQWSServer ()
- enum ServerFlags { DisableKeyboard = 0x01, DisableMouse = 0x02 }
- enum GUIMode { NoGui = false, NormalGUI = true, Server }
- void sendIMEvent ( IMState state, const TQString & txt, int cpos, int selLen )
- class KeyMap { }
- class KeyOverride { }
- class KeyboardFilter { }
- TQWSWindow * windowAt ( const TQPoint & pos )
- const TQPtrList<TQWSWindow> & clientWindows ()
- void openMouse ()
- void closeMouse ()
- void openKeyboard ()
- void closeKeyboard ()
- void refresh ()
- void refresh ( TQRegion & r )
- void enablePainting ( bool e )
- TQWSPropertyManager * manager ()
- enum WindowEvent { Create = 0x0001, Destroy = 0x0002, Hide = 0x0004, Show = 0x0008, Raise = 0x0010, Lower = 0x0020, Geometry = 0x0040, Active = 0x0080, Name = 0x0100 }

## Signals

- void windowEvent ( TQWSWindow * w, TQWSServer::WindowEvent e )
- void newChannel ( const TQString & channel )
- void removedChannel ( const TQString & channel )

## Static Public Members

- void sendKeyEvent ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat )
- const KeyMap * keyMap ()
- void setOverrideKeys ( const KeyOverride * )
- void setKeyboardFilter ( KeyboardFilter * f )
- void setDefaultMouse ( const char * m )
- void setDefaultKeyboard ( const char * k )
- void setMaxWindowRect ( const TQRect & r )
- void setDesktopBackground ( const TQImage & img )
- void setDesktopBackground ( const TQColor & c )
- TQWSMouseHandler * mouseHandler ()
- TQWSKeyboardHandler * keyboardHandler ()
- void setKeyboardHandler ( TQWSKeyboardHandler * kh )
- void setScreenSaverIntervals ( int * ms )
- void setScreenSaverInterval ( int ms )
- bool screenSaverActive ()
- void screenSaverActivate ( bool activate )
- void setCursorVisible ( bool vis )
- bool isCursorVisible ()

## Detailed Description

The TQWSServer class provides server-specific functionality in TQt/Embedded.

When you run a TQt/Embedded application, it either runs as a server or connects to an existing server. If it runs as a server, some additional operations are provided by this class.

This class is instantiated by TQApplication for TQt/Embedded server processes. You should never construct this class yourself.

A pointer to the TQWSServer instance can be obtained via the global `qwsServer` variable.

The mouse and keyboard devices can be opened with openMouse() and openKeyboard(). (Close them with closeMouse() and closeKeyboard().)

The display is refreshed with refresh(), and painting can be enabled or disabled with enablePainting().

Obtain the list of client windows with clientWindows() and find out which window is at a particular point with windowAt().

Many static functions are provided, for example, setKeyboardFilter(), setKeyboardHandler(), setDefaultKeyboard() and setDefaultMouse().

The size of the window rectangle can be set with setMaxWindowRect(), and the desktop's background can be set with setDesktopBackground().

The screen saver is controlled with setScreenSaverInterval() and screenSaverActivate().

See also TQt/Embedded.

## Member Type Documentation

### TQWSServer::GUIMode

This determines what sort of TQWS server to create:

- `TQWSServer::NoGui` - This is used for non-graphical TQt applications.
- `TQWSServer::NormalGUI` - A normal TQt/Embedded application (not the server).
- `TQWSServer::Server` - A TQt/Embedded server (e.g. if `-qws` has been specified on the command line.

### TQWSServer::ServerFlags

This enum is used to pass various options to the window system server.

- `TQWSServer::DisableKeyboard` - Ignore all keyboard input.
- `TQWSServer::DisableMouse` - Ignore all mouse input.

### TQWSServer::WindowEvent

This specifies what sort of event has occurred to a top-level window:

- `TQWSServer::Create` - A new window has been created (TQWidget constructor).
- `TQWSServer::Destroy` - The window has been closed and deleted (TQWidget destructor).
- `TQWSServer::Hide` - The window has been hidden with TQWidget::hide().
- `TQWSServer::Show` - The window has been shown with TQWidget::show() or similar.
- `TQWSServer::Raise` - The window has been raised to the top of the desktop.
- `TQWSServer::Lower` - The window has been lowered.
- `TQWSServer::Geometry` - The window has changed size or position.
- `TQWSServer::Active` - The window has become the active window (has keyboard focus).
- `TQWSServer::Name` - The window has been named.

## Member Function Documentation

### TQWSServer::TQWSServer ( int flags = 0, TQObject * parent = 0, const char * name = 0 )

Construct a TQWSServer object.

Warning: This class is instantiated by TQApplication for TQt/Embedded server processes. You should never construct this class yourself.

The flags are used for keyboard and mouse setting. The server's parent is parent and it is called name.

### TQWSServer::~TQWSServer ()

Destruct TQWSServer

### const TQPtrList<TQWSWindow> & TQWSServer::clientWindows ()

Returns the list of top-level windows. This list will change as applications add and remove wigdets so it should not be stored for future use. The windows are sorted in stacking order from top-most to bottom-most.

### void TQWSServer::closeKeyboard ()

Closes keyboard device(s).

### void TQWSServer::closeMouse ()

Closes the pointer device(s).

### void TQWSServer::enablePainting ( bool e )

If e is true, painting on the display is enabled; if e is false, painting is disabled.

### bool TQWSServer::isCursorVisible ()`[static]`

Returns true if the cursor is visible; otherwise returns false.

See also setCursorVisible().

### const KeyMap * TQWSServer::keyMap ()`[static]`

Returns the keyboard mapping table used to convert keyboard scancodes to TQt keycodes and Unicode values. It's used by the keyboard driver in `qkeyboard_qws.cpp`.

### TQWSKeyboardHandler * TQWSServer::keyboardHandler ()`[static]`

Returns the primary keyboard handler.

### TQWSPropertyManager * TQWSServer::manager ()

Returns the TQWSPropertyManager, which is used for implementing X11-style window properties.

### TQWSMouseHandler * TQWSServer::mouseHandler ()`[static]`

Returns the primary mouse handler.

### void TQWSServer::newChannel ( const TQString & channel )`[signal]`

This signal is emitted when the TQCopChannel channel is created.

### void TQWSServer::openKeyboard ()

Opens the keyboard device(s).

### void TQWSServer::openMouse ()

Opens the mouse device(s).

### void TQWSServer::refresh ()

Refreshes the entire display.

### void TQWSServer::refresh ( TQRegion & r )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Refreshes the region r.

### void TQWSServer::removedChannel ( const TQString & channel )`[signal]`

This signal is emitted immediately after the TQCopChannel channel is destroyed. Note that a channel is not destroyed until all its listeners have unregistered.

### void TQWSServer::screenSaverActivate ( bool activate )`[static]`

If activate is true the screensaver is activated immediately; if activate is false the screensaver is deactivated.

### bool TQWSServer::screenSaverActive ()`[static]`

Returns true if the screensaver is active (i.e. the screen is blanked); otherwise returns false.

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

This function sends an input method event to the server. The current state is passed in state and the current text in txt. The cursor's position in the text is given by cpos, and the selection length (which could be 0) is given in selLen.

### void TQWSServer::sendKeyEvent ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat )`[static]`

Send a key event. You can use this to send key events generated by "virtual keyboards". unicode is the Unicode value of the key to send, keycode the TQt keycode (e.g. `Key_Left`), modifiers indicates whether, Shift/Alt/Ctrl keys are pressed, isPress is true if this is a key down event and false if it's a key up event, and autoRepeat is true if this is an autorepeat event (i.e. the user has held the key down and this is the second or subsequent key event being sent).

### void TQWSServer::setCursorVisible ( bool vis )`[static]`

If vis is true, makes the cursor visible; if vis is false, makes the cursor invisible.

See also isCursorVisible().

### void TQWSServer::setDefaultKeyboard ( const char * k )`[static]`

Set the keyboard driver to k, e.g. if `$TQWS_KEYBOARD` is not defined. The default is platform-dependent.

### void TQWSServer::setDefaultMouse ( const char * m )`[static]`

Set the mouse driver m to use if `$TQWS_MOUSE_PROTO` is not defined. The default is platform-dependent.

### void TQWSServer::setDesktopBackground ( const TQImage & img )`[static]`

Sets the image img to be used as the background in the absence of obscuring windows.

### void TQWSServer::setDesktopBackground ( const TQColor & c )`[static]`

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Sets the color c to be used as the background in the absence of obscuring windows.

### void TQWSServer::setKeyboardFilter ( KeyboardFilter * f )`[static]`

Adds a filter f to be invoked for all key events from physical keyboard drivers (events sent via processKeyEvent()).

The filter is not invoked for keys generated by virtual keyboard drivers (events sent via sendKeyEvent()).

If f is 0, the most-recently added filter is removed and deleted. The caller is responsible for matching each addition with a corresponding removal.

### void TQWSServer::setKeyboardHandler ( TQWSKeyboardHandler * kh )`[static]`

Sets the primary keyboard handler to kh.

### void TQWSServer::setMaxWindowRect ( const TQRect & r )`[static]`

Sets the area of the screen which TQt/Embedded applications will consider to be the maximum area to use for windows to r.

See also TQWidget::showMaximized().

### void TQWSServer::setScreenSaverInterval ( int ms )`[static]`

Sets the timeout for the screensaver to ms milliseconds. A setting of zero turns off the screensaver.

### void TQWSServer::setScreenSaverIntervals ( int * ms )`[static]`

Sets an array of timeouts for the screensaver to a list of ms milliseconds. A setting of zero turns off the screensaver. The array must be 0-terminated.

### TQWSWindow * TQWSServer::windowAt ( const TQPoint & pos )

Returns the window containing the point pos or 0 if there is no window under the point.

### void TQWSServer::windowEvent ( TQWSWindow * w, TQWSServer::WindowEvent e )`[signal]`

This signal is emitted whenever something happens to a top-level window (e.g. it's created or destroyed). w is the window to which the event of type e has occurred.

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