Create  Edit  FrontPage  Index  Search  Changes  History  RSS  Back  Login

Gtk::Socket Diff - Ruby-GNOME2 Project Website

  • Added parts are displayed like this.
  • Deleted parts are displayed like this.

= class Gtk::Socket

Together with Gtk::Plug, Gtk::Socket 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 Gtk::Socket widget and, passes that widget's window ID to the other process, which then creates a Gtk::Plug with that window ID. ID.

Any widgets contained in the Gtk::Plug then will appear inside the first applications window.

The socket's window ID is obtained by using Gtk::Socket#id. Before using this method, the socket must have been realized, and for hence, have been added to its parent.

== Description

=== Example 1. Obtaining the window ID of a socket.
  socket = Gtk::Socket.new
  socket.show
  parent.add(socket)

  # The following call is only necessary if one of
  # the ancestors of the socket is not yet visible.
  socket.realize
  puts "The ID of the sockets window is #{socket.id}"

Note that if you pass the window ID of the socket to another process that will create a plug in the socket, you must make sure that the socket widget is not destroyed until that plug is created. Violating this rule will cause unpredictable consequences, the most likely consequence being that the plug will appear as a separate toplevel window. You can check if the plug has been created by examining the Gtk::Socket#plug_window. If this field is non-nil, then the plug has been successfully created inside of the socket.
When GTK+ is notified that the embedded window has been destroyed, then it will destroy the socket as well. You should always, therefore, be prepared for your sockets to be destroyed at any time when the main event loop is running.
The communication between a Gtk::Socket and a Gtk::Plug follows the XEmbed protocol. This protocol has also been implemented in other toolkits, e.g. Qt, allowing the same level of integration when embedding a Qt widget in GTK or vice versa.

== Object Hierarchy

* Object
  * GLib::Instantiatable
    * GLib::Object
      * GLib::InitiallyUnowned
        * Gtk::Object
          * Gtk::Widget
            * Gtk::Container
              * Gtk::Socket

== Class Methods

--- Gtk::Socket.new

    Create a new empty Gtk::Socket.
    * Returns: the new Gtk::Socket.

== Instance Methods

--- add_id(window_id)

    Adds an XEMBED client, such as a Gtk::Plug, to the Gtk::Socket. The client may be in the same process or in a different process.
    To embed a Gtk::Plug in a Gtk::Socket, you can either create the Gtk::Plug with Gtk::Plug.new(0), call Gtk::Plug#id to get the window ID of the plug, and then pass that to the Gtk::Socket#add_id, or you can call Gtk::Socket#id to get the window ID for the socket, and call Gtk::Plug.new passing in that ID.
    The Gtk::Socket must have already be added into a toplevel window before you can make this call.
    * window_id: the window ID of a client participating in the XEMBED protocol.
    * Returns: self

--- id

    Gets the window ID of a Gtk::Socket widget, which can then be used to create a client embedded inside the socket, for instance with Gtk::Plug.new.
    The Gtk::Socket must have already be added into a toplevel window before you can make this call.
    * Returns: the window ID for the socket

--- plug_window

    Returns plug_window value. You can check if the plug has been created.
    * Returns: plug_window(Gdk::Window)

--- ref_accessible

    See Atk::Implementor#ref_accessible.

--- add_child

    See Gtk::Buildable#add_child.

--- construct_child

    See Gtk::Buildable#construct_child.

--- get_internal_child

    See Gtk::Buildable#get_internal_child.

--- name

    See Gtk::Buildable#name.

--- name=

    See Gtk::Buildable#name=.

--- set_buildable_property

    See Gtk::Buildable#set_buildable_property.

--- set_name

    See Gtk::Buildable#set_name.

--- builder_name

    See Gtk::Buildable#builder_name.

--- builder_name=

    See Gtk::Buildable#builder_name=.

--- set_builder_name

    See Gtk::Buildable#set_builder_name.

== Signals

--- plug-added: self

     * self: Gtk::Socket

--- plug-removed: self

     * self: Gtk::Socket

== See Also

* Gtk::Plug
* ((<XEmbed|URL:http://www.freedesktop.org/standards/xembed-spec/>))

== ChangeLog

- ((<Masao>))