edbee - Qt Editor Library
Public Types | Public Member Functions | List of all members
edbee::SelectionCommand Class Reference

The selection command is used to move the caret and anchors to make selections and move the carets around. More...

#include <selectioncommand.h>

+ Inheritance diagram for edbee::SelectionCommand:
+ Collaboration diagram for edbee::SelectionCommand:

Public Types

enum  SelectionType {
  MoveCaretByCharacter, MoveCaretsOrDeselect, MoveCaretByWord, MoveCaretByLine,
  MoveCaretByPage, MoveCaretToLineBoundary, MoveCaretToDocumentBegin, MoveCaretToDocumentEnd,
  MoveCaretToExactOffset, SelectAll, SelectWord, SelectFullLine,
  SelectWordAt, ToggleWordSelectionAt, AddCaretAtOffset, AddCaretByLine,
  ResetSelection
}
 

Public Member Functions

 SelectionCommand (SelectionType unit, int amount=0, bool keepSelection=false)
 The constructor of the selection command. More...
 
virtual ~SelectionCommand ()
 The descructor of the command. More...
 
virtual int commandId ()
 Return the command id This is th coalesceId + the given selection item. More...
 
virtual void execute (TextEditorController *controller)
 execute the given selection command More...
 
virtual QString toString ()
 Converts this command to a strings. More...
 
SelectionType unit ()
 
int amount ()
 
bool keepSelection ()
 
- Public Member Functions inherited from edbee::TextEditorCommand
 TextEditorCommand ()
 The default constructor. More...
 
virtual ~TextEditorCommand ()
 A blank virtual destructor. More...
 

Detailed Description

The selection command is used to move the caret and anchors to make selections and move the carets around.

Member Enumeration Documentation

◆ SelectionType

Enumerator
MoveCaretByCharacter 

Moves the caret(s) by the given amount of characters.

MoveCaretsOrDeselect 

Moves the caret(s) by the given amount of characters or deselects the current selection.

Todo:
, implement subword selecting
MoveCaretByWord 

moves the caret(s) by the given amount of words

MoveCaretByLine 

moves the caret(s) by the given amount of lines

MoveCaretByPage 

moves the caret(s) by the given amount of pages

MoveCaretToLineBoundary 

moves the caret to a line-boundary (<0 begin of line, >0 end of line)

MoveCaretToDocumentBegin 

moves the caret to the document start

MoveCaretToDocumentEnd 

moves the caret to the document end

MoveCaretToExactOffset 

moves the caret to the given offset (given in amount)

SelectAll 

selects the complete document

SelectWord 

select a full word

SelectFullLine 

select a full line

SelectWordAt 

select 'toggles' a word. Double click on a word to select a word or deselect a word

ToggleWordSelectionAt 

Toggles the selection and caret at the given location.

AddCaretAtOffset 

adds a extra caret at the given offset (amount is the caret offset)

AddCaretByLine 

adds a caret at the given line amount is the amount of lines and the direction to add

ResetSelection 

Constructor & Destructor Documentation

◆ SelectionCommand()

edbee::SelectionCommand::SelectionCommand ( SelectionType  unit,
int  amount = 0,
bool  keepSelection = false 
)
explicit

The constructor of the selection command.

Parameters
unitthe unit of this command
amountthe number of steps
keepSelectionwhen true the anchor stays put (and the selection is expanded)

◆ ~SelectionCommand()

edbee::SelectionCommand::~SelectionCommand ( )
virtual

The descructor of the command.

Member Function Documentation

◆ amount()

int edbee::SelectionCommand::amount ( )
inline

◆ commandId()

int edbee::SelectionCommand::commandId ( )
virtual

Return the command id This is th coalesceId + the given selection item.

◆ execute()

void edbee::SelectionCommand::execute ( TextEditorController controller)
virtual

execute the given selection command

Parameters
controllerthe controller to execute the selection for

Implements edbee::TextEditorCommand.

◆ keepSelection()

bool edbee::SelectionCommand::keepSelection ( )
inline

◆ toString()

QString edbee::SelectionCommand::toString ( )
virtual

Converts this command to a strings.

Implements edbee::TextEditorCommand.

◆ unit()

SelectionType edbee::SelectionCommand::unit ( )
inline

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