.\" This is a wxWidgets manpage page generated from the XML docs .TH wxCommandProcessor 3wx 2005-02-15 "wxWidgets" "wxWidgets class documentation" .SH NAME wxCommandProcessor \- .SH DESCRIPTION wxCommandProcessor is a class that maintains a history of wxCommands, with undo/redo functionality built-in. Derive a new class from this if you want different behaviour. .SH "PARENTS" wxObject .SH "INCLUDE FILES" wx/cmdproc.h .SH MEMBERS .SS wxCommandProcessor (int maxCommands = -1) Constructor. maxCommands may be set to a positive integer to limit the number of commands stored to it, otherwise (and by default) the list of commands can grow arbitrarily. .SS ~wxCommandProcessor () Destructor. .SS virtual bool CanUndo () Returns true if the currently-active command can be undone, false otherwise. .SS virtual void ClearCommands () Deletes all the commands in the list and sets the current command pointer to NULL. .SS virtual bool Redo () Executes (redoes) the current command (the command that has just been undone if any). .SS wxList& GetCommands () Returns the list of commands. .SS int GetMaxCommands () Returns the maximum number of commands that the command processor stores. .SS wxMenu* GetEditMenu () Returns the edit menu associated with the command processor. .SS const wxString& GetRedoAccelerator () Returns the string that will be appended to the Redo menu item. .SS wxString GetRedoMenuLabel () Returns the string that will be shown for the redo menu item. .SS const wxString& GetUndoAccelerator () Returns the string that will be appended to the Undo menu item. .SS wxString GetUndoMenuLabel () Returns the string that will be shown for the undo menu item. .SS virtual void Initialize () Initializes the command processor, setting the current command to the last in the list (if any), and updating the edit menu (if one has been specified). .SS virtual bool IsDirty () Returns a boolean value that indicates if changes have been made since the last save operation. This only works if wxCommandProcessor::MarkAsSaved is called whenever the project is saved. .SS virtual void MarkAsSaved () You must call this method whenever the project is saved if you plan to use wxCommandProcessor::IsDirty . .SS void SetEditMenu (wxMenu* menu) Tells the command processor to update the Undo and Redo items on this menu as appropriate. Set this to NULL if the menu is about to be destroyed and command operations may still be performed, or the command processor may try to access an invalid pointer. .SS void SetMenuStrings () Sets the menu labels according to the currently set menu and the current command state. .SS void SetRedoAccelerator (const wxString&accel) Sets the string that will be appended to the Redo menu item. .SS void SetUndoAccelerator (const wxString&accel) Sets the string that will be appended to the Undo menu item. .SS virtual bool Submit (wxCommand *commandbool storeIt = true) Submits a new command to the command processor. The command processor calls wxCommand::Do to execute the command; if it succeeds, the command is stored in the history list, and the associated edit menu (if any) updated appropriately. If it fails, the command is deleted immediately. Once Submit has been called, the passed command should not be deleted directly by the application. storeIt indicates whether the successful command should be stored in the history list. .SS virtual bool Undo () Undoes the command just executed. .SH "SEE ALSO" wxObject wxCommandProcessor overview wxCommand .SH "AUTHORS" Documentation content by Julian Smart, Robert Roebling, Vadim Zeitlin, Robin Dunn, et al Conversion to manpage format by Arnout Engelen (http://bzzt.net), bugreports welcome.