Loading...
Searching...
No Matches
juce::UndoableAction Class Referenceabstract

## Detailed Description

Used by the UndoManager class to store an action which can be done and undone.

See also
  UndoManager

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

- juce_data_structures/undomanager/juce_UndoableAction.h

## Public Member Functions

virtual | ~UndoableAction ()=default
| Destructor.
virtual bool | perform ()=0
| Overridden by a subclass to perform the action.
virtual bool | undo ()=0
| Overridden by a subclass to undo the action.
virtual int | getSizeInUnits ()
| Returns a value to indicate how much memory this object takes up.
virtual UndoableAction * | createCoalescedAction (UndoableAction *nextAction)
| Allows multiple actions to be coalesced into a single action object, to reduce storage space.

## Protected Member Functions

| UndoableAction ()=default
| Creates an action.

## Constructors and Destructors

## UndoableAction()

juce::UndoableAction::UndoableAction | ( |  | ) |

protected default

Creates an action.

Referenced by createCoalescedAction().

## ~UndoableAction()

virtual juce::UndoableAction::~UndoableAction | ( |  | ) |

virtual default

Destructor.

## Member Functions

## perform()

virtual bool juce::UndoableAction::perform | ( |  | ) |

pure virtual

Overridden by a subclass to perform the action.

This method is called by the UndoManager, and shouldn't be used directly by applications.

Be careful not to make any calls in a perform() method that could call recursively back into the UndoManager::perform() method

Returns
  true if the action could be performed.

See also
  UndoManager::perform

## undo()

virtual bool juce::UndoableAction::undo | ( |  | ) |

pure virtual

Overridden by a subclass to undo the action.

This method is called by the UndoManager, and shouldn't be used directly by applications.

Be careful not to make any calls in an undo() method that could call recursively back into the UndoManager::perform() method

Returns
  true if the action could be undone without any errors.

See also
  UndoManager::perform

## getSizeInUnits()

virtual int juce::UndoableAction::getSizeInUnits | ( |  | ) |

inline virtual

Returns a value to indicate how much memory this object takes up.

Because the UndoManager keeps a list of UndoableActions, this is used to work out how much space each one will take up, so that the UndoManager can work out how many to keep.

The default value returned here is 10 - units are arbitrary and don't have to be accurate.

See also
  UndoManager::getNumberOfUnitsTakenUpByStoredCommands, UndoManager::setMaxNumberOfStoredUnits

## createCoalescedAction()

virtual UndoableAction * juce::UndoableAction::createCoalescedAction | ( | UndoableAction * | nextAction | ) |

virtual

Allows multiple actions to be coalesced into a single action object, to reduce storage space.

If possible, this method should create and return a single action that does the same job as this one followed by the supplied action.

If it's not possible to merge the two actions, the method should return a nullptr.

References UndoableAction().

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited