\c{ \nop{ The example given in the previous section showed what kind of components are typically used when developing a program with the hush library. However, instead of employing a Tcl script, the window interface may also be developed entirely by employing hush C++ widgets. } In this section, a brief overview will be given of the classes offered by the hush library. Further, it will be shown how to construct the hush interpreter referred to in the introduction. In addition, we will take a closer look at the classes kit and session, which are needed to communicate with the embedded Tcl interpreter and to initialize the main event loop. } \c{

The hush class library

The hush C++ library consists of three kinds of classes, namely (a) the widget classes, which mimic the functionality of Tk, (b) the handler classes, which are involved in the handling of events and the binding of C++ code to Tcl commands, and (c) the classes kit and session, which encapsulate the embedded interpreter and the window management system, } .so f_ov \c{ In the widget class hierarchy depicted in slide hush-overview (a), the widget class represents an abstract widget, defining the commands that are valid for each of the descendant concrete widget classes. The widget class, however, is not an abstract class in C++ terms. It may be used for creating pointers to widgets defined in Tcl. In contrast, employing the constructor of one of the concrete widget classes results in actually creating a widget. A more detailed example showing the functionality offered by the widget classes will be given in section user. A description of the individual widget classes is included in appendix hush-man. } \c{ The class hierarchy depicted in slide hush-overview (b) depicts the handler class as a subclass of client. The reason for this will become clear in section Binding. The handler class may also be considered an abstract class, in the sense that it is intended to be used as the ancestor of a user-defined handler class. The handler class has two pre-defined descendant classes, namely the widget class and the item class. This implies, indeed, that both the widget and the item classes (the latter of which is discussed in section hush-item) may also be used as ancestor handler classes. The reason for this is that any descendant of a widget or item class may declare itself to be its own handler and define the actions that are invoked in response to particular events. This will be illustrated and discussed in sections Binding and user. } \c{

The hush interpreter

In the introduction, hush was announced as both a C++ library and as an interpreter extending the wish interpreter. The program shown in slide hush-interpreter substantiates this claim, albeit in a perhaps disappointingly simple way. } \slide{hush-interpreter}{The hush interpreter}{ .ds lib/sli-hush.c }{ .ds lib/hush.c } } \c{ The structure of the program is characteristic for hush-based applications. \nop{ similar to the C++ example of section hush-example. } Part [1] consists merely of including the {\tt hush.h} header file and may possibly define additional functionality. \nop{ Part [2] is empty. } Part [2] consists of an application class, derived from session, defining how the hush interpreter deals with command-line arguments (a and d) and the initialization that takes place when the main event loop is started (c). To understand (a) and (d) it is enough to know that the hush library provides a hypertext widget and that the -x option treats the next argument as the name of a hypertext file. In section hyper, an example will be given that involves the hypertext widget. In (b) the {\tt hush.tcl} file is declared to be the initialization file. It contains the Tcl code for installing the extensions loaded in (c). In (e), a predefined button {\tt .quit} is packed to the root widget. Part [3] is needed to initialize the application and start the main event loop. } \c{ The hush interpreter defined by the program extends the wish interpreter by loading some extensions to Tcl \nop{discussed in the introduction} and by allowing for the display of a hypertext file. The interpreter accepts any command-line argument accepted by the wish interpreter, in addition to the -x hypertext option. } \nop{ The Tcl interface script given in slide int-script, for example, may be executed using the hush interpreter. }