wxWidgets: wxCommandProcessor Class Reference

| Version: 3.1.5

Loading...
Searching...
No Matches
Public Member Functions | List of all members
wxCommandProcessor Class Reference
Class List by Category » Document/View Framework

`#include </cygdrive/c/Users/Hamis/Cygwin-packaging/wxWidgets3.1/wxWidgets3.1-3.1.5-4.x86_64/src/wxWidgets-3.1.5/interface/wx/cmdproc.h>`

Inheritance diagram for wxCommandProcessor:
[legend]

## Detailed Description

wxCommandProcessor is a class that maintains a history of wxCommands, with undo/redo functionality built-in.

Derive a new class from this if you want different behaviour.

##

Library: wxCore

<>< =''>:</>&;&;< =''>\ </></>

See also
  wxCommandProcessor Overview, wxCommand

## Public Member Functions
| wxCommandProcessor (int maxCommands=-1)
| Constructor.
virtual | ~wxCommandProcessor ()
| Destructor.
virtual bool | CanUndo () const
| Returns true if the currently-active command can be undone, false otherwise.
virtual bool | CanRedo () const
| Returns true if the currently-active command can be redone, false otherwise.
virtual void | ClearCommands ()
| Deletes all commands in the list and sets the current command pointer to NULL.
wxList & | GetCommands ()
| Returns the list of commands.
wxCommand * | GetCurrentCommand () const
| Returns the current command.
wxMenu * | GetEditMenu () const
| Returns the edit menu associated with the command processor.
int | GetMaxCommands () const
| Returns the maximum number of commands that the command processor stores.
const wxString & | GetRedoAccelerator () const
| Returns the string that will be appended to the Redo menu item.
wxString | GetRedoMenuLabel () const
| Returns the string that will be shown for the redo menu item.
const wxString & | GetUndoAccelerator () const
| Returns the string that will be appended to the Undo menu item.
wxString | GetUndoMenuLabel () const
| Returns the string that will be shown for the undo menu item.
virtual void | Initialize ()
| Initializes the command processor, setting the current command to the last in the list (if any), and updating the edit menu (if one has been specified).
virtual bool | IsDirty () const
| Returns a boolean value that indicates if changes have been made since the last save operation.
void | MarkAsSaved ()
| You must call this method whenever the project is saved if you plan to use IsDirty().
virtual bool | Redo ()
| Executes (redoes) the current command (the command that has just been undone if any).
void | SetEditMenu (wxMenu *menu)
| Tells the command processor to update the Undo and Redo items on this menu as appropriate.
virtual void | SetMenuStrings ()
| Sets the menu labels according to the currently set menu and the current command state.
void | SetRedoAccelerator (const wxString &accel)
| Sets the string that will be appended to the Redo menu item.
void | SetUndoAccelerator (const wxString &accel)
| Sets the string that will be appended to the Undo menu item.
virtual bool | Submit (wxCommand *command, bool storeIt=true)
| Submits a new command to the command processor.
virtual void | Store (wxCommand *command)
| Just store the command without executing it.
virtual bool | Undo ()
| Undoes the last command executed.
Public Member Functions inherited from wxObject
| wxObject ()
| Default ctor; initializes to NULL the internal reference data.
| wxObject (const wxObject &other)
| Copy ctor.
virtual | ~wxObject ()
| Destructor.
virtual wxClassInfo * | GetClassInfo () const
| This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar).
wxObjectRefData * | GetRefData () const
| Returns the wxObject::m_refData pointer, i.e. the data referenced by this object.
bool | IsKindOf (const wxClassInfo *info) const
| Determines whether this class is a subclass of (or the same class as) the given class.
bool | IsSameAs (const wxObject &obj) const
| Returns true if this object has the same data pointer as obj.
void | Ref (const wxObject &clone)
| Makes this object refer to the data in clone.
void | SetRefData (wxObjectRefData *data)
| Sets the wxObject::m_refData pointer.
void | UnRef ()
| Decrements the reference count in the associated data, and if it is zero, deletes the data.
void | UnShare ()
| This is the same of AllocExclusive() but this method is public.
void | operator delete (void *buf)
| The delete operator is defined for debugging versions of the library only, when the identifier `__WXDEBUG__` is defined.
void * | operator new (size_t size, const wxString &filename=NULL, int lineNum=0)
| The new operator is defined for debugging versions of the library only, when the identifier `__WXDEBUG__` is defined.

## Additional Inherited Members
Protected Member Functions inherited from wxObject
void | AllocExclusive ()
| Ensure that this object's data is not shared with any other object.
virtual wxObjectRefData * | CreateRefData () const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it.
virtual wxObjectRefData * | CloneRefData (const wxObjectRefData *data) const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data.
Protected Attributes inherited from wxObject
wxObjectRefData * | m_refData
| Pointer to an object which is the object's reference-counted data.

## Constructor & Destructor Documentation

## ◆ wxCommandProcessor()

wxCommandProcessor::wxCommandProcessor | ( | int | maxCommands = -1 | ) |

Constructor.

Parameters

  maxCommands | May be set to a positive integer to limit the number of commands stored to it, otherwise (and by default) the list of commands can grow arbitrarily.

## ◆ ~wxCommandProcessor()

virtual wxCommandProcessor::~wxCommandProcessor | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ CanRedo()

virtual bool wxCommandProcessor::CanRedo | ( |  | ) | const
| virtual

Returns true if the currently-active command can be redone, false otherwise.

## ◆ CanUndo()

virtual bool wxCommandProcessor::CanUndo | ( |  | ) | const
| virtual

Returns true if the currently-active command can be undone, false otherwise.

## ◆ ClearCommands()

virtual void wxCommandProcessor::ClearCommands | ( |  | ) |
| virtual

Deletes all commands in the list and sets the current command pointer to NULL.

## ◆ GetCommands()

wxList & wxCommandProcessor::GetCommands | ( |  | ) |

Returns the list of commands.

## ◆ GetCurrentCommand()

wxCommand * wxCommandProcessor::GetCurrentCommand | ( |  | ) | const

Returns the current command.

## ◆ GetEditMenu()

wxMenu * wxCommandProcessor::GetEditMenu | ( |  | ) | const

Returns the edit menu associated with the command processor.

## ◆ GetMaxCommands()

int wxCommandProcessor::GetMaxCommands | ( |  | ) | const

Returns the maximum number of commands that the command processor stores.

## ◆ GetRedoAccelerator()

const wxString & wxCommandProcessor::GetRedoAccelerator | ( |  | ) | const

Returns the string that will be appended to the Redo menu item.

## ◆ GetRedoMenuLabel()

wxString wxCommandProcessor::GetRedoMenuLabel | ( |  | ) | const

Returns the string that will be shown for the redo menu item.

## ◆ GetUndoAccelerator()

const wxString & wxCommandProcessor::GetUndoAccelerator | ( |  | ) | const

Returns the string that will be appended to the Undo menu item.

## ◆ GetUndoMenuLabel()

wxString wxCommandProcessor::GetUndoMenuLabel | ( |  | ) | const

Returns the string that will be shown for the undo menu item.

## ◆ Initialize()

virtual void wxCommandProcessor::Initialize | ( |  | ) |
| virtual

Initializes the command processor, setting the current command to the last in the list (if any), and updating the edit menu (if one has been specified).

## ◆ IsDirty()

virtual bool wxCommandProcessor::IsDirty | ( |  | ) | const
| virtual

Returns a boolean value that indicates if changes have been made since the last save operation.

This only works if MarkAsSaved() is called whenever the project is saved.

## ◆ MarkAsSaved()

void wxCommandProcessor::MarkAsSaved | ( |  | ) |

You must call this method whenever the project is saved if you plan to use IsDirty().

## ◆ Redo()

virtual bool wxCommandProcessor::Redo | ( |  | ) |
| virtual

Executes (redoes) the current command (the command that has just been undone if any).

## ◆ SetEditMenu()

void wxCommandProcessor::SetEditMenu | ( | wxMenu * | menu | ) |

Tells the command processor to update the Undo and Redo items on this menu as appropriate.

Set this to NULL if the menu is about to be destroyed and command operations may still be performed, or the command processor may try to access an invalid pointer.

## ◆ SetMenuStrings()

virtual void wxCommandProcessor::SetMenuStrings | ( |  | ) |
| virtual

Sets the menu labels according to the currently set menu and the current command state.

## ◆ SetRedoAccelerator()

void wxCommandProcessor::SetRedoAccelerator | ( | const wxString & | accel | ) |

Sets the string that will be appended to the Redo menu item.

## ◆ SetUndoAccelerator()

void wxCommandProcessor::SetUndoAccelerator | ( | const wxString & | accel | ) |

Sets the string that will be appended to the Undo menu item.

## ◆ Store()

virtual void wxCommandProcessor::Store | ( | wxCommand * | command | ) |
| virtual

Just store the command without executing it.

The command is stored in the history list, and the associated edit menu (if any) updated appropriately.

## ◆ Submit()

virtual bool wxCommandProcessor::Submit | ( | wxCommand * | command,
|  | bool | storeIt = true )
| virtual

Submits a new command to the command processor.

The command processor calls wxCommand::Do() to execute the command; if it succeeds, the command is stored in the history list, and the associated edit menu (if any) updated appropriately. If it fails, the command is deleted immediately. Once Submit() has been called, the passed command should not be deleted directly by the application.

Parameters

  command | The command to submit
  storeIt | Indicates whether the successful command should be stored in the history list.

## ◆ Undo()

virtual bool wxCommandProcessor::Undo | ( |  | ) |
| virtual

Undoes the last command executed.