1/*
2 SPDX-FileCopyrightText: KDE Developers
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KATE_ABSTRACT_INPUT_MODE_H
8#define KATE_ABSTRACT_INPUT_MODE_H
9
10class KateLayoutCache;
11class KateViewInternal;
12
13#include "ktexteditor/view.h"
14
15#include <QKeyEvent>
16
17class KateViewInternal;
18class KConfigGroup;
19class QKeyEvent;
20namespace KTextEditor
21{
22class ViewPrivate;
23enum class caretStyles;
24class Cursor;
25}
26
27class KateAbstractInputMode
28{
29protected:
30 KateAbstractInputMode(KateViewInternal *);
31
32public:
33 virtual ~KateAbstractInputMode() = default;
34
35 virtual KTextEditor::View::ViewMode viewMode() const = 0;
36 virtual QString viewModeHuman() const = 0;
37 virtual KTextEditor::View::InputMode viewInputMode() const = 0;
38 virtual QString viewInputModeHuman() const = 0;
39
40 virtual void activate() = 0;
41 virtual void deactivate() = 0;
42 virtual void reset() = 0;
43
44 virtual bool overwrite() const = 0;
45 virtual void overwrittenChar(const QChar &) = 0;
46 virtual void clearSelection() = 0;
47 virtual bool stealKey(QKeyEvent *k) = 0;
48
49 virtual void gotFocus() = 0;
50 virtual void lostFocus() = 0;
51
52 virtual void readSessionConfig(const KConfigGroup &config) = 0;
53 virtual void writeSessionConfig(KConfigGroup &config) = 0;
54 virtual void updateRendererConfig() = 0;
55 virtual void updateConfig() = 0;
56 virtual void readWriteChanged(bool rw) = 0;
57
58 virtual void find() = 0;
59 virtual void findSelectedForwards() = 0;
60 virtual void findSelectedBackwards() = 0;
61 virtual void findReplace() = 0;
62 virtual void findNext() = 0;
63 virtual void findPrevious() = 0;
64
65 virtual void activateCommandLine() = 0;
66
67 virtual bool keyPress(QKeyEvent *) = 0;
68 virtual bool blinkCaret() const = 0;
69 virtual KTextEditor::caretStyles caretStyle() const = 0;
70
71 virtual void toggleInsert() = 0;
72 virtual void launchInteractiveCommand(const QString &command) = 0;
73
74 virtual QString bookmarkLabel(int line) const = 0;
75
76 /* functions that are currently view private, but vi-mode needs to access them */
77public:
78 void updateCursor(const KTextEditor::Cursor newCursor);
79 KateLayoutCache *layoutCache() const;
80 int linesDisplayed() const;
81 void scrollViewLines(int offset);
82
83protected:
84 KateViewInternal *viewInternal() const
85 {
86 return m_viewInternal;
87 }
88 KTextEditor::ViewPrivate *view() const
89 {
90 return m_view;
91 }
92
93private:
94 KateViewInternal *m_viewInternal;
95 KTextEditor::ViewPrivate *m_view;
96};
97
98#endif
99

source code of ktexteditor/src/inputmode/kateabstractinputmode.h