| Methods Index |
Subclasses:
CDragSource
CMouseHandler is to provide a generic interface for mouse behavior clients.
CMouseHandler is an abstract class and must be used through a subclass. Derived class instances should be registered with a mouse manager which delegates mouse events for the handler to process.
CMouseManager and CMouseHandler have a many-to-many association: a manager can manage zero or more handlers, and a handler can be registered with zero or more managers.
DoDown, DoUp, DoMove, DoDouble, and DoScroll are called on mouse down, up, move, double-click, and scroll events, respectively. These functions return TRUE if they have consumed the event (it no longer needs processing by the object which owns the mouse manager), FALSE if the event has not been consumed (it needs further processing by the object that owns the mouse manager). Note that the default CMouseManager behavior allows all registered mouse handlers an opportunity to consume events (i.e., events can be consumed by more than one handler).When a
CMouseHandler is deleted, it automatically removes itself from any CMouseManagers is it registered with.
|
|
|
|
friend class
|
CMouseManager
| |
|
|
|
|
RWGSlist
|
itsMouseManagers;
| List of managers where handler is registered |
CMouseHandler& operator=(const CMouseHandler& theMouseHandler);
virtual ~CMouseHandler();
virtual BOOLEAN DoDown(
CPoint& theLocation,
short& theButton,
BOOLEAN& isShiftKey,
BOOLEAN& isControlKey) = 0; virtual BOOLEAN DoUp(
CPoint& theLocation,
short& theButton,
BOOLEAN& isShiftKey,
BOOLEAN& isControlKey) = 0; virtual BOOLEAN DoDouble(
CPoint& theLocation,
short& theButton,
BOOLEAN& isShiftKey,
BOOLEAN& isControlKey) = 0; virtual BOOLEAN DoMove(
CPoint& theLocation,
short& theButton,
BOOLEAN& isShiftKey,
BOOLEAN& isControlKey) = 0; virtual BOOLEAN DoScroll(
CPoint& theLocation,
short& theButton,
BOOLEAN& isShiftKey,
BOOLEAN& isControlKey,
XVT_INT32& theScrollX,
XVT_INT32& theScrollY);
theLocation, which may be in coordinates relative to the Task Window or relative to the window receiving the events. See UsesGlobalCoords() below for more information about this. Note that the methods take references to the event parameters, allowing each handler to modify the event if necessary. (For an example, see the sample code for CSnapHandler in the samples directory.) The methods should return TRUE to indicate that the event was consumed and should not be passed on to the window. Otherwise, the handler can simply take some action and return FALSE to allow normal window processing to take place as well.
virtual BOOLEAN UsesGlobalCoords(void) = 0;
TRUE, then CMouseManager delegates mouse events by calling CMouseHandler Do*() methods, passing along mouse positions in global, Task Window relative coordinates. Otherwise, if this methods returns FALSE, mouse positions are supplied in coordinates relative to the window receiving the mouse event.