KTextEditor

foldinginterface.h
1 /* SPDX-License-Identifier: LGPL-2.0-or-later
2 
3  Copyright (C) 2013 Christoph Cullmann <[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_FOLDINGINTERFACE_H
22 #define KTEXTEDITOR_FOLDINGINTERFACE_H
23 
24 // #include <ktexteditor_export.h>
25 
26 #include <QFlags>
27 
28 namespace KTextEditor
29 {
30 class Range;
31 
38 class KTEXTEDITOR_EXPORT FoldingInterface
39 {
40 public:
46 
50  virtual ~FoldingInterface();
51 
59  Persistent = 0x1,
60 
64  Folded = 0x2
65  };
66  Q_DECLARE_FLAGS(FoldingRangeFlags, FoldingRangeFlag);
67 
82  qint64 newFoldingRange(const KTextEditor::Range &range, FoldingRangeFlags flags = FoldingRangeFlags());
83 
89  virtual bool foldRange(qint64 id) = 0;
90 
98  virtual bool unfoldRange(qint64 id, bool remove = false) = 0;
99 
106  virtual QVector<QPair<qint64, FoldingRangeFlags>> foldingRangesStartingOnLine(int line) const = 0;
107 
113  virtual bool lineContainsStartFoldingRanges(int line) const = 0;
114 
120  virtual qint64 foldLine(int line) const = 0;
121 
127  virtual bool unfoldLine(int line) const = 0;
128 
146  virtual bool isLineVisible(int line, qint64 *foldedRangeId = 0) const = 0;
147 
153  virtual void ensureLineIsVisible(int line) = 0;
154 
160  virtual int visibleLines() const = 0;
161 
169  virtual int lineToVisibleLine(int line) const = 0;
170 
178  virtual int visibleLineToLine(int visibleLine) const = 0;
179 
184 public Q_SLOTS:
189  void clear();
190 
191 Q_SIGNALS:
196  void foldingRangesChanged();
197 };
198 
199 }
200 
201 Q_DECLARE_OPERATORS_FOR_FLAGS(KTextEditor::FoldingInterface::FoldingRangeFlags)
202 
203 #endif
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.
FoldingRangeFlag
Folding state of a range.
KTextEditor interface for code folding of a KTextEditor::View.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Aug 7 2020 22:55:42 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.