NSUndoManager

NSUndoManager Mac OS X 10.0

This class provides the basis of Cocoa's undo and redo system. NSUndoManager supports two kinds of undo: simple undo and invocation-based undo. In simple undo clients register in the undo manager a target and selector that is used to undo the last operation. In invocation based undo the client creates an NSInvocation object that can undo the last operation and record that in the undo manager. In either case, it is the responsibility of the client to specify how the an operation is undone; NSUndoManager simply provides the machinery for keeping track of and executing the supplied selectors or invocations.

figs/cocn_13113.gif

@interface NSUndoManager : NSObject
 // Accessor Methods
   - (void)setActionName:(NSString *)actionName;
   - (void)setGroupsByEvent:(BOOL)groupsByEvent;
   - (BOOL)groupsByEvent;
   - (void)setRunLoopModes:(NSArray *)runLoopModes;
   - (NSArray *)runLoopModes;
   - (void)setLevelsOfUndo:(unsigned)levels;
   - (unsigned)levelsOfUndo;
 // Instance Methods
   - (void)beginUndoGrouping;
   - (BOOL)canRedo;
   - (BOOL)canUndo;
   - (void)disableUndoRegistration;
   - (void)enableUndoRegistration;
   - (void)endUndoGrouping;
   - (void)forwardInvocation:(NSInvocation *)anInvocation;
   - (int)groupingLevel;
   - (BOOL)isRedoing;
   - (BOOL)isUndoRegistrationEnabled;
   - (BOOL)isUndoing;
   - (id)prepareWithInvocationTarget:(id)target;
   - (void)redo;
   - (NSString *)redoActionName;
   - (NSString *)redoMenuItemTitle;
   - (NSString *)redoMenuTitleForUndoActionName:(NSString *)actionName;
   - (void)registerUndoWithTarget:(id)target selector:(SEL)selector object:(id)anObject;
   - (void)removeAllActions;
   - (void)removeAllActionsWithTarget:(id)target;
   - (void)undo;
   - (NSString *)undoActionName;
   - (NSString *)undoMenuItemTitle;
   - (NSString *)undoMenuTitleForUndoActionName:(NSString *)actionName;
   - (void)undoNestedGroup;



    Part II: API Quick Reference
    Chapter 13. Foundation Classes