~ubuntu-branches/ubuntu/precise/gtkmm3.0/precise

« back to all changes in this revision

Viewing changes to gtk/gtkmm/socket.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2011-06-17 00:12:44 UTC
  • Revision ID: james.westby@ubuntu.com-20110617001244-9hl5an15hiaaahi6
Tags: upstream-3.0.1
ImportĀ upstreamĀ versionĀ 3.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- c++ -*-
 
2
// Generated by gtkmmproc -- DO NOT MODIFY!
 
3
#ifndef _GTKMM_SOCKET_H
 
4
#define _GTKMM_SOCKET_H
 
5
 
 
6
 
 
7
#include <glibmm.h>
 
8
 
 
9
/* $Id: socket.hg,v 1.2 2004/02/10 17:35:13 mxpxpod Exp $ */
 
10
 
 
11
/* Copyright (C) 1998-2002 The gtkmm Development Team
 
12
 *
 
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.
 
17
 *
 
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.
 
22
 *
 
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.
 
26
 */
 
27
 
 
28
#include <gtkmm/container.h>
 
29
#include <gdkmm/types.h>
 
30
#include <gtk/gtkx.h> //Necessary for the X11 Window type.
 
31
 
 
32
 
 
33
#ifndef DOXYGEN_SHOULD_SKIP_THIS
 
34
typedef struct _GtkSocket GtkSocket;
 
35
typedef struct _GtkSocketClass GtkSocketClass;
 
36
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
37
 
 
38
 
 
39
namespace Gtk
 
40
{ class Socket_Class; } // namespace Gtk
 
41
namespace Gtk
 
42
{
 
43
 
 
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.
 
47
  
 
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.
 
55
 *
 
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.
 
59
 *
 
60
 * @code
 
61
 * Gtk::Socket socket;
 
62
 * parent.add(socket);
 
63
 *
 
64
 * // The following call is only necessary if one of the ancestors of the
 
65
 * // socket is not yet visible
 
66
 * socket.realize();
 
67
 *
 
68
 * cout << "The ID of the sockets window is: " << socket.get_id() << endl;
 
69
 *
 
70
 * @endcode
 
71
 *
 
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.
 
80
 *
 
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
 
84
 * loop is running.
 
85
 *
 
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.
 
90
 *
 
91
 * @ingroup Widgets
 
92
 * @ingroup Containers
 
93
 */
 
94
 
 
95
class Socket : public Container
 
96
{
 
97
  public:
 
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 */
 
104
 
 
105
  virtual ~Socket();
 
106
 
 
107
#ifndef DOXYGEN_SHOULD_SKIP_THIS
 
108
 
 
109
private:
 
110
  friend class Socket_Class;
 
111
  static CppClassType socket_class_;
 
112
 
 
113
  // noncopyable
 
114
  Socket(const Socket&);
 
115
  Socket& operator=(const Socket&);
 
116
 
 
117
protected:
 
118
  explicit Socket(const Glib::ConstructParams& construct_params);
 
119
  explicit Socket(GtkSocket* castitem);
 
120
 
 
121
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
122
 
 
123
public:
 
124
#ifndef DOXYGEN_SHOULD_SKIP_THIS
 
125
  static GType get_type()      G_GNUC_CONST;
 
126
 
 
127
 
 
128
  static GType get_base_type() G_GNUC_CONST;
 
129
#endif
 
130
 
 
131
  ///Provides access to the underlying C GtkObject.
 
132
  GtkSocket*       gobj()       { return reinterpret_cast<GtkSocket*>(gobject_); }
 
133
 
 
134
  ///Provides access to the underlying C GtkObject.
 
135
  const GtkSocket* gobj() const { return reinterpret_cast<GtkSocket*>(gobject_); }
 
136
 
 
137
 
 
138
public:
 
139
  //C++ methods used to invoke GTK+ virtual functions:
 
140
 
 
141
protected:
 
142
  //GTK+ Virtual Functions (override these to change behaviour):
 
143
 
 
144
  //Default Signal Handlers::
 
145
  virtual void on_plug_added();
 
146
  virtual bool on_plug_removed();
 
147
 
 
148
 
 
149
private:
 
150
 
 
151
  
 
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
 
155
 
 
156
public:
 
157
  Socket();
 
158
  
 
159
 
 
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. 
 
162
   * 
 
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
 
168
   * ID.
 
169
   * 
 
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.
 
173
   */
 
174
  void add_id(::Window window_id);
 
175
  
 
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(). 
 
179
   * 
 
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.
 
183
   */
 
184
  ::Window get_id() const;
 
185
 
 
186
  
 
187
  /** Retrieves the window of the plug. Use this to check if the plug has
 
188
   * been created inside of the socket.
 
189
   * 
 
190
   * @newin{2,14}
 
191
   * @return The window of the plug if available, or <tt>0</tt>.
 
192
   */
 
193
  Glib::RefPtr<Gdk::Window> get_plug_window();
 
194
  
 
195
  /** Retrieves the window of the plug. Use this to check if the plug has
 
196
   * been created inside of the socket.
 
197
   * 
 
198
   * @newin{2,14}
 
199
   * @return The window of the plug if available, or <tt>0</tt>.
 
200
   */
 
201
  Glib::RefPtr<const Gdk::Window> get_plug_window() const;
 
202
 
 
203
  
 
204
  /**
 
205
   * @par Prototype:
 
206
   * <tt>void on_my_%plug_added()</tt>
 
207
   */
 
208
 
 
209
  Glib::SignalProxy0< void > signal_plug_added();
 
210
 
 
211
  
 
212
  /**
 
213
   * @par Prototype:
 
214
   * <tt>bool on_my_%plug_removed()</tt>
 
215
   */
 
216
 
 
217
  Glib::SignalProxy0< bool > signal_plug_removed();
 
218
 
 
219
 
 
220
};
 
221
 
 
222
} // namespace Gtk
 
223
 
 
224
 
 
225
namespace Glib
 
226
{
 
227
  /** A Glib::wrap() method for this object.
 
228
   * 
 
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.
 
232
   *
 
233
   * @relates Gtk::Socket
 
234
   */
 
235
  Gtk::Socket* wrap(GtkSocket* object, bool take_copy = false);
 
236
} //namespace Glib
 
237
 
 
238
 
 
239
#endif /* _GTKMM_SOCKET_H */
 
240