KTextEditor

annotationinterface.h
1 /* SPDX-License-Identifier: LGPL-2.0-or-later
2 
3  Copyright 2008 Andreas Pakulat <[email protected]>
4  Copyright 2008-2018 Dominik Haumann <[email protected]>
5  Copyright 2017-2018 Friedrich W. H. Kossebau <[email protected]>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 #ifndef KTEXTEDITOR_ANNOTATIONINTERFACE_H
24 #define KTEXTEDITOR_ANNOTATIONINTERFACE_H
25 
26 #include <ktexteditor_export.h>
27 
28 #include <QObject>
29 
30 class QMenu;
31 
32 namespace KTextEditor
33 {
34 class View;
35 class AbstractAnnotationItemDelegate;
36 
55 class KTEXTEDITOR_EXPORT AnnotationModel : public QObject
56 {
57  Q_OBJECT
58 public:
59  virtual ~AnnotationModel()
60  {
61  }
62 
63  enum { GroupIdentifierRole = Qt::UserRole };
64  // KF6: add AnnotationModelUserRole = Qt::UserRole + 0x100
65 
86  virtual QVariant data(int line, Qt::ItemDataRole role) const = 0; // KF6: use int for role
87 
88 Q_SIGNALS:
99  void reset();
100 
108  void lineChanged(int line);
109 };
110 
162 class KTEXTEDITOR_EXPORT AnnotationInterface
163 {
164 public:
165  virtual ~AnnotationInterface()
166  {
167  }
168 
175  virtual void setAnnotationModel(AnnotationModel *model) = 0;
176 
182  virtual AnnotationModel *annotationModel() const = 0;
183 };
184 
223 class KTEXTEDITOR_EXPORT AnnotationViewInterface : public AnnotationInterface
224 {
225 public:
226  virtual ~AnnotationViewInterface()
227  {
228  }
229 
236  virtual void setAnnotationBorderVisible(bool visible) = 0;
237 
241  virtual bool isAnnotationBorderVisible() const = 0;
242 
243  //
244  // SIGNALS!!!
245  //
246 public:
258  virtual void annotationContextMenuAboutToShow(KTextEditor::View *view, QMenu *menu, int line) = 0;
259 
268  virtual void annotationActivated(KTextEditor::View *view, int line) = 0;
269 
276  virtual void annotationBorderVisibilityChanged(KTextEditor::View *view, bool visible) = 0;
277 };
278 
316 class KTEXTEDITOR_EXPORT AnnotationViewInterfaceV2 : public AnnotationViewInterface
317 {
318  // KF6: Merge KTextEditor::AnnotationViewInterfaceV2 into KTextEditor::AnnotationViewInterface (kossebau)
319 public:
320  virtual ~AnnotationViewInterfaceV2()
321  {
322  }
323 
331  virtual void setAnnotationItemDelegate(KTextEditor::AbstractAnnotationItemDelegate *delegate) = 0;
332 
338  virtual KTextEditor::AbstractAnnotationItemDelegate *annotationItemDelegate() const = 0;
339 
349  virtual void setAnnotationUniformItemSizes(bool uniformItemSizes) = 0;
350 
354  virtual bool uniformAnnotationItemSizes() const = 0;
355 };
356 
357 }
358 
359 Q_DECLARE_INTERFACE(KTextEditor::AnnotationInterface, "org.kde.KTextEditor.AnnotationInterface")
360 Q_DECLARE_INTERFACE(KTextEditor::AnnotationViewInterface, "org.kde.KTextEditor.AnnotationViewInterface")
361 Q_DECLARE_INTERFACE(KTextEditor::AnnotationViewInterfaceV2, "org.kde.KTextEditor.AnnotationViewInterfaceV2")
362 
363 #endif
Annotation interface for the View, version 2.
A delegate for rendering line annotation information and handling events.
void setAnnotationModel(KTextEditor::AnnotationModel *model) override
Sets a new AnnotationModel for this document to provide annotation information for each line...
UserRole
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
An model for providing line annotation information.
KTextEditor::AnnotationModel * annotationModel() const override
returns the currently set AnnotationModel or 0 if there&#39;s none set
Annotation interface for the View.
A text widget with KXMLGUIClient that represents a Document.
Definition: view.h:155
A Document extension interface for handling Annotations.
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.