$szTitle = "wxcommandprocessor"; include "./_header.inc"; ?>
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.
derived from
include files
<wx/cmdproc.h>
see also
wxcommandprocessor overview, wxcommand
members
wxcommandprocessor::wxcommandprocessor
wxcommandprocessor::~wxcommandprocessor
wxcommandprocessor::canundo
wxcommandprocessor::clearcommands
wxcommandprocessor::redo
wxcommandprocessor::getcommands
wxcommandprocessor::getmaxcommands
wxcommandprocessor::geteditmenu
wxcommandprocessor::getredoaccelerator
wxcommandprocessor::getredomenulabel
wxcommandprocessor::getundoaccelerator
wxcommandprocessor::getundomenulabel
wxcommandprocessor::initialize
wxcommandprocessor::isdirty
wxcommandprocessor::markassaved
wxcommandprocessor::seteditmenu
wxcommandprocessor::setmenustrings
wxcommandprocessor::setredoaccelerator
wxcommandprocessor::setundoaccelerator
wxcommandprocessor::submit
wxcommandprocessor::undo
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.
~wxcommandprocessor()
destructor.
virtual bool canundo()
returns true if the currently-active command can be undone, false otherwise.
virtual void clearcommands()
deletes all commands in the list and sets the current command pointer to null.
virtual bool redo()
executes (redoes) the current command (the command that has just been undone if any).
wxlist& getcommands() const
returns the list of commands.
int getmaxcommands() const
returns the maximum number of commands that the command processor stores.
wxmenu* geteditmenu() const
returns the edit menu associated with the command processor.
const wxstring& getredoaccelerator() const
returns the string that will be appended to the redo menu item.
wxstring getredomenulabel() const
returns the string that will be shown for the redo menu item.
const wxstring& getundoaccelerator() const
returns the string that will be appended to the undo menu item.
wxstring getundomenulabel() const
returns the string that will be shown for the undo menu item.
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).
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.
virtual void markassaved()
you must call this method whenever the project is saved if you plan to use wxcommandprocessor::isdirty.
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.
void setmenustrings()
sets the menu labels according to the currently set menu and the current command state.
void setredoaccelerator(const wxstring&accel)
sets the string that will be appended to the redo menu item.
void setundoaccelerator(const wxstring&accel)
sets the string that will be appended to the undo menu item.
virtual 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.
virtual bool undo()
undoes the command just executed.
include "./_footer.inc"; ?>