1 \section{\class{wxCommandProcessor
}}\label{wxcommandprocessor
}
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.
7 \wxheading{Derived from
}
9 \helpref{wxObject
}{wxobject
}
11 \wxheading{Include files
}
17 \helpref{wxCore
}{librarieslist
}
21 \helpref{wxCommandProcessor overview
}{wxcommandprocessoroverview
},
\helpref{wxCommand
}{wxcommand
}
23 \latexignore{\rtfignore{\wxheading{Members
}}}
26 \membersection{wxCommandProcessor::wxCommandProcessor
}\label{wxcommandprocessorctor
}
28 \func{}{wxCommandProcessor
}{\param{int
}{ maxCommands = $-
1$
}}
32 {\it maxCommands
} may be set to a positive integer to limit the number of
33 commands stored to it, otherwise (and by default) the list of commands can grow
37 \membersection{wxCommandProcessor::
\destruct{wxCommandProcessor
}}\label{wxcommandprocessordtor
}
39 \func{}{\destruct{wxCommandProcessor
}}{\void}
44 \membersection{wxCommandProcessor::CanUndo
}\label{wxcommandprocessorcanundo
}
46 \func{virtual bool
}{CanUndo
}{\void}
48 Returns true if the currently-active command can be undone, false otherwise.
51 \membersection{wxCommandProcessor::ClearCommands
}\label{wxcommandprocessorclearcommands
}
53 \func{virtual void
}{ClearCommands
}{\void}
55 Deletes all commands in the list and sets the current command pointer to
\NULL.
58 \membersection{wxCommandProcessor::Redo
}\label{wxcommandprocessorredo
}
60 \func{virtual bool
}{Redo
}{\void}
62 Executes (redoes) the current command (the command that has just been undone if any).
65 \membersection{wxCommandProcessor::GetCommands
}\label{wxcommandprocessorgetcommands
}
67 \constfunc{wxList\&
}{GetCommands
}{\void}
69 Returns the list of commands.
72 \membersection{wxCommandProcessor::GetMaxCommands
}\label{wxcommandprocessorgetmaxcommands
}
74 \constfunc{int
}{GetMaxCommands
}{\void}
76 Returns the maximum number of commands that the command processor stores.
79 \membersection{wxCommandProcessor::GetEditMenu
}\label{wxcommandprocessorgeteditmenu
}
81 \constfunc{wxMenu*
}{GetEditMenu
}{\void}
83 Returns the edit menu associated with the command processor.
86 \membersection{wxCommandProcessor::GetRedoAccelerator
}\label{wxcommandprocessorgetredoaccelerator
}
88 \constfunc{const wxString\&
}{GetRedoAccelerator
}{\void}
90 Returns the string that will be appended to the Redo menu item.
93 \membersection{wxCommandProcessor::GetRedoMenuLabel
}\label{wxcommandprocessorgetredomenulabel
}
95 \constfunc{wxString
}{GetRedoMenuLabel
}{\void}
97 Returns the string that will be shown for the redo menu item.
100 \membersection{wxCommandProcessor::GetUndoAccelerator
}\label{wxcommandprocessorgetundoaccelerator
}
102 \constfunc{const wxString\&
}{GetUndoAccelerator
}{\void}
104 Returns the string that will be appended to the Undo menu item.
107 \membersection{wxCommandProcessor::GetUndoMenuLabel
}\label{wxcommandprocessorgetundomenulabel
}
109 \constfunc{wxString
}{GetUndoMenuLabel
}{\void}
111 Returns the string that will be shown for the undo menu item.
114 \membersection{wxCommandProcessor::Initialize
}\label{wxcommandprocessorinitialize
}
116 \func{virtual void
}{Initialize
}{\void}
118 Initializes the command processor, setting the current command to the
119 last in the list (if any), and updating the edit menu (if one has been
123 \membersection{wxCommandProcessor::IsDirty
}\label{wxcommandprocessorisdirty
}
125 \func{virtual bool
}{IsDirty
}{\void}
127 Returns a boolean value that indicates if changes have been made since
128 the last save operation. This only works if
129 \helpref{wxCommandProcessor::MarkAsSaved
}{wxcommandprocessormarkassaved
}
130 is called whenever the project is saved.
133 \membersection{wxCommandProcessor::MarkAsSaved
}\label{wxcommandprocessormarkassaved
}
135 \func{virtual void
}{MarkAsSaved
}{\void}
137 You must call this method whenever the project is saved if you plan to use
138 \helpref{wxCommandProcessor::IsDirty
}{wxcommandprocessorisdirty
}.
141 \membersection{wxCommandProcessor::SetEditMenu
}\label{wxcommandprocessorseteditmenu
}
143 \func{void
}{SetEditMenu
}{\param{wxMenu*
}{menu
}}
145 Tells the command processor to update the Undo and Redo items on this
146 menu as appropriate. Set this to NULL if the menu is about to be
147 destroyed and command operations may still be performed, or the command
148 processor may try to access an invalid pointer.
151 \membersection{wxCommandProcessor::SetMenuStrings
}\label{wxcommandprocessorsetmenustrings
}
153 \func{void
}{SetMenuStrings
}{\void}
155 Sets the menu labels according to the currently set menu and the current
159 \membersection{wxCommandProcessor::SetRedoAccelerator
}\label{wxcommandprocessorsetredoaccelerator
}
161 \func{void
}{SetRedoAccelerator
}{\param{const wxString\&
}{accel
}}
163 Sets the string that will be appended to the Redo menu item.
166 \membersection{wxCommandProcessor::SetUndoAccelerator
}\label{wxcommandprocessorsetundoaccelerator
}
168 \func{void
}{SetUndoAccelerator
}{\param{const wxString\&
}{accel
}}
170 Sets the string that will be appended to the Undo menu item.
173 \membersection{wxCommandProcessor::Submit
}\label{wxcommandprocessorsubmit
}
175 \func{virtual bool
}{Submit
}{\param{wxCommand *
}{command
},
\param{bool
}{ storeIt = true
}}
177 Submits a new command to the command processor. The command processor
178 calls wxCommand::Do to execute the command; if it succeeds, the command
179 is stored in the history list, and the associated edit menu (if any) updated
180 appropriately. If it fails, the command is deleted
181 immediately. Once Submit has been called, the passed command should not
182 be deleted directly by the application.
184 {\it storeIt
} indicates whether the successful command should be stored
188 \membersection{wxCommandProcessor::Undo
}\label{wxcommandprocessorundo
}
190 \func{virtual bool
}{Undo
}{\void}
192 Undoes the command just executed.