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 | |
10 | class KateLayoutCache; |
11 | class KateViewInternal; |
12 | |
13 | #include "ktexteditor/view.h" |
14 | |
15 | #include <QKeyEvent> |
16 | |
17 | class KateViewInternal; |
18 | class KConfigGroup; |
19 | class QKeyEvent; |
20 | namespace KTextEditor |
21 | { |
22 | class ViewPrivate; |
23 | enum class caretStyles; |
24 | class Cursor; |
25 | } |
26 | |
27 | class KateAbstractInputMode |
28 | { |
29 | protected: |
30 | KateAbstractInputMode(KateViewInternal *); |
31 | |
32 | public: |
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 */ |
77 | public: |
78 | void updateCursor(const KTextEditor::Cursor newCursor); |
79 | KateLayoutCache *layoutCache() const; |
80 | int linesDisplayed() const; |
81 | void scrollViewLines(int offset); |
82 | |
83 | protected: |
84 | KateViewInternal *viewInternal() const |
85 | { |
86 | return m_viewInternal; |
87 | } |
88 | KTextEditor::ViewPrivate *view() const |
89 | { |
90 | return m_view; |
91 | } |
92 | |
93 | private: |
94 | KateViewInternal *m_viewInternal; |
95 | KTextEditor::ViewPrivate *m_view; |
96 | }; |
97 | |
98 | #endif |
99 | |