]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/cmdproc.tex
Added EVT_MOVE_START, EVT_MOVE_END (wxMSW only for now)
[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{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
30Constructor.
31
32{\it maxCommands} may be set to a positive integer to limit the number of
33commands stored to it, otherwise (and by default) the list of commands can grow
34arbitrarily.
35
36
37\membersection{wxCommandProcessor::\destruct{wxCommandProcessor}}\label{wxcommandprocessordtor}
38
39\func{}{\destruct{wxCommandProcessor}}{\void}
40
41Destructor.
42
43
44\membersection{wxCommandProcessor::CanUndo}\label{wxcommandprocessorcanundo}
45
46\func{virtual bool}{CanUndo}{\void}
47
48Returns 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
55Deletes 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
62Executes (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
69Returns the list of commands.
70
71
72\membersection{wxCommandProcessor::GetMaxCommands}\label{wxcommandprocessorgetmaxcommands}
73
74\constfunc{int}{GetMaxCommands}{\void}
75
76Returns 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
83Returns the edit menu associated with the command processor.
84
85
86\membersection{wxCommandProcessor::GetRedoAccelerator}\label{wxcommandprocessorgetredoaccelerator}
87
88\constfunc{const wxString\&}{GetRedoAccelerator}{\void}
89
90Returns 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
97Returns 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
104Returns 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
111Returns 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
118Initializes the command processor, setting the current command to the
119last in the list (if any), and updating the edit menu (if one has been
120specified).
121
122
123\membersection{wxCommandProcessor::IsDirty}\label{wxcommandprocessorisdirty}
124
125\func{virtual bool}{IsDirty}{\void}
126
127Returns a boolean value that indicates if changes have been made since
128the last save operation. This only works if
129\helpref{wxCommandProcessor::MarkAsSaved}{wxcommandprocessormarkassaved}
130is called whenever the project is saved.
131
132
133\membersection{wxCommandProcessor::MarkAsSaved}\label{wxcommandprocessormarkassaved}
134
135\func{virtual void}{MarkAsSaved}{\void}
136
137You 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
145Tells the command processor to update the Undo and Redo items on this
146menu as appropriate. Set this to NULL if the menu is about to be
147destroyed and command operations may still be performed, or the command
148processor may try to access an invalid pointer.
149
150
151\membersection{wxCommandProcessor::SetMenuStrings}\label{wxcommandprocessorsetmenustrings}
152
153\func{void}{SetMenuStrings}{\void}
154
155Sets the menu labels according to the currently set menu and the current
156command state.
157
158
159\membersection{wxCommandProcessor::SetRedoAccelerator}\label{wxcommandprocessorsetredoaccelerator}
160
161\func{void}{SetRedoAccelerator}{\param{const wxString\&}{accel}}
162
163Sets 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
170Sets 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
177Submits a new command to the command processor. The command processor
178calls wxCommand::Do to execute the command; if it succeeds, the command
179is stored in the history list, and the associated edit menu (if any) updated
180appropriately. If it fails, the command is deleted
181immediately. Once Submit has been called, the passed command should not
182be deleted directly by the application.
183
184{\it storeIt} indicates whether the successful command should be stored
185in the history list.
186
187
188\membersection{wxCommandProcessor::Undo}\label{wxcommandprocessorundo}
189
190\func{virtual bool}{Undo}{\void}
191
192Undoes the command just executed.
193
194