Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 345aa895e80053137c21f8693106c3a0 > files > 199

gtkmm2.4-documentation-2.17.4-1mdv2010.0.noarch.rpm

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Widgets and ChildAnchors</title>
<link rel="stylesheet" href="style.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
<link rel="home" href="index.html" title="Programming with gtkmm">
<link rel="up" href="chapter-textview.html" title="Chapter 10. TextView">
<link rel="prev" href="chapter-textview.html" title="Chapter 10. TextView">
<link rel="next" href="sec-textview-examples.html" title="Examples">
</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">Widgets and ChildAnchors</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="chapter-textview.html"><img src="icons/prev.png" alt="Prev"></a> </td>
<th width="60%" align="center">Chapter 10. TextView</th>
<td width="20%" align="right"> <a accesskey="n" href="sec-textview-examples.html"><img src="icons/next.png" alt="Next"></a>
</td>
</tr>
</table>
<hr>
</div>
<div class="sect1" title="Widgets and ChildAnchors">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="sec-widgets-and-childanchors"></a>Widgets and ChildAnchors</h2></div></div></div>
<p>
You can embed widgets, such as <code class="classname">Gtk::Button</code>s, in the
text. Each such child widget needs a <code class="classname">ChildAnchor</code>.
ChildAnchors are associated with <code class="classname">iterators</code>. For
instance, to create a child anchor at a particular position, use
<code class="methodname">Gtk::TextBuffer::create_child_anchor()</code>:
</p>
<pre class="programlisting">Glib::RefPtr&lt;Gtk::TextChildAnchor&gt; refAnchor =
    refBuffer-&gt;create_child_anchor(iter);</pre>
<p>
Then, to add a widget at that position, use
<code class="methodname">Gtk::TextView::add_child_at_anchor()</code>:
</p>
<pre class="programlisting">m_TextView.add_child_at_anchor(m_Button, refAnchor);</pre>
<p><a class="ulink" href="http://library.gnome.org/devel/gtkmm/unstable/classGtk_1_1TextChildAnchor.html" target="_top">Reference</a></p>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="chapter-textview.html"><img src="icons/prev.png" alt="Prev"></a> </td>
<td width="20%" align="center"><a accesskey="u" href="chapter-textview.html"><img src="icons/up.png" alt="Up"></a></td>
<td width="40%" align="right"> <a accesskey="n" href="sec-textview-examples.html"><img src="icons/next.png" alt="Next"></a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Chapter 10. TextView </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"> Examples</td>
</tr>
</table>
</div>
</body>
</html>