/usr/share/doc/gtkmm-documentation/tutorial/html/chapter-plugs-sockets.html is in gtkmm-documentation 3.18.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chapter 22. Plugs and Sockets</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="Programming with gtkmm 3">
<link rel="up" href="index.html" title="Programming with gtkmm 3">
<link rel="prev" href="sec-recentchooser.html" title="RecentChooser">
<link rel="next" href="sec-plugs-sockets-example.html" title="Plugs and Sockets Example">
</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">Chapter 22. Plugs and Sockets</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="sec-recentchooser.html"><img src="icons/prev.png" alt="Prev"></a> </td>
<th width="60%" align="center"> </th>
<td width="20%" align="right"> <a accesskey="n" href="sec-plugs-sockets-example.html"><img src="icons/next.png" alt="Next"></a>
</td>
</tr>
</table>
<hr>
</div>
<div class="chapter">
<div class="titlepage"><div><div><h1 class="title">
<a name="chapter-plugs-sockets"></a>Chapter 22. Plugs and Sockets</h1></div></div></div>
<div class="toc">
<p><b>Table of Contents</b></p>
<ul class="toc">
<li><span class="sect1"><a href="chapter-plugs-sockets.html#sec-plugs-sockets-overview">Overview</a></span></li>
<li><span class="sect1"><a href="sec-plugs-sockets-example.html">Plugs and Sockets Example</a></span></li>
</ul>
</div>
<div class="sect1">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="sec-plugs-sockets-overview"></a>Overview</h2></div></div></div>
<p>
From time to time, it may be useful to be able to embed a widget from
another application within your application. <span class="application">gtkmm</span> allows you to do
this with the <code class="classname">Gtk::Socket</code> and
<code class="classname">Gtk::Plug</code> classes. It is not anticipated that very
many applications will need this functionality, but in the rare case that
you need to display a widget that is running in a completely different
process, these classes can be very helpful.
</p>
<p>
The communication between a <code class="classname">Socket</code> and a
<code class="classname">Plug</code> follows the XEmbed protocol. This protocol has
also been implemented in other toolkits (e.g. Qt), which allows the same
level of integration when embedding a Qt widget in GTK+ or vice versa.
</p>
<p>
The way that <code class="classname">Sockets</code> and
<code class="classname">Plugs</code> work together is through their window ids.
Both a <code class="classname">Socket</code> and a <code class="classname">Plug</code>
have IDs that can be retrieved with their <code class="methodname">get_id()</code>
member functions. The use of these IDs will be explained below in <a class="xref" href="chapter-plugs-sockets.html#sec-connecting-plugs-sockets" title="Connecting Plugs and Sockets">the section called “Connecting Plugs and Sockets”</a>.
</p>
<div class="sect2">
<div class="titlepage"><div><div><h3 class="title">
<a name="sec-sockets"></a>Sockets</h3></div></div></div>
<p>
A <code class="classname">Socket</code> is a special kind of container widget that
provides the ability to embed widgets from one process into another
process in a way that is transparent to the user.
</p>
</div>
<div class="sect2">
<div class="titlepage"><div><div><h3 class="title">
<a name="sec-plugs"></a>Plugs</h3></div></div></div>
<p>
A <code class="classname">Plug</code> is a special kind of Window that can be
plugged into a <code class="classname">Socket</code>. Besides the normal
properties and methods of <code class="classname">Gtk::Window</code>, a
<code class="classname">Plug</code> provides a constructor that takes the ID of
a <code class="classname">Socket</code>, which will automatically embed the
<code class="classname">Plug</code> into the <code class="classname">Socket</code> that
matches that ID.
</p>
<p>
Since a <code class="classname">Plug</code> is just a special type of
<code class="classname">Gtk::Window</code> class, you can add containers or
widgets to it like you would to any other window.
</p>
</div>
<div class="sect2">
<div class="titlepage"><div><div><h3 class="title">
<a name="sec-connecting-plugs-sockets"></a>Connecting Plugs and Sockets</h3></div></div></div>
<p>
After a <code class="classname">Socket</code> or <code class="classname">Plug</code>
object is realized, you can obtain its ID with its
<code class="methodname">get_id()</code> function. This ID can then be shared with
other processes so that other processes know how to connect to
each other.
</p>
<p>
There are two basic strategies that can be used:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>
Create a <code class="classname">Socket</code> object in one process and
pass the ID of that <code class="classname">Socket</code> to another
process so that it can create a <code class="classname">Plug</code> object
by specifying the given <code class="classname">Socket</code> ID in its
constructor. There is no way to assign a
<code class="classname">Plug</code> to a particular
<code class="classname">Socket</code> after creation, so you must pass the
<code class="classname">Socket</code> ID to the
<code class="classname">Plug</code>'s constructor.
</p></li>
<li class="listitem"><p>
Create a <code class="classname">Plug</code> independantly from any
particular <code class="classname">Socket</code> and pass the ID of the
<code class="classname">Plug</code> to other processes that need to use
it. The ID of the <code class="classname">Plug</code> can be associated
with a particular <code class="classname">Socket</code> object using the
<code class="methodname">Socket::add_id()</code> function. This is the
approach used in the example below.
</p></li>
</ul></div>
<p>
</p>
</div>
</div>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="sec-recentchooser.html"><img src="icons/prev.png" alt="Prev"></a> </td>
<td width="20%" align="center"> </td>
<td width="40%" align="right"> <a accesskey="n" href="sec-plugs-sockets-example.html"><img src="icons/next.png" alt="Next"></a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">RecentChooser </td>
<td width="20%" align="center"><a accesskey="h" href="index.html"><img src="icons/home.png" alt="Home"></a></td>
<td width="40%" align="right" valign="top"> Plugs and Sockets Example</td>
</tr>
</table>
</div>
</body>
</html>
|