| UndoManager By Jeff Martin (jmartin@bozell.com) |
| Inherits From: | Object | |
| Declared In: | UndoManager.h |
| Class Description |
- setRadius:(float)value
{
// Give undoManager the target for this event, then send undo message.
[[undoManager setUndoTarget:self] setRadius:radius];
// Set the new value and return
radius = value; return self;
}
|
| Instance Variables |
| id | undoList; | // The list that holds undo records | |
| id | redoList; | // The list that holds redo records | |
| int | disabled; | // Whether the UndoManager is accepting events | |
| BOOL | undoing; | // Whether the UndoManager is currently undoing | |
| BOOL | redoing; | // Whether the UndoManager is currently redoing | |
| BOOL | recordGrouping; | // Whether UndoRecords are being grouped | |
| int | levelsOfUndo; | // How many levels of undo/redo to record | |
| id | target; | // Current target of registered undo messages |
| id | delegateList; | // List of objects to be notified of UM changes |
| Method Types |
| // Grouping multiple UndoRecords into an undo event - beginUndoRecordGrouping; - endUndoRecordGrouping; |
| // Disable/Reenable UndoManager | to prevent events from being added to undo list | |
| - disableUndoRegistration; | ||
| - reenableUndoRegistration; |
| // Setting the current target for events that are received - setUndoTarget:object; // Setting the target or args of the next registered method to be freed when // Setting the target or args of the next registered method to be freed when // Setting the target or args of the next registered method to be freed when // Make UndoManager copy arguments(like objects or strings) for convenience // Make UndoManager copy arguments and free them when record is discarded // Make UndoManager copy arguments and free them when record is executed // Copies the pointer args in undoRecord as requested by copyArgsMask |
| // Overridden to capture undo/redo | messages to be added to current record |
| - forward:(SEL)aSelector :(marg_list)argFrame;
// Removes a record from the undo/redo list and dispatches the messages in it. // Query and set the maximum length of the undo/redo list |
| // These methods add and remove | objects that are to receive undo notification. | |
| - addUndoDelegate:object; | ||
| - removeUndoDelegate:object; | ||
| - sendNotification:(SEL)action; | ||
| // Used internally to free the space | used for an undo/redo groups and records |
| - discardRecordGroup:recordGroup; - executeRecordGroup:recordGroup; - freeUndoRecord:(UndoRecord *)undoRecord withFreeMask:(int)mask; // Remove and Free all records currently stored in the UndoManager |
| Instance Methods |
| - | beginUndoRecordGrouping, - endUndoRecordGrouping |
| - | disableUndoRegistration, - reenableUndoRegistration |
| - | setUndoTarget:object |
| - freeUndoTarget, - freeUndoArgs, - freeUndoArgAt:(int)pos |
| - freeUndoTargetOnRecordDiscard, - freeUndoArgsOnRecordDiscard, - freeUndoArgOnRecordDiscardAt:(int)pos |
| - freeUndoTargetOnRecordExecute, - freeUndoArgsOnRecordExecute, - freeUndoArgOnRecordExecuteAt:(int)pos |
| - | copyUndoArgs, - copyUndoArgsAt:(int)pos |
| - | copyUndoArgsForRecord:(UndoRecord *)undoRecord |
| - forward:(SEL)aSelector :(marg_list)argFrame |
| - | undo:sender |
| - redo |
| - (int)levelsOfUndo, - setLevelsOfUndo:(int)value |
| - | addUndoDelegate:object, - removeUndoDelegate:object |
| - | discardRecordGroup:recordGroup; | |
| - | executeRecordGroup:recordGroup; |
| - freeUndoRecord:(UndoRecord *)undoRecord; |
| - | emptyUndoManager |
| - free |
Written by: Jeff Martin (jmartin@bozell.com)
You may freely copy, distribute and reuse the code in this example.
Don't even talk to me about warranties.