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