This document describes a higher-level interface to the Gtk-Fortran package. The aim of this module to to make the development of widget interfaces somewhat less intimidating to the typical scientific programmer. The two main drivers of this have been: the widget routines in IDL (Interactive Data Language http://www.ittvis.com/) which allow the development of complex GUIs with a much simpler interface than that in plain GTK; and the Pilib project (web site now defunct) which was an earlier attempt to build a widget toolkit for Fortran but which is now essentially defunct.
The intent is not to replace the lower-level Gtk calls, but to supplement them by bundled routines that allow widget elements to be constructed in fewer lines of code. The majority of the routines provided are constructors, however when setting or getting values involves multiple calls, then such routines are also provided.
Not all the possible widgets are covered, nor are all the possible options. However most things likely to be needed for setting up and monitoring progress in a scientific program are covered.
The following simple example shows the comparison between the standard interface and the high-level interface in setting up an ``Apply'' button for a program:
When a high-level routine provides an argument to set a signal handler,
the argument name is just the signal name with hyphens (
replaced with underscores (
_). The user data argument is simply
data if only a single signal is handled, and
data_<signal name> when several are present.
Callback routines (also known as signal handlers or event handlers) are called when an action is performed on a widget (e.g. clicking a button). They are usually (though not always) subroutines (details of all signals and their requirements can be found in the Gtk documentation page at http://www.gtk.org/documentation.html). Generally callbacks fall into 2 categories:
There is a separate high level drawing interface
gtk_draw_hl that provides a bundled drawable widget with automatic expose event repair. To use this you need to have:
in your program. If you want to do more than very basic event processing you will also need
The interfaces to the individual routines are listed on the Highlevel-API page.
The supplemental routines and definitions are described in the Supplementary routines page.
The high level drawing interface is described in the High level drawing api page. NOTE There was a major change to the drawing API on 1 July 2011. This was to change the backing store from using a GdkPixbuf to a Cairo Image Surface, which facilitates updating plots rather than redrawing them.