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{wxCommandProcessor overview
}{wxcommandprocessoroverview
},
\helpref{wxCommand
}{wxcommand
}
19 \latexignore{\rtfignore{\wxheading{Members
}}}
22 \membersection{wxCommandProcessor::wxCommandProcessor
}\label{wxcommandprocessorctor
}
24 \func{}{wxCommandProcessor
}{\param{int
}{ maxCommands = $-
1$
}}
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
33 \membersection{wxCommandProcessor::
\destruct{wxCommandProcessor
}}\label{wxcommandprocessordtor
}
35 \func{}{\destruct{wxCommandProcessor
}}{\void}
40 \membersection{wxCommandProcessor::CanUndo
}\label{wxcommandprocessorcanundo
}
42 \func{virtual bool
}{CanUndo
}{\void}
44 Returns true if the currently-active command can be undone, false otherwise.
47 \membersection{wxCommandProcessor::ClearCommands
}\label{wxcommandprocessorclearcommands
}
49 \func{virtual void
}{ClearCommands
}{\void}
51 Deletes all the commands in the list and sets the current command pointer to NULL.
54 \membersection{wxCommandProcessor::Redo
}\label{wxcommandprocessorredo
}
56 \func{virtual bool
}{Redo
}{\void}
58 Executes (redoes) the current command (the command that has just been undone if any).
61 \membersection{wxCommandProcessor::GetCommands
}\label{wxcommandprocessorgetcommands
}
63 \constfunc{wxList\&
}{GetCommands
}{\void}
65 Returns the list of commands.
68 \membersection{wxCommandProcessor::GetMaxCommands
}\label{wxcommandprocessorgetmaxcommands
}
70 \constfunc{int
}{GetMaxCommands
}{\void}
72 Returns the maximum number of commands that the command processor stores.
75 \membersection{wxCommandProcessor::GetEditMenu
}\label{wxcommandprocessorgeteditmenu
}
77 \constfunc{wxMenu*
}{GetEditMenu
}{\void}
79 Returns the edit menu associated with the command processor.
82 \membersection{wxCommandProcessor::GetRedoAccelerator
}\label{wxcommandprocessorgetredoaccelerator
}
84 \constfunc{const wxString\&
}{GetRedoAccelerator
}{\void}
86 Returns the string that will be appended to the Redo menu item.
89 \membersection{wxCommandProcessor::GetRedoMenuLabel
}\label{wxcommandprocessorgetredomenulabel
}
91 \constfunc{wxString
}{GetRedoMenuLabel
}{\void}
93 Returns the string that will be shown for the redo menu item.
96 \membersection{wxCommandProcessor::GetUndoAccelerator
}\label{wxcommandprocessorgetundoaccelerator
}
98 \constfunc{const wxString\&
}{GetUndoAccelerator
}{\void}
100 Returns the string that will be appended to the Undo menu item.
103 \membersection{wxCommandProcessor::GetUndoMenuLabel
}\label{wxcommandprocessorgetundomenulabel
}
105 \constfunc{wxString
}{GetUndoMenuLabel
}{\void}
107 Returns the string that will be shown for the undo menu item.
110 \membersection{wxCommandProcessor::Initialize
}\label{wxcommandprocessorinitialize
}
112 \func{virtual void
}{Initialize
}{\void}
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
119 \membersection{wxCommandProcessor::IsDirty
}\label{wxcommandprocessorisdirty
}
121 \func{virtual bool
}{IsDirty
}{\void}
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.
129 \membersection{wxCommandProcessor::MarkAsSaved
}\label{wxcommandprocessormarkassaved
}
131 \func{virtual void
}{MarkAsSaved
}{\void}
133 You must call this method whenever the project is saved if you plan to use
134 \helpref{wxCommandProcessor::IsDirty
}{wxcommandprocessorisdirty
}.
137 \membersection{wxCommandProcessor::SetEditMenu
}\label{wxcommandprocessorseteditmenu
}
139 \func{void
}{SetEditMenu
}{\param{wxMenu*
}{menu
}}
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.
147 \membersection{wxCommandProcessor::SetMenuStrings
}\label{wxcommandprocessorsetmenustrings
}
149 \func{void
}{SetMenuStrings
}{\void}
151 Sets the menu labels according to the currently set menu and the current
155 \membersection{wxCommandProcessor::SetRedoAccelerator
}\label{wxcommandprocessorsetredoaccelerator
}
157 \func{void
}{SetRedoAccelerator
}{\param{const wxString\&
}{accel
}}
159 Sets the string that will be appended to the Redo menu item.
162 \membersection{wxCommandProcessor::SetUndoAccelerator
}\label{wxcommandprocessorsetundoaccelerator
}
164 \func{void
}{SetUndoAccelerator
}{\param{const wxString\&
}{accel
}}
166 Sets the string that will be appended to the Undo menu item.
169 \membersection{wxCommandProcessor::Submit
}\label{wxcommandprocessorsubmit
}
171 \func{virtual bool
}{Submit
}{\param{wxCommand *
}{command
},
\param{bool
}{ storeIt = true
}}
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.
180 {\it storeIt
} indicates whether the successful command should be stored
184 \membersection{wxCommandProcessor::Undo
}\label{wxcommandprocessorundo
}
186 \func{virtual bool
}{Undo
}{\void}
188 Undoes the command just executed.