When I think about it, I’ve done a surprising amount of GUI programming, on a really surprising range of platforms. My first exposure was writing X applications using Xt and Motif. You had to write a lot of code to get anything done and the “object-oriented C” approach used for defining widgets took a bit of getting used to.
Since then, I’ve done more and bigger stuff with Motif, I got to play with an early version of NeXTStep, I’ve used Qt on Linux and I’ve even done some Windows GUI programming, which I didn’t enjoy a whole lot.
wxWindows and Isla
My most recent GUI programming work has been with wxWindows, writing a tool to produce island outline data for a general circulation model of the ocean (this is part of a big climate model, and needs island outlines computed according to a fairly complicated geometrical prescription as part of its input data1).
This application (called Isla) was interesting to write, partially because of the complicated island determination rules, but also because it’s a scrolling zoomable map view of a land/sea mask at variable resolution (the climate model can be run in lots of different configurations with lots of different ocean grid resolutions, all of which have to be dealt with), with island information overlaid as it’s calculated (the user can also coarsen or refine the sets of bounding rectangles used to define each island if they want).
GUI programming in C or C++ tends to be similar whatever platform or framework you’re using. wxWindows is straightforward – all the usual tasks of laying out forms, making menus and so on are easy to do and there are some nice pre-processor helpers that make event routing convenient. Isla, like a lot of GUI applications, has a wrapper of menu commands and a few dialogues around a “canvas” where most of the interaction happens: for Isla, this is the zoomable map view showing the land/sea mask and the island data. Implementing this kind of thing is usually quite a good test of how convenient a GUI framework is to use, since you have to do most things by hand: coordinate transformations, drawing, mouse events and so on, and you have to fall back on the lower-level features of the framework. wxWindows is nice in this respect, and it feels like something close to an optimum for GUI development in C++. I’ll use it again if I have clients who want this sort of application.
Things I’d like to try
There are are three main things I’d like to spend a little bit of time on in terms of GUI programming:
Functional reactive programming is a completely different idea to the “standard” widgets-and-events approach to GUI programming, and it looks quite exciting. I think it’s fair to say that it’s still quite “researchy”, but it shows a lot of promise. I’m kind of tempted to try writing a little game using Netwire and SDL at some point to see how it feels.
If you want the grubby details, the “island outlines” are closed curves on the streamfunction (or velocity) grid of the model (the land/sea mask defining the islands is given on the tracer grid, which is offset from the velocity grid). The model does a line integral of the streamfunction around these curves and performs a relaxation calculation to fix the streamfunction values in the “holes” in the ocean flow defined by the islands. There are a couple of pages of rules defining how the island outlines should be determined from the land/sea mask.↩