# IShAction Struct Reference
[Shell Interfaces]

Interface for basic Actions. All actions should implement these functions. More...

Inheritance diagram for IShAction:

List of all members.

## Public Member Functions
virtual MCCOMErr MCCOMAPI | Do ()=0
virtual MCCOMErr MCCOMAPI | Undo ()=0
virtual MCCOMErr MCCOMAPI | Redo ()=0
virtual boolean MCCOMAPI | WillCauseChange ()=0
virtual boolean MCCOMAPI | CanUndo ()=0
virtual void MCCOMAPI | GetPartToRedraw (IMFPart **outPart, int32 stage)=0
virtual MCCOMErr MCCOMAPI | GetName (TMCString &name)=0
virtual boolean MCCOMAPI | NeedsToPrepareMenus (void)=0

## Detailed Description

Interface for basic Actions. All actions should implement these functions.

## Member Function Documentation

virtual boolean MCCOMAPI IShAction::CanUndo | ( |  | ) | `[pure 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.

Implemented in TBasicAction.

virtual MCCOMErr MCCOMAPI IShAction::Do | ( |  | ) | `[pure 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().

Implemented in TBasicAction.

virtual MCCOMErr MCCOMAPI IShAction::GetName | ( | TMCString & | name | ) | `[pure 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

Implemented in TBasicAction.

virtual void MCCOMAPI IShAction::GetPartToRedraw | ( | IMFPart ** | outPart,
|  | int32 | stage |
| ) |  |  | `[pure 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

Implemented in TBasicAction.

virtual boolean MCCOMAPI IShAction::NeedsToPrepareMenus | ( | void |  | ) | `[pure 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)

Implemented in TBasicAction.

virtual MCCOMErr MCCOMAPI IShAction::Redo | ( |  | ) | `[pure virtual]`

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

Implemented in TBasicAction.

virtual MCCOMErr MCCOMAPI IShAction::Undo | ( |  | ) | `[pure 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.

Implemented in TBasicAction.

virtual boolean MCCOMAPI IShAction::WillCauseChange | ( |  | ) | `[pure virtual]`

Returns:
  true if the action will modify the database.

Implemented in TBasicAction.

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

- IShUtilities.h