KTextEditor

activemode.h
1/*
2 SPDX-FileCopyrightText: 2013-2016 Simon St James <kdedevel@etotheipiplusone.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KATEVI_EMULATED_COMMAND_BAR_ACTIVEMODE_H
8#define KATEVI_EMULATED_COMMAND_BAR_ACTIVEMODE_H
9
10#include "completer.h"
11
12class QKeyEvent;
13class QString;
14class QWidget;
15
16namespace KTextEditor
17{
18class Cursor;
19class Range;
20class ViewPrivate;
21}
22
23namespace KateVi
24{
25class EmulatedCommandBar;
26struct CompletionStartParams;
27class MatchHighlighter;
28class InputModeManager;
29
30class ActiveMode
31{
32public:
33 ActiveMode(EmulatedCommandBar *emulatedCommandBar, MatchHighlighter *matchHighlighter, InputModeManager *viInputModeManager, KTextEditor::ViewPrivate *view)
34 : m_emulatedCommandBar(emulatedCommandBar)
35 , m_viInputModeManager(viInputModeManager)
36 , m_view(view)
37 , m_matchHighligher(matchHighlighter)
38 {
39 }
40 virtual ~ActiveMode() = 0;
41 virtual bool handleKeyPress(const QKeyEvent *keyEvent) = 0;
42 virtual void editTextChanged(const QString &newText)
43 {
44 Q_UNUSED(newText);
45 }
46 virtual KateVi::CompletionStartParams completionInvoked(Completer::CompletionInvocation invocationType);
47 virtual void completionChosen()
48 {
49 }
50 virtual void deactivate(bool wasAborted) = 0;
51 void setViInputModeManager(InputModeManager *viInputModeManager);
52
53protected:
54 // Helper methods.
55 void hideAllWidgetsExcept(QWidget *widgetToKeepVisible);
56 void updateMatchHighlight(KTextEditor::Range matchRange);
57 void close(bool wasAborted);
58 void closeWithStatusMessage(const QString &exitStatusMessage);
59 void startCompletion(const CompletionStartParams &completionStartParams);
60 void moveCursorTo(const KTextEditor::Cursor cursorPos);
61 EmulatedCommandBar *emulatedCommandBar();
62 KTextEditor::ViewPrivate *view();
63 InputModeManager *viInputModeManager();
64
65private:
66 EmulatedCommandBar *m_emulatedCommandBar = nullptr;
67 InputModeManager *m_viInputModeManager = nullptr;
68 KTextEditor::ViewPrivate *m_view = nullptr;
69 MatchHighlighter *m_matchHighligher = nullptr;
70};
71}
72#endif
The Cursor represents a position in a Document.
Definition cursor.h:75
An object representing a section of text, from one Cursor to another.
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:07:22 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.