Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.swt.custom
Class StyledTextRenderer  view StyledTextRenderer download StyledTextRenderer.java

java.lang.Object
  extended byorg.eclipse.swt.custom.StyledTextRenderer
Direct Known Subclasses:
DisplayRenderer, PrintRenderer

abstract class StyledTextRenderer
extends java.lang.Object

A StyledTextRenderer renders the content of a StyledText widget. Subclasses can provide a different device (e.g., Display, Printer) to render on and implement abstract methods to return resources created on that device.


Field Summary
private  int ascent
           
protected  org.eclipse.swt.graphics.Font boldFont
           
protected  org.eclipse.swt.graphics.Font boldItalicFont
           
private  int descent
           
private  org.eclipse.swt.graphics.Device device
           
protected  org.eclipse.swt.graphics.Font italicFont
           
private  int lineEndSpaceWidth
           
protected  org.eclipse.swt.graphics.Font regularFont
           
private  int tabWidth
           
 
Constructor Summary
(package private) StyledTextRenderer(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.Font regularFont)
          Creates an instance of StyledTextRenderer.
 
Method Summary
(package private)  void calculateLineHeight()
          Calculates the line height and space width.
(package private)  org.eclipse.swt.graphics.TextLayout createTextLayout(int lineOffset)
           
(package private)  void dispose()
          Disposes the resource created by the receiver.
protected abstract  void disposeGC(org.eclipse.swt.graphics.GC gc)
          Dispose the specified GC.
(package private)  void disposeTextLayout(org.eclipse.swt.graphics.TextLayout layout)
           
(package private)  void drawLine(java.lang.String line, int lineIndex, int paintY, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Color widgetBackground, org.eclipse.swt.graphics.Color widgetForeground, boolean clearBackground)
          Draws a line of text at the specified location.
protected abstract  void drawLineBreakSelection(java.lang.String line, int lineOffset, int paintX, int paintY, org.eclipse.swt.graphics.GC gc)
          Draws the background of the line selection.
(package private)  int getBaseline()
           
protected abstract  int[] getBidiSegments(int lineOffset, java.lang.String lineText)
          Returns the text segments that should be treated as if they had a different direction than the surrounding text.
protected abstract  org.eclipse.swt.graphics.Rectangle getClientArea()
          Returns the visible client area that can be used for rendering.
protected abstract  StyledTextContent getContent()
          Returns the StyledTextContent to use for line offset calculations.
(package private)  org.eclipse.swt.graphics.Device getDevice()
          Returns the Device that is being rendered on.
(package private)  org.eclipse.swt.graphics.Font getFont(int style)
          Returns the Font according with the given style
(package private)  org.eclipse.swt.graphics.FontData[] getFontData(int style)
           
protected abstract  org.eclipse.swt.graphics.GC getGC()
          Returns the GC to use for rendering and measuring.
protected abstract  int getHorizontalPixel()
          Returns the horizontal scroll position.
protected  int getLeftMargin()
           
protected abstract  StyledTextEvent getLineBackgroundData(int lineOffset, java.lang.String line)
          Returns the line background data for the given line or null if there is none.
(package private)  int getLineEndSpaceWidth()
          Returns the width in pixels of the space used to represent line delimiters.
(package private)  int getLineHeight()
          Returns the height in pixels of a line.
protected abstract  StyledTextEvent getLineStyleData(int lineOffset, java.lang.String line)
          Returns the line style data for the given line or null if there is none.
(package private)  StyledTextEvent getLineStyleData(StyledTextEvent event, int lineOffset, java.lang.String line)
          Returns the line style data for the specified line.
protected abstract  int getOrientation()
           
protected  int getRightMargin()
           
protected abstract  org.eclipse.swt.graphics.Point getSelection()
          Returns the widget selection.
protected abstract  org.eclipse.swt.graphics.Color getSelectionBackground()
           
protected abstract  org.eclipse.swt.graphics.Color getSelectionForeground()
           
(package private)  org.eclipse.swt.graphics.TextLayout getTextLayout(java.lang.String line, int lineOffset)
          Returns TextLayout given a line index and an array of styles
(package private)  StyleRange[] getVisualLineStyleData(StyleRange[] logicalStyles, int lineOffset, int lineLength)
          Returns styles for the specified visual (wrapped) line.
protected abstract  boolean getWordWrap()
          Returns the word wrap state.
protected abstract  boolean isFullLineSelection()
          Returns whether the widget was created with the SWT.FULL_SELECTION style.
(package private)  void setTabLength(int tabLength)
          Calculates the width in pixel of a tab character
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

device

private org.eclipse.swt.graphics.Device device

regularFont

protected org.eclipse.swt.graphics.Font regularFont

boldFont

protected org.eclipse.swt.graphics.Font boldFont

italicFont

protected org.eclipse.swt.graphics.Font italicFont

boldItalicFont

protected org.eclipse.swt.graphics.Font boldItalicFont

tabWidth

private int tabWidth

ascent

private int ascent

descent

private int descent

lineEndSpaceWidth

private int lineEndSpaceWidth
Constructor Detail

StyledTextRenderer

StyledTextRenderer(org.eclipse.swt.graphics.Device device,
                   org.eclipse.swt.graphics.Font regularFont)
Creates an instance of StyledTextRenderer.

Method Detail

calculateLineHeight

void calculateLineHeight()
Calculates the line height and space width.


dispose

void dispose()
Disposes the resource created by the receiver.


disposeGC

protected abstract void disposeGC(org.eclipse.swt.graphics.GC gc)
Dispose the specified GC. Allows subclasses to reuse GCs.


drawLine

void drawLine(java.lang.String line,
              int lineIndex,
              int paintY,
              org.eclipse.swt.graphics.GC gc,
              org.eclipse.swt.graphics.Color widgetBackground,
              org.eclipse.swt.graphics.Color widgetForeground,
              boolean clearBackground)
Draws a line of text at the specified location.


drawLineBreakSelection

protected abstract void drawLineBreakSelection(java.lang.String line,
                                               int lineOffset,
                                               int paintX,
                                               int paintY,
                                               org.eclipse.swt.graphics.GC gc)
Draws the background of the line selection. Implemented by subclasses for optional selection rendering.


getClientArea

protected abstract org.eclipse.swt.graphics.Rectangle getClientArea()
Returns the visible client area that can be used for rendering.


getContent

protected abstract StyledTextContent getContent()
Returns the StyledTextContent to use for line offset calculations.


getDevice

org.eclipse.swt.graphics.Device getDevice()
Returns the Device that is being rendered on.


getBaseline

int getBaseline()

getBidiSegments

protected abstract int[] getBidiSegments(int lineOffset,
                                         java.lang.String lineText)
Returns the text segments that should be treated as if they had a different direction than the surrounding text.


getFont

org.eclipse.swt.graphics.Font getFont(int style)
Returns the Font according with the given style


getFontData

org.eclipse.swt.graphics.FontData[] getFontData(int style)

getGC

protected abstract org.eclipse.swt.graphics.GC getGC()
Returns the GC to use for rendering and measuring. Allows subclasses to reuse GCs.


getHorizontalPixel

protected abstract int getHorizontalPixel()
Returns the horizontal scroll position.


getLeftMargin

protected int getLeftMargin()

getLineEndSpaceWidth

int getLineEndSpaceWidth()
Returns the width in pixels of the space used to represent line delimiters.


getLineBackgroundData

protected abstract StyledTextEvent getLineBackgroundData(int lineOffset,
                                                         java.lang.String line)
Returns the line background data for the given line or null if there is none.


getLineHeight

int getLineHeight()
Returns the height in pixels of a line.


getLineStyleData

StyledTextEvent getLineStyleData(StyledTextEvent event,
                                 int lineOffset,
                                 java.lang.String line)
Returns the line style data for the specified line. The lineOffset and line may specify a segment of a logical line stored in the StyledTextContent of the widget. The returned styles are guaranteed to be at least partially on the segment.


getLineStyleData

protected abstract StyledTextEvent getLineStyleData(int lineOffset,
                                                    java.lang.String line)
Returns the line style data for the given line or null if there is none. If there is a LineStyleListener but it does not set any styles, the StyledTextEvent.styles field will be initialized to an empty array.


getOrientation

protected abstract int getOrientation()

getRightMargin

protected int getRightMargin()

getSelectionForeground

protected abstract org.eclipse.swt.graphics.Color getSelectionForeground()

getSelectionBackground

protected abstract org.eclipse.swt.graphics.Color getSelectionBackground()

getSelection

protected abstract org.eclipse.swt.graphics.Point getSelection()
Returns the widget selection. Implemented by subclasses for optional selection rendering.


getVisualLineStyleData

StyleRange[] getVisualLineStyleData(StyleRange[] logicalStyles,
                                    int lineOffset,
                                    int lineLength)
Returns styles for the specified visual (wrapped) line.


getWordWrap

protected abstract boolean getWordWrap()
Returns the word wrap state.


isFullLineSelection

protected abstract boolean isFullLineSelection()
Returns whether the widget was created with the SWT.FULL_SELECTION style. Implemented by subclasses for optional selection rendering.


setTabLength

void setTabLength(int tabLength)
Calculates the width in pixel of a tab character


getTextLayout

org.eclipse.swt.graphics.TextLayout getTextLayout(java.lang.String line,
                                                  int lineOffset)
Returns TextLayout given a line index and an array of styles


createTextLayout

org.eclipse.swt.graphics.TextLayout createTextLayout(int lineOffset)

disposeTextLayout

void disposeTextLayout(org.eclipse.swt.graphics.TextLayout layout)