Because GrafEdit programs are often built on top of a variety of underlying data sets, it is important to have the flexibility to decide which events are interesting and need to be connected to which types of view invalidation. For this purpose, the following functions are defined in TCanvasView:
void TCanvasView::ConnectNotification
( TRequestBasedMemberFunctionConnectionTo aCanvasView ); void TCanvasView::RegisterNotificationInterest
(TRequestBasedMemberFunctionConnectionTo aCanvasView); void TCanvasView::DisconnectNotification
( TRequestBasedMemberFunctionConnectionTo aCanvasView ); void TCanvasView::HandleUnknownNotification( const TNotification aNotification );
RegisterNotificationInterest is overridden to register interest and to define the associated functions to call. This function has a connection parameter. An implementation of this function should call AddInterest on this connection and pass it a TInterest instance that represents a type of event. Thereafter, any notifications associated with that interest will be received.
An optional function can be passed to AddInterest to identify which function to call for notifications associated with the interest. In this case, the identified function, which must be implemented in the canvas view derived class, is called whenever a notification for that interest is received. If the member function is not provided, then HandleUnknownNotification is called and should be implemented.