TStandardCanvasModel introduces functions to get any of five model interests that it defines. These interests represent events that occur in association with the model.
TModelInterest GetGraphicsAddedInterest() const;
TModelInterest GetGraphicsRemovedInterest() const;
TModelInterest GetGraphicsChangedInterest() const;
TModelInterest GetDrasticChangeInsterest() const;
TModelInterest GetEmbeddedGraphicAddedInterest() const;
Instances that need to know when these events occur register interest in receiving notifications associated with these interests. Instances that cause these events to occur send notifications associated with these interests. Both types of instances call the standard canvas model for the interest to use. The TModelInterest return values not only represent their respective events, but also the model called to create the interest. Therefore, the return values can be used to broadcast and detect notifications relating to specific events occurring in specific models in the document.
To send a notification, an instance creates a TNotification or TNotification derived class from the model interest returned and calls the NotifyOfChange function that TStandardCanvasModel derives from TModel.
virtual void NotifyOfChange( const TNotification& );
Although any instance can broadcast a change notification, the selection typically does this in its TStandardCanvasModelSelection::Invalidate implementation. Commands can also broadcast a notification because they have access to the model by way of the selection. However, a command must dynamically cast the model from MCanvasRepresentation to TStandardCanvasModel. The model can also broadcast notification. Standard GrafEdit broadcasts notification from the selection only, but you might find some of these other techniques more applicable.
Canvas views are the primary instances to register interest in the events. See "Canvas views" on page 118 for more information. The canvas typically responds to notifications by invalidating a corresponding area that needs to be updated.
[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