File: ch21.html

package info (click to toggle)
gtkmm2.0 2.2.12-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 56,872 kB
  • ctags: 51,600
  • sloc: xml: 73,173; cpp: 20,565; sh: 8,608; perl: 2,702; makefile: 1,233
file content (10 lines) | stat: -rw-r--r-- 3,663 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter21.Recommended Techniques</title><meta name="generator" content="DocBook XSL Stylesheets V1.64.1"><link rel="home" href="index.html" title="Programming with gtkmm2"><link rel="up" href="index.html" title="Programming with gtkmm2"><link rel="previous" href="ch20s04.html" title="Getting help with translations"><link rel="next" href="ch21s02.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">Chapter21.Recommended Techniques</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch20s04.html">Prev</a></td><th width="60%" align="center"></th><td width="20%" align="right"><a accesskey="n" href="ch21s02.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="sec-gathering"></a>Chapter21.Recommended Techniques</h2></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="ch21.html#id2520225">Application lifetime</a></span></dt><dt><span class="sect1"><a href="ch21s02.html">Using a gtkmm widget</a></span></dt></dl></div><p>This section is simply a gathering of wisdom, general style guidelines
and hints for creating gtkmm applications.
</p><p>Use GNU autoconf and automake! They are your friends :) Automake
examines C files, determines how they depend on each other, and
generates a Makefile so the files can be compiled in the correct
order. Autoconf permits automatic configuration of software
installation, handling a large number of system quirks to increase
portability..
</p><p>Subclass Widgets to better organise your code. You should probably subclass your main Window 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. gtkmm's classes uses special versions of Sigc::Signal, but you should use normal SigC::Signals, as described in the libsigc++ documentation.</p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2520225"></a>Application lifetime</h2></div></div><div></div></div><p>Most applications will have only one window, or only one main window. These applications can use the Gtk::Main::run(Gtk::Window&amp;) 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 hide() the window. You can prevent the user from closing the window (for instance, if there are unsaved changes) by overriding Gtk::Window::on_delete_event().</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="ch20s04.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="index.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="ch21s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Getting help with translations</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">Using a gtkmm widget</td></tr></table></div></body></html>