edbee - Qt Editor Library
selectioncommand.h
Go to the documentation of this file.
1 
6 #pragma once
7 
9 
10 namespace edbee {
11 
15 {
16 public:
18 
19  // movement and selection
22  // SubWord, // TODO, implement subword selecting
30 
31  // selection only
37 
38  // add an extra caret
42  };
43 
44 public:
45  explicit SelectionCommand( SelectionType unit, int amount=0, bool keepSelection=false );
46  virtual ~SelectionCommand();
47 
48  virtual int commandId();
49 
50 
51  virtual void execute( TextEditorController* controller );
52  virtual QString toString();
53 
54  SelectionType unit() { return unit_; }
55  int amount() { return amount_; }
56  bool keepSelection() { return keepSelection_; }
57 
58 private:
59 
60  SelectionType unit_;
61  int amount_;
62  bool keepSelection_;
63 
64 
65 };
66 
67 
68 } // edbee
SelectionType unit()
Definition: selectioncommand.h:54
moves the caret(s) by the given amount of lines
Definition: selectioncommand.h:24
virtual ~SelectionCommand()
The descructor of the command.
Definition: selectioncommand.cpp:35
select 'toggles' a word. Double click on a word to select a word or deselect a word ...
Definition: selectioncommand.h:35
moves the caret(s) by the given amount of words
Definition: selectioncommand.h:23
SelectionType
Definition: selectioncommand.h:17
The selection command is used to move the caret and anchors to make selections and move the carets ar...
Definition: selectioncommand.h:14
SelectionCommand(SelectionType unit, int amount=0, bool keepSelection=false)
The constructor of the selection command.
Definition: selectioncommand.cpp:26
bool keepSelection()
Definition: selectioncommand.h:56
Moves the caret(s) by the given amount of characters or deselects the current selection.
Definition: selectioncommand.h:21
moves the caret to the given offset (given in amount)
Definition: selectioncommand.h:29
select a full word
Definition: selectioncommand.h:33
int amount()
Definition: selectioncommand.h:55
moves the caret to a line-boundary (<0 begin of line, >0 end of line)
Definition: selectioncommand.h:26
This is the abstract base class for a textcommand.
Definition: texteditorcommand.h:49
Definition: selectioncommand.h:41
moves the caret to the document start
Definition: selectioncommand.h:27
virtual QString toString()
Converts this command to a strings.
Definition: selectioncommand.cpp:212
Copyright 2011-2013 - Reliable Bits Software by Blommers IT.
Definition: commentcommand.cpp:22
adds a extra caret at the given offset (amount is the caret offset)
Definition: selectioncommand.h:39
Moves the caret(s) by the given amount of characters.
Definition: selectioncommand.h:20
select a full line
Definition: selectioncommand.h:34
moves the caret to the document end
Definition: selectioncommand.h:28
The texteditor works via the controller. The controller is the central point/mediater which maps/cont...
Definition: texteditorcontroller.h:37
virtual void execute(TextEditorController *controller)
execute the given selection command
Definition: selectioncommand.cpp:52
adds a caret at the given line amount is the amount of lines and the direction to add ...
Definition: selectioncommand.h:40
Toggles the selection and caret at the given location.
Definition: selectioncommand.h:36
selects the complete document
Definition: selectioncommand.h:32
moves the caret(s) by the given amount of pages
Definition: selectioncommand.h:25
virtual int commandId()
Return the command id This is th coalesceId + the given selection item.
Definition: selectioncommand.cpp:42