1 | /** @file Decoration.h |
2 | ** Visual elements added over text. |
3 | **/ |
4 | // Copyright 1998-2007 by Neil Hodgson <neilh@scintilla.org> |
5 | // The License.txt file describes the conditions under which this software may be distributed. |
6 | |
7 | #ifndef DECORATION_H |
8 | #define DECORATION_H |
9 | |
10 | #include "Position.h" |
11 | #include "RunStyles.h" |
12 | |
13 | #include <vector> |
14 | #include <memory> |
15 | |
16 | namespace Scintilla::Internal { |
17 | |
18 | class IDecoration { |
19 | public: |
20 | virtual ~IDecoration() {} |
21 | virtual bool Empty() const noexcept = 0; |
22 | virtual int Indicator() const noexcept = 0; |
23 | virtual Sci::Position Length() const noexcept = 0; |
24 | virtual int ValueAt(Sci::Position position) const noexcept = 0; |
25 | virtual Sci::Position StartRun(Sci::Position position) const noexcept = 0; |
26 | virtual Sci::Position EndRun(Sci::Position position) const noexcept = 0; |
27 | virtual void SetValueAt(Sci::Position position, int value) = 0; |
28 | virtual void InsertSpace(Sci::Position position, Sci::Position insertLength) = 0; |
29 | virtual Sci::Position Runs() const noexcept = 0; |
30 | }; |
31 | |
32 | class IDecorationList { |
33 | public: |
34 | virtual ~IDecorationList() {} |
35 | |
36 | virtual const std::vector<const IDecoration*> &View() const noexcept = 0; |
37 | |
38 | virtual void SetCurrentIndicator(int indicator) = 0; |
39 | virtual int GetCurrentIndicator() const noexcept = 0; |
40 | |
41 | virtual void SetCurrentValue(int value) = 0; |
42 | virtual int GetCurrentValue() const noexcept = 0; |
43 | |
44 | // Returns with changed=true if some values may have changed |
45 | virtual FillResult<Sci::Position> FillRange(Sci::Position position, int value, Sci::Position fillLength) = 0; |
46 | virtual void InsertSpace(Sci::Position position, Sci::Position insertLength) = 0; |
47 | virtual void DeleteRange(Sci::Position position, Sci::Position deleteLength) = 0; |
48 | virtual void DeleteLexerDecorations() = 0; |
49 | |
50 | virtual int AllOnFor(Sci::Position position) const noexcept = 0; |
51 | virtual int ValueAt(int indicator, Sci::Position position) noexcept = 0; |
52 | virtual Sci::Position Start(int indicator, Sci::Position position) noexcept = 0; |
53 | virtual Sci::Position End(int indicator, Sci::Position position) noexcept = 0; |
54 | |
55 | virtual bool ClickNotified() const noexcept = 0; |
56 | virtual void SetClickNotified(bool notified) noexcept = 0; |
57 | }; |
58 | |
59 | std::unique_ptr<IDecoration> DecorationCreate(bool largeDocument, int indicator); |
60 | |
61 | std::unique_ptr<IDecorationList> DecorationListCreate(bool largeDocument); |
62 | |
63 | } |
64 | |
65 | #endif |
66 | |