# kdeui Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# QXEmbed Class Reference

A QXEmbed widget serves as an embedder that can manage one single embedded X-window. The QXEmbed widget is a graphical socket that can embed an external X-Window. More...

`#include <qxembed.h>`

Inheritance diagram for QXEmbed:

[legend]
Collaboration diagram for QXEmbed:

[legend]
List of all members.

## Public Types

enum | Protocol { XEMBED, XPLAIN }

## Signals

void | embeddedWindowDestroyed ()

## Public Member Functions

| QXEmbed (QWidget *parent=0, const char *name=0, WFlags f=0)
| ~QXEmbed ()
void | setProtocol (Protocol proto)
Protocol | protocol ()
void | embed (WId w)
WId | embeddedWinId () const
void | sendDelete (void)
void | setAutoDelete (bool)
bool | autoDelete () const
QSize | sizeHint () const
QSize | minimumSizeHint () const
QSizePolicy | sizePolicy () const
bool | eventFilter (QObject *, QEvent *)
bool | customWhatsThis () const
void | enterWhatsThisMode ()
virtual void | reparent (QWidget *parent, WFlags f, const QPoint &p, bool showIt=false)

## Static Public Member Functions

static void | initialize ()
static void | embedClientIntoWindow (QWidget *client, WId window)
static bool | processClientCmdline (QWidget *client, int &argc, char **argv)

## Protected Member Functions

bool | event (QEvent *)
void | keyPressEvent (QKeyEvent *)
void | keyReleaseEvent (QKeyEvent *)
void | focusInEvent (QFocusEvent *)
void | focusOutEvent (QFocusEvent *)
void | resizeEvent (QResizeEvent *)
void | showEvent (QShowEvent *)
bool | x11Event (XEvent *)
virtual void | windowChanged (WId w)
bool | focusNextPrevChild (bool next)

## Detailed Description

A QXEmbed widget serves as an embedder that can manage one single embedded X-window. The QXEmbed widget is a graphical socket that can embed an external X-Window.

These so-called client windows can be arbitrary Qt or non Qt applications.

There are two different ways of using QXEmbed, from the client side or from the embedder's side.

Embedding from the client's side requires that the client knows the window identifier of the respective embedder widget. Use either embedClientIntoWindow() or the high-level wrapper processClientCmdline(). This is only possible when the client is a Qt application.

When using it from the embedder's side, you must know the window identifier of the window that should be embedded. Simply call embed() with this identifier as parameter. If the client is a Qt application, make sure it has called QXEmbed::initialize(). Otherwise you should probably call setProtocol(XPLAIN) before embed().

Reimplement the change handler windowChanged() to catch embedding or the destruction of embedded windows. In the latter case, the embedder also emits a signal embeddedWindowDestroyed() for convenience.

Definition at line 58 of file qxembed.h.

## Constructor & Destructor Documentation

QXEmbed::QXEmbed | ( | QWidget * | parent = `0`,
|  | const char * | name = `0`,
|  | WFlags | f = `0`
| ) |

| Constructs a xembed widget. The parent, name and f arguments are passed to the QFrame constructor. Definition at line 608 of file qxembed.cpp. References initialize(), QWidget::QWidget(), QApplication::sendPostedEvents(), QWidget::setAcceptDrops(), QWidget::setFocusPolicy(), QWidget::setKeyCompression(), QWidget::topLevelWidget(), and QWidget::winId().

QXEmbed::~QXEmbed | ( |  | ) |

| Destructor. Cleans up the focus if necessary. Definition at line 668 of file qxembed.cpp. References autoDelete(), sendDelete(), QWidget::topLevelWidget(), and QWidget::winId().

## Member Function Documentation

void QXEmbed::initialize | ( |  | ) | `[static]`

Embedded applications should call this function to make sure they support the XEMBED protocol.

It is called automatically when you use embedClientIntoWindow() or processClientCmdline(). Clients might have to call it manually when you use embed().

Definition at line 568 of file qxembed.cpp.

References QPtrDict::setAutoDelete().

Referenced by embedClientIntoWindow(), KSystemTray::KSystemTray(), and QXEmbed().

void QXEmbed::setProtocol | ( | Protocol | proto | ) |

Sets the protocol used for embedding windows.

This function must be called before embedding a window. Protocol XEMBED provides maximal functionality (focus, tabs, etc) but requires explicit cooperation from the embedded window. Protocol XPLAIN provides maximal compatibility with embedded applications that do not support the XEMBED protocol. The default is XEMBED.

Non KDE applications should be embedded with protocol XPLAIN. This does not happen automatically yet. You must call setProtocol() explicitly.

Definition at line 739 of file qxembed.cpp.

QXEmbed::Protocol QXEmbed::protocol | ( |  | ) |

Returns the protocol used for embedding the current window.

Returns:
  the protocol used by QXEmbed.

Definition at line 749 of file qxembed.cpp.

void QXEmbed::embed | ( | WId | w | ) |

Embeds the window with the identifier w into this xembed widget.

This function is useful if the embedder knows about the client window that should be embedded. Often it is vice versa: the client knows about its target embedder. In that case, it is not necessary to call embed(). Instead, the client will call the static function embedClientIntoWindow().

Parameters:

  | w | the identifier of the window to embed

See also:
  embeddedWinId()

Definition at line 958 of file qxembed.cpp.

References endl(), QApplication::flushX(), kdDebug(), and QWidget::winId().

WId QXEmbed::embeddedWinId | ( |  | ) | const

Returns the window identifier of the embedded window, or 0 if no window is embedded yet.

Returns:
  the id of the embedded window (0 if no window is embedded)

Definition at line 1012 of file qxembed.cpp.

void QXEmbed::embedClientIntoWindow | ( | QWidget * | client,
|  | WId | window
| ) | `[static]`

| A function for clients that embed themselves. processClientCmdline(). The widget client will be embedded in the window window. The application has to ensure that window is the handle of the window identifier of an QXEmbed widget. Definition at line 1234 of file qxembed.cpp. References initialize(). Referenced by processClientCmdline().

bool QXEmbed::processClientCmdline | ( | QWidget * | client,
|  | int & | argc,
|  | char ** | argv
| ) | `[static]`

A utility function for clients that embed theirselves.

The widget client will be embedded in the window that is passed as -embed command line argument.

The function returns true on success or false if no such command line parameter is specified.

See also:
  embedClientIntoWindow()

Definition at line 1202 of file qxembed.cpp.

References embedClientIntoWindow(), and QCString::toInt().

void QXEmbed::sendDelete | ( | void |  | ) |

| Sends a WM_DELETE_WINDOW message to the embedded window. This is what typically happens when you click on the close button of a window manager decoration. This should cause the embedded application to cleanly close the window. Signal embeddedWindowDestroyed() can be used to monitor the status of the embedded window. Definition at line 723 of file qxembed.cpp. Referenced by ~QXEmbed().

void QXEmbed::setAutoDelete | ( | bool |  | ) |

Selects what shoud be done with the embedded window when the embedding window is destroyed.

When the argument is true, the embedded window is kept alive, is hidden, and receives a WM_DELETE_WINDOW message using sendDelete(). This is the default. Otherwise, the destruction of the QXEmbed object simply destroys the embedded window.

See also:
  sendDelete()

Definition at line 1282 of file qxembed.cpp.

bool QXEmbed::autoDelete | ( |  | ) | const

Returns the value of flag indicating what shoud be done with the embedded window when the embedding window is destroyed.

See also:
  setAutoDelete()

Definition at line 1288 of file qxembed.cpp.

Referenced by ~QXEmbed().

void QXEmbed::embeddedWindowDestroyed | ( |  | ) | `[signal]`

This signal is emitted when the embedded window has been lost (destroyed or reparented away).

See also:
  embeddedWinId()

void QXEmbed::windowChanged | ( | WId | w | ) | `[protected, virtual]`

A change handler that indicates that the embedded window has been changed.

The window handle can also be retrieved with embeddedWinId().

Parameters:

  | w | the handle of the window that changed

Definition at line 1195 of file qxembed.cpp.

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

- qxembed.h
- qxembed.cpp

This file is part of the documentation for kdeui Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:21:57 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003