37template <
class CallbackClass>
48 const bool ctrlOrAltDown = mods.isCtrlDown() || mods.isAltDown();
66 if (mods.isCommandDown())
76 : target.moveCaretToStartOfLine (isShiftDown);
78 : target.moveCaretToEndOfLine (isShiftDown);
92 return target.copyToClipboard();
96 return target.cutToClipboard();
100 return target.pasteFromClipboard();
110 return target.selectAll();
113 return target.undo();
117 return target.redo();
Represents a key press, including any modifier keys that are needed.
static const int homeKey
key-code for the home key
static const int upKey
key-code for the cursor-up key
static const int endKey
key-code for the end key
bool isKeyCode(int keyCodeToCompare) const noexcept
Checks whether the KeyPress's key is the same as the one provided, without checking the modifiers.
static const int rightKey
key-code for the cursor-right key
static const int deleteKey
key-code for the delete key (not backspace)
static const int insertKey
key-code for the insert key
ModifierKeys getModifiers() const noexcept
Returns the key modifiers.
static const int downKey
key-code for the cursor-down key
static const int leftKey
key-code for the cursor-left key
static const int pageUpKey
key-code for the page-up key
static const int pageDownKey
key-code for the page-down key
static const int backspaceKey
key-code for the backspace key
bool isShiftDown() const noexcept
Checks whether the shift key's flag is set.
@ ctrlModifier
CTRL key flag.
@ commandModifier
Command key flag - on windows this is the same as the CTRL key flag.
@ shiftModifier
Shift key flag.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
This class is used to invoke a range of text-editor navigation methods on an object,...
static bool invokeKeyFunction(CallbackClass &target, const KeyPress &key)
Checks the keypress and invokes one of a range of navigation functions that the target class must imp...