A ViewKit Generic Application

Like many application frameworks, the ViewKit library supports the notion of a generic application. A generic application is an application that fully conforms to the requirements of the environment in which it runs, and that lacks only the specific behavior of any given application. A generic application can be viewed as the common subset of all applications supported by a framework. As such, it provides the minimal behavior expected of all applications. It also provides a useful first look at what it is like to write a ViewKit application. The ViewKit generic application can be written as follows:


/////////////////////////////////////////////////////////////
// Simplest possible ViewKit application
/////////////////////////////////////////////////////////////
#include 
#include 

void main ( int argc, char **argv )
{
    VkApp     *app = new VkApp("Generic", &argc, argv);
    VkWindow  *win = new VkWindow("generic");

    win->show();  // Display the window
    app->run();   // Run the application
}

The generic application instantiates an application object (VkApp), and a simple top-level window object (VkWindow). After displaying the window, the application runs. Figure 5 shows how the ViewKit generic application appears on the screen.

Figure 5. The ViewKit generic application.

The ViewKit generic application automatically supports on-line context-sensitive help, has ready-to-use services such as busy cursors and standard dialogs is integrated with the SGI desktop, and includes support for audio. The developer has only to add those elements that are application specific. The ViewKit framework also makes it easy to extend the generic application to meet application-specific needs.

___________________________________________________________________