]>
git.saurik.com Git - wxWidgets.git/blob - 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.
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
);
18 while (x
< rc
.right
) {
19 surface
->LineTo(x
, rc
.top
+ y
);
23 surface
->LineTo(rc
.right
, rc
.top
+ y
); // Finish the line
24 } else if (style
== INDIC_TT
) {
25 surface
->MoveTo(rc
.left
, ymid
);
27 while (x
< rc
.right
) {
28 surface
->LineTo(x
, ymid
);
29 surface
->MoveTo(x
-3, ymid
);
30 surface
->LineTo(x
-3, ymid
+2);
32 surface
->MoveTo(x
, ymid
);
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);
40 } else if (style
== INDIC_DIAGONAL
) {
42 while (x
< rc
.right
) {
43 surface
->MoveTo(x
, rc
.top
+2);
45 int endY
= rc
.top
- 1;
46 if (endX
> rc
.right
) {
47 endY
+= endX
- rc
.right
;
50 surface
->LineTo(endX
, endY
);
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
);