## GtkPlug GtkPlug — Toplevel for embedding into other processes |

## Synopsis

    #include <gtk/gtk.h>

                        GtkPlug;
    void                gtk_plug_construct                  (GtkPlug *plug,
                                                             GdkNativeWindow socket_id);
    void                gtk_plug_construct_for_display      (GtkPlug *plug,
                                                             GdkDisplay *display,
                                                             GdkNativeWindow socket_id);
    GtkWidget*          gtk_plug_new                        (GdkNativeWindow socket_id);
    GtkWidget*          gtk_plug_new_for_display            (GdkDisplay *display,
                                                             GdkNativeWindow socket_id);
    GdkNativeWindow     gtk_plug_get_id                     (GtkPlug *plug);
    gboolean            gtk_plug_get_embedded               (GtkPlug *plug);
    GdkWindow *         gtk_plug_get_socket_window          (GtkPlug *plug);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkWidget
                         +----GtkContainer
                               +----GtkBin
                                     +----GtkWindow
                                           +----GtkPlug

## Implemented Interfaces

GtkPlug implements AtkImplementorIface and GtkBuildable.

## Properties

      "embedded"                 gboolean              : Read
      "socket-window"            GdkWindow*            : Read

## Signals

      "embedded"                                       : Run Last

## Description

Together with GtkSocket, GtkPlug provides the ability to embed widgets from one process into another process in a fashion that is transparent to the user. One process creates a GtkSocket widget and, passes the ID of that widgets window to the other process, which then creates a GtkPlug with that window ID. Any widgets contained in the GtkPlug then will appear inside the first applications window.

### Note

The GtkPlug and GtkSocket widgets are currently not available on all platforms supported by GTK+.

## Details

### GtkPlug

    typedef struct _GtkPlug GtkPlug;

### gtk_plug_construct ()

    void                gtk_plug_construct                  (GtkPlug *plug,
                                                             GdkNativeWindow socket_id);

Finish the initialization of `plug` for a given GtkSocket identified by `socket_id`. This function will generally only be used by classes deriving from GtkPlug.

`plug` : | a GtkPlug.
`socket_id` : | the XID of the socket's window.

### gtk_plug_construct_for_display ()

    void                gtk_plug_construct_for_display      (GtkPlug *plug,
                                                             GdkDisplay *display,
                                                             GdkNativeWindow socket_id);

Finish the initialization of `plug` for a given GtkSocket identified by `socket_id` which is currently displayed on `display`. This function will generally only be used by classes deriving from GtkPlug.

`plug` : | a GtkPlug.
`display` : | the GdkDisplay associated with `socket_id`'s GtkSocket.
`socket_id` : | the XID of the socket's window.

Since 2.2

### gtk_plug_new ()

    GtkWidget*          gtk_plug_new                        (GdkNativeWindow socket_id);

Creates a new plug widget inside the GtkSocket identified by `socket_id`. If `socket_id` is 0, the plug is left "unplugged" and can later be plugged into a GtkSocket by `gtk_socket_add_id()`.

`socket_id` : | the window ID of the socket, or 0.
Returns : | the new GtkPlug widget.

### gtk_plug_new_for_display ()

    GtkWidget*          gtk_plug_new_for_display            (GdkDisplay *display,
                                                             GdkNativeWindow socket_id);

Create a new plug widget inside the GtkSocket identified by socket_id.

`display` : | the GdkDisplay on which `socket_id` is displayed
`socket_id` : | the XID of the socket's window.
Returns : | the new GtkPlug widget.

Since 2.2

### gtk_plug_get_id ()

    GdkNativeWindow     gtk_plug_get_id                     (GtkPlug *plug);

Gets the window ID of a GtkPlug widget, which can then be used to embed this window inside another window, for instance with `gtk_socket_add_id()`.

`plug` : | a GtkPlug.
Returns : | the window ID for the plug

### gtk_plug_get_embedded ()

    gboolean            gtk_plug_get_embedded               (GtkPlug *plug);

Determines whether the plug is embedded in a socket.

`plug` : | a GtkPlug
Returns : | `TRUE` if the plug is embedded in a socket

Since 2.14

### gtk_plug_get_socket_window ()

    GdkWindow *         gtk_plug_get_socket_window          (GtkPlug *plug);

Retrieves the socket the plug is embedded in.

`plug` : | a GtkPlug
Returns : | the window of the socket, or `NULL`

Since 2.14

## Property Details

### The `"embedded"` property

      "embedded"                 gboolean              : Read

`TRUE` if the plug is embedded in a socket.

Default value: FALSE

Since 2.12

### The `"socket-window"` property

      "socket-window"            GdkWindow*            : Read

The window of the socket the plug is embedded in.

Since 2.14

## Signal Details

### The `"embedded"` signal

    void                user_function                      (GtkPlug *plug,
                                                            gpointer user_data)      : Run Last

Gets emitted when the plug becomes embedded in a socket and when the embedding ends.

`plug` : | the object on which the signal was emitted
`user_data` : | user data set when the signal handler was connected.

## See Also

GtkSocket | the widget that a GtkPlug plugs into.