2
// Generated by gtkmmproc -- DO NOT MODIFY!
3
#ifndef _GTKMM_SOCKET_H
4
#define _GTKMM_SOCKET_H
9
/* $Id: socket.hg,v 1.2 2004/02/10 17:35:13 mxpxpod Exp $ */
11
/* Copyright (C) 1998-2002 The gtkmm Development Team
13
* This library is free software; you can redistribute it and/or
14
* modify it under the terms of the GNU Lesser General Public
15
* License as published by the Free Software Foundation; either
16
* version 2.1 of the License, or (at your option) any later version.
18
* This library is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
* Lesser General Public License for more details.
23
* You should have received a copy of the GNU Lesser General Public
24
* License along with this library; if not, write to the Free
25
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28
#include <gtkmm/container.h>
29
#include <gdkmm/types.h>
30
#include <gtk/gtkx.h> //Necessary for the X11 Window type.
33
#ifndef DOXYGEN_SHOULD_SKIP_THIS
34
typedef struct _GtkSocket GtkSocket;
35
typedef struct _GtkSocketClass GtkSocketClass;
36
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
40
{ class Socket_Class; } // namespace Gtk
44
//Note that Window is the (awfully named) type from the X11 header.
45
//gtkx.h (needed to get GtkPlug and GtkSocket) pulls this in,
46
//assuming that you will be careful when doing so.
48
/** Container for widgets from other processes.
49
* Together with Gtk::Plug, Gtk::Socket provides the ability to embed
50
* widgets from one process into another process in a fashion that is
51
* transparent to the user. One process creates a Gtk::Socket widget and,
52
* passes the that widget's window ID to the other process, which then
53
* creates a Gtk::Plug with that window ID. Any widgets contained in the
54
* Gtk::Plug then will appear inside the first applications window.
56
* The socket's window ID is obtained by using get_id(). Before using this
57
* function, the socket must have been realized, and for hence, have been
58
* added to its parent.
64
* // The following call is only necessary if one of the ancestors of the
65
* // socket is not yet visible
68
* cout << "The ID of the sockets window is: " << socket.get_id() << endl;
72
* Note that if you pass the window ID of the socket to another process that
73
* will create a plug in the socket, you must make sure that the socket
74
* widget is not destroyed until that plug is created. Violating this rule
75
* will cause unpredictable consequences, the most likely consequence being
76
* that the plug will appear as a separate toplevel window. You can check if
77
* the plug has been created by examining the plug_window member of the
78
* GtkSocket structure returned by gobj(). If this field is non-NULL, then
79
* the plug has been successfully created inside of the socket.
81
* When gtkmm is notified that the embedded window has been destroyed, then
82
* it will destroy the socket as well. You should always, therefore, be
83
* prepared for your sockets to be destroyed at any time when the main event
86
* The communication between a Gtk::Socket and a Gtk::Plug follows the
87
* XEmbed protocol. This protocol has also been implemented in other
88
* toolkits, e.g. Qt, allowing the same level of integration when embedding
89
* a Qt widget in gtkmm or vice versa.
95
class Socket : public Container
98
#ifndef DOXYGEN_SHOULD_SKIP_THIS
99
typedef Socket CppObjectType;
100
typedef Socket_Class CppClassType;
101
typedef GtkSocket BaseObjectType;
102
typedef GtkSocketClass BaseClassType;
103
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
107
#ifndef DOXYGEN_SHOULD_SKIP_THIS
110
friend class Socket_Class;
111
static CppClassType socket_class_;
114
Socket(const Socket&);
115
Socket& operator=(const Socket&);
118
explicit Socket(const Glib::ConstructParams& construct_params);
119
explicit Socket(GtkSocket* castitem);
121
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
124
#ifndef DOXYGEN_SHOULD_SKIP_THIS
125
static GType get_type() G_GNUC_CONST;
128
static GType get_base_type() G_GNUC_CONST;
131
///Provides access to the underlying C GtkObject.
132
GtkSocket* gobj() { return reinterpret_cast<GtkSocket*>(gobject_); }
134
///Provides access to the underlying C GtkObject.
135
const GtkSocket* gobj() const { return reinterpret_cast<GtkSocket*>(gobject_); }
139
//C++ methods used to invoke GTK+ virtual functions:
142
//GTK+ Virtual Functions (override these to change behaviour):
144
//Default Signal Handlers::
145
virtual void on_plug_added();
146
virtual bool on_plug_removed();
152
//This is not available in on Win32.
153
//This source file will not be compiled,
154
//and the class will not be registered in wrap_init.h or wrap_init.cc
160
/** Adds an XEMBED client, such as a Gtk::Plug, to the Gtk::Socket. The
161
* client may be in the same process or in a different process.
163
* To embed a Gtk::Plug in a Gtk::Socket, you can either create the
164
* Gtk::Plug with <tt>gtk_plug_new (0)</tt>, call
165
* Gtk::Plug::get_id() to get the window ID of the plug, and then pass that to the
166
* add_id(), or you can call get_id() to get the
167
* window ID for the socket, and call Gtk::Plug::new() passing in that
170
* The Gtk::Socket must have already be added into a toplevel window
171
* before you can make this call.
172
* @param window_id The window ID of a client participating in the XEMBED protocol.
174
void add_id(::Window window_id);
176
/** Gets the window ID of a Gtk::Socket widget, which can then
177
* be used to create a client embedded inside the socket, for
178
* instance with Gtk::Plug::new().
180
* The Gtk::Socket must have already be added into a toplevel window
181
* before you can make this call.
182
* @return The window ID for the socket.
184
::Window get_id() const;
187
/** Retrieves the window of the plug. Use this to check if the plug has
188
* been created inside of the socket.
191
* @return The window of the plug if available, or <tt>0</tt>.
193
Glib::RefPtr<Gdk::Window> get_plug_window();
195
/** Retrieves the window of the plug. Use this to check if the plug has
196
* been created inside of the socket.
199
* @return The window of the plug if available, or <tt>0</tt>.
201
Glib::RefPtr<const Gdk::Window> get_plug_window() const;
206
* <tt>void on_my_%plug_added()</tt>
209
Glib::SignalProxy0< void > signal_plug_added();
214
* <tt>bool on_my_%plug_removed()</tt>
217
Glib::SignalProxy0< bool > signal_plug_removed();
227
/** A Glib::wrap() method for this object.
229
* @param object The C instance.
230
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
231
* @result A C++ instance that wraps this C instance.
233
* @relates Gtk::Socket
235
Gtk::Socket* wrap(GtkSocket* object, bool take_copy = false);
239
#endif /* _GTKMM_SOCKET_H */