git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18805 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
		
			
				
	
	
		
			154 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			TeX
		
	
	
	
	
	
			
		
		
	
	
			154 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			TeX
		
	
	
	
	
	
\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}
 | 
						|
 | 
						|
\wxheading{Include files}
 | 
						|
 | 
						|
<wx/cmdproc.h>
 | 
						|
 | 
						|
\wxheading{See also}
 | 
						|
 | 
						|
\helpref{wxCommandProcessor overview}{wxcommandprocessoroverview}, \helpref{wxCommand}{wxcommand}
 | 
						|
 | 
						|
\latexignore{\rtfignore{\wxheading{Members}}}
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::wxCommandProcessor}
 | 
						|
 | 
						|
\func{}{wxCommandProcessor}{\param{int}{ maxCommands = $-1$}}
 | 
						|
 | 
						|
Constructor.
 | 
						|
 | 
						|
{\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.
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::\destruct{wxCommandProcessor}}
 | 
						|
 | 
						|
\func{}{\destruct{wxCommandProcessor}}{\void}
 | 
						|
 | 
						|
Destructor.
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::CanUndo}
 | 
						|
 | 
						|
\func{virtual bool}{CanUndo}{\void}
 | 
						|
 | 
						|
Returns true if the currently-active command can be undone, false otherwise.
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::ClearCommands}
 | 
						|
 | 
						|
\func{virtual void}{ClearCommands}{\void}
 | 
						|
 | 
						|
Deletes all the commands in the list and sets the current command pointer to NULL.
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::Redo}
 | 
						|
 | 
						|
\func{virtual bool}{Redo}{\void}
 | 
						|
 | 
						|
Executes (redoes) the current command (the command that has just been undone if any).
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::GetCommands}
 | 
						|
 | 
						|
\constfunc{wxList\&}{GetCommands}{\void}
 | 
						|
 | 
						|
Returns the list of commands.
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::GetMaxCommands}
 | 
						|
 | 
						|
\constfunc{int}{GetMaxCommands}{\void}
 | 
						|
 | 
						|
Returns the maximum number of commands that the command processor stores.
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::GetEditMenu}
 | 
						|
 | 
						|
\constfunc{wxMenu*}{GetEditMenu}{\void}
 | 
						|
 | 
						|
Returns the edit menu associated with the command processor.
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::GetRedoAccelerator}\label{wxcommandprocessorgetredoaccelerator}
 | 
						|
 | 
						|
\constfunc{const wxString\&}{GetRedoAccelerator}{\void}
 | 
						|
 | 
						|
Returns the string that will be appended to the Redo menu item.
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::GetRedoMenuLabel}\label{wxcommandprocessorgetredomenulabel}
 | 
						|
 | 
						|
\constfunc{wxString}{GetRedoMenuLabel}{\void}
 | 
						|
 | 
						|
Returns the string that will be shown for the redo menu item.
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::GetUndoAccelerator}\label{wxcommandprocessorgetundoaccelerator}
 | 
						|
 | 
						|
\constfunc{const wxString\&}{GetUndoAccelerator}{\void}
 | 
						|
 | 
						|
Returns the string that will be appended to the Undo menu item.
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::GetUndoMenuLabel}\label{wxcommandprocessorgetundomenulabel}
 | 
						|
 | 
						|
\constfunc{wxString}{GetUndoMenuLabel}{\void}
 | 
						|
 | 
						|
Returns the string that will be shown for the undo menu item.
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::Initialize}
 | 
						|
 | 
						|
\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).
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::SetEditMenu}
 | 
						|
 | 
						|
\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.
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::SetMenuStrings}
 | 
						|
 | 
						|
\func{void}{SetMenuStrings}{\void}
 | 
						|
 | 
						|
Sets the menu labels according to the currently set menu and the current
 | 
						|
command state.
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::SetRedoAccelerator}\label{wxcommandprocessorsetredoaccelerator}
 | 
						|
 | 
						|
\func{void}{SetRedoAccelerator}{\param{const wxString\&}{accel}}
 | 
						|
 | 
						|
Sets the string that will be appended to the Redo menu item.
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::SetUndoAccelerator}\label{wxcommandprocessorsetundoaccelerator}
 | 
						|
 | 
						|
\func{void}{SetUndoAccelerator}{\param{const wxString\&}{accel}}
 | 
						|
 | 
						|
Sets the string that will be appended to the Undo menu item.
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::Submit}
 | 
						|
 | 
						|
\func{virtual bool}{Submit}{\param{wxCommand *}{command}, \param{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.
 | 
						|
 | 
						|
{\it storeIt} indicates whether the successful command should be stored
 | 
						|
in the history list.
 | 
						|
 | 
						|
\membersection{wxCommandProcessor::Undo}
 | 
						|
 | 
						|
\func{virtual bool}{Undo}{\void}
 | 
						|
 | 
						|
Undoes the command just executed.
 | 
						|
 | 
						|
 |