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 {
12 
13 class XPM;
14 class RGBAImage;
15 
16 typedef void (*DrawLineMarkerFn)(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, int tFold, int marginStyle, const void *lineMarker);
17 
18 /**
19  */
20 class LineMarker {
21 public:
22 	enum class FoldPart { undefined, head, body, tail, headWithTail };
23 
24 	int markType = SC_MARK_CIRCLE;
25 	ColourDesired fore = ColourDesired(0, 0, 0);
26 	ColourDesired back = ColourDesired(0xff, 0xff, 0xff);
27 	ColourDesired backSelected = ColourDesired(0xff, 0x00, 0x00);
28 	int alpha = SC_ALPHA_NOALPHA;
29 	std::unique_ptr<XPM> pxpm;
30 	std::unique_ptr<RGBAImage> image;
31 	/** Some platforms, notably PLAT_CURSES, do not support Scintilla's native
32 	 * Draw function for drawing line markers. Allow those platforms to override
33 	 * it instead of creating a new method(s) in the Surface class that existing
34 	 * platforms must implement as empty. */
35 	DrawLineMarkerFn customDraw = nullptr;
36 
37 	LineMarker() noexcept = default;
38 	LineMarker(const LineMarker &other);
39 	LineMarker(LineMarker &&) noexcept = default;
40 	LineMarker &operator=(const LineMarker& other);
41 	LineMarker &operator=(LineMarker&&) noexcept = default;
42 	virtual ~LineMarker() = default;
43 
44 	void SetXPM(const char *textForm);
45 	void SetXPM(const char *const *linesForm);
46 	void SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage);
47 	void Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, FoldPart part, int marginStyle) const;
48 };
49 
50 }
51 
52 #endif
53