Support more folding icon styles: arrows, +/- and no lines
[geany-mirror.git] / scintilla / Indicator.cxx
blobda9531224aee35f747ece9607bf156f3fa319fab
1 // Scintilla source code edit control
2 /** @file Indicator.cxx
3 ** Defines the style of indicators which are text decorations such as underlining.
4 **/
5 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
6 // The License.txt file describes the conditions under which this software may be distributed.
8 #include "Platform.h"
10 #include "Scintilla.h"
11 #include "Indicator.h"
13 #ifdef SCI_NAMESPACE
14 using namespace Scintilla;
15 #endif
17 void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) {
18 surface->PenColour(fore.allocated);
19 int ymid = (rc.bottom + rc.top) / 2;
20 if (style == INDIC_SQUIGGLE) {
21 surface->MoveTo(rc.left, rc.top);
22 int x = rc.left + 2;
23 int y = 2;
24 while (x < rc.right) {
25 surface->LineTo(x, rc.top + y);
26 x += 2;
27 y = 2 - y;
29 surface->LineTo(rc.right, rc.top + y); // Finish the line
30 } else if (style == INDIC_TT) {
31 surface->MoveTo(rc.left, ymid);
32 int x = rc.left + 5;
33 while (x < rc.right) {
34 surface->LineTo(x, ymid);
35 surface->MoveTo(x-3, ymid);
36 surface->LineTo(x-3, ymid+2);
37 x++;
38 surface->MoveTo(x, ymid);
39 x += 5;
41 surface->LineTo(rc.right, ymid); // Finish the line
42 if (x - 3 <= rc.right) {
43 surface->MoveTo(x-3, ymid);
44 surface->LineTo(x-3, ymid+2);
46 } else if (style == INDIC_DIAGONAL) {
47 int x = rc.left;
48 while (x < rc.right) {
49 surface->MoveTo(x, rc.top+2);
50 int endX = x+3;
51 int endY = rc.top - 1;
52 if (endX > rc.right) {
53 endY += endX - rc.right;
54 endX = rc.right;
56 surface->LineTo(endX, endY);
57 x += 4;
59 } else if (style == INDIC_STRIKE) {
60 surface->MoveTo(rc.left, rc.top - 4);
61 surface->LineTo(rc.right, rc.top - 4);
62 } else if (style == INDIC_HIDDEN) {
63 // Draw nothing
64 } else if (style == INDIC_BOX) {
65 surface->MoveTo(rc.left, ymid+1);
66 surface->LineTo(rc.right, ymid+1);
67 surface->LineTo(rc.right, rcLine.top+1);
68 surface->LineTo(rc.left, rcLine.top+1);
69 surface->LineTo(rc.left, ymid+1);
70 } else if (style == INDIC_ROUNDBOX) {
71 PRectangle rcBox = rcLine;
72 rcBox.top = rcLine.top + 1;
73 rcBox.left = rc.left;
74 rcBox.right = rc.right;
75 surface->AlphaRectangle(rcBox, 1, fore.allocated, fillAlpha, fore.allocated, 50, 0);
76 } else { // Either INDIC_PLAIN or unknown
77 surface->MoveTo(rc.left, ymid);
78 surface->LineTo(rc.right, ymid);