File: class-gtksocket.html

package info (click to toggle)
python-gtk2-doc 2.5.2-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,304 kB
  • ctags: 3,741
  • sloc: makefile: 38
file content (54 lines) | stat: -rw-r--r-- 14,176 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gtk.Socket</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gtk-class-reference.html" title="The gtk Class Reference"><link rel="previous" href="class-gtksizegroup.html" title="gtk.SizeGroup"><link rel="next" href="class-gtkspinbutton.html" title="gtk.SpinButton"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gtk.Socket</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtksizegroup.html">Prev</a></td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-gtkspinbutton.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gtksocket"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>gtk.Socket</h2><p>gtk.Socket &#8212; a container for widgets from other processes.</p></div><div class="refsect1" lang="en"><a name="id3505100"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.Socket</span></span>(<span class="ooclass"><span class="classname"><a href="class-gtkcontainer.html" title="gtk.Container">gtk.Container</a></span></span>):
<code class="constructorsynopsis">    <span class="methodname"><a href="class-gtksocket.html#constructor-gtksocket" title="Constructor">gtk.Socket</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtksocket.html#method-gtksocket--add-id" title="gtk.Socket.add_id">add_id</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>window_id</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtksocket.html#method-gtksocket--get-id" title="gtk.Socket.get_id">get_id</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3505179"></a><h2>Ancestry</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="synopsis">+-- <a href="class-gobject.html" title="gobject.GObject">gobject.GObject</a>
  +-- <a href="class-gtkobject.html" title="gtk.Object">gtk.Object</a>
    +-- <a href="class-gtkwidget.html" title="gtk.Widget">gtk.Widget</a>
      +-- <a href="class-gtkcontainer.html" title="gtk.Container">gtk.Container</a>
        +-- <a href="class-gtksocket.html" title="gtk.Socket">gtk.Socket</a>
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3505221"></a><h2>Signal Prototypes</h2><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term">"<a href="class-gtksocket.html#signal-gtksocket--plug-added" title='The "plug-added" gtk.Socket Signal'>plug-added</a>"</span></td><td><code class="methodsynopsis">    def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>socket</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></td></tr><tr><td><span class="term">"<a href="class-gtksocket.html#signal-gtksocket--plug-removed" title='The "plug-removed" gtk.Socket Signal'>plug-removed</a>"</span></td><td><code class="methodsynopsis">    def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>socket</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></td></tr></tbody></table></div><div class="refsect1" lang="en"><a name="id3505313"></a><h2>Description</h2><p>Together with a <a href="class-gtkplug.html" title="gtk.Plug"><tt class="classname">gtk.Plug</tt></a>, a <a href="class-gtksocket.html" title="gtk.Socket"><tt class="classname">gtk.Socket</tt></a> 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 <a href="class-gtksocket.html" title="gtk.Socket"><tt class="classname">gtk.Socket</tt></a> widget
and, passes the that widget's window ID to the other process, which then
creates a <a href="class-gtkplug.html" title="gtk.Plug"><tt class="classname">gtk.Plug</tt></a> with that
window ID. Any widgets contained in the <a href="class-gtkplug.html" title="gtk.Plug"><tt class="classname">gtk.Plug</tt></a> then will
appear inside the first applications window. The socket's window ID is
obtained by using the <a href="class-gtksocket.html#method-gtksocket--get-id" title="gtk.Socket.get_id"><tt class="methodname">get_id</tt>()</a>
method. Before using this function, the socket must have been realized, and
added to its parent.</p><p>When PyGTK 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 <a href="class-gtksocket.html" title="gtk.Socket"><tt class="classname">gtk.Socket</tt></a> and a
<a href="class-gtkplug.html" title="gtk.Plug"><tt class="classname">gtk.Plug</tt></a> follows
the XEmbed protocol.</p></div><div class="refsect1" lang="en"><a name="constructor-gtksocket"></a><h2>Constructor</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="constructorsynopsis">    <span class="methodname">gtk.Socket</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the new <a href="class-gtksocket.html" title="gtk.Socket"><tt class="classname">gtk.Socket</tt></a>.</td></tr></tbody></table><p>Creates a new <a href="class-gtksocket.html" title="gtk.Socket"><tt class="classname">gtk.Socket</tt></a>.</p></div><div class="refsect1" lang="en"><a name="id3505461"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gtksocket--add-id"></a><h3>gtk.Socket.add_id</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">add_id</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>window_id</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>window_id</tt></b>:</span></td><td>the window ID of a client participating in the
XEMBED protocol.</td></tr></tbody></table><p>The <tt class="methodname">add_id</tt>() method adds an XEMBED
client specified by <i class="parameter"><tt>window_id</tt></i>, such as a <a href="class-gtkplug.html" title="gtk.Plug"><tt class="classname">gtk.Plug</tt></a>, to the <a href="class-gtksocket.html" title="gtk.Socket"><tt class="classname">gtk.Socket</tt></a>.  The
client may be in the same process or in a different process.</p><p>
To embed a <a href="class-gtkplug.html" title="gtk.Plug"><tt class="classname">gtk.Plug</tt></a> in a <a href="class-gtksocket.html" title="gtk.Socket"><tt class="classname">gtk.Socket</tt></a>, you can
either:</p><div class="itemizedlist"><ul type="disc"><li><p>create the <a href="class-gtkplug.html" title="gtk.Plug"><tt class="classname">gtk.Plug</tt></a> by calling
<a href="class-gtkplug.html#constructor-gtkplug" title="Constructor">gtk.Plug</a>(), then call <a href="class-gtkplug.html#method-gtkplug--get-id" title="gtk.Plug.get_id"><tt class="methodname">gtk.Plug.get_id</tt>()</a> 
to get the window ID of the plug, and finally pass that to the <a href="class-gtksocket.html#method-gtksocket--add-id" title="gtk.Socket.add_id"><tt class="function">gtk.Socket.add_id()</tt></a>; 
or,</p></li><li><p>call the <a href="class-gtksocket.html#method-gtksocket--get-id" title="gtk.Socket.get_id"><tt class="function">gtk.Socket.get_id()</tt></a> 
method to get the window ID for the socket, then create the <a href="class-gtkplug.html" title="gtk.Plug"><tt class="classname">gtk.Plug</tt></a> by calling
<a href="class-gtkplug.html#constructor-gtkplug" title="Constructor">gtk.Plug</a>() passing in that ID.
The <a href="class-gtksocket.html" title="gtk.Socket"><tt class="classname">gtk.Socket</tt></a>
must have already be added into a toplevel window before you can make this
call.</p></li></ul></div></div><div class="refsect2" lang="en"><a name="method-gtksocket--get-id"></a><h3>gtk.Socket.get_id</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_id</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the window ID for the
socket</td></tr></tbody></table><p>The <tt class="methodname">get_id</tt>() method gets the window ID
of a <a href="class-gtksocket.html" title="gtk.Socket"><tt class="classname">gtk.Socket</tt></a> widget,
which can then be used to create a client embedded inside the socket, for
instance with <a href="class-gtkplug.html#constructor-gtkplug" title="Constructor">gtk.Plug</a>(). The
<a href="class-gtksocket.html" title="gtk.Socket"><tt class="classname">gtk.Socket</tt></a>
must have already be added into a toplevel window before you can make this
call.</p></div></div><div class="refsect1" lang="en"><a name="id3505721"></a><h2>Signals</h2><div class="refsect2" lang="en"><a name="signal-gtksocket--plug-added"></a><h3>The "plug-added" gtk.Socket Signal</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>socket</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><i class="parameter"><tt>socket</tt></i>:</span></td><td>the socket that received the
signal</td></tr><tr><td><span class="term"><i class="parameter"><tt>user_param1</tt></i>:</span></td><td>the first user parameter (if any) specified
with the <a href="class-gobject.html#method-gobject--connect" title="gobject.GObject.connect"><tt class="methodname">connect</tt>()</a>
method</td></tr><tr><td><span class="term"><i class="parameter"><tt>...</tt></i>:</span></td><td>additional user parameters (if
any)</td></tr></tbody></table><p>The "plug-added" signal is emitted when a plug is added to the
socket.</p></div><div class="refsect2" lang="en"><a name="signal-gtksocket--plug-removed"></a><h3>The "plug-removed" gtk.Socket Signal</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">callback</span>(<span class="methodparam"><span class="parameter"><i class="parameter"><tt>socket</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>user_param1</tt></i></span></span>, <span class="methodparam"><span class="parameter"><i class="parameter"><tt>...</tt></i></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><i class="parameter"><tt>socket</tt></i>:</span></td><td>the socket that received the
signal</td></tr><tr><td><span class="term"><i class="parameter"><tt>user_param1</tt></i>:</span></td><td>the first user parameter (if any) specified
with the <a href="class-gobject.html#method-gobject--connect" title="gobject.GObject.connect"><tt class="methodname">connect</tt>()</a>
method</td></tr><tr><td><span class="term"><i class="parameter"><tt>...</tt></i>:</span></td><td>additional user parameters (if
any)</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">TRUE</tt> if the <a href="class-gtksocket.html" title="gtk.Socket"><tt class="classname">gtk.Socket</tt></a>
	  should not be destroyed.</td></tr></tbody></table><p>The "plug-removed" signal is emitted when a plug is removed from
the socket. The default action is to destroy the <a href="class-gtksocket.html" title="gtk.Socket"><tt class="classname">gtk.Socket</tt></a> widget,
so if you want to reuse it you must add a signal handler that returns
<tt class="literal">TRUE</tt>.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-gtksizegroup.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="gtk-class-reference.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="class-gtkspinbutton.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.SizeGroup</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">gtk.SpinButton</td></tr></table></div></body></html>