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