]> git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/src/Indicator.cxx
More theme goodies.
[wxWidgets.git] / src / stc / scintilla / src / Indicator.cxx
1 // Scintilla source code edit control
2 // Indicator.cxx - defines the style of indicators which are text decorations such as underlining
3 // Copyright 1998-2000 by Neil Hodgson <neilh@scintilla.org>
4 // The License.txt file describes the conditions under which this software may be distributed.
5
6 #include "Platform.h"
7
8 #include "Scintilla.h"
9 #include "Indicator.h"
10
11 void Indicator::Draw(Surface *surface, PRectangle &rc) {
12 surface->PenColour(fore.allocated);
13 int ymid = (rc.bottom + rc.top) / 2;
14 if (style == INDIC_SQUIGGLE) {
15 surface->MoveTo(rc.left, rc.top);
16 int x = rc.left + 2;
17 int y = 2;
18 while (x < rc.right) {
19 surface->LineTo(x, rc.top + y);
20 x += 2;
21 y = 2 - y;
22 }
23 surface->LineTo(rc.right, rc.top + y); // Finish the line
24 } else if (style == INDIC_TT) {
25 surface->MoveTo(rc.left, ymid);
26 int x = rc.left + 5;
27 while (x < rc.right) {
28 surface->LineTo(x, ymid);
29 surface->MoveTo(x-3, ymid);
30 surface->LineTo(x-3, ymid+2);
31 x++;
32 surface->MoveTo(x, ymid);
33 x += 5;
34 }
35 surface->LineTo(rc.right, ymid); // Finish the line
36 if (x - 3 <= rc.right) {
37 surface->MoveTo(x-3, ymid);
38 surface->LineTo(x-3, ymid+2);
39 }
40 } else if (style == INDIC_DIAGONAL) {
41 int x = rc.left;
42 while (x < rc.right) {
43 surface->MoveTo(x, rc.top+2);
44 int endX = x+3;
45 int endY = rc.top - 1;
46 if (endX > rc.right) {
47 endY += endX - rc.right;
48 endX = rc.right;
49 }
50 surface->LineTo(endX, endY);
51 x += 4;
52 }
53 } else if (style == INDIC_STRIKE) {
54 surface->MoveTo(rc.left, rc.top - 4);
55 surface->LineTo(rc.right, rc.top - 4);
56 } else { // Either INDIC_PLAIN or unknown
57 surface->MoveTo(rc.left, ymid);
58 surface->LineTo(rc.right, ymid);
59 }
60 }
61