Loading...
Searching...
No Matches
OngoingCommandDispatcher Class Referencefinal

The OngoingCommandDispatcher class. More...

Inheritance diagram for OngoingCommandDispatcher:
ICommandDispatcher

Detailed Description

The OngoingCommandDispatcher class.

A basic, type-unsafe dispatcher for a commands that have continuous edition capabilities.

That is, it is useful when you want to have a command that has a long initialization but a very fast update. For instance, moving an object : initializing the command is (relatively) long so we don't want to create a new one at every mouse movement.
Instead, such commands have an update() function with the same arguments than the used constructor.
This dispatcher will call the correct method of the given command whether we're initializing it for the first time, or modifying the existing command.

Public Member Functions

 OngoingCommandDispatcher (const score::CommandStackFacade &stack)
 
void watch (const QObject *obj)
 
void unwatch (const QObject *obj)
 
template<typename TheCommand , typename Watched , typename... Args>
void submit (Watched &&watched, Args &&... args)
 
void commit ()
 
void rollback ()
 If the command has to be reverted, for instance when pressing escape.
 
void rollback_without_undo ()
 
- Public Member Functions inherited from ICommandDispatcher
 ICommandDispatcher (const score::CommandStack &stack)=delete
 
 ICommandDispatcher (const score::CommandStackFacade &stack)
 
const score::CommandStackFacadestack () const
 

Member Function Documentation

◆ commit()

void OngoingCommandDispatcher::commit ( )

When the command is finished and can be sent to the undo - redo stack. For instance on mouse release.

◆ submit()

template<typename TheCommand , typename Watched , typename... Args>
void OngoingCommandDispatcher::submit ( Watched &&  watched,
Args &&...  args 
)
inline

Call this repeatedly to make the command, for instance on click and when the mouse moves.


The documentation for this class was generated from the following files: