Writing interactive software leads, due to the lack of adapted control structures, to a code that is difficult to maintain and reuse. Formalisms adapted to the description and to the specification of interactions do exist. We propose to extend imperative programming languages with a control structure borrowed from one of those formalisms : the hierarchical state machines.
A paper in french [B02], and in english [BBL06] describe our work, and a library (libhsm) is provided to experiment the use of hierarchical state machines in C++.
The library provides a preprocessor to generate C++ code from HSMs definitions, a framework to support run-time execution of HSMs, and abstractions for dealing with system dependent aspects of interactive software (dealing with windows, time, files, threads, etc.)
The latter part of the library is fully functionnal under MacOSX system only. The port is almost complete for Win32 systems but not activelly supported, and the windowing part of the port is totally absent for posix / X systems but the libhsm design should make it easy to achieve.
Some easy to prototype widgets (a traditionnal button, a button for crossing-based user interface):
A simple svg editor using a transparent toolglass and bimanual interaction:
An interactive tree view:
The hsm library is available as a source archive.
You will need the svgl library if you are planning to use the svg display facility.