Sophie

Sophie

distrib > * > 2010.0 > * > by-pkgid > 345aa895e80053137c21f8693106c3a0 > files > 33

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

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chapter 26. Recommended Techniques</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="index.html" title="Programming with gtkmm">
<link rel="prev" href="sec-custom-widgets.html" title="Custom Widgets">
<link rel="next" href="sec-using-a-gtkmm-widget.html" title="Using a gtkmm widget">
</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 26. Recommended Techniques</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="sec-custom-widgets.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-using-a-gtkmm-widget.html"><img src="icons/next.png" alt="Next"></a>
</td>
</tr>
</table>
<hr>
</div>
<div class="chapter" title="Chapter 26. Recommended Techniques">
<div class="titlepage"><div><div><h2 class="title">
<a name="chapter-recommended-techniques"></a>Chapter 26. Recommended Techniques</h2></div></div></div>
<div class="toc">
<p><b>Table of Contents</b></p>
<ul>
<li><span class="sect1"><a href="chapter-recommended-techniques.html#sec-application-lifetime">Application Lifetime</a></span></li>
<li><span class="sect1"><a href="sec-using-a-gtkmm-widget.html">Using a <span class="application">gtkmm</span> widget</a></span></li>
</ul>
</div>
<p>This section is simply a gathering of wisdom, general style guidelines
and hints for creating <span class="application">gtkmm</span> applications.
</p>
<p>Use GNU <span class="application">autoconf</span> and
    <span class="application">automake</span>! They are your friends :)
    <span class="application">Automake</span> examines C files, determines how they
    depend on each other, and generates a <code class="filename">Makefile</code> so the
    files can be compiled in the correct order.
    <span class="application">Autoconf</span> permits automatic configuration of
    software installation, handling a large number of system quirks to increase
    portability..
</p>
<p>Subclass Widgets to better organize your code. You should probably
    subclass your main <code class="classname">Window</code> at least. Then you can
    make your child Widgets and signal handlers members of that class.
</p>
<p>Create your own signals instead of passing pointers around. Objects can
    communicate with each other via signals and signal handlers. This is much
    simpler than objects holding pointers to each other and calling each
    other's methods. <span class="application">gtkmm</span>'s classes uses special versions of
    <code class="classname">sigc::signal</code>, but you should use normal
    <code class="classname">sigc::signal</code>s, as described in the
    <span class="application">libsigc++</span> documentation.</p>
<div class="sect1" title="Application Lifetime">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="sec-application-lifetime"></a>Application Lifetime</h2></div></div></div>
<p>Most applications will have only one <code class="classname">Window</code>, or
    only one main window. These applications can use the
    <code class="methodname">Gtk::Main::run(Gtk::Window&amp;)</code> overload. It shows
    the window and returns when the window has been hidden. This might happen
    when the user closes the window, or when your code decides to
    <code class="methodname">hide()</code> the window.  You can prevent the user from
    closing the window (for instance, if there are unsaved changes) by
    overriding <code class="methodname">Gtk::Window::on_delete_event()</code>.</p>
<p>Most of our examples use this technique.</p>
</div>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="sec-custom-widgets.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-using-a-gtkmm-widget.html"><img src="icons/next.png" alt="Next"></a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Custom Widgets </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"> Using a <span class="application">gtkmm</span> widget</td>
</tr>
</table>
</div>
</body>
</html>