|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.eclipse.swt.custom.StyledTextRenderer
|
+--org.eclipse.swt.custom.DisplayRenderer
| Field Summary | |
protected Font |
boldFont
|
private StyledText |
parent
|
protected Font |
regularFont
|
| Constructor Summary | |
(package private) |
DisplayRenderer(Device device,
Font regularFont,
boolean isBidi,
int leftMargin,
StyledText parent,
int tabLength)
Creates an instance of |
| Method Summary | |
(package private) void |
calculateLineHeight()
Calculates the line height and space width. |
(package private) void |
dispose()
Disposes the resource created by the receiver. |
protected void |
disposeGC(GC gc)
Dispose the specified GC. |
(package private) void |
drawLine(String line,
int lineIndex,
int paintY,
GC gc,
Color widgetBackground,
Color widgetForeground,
boolean clearBackground)
Draws a line of text at the specified location. |
protected void |
drawLineSelectionBackground(String line,
int lineOffset,
StyleRange[] styles,
int paintY,
GC gc,
StyledTextBidi bidi)
Draws the background of the line selection. |
(package private) StyleRange[] |
filterLineStyles(StyleRange[] styles)
Filter the given style ranges based on the font style and return the unchanged styles only if there is at least one non-regular (e.g., bold) font. |
protected int[] |
getBidiSegments(int lineOffset,
String lineText)
Returns the text segments that should be treated as if they had a different direction than the surrounding text. |
protected Rectangle |
getClientArea()
Returns the visible client area that can be used for rendering. |
protected StyledTextContent |
getContent()
Returns the |
protected int |
getCurrentFontStyle()
Return the font style that is currently set on the active gc. |
(package private) Device |
getDevice()
Returns the Device that is being rendered on. |
protected GC |
getGC()
Returns a new GC to use for rendering and measuring. |
protected int |
getHorizontalPixel()
Returns the horizontal scroll position. |
(package private) int |
getLeftMargin()
Method getLeftMargin. |
protected StyledTextEvent |
getLineBackgroundData(int lineOffset,
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 StyledTextEvent |
getLineStyleData(int lineOffset,
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,
String line)
Returns the line style data for the specified line. |
protected Point |
getSelection()
Returns the widget selection. |
(package private) StyledTextBidi |
getStyledTextBidi(String lineText,
int lineOffset,
GC gc,
StyleRange[] styles)
Returns a StyledTextBidi object for the specified line. |
protected int |
getStyledTextWidth(String text,
int textStartOffset,
StyleRange[] lineStyles,
int paintX,
GC gc)
Returns the width of the specified text segment. |
(package private) int |
getTextPosition(String text,
int lineOffset,
int length,
StyleRange[] lineStyles,
GC gc)
Returns the x position of the character at the specified offset relative to the first character in the line. |
(package private) int |
getTextWidth(String text,
int lineOffset,
int startOffset,
int length,
StyleRange[] lineStyles,
int startXOffset,
GC gc)
Returns the width of the specified text range. |
(package private) StyleRange[] |
getVisualLineStyleData(StyleRange[] logicalStyles,
int lineOffset,
int lineLength)
Returns styles for the specified visual (wrapped) line. |
protected boolean |
getWordWrap()
Returns the word wrap state. |
(package private) boolean |
isBidi()
Returns whether the widget is running on a bidi platform. |
protected boolean |
isFullLineSelection()
Returns whether the widget was created with the SWT.FULL_SELECTION style. |
protected StyleRange[] |
mergeSelectionLineStyles(StyleRange[] styles)
Merges the selection into the styles that are passed in. |
protected void |
setCurrentFontStyle(int style)
Set the font style that is set for the active gc. |
(package private) void |
setLineFont(GC gc,
int style)
Sets the font of the specified GC if it is not already set. |
private StyleRange |
setSelectionStyleEnd(StyleRange selectionStyle,
StyleRange style)
Ensures that the selection style ends at the selection end. |
(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 |
private StyledText parent
protected Font regularFont
protected Font boldFont
| Constructor Detail |
DisplayRenderer(Device device,
Font regularFont,
boolean isBidi,
int leftMargin,
StyledText parent,
int tabLength)
device - Device to render onregularFont - Font to use for regular (non-bold) textisBidi - true=bidi platform, false=no bidi platformleftMargin - margin to the left of the textparent - tabLength - length in characters of a tab character| Method Detail |
protected void disposeGC(GC gc)
disposeGC in class StyledTextRenderergc - GC to dispose.
protected void drawLineSelectionBackground(String line,
int lineOffset,
StyleRange[] styles,
int paintY,
GC gc,
StyledTextBidi bidi)
drawLineSelectionBackground in class StyledTextRendererline - the line to drawlineOffset - offset of the first character in the line.
Relative to the start of the document.styles - line stylespaintY - y location to draw atgc - GC to draw onbidi - the bidi object to use for measuring and rendering text in bidi
locales. null when not in bidi mode.
protected int[] getBidiSegments(int lineOffset,
String lineText)
getBidiSegments in class StyledTextRendererlineOffset - offset of the first character in the line.
0 based from the beginning of the document.
protected Rectangle getClientArea()
getClientArea in class StyledTextRendererprotected StyledTextContent getContent()
getContent in class StyledTextRendererprotected GC getGC()
getGC in class StyledTextRendererdisposeGCprotected int getHorizontalPixel()
getHorizontalPixel in class StyledTextRenderer
protected StyledTextEvent getLineBackgroundData(int lineOffset,
String line)
StyledTextRenderer
getLineBackgroundData in class StyledTextRendererlineOffset - offset of the line start relative to the start
of the content.line - line to get line background data for
StyledTextRenderer.getLineBackgroundData(int, java.lang.String)
protected StyledTextEvent getLineStyleData(int lineOffset,
String line)
StyledTextRenderer
getLineStyleData in class StyledTextRendererlineOffset - offset of the line start relative to the start of
the content.line - line to get line styles for
StyledTextRenderer.getLineStyleData(org.eclipse.swt.custom.StyledTextEvent, int, java.lang.String)protected Point getSelection()
StyledTextRenderer
getSelection in class StyledTextRendererStyledTextRenderer.getSelection()
protected int getStyledTextWidth(String text,
int textStartOffset,
StyleRange[] lineStyles,
int paintX,
GC gc)
getStyledTextWidth in class StyledTextRenderertext - text to measuretextStartOffset - offset of the first character in text relative
to the first character in the documentlineStyles - styles of the linepaintX - x location to start drawing atgc - GC to measure with
protected StyleRange[] mergeSelectionLineStyles(StyleRange[] styles)
StyledTextRenderer
mergeSelectionLineStyles in class StyledTextRendererstyles - the existing styles that the selection should be
applied to.
StyledTextRenderer#getSelectionLineStylesprotected boolean getWordWrap()
StyledTextRenderer
getWordWrap in class StyledTextRendererStyledTextRenderer.getWordWrap()protected boolean isFullLineSelection()
StyledTextRenderer
isFullLineSelection in class StyledTextRendererStyledTextRenderer.isFullLineSelection()
private StyleRange setSelectionStyleEnd(StyleRange selectionStyle,
StyleRange style)
selectionStyle is assumed to be created based on the style
range of style. If selectionStyle does extend
beyond the selection range a new style is returned to preserve the style
passed in with style.
selectionStyle - the selection style based on the style range in
stylestyle - the existing style that is to be merged with the selection
style
if the selection does not fully extend over the existing style range.
null otherwise.void calculateLineHeight()
void dispose()
void drawLine(String line,
int lineIndex,
int paintY,
GC gc,
Color widgetBackground,
Color widgetForeground,
boolean clearBackground)
line - the line to drawlineIndex - index of the line to drawpaintY - y location to draw atgc - GC to draw onwidgetBackground - the widget background color.
Used as the default rendering color.widgetForeground - the widget foreground color.
Used as the default rendering color.clearBackground - true if the line background should be drawn
explicitly.StyleRange[] filterLineStyles(StyleRange[] styles)
styles - styles that may contain font styles.
protected int getCurrentFontStyle()
Device getDevice()
int getLeftMargin()
int getLineEndSpaceWidth()
int getLineHeight()
StyledTextEvent getLineStyleData(StyledTextEvent event,
int lineOffset,
String line)
event - the styles for the logical linelineOffset - offset of the line start relative to the start of
the content.line - line to get line styles for
StyledTextBidi getStyledTextBidi(String lineText,
int lineOffset,
GC gc,
StyleRange[] styles)
lineText - the line that the StyledTextBidi object should
work on.lineOffset - offset of the beginning of the line, relative
to the beginning of the documentgc - GC to use when creating a new StyledTextBidi object.styles - StyleRanges to use when creating a new StyledTextBidi
object.
int getTextPosition(String text,
int lineOffset,
int length,
StyleRange[] lineStyles,
GC gc)
text - text to be measured.lineOffset - offset of the first character in the line.length - number of characters to measure. Tabs are counted
as one character in this parameter.gc - GC to use for measuring text
int getTextWidth(String text,
int lineOffset,
int startOffset,
int length,
StyleRange[] lineStyles,
int startXOffset,
GC gc)
text - text to be measured.lineOffset - offset of the first character in the line.startOffset - offset of the character to start measuring and
expand tabs.length - number of characters to measure. Tabs are counted
as one character in this parameter.startXOffset - x position of "startOffset" in "text". Used for
calculating tab stopsgc - GC to use for measuring text
StyleRange[] getVisualLineStyleData(StyleRange[] logicalStyles,
int lineOffset,
int lineLength)
logicalStyles - the styles for a logical (unwrapped) linelineOffset - offset of the visual linelineLength - length of the visual line
boolean isBidi()
protected void setCurrentFontStyle(int style)
style - SWT.BOLD, SWT.NORMAL
void setLineFont(GC gc,
int style)
gc - GC to set the font instyle - desired style of the font in gc. Can be one of SWT.NORMAL, SWT.
BOLDvoid setTabLength(int tabLength)
tabLength - number of space characters represented by a tab character.
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||