/* 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <gtkmm/window.h>
#include <gtk/gtkx.h> //Necessary for the X11 Window type.
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/window_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 (not Gtk::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.

/** Toplevel for embedding into other processes.
 *
 * Together with Gtk::Socket, Gtk::Plug 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 ID of that widget's window 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
 * application's window.
 *
 * 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.
 *
 * @note
 * The Gtk::Plug and Gtk::Socket widgets are only available when GTK+ and gtkmm
 * are compiled for the X11 platform and %GDK_WINDOWING_X11 is defined.
 * They can only be used on a GdkX11Display.
 */
class GTKMM_API Plug : public Window
{
  _CLASS_GTKOBJECT(Plug, GtkPlug, GTK_PLUG, Gtk::Window, GtkWindow, , , GTKMM_API)
  _UNMANAGEABLE
  _IGNORE(gtk_plug_construct, gtk_plug_construct_for_display)
public:
  Plug();

#m4 _CONVERSION(`Window', `::Window', `($3)')
#m4 _CONVERSION(`::Window', `Window', `($3)')
  explicit Plug(::Window socket_id);
  Plug(const Glib::RefPtr<Gdk::Display>& display, ::Window socket_id);

  _WRAP_METHOD(::Window get_id() const, gtk_plug_get_id)

  _WRAP_METHOD(bool get_embedded() const, gtk_plug_get_embedded)

  _WRAP_METHOD(Glib::RefPtr<Gdk::Window> get_socket_window(), gtk_plug_get_socket_window, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Gdk::Window> get_socket_window() const, gtk_plug_get_socket_window, refreturn, constversion)

  _WRAP_PROPERTY("embedded", bool)
  _WRAP_PROPERTY("socket-window", Glib::RefPtr<Gdk::Window>)

  _WRAP_SIGNAL(void embedded(), "embedded")
};

} //namespace Gtk

