Using stationery classes

Now that you have a model and a view, you have the minimum requirements for creating a document in the Presentation framework.

The Presentation framework provides a stationery class template that lets you easily construct a document component using your model and view. TGUIModelViewStationeryFor<AModel, AView> creates a document component using the specified model and a default presenter on the specified view.

To create a new document, the framework calls the TGUIModelViewStationeryFor<AModel, AView>::CreateDocument function. To construct the document, the CreateDocument function:

  1. Instantiates the model.
  2. Creates a presenter using TGUIPresenterFor<AView>, the default presenter provided by the Presentation framework. The presenter then instantiates the view.
  3. Creates a TGUIBundle for the document.

In this diagram, note that the only classes you have to implement are TTilesModel and TTilesView (classes you create are indicated by a dot in these diagrams). This is one of the simplest ways to create a Presentation framework program--just plugging in your own data model and content view. The Presentation framework places the view in a resizable window, and builds and displays the standard menu including Document and Edit submenus.

To use the stationery, you need to instantiate the class template into a template class for your model and view classes. This requires a single line of code somewhere within the source code for the Tiles program, declaring a static instance of TGUIModelViewStationeryFor<AModel, AView> based on the TTilesModel and TTilesView classes.

NOTE Recent additions to C++ provide syntax that doesn't require you to declare a static instance for each template instantiation. This syntax will be supported in a later version of the CommonPoint application system.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker