Using GUI bundles

A GUI bundle is an object that provides context for a particular document. TGUIBundle is a Presentation framework convenience class that makes it easier to keep track of all the associated elements of a document component. An object that actively participates in the presentation of a document can own a single TGUIBundle instead of owning references to all its associated objects.

For example, in the Tiles program, TTilesView accesses the correct model reference by using a GUI bundle--the view owns a TGUIBundle instead of owning a reference to the model. When the framework creates an instance of TTilesView, it passes it an instance of TGUIBundle that binds the view to the model. The view's GetModelReference function, inherited from MGUIBundle, calls the GetModelReference function on the view's TGUIBundle, which returns a reference to the associated TTilesModel.

Objects that use the TGUIBundle mechanism can either mix in the class MGUIBundle, or store their own TGUIBundle and access it directly. TTilesView mixes in MGUIBundle by deriving from TDocumentComponentView, which derives from TContentView and mixes in MGUIBundle. MGUIBundle handles storing the associated TGUIBundle and provides a set of functions to access the model reference and other information in the TGUIBundle. See the online class description of TGUIBundle for a complete list of the items that can be stored by this class.


You'll learn more about TGUIBundle as additional features are added to the Tiles program. For now, you need to know that the TDocumentComponentView class (and therefore the TTilesView class) must receive a TGUIBundle in its constructor, which it passes to its MGUIBundle base class. All classes derived from TDocumentComponentView have this requirement.


[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