2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _GTKMM_SOCKET_H
4 #define _GTKMM_SOCKET_H
10 /* Copyright (C) 1998-2002 The gtkmm Development Team
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with this library; if not, write to the Free
24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 #include <gtkmm/container.h>
28 #include <gdkmm/types.h>
31 #ifndef DOXYGEN_SHOULD_SKIP_THIS
32 typedef struct _GtkSocket GtkSocket;
33 typedef struct _GtkSocketClass GtkSocketClass;
34 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
38 { class Socket_Class; } // namespace Gtk
42 /** Container for widgets from other processes.
43 * Together with Gtk::Plug, Gtk::Socket provides the ability to embed
44 * widgets from one process into another process in a fashion that is
45 * transparent to the user. One process creates a Gtk::Socket widget and,
46 * passes the that widget's window ID to the other process, which then
47 * creates a Gtk::Plug with that window ID. Any widgets contained in the
48 * Gtk::Plug then will appear inside the first applications window.
50 * The socket's window ID is obtained by using get_id(). Before using this
51 * function, the socket must have been realized, and for hence, have been
52 * added to its parent.
58 * // The following call is only necessary if one of the ancestors of the
59 * // socket is not yet visible
62 * cout << "The ID of the sockets window is: " << socket.get_id() << endl;
66 * Note that if you pass the window ID of the socket to another process that
67 * will create a plug in the socket, you must make sure that the socket
68 * widget is not destroyed until that plug is created. Violating this rule
69 * will cause unpredictable consequences, the most likely consequence being
70 * that the plug will appear as a separate toplevel window. You can check if
71 * the plug has been created by examining the plug_window member of the
72 * GtkSocket structure returned by gobj(). If this field is non-NULL, then
73 * the plug has been successfully created inside of the socket.
75 * When gtkmm is notified that the embedded window has been destroyed, then
76 * it will destroy the socket as well. You should always, therefore, be
77 * prepared for your sockets to be destroyed at any time when the main event
80 * The communication between a Gtk::Socket and a Gtk::Plug follows the
81 * XEmbed protocol. This protocol has also been implemented in other
82 * toolkits, e.g. Qt, allowing the same level of integration when embedding
83 * a Qt widget in gtkmm or vice versa.
89 class Socket : public Container
92 #ifndef DOXYGEN_SHOULD_SKIP_THIS
93 typedef Socket CppObjectType;
94 typedef Socket_Class CppClassType;
95 typedef GtkSocket BaseObjectType;
96 typedef GtkSocketClass BaseClassType;
97 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
101 #ifndef DOXYGEN_SHOULD_SKIP_THIS
104 friend class Socket_Class;
105 static CppClassType socket_class_;
108 Socket(const Socket&);
109 Socket& operator=(const Socket&);
112 explicit Socket(const Glib::ConstructParams& construct_params);
113 explicit Socket(GtkSocket* castitem);
115 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
118 #ifndef DOXYGEN_SHOULD_SKIP_THIS
119 static GType get_type() G_GNUC_CONST;
120 static GType get_base_type() G_GNUC_CONST;
123 ///Provides access to the underlying C GtkObject.
124 GtkSocket* gobj() { return reinterpret_cast<GtkSocket*>(gobject_); }
126 ///Provides access to the underlying C GtkObject.
127 const GtkSocket* gobj() const { return reinterpret_cast<GtkSocket*>(gobject_); }
131 //C++ methods used to invoke GTK+ virtual functions:
134 //GTK+ Virtual Functions (override these to change behaviour):
136 //Default Signal Handlers::
137 virtual void on_plug_added();
138 virtual bool on_plug_removed();
144 //This is not available in on Win32.
145 //This source file will not be compiled,
146 //and the class will not be registered in wrap_init.h or wrap_init.cc
152 /** Adds an XEMBED client, such as a Gtk::Plug, to the Gtk::Socket. The
153 * client may be in the same process or in a different process.
155 * To embed a Gtk::Plug in a Gtk::Socket, you can either create the
156 * Gtk::Plug with <tt>gtk_plug_new (0)</tt>, call
157 * Gtk::Plug::get_id() to get the window ID of the plug, and then pass that to the
158 * add_id(), or you can call get_id() to get the
159 * window ID for the socket, and call Gtk::Plug::new() passing in that
162 * The Gtk::Socket must have already be added into a toplevel window
163 * before you can make this call.
164 * @param window_id The window ID of a client participating in the XEMBED protocol.
166 void add_id(Gdk::NativeWindow window_id);
168 /** Gets the window ID of a Gtk::Socket widget, which can then
169 * be used to create a client embedded inside the socket, for
170 * instance with Gtk::Plug::new().
172 * The Gtk::Socket must have already be added into a toplevel window
173 * before you can make this call.
174 * @return The window ID for the socket.
176 Gdk::NativeWindow get_id() const;
179 Glib::SignalProxy0< void > signal_plug_added();
182 Glib::SignalProxy0< bool > signal_plug_removed();
192 /** @relates Gtk::Socket
193 * @param object The C instance
194 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
195 * @result A C++ instance that wraps this C instance.
197 Gtk::Socket* wrap(GtkSocket* object, bool take_copy = false);
199 #endif /* _GTKMM_SOCKET_H */