]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/cmdproc.tex
toplevel code transferred to wxTopLevelWindow
[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
13<wx/docview.h>
14
a660d684
KB
15\wxheading{See also}
16
17\helpref{wxCommandProcessor overview}{wxcommandprocessoroverview}, \helpref{wxCommand}{wxcommand}
18
19\latexignore{\rtfignore{\wxheading{Members}}}
20
21\membersection{wxCommandProcessor::wxCommandProcessor}
22
23\func{}{wxCommandProcessor}{\param{int}{ maxCommands = 100}}
24
25Constructor.
26
27{\it maxCommands} defaults to a rather arbitrary 100, but can be set from 1 to any integer.
28If your wxCommand classes store a lot of data, you may wish the limit the number of
29commands stored to a smaller number.
30
31\membersection{wxCommandProcessor::\destruct{wxCommandProcessor}}
32
33\func{}{\destruct{wxCommandProcessor}}{\void}
34
35Destructor.
36
37\membersection{wxCommandProcessor::CanUndo}
38
39\func{virtual bool}{CanUndo}{\void}
40
41Returns TRUE if the currently-active command can be undone, FALSE otherwise.
42
43\membersection{wxCommandProcessor::ClearCommands}
44
45\func{virtual void}{ClearCommands}{\void}
46
47Deletes all the commands in the list and sets the current command pointer to NULL.
48
49\membersection{wxCommandProcessor::Do}
50
51\func{virtual bool}{Do}{\void}
52
53Executes (redoes) the current command (the command that has just been undone if any).
54
55\membersection{wxCommandProcessor::GetCommands}
56
57\constfunc{wxList\&}{GetCommands}{\void}
58
59Returns the list of commands.
60
61\membersection{wxCommandProcessor::GetMaxCommands}
62
63\constfunc{int}{GetMaxCommands}{\void}
64
65Returns the maximum number of commands that the command processor stores.
66
67\membersection{wxCommandProcessor::GetEditMenu}
68
69\constfunc{wxMenu*}{GetEditMenu}{\void}
70
71Returns the edit menu associated with the command processor.
72
5e0e6ceb
JS
73\membersection{wxCommandProcessor::GetRedoAccelerator}\label{wxcommandprocessorgetredoaccelerator}
74
75\constfunc{const wxString\&}{GetRedoAccelerator}{\void}
76
77Returns the string that will be appended to the Redo menu item.
78
79\membersection{wxCommandProcessor::GetUndoAccelerator}\label{wxcommandprocessorgetundoaccelerator}
80
81\constfunc{const wxString\&}{GetUndoAccelerator}{\void}
82
83Returns the string that will be appended to the Undo menu item.
84
a660d684
KB
85\membersection{wxCommandProcessor::Initialize}
86
87\func{virtual void}{Initialize}{\void}
88
89Initializes the command processor, setting the current command to the
90last in the list (if any), and updating the edit menu (if one has been
91specified).
92
93\membersection{wxCommandProcessor::SetEditMenu}
94
95\func{void}{SetEditMenu}{\param{wxMenu* }{menu}}
96
97Tells the command processor to update the Undo and Redo items on this
98menu as appropriate. Set this to NULL if the menu is about to be
99destroyed and command operations may still be performed, or the command
100processor may try to access an invalid pointer.
101
5e0e6ceb
JS
102\membersection{wxCommandProcessor::SetRedoAccelerator}\label{wxcommandprocessorsetredoaccelerator}
103
104\func{void}{SetRedoAccelerator}{\param{const wxString\&}{accel}}
105
106Sets the string that will be appended to the Redo menu item.
107
108\membersection{wxCommandProcessor::SetUndoAccelerator}\label{wxcommandprocessorsetundoaccelerator}
109
110\func{void}{SetUndoAccelerator}{\param{const wxString\&}{accel}}
111
112Sets the string that will be appended to the Undo menu item.
113
a660d684
KB
114\membersection{wxCommandProcessor::Submit}
115
116\func{virtual bool}{Submit}{\param{wxCommand *}{command}, \param{bool}{ storeIt = TRUE}}
117
118Submits a new command to the command processor. The command processor
119calls wxCommand::Do to execute the command; if it succeeds, the command
120is stored in the history list, and the associated edit menu (if any) updated
121appropriately. If it fails, the command is deleted
122immediately. Once Submit has been called, the passed command should not
123be deleted directly by the application.
124
125{\it storeIt} indicates whether the successful command should be stored
126in the history list.
127
128\membersection{wxCommandProcessor::Undo}
129
130\func{virtual bool}{Undo}{\void}
131
132Undoes the command just executed.
133
134