|
Eclipse Platform Release 3.3 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectorg.eclipse.jface.text.source.AbstractRulerColumn
Abstract implementation of a IVerticalRulerColumn that
uses a Canvas to draw the ruler contents and which
handles scrolling and mouse selection.
paint(GC, ILineRange) to control the entire painting of
the ruler.paintLine(GC, int, int, int, int) to control the
painting of a line.computeBackground(int),
computeForeground(int) and computeText(int)
to specify the ruler appearance for a line.redraw() to mark the entire ruler as needing to be redrawn.
Alternatively, use redraw(ILineRange) to only invalidate a certain line range, for
example due to changes to the display model.
font used to draw text in paintLine(GC, int, int, int, int).text inset for text drawn.default background color of the ruler.width of the ruler.
| Constructor Summary | |
|---|---|
protected |
AbstractRulerColumn()
Creates a new ruler. |
| Method Summary | |
|---|---|
void |
addVerticalRulerListener(IVerticalRulerListener listener)
Registers a vertical ruler listener to be informed if an annotation gets selected on the vertical ruler. |
protected Color |
computeBackground(int line)
Returns the background color drawn for a certain line by paintLine(GC, int, int, int, int). |
protected Color |
computeForeground(int line)
Returns the foreground color drawn for a certain line by paintLine(GC, int, int, int, int). |
protected String |
computeText(int line)
Returns the text to be drawn for a certain line by paintLine(GC, int, int, int, int),
null for no text. |
Control |
createControl(CompositeRuler parentRuler,
Composite parentControl)
Creates the column's SWT control. |
void |
dispose()
Disposes this ruler column. |
protected int |
getCanvasStyle()
Returns the SWT style bits used when creating the ruler canvas. |
Control |
getControl()
Returns the column's SWT control. |
protected Color |
getDefaultBackground()
Returns the background color. |
protected Font |
getFont()
Returns the current font. |
IAnnotationHover |
getHover()
Returns the hover for this vertical ruler (column). |
int |
getLineOfLastMouseButtonActivity()
Returns the line number of the last mouse button activity. |
IAnnotationModel |
getModel()
Returns the model currently used by the receiver. |
protected CompositeRuler |
getParentRuler()
Returns the parent ruler, null before
createControl(CompositeRuler, Composite) has been called. |
protected int |
getTextInset()
Returns the text inset for text drawn by paintLine(GC, int, int, int, int). |
int |
getWidth()
Returns the width of this column's control. |
protected void |
paint(GC gc,
ILineRange lines)
Paints the ruler. |
protected void |
paintLine(GC gc,
int modelLine,
int widgetLine,
int linePixel,
int lineHeight)
Paints the ruler representation of a single line. |
void |
redraw()
Redraws this column. |
protected void |
redraw(ILineRange lines)
Marks the region covered by lines as needing to be redrawn. |
void |
removeVerticalRulerListener(IVerticalRulerListener listener)
Removes a previously registered listener. |
protected void |
setDefaultBackground(Color background)
Sets the default background color for this column. |
void |
setFont(Font font)
Sets the font of this ruler column. |
protected void |
setHover(IAnnotationHover hover)
Sets the annotation hover. |
void |
setModel(IAnnotationModel model)
Associates an annotation model with this ruler column. |
protected void |
setTextInset(int textInset)
Sets the text inset (padding) used to draw text in paintLine(GC, int, int, int, int). |
protected void |
setWidth(int width)
The new width in pixels. |
int |
toDocumentLineNumber(int y_coordinate)
Translates a y-coordinate of the ruler's SWT control into the according line number of the document of the connected text viewer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
protected AbstractRulerColumn()
| Method Detail |
public Control createControl(CompositeRuler parentRuler,
Composite parentControl)
IVerticalRulerColumn
createControl in interface IVerticalRulerColumnparentRuler - the parent ruler of this columnparentControl - the control of the parent ruler
protected int getCanvasStyle()
The default implementation returns SWT.NO_BACKGROUND.
Clients may reimplement this method to create a canvas with their desired style bits.
SWT.NONE if nonepublic final Control getControl()
IVerticalRulerColumn
getControl in interface IVerticalRulerColumnprotected final void setWidth(int width)
DEFAULT_WIDTH constant
specifies the default width.
width - the new widthpublic final int getWidth()
IVerticalRulerColumn
getWidth in interface IVerticalRulerColumnprotected final CompositeRuler getParentRuler()
null before
createControl(CompositeRuler, Composite) has been called.
nullpublic final void setFont(Font font)
setFont in interface IVerticalRulerColumnfont - the font or null to use the default fontprotected final Font getFont()
protected final void setTextInset(int textInset)
paintLine(GC, int, int, int, int).
textInset - the new text insetprotected final int getTextInset()
paintLine(GC, int, int, int, int). The
DEFAULT_TEXT_INSET constant specifies the default inset in pixels.
public void setModel(IAnnotationModel model)
IVerticalRulerColumnnull is acceptable and clears the ruler.
setModel in interface IVerticalRulerColumnmodel - the new annotation model, may be nullpublic final IAnnotationModel getModel()
IVerticalRulerInfoExtension
getModel in interface IVerticalRulerInfoExtensionnull if no model is
installed.protected final void setDefaultBackground(Color background)
computeBackground(int) and also to paint the area of the ruler
that does not correspond to any lines (when the viewport is not entirely filled with lines).
background - the default background color, null to use the text widget's
backgroundprotected final Color getDefaultBackground()
null if the system is shutting down.
protected final void setHover(IAnnotationHover hover)
hover - the annotation hover, null for no hoverpublic IAnnotationHover getHover()
IVerticalRulerInfoExtension
getHover in interface IVerticalRulerInfoExtensionpublic void dispose()
Subclasses may extend this method.
Clients who created this column are responsible to call this method once the column is no longer used.
public final void redraw()
IVerticalRulerColumn
redraw in interface IVerticalRulerColumnprotected final void redraw(ILineRange lines)
lines as needing to be redrawn.
lines - the lines to be redrawn in document coordinates
protected void paint(GC gc,
ILineRange lines)
lines reference widget line indices, and that
lines may not cover the entire viewport, but only the lines that need to be
painted. The lines may not be entirely visible.
Subclasses may replace or extend. The default implementation calls
paintLine(GC, int, int, int, int) for every visible line.
gc - the graphics context to paint onlines - the lines to paint in widget coordinates
protected void paintLine(GC gc,
int modelLine,
int widgetLine,
int linePixel,
int lineHeight)
Subclasses may replace or extend. The default implementation draws the text obtained by
computeText(int) in the foreground color and fills
the entire width using the background color. The text is
drawn getTextInset() pixels to the right of the left border.
gc - the graphics context to paint onmodelLine - the model line (based on document coordinates)widgetLine - the line in the text widget corresponding to modelLinelinePixel - the first y-pixel of the widget linelineHeight - the line height in pixelsprotected String computeText(int line)
paintLine(GC, int, int, int, int),
null for no text. The default implementation returns null.
Subclasses may replace or extend.
line - the document line number
null for no textprotected Color computeBackground(int line)
paintLine(GC, int, int, int, int). The default implementation returns
getDefaultBackground().
Subclasses may replace or extend.
line - the document line number
protected Color computeForeground(int line)
paintLine(GC, int, int, int, int). The default implementation returns a
SWT.COLOR_DARK_GRAY color.
Subclasses may replace or extend.
line - the document line number
public final int getLineOfLastMouseButtonActivity()
IVerticalRulerInfo0.
getLineOfLastMouseButtonActivity in interface IVerticalRulerInfopublic final int toDocumentLineNumber(int y_coordinate)
IVerticalRulerInfo
toDocumentLineNumber in interface IVerticalRulerInfoy_coordinate - a y-coordinate of the ruler's SWT control
-1 if that
coordinate does not correspond to a valid document linepublic void addVerticalRulerListener(IVerticalRulerListener listener)
IVerticalRulerInfoExtension
addVerticalRulerListener in interface IVerticalRulerInfoExtensionlistener - the listener to be informedpublic void removeVerticalRulerListener(IVerticalRulerListener listener)
IVerticalRulerInfoExtensionlistener is not registered
with the receiver, calling this method has no effect.
removeVerticalRulerListener in interface IVerticalRulerInfoExtensionlistener - the listener to be removed
|
Eclipse Platform Release 3.3 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.