Basic hypertext functionality

One of the components extending the hush widget library is a hypertext widget offering basic hypertext functionality by allowing the programmer to embed (Tcl) script code in plain text. The public C++ interface of the hypertext widget looks as follows:
  interface hypertext : widget {

    hypertext(char* path);
    hypertext(widget* parent, char* path);

    void configure( char* cmd );

    void file( char* name );
    };
A hypertext widget, as any other widget of the hush widget library, can be created from an absolute path name (as in Tk) or, relative to a parent widget, with a path extending the path of the parent widget. The hypertext widget allows for a number of configuration commands, for setting font size, background, foreground and the like.

A typical hypertext file is shown below:


  Rubber banding: press the left mouse button
  and release when the rectangle is of appropriate
  size
      %%
  drawtool $this.draw 
  $this.tool create rectangle 10 30 70 90
  $this append $this.tool 
  %%
  For additional information click on the %% 
  button $this.navigate -text instruction -command end-of-text
  $this append $this.navigate
  %%
  button. 

This file may be put in the hypertext widget by calling hypertext::file. The script code inbetween the %% brackets is evaluated and results in an instance of the drawtool widget, which is defined by the application (and briefly discussed in section Drawtool). The embedded widgets must me defined relative to the hypertext widget, by referring to the (widget) variable this. The drawtool widget is surrounded by text which contains an additional button for navigation.