1998-05-20 10:25:30 -04:00
|
|
|
\section{\class{wxCommandProcessor}}\label{wxcommandprocessor}
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
|
1999-02-15 15:41:29 -05:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
2002-02-02 08:21:40 -05:00
|
|
|
<wx/cmdproc.h>
|
1999-02-15 15:41:29 -05:00
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxCommandProcessor overview}{wxcommandprocessoroverview}, \helpref{wxCommand}{wxcommand}
|
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
2004-10-04 11:13:52 -04:00
|
|
|
\membersection{wxCommandProcessor::wxCommandProcessor}\label{wxcommandprocessorctor}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2002-12-10 09:09:38 -05:00
|
|
|
\func{}{wxCommandProcessor}{\param{int}{ maxCommands = $-1$}}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
Constructor.
|
|
|
|
|
2002-12-10 09:09:38 -05:00
|
|
|
{\it 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.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
2004-10-04 11:13:52 -04:00
|
|
|
\membersection{wxCommandProcessor::\destruct{wxCommandProcessor}}\label{wxcommandprocessordtor}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{}{\destruct{wxCommandProcessor}}{\void}
|
|
|
|
|
|
|
|
Destructor.
|
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
2004-10-04 11:13:52 -04:00
|
|
|
\membersection{wxCommandProcessor::CanUndo}\label{wxcommandprocessorcanundo}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{virtual bool}{CanUndo}{\void}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Returns true if the currently-active command can be undone, false otherwise.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
2004-10-04 11:13:52 -04:00
|
|
|
\membersection{wxCommandProcessor::ClearCommands}\label{wxcommandprocessorclearcommands}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{virtual void}{ClearCommands}{\void}
|
|
|
|
|
2006-02-13 10:18:35 -05:00
|
|
|
Deletes all commands in the list and sets the current command pointer to \NULL.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
2004-10-04 11:13:52 -04:00
|
|
|
\membersection{wxCommandProcessor::Redo}\label{wxcommandprocessorredo}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2002-12-20 06:15:05 -05:00
|
|
|
\func{virtual bool}{Redo}{\void}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
Executes (redoes) the current command (the command that has just been undone if any).
|
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
2004-10-04 11:13:52 -04:00
|
|
|
\membersection{wxCommandProcessor::GetCommands}\label{wxcommandprocessorgetcommands}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\constfunc{wxList\&}{GetCommands}{\void}
|
|
|
|
|
|
|
|
Returns the list of commands.
|
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
2004-10-04 11:13:52 -04:00
|
|
|
\membersection{wxCommandProcessor::GetMaxCommands}\label{wxcommandprocessorgetmaxcommands}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\constfunc{int}{GetMaxCommands}{\void}
|
|
|
|
|
|
|
|
Returns the maximum number of commands that the command processor stores.
|
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
2004-10-04 11:13:52 -04:00
|
|
|
\membersection{wxCommandProcessor::GetEditMenu}\label{wxcommandprocessorgeteditmenu}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\constfunc{wxMenu*}{GetEditMenu}{\void}
|
|
|
|
|
|
|
|
Returns the edit menu associated with the command processor.
|
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
2000-12-03 13:25:13 -05:00
|
|
|
\membersection{wxCommandProcessor::GetRedoAccelerator}\label{wxcommandprocessorgetredoaccelerator}
|
|
|
|
|
|
|
|
\constfunc{const wxString\&}{GetRedoAccelerator}{\void}
|
|
|
|
|
|
|
|
Returns the string that will be appended to the Redo menu item.
|
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
2002-12-20 05:15:06 -05:00
|
|
|
\membersection{wxCommandProcessor::GetRedoMenuLabel}\label{wxcommandprocessorgetredomenulabel}
|
|
|
|
|
|
|
|
\constfunc{wxString}{GetRedoMenuLabel}{\void}
|
|
|
|
|
|
|
|
Returns the string that will be shown for the redo menu item.
|
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
2000-12-03 13:25:13 -05:00
|
|
|
\membersection{wxCommandProcessor::GetUndoAccelerator}\label{wxcommandprocessorgetundoaccelerator}
|
|
|
|
|
|
|
|
\constfunc{const wxString\&}{GetUndoAccelerator}{\void}
|
|
|
|
|
|
|
|
Returns the string that will be appended to the Undo menu item.
|
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
2002-12-20 05:15:06 -05:00
|
|
|
\membersection{wxCommandProcessor::GetUndoMenuLabel}\label{wxcommandprocessorgetundomenulabel}
|
|
|
|
|
|
|
|
\constfunc{wxString}{GetUndoMenuLabel}{\void}
|
|
|
|
|
|
|
|
Returns the string that will be shown for the undo menu item.
|
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
2004-10-04 11:13:52 -04:00
|
|
|
\membersection{wxCommandProcessor::Initialize}\label{wxcommandprocessorinitialize}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{virtual void}{Initialize}{\void}
|
|
|
|
|
|
|
|
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).
|
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
|
|
|
\membersection{wxCommandProcessor::IsDirty}\label{wxcommandprocessorisdirty}
|
|
|
|
|
|
|
|
\func{virtual bool}{IsDirty}{\void}
|
|
|
|
|
|
|
|
Returns a boolean value that indicates if changes have been made since
|
|
|
|
the last save operation. This only works if
|
|
|
|
\helpref{wxCommandProcessor::MarkAsSaved}{wxcommandprocessormarkassaved}
|
|
|
|
is called whenever the project is saved.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxCommandProcessor::MarkAsSaved}\label{wxcommandprocessormarkassaved}
|
|
|
|
|
|
|
|
\func{virtual void}{MarkAsSaved}{\void}
|
|
|
|
|
|
|
|
You must call this method whenever the project is saved if you plan to use
|
|
|
|
\helpref{wxCommandProcessor::IsDirty}{wxcommandprocessorisdirty}.
|
|
|
|
|
|
|
|
|
2004-10-04 11:13:52 -04:00
|
|
|
\membersection{wxCommandProcessor::SetEditMenu}\label{wxcommandprocessorseteditmenu}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{void}{SetEditMenu}{\param{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.
|
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
2004-10-04 11:13:52 -04:00
|
|
|
\membersection{wxCommandProcessor::SetMenuStrings}\label{wxcommandprocessorsetmenustrings}
|
2002-12-20 05:15:06 -05:00
|
|
|
|
|
|
|
\func{void}{SetMenuStrings}{\void}
|
|
|
|
|
|
|
|
Sets the menu labels according to the currently set menu and the current
|
|
|
|
command state.
|
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
2000-12-03 13:25:13 -05:00
|
|
|
\membersection{wxCommandProcessor::SetRedoAccelerator}\label{wxcommandprocessorsetredoaccelerator}
|
|
|
|
|
|
|
|
\func{void}{SetRedoAccelerator}{\param{const wxString\&}{accel}}
|
|
|
|
|
|
|
|
Sets the string that will be appended to the Redo menu item.
|
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
2000-12-03 13:25:13 -05:00
|
|
|
\membersection{wxCommandProcessor::SetUndoAccelerator}\label{wxcommandprocessorsetundoaccelerator}
|
|
|
|
|
|
|
|
\func{void}{SetUndoAccelerator}{\param{const wxString\&}{accel}}
|
|
|
|
|
|
|
|
Sets the string that will be appended to the Undo menu item.
|
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
2004-10-04 11:13:52 -04:00
|
|
|
\membersection{wxCommandProcessor::Submit}\label{wxcommandprocessorsubmit}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
\func{virtual bool}{Submit}{\param{wxCommand *}{command}, \param{bool}{ storeIt = true}}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
{\it storeIt} indicates whether the successful command should be stored
|
|
|
|
in the history list.
|
|
|
|
|
2005-02-19 11:52:08 -05:00
|
|
|
|
2004-10-04 11:13:52 -04:00
|
|
|
\membersection{wxCommandProcessor::Undo}\label{wxcommandprocessorundo}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{virtual bool}{Undo}{\void}
|
|
|
|
|
|
|
|
Undoes the command just executed.
|
|
|
|
|
|
|
|
|