# TBasicAction Class Reference
[Base Classes for plugins]

Inheritance diagram for TBasicAction:

List of all members.

## Public Member Functions
virtual MCErr MCCOMAPI | QueryInterface (const MCIID &riid, void **ppvObj)
virtual uint32 MCCOMAPI | AddRef ()
virtual MCCOMErr MCCOMAPI | Do ()
virtual MCCOMErr MCCOMAPI | Undo ()
virtual MCCOMErr MCCOMAPI | Redo ()
virtual boolean MCCOMAPI | WillCauseChange ()
virtual boolean MCCOMAPI | CanUndo ()
virtual void MCCOMAPI | GetPartToRedraw (IMFPart **outPart, int32 stage)
virtual MCCOMErr MCCOMAPI | GetName (TMCString &name)
virtual boolean MCCOMAPI | NeedsToPrepareMenus (void)

## Detailed Description

Basic Action class. Derive from this for a default implementation of IShAction

See also:
  IShAction

## Member Function Documentation

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

Increments the reference count of the object

Reimplemented from TBasicUnknown.

virtual boolean MCCOMAPI TBasicAction::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 IShAction.

virtual MCCOMErr MCCOMAPI TBasicAction::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 IShAction.

virtual MCCOMErr MCCOMAPI TBasicAction::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 IShAction.

virtual void MCCOMAPI TBasicAction::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 IShAction.

virtual boolean MCCOMAPI TBasicAction::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 IShAction.

virtual MCErr MCCOMAPI TBasicAction::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 TBasicAction::Redo | ( |  | ) | `[virtual]`

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

Implements IShAction.

virtual MCCOMErr MCCOMAPI TBasicAction::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 IShAction.

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

Returns:
  true if the action will modify the database.

Implements IShAction.

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

- BasicMCFCOMImplementations.h