# TBasicMouseAction Class Reference
[Base Classes for plugins]

Inheritance diagram for TBasicMouseAction:

List of all members.

## Public Member Functions
virtual MCErr MCCOMAPI | QueryInterface (const MCIID &riid, void **ppvObj)
virtual uint32 MCCOMAPI | AddRef ()
virtual uint32 MCCOMAPI | Release ()=0
virtual MCCOMErr MCCOMAPI | Do ()
virtual MCCOMErr MCCOMAPI | Undo ()
virtual MCCOMErr MCCOMAPI | Redo ()
virtual boolean MCCOMAPI | WillCauseChange ()
virtual boolean MCCOMAPI | CanUndo ()
virtual MCCOMErr MCCOMAPI | GetName (TMCString &name)
virtual void MCCOMAPI | Track (IMCGraphicContext *gc, int16 stage, TMCPoint &first, TMCPoint &prev, TMCPoint &cur, boolean moved, IShMouseAction **nextAction)
virtual void MCCOMAPI | TrackEx (IMCGraphicContext *gc, int16 stage, const TMFTabletMouseSample &first, const TMFTabletMouseSample &prev, const TMFTabletMouseSample &cur, boolean moved, IShMouseAction **nextAction)
virtual MCCOMErr MCCOMAPI | Feedback (IMCGraphicContext *gc, int16 stage, const TMCPoint &first, const TMCPoint &prev, const TMCPoint &cur, boolean moved, boolean show)
virtual void MCCOMAPI | GetPartToRedraw (IMFPart **outPart, int32 stage)
virtual MCCOMErr MCCOMAPI | Constrain (IMCGraphicContext *gc, int16 stage, const TMCPoint &first, const TMCPoint &prev, TMCPoint &cur, boolean moved)
virtual boolean MCCOMAPI | NeedsToPrepareMenus (void)
virtual boolean MCCOMAPI | ConstrainedToView (void)
virtual boolean MCCOMAPI | IsPerpetualMouseAction (void)
virtual boolean MCCOMAPI | ShouldHideCursor (void)
virtual boolean MCCOMAPI | ShouldAutoScroll (void)
virtual boolean MCCOMAPI | KeepTracking ()
virtual boolean MCCOMAPI | WantsTabletTracking ()

## Detailed Description

Basic Mouse Action class. Derive from this for a default implementation of an IShMouseAction

See also:
  IShMouseAction

## Member Function Documentation

virtual uint32 MCCOMAPI TBasicMouseAction::AddRef | ( |  | ) | `[inline, virtual]`

Increments the reference count of the object

Reimplemented from TBasicUnknown.

virtual boolean MCCOMAPI TBasicMouseAction::CanUndo | ( |  | ) | `[virtual]`

Returns true if the action is undoable. If CanUndo() returns false, Undo() and Redo() should return MC_E_NOTIMPL and do nothing.

Returns:
  true if the action is undoable.

Implements IShMouseAction.

virtual MCCOMErr MCCOMAPI TBasicMouseAction::Constrain | ( | IMCGraphicContext * | gc,
|  | int16 | stage,
|  | const TMCPoint & | first,
|  | const TMCPoint & | prev,
|  | TMCPoint & | cur,
|  | boolean | moved |
| ) |  |  | `[virtual]`

Use this method to constrain the 'cur' position to a value, before Track() is called

Parameters:

  | gc | Graphic context for the mouse action
  | stage | kShBeginTracking, kShContinueTracking, or kShEndTracking. Tells the function what stage of tracking we're in.
  | first | Initial mouse position when this action started tracking
  | prev | Previous mouse position from the previous call of Track()
  | cur | Current mouse position - also returns constrained current mouse position
  | moved | Pass true here if the mouse has moved since the last call to Track()

Implements IShMouseAction.

virtual boolean MCCOMAPI TBasicMouseAction::ConstrainedToView | ( | void |  | ) | `[virtual]`

Returns:
  true if the action should be constrained to the view. If so, the cursor locations outside of the view will be clamped to the view's limits.

Implements IShMouseAction.

virtual MCCOMErr MCCOMAPI TBasicMouseAction::Do | ( |  | ) | `[virtual]`

Function called to actually perform the action.

Note:
  As the constructor of the action is not protected by the exception mechanism, no memory allocations (ie 'pointer = new ...') should be used there. Only initializations (like 'pointer = NULL;') should be made in the constructor. The allocations should be made here in Do().

Implements IShMouseAction.

virtual MCCOMErr MCCOMAPI TBasicMouseAction::Feedback | ( | IMCGraphicContext * | gc,
|  | int16 | stage,
|  | const TMCPoint & | first,
|  | const TMCPoint & | prev,
|  | const TMCPoint & | cur,
|  | boolean | moved,
|  | boolean | show |
| ) |  |  | `[virtual]`

Allows the action to draw things related to the tracking. Feedback() is called for the first time right before the first call of Track(kShBeginTracking), and then Feedback() is called right after each call to Track().

Parameters:

  | gc | Graphic context for the mouse action
  | stage | kShBeginTracking, kShContinueTracking, or kShEndTracking. Tells the function what stage of tracking we're in.
  | first | Initial mouse position when this action started tracking
  | prev | Previous mouse position from the previous call of Track()
  | cur | Current mouse position
  | moved | Pass true here if the mouse has moved since the last call to Track()
  | show | Pass false here to bypass any drawing, or true to enable drawing.

Implements IShMouseAction.

virtual MCCOMErr MCCOMAPI TBasicMouseAction::GetName | ( | TMCString & | name | ) | `[virtual]`

Return the name to display in the undo/redo list.

Note:
  Do not use hardcoded strings inside the code, use strings from resources instead.

Parameters:

  | name | The name of the action

Implements IShMouseAction.

virtual void MCCOMAPI TBasicMouseAction::GetPartToRedraw | ( | IMFPart ** | outPart,
|  | int32 | stage |
| ) |  |  | `[virtual]`

Gives the action the opportunity to tell the Shell that the returned part should be redrawn after Do/Undo/Redo. Return NULL in outPart if no redraw is needed.

Parameters:

  | outPart | Returns a pointer to the part that needs to be redrawn after the action runs.
  | stage | Allows you to specify what stage to query for part redraw. kShDoAction, kShUndoAction, kShRedoAction

Implements IShMouseAction.

virtual boolean MCCOMAPI TBasicMouseAction::IsPerpetualMouseAction | ( | void |  | ) | `[virtual]`

Returns:
  true if the action wants infinite mouse movement

Implements IShMouseAction.

virtual boolean MCCOMAPI TBasicMouseAction::KeepTracking | ( |  | ) | `[virtual]`

Returns false if you do not want the mouse action to perform any tracking. This is useful if you just want to do something on the click.

Returns:
  false if the mouse action should stop tracking

Implements IShMouseAction.

virtual boolean MCCOMAPI TBasicMouseAction::NeedsToPrepareMenus | ( | void |  | ) | `[virtual]`

Returns:
  true if execution of the action (Do() or Undo() or Redo()) should cause the menus to be prepared (ie if contents of the menus need to be enabled/disabled)

Implements IShMouseAction.

virtual MCErr MCCOMAPI TBasicMouseAction::QueryInterface | ( | const MCIID & | riid,
|  | void ** | ppvObj |
| ) |  |  | `[virtual]`

Check if the object supports a given interface and returns a pointer to that interface if it does. Note that QueryInterface will increment the reference count of the object by one if the interface is found.

Parameters:

  | riid | GUID of the interface
  | ppvObj | A pointer to the pointer being returned.

Reimplemented from TBasicUnknown.

virtual MCCOMErr MCCOMAPI TBasicMouseAction::Redo | ( |  | ) | `[virtual]`

Called to Redo the action. This can often simply call Do().

Implements IShMouseAction.

virtual uint32 MCCOMAPI TBasicMouseAction::Release | ( |  | ) | `[pure virtual]`

Decrements the reference count of the object. If the reference count reaches zero, the object is destroyed.

Implements IMCUnknown.

virtual boolean MCCOMAPI TBasicMouseAction::ShouldAutoScroll | ( | void |  | ) | `[virtual]`

Returns:
  true if the mouse should autoscroll in a scoll part

Implements IShMouseAction.

virtual boolean MCCOMAPI TBasicMouseAction::ShouldHideCursor | ( | void |  | ) | `[virtual]`

Returns:
  true if the action wants to hide the cursor

Implements IShMouseAction.

virtual void MCCOMAPI TBasicMouseAction::Track | ( | IMCGraphicContext * | gc,
|  | int16 | stage,
|  | TMCPoint & | first,
|  | TMCPoint & | prev,
|  | TMCPoint & | cur,
|  | boolean | moved,
|  | IShMouseAction ** | nextAction |
| ) |  |  | `[virtual]`

Called each time the mouse moves. At least, Track() is called three times (even if the mouse does not move).

Note:
  The nextAction parameter must return 'this' to continue the current action, or a pointer to a new action, or NULL if the tracking should stop and the Action be discarded.
  The TMCPoint arguments are input values, but they can also be used as output values. This is useful to force the initial position of the mouse to be in the middle of a handle. Constraints on the 'cur' position should be handled in Constrain().

Parameters:

  | gc | Graphic context for the mouse action
  | stage | kShBeginTracking, kShContinueTracking, or kShEndTracking. Tells the function what stage of tracking we're in.
  | first | Initial mouse position when this action started tracking
  | prev | Previous mouse position from the previous call of Track()
  | cur | Current mouse position
  | moved | Pass true here if the mouse has moved since the last call to Track()
  | nextAction | Returns a pointer to the next action whose Track() to call. See note in function description.

Implements IShMouseAction.

Reimplemented in TSimpleMouseAction.

virtual void MCCOMAPI TBasicMouseAction::TrackEx | ( | IMCGraphicContext * | gc,
|  | int16 | stage,
|  | const TMFTabletMouseSample & | first,
|  | const TMFTabletMouseSample & | prev,
|  | const TMFTabletMouseSample & | cur,
|  | boolean | moved,
|  | IShMouseAction ** | nextAction |
| ) |  |  | `[virtual]`

Called each time the mouse moves when the mouse action is in tablet mode. At least, TrackEx() is called three times (even if the mouse does not move).

Note:
  The nextAction parameter must return 'this' to continue the current action, or a pointer to a new action, or NULL if the tracking should stop and the Action be discarded.

Parameters:

  | gc | Graphic context for the mouse action
  | stage | kShBeginTracking, kShContinueTracking, or kShEndTracking. Tells the function what stage of tracking we're in.
  | first | Initial mouse position when this action started tracking
  | prev | Previous mouse position from the previous call of Track()
  | cur | Current mouse position
  | moved | Pass true here if the mouse has moved since the last call to Track()
  | nextAction | Returns a pointer to the next action whose Track() to call. See note in function description.

Implements IShMouseAction.

virtual MCCOMErr MCCOMAPI TBasicMouseAction::Undo | ( |  | ) | `[virtual]`

Called to undo the action.

Note:
  When undone, an action must restore the database to EXACTLY the same state it was in before Do() was called. This means that if a pointer is cloned, the action must store the original pointer in Do() and apply its modifications to the clone. Then, when Undo() is called, the action simply replaces the cloned and modified pointer with the original, unmodified one.

Implements IShMouseAction.

virtual boolean MCCOMAPI TBasicMouseAction::WantsTabletTracking | ( |  | ) | `[virtual]`

Returns true if the mouse action wants to use the tablet tracking.

Implements IShMouseAction.

virtual boolean MCCOMAPI TBasicMouseAction::WillCauseChange | ( |  | ) | `[virtual]`

Returns:
  true if the action will modify the database.

Implements IShMouseAction.

The documentation for this class was generated from the following file:

- BasicMCFCOMImplementations.h