






Cursor tool support
Although a canvas view can respond to mouse input directly, TCanvasView is designed primarily to respond to higher-level interaction from cursor tools. A cursor tool provides direct manipulation and interactive feedback. The current cursor tool is set any time by calling TTool::SetCurrentTool, which is a static function in the TTool class.
static void TTool::SetCurrentTool( const TTool& );
Whenever the mouse is used over a canvas view, the canvas view delegates mouse event handling to the Cursor Tools framework, which determines when a tool is bound to the device that produced the event and when the tool can begin interaction with the event. The Cursor Tools framework calls a tool handler identified by the application to create either a tool target or a tool interactor. TCanvasView is able to identify itself as the application tool handler because it derives from a mix of TContentView and MToolHandler. TCanvasView implements the following MToolHandler functions:
virtual MToolTarget* CreateToolTarget( const TTypeDescriptions&, const TGPoint& );
virtual TToolInteractor* CreateToolInteractor( const TGPoint&, const TToken& hint );
virtual Boolean SupportsFeedback() const;
virtual void AdoptFeedbackGraphic( MGRaphic* adopt, const TGArea& total,
const TGarea& changed );
virtual MGraphic* OrphanFeedbackGraphic( Boolean repair );
TCanvasView does not implement the following MToolHandler functions, which must be implemented in all TCanvasView derived classes, such as TStandardCanvasView.
virtual void AdoptAndDo( TToolCommandBinding* ) = 0;
virtual void DoBegin*( TToolCommandBinding& ) = 0;
virtual void DoIncrement( TToolCommandBinding& ) = 0;
virtual void AdoptAndDoEnd( TToolCommandBinding* ) = 0;
[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