1 | /*
|
---|
2 | * 02/10/2009
|
---|
3 | *
|
---|
4 | * RSTAView.java - An <code>RSyntaxTextArea</code> view.
|
---|
5 | *
|
---|
6 | * This library is distributed under a modified BSD license. See the included
|
---|
7 | * RSyntaxTextArea.License.txt file for details.
|
---|
8 | */
|
---|
9 | package org.fife.ui.rsyntaxtextarea;
|
---|
10 |
|
---|
11 | import java.awt.Rectangle;
|
---|
12 |
|
---|
13 | import javax.swing.text.BadLocationException;
|
---|
14 |
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * Utility methods for RSyntaxTextArea's views.
|
---|
18 | *
|
---|
19 | * @author Robert Futrell
|
---|
20 | * @version 1.0
|
---|
21 | */
|
---|
22 | interface RSTAView {
|
---|
23 |
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * Returns the y-coordinate of the specified line.<p>
|
---|
27 | *
|
---|
28 | * This method is quicker than using traditional
|
---|
29 | * <code>modelToView(int)</code> calls, as the entire bounding box isn't
|
---|
30 | * computed.
|
---|
31 | *
|
---|
32 | * @param alloc The area the text area can render into.
|
---|
33 | * @param line The line number.
|
---|
34 | * @return The y-coordinate of the top of the line, or <code>-1</code> if
|
---|
35 | * this text area doesn't yet have a positive size or the line is
|
---|
36 | * hidden (i.e. from folding).
|
---|
37 | * @throws BadLocationException If <code>line</code> isn't a valid line
|
---|
38 | * number for this document.
|
---|
39 | */
|
---|
40 | public int yForLine(Rectangle alloc, int line) throws BadLocationException;
|
---|
41 |
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * Returns the y-coordinate of the line containing a specified offset.<p>
|
---|
45 | *
|
---|
46 | * This method is quicker than using traditional
|
---|
47 | * <code>modelToView(int)</code> calls, as the entire bounding box isn't
|
---|
48 | * computed.
|
---|
49 | *
|
---|
50 | * @param alloc The area the text area can render into.
|
---|
51 | * @param offs The offset info the document.
|
---|
52 | * @return The y-coordinate of the top of the offset, or <code>-1</code> if
|
---|
53 | * this text area doesn't yet have a positive size or the line is
|
---|
54 | * hidden (i.e. from folding).
|
---|
55 | * @throws BadLocationException If <code>offs</code> isn't a valid offset
|
---|
56 | * into the document.
|
---|
57 | */
|
---|
58 | public int yForLineContaining(Rectangle alloc, int offs)
|
---|
59 | throws BadLocationException;
|
---|
60 |
|
---|
61 |
|
---|
62 | } |
---|