| Methods Index |
Subclass: None
CMouseManager is to provide management capabilities for CMouseHandlers.
CMouseManager is used to propagate mouse events to its CMouseHandlers. Events are propagated to all CMouseHandlers in the order in which they are registered with the manager.
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.The most direct usage of
CMouseManager is from within a CWindow object. Each CWindow automatically creates a CMouseManager and delegates each of its DoMouse*() methods to the appropriate CMouseManager interfaces. This allows you to register mouse handlers with a window without having to create a manager directly:
CWindow* aWindow = ...;
CMouseHandler* aHandler = ...; ... aWindow->GetMouseManager()->
RegisterMouseHandler(aHandler);
MouseManagers can be chained in a hierarchy, in effect allowing a manager to inherit the handlers of "parent" managers. For instance, the managers created for each CWindow are normally chained with the manager of the application's TaskWindow. This has the effect of making all handlers attached to the TaskWindow available globally to all windows in the application. For more information, see the SetParent() method.
Protected Data Members
RWGSlist(CMouseHandler)
itsMouseHandlers;
List of registered handlers
CMouseManager*
itsParent
Used to chain managers
Overrides
You may override the manager's Mouse*() methods to define different ways of delegating events to registered handlers.
Public Methods
Constructor, Destructor, and Initializer Methods
CMouseManager(CMouseManager* the Parent = NULL);
CMouseManager for chaining purposes. When managers are chained, events are propagated to the parent manager before being handled by the current manager.
CMouseManager(const CMouseManager& theMouseManager);
theMouseManager by registering the same mouse handlers with the newly constructed instance.
CMouseManager& operator=(const CMouseManager& theMouseManager);
theMouseManager by registering the same mouse handlers with the manager.
virtual ~CMouseManager();
void RegisterMouseHandler(
CMouseHandler *theMouseHandler,
BOOLEAN isInFront =FALSE);
isInFront is TRUE, the handler is added in front of other handlers, making it receive mouse events before the other handlers. Otherwise, the handler is appended to the end of the existing handler list. The handler is not consumed: it is up to you to delete it when you are done using it.
void UnRegisterMouseHandler(CMouseHandler *theMouseHandler);
virtual BOOLEAN DoDown(
const CWindow *theWindow,
CPoint& theLocation,
short& theButton,
BOOLEAN& isShiftKey,
BOOLEAN& isControlKey); virtual BOOLEAN DoUp(
const CWindow *theWindow,
CPoint& theLocation,
short& theButton,
BOOLEAN& isShiftKey,
BOOLEAN& isControlKey); virtual BOOLEAN DoDouble(
const CWindow *theWindow,
CPoint& theLocation,
short& theButton,
BOOLEAN& isShiftKey,
BOOLEAN& isControlKey); virtual BOOLEAN DoMove(
const CWindow *theWindow,
CPoint& theLocation,
short& theButton,
BOOLEAN& isShiftKey,
BOOLEAN& isControlKey); virtual BOOLEAN DoScroll(
const CWindow *theWindow,
CPoint& theLocation,
short& theButton,
BOOLEAN& isShiftKey,
BOOLEAN& isControlKey,
XVT_INT32& theScrollX,
XVT_INT32& theScrollY);
theLocation to be relative to theWindow. Note that the methods take references to the event parameters, allowing each handler to modify the event if necessary. (For an example, see the CSnapHandler sample in the Samples directory.) The methods delegate events to all handlers, regardless of whether the handlers consume the events or not. Upon completion, the methods returns TRUE if one or more of the handlers have consumed the event. You may use these methods to define different ways of delegating events to registered handlers.
CMouseManager* GetParent(void) const; void SetParent(CMouseManager* theParent);
CMouseManager for chaining purposes. When managers are chained, events are propagated to the parent manager before being handled by the current manager.