// $Revision: 1.2 $ // Copyright (C) 1994, 1995 Taligent, Inc. All rights reserved. #ifndef TaligentSample_TILESINTERACTORS #define TaligentSample_TILESINTERACTORS #ifndef TaligentSample_TILESCOMMANDS #include "TilesCommands.h" #endif #ifndef TaligentSample_TILESVIEW #include "TilesView.h" #endif // TMoveInteractor is an interactive mouse event handler. Once the user clicks // on a TTile in the window, the TMoveInteractor will track mouse events, create // a TMoveCommand and apply the command incrementally to the TTile. In this way // the interactive mouse actions are bound to the TMoveCommand. TMoveInteractor // mixes in TInteractor to handle interactive events and MMouseEventHandler to // receive mouse events. class TMoveInteractor : public TInteractor, public MMouseEventHandler { public: // The constructor takes a pointer to the view in which the mouse down // event occured and in which the TMoveInteractor should operate. TMoveInteractor (TTilesView *view); TMoveInteractor (); virtual ~TMoveInteractor (); // The following macro must be called within class declarations in order to use Taligent // Type Extensions.The macro defines a set of Taligent Type Extension utility functions. // This macro call matches a macro call to TaligentTypeExtensionMacro in TilesInteractors.C TaligentTypeExtensionDeclarationsMacro(TMoveInteractor) // MouseDown starts the interactive mouse event handling virtual bool MouseDown (TMouseDownEvent& mouseDown); // MouseMoved applies the TMoveCommand incrementally to the current selection virtual bool MouseMoved (TMouseMovedEvent& mouseMoved); // MouseUp finishes the interactive mouse event handling virtual bool MouseUp (TMouseUpEvent& mouseDown); // MouseEntered and MouseExited are used to detect when the user has // left or reentered the view while dragging the mouse. virtual bool MouseEntered (TMouseMovedEvent& mouseEnter); virtual bool MouseExited (TMouseMovedEvent& mouseExit); protected: // A cleanup routine in case an exception is thrown virtual void HandleException (); private: // The view in which the TMoveInteractor will operate TTilesView* fView; // To keep track of the TMoveCommand incremental command and its target, // which is the current selection TTilesCommandBinding* fCommandBinding; // The location of the orginal mouse down event, used to calculate the // move delta. TGPoint fOrigin; }; #endif // TaligentSample_TILESINTERACTORS