]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/cmdproc.tex
Made wxLayoutAlgorithm more general (copes with nested sash windows)
[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{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
21 Constructor.
22
23 {\it maxCommands} defaults to a rather arbitrary 100, but can be set from 1 to any integer.
24 If your wxCommand classes store a lot of data, you may wish the limit the number of
25 commands stored to a smaller number.
26
27 \membersection{wxCommandProcessor::\destruct{wxCommandProcessor}}
28
29 \func{}{\destruct{wxCommandProcessor}}{\void}
30
31 Destructor.
32
33 \membersection{wxCommandProcessor::CanUndo}
34
35 \func{virtual bool}{CanUndo}{\void}
36
37 Returns TRUE if the currently-active command can be undone, FALSE otherwise.
38
39 \membersection{wxCommandProcessor::ClearCommands}
40
41 \func{virtual void}{ClearCommands}{\void}
42
43 Deletes 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
49 Executes (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
55 Returns the list of commands.
56
57 \membersection{wxCommandProcessor::GetMaxCommands}
58
59 \constfunc{int}{GetMaxCommands}{\void}
60
61 Returns the maximum number of commands that the command processor stores.
62
63 \membersection{wxCommandProcessor::GetEditMenu}
64
65 \constfunc{wxMenu*}{GetEditMenu}{\void}
66
67 Returns the edit menu associated with the command processor.
68
69 \membersection{wxCommandProcessor::Initialize}
70
71 \func{virtual void}{Initialize}{\void}
72
73 Initializes the command processor, setting the current command to the
74 last in the list (if any), and updating the edit menu (if one has been
75 specified).
76
77 \membersection{wxCommandProcessor::SetEditMenu}
78
79 \func{void}{SetEditMenu}{\param{wxMenu* }{menu}}
80
81 Tells the command processor to update the Undo and Redo items on this
82 menu as appropriate. Set this to NULL if the menu is about to be
83 destroyed and command operations may still be performed, or the command
84 processor 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
90 Submits a new command to the command processor. The command processor
91 calls wxCommand::Do to execute the command; if it succeeds, the command
92 is stored in the history list, and the associated edit menu (if any) updated
93 appropriately. If it fails, the command is deleted
94 immediately. Once Submit has been called, the passed command should not
95 be deleted directly by the application.
96
97 {\it storeIt} indicates whether the successful command should be stored
98 in the history list.
99
100 \membersection{wxCommandProcessor::Undo}
101
102 \func{virtual bool}{Undo}{\void}
103
104 Undoes the command just executed.
105
106