]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/cmdproc.tex
define _HPUX_SOURCE under HP-UX, otherwise many things are not defined in standard...
[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
f260c476 21
f510b7b2 22\membersection{wxCommandProcessor::wxCommandProcessor}\label{wxcommandprocessorctor}
a660d684 23
84023968 24\func{}{wxCommandProcessor}{\param{int}{ maxCommands = $-1$}}
a660d684
KB
25
26Constructor.
27
84023968
VZ
28{\it maxCommands} may be set to a positive integer to limit the number of
29commands stored to it, otherwise (and by default) the list of commands can grow
30arbitrarily.
a660d684 31
f260c476 32
f510b7b2 33\membersection{wxCommandProcessor::\destruct{wxCommandProcessor}}\label{wxcommandprocessordtor}
a660d684
KB
34
35\func{}{\destruct{wxCommandProcessor}}{\void}
36
37Destructor.
38
f260c476 39
f510b7b2 40\membersection{wxCommandProcessor::CanUndo}\label{wxcommandprocessorcanundo}
a660d684
KB
41
42\func{virtual bool}{CanUndo}{\void}
43
cc81d32f 44Returns true if the currently-active command can be undone, false otherwise.
a660d684 45
f260c476 46
f510b7b2 47\membersection{wxCommandProcessor::ClearCommands}\label{wxcommandprocessorclearcommands}
a660d684
KB
48
49\func{virtual void}{ClearCommands}{\void}
50
51Deletes all the commands in the list and sets the current command pointer to NULL.
52
f260c476 53
f510b7b2 54\membersection{wxCommandProcessor::Redo}\label{wxcommandprocessorredo}
a660d684 55
fc9a9b2a 56\func{virtual bool}{Redo}{\void}
a660d684
KB
57
58Executes (redoes) the current command (the command that has just been undone if any).
59
f260c476 60
f510b7b2 61\membersection{wxCommandProcessor::GetCommands}\label{wxcommandprocessorgetcommands}
a660d684
KB
62
63\constfunc{wxList\&}{GetCommands}{\void}
64
65Returns the list of commands.
66
f260c476 67
f510b7b2 68\membersection{wxCommandProcessor::GetMaxCommands}\label{wxcommandprocessorgetmaxcommands}
a660d684
KB
69
70\constfunc{int}{GetMaxCommands}{\void}
71
72Returns the maximum number of commands that the command processor stores.
73
f260c476 74
f510b7b2 75\membersection{wxCommandProcessor::GetEditMenu}\label{wxcommandprocessorgeteditmenu}
a660d684
KB
76
77\constfunc{wxMenu*}{GetEditMenu}{\void}
78
79Returns the edit menu associated with the command processor.
80
f260c476 81
5e0e6ceb
JS
82\membersection{wxCommandProcessor::GetRedoAccelerator}\label{wxcommandprocessorgetredoaccelerator}
83
84\constfunc{const wxString\&}{GetRedoAccelerator}{\void}
85
86Returns the string that will be appended to the Redo menu item.
87
f260c476 88
d863ed83
JS
89\membersection{wxCommandProcessor::GetRedoMenuLabel}\label{wxcommandprocessorgetredomenulabel}
90
91\constfunc{wxString}{GetRedoMenuLabel}{\void}
92
93Returns the string that will be shown for the redo menu item.
94
f260c476 95
5e0e6ceb
JS
96\membersection{wxCommandProcessor::GetUndoAccelerator}\label{wxcommandprocessorgetundoaccelerator}
97
98\constfunc{const wxString\&}{GetUndoAccelerator}{\void}
99
100Returns the string that will be appended to the Undo menu item.
101
f260c476 102
d863ed83
JS
103\membersection{wxCommandProcessor::GetUndoMenuLabel}\label{wxcommandprocessorgetundomenulabel}
104
105\constfunc{wxString}{GetUndoMenuLabel}{\void}
106
107Returns the string that will be shown for the undo menu item.
108
f260c476 109
f510b7b2 110\membersection{wxCommandProcessor::Initialize}\label{wxcommandprocessorinitialize}
a660d684
KB
111
112\func{virtual void}{Initialize}{\void}
113
114Initializes the command processor, setting the current command to the
115last in the list (if any), and updating the edit menu (if one has been
116specified).
117
f260c476
VZ
118
119\membersection{wxCommandProcessor::IsDirty}\label{wxcommandprocessorisdirty}
120
121\func{virtual bool}{IsDirty}{\void}
122
123Returns a boolean value that indicates if changes have been made since
124the last save operation. This only works if
125\helpref{wxCommandProcessor::MarkAsSaved}{wxcommandprocessormarkassaved}
126is called whenever the project is saved.
127
128
129\membersection{wxCommandProcessor::MarkAsSaved}\label{wxcommandprocessormarkassaved}
130
131\func{virtual void}{MarkAsSaved}{\void}
132
133You must call this method whenever the project is saved if you plan to use
134\helpref{wxCommandProcessor::IsDirty}{wxcommandprocessorisdirty}.
135
136
f510b7b2 137\membersection{wxCommandProcessor::SetEditMenu}\label{wxcommandprocessorseteditmenu}
a660d684
KB
138
139\func{void}{SetEditMenu}{\param{wxMenu* }{menu}}
140
141Tells the command processor to update the Undo and Redo items on this
142menu as appropriate. Set this to NULL if the menu is about to be
143destroyed and command operations may still be performed, or the command
144processor may try to access an invalid pointer.
145
f260c476 146
f510b7b2 147\membersection{wxCommandProcessor::SetMenuStrings}\label{wxcommandprocessorsetmenustrings}
d863ed83
JS
148
149\func{void}{SetMenuStrings}{\void}
150
151Sets the menu labels according to the currently set menu and the current
152command state.
153
f260c476 154
5e0e6ceb
JS
155\membersection{wxCommandProcessor::SetRedoAccelerator}\label{wxcommandprocessorsetredoaccelerator}
156
157\func{void}{SetRedoAccelerator}{\param{const wxString\&}{accel}}
158
159Sets the string that will be appended to the Redo menu item.
160
f260c476 161
5e0e6ceb
JS
162\membersection{wxCommandProcessor::SetUndoAccelerator}\label{wxcommandprocessorsetundoaccelerator}
163
164\func{void}{SetUndoAccelerator}{\param{const wxString\&}{accel}}
165
166Sets the string that will be appended to the Undo menu item.
167
f260c476 168
f510b7b2 169\membersection{wxCommandProcessor::Submit}\label{wxcommandprocessorsubmit}
a660d684 170
cc81d32f 171\func{virtual bool}{Submit}{\param{wxCommand *}{command}, \param{bool}{ storeIt = true}}
a660d684
KB
172
173Submits a new command to the command processor. The command processor
174calls wxCommand::Do to execute the command; if it succeeds, the command
175is stored in the history list, and the associated edit menu (if any) updated
176appropriately. If it fails, the command is deleted
177immediately. Once Submit has been called, the passed command should not
178be deleted directly by the application.
179
180{\it storeIt} indicates whether the successful command should be stored
181in the history list.
182
f260c476 183
f510b7b2 184\membersection{wxCommandProcessor::Undo}\label{wxcommandprocessorundo}
a660d684
KB
185
186\func{virtual bool}{Undo}{\void}
187
188Undoes the command just executed.
189
190