1 | // Scintilla source code edit control |
2 | /** @file LineMarker.h |
3 | ** Defines the look of a line marker in the margin . |
4 | **/ |
5 | // Copyright 1998-2011 by Neil Hodgson <neilh@scintilla.org> |
6 | // The License.txt file describes the conditions under which this software may be distributed. |
7 | |
8 | #ifndef LINEMARKER_H |
9 | #define LINEMARKER_H |
10 | |
11 | namespace Scintilla::Internal { |
12 | |
13 | class XPM; |
14 | class RGBAImage; |
15 | |
16 | typedef void (*DrawLineMarkerFn)(Surface *surface, const PRectangle &rcWhole, const Font *fontForCharacter, int tFold, Scintilla::MarginType marginStyle, const void *lineMarker); |
17 | |
18 | /** |
19 | */ |
20 | class LineMarker { |
21 | public: |
22 | enum class FoldPart { undefined, head, body, tail, headWithTail }; |
23 | |
24 | Scintilla::MarkerSymbol markType = Scintilla::MarkerSymbol::Circle; |
25 | ColourRGBA fore = ColourRGBA(0, 0, 0); |
26 | ColourRGBA back = ColourRGBA(0xff, 0xff, 0xff); |
27 | ColourRGBA backSelected = ColourRGBA(0xff, 0x00, 0x00); |
28 | Scintilla::Layer layer = Scintilla::Layer::Base; |
29 | Scintilla::Alpha alpha = Scintilla::Alpha::NoAlpha; |
30 | XYPOSITION strokeWidth = 1.0f; |
31 | std::unique_ptr<XPM> pxpm; |
32 | std::unique_ptr<RGBAImage> image; |
33 | /** Some platforms, notably PLAT_CURSES, do not support Scintilla's native |
34 | * Draw function for drawing line markers. Allow those platforms to override |
35 | * it instead of creating a new method(s) in the Surface class that existing |
36 | * platforms must implement as empty. */ |
37 | DrawLineMarkerFn customDraw = nullptr; |
38 | |
39 | LineMarker() noexcept = default; |
40 | LineMarker(const LineMarker &other); |
41 | LineMarker(LineMarker &&) noexcept = default; |
42 | LineMarker &operator=(const LineMarker& other); |
43 | LineMarker &operator=(LineMarker&&) noexcept = default; |
44 | virtual ~LineMarker() = default; |
45 | |
46 | ColourRGBA BackWithAlpha() const noexcept; |
47 | |
48 | void SetXPM(const char *textForm); |
49 | void SetXPM(const char *const *linesForm); |
50 | void SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage); |
51 | void AlignedPolygon(Surface *surface, const Point *pts, size_t npts) const; |
52 | void Draw(Surface *surface, const PRectangle &rcWhole, const Font *fontForCharacter, FoldPart part, Scintilla::MarginType marginStyle) const; |
53 | void DrawFoldingMark(Surface *surface, const PRectangle &rcWhole, FoldPart part) const; |
54 | }; |
55 | |
56 | } |
57 | |
58 | #endif |
59 | |