1 \section{\class{wxCommandProcessor
}}\label{wxcommandprocessor
}
3 wxCommandProcessor is a class that maintains a history of wxCommands,
4 with undo/redo functionality built-in. Derive a new class from this
5 if you want different behaviour.
7 \wxheading{Derived from
}
9 \helpref{wxObject
}{wxobject
}
11 \wxheading{Include files
}
17 \helpref{wxCommandProcessor overview
}{wxcommandprocessoroverview
},
\helpref{wxCommand
}{wxcommand
}
19 \latexignore{\rtfignore{\wxheading{Members
}}}
21 \membersection{wxCommandProcessor::wxCommandProcessor
}
23 \func{}{wxCommandProcessor
}{\param{int
}{ maxCommands = $-
1$
}}
27 {\it maxCommands
} may be set to a positive integer to limit the number of
28 commands stored to it, otherwise (and by default) the list of commands can grow
31 \membersection{wxCommandProcessor::
\destruct{wxCommandProcessor
}}
33 \func{}{\destruct{wxCommandProcessor
}}{\void}
37 \membersection{wxCommandProcessor::CanUndo
}
39 \func{virtual bool
}{CanUndo
}{\void}
41 Returns true if the currently-active command can be undone, false otherwise.
43 \membersection{wxCommandProcessor::ClearCommands
}
45 \func{virtual void
}{ClearCommands
}{\void}
47 Deletes all the commands in the list and sets the current command pointer to NULL.
49 \membersection{wxCommandProcessor::Redo
}
51 \func{virtual bool
}{Redo
}{\void}
53 Executes (redoes) the current command (the command that has just been undone if any).
55 \membersection{wxCommandProcessor::GetCommands
}
57 \constfunc{wxList\&
}{GetCommands
}{\void}
59 Returns the list of commands.
61 \membersection{wxCommandProcessor::GetMaxCommands
}
63 \constfunc{int
}{GetMaxCommands
}{\void}
65 Returns the maximum number of commands that the command processor stores.
67 \membersection{wxCommandProcessor::GetEditMenu
}
69 \constfunc{wxMenu*
}{GetEditMenu
}{\void}
71 Returns the edit menu associated with the command processor.
73 \membersection{wxCommandProcessor::GetRedoAccelerator
}\label{wxcommandprocessorgetredoaccelerator
}
75 \constfunc{const wxString\&
}{GetRedoAccelerator
}{\void}
77 Returns the string that will be appended to the Redo menu item.
79 \membersection{wxCommandProcessor::GetRedoMenuLabel
}\label{wxcommandprocessorgetredomenulabel
}
81 \constfunc{wxString
}{GetRedoMenuLabel
}{\void}
83 Returns the string that will be shown for the redo menu item.
85 \membersection{wxCommandProcessor::GetUndoAccelerator
}\label{wxcommandprocessorgetundoaccelerator
}
87 \constfunc{const wxString\&
}{GetUndoAccelerator
}{\void}
89 Returns the string that will be appended to the Undo menu item.
91 \membersection{wxCommandProcessor::GetUndoMenuLabel
}\label{wxcommandprocessorgetundomenulabel
}
93 \constfunc{wxString
}{GetUndoMenuLabel
}{\void}
95 Returns the string that will be shown for the undo menu item.
97 \membersection{wxCommandProcessor::Initialize
}
99 \func{virtual void
}{Initialize
}{\void}
101 Initializes the command processor, setting the current command to the
102 last in the list (if any), and updating the edit menu (if one has been
105 \membersection{wxCommandProcessor::SetEditMenu
}
107 \func{void
}{SetEditMenu
}{\param{wxMenu*
}{menu
}}
109 Tells the command processor to update the Undo and Redo items on this
110 menu as appropriate. Set this to NULL if the menu is about to be
111 destroyed and command operations may still be performed, or the command
112 processor may try to access an invalid pointer.
114 \membersection{wxCommandProcessor::SetMenuStrings
}
116 \func{void
}{SetMenuStrings
}{\void}
118 Sets the menu labels according to the currently set menu and the current
121 \membersection{wxCommandProcessor::SetRedoAccelerator
}\label{wxcommandprocessorsetredoaccelerator
}
123 \func{void
}{SetRedoAccelerator
}{\param{const wxString\&
}{accel
}}
125 Sets the string that will be appended to the Redo menu item.
127 \membersection{wxCommandProcessor::SetUndoAccelerator
}\label{wxcommandprocessorsetundoaccelerator
}
129 \func{void
}{SetUndoAccelerator
}{\param{const wxString\&
}{accel
}}
131 Sets the string that will be appended to the Undo menu item.
133 \membersection{wxCommandProcessor::Submit
}
135 \func{virtual bool
}{Submit
}{\param{wxCommand *
}{command
},
\param{bool
}{ storeIt = true
}}
137 Submits a new command to the command processor. The command processor
138 calls wxCommand::Do to execute the command; if it succeeds, the command
139 is stored in the history list, and the associated edit menu (if any) updated
140 appropriately. If it fails, the command is deleted
141 immediately. Once Submit has been called, the passed command should not
142 be deleted directly by the application.
144 {\it storeIt
} indicates whether the successful command should be stored
147 \membersection{wxCommandProcessor::Undo
}
149 \func{virtual bool
}{Undo
}{\void}
151 Undoes the command just executed.