]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/cmdproc.tex
Faster Deselect
[wxWidgets.git] / docs / latex / wx / cmdproc.tex
CommitLineData
a660d684
KB
1\section{\class{wxCommandProcessor}}\label{wxcommandprocessor}
2
3wxCommandProcessor is a class that maintains a history of wxCommands,
4with undo/redo functionality built-in. Derive a new class from this
5if you want different behaviour.
6
7\wxheading{Derived from}
8
9\helpref{wxObject}{wxobject}
10
954b8ae6
JS
11\wxheading{Include files}
12
d6263458 13<wx/cmdproc.h>
954b8ae6 14
a660d684
KB
15\wxheading{See also}
16
17\helpref{wxCommandProcessor overview}{wxcommandprocessoroverview}, \helpref{wxCommand}{wxcommand}
18
19\latexignore{\rtfignore{\wxheading{Members}}}
20
f510b7b2 21\membersection{wxCommandProcessor::wxCommandProcessor}\label{wxcommandprocessorctor}
a660d684 22
84023968 23\func{}{wxCommandProcessor}{\param{int}{ maxCommands = $-1$}}
a660d684
KB
24
25Constructor.
26
84023968
VZ
27{\it maxCommands} may be set to a positive integer to limit the number of
28commands stored to it, otherwise (and by default) the list of commands can grow
29arbitrarily.
a660d684 30
f510b7b2 31\membersection{wxCommandProcessor::\destruct{wxCommandProcessor}}\label{wxcommandprocessordtor}
a660d684
KB
32
33\func{}{\destruct{wxCommandProcessor}}{\void}
34
35Destructor.
36
f510b7b2 37\membersection{wxCommandProcessor::CanUndo}\label{wxcommandprocessorcanundo}
a660d684
KB
38
39\func{virtual bool}{CanUndo}{\void}
40
cc81d32f 41Returns true if the currently-active command can be undone, false otherwise.
a660d684 42
f510b7b2 43\membersection{wxCommandProcessor::ClearCommands}\label{wxcommandprocessorclearcommands}
a660d684
KB
44
45\func{virtual void}{ClearCommands}{\void}
46
47Deletes all the commands in the list and sets the current command pointer to NULL.
48
f510b7b2 49\membersection{wxCommandProcessor::Redo}\label{wxcommandprocessorredo}
a660d684 50
fc9a9b2a 51\func{virtual bool}{Redo}{\void}
a660d684
KB
52
53Executes (redoes) the current command (the command that has just been undone if any).
54
f510b7b2 55\membersection{wxCommandProcessor::GetCommands}\label{wxcommandprocessorgetcommands}
a660d684
KB
56
57\constfunc{wxList\&}{GetCommands}{\void}
58
59Returns the list of commands.
60
f510b7b2 61\membersection{wxCommandProcessor::GetMaxCommands}\label{wxcommandprocessorgetmaxcommands}
a660d684
KB
62
63\constfunc{int}{GetMaxCommands}{\void}
64
65Returns the maximum number of commands that the command processor stores.
66
f510b7b2 67\membersection{wxCommandProcessor::GetEditMenu}\label{wxcommandprocessorgeteditmenu}
a660d684
KB
68
69\constfunc{wxMenu*}{GetEditMenu}{\void}
70
71Returns the edit menu associated with the command processor.
72
5e0e6ceb
JS
73\membersection{wxCommandProcessor::GetRedoAccelerator}\label{wxcommandprocessorgetredoaccelerator}
74
75\constfunc{const wxString\&}{GetRedoAccelerator}{\void}
76
77Returns the string that will be appended to the Redo menu item.
78
d863ed83
JS
79\membersection{wxCommandProcessor::GetRedoMenuLabel}\label{wxcommandprocessorgetredomenulabel}
80
81\constfunc{wxString}{GetRedoMenuLabel}{\void}
82
83Returns the string that will be shown for the redo menu item.
84
5e0e6ceb
JS
85\membersection{wxCommandProcessor::GetUndoAccelerator}\label{wxcommandprocessorgetundoaccelerator}
86
87\constfunc{const wxString\&}{GetUndoAccelerator}{\void}
88
89Returns the string that will be appended to the Undo menu item.
90
d863ed83
JS
91\membersection{wxCommandProcessor::GetUndoMenuLabel}\label{wxcommandprocessorgetundomenulabel}
92
93\constfunc{wxString}{GetUndoMenuLabel}{\void}
94
95Returns the string that will be shown for the undo menu item.
96
f510b7b2 97\membersection{wxCommandProcessor::Initialize}\label{wxcommandprocessorinitialize}
a660d684
KB
98
99\func{virtual void}{Initialize}{\void}
100
101Initializes the command processor, setting the current command to the
102last in the list (if any), and updating the edit menu (if one has been
103specified).
104
f510b7b2 105\membersection{wxCommandProcessor::SetEditMenu}\label{wxcommandprocessorseteditmenu}
a660d684
KB
106
107\func{void}{SetEditMenu}{\param{wxMenu* }{menu}}
108
109Tells the command processor to update the Undo and Redo items on this
110menu as appropriate. Set this to NULL if the menu is about to be
111destroyed and command operations may still be performed, or the command
112processor may try to access an invalid pointer.
113
f510b7b2 114\membersection{wxCommandProcessor::SetMenuStrings}\label{wxcommandprocessorsetmenustrings}
d863ed83
JS
115
116\func{void}{SetMenuStrings}{\void}
117
118Sets the menu labels according to the currently set menu and the current
119command state.
120
5e0e6ceb
JS
121\membersection{wxCommandProcessor::SetRedoAccelerator}\label{wxcommandprocessorsetredoaccelerator}
122
123\func{void}{SetRedoAccelerator}{\param{const wxString\&}{accel}}
124
125Sets the string that will be appended to the Redo menu item.
126
127\membersection{wxCommandProcessor::SetUndoAccelerator}\label{wxcommandprocessorsetundoaccelerator}
128
129\func{void}{SetUndoAccelerator}{\param{const wxString\&}{accel}}
130
131Sets the string that will be appended to the Undo menu item.
132
f510b7b2 133\membersection{wxCommandProcessor::Submit}\label{wxcommandprocessorsubmit}
a660d684 134
cc81d32f 135\func{virtual bool}{Submit}{\param{wxCommand *}{command}, \param{bool}{ storeIt = true}}
a660d684
KB
136
137Submits a new command to the command processor. The command processor
138calls wxCommand::Do to execute the command; if it succeeds, the command
139is stored in the history list, and the associated edit menu (if any) updated
140appropriately. If it fails, the command is deleted
141immediately. Once Submit has been called, the passed command should not
142be deleted directly by the application.
143
144{\it storeIt} indicates whether the successful command should be stored
145in the history list.
146
f510b7b2 147\membersection{wxCommandProcessor::Undo}\label{wxcommandprocessorundo}
a660d684
KB
148
149\func{virtual bool}{Undo}{\void}
150
151Undoes the command just executed.
152
153