Class TUndoStack

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TUndoStack = class(TList)

Description

TUndoStack is used to manage the TUndoItems.

TUndoStack allows commands to be undone and then redone when they are encapsulated as TUndoItems.

Hierarchy

Overview

Fields

Private FMaxItems: integer;
Private FUndoToolButton: TToolButton;
Private FRedoToolButton: TToolButton;
Private FUndoEvent: TNotifyEvent;
Private FReDoEvent: TNotifyEvent;
Protected CurrentUndo: integer;

Methods

Private procedure HiddenProcExcept;
Private procedure SetMaxItems(AMaxItems: integer);
Private function GetCurrentItem: TUndoItem;
Private function GetCurrentRedoItem: TUndoItem;
Private function CanUndo: boolean;
Private function CanRedo: boolean;
Private procedure UndoClick(Sender: TObject);
Private procedure RedoClick(Sender: TObject);
Private procedure UpdateButtons;
Public constructor Create(AMaxItems: integer);
Public procedure Clear; override;
Public procedure DeleteAndFree(Item: integer);
Public function Submit(Item: TUndoItem): TStackStatus;
Public procedure Undo(Num: integer);
Public procedure Redo(Num: integer);
Public procedure RemoveLastItem;
Public procedure SetUndoActions(const UndoAction, RedoAction: TAction);
Public procedure SetUndoMenuItems(const UndoItem, RedoItem: TMenuItem);
Public procedure SetUndoToolButtons(const Undo, Redo: TToolButton);
Public procedure Delete(Index: Integer);
Public function Add(Item: Pointer): Integer;
Public procedure Insert(Index: Integer; const S: string);
Public procedure Move(CurIndex, NewIndex: Integer);
Public procedure Exchange(Index1, Index2: Integer);

Properties

Public property MaxItems: integer read FMaxItems write SetMaxItems;
Public property CurrentItem: TUndoItem read GetCurrentItem;
Public property CurrentRedoItem: TUndoItem read GetCurrentRedoItem;
Public property UndoToolButton: TToolButton read FUndoToolButton write FUndoToolButton;
Public property RedoToolButton: TToolButton read FRedoToolButton write FRedoToolButton;
Public property UndoEvent : TNotifyEvent read FUndoEvent;
Public property ReDoEvent : TNotifyEvent read FReDoEvent;

Description

Fields

Private FMaxItems: integer;

FMaxItems: integer; See MaxItems.

Private FUndoToolButton: TToolButton;
 
Private FRedoToolButton: TToolButton;
 
Private FUndoEvent: TNotifyEvent;
 
Private FReDoEvent: TNotifyEvent;
 
Protected CurrentUndo: integer;

CurrentUndo: integer; CurrentUndo is the position in the stack to undo or redo.

Methods

Private procedure HiddenProcExcept;

HiddenProcExcept raises an exception.

Private procedure SetMaxItems(AMaxItems: integer);

See MaxItems.

Private function GetCurrentItem: TUndoItem;

GetCurrentItem is the item to undo.

Private function GetCurrentRedoItem: TUndoItem;

GetCurrentRedoItem is the item to redo.

Private function CanUndo: boolean;

CanUndo returns true if it is possible to undo the last action.

Private function CanRedo: boolean;

CanRedo returns true if it is possible to redo an action.

Private procedure UndoClick(Sender: TObject);

UndoClick shows a hint for the next undo.

Private procedure RedoClick(Sender: TObject);

RedoClick shows a hint for the next redo.

Private procedure UpdateButtons;
 
Public constructor Create(AMaxItems: integer);

Create creates an instance of TUndoStack and sets MaxItems.

Public procedure Clear; override;

Clear removes all TUndoItems from the TUndoStack

Public procedure DeleteAndFree(Item: integer);

DeleteAndFree deletes and frees the TUndoItems at Item from TUndoStack.

Public function Submit(Item: TUndoItem): TStackStatus;

Submit adds a TUndoItems to the TUndoStack.

Public procedure Undo(Num: integer);

Undo undoes Num TUndoItems in the TUndoStack.

Public procedure Redo(Num: integer);

Redo redoes Num TUndoItems in the TUndoStack.

Public procedure RemoveLastItem;

RemoveLastItem removes the last TUndoItemfrom the TUndoStack.

Public procedure SetUndoActions(const UndoAction, RedoAction: TAction);

Set the properties of the TActions used for undoing and redoing things.

Public procedure SetUndoMenuItems(const UndoItem, RedoItem: TMenuItem);

Set the properties of the TMenuItems used for undoing and redoing things.

Public procedure SetUndoToolButtons(const Undo, Redo: TToolButton);

Set the properties of the TToolButtons used for undoing and redoing things.

Public procedure Delete(Index: Integer);

Delete raises an exception.

Public function Add(Item: Pointer): Integer;

Add raises an exception.

Public procedure Insert(Index: Integer; const S: string);

Insert raises an exception.

Public procedure Move(CurIndex, NewIndex: Integer);

Move raises an exception.

Public procedure Exchange(Index1, Index2: Integer);

Exchange raises an exception.

Properties

Public property MaxItems: integer read FMaxItems write SetMaxItems;

MaxItems is the maximum number of items allowed in the TUndoStack.

Public property CurrentItem: TUndoItem read GetCurrentItem;

CurrentItem is the current TUndoItem for undoing something.

Public property CurrentRedoItem: TUndoItem read GetCurrentRedoItem;

CurrentRedoItem is the current TUndoItem for redoing something.

Public property UndoToolButton: TToolButton read FUndoToolButton write FUndoToolButton;
 
Public property RedoToolButton: TToolButton read FRedoToolButton write FRedoToolButton;
 
Public property UndoEvent : TNotifyEvent read FUndoEvent;
 
Public property ReDoEvent : TNotifyEvent read FReDoEvent;
 

Generated by PasDoc 0.12.1 on 2013-05-13 15:42:06