Lomse library. API documentation  0.30.0
CmdDeleteSelection Class Reference

#include <lomse_command.h>

Inheritance diagram for CmdDeleteSelection:
CmdDelete DocCmdSimple DocCommand

Detailed Description

A command for deleting all the selected objects.

See constructor for details.

Public Member Functions

 CmdDeleteSelection (const std::string &name="Delete selection")
 
int get_cursor_update_policy () override
 
int get_undo_policy () override
 
int get_selection_update_policy () override
 
- Public Member Functions inherited from DocCmdSimple
virtual ~DocCmdSimple ()
 
bool is_composite () override
 
- Public Member Functions inherited from DocCommand
virtual ~DocCommand ()
 
std::string get_name ()
 
bool is_reversible ()
 
bool is_recordable ()
 
std::string get_error ()
 

Additional Inherited Members

- Public Types inherited from DocCommand
enum  ECmdCursorPolicy
 
enum  ECmdUndoPolicy
 
enum  ECmdSelectionPolicy
 

Constructor & Destructor Documentation

◆ CmdDeleteSelection()

CmdDeleteSelection::CmdDeleteSelection ( const std::string &  name = "Delete selection")

This command deletes all selected objects.

Parameters
nameThe displayable name for the command. If not specified will default to "Delete selection".

Remarks

  • If current selection is empty the command will not be executed and will return a failure code.
  • After executing the command:
    • the selection will be empty.
    • the cursor will not change its position unless it was pointing to one of the deleted objects. In this case, cursor will point to next remaining object after the one it was pointing.
void CommandHandler::delete_selection()
{
//Delete all objects currently selected.
if (SpInteractor spInteractor = m_pPresenter->get_interactor(0).lock())
{
string name = gettext("Delete selection");
SpInteractor->exec_command( new CmdDeleteSelection(name) );
}
}

Member Function Documentation

◆ get_cursor_update_policy()

int CmdDeleteSelection::get_cursor_update_policy ( )
inlineoverridevirtual

Returns a value from ECmdCursorPolicy that indicates the update policy followed by this command.

Implements DocCommand.

◆ get_selection_update_policy()

int CmdDeleteSelection::get_selection_update_policy ( )
inlineoverridevirtual

Returns a value from ECmdSelectionPolicy that indicates the undo policy followed by this command.

Implements DocCommand.

◆ get_undo_policy()

int CmdDeleteSelection::get_undo_policy ( )
inlineoverridevirtual

Returns a value from ECmdUndoPolicy that indicates the undo policy followed by this command.

Implements DocCommand.