wxcommandprocessorwxcommandprocessor 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. derived from include files <wx/cmdproc.h> see also wxcommandprocessor overview, wxcommand members
wxcommandprocessor::wxcommandprocessor
wxcommandprocessor::wxcommandprocessorwxcommandprocessor(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.
wxcommandprocessor::~wxcommandprocessor~wxcommandprocessor() destructor.
wxcommandprocessor::canundovirtual bool canundo() returns true if the currently-active command can be undone, false otherwise.
wxcommandprocessor::clearcommandsvirtual void clearcommands() deletes all commands in the list and sets the current command pointer to null.
wxcommandprocessor::redovirtual bool redo() executes (redoes) the current command (the command that has just been undone if any).
wxcommandprocessor::getcommandswxlist& getcommands() const returns the list of commands.
wxcommandprocessor::getmaxcommandsint getmaxcommands() const returns the maximum number of commands that the command processor stores.
wxcommandprocessor::geteditmenuwxmenu* geteditmenu() const returns the edit menu associated with the command processor.
wxcommandprocessor::getredoacceleratorconst wxstring& getredoaccelerator() const returns the string that will be appended to the redo menu item.
wxcommandprocessor::getredomenulabelwxstring getredomenulabel() const returns the string that will be shown for the redo menu item.
wxcommandprocessor::getundoacceleratorconst wxstring& getundoaccelerator() const returns the string that will be appended to the undo menu item.
wxcommandprocessor::getundomenulabelwxstring getundomenulabel() const returns the string that will be shown for the undo menu item.
wxcommandprocessor::initializevirtual 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).
wxcommandprocessor::isdirtyvirtual 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.
wxcommandprocessor::markassavedvirtual void markassaved() you must call this method whenever the project is saved if you plan to use wxcommandprocessor::isdirty.
wxcommandprocessor::seteditmenuvoid 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.
wxcommandprocessor::setmenustringsvoid setmenustrings() sets the menu labels according to the currently set menu and the current command state.
wxcommandprocessor::setredoacceleratorvoid setredoaccelerator(const wxstring&accel) sets the string that will be appended to the redo menu item.
wxcommandprocessor::setundoacceleratorvoid setundoaccelerator(const wxstring&accel) sets the string that will be appended to the undo menu item.
wxcommandprocessor::submitvirtual bool submit(wxcommand *command, bool 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.
wxcommandprocessor::undovirtual bool undo() undoes the command just executed.
|