]>
git.saurik.com Git - wxWidgets.git/blob - contrib/src/stc/scintilla/src/Indicator.cxx
a42abb2037de1583aec37833bad773f3f1bd17f0
1 // Scintilla source code edit control
2 /** @file Indicator.cxx
3 ** Defines the style of indicators which are text decorations such as underlining.
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.
10 #include "Scintilla.h"
11 #include "Indicator.h"
13 void Indicator::Draw(Surface
*surface
, const PRectangle
&rc
, const PRectangle
&rcLine
) {
14 surface
->PenColour(fore
.allocated
);
15 int ymid
= (rc
.bottom
+ rc
.top
) / 2;
16 if (style
== INDIC_SQUIGGLE
) {
17 surface
->MoveTo(rc
.left
, rc
.top
);
20 while (x
< rc
.right
) {
21 surface
->LineTo(x
, rc
.top
+ y
);
25 surface
->LineTo(rc
.right
, rc
.top
+ y
); // Finish the line
26 } else if (style
== INDIC_TT
) {
27 surface
->MoveTo(rc
.left
, ymid
);
29 while (x
< rc
.right
) {
30 surface
->LineTo(x
, ymid
);
31 surface
->MoveTo(x
-3, ymid
);
32 surface
->LineTo(x
-3, ymid
+2);
34 surface
->MoveTo(x
, ymid
);
37 surface
->LineTo(rc
.right
, ymid
); // Finish the line
38 if (x
- 3 <= rc
.right
) {
39 surface
->MoveTo(x
-3, ymid
);
40 surface
->LineTo(x
-3, ymid
+2);
42 } else if (style
== INDIC_DIAGONAL
) {
44 while (x
< rc
.right
) {
45 surface
->MoveTo(x
, rc
.top
+2);
47 int endY
= rc
.top
- 1;
48 if (endX
> rc
.right
) {
49 endY
+= endX
- rc
.right
;
52 surface
->LineTo(endX
, endY
);
55 } else if (style
== INDIC_STRIKE
) {
56 surface
->MoveTo(rc
.left
, rc
.top
- 4);
57 surface
->LineTo(rc
.right
, rc
.top
- 4);
58 } else if (style
== INDIC_HIDDEN
) {
60 } else if (style
== INDIC_BOX
) {
61 surface
->MoveTo(rc
.left
, ymid
+1);
62 surface
->LineTo(rc
.right
, ymid
+1);
63 surface
->LineTo(rc
.right
, rcLine
.top
+1);
64 surface
->LineTo(rc
.left
, rcLine
.top
+1);
65 surface
->LineTo(rc
.left
, ymid
+1);
66 } else { // Either INDIC_PLAIN or unknown
67 surface
->MoveTo(rc
.left
, ymid
);
68 surface
->LineTo(rc
.right
, ymid
);