KTextEditor

annotationinterface.h
1 /*
2  SPDX-FileCopyrightText: 2008 Andreas Pakulat <[email protected]>
3  SPDX-FileCopyrightText: 2008-2018 Dominik Haumann <[email protected]>
4  SPDX-FileCopyrightText: 2017-2018 Friedrich W. H. Kossebau <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #ifndef KTEXTEDITOR_ANNOTATIONINTERFACE_H
10 #define KTEXTEDITOR_ANNOTATIONINTERFACE_H
11 
12 #include <ktexteditor_export.h>
13 
14 #include <QObject>
15 
16 class QMenu;
17 
18 namespace KTextEditor
19 {
20 class View;
21 class AbstractAnnotationItemDelegate;
22 
41 class KTEXTEDITOR_EXPORT AnnotationModel : public QObject
42 {
43  Q_OBJECT
44 public:
45  virtual ~AnnotationModel()
46  {
47  }
48 
49  enum { GroupIdentifierRole = Qt::UserRole };
50  // KF6: add AnnotationModelUserRole = Qt::UserRole + 0x100
51 
72  virtual QVariant data(int line, Qt::ItemDataRole role) const = 0; // KF6: use int for role
73 
74 Q_SIGNALS:
85  void reset();
86 
94  void lineChanged(int line);
95 };
96 
148 class KTEXTEDITOR_EXPORT AnnotationInterface
149 {
150 public:
151  virtual ~AnnotationInterface()
152  {
153  }
154 
161  virtual void setAnnotationModel(AnnotationModel *model) = 0;
162 
168  virtual AnnotationModel *annotationModel() const = 0;
169 };
170 
209 class KTEXTEDITOR_EXPORT AnnotationViewInterface : public AnnotationInterface
210 {
211 public:
212  virtual ~AnnotationViewInterface()
213  {
214  }
215 
222  virtual void setAnnotationBorderVisible(bool visible) = 0;
223 
227  virtual bool isAnnotationBorderVisible() const = 0;
228 
229  //
230  // SIGNALS!!!
231  //
232 public:
244  virtual void annotationContextMenuAboutToShow(KTextEditor::View *view, QMenu *menu, int line) = 0;
245 
254  virtual void annotationActivated(KTextEditor::View *view, int line) = 0;
255 
262  virtual void annotationBorderVisibilityChanged(KTextEditor::View *view, bool visible) = 0;
263 };
264 
302 class KTEXTEDITOR_EXPORT AnnotationViewInterfaceV2 : public AnnotationViewInterface
303 {
304  // KF6: Merge KTextEditor::AnnotationViewInterfaceV2 into KTextEditor::AnnotationViewInterface (kossebau)
305 public:
306  virtual ~AnnotationViewInterfaceV2()
307  {
308  }
309 
317  virtual void setAnnotationItemDelegate(KTextEditor::AbstractAnnotationItemDelegate *delegate) = 0;
318 
324  virtual KTextEditor::AbstractAnnotationItemDelegate *annotationItemDelegate() const = 0;
325 
335  virtual void setAnnotationUniformItemSizes(bool uniformItemSizes) = 0;
336 
340  virtual bool uniformAnnotationItemSizes() const = 0;
341 };
342 
343 }
344 
345 Q_DECLARE_INTERFACE(KTextEditor::AnnotationInterface, "org.kde.KTextEditor.AnnotationInterface")
346 Q_DECLARE_INTERFACE(KTextEditor::AnnotationViewInterface, "org.kde.KTextEditor.AnnotationViewInterface")
347 Q_DECLARE_INTERFACE(KTextEditor::AnnotationViewInterfaceV2, "org.kde.KTextEditor.AnnotationViewInterfaceV2")
348 
349 #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...
Definition: katetextblock.h:21
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:146
A Document extension interface for handling Annotations.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Jan 19 2021 23:00:12 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.