001: /*
002: * Sun Public License Notice
003: *
004: * The contents of this file are subject to the Sun Public License
005: * Version 1.0 (the "License"). You may not use this file except in
006: * compliance with the License. A copy of the License is available at
007: * http://www.sun.com/
008: *
009: * The Original Code is NetBeans. The Initial Developer of the Original
010: * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
011: * Microsystems, Inc. All Rights Reserved.
012: */
013:
014: package org.netbeans.editor;
015:
016: import java.awt.Color;
017: import java.awt.Font;
018:
019: /**
020: * This interface provides methods for getting and setting various drawing
021: * attributes. During painting draw layer receives draw context and it is
022: * expected to either leave draw parameters as they are or change them.
023: *
024: * @author Miloslav Metelka
025: * @version 1.00
026: */
027:
028: public interface DrawContext {
029:
030: /** Get current foreground color */
031: public Color getForeColor();
032:
033: /** Set current foreground color */
034: public void setForeColor(Color foreColor);
035:
036: /** Get current background color */
037: public Color getBackColor();
038:
039: /** Set current background color */
040: public void setBackColor(Color backColor);
041:
042: /** Get current underline color */
043: public Color getUnderlineColor();
044:
045: /** Set current underline color */
046: public void setUnderlineColor(Color underlineColor);
047:
048: /** Get current strike-through color */
049: public Color getStrikeThroughColor();
050:
051: /** Set current underline color */
052: public void setStrikeThroughColor(Color strikeThroughColor);
053:
054: /** Get current font */
055: public Font getFont();
056:
057: /** Set current font */
058: public void setFont(Font font);
059:
060: /**
061: * Get start position of the drawing. This value stays unchanged during the
062: * line-number drawing.
063: */
064: public int getStartOffset();
065:
066: /**
067: * Get end position of the drawing. This value stays unchanged during the
068: * line-number drawing.
069: */
070: public int getEndOffset();
071:
072: /**
073: * Is current drawing position at the begining of the line? This flag is
074: * undefined for the line-number drawing.
075: */
076: public boolean isBOL();
077:
078: /**
079: * Is current drawing position at the end of the line This flag is undefined
080: * for the line-number drawing.
081: */
082: public boolean isEOL();
083:
084: /** Get draw info for the component that is currently drawn. */
085: public EditorUI getEditorUI();
086:
087: /**
088: * Get token type number according to the appropriate syntax scanner
089: */
090: public TokenID getTokenID();
091:
092: /** Get the token-context-path for the token */
093: public TokenContextPath getTokenContextPath();
094:
095: /** Get starting position in the document of the token being drawn */
096: public int getTokenOffset();
097:
098: /** Get length of the token text */
099: public int getTokenLength();
100:
101: /**
102: * Get the starting position in the document of the fragment of the token
103: * being drawn.
104: */
105: public int getFragmentOffset();
106:
107: /**
108: * Get the length of the fragment of the token being drawn
109: */
110: public int getFragmentLength();
111:
112: /**
113: * Get the buffer with the characters being drawn. No changes can be done to
114: * characters in the buffer.
115: */
116: public char[] getBuffer();
117:
118: /**
119: * Get the position in the document where the buffer starts. The area
120: * between <tt>getDrawStartOffset()</tt> and <tt>getDrawEndOffset</tt>
121: * will contain valid characters. However the first token can start even
122: * under <tt>getDrawStartOffset()</tt>. In this case the valid area
123: * starts at <tt>getTokenOffset()</tt> of the first token.
124: */
125: public int getBufferStartOffset();
126:
127: }
|