edbee - Qt Editor Library v0.11.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
selectioncommand.h
Go to the documentation of this file.
1// edbee - Copyright (c) 2012-2025 by Rick Blommers and contributors
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include "edbee/exports.h"
7
9
10namespace edbee {
11
15{
16public:
44
45public:
46 explicit SelectionCommand( SelectionType unit, int amount=0, bool keepSelection=false, int rangeIndex = -1 );
47 virtual ~SelectionCommand();
48
49
50 virtual int commandId();
51
52
53 virtual void execute( TextEditorController* controller ) override;
54 virtual QString toString() override;
55 virtual bool readonly() override;
56
57 SelectionType unit() { return unit_; }
58 int amount() { return amount_; }
59 bool keepSelection() { return keepSelection_; }
60 int rangeIndex() { return rangeIndex_; }
61 void setAnchor(int anchor) { anchor_ = anchor; }
62 int anchor() { return anchor_; }
63
64
65private:
66
67 SelectionType unit_;
68 int amount_;
69 int anchor_;
70 bool keepSelection_;
71 int rangeIndex_;
72};
73
74
75} // edbee
The selection command is used to move the caret and anchors to make selections and move the carets ar...
Definition selectioncommand.h:15
int anchor()
Definition selectioncommand.h:62
SelectionType
Definition selectioncommand.h:17
@ SelectWord
select a full word
Definition selectioncommand.h:34
@ MoveCaretByCharacter
Moves the caret(s) by the given amount of characters.
Definition selectioncommand.h:20
@ ToggleWordSelectionAt
Toggles the selection and caret at the given location.
Definition selectioncommand.h:37
@ MoveCaretToExactOffset
moves the caret to the given offset (given in amount). (This action also support the adjustment of th...
Definition selectioncommand.h:30
@ MoveCaretToLineBoundary
moves the caret to a line-boundary (<0 begin of line, >0 end of line)
Definition selectioncommand.h:27
@ MoveCaretToDocumentBegin
moves the caret to the document start
Definition selectioncommand.h:28
@ MoveCaretByPage
moves the caret(s) by the given amount of pages
Definition selectioncommand.h:25
@ AddCaretAtOffset
adds a extra caret at the given offset (amount is the caret offset)
Definition selectioncommand.h:40
@ MoveCaretToDocumentEnd
moves the caret to the document end
Definition selectioncommand.h:29
@ SelectAll
selects the complete document
Definition selectioncommand.h:33
@ SelectFullLine
select a full line
Definition selectioncommand.h:35
@ ResetSelection
Definition selectioncommand.h:42
@ AddCaretByLine
adds a caret at the given line amount is the amount of lines and the direction to add
Definition selectioncommand.h:41
@ MoveCaretByWord
moves the caret(s) by the given amount of words
Definition selectioncommand.h:23
@ SelectWordAt
select 'toggles' a word. Double click on a word to select a word or deselect a word
Definition selectioncommand.h:36
@ MoveCaretsOrDeselect
Moves the caret(s) by the given amount of characters or deselects the current selection.
Definition selectioncommand.h:21
@ MoveCaretByLine
moves the caret(s) by the given amount of lines
Definition selectioncommand.h:24
@ MoveCaretToWordBoundary
moves the caret to a line-boundary (<0 begin of line, >0 end of line)
Definition selectioncommand.h:26
bool keepSelection()
Definition selectioncommand.h:59
SelectionCommand(SelectionType unit, int amount=0, bool keepSelection=false, int rangeIndex=-1)
The constructor of the selection command.
Definition selectioncommand.cpp:24
void setAnchor(int anchor)
Definition selectioncommand.h:61
int amount()
Definition selectioncommand.h:58
SelectionType unit()
Definition selectioncommand.h:57
int rangeIndex()
Definition selectioncommand.h:60
TextEditorCommand()
The default constructor.
Definition texteditorcommand.cpp:12
The texteditor works via the controller. The controller is the central point/mediator which maps/cont...
Definition texteditorcontroller.h:39
#define EDBEE_EXPORT
Definition exports.h:15
QT Acessibility has an issue with reporting blank lines between elements lines. defining 'WINDOWS_EMP...
Definition commentcommand.cpp:20