]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/cmdproc.tex
added CreateSeparatedButtonSizer(), changed signature and semantics of CreateButtonSi...
[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{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
26 Constructor.
27
28 {\it maxCommands} may be set to a positive integer to limit the number of
29 commands stored to it, otherwise (and by default) the list of commands can grow
30 arbitrarily.
31
32
33 \membersection{wxCommandProcessor::\destruct{wxCommandProcessor}}\label{wxcommandprocessordtor}
34
35 \func{}{\destruct{wxCommandProcessor}}{\void}
36
37 Destructor.
38
39
40 \membersection{wxCommandProcessor::CanUndo}\label{wxcommandprocessorcanundo}
41
42 \func{virtual bool}{CanUndo}{\void}
43
44 Returns 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
51 Deletes 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
58 Executes (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
65 Returns the list of commands.
66
67
68 \membersection{wxCommandProcessor::GetMaxCommands}\label{wxcommandprocessorgetmaxcommands}
69
70 \constfunc{int}{GetMaxCommands}{\void}
71
72 Returns 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
79 Returns the edit menu associated with the command processor.
80
81
82 \membersection{wxCommandProcessor::GetRedoAccelerator}\label{wxcommandprocessorgetredoaccelerator}
83
84 \constfunc{const wxString\&}{GetRedoAccelerator}{\void}
85
86 Returns 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
93 Returns 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
100 Returns 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
107 Returns 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
114 Initializes the command processor, setting the current command to the
115 last in the list (if any), and updating the edit menu (if one has been
116 specified).
117
118
119 \membersection{wxCommandProcessor::IsDirty}\label{wxcommandprocessorisdirty}
120
121 \func{virtual bool}{IsDirty}{\void}
122
123 Returns a boolean value that indicates if changes have been made since
124 the last save operation. This only works if
125 \helpref{wxCommandProcessor::MarkAsSaved}{wxcommandprocessormarkassaved}
126 is called whenever the project is saved.
127
128
129 \membersection{wxCommandProcessor::MarkAsSaved}\label{wxcommandprocessormarkassaved}
130
131 \func{virtual void}{MarkAsSaved}{\void}
132
133 You 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
141 Tells the command processor to update the Undo and Redo items on this
142 menu as appropriate. Set this to NULL if the menu is about to be
143 destroyed and command operations may still be performed, or the command
144 processor may try to access an invalid pointer.
145
146
147 \membersection{wxCommandProcessor::SetMenuStrings}\label{wxcommandprocessorsetmenustrings}
148
149 \func{void}{SetMenuStrings}{\void}
150
151 Sets the menu labels according to the currently set menu and the current
152 command state.
153
154
155 \membersection{wxCommandProcessor::SetRedoAccelerator}\label{wxcommandprocessorsetredoaccelerator}
156
157 \func{void}{SetRedoAccelerator}{\param{const wxString\&}{accel}}
158
159 Sets 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
166 Sets 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
173 Submits a new command to the command processor. The command processor
174 calls wxCommand::Do to execute the command; if it succeeds, the command
175 is stored in the history list, and the associated edit menu (if any) updated
176 appropriately. If it fails, the command is deleted
177 immediately. Once Submit has been called, the passed command should not
178 be deleted directly by the application.
179
180 {\it storeIt} indicates whether the successful command should be stored
181 in the history list.
182
183
184 \membersection{wxCommandProcessor::Undo}\label{wxcommandprocessorundo}
185
186 \func{virtual bool}{Undo}{\void}
187
188 Undoes the command just executed.
189
190