KTextEditor

codecompletioninterface.h
1 /* SPDX-License-Identifier: LGPL-2.0-or-later
2 
3  Copyright (C) 2005-2006 Hamish Rodda <[email protected]>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #ifndef KTEXTEDITOR_CODECOMPLETIONINTERFACE_H
22 #define KTEXTEDITOR_CODECOMPLETIONINTERFACE_H
23 
24 #include <QObject>
25 #include <ktexteditor/range.h>
26 #include <ktexteditor/codecompletionmodel.h>
27 #include <ktexteditor_export.h>
28 
29 namespace KTextEditor
30 {
31 class CodeCompletionModel;
32 
98 class KTEXTEDITOR_EXPORT CodeCompletionInterface
99 {
100 public:
101  virtual ~CodeCompletionInterface();
102 
106  virtual bool isCompletionActive() const = 0;
107 
111  virtual void startCompletion(const Range &word, CodeCompletionModel *model) = 0;
112 
119  virtual void abortCompletion() = 0;
120 
125  virtual void forceCompletion() = 0;
126 
132  virtual void registerCompletionModel(CodeCompletionModel *model) = 0;
133 
139  virtual void unregisterCompletionModel(CodeCompletionModel *model) = 0;
140 
144  virtual bool isAutomaticInvocationEnabled() const = 0;
145 
149  virtual void setAutomaticInvocationEnabled(bool enabled = true) = 0;
150 
151  // Q_SIGNALS:
152  // void completionExecuted(KTextEditor::View* view, const KTextEditor::Cursor& position, KTextEditor::CodeCompletionModel* model, int row);
153  // void completionAborted(KTextEditor::View* view);
154 };
155 
188 class KTEXTEDITOR_EXPORT CodeCompletionInterfaceV2 : public CodeCompletionInterface
189 {
190  // KF6: Merge KTextEditor::CodeCompletionInterfaceV2 into KTextEditor::CodeCompletionInterface
191 public:
192  virtual ~CodeCompletionInterfaceV2();
197  virtual void startCompletion(const Range &word, const QList<CodeCompletionModel *> &models = QList<CodeCompletionModel *>(), CodeCompletionModel::InvocationType invocationType = CodeCompletionModel::ManualInvocation) = 0;
199 
205  virtual QList<CodeCompletionModel*> codeCompletionModels() const = 0;
206 };
207 
208 }
209 
210 Q_DECLARE_INTERFACE(KTextEditor::CodeCompletionInterface, "org.kde.KTextEditor.CodeCompletionInterface")
211 Q_DECLARE_INTERFACE(KTextEditor::CodeCompletionInterfaceV2, "org.kde.KTextEditor.CodeCompletionInterfaceV2")
212 
213 #endif // KTEXTEDITOR_CODECOMPLETIONINTERFACE_H
Code completion extension interface for the View, version 2.
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
An object representing a section of text, from one Cursor to another.
Code completion extension interface for the View.
virtual void startCompletion(const Range &word, CodeCompletionModel *model)=0
Invoke code completion over a given range, with a specific model.
An item model for providing code completion, and meta information for enhanced presentation.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Aug 10 2020 23:01:30 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.