]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/cmdproc.tex
rebaked after animation control and helpbest.h changes
[wxWidgets.git] / docs / latex / wx / cmdproc.tex
... / ...
CommitLineData
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
11\wxheading{Include files}
12
13<wx/cmdproc.h>
14
15\wxheading{See also}
16
17\helpref{wxCommandProcessor overview}{wxcommandprocessoroverview}, \helpref{wxCommand}{wxcommand}
18
19\latexignore{\rtfignore{\wxheading{Members}}}
20
21
22\membersection{wxCommandProcessor::wxCommandProcessor}\label{wxcommandprocessorctor}
23
24\func{}{wxCommandProcessor}{\param{int}{ maxCommands = $-1$}}
25
26Constructor.
27
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.
31
32
33\membersection{wxCommandProcessor::\destruct{wxCommandProcessor}}\label{wxcommandprocessordtor}
34
35\func{}{\destruct{wxCommandProcessor}}{\void}
36
37Destructor.
38
39
40\membersection{wxCommandProcessor::CanUndo}\label{wxcommandprocessorcanundo}
41
42\func{virtual bool}{CanUndo}{\void}
43
44Returns true if the currently-active command can be undone, false otherwise.
45
46
47\membersection{wxCommandProcessor::ClearCommands}\label{wxcommandprocessorclearcommands}
48
49\func{virtual void}{ClearCommands}{\void}
50
51Deletes all commands in the list and sets the current command pointer to \NULL.
52
53
54\membersection{wxCommandProcessor::Redo}\label{wxcommandprocessorredo}
55
56\func{virtual bool}{Redo}{\void}
57
58Executes (redoes) the current command (the command that has just been undone if any).
59
60
61\membersection{wxCommandProcessor::GetCommands}\label{wxcommandprocessorgetcommands}
62
63\constfunc{wxList\&}{GetCommands}{\void}
64
65Returns the list of commands.
66
67
68\membersection{wxCommandProcessor::GetMaxCommands}\label{wxcommandprocessorgetmaxcommands}
69
70\constfunc{int}{GetMaxCommands}{\void}
71
72Returns the maximum number of commands that the command processor stores.
73
74
75\membersection{wxCommandProcessor::GetEditMenu}\label{wxcommandprocessorgeteditmenu}
76
77\constfunc{wxMenu*}{GetEditMenu}{\void}
78
79Returns the edit menu associated with the command processor.
80
81
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
88
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
95
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
102
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
109
110\membersection{wxCommandProcessor::Initialize}\label{wxcommandprocessorinitialize}
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
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
137\membersection{wxCommandProcessor::SetEditMenu}\label{wxcommandprocessorseteditmenu}
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
146
147\membersection{wxCommandProcessor::SetMenuStrings}\label{wxcommandprocessorsetmenustrings}
148
149\func{void}{SetMenuStrings}{\void}
150
151Sets the menu labels according to the currently set menu and the current
152command state.
153
154
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
161
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
168
169\membersection{wxCommandProcessor::Submit}\label{wxcommandprocessorsubmit}
170
171\func{virtual bool}{Submit}{\param{wxCommand *}{command}, \param{bool}{ storeIt = true}}
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
183
184\membersection{wxCommandProcessor::Undo}\label{wxcommandprocessorundo}
185
186\func{virtual bool}{Undo}{\void}
187
188Undoes the command just executed.
189
190