KTextEditor

markinterface.h
1 /*
2  SPDX-FileCopyrightText: 2001 Christoph Cullmann <[email protected]>
3 
4  Documentation:
5  SPDX-FileCopyrightText: 2005 Dominik Haumann <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.0-or-later
8 */
9 
10 #ifndef KTEXTEDITOR_MARKINTERFACE_H
11 #define KTEXTEDITOR_MARKINTERFACE_H
12 
13 #include <ktexteditor_export.h>
14 
15 #include <QHash>
16 #include <QObject>
17 
18 class QIcon;
19 class QPixmap;
20 class QPoint;
21 class QMenu;
22 
23 namespace KTextEditor
24 {
25 class Document;
26 
42 class Mark
43 {
44 public:
46  int line;
47 
49  uint type;
50 };
51 
112 class KTEXTEDITOR_EXPORT MarkInterface
113 {
114 public:
115  MarkInterface();
116 
120  virtual ~MarkInterface();
121 
122  //
123  // slots !!!
124  //
125 public:
133  virtual uint mark(int line) = 0;
134 
148  virtual void setMark(int line, uint markType) = 0;
149 
155  virtual void clearMark(int line) = 0;
156 
165  virtual void addMark(int line, uint markType) = 0;
166 
173  virtual void removeMark(int line, uint markType) = 0;
174 
180  virtual const QHash<int, KTextEditor::Mark *> &marks() = 0;
181 
186  virtual void clearMarks() = 0;
188 
195  static int reservedMarkersCount()
196  {
197  return 7;
198  }
199 
206  enum MarkTypes {
208  markType01 = 0x1,
210  markType02 = 0x2,
212  markType03 = 0x4,
214  markType04 = 0x8,
216  markType05 = 0x10,
218  markType06 = 0x20,
220  markType07 = 0x40,
221 
222  markType08 = 0x80,
223  markType09 = 0x100,
224  markType10 = 0x200,
225  markType11 = 0x400,
226  markType12 = 0x800,
227  markType13 = 0x1000,
228  markType14 = 0x2000,
229  markType15 = 0x4000,
230  markType16 = 0x8000,
231  markType17 = 0x10000,
232  markType18 = 0x20000,
233  markType19 = 0x40000,
234  markType20 = 0x80000,
235  markType21 = 0x100000,
236  markType22 = 0x200000,
237  markType23 = 0x400000,
238  markType24 = 0x800000,
239  markType25 = 0x1000000,
240  markType26 = 0x2000000,
241  markType27 = 0x4000000,
242  markType28 = 0x8000000,
243  markType29 = 0x10000000,
244  markType30 = 0x20000000,
245  markType31 = 0x40000000,
246  markType32 = 0x80000000,
247  /* reserved marks */
248  Bookmark = markType01,
249  BreakpointActive = markType02,
250  BreakpointReached = markType03,
251  BreakpointDisabled = markType04,
252  Execution = markType05,
253  Warning = markType06,
254  Error = markType07,
255  SearchMatch = markType32,
256  };
257 
258  //
259  // signals !!!
260  //
261 public:
267  virtual void marksChanged(KTextEditor::Document *document) = 0;
268 
269  /*
270  * Methods to modify mark properties.
271  */
272 public:
279  virtual void setMarkPixmap(MarkTypes mark, const QPixmap &pixmap) = 0;
280 
287  virtual QPixmap markPixmap(MarkTypes mark) const = 0;
288 
295  virtual void setMarkDescription(MarkTypes mark, const QString &text) = 0;
296 
304  virtual QString markDescription(MarkTypes mark) const = 0;
305 
325  virtual void setEditableMarks(uint markMask) = 0;
326 
334  virtual uint editableMarks() const = 0;
335 
341  MarkAdded = 0,
343  };
344 
345  //
346  // signals !!!
347  //
348 public:
356  virtual void markChanged(KTextEditor::Document *document, KTextEditor::Mark mark, KTextEditor::MarkInterface::MarkChangeAction action) = 0;
357 
358 Q_SIGNALS:
359 
368  void markToolTipRequested(KTextEditor::Document *document, KTextEditor::Mark mark, QPoint position, bool &handled);
369 
378  void markContextMenuRequested(KTextEditor::Document *document, KTextEditor::Mark mark, QPoint pos, bool &handled);
379 
386  void markClicked(KTextEditor::Document *document, KTextEditor::Mark mark, bool &handled);
387 
388 private:
389  class MarkInterfacePrivate *const d = nullptr;
390 };
391 
423 class KTEXTEDITOR_EXPORT MarkInterfaceV2 : public MarkInterface
424 {
425  // KF6: Merge KTextEditor::MarkInterfaceV2 into KTextEditor::MarkInterface, drop QPixmap API (kossebau)
426 public:
427  virtual ~MarkInterfaceV2()
428  {
429  }
430 
437  virtual void setMarkIcon(MarkTypes markType, const QIcon &icon) = 0;
438 
445  virtual QIcon markIcon(MarkTypes markType) const = 0;
446 };
447 
448 }
449 
450 Q_DECLARE_INTERFACE(KTextEditor::MarkInterface, "org.kde.KTextEditor.MarkInterface")
451 Q_DECLARE_INTERFACE(KTextEditor::MarkInterfaceV2, "org.kde.KTextEditor.MarkInterfaceV2")
452 
453 #endif
Mark extension interface for the Document.
QString markDescription(MarkInterface::MarkTypes) const override
Get the mark&#39;s description to text.
const QHash< int, KTextEditor::Mark * > & marks() override
Get a hash holding all marks in the document.
MarkChangeAction
Possible actions on a mark.
A KParts derived class representing a text document.
Definition: document.h:185
Type type(const QSqlDatabase &db)
action: a mark was removed.
virtual ~MarkInterface()
Virtual destructor.
uint mark(int line) override
Get all marks set on the line.
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Definition: katetextblock.h:21
Mark extension interface for the Document, version 2.
MarkTypes
Predefined mark types.
action: a mark was added.
static int reservedMarkersCount()
Get the number of predefined mark types we have so far.
QIcon markIcon(MarkInterface::MarkTypes markType) const override
Get the mark&#39;s icon.
uint editableMarks() const override
Get, which marks can be toggled by the user.
QPixmap markPixmap(MarkInterface::MarkTypes) const override
Get the mark&#39;s pixmap.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jan 27 2021 22:56:57 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.