/* Copyright (C) 1998-2002 The gtkmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ #include #include #include //Necessary for the X11 Window type. _DEFS(gtkmm,gtk) _PINCLUDE(gtkmm/private/container_p.h) //This file is used only on systems with the X11 backend. _INCLUDE_IN_WRAP_INIT(gdkmmconfig.h)dnl // If GDKMM_X11_BACKEND_ENABLED is defined, it's defined here. _GMMPROC_WRAP_CONDITIONALLY(ifdef GDKMM_X11_BACKEND_ENABLED) namespace Gtk { //Note that Window is the (awfully named) type from the X11 header. //gtkx.h (needed to get GtkPlug and GtkSocket) pulls this in, //assuming that you will be careful when doing so. /** Container for widgets from other processes. * 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 the that widget's window ID to the other process, which then * creates a Gtk::Plug with that window 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 get_id(). Before using this * function, the socket must have been realized, and for hence, have been * added to its parent. * * @code * Gtk::Socket socket; * parent.add(socket); * * // The following call is only necessary if one of the ancestors of the * // socket is not yet visible * socket.realize(); * * cout << "The ID of the sockets window is: " << socket.get_id() << endl; * * @endcode * * 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 plug_window member of the * GtkSocket structure returned by gobj(). If this field is non-NULL, then * the plug has been successfully created inside of the socket. * * When gtkmm 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 gtkmm or vice versa. * * @ingroup Widgets * @ingroup Containers */ class GTKMM_API Socket : public Container { _CLASS_GTKOBJECT(Socket, GtkSocket, GTK_SOCKET, Gtk::Container, GtkContainer, , , GTKMM_API) public: _CTOR_DEFAULT #m4 _CONVERSION(`Window', `::Window', `($3)') #m4 _CONVERSION(`::Window', `Window', `($3)') _WRAP_METHOD(void add_id(::Window window_id), gtk_socket_add_id) _WRAP_METHOD(::Window get_id() const, gtk_socket_get_id) _WRAP_METHOD(Glib::RefPtr get_plug_window(), gtk_socket_get_plug_window, refreturn) _WRAP_METHOD(Glib::RefPtr get_plug_window() const, gtk_socket_get_plug_window, refreturn, constversion) _WRAP_SIGNAL(void plug_added(), "plug_added") _WRAP_SIGNAL(bool plug_removed(), "plug_removed") }; } // namespace Gtk