| ||freshmeat.net entry|
This project is no longer active. For an alternative see Gtk2Hs. GTK+ (The GIMP Toolkit) is an open source GUI toolkit originally developed for the GIMP (GNU Image Manipulation Program). However, it is used in a range of other projects by now, most notably the GNOME (GNU Network Object Model Environment). GTK+ is portable as it does not rely on X window's Xt library, but instead accesses the underlying window system via a thin API, called GDK. Furthermore, it uses a consequent object-oriented design and realizes callback functionality via a flexible and powerful signal mechanism (not identical with, but oriented by *nix signals). GTK+ object-oriented features are realized in plain C; and it has been designed with an eye on making it not too difficult to interface from high-level languages. Therefore, it is a very interesting choice for a GUI toolkit for Haskell.
For a summary of the latest changes to the CVS head, check out the NEWS in CVS. Here is some more general news:
GtkSpinButtonand a widget handler for key events courtesy of Peter Strand, support for
GtkVButtonBoxcourtesy of Ian Lynagh, and quite a number of additional widgets being supported by iHaskell courtesy of Haoran Un.
GtkMozEmbed(the latter as an extension feature). Needs version 0.10.8 or higher of C->Haskell.
GtkNotebook. Needs version 0.10.8 or higher of C->Haskell.
GtkGLAreafixed again. Needs version 0.10.6 or later of C->Haskell.
GtkEditableas well as support for GHC's package management. Needs version 0.10.6 or later of C->Haskell.
GtkAccelGroupand the widgets
GtkTooltips(all courtesy of Jonas Svensson). Moreover, all of the GDK modules are now rewritten to use C->Haskell with the current FFI API. Needs version 0.10.6 or later of C->Haskell.
Currently, the GTK+ binding is available for the Glasgow Haskell Compiler only, but I plan to include support for NHC98.
The basic functionality and many advanced widgets are supported. Furthermore, there is some GLib and GDK support as well as full support for GtkGLArea, which allows you to render OpenGL graphics in a GTK+ window. Everything from Chapter 3 of Havoc Pennington's GTK+/Gnome book is implemented (it's a good book, by the way). However, GTK+ provides a number of more sophisticated and/or specialised widgets that aren't supported yet.
The implemented functionality should be sufficient for average user interfaces. You may want to have a look at the screenshot and code of one of the small examples that I used to test the binding. Or a screenshot of the Boolean Editor.
The following lists source and binary packages of Gtk+HS. Note that the binary packages are compiled for use with GHC and that they will only work with exactly the version of GHC that they have been compiled for. Similarly, the used package of C->Haskell must also be for the same version of GHC.
i386.deb| FreeBSD port ]
i386.deb| FreeBSD port ]
To subscribe to the Gtk+HS mailing list, visit the subscription page. The address of the list is firstname.lastname@example.org and there is also an online archive.
For those who prefer the bleeding edge fresh from CVS over tar balls, Gtk+HS can be obtained by anonymous CVS from the Gnome repository. Here is what you have to know:
cvs -z3 checkout gtk+hsThe -z3 is to compress the stuff when it flies (or crawls) over the net.
This creates a directory named gtk+hs wherever you issue the checkout command. When getting the stuff from CVS, don't forget to invoke autoconf before ./configure (the configure script is not pre-generated in the CVS). By virtue of the fabulous LXR tool, you can also browse the source code online.
Currently, the only Gtk+HS-specific documentation is a a brief usage guide. There is no dedicated documentation describing the API of GTK+ in Haskell. However, the binding remains as close as possible to the original GTK+ interface (while, at the same time, embedding the functionality nicely in Haskell's type system). Thus, I recommend to consult the original GTK+ documentation in conjunction with the interface specification of the Haskell modules. Wherever, I deviated significantly from GTK+'s original interface, the module header or a comment at the function definition explains the differences.
Check out the GTK+ 1.2 tutorial and the reference manuals for GTK+, GDK, and GLib.
The following is a (probably incomplete list) of publicly available applications that use Gtk+HS:
linkchkis a heart-beat monitor for local network links for Linux (relies on the
hsclockis an accurate multi-zone GTK+ clock, that can also run in a tty.
There are more applications of which I know that they are using the toolkit, but they haven't been publicly released.
iHaskell is a layer on top of Gtk+Haskell that
iHaskell is part of Gtk+HS standard release (in the subdirectory
ih/). To enable it, you need to install the Haskell Ports
Library first and pass the option
./configure when compiling Gtk+HS. You can have a direct look at
the iHaskell code in CVS, too. The only documentation to date are the
slides of a talk that I have given at the
meeting of the IFIP WG 2.8.
The next major development will be support for GTK+ 2.0. This will be realised using a recently implemented feature for conditional compilation in C->Haskell. As a result, it will be possible support GTK+ 1.2 and GTK+ 2.0 within one set of Haskell binding sources.
The code is released under the GNU Library General Public Lisence. This basically means that you can do whatever you want with it, as long as you share any improvements to the library with the rest of us. I welcome everybody to contribute bindings for widgets and functions that are not supported yet; I only ask any contributors that they code in accordance with the style and design of the existing modules.
This page is part of Manuel Chakravarty's WWW-stuff.
Last modified: Fri Jul 15 22:33:02 EST 2005