|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.eclipse.swt.widgets.Widget
|
+--org.eclipse.swt.widgets.Control
|
+--org.eclipse.swt.widgets.Scrollable
|
+--org.eclipse.swt.widgets.Composite
|
+--org.eclipse.swt.widgets.Canvas
|
+--org.eclipse.swt.custom.StyledText
Safe: A StyledText is an editable user interface object that displays lines of text. The following style attributes can be defined for the text:
In addition to text style attributes, the background color of a line may be specified.
There are two ways to use this widget when specifying text style information. You may use the API that is defined for StyledText or you may define your own LineStyleListener. If you define your own listener, you will be responsible for maintaining the text style information for the widget. IMPORTANT: You may not define your own listener and use the StyledText API. The following StyledText API is not supported if you have defined a LineStyleListener:
There are two ways to use this widget when specifying line background colors. You may use the API that is defined for StyledText or you may define your own LineBackgroundListener. If you define your own listener, you will be responsible for maintaining the line background color information for the widget. IMPORTANT: You may not define your own listener and use the StyledText API. The following StyledText API is not supported if you have defined a LineBackgroundListener:
The content implementation for this widget may also be user-defined. To do so, you must implement the StyledTextContent interface and use the StyledText API setContent(StyledTextContent) to initialize the widget.
IMPORTANT: This class is not intended to be subclassed.
| Field Summary | |
(package private) int |
autoScrollDirection
|
(package private) Color |
background
|
(package private) static int |
BIDI_CARET_WIDTH
|
(package private) boolean |
bidiColoring
|
(package private) int |
bottomMargin
|
(package private) int |
caretDirection
|
(package private) int |
caretOffset
|
(package private) PaletteData |
caretPalette
|
(package private) int |
clientAreaHeight
|
(package private) int |
clientAreaWidth
|
(package private) Clipboard |
clipboard
|
(package private) int |
columnX
|
(package private) StyledTextContent |
content
|
(package private) static int |
DEFAULT_HEIGHT
|
(package private) static int |
DEFAULT_WIDTH
|
(package private) DefaultLineStyler |
defaultLineStyler
|
(package private) boolean |
doubleClickEnabled
|
(package private) Point |
doubleClickSelection
|
(package private) boolean |
editable
|
(package private) static int |
ExtendedModify
|
(package private) Color |
foreground
|
(package private) int |
horizontalScrollOffset
|
(package private) Cursor |
ibeamCursor
|
(package private) boolean |
isBidi
|
(package private) boolean |
isCarbon
|
(package private) Hashtable |
keyActionMap
|
(package private) int |
lastCaretDirection
|
(package private) int |
lastTextChangeNewCharCount
|
(package private) int |
lastTextChangeNewLineCount
|
(package private) int |
lastTextChangeReplaceCharCount
|
(package private) int |
lastTextChangeReplaceLineCount
|
(package private) int |
lastTextChangeStart
|
(package private) Image |
leftCaretBitmap
|
(package private) int |
leftMargin
|
(package private) org.eclipse.swt.custom.StyledText.LineCache |
lineCache
|
(package private) int |
lineEndSpaceWidth
|
(package private) static int |
LineGetBackground
|
(package private) static int |
LineGetSegments
|
(package private) static int |
LineGetStyle
|
(package private) int |
lineHeight
|
(package private) StyledTextContent |
logicalContent
|
(package private) boolean |
mouseDoubleClick
|
(package private) boolean |
overwrite
|
(package private) static String |
PlatformLineDelimiter
|
(package private) DisplayRenderer |
renderer
|
(package private) Image |
rightCaretBitmap
|
(package private) int |
rightMargin
|
(package private) Point |
selection
|
(package private) int |
selectionAnchor
|
(package private) Color |
selectionBackground
|
(package private) Color |
selectionForeground
|
(package private) static char |
TAB
|
(package private) int |
tabLength
|
(package private) static int |
TextChanged
|
(package private) TextChangeListener |
textChangeListener
|
(package private) static int |
TextChanging
|
(package private) int |
textLimit
|
(package private) static int |
TextSet
|
(package private) int |
topIndex
|
(package private) int |
topMargin
|
(package private) int |
topOffset
|
(package private) boolean |
userLineBackground
|
(package private) boolean |
userLineStyle
|
(package private) static int |
VerifyKey
|
(package private) int |
verticalScrollOffset
|
(package private) boolean |
wordWrap
|
(package private) static int |
XINSET
|
| Fields inherited from class org.eclipse.swt.widgets.Canvas |
|
| Fields inherited from class org.eclipse.swt.widgets.Composite |
|
| Fields inherited from class org.eclipse.swt.widgets.Scrollable |
|
| Fields inherited from class org.eclipse.swt.widgets.Control |
handle |
| Fields inherited from class org.eclipse.swt.widgets.Widget |
|
| Constructor Summary | |
StyledText(Composite parent,
int style)
Enabled: Constructs a new instance of this class given its parent and a style value describing its behavior and appearance. |
|
| Method Summary | |
void |
addBidiSegmentListener(BidiSegmentListener listener)
Enabled: Adds a bidirectional segment listener. |
void |
addExtendedModifyListener(ExtendedModifyListener extendedModifyListener)
Enabled: Adds an extended modify listener. |
void |
addLineBackgroundListener(LineBackgroundListener listener)
Enabled: Adds a line background listener. |
void |
addLineStyleListener(LineStyleListener listener)
Enabled: Adds a line style listener. |
void |
addModifyListener(ModifyListener modifyListener)
Enabled: Adds a modify listener. |
void |
addSelectionListener(SelectionListener listener)
Enabled: Adds a selection listener. |
void |
addVerifyKeyListener(VerifyKeyListener listener)
Enabled: Adds a verify key listener. |
void |
addVerifyListener(VerifyListener verifyListener)
Enabled: Adds a verify listener. |
void |
append(String string)
Enabled: Appends a string to the text at the end of the widget. |
(package private) void |
calculateContentWidth()
Calculates the width of the widest visible line. |
(package private) void |
calculateScrollBars()
Calculates the scroll bars |
(package private) void |
calculateTopIndex()
Calculates the top index based on the current vertical scroll offset. |
(package private) static int |
checkStyle(int style)
Hides the scroll bars if widget is created in single line mode. |
(package private) void |
claimBottomFreeSpace()
Scrolls down the text to use new space made available by a resize or by deleted lines. |
(package private) void |
claimRightFreeSpace()
Scrolls text to the right to use new space made available by a resize. |
(package private) void |
clearMargin(GC gc,
Color background,
Rectangle clientArea,
int renderHeight)
Clears the widget margin. |
(package private) void |
clearSelection(boolean sendEvent)
Removes the widget selection. |
Point |
computeSize(int wHint,
int hHint,
boolean changed)
Enabled: Computes the preferred size. |
void |
copy()
Suppressed: Copies the selected text to the clipboard. |
(package private) void |
createCaretBitmaps()
Create the bitmaps to use for the caret in bidi mode. |
(package private) void |
createKeyBindings()
Creates default key bindings. |
void |
cut()
Suppressed: Moves the selected text to the clipboard. |
(package private) void |
doAutoScroll(Event event)
A mouse move event has occurred. |
(package private) void |
doAutoScroll(int direction)
Initiates autoscrolling. |
(package private) void |
doBackspace()
Deletes the previous character. |
(package private) void |
doColumnLeft()
Moves the caret one character to the left. |
(package private) void |
doColumnRight()
Moves the caret one character to the right. |
(package private) void |
doContent(char key)
Replaces the selection with the character or insert the character at the current caret position if no selection exists. |
(package private) void |
doContentEnd()
Moves the caret after the last character of the widget content. |
(package private) void |
doContentStart()
Moves the caret in front of the first character of the widget content. |
(package private) void |
doCursorNext()
Moves the caret to the end of the selection if a selection exists. |
(package private) void |
doCursorPrevious()
Moves the caret to the start of the selection if a selection exists. |
(package private) void |
doDelete()
Deletes the next character. |
(package private) void |
doDeleteWordNext()
Deletes the next word. |
(package private) void |
doDeleteWordPrevious()
Deletes the previous word. |
(package private) int |
doLineDown()
Moves the caret one line down and to the same character offset relative to the beginning of the line. |
(package private) void |
doLineEnd()
Moves the caret to the end of the line. |
(package private) void |
doLineStart()
Moves the caret to the beginning of the line. |
(package private) int |
doLineUp()
Moves the caret one line up and to the same character offset relative to the beginning of the line. |
(package private) void |
doMouseLocationChange(int x,
int y,
boolean select)
Moves the caret to the specified location. |
(package private) void |
doMouseSelection()
Updates the selection based on the caret position |
(package private) int |
doMouseWordSelect(int x,
int newCaretOffset,
int line)
Returns the offset of the word at the specified offset. |
(package private) void |
doPageDown(boolean select)
Scrolls one page down so that the last line (truncated or whole) of the current page becomes the fully visible top line. |
(package private) void |
doPageEnd()
Moves the cursor to the end of the last fully visible line. |
(package private) void |
doPageStart()
Moves the cursor to the beginning of the first fully visible line. |
(package private) void |
doPageUp()
Scrolls one page up so that the first line (truncated or whole) of the current page becomes the fully visible last line. |
(package private) void |
doSelection(int direction)
Updates the selection to extend to the current caret position. |
(package private) void |
doSelectionCursorNext()
Moves the caret to the next character or to the beginning of the next line if the cursor is at the end of a line. |
(package private) void |
doSelectionCursorPrevious()
Moves the caret to the previous character or to the end of the previous line if the cursor is at the beginning of a line. |
(package private) void |
doSelectionLineDown()
Moves the caret one line down and to the same character offset relative to the beginning of the line. |
(package private) void |
doSelectionLineUp()
Moves the caret one line up and to the same character offset relative to the beginning of the line. |
(package private) void |
doSelectionPageDown()
Scrolls one page down so that the last line (truncated or whole) of the current page becomes the fully visible top line. |
(package private) void |
doSelectionPageUp()
Scrolls one page up so that the first line (truncated or whole) of the current page becomes the fully visible last line. |
(package private) void |
doSelectionWordNext()
Moves the caret to the end of the next word . |
(package private) void |
doSelectionWordPrevious()
Moves the caret to the start of the previous word. |
(package private) void |
doWordNext()
Moves the caret to the end of the next word. |
(package private) void |
doWordPrevious()
Moves the caret to the start of the previous word. |
(package private) void |
draw(int x,
int y,
int width,
int height,
boolean clearBackground)
Draws the specified rectangle. |
(package private) void |
endAutoScroll()
Ends the autoscroll process. |
Color |
getBackground()
Enabled: @see org.eclipse.swt.widgets.Control#getBackground |
boolean |
getBidiColoring()
Deprecated. use BidiSegmentListener instead. |
(package private) int |
getBidiOffsetAtMouseLocation(int x,
int line)
Returns the offset at the specified x location in the specified line. |
(package private) int[] |
getBidiSegments(int lineOffset,
String line)
Returns the text segments that should be treated as if they had a different direction than the surrounding text. |
(package private) int[] |
getBidiSegmentsCompatibility(String line,
int lineOffset)
|
(package private) int |
getBidiTextPosition(String text,
int endOffset,
StyledTextBidi bidi)
Returns the x position of the character at the specified offset relative to the first character in the line. |
(package private) int |
getBottomIndex()
Returns the index of the last fully visible line. |
(package private) int |
getCaretLine()
Returns the index of the line the caret is on. |
int |
getCaretOffset()
Enabled: Returns the caret position relative to the start of the text. |
(package private) int |
getCaretOffsetAtX(String line,
int lineOffset,
int lineXOffset)
Returns the caret offset at the given x location in the line. |
(package private) int |
getCaretWidth()
Returns the caret width. |
int |
getCharCount()
Enabled: Gets the number of characters. |
StyledTextContent |
getContent()
Enabled: Returns the content implementation that is used for text storage or null if no user defined content implementation has been set. |
boolean |
getDoubleClickEnabled()
Enabled: Returns whether the widget implements double click mouse behavior. |
boolean |
getEditable()
Enabled: Returns whether the widget content can be edited. |
Color |
getForeground()
Enabled: @see org.eclipse.swt.widgets.Control#getForeground |
(package private) GC |
getGC()
Return a GC to use for rendering and update the cached font style to represent the current style. |
(package private) int |
getHorizontalIncrement()
Returns the horizontal scroll increment. |
int |
getHorizontalIndex()
Enabled: Returns the horizontal scroll offset relative to the start of the line. |
int |
getHorizontalPixel()
Enabled: Returns the horizontal scroll offset relative to the start of the line. |
int |
getKeyBinding(int key)
Enabled: Returns the action assigned to the key. |
int |
getLineAtOffset(int offset)
Enabled: Returns the line at the specified offset in the text where 0 <= offset <= getCharCount() so that getLineAtOffset(getCharCount()) returns the line of the insert location. |
Color |
getLineBackground(int index)
Enabled: Returns the background color of the line at the given index. |
(package private) StyledTextEvent |
getLineBackgroundData(int lineOffset,
String line)
Returns the line background data for the given line or null if there is none. |
(package private) org.eclipse.swt.custom.StyledText.LineCache |
getLineCache(StyledTextContent content)
Returns a LineCache implementation. |
int |
getLineCount()
Enabled: Gets the number of text lines. |
(package private) int |
getLineCountWhole()
Returns the number of lines that can be completely displayed in the widget client area. |
String |
getLineDelimiter()
Enabled: Returns the line delimiter used for entering new lines by key down or paste operation. |
int |
getLineHeight()
Enabled: Returns the line height. |
(package private) StyledTextEvent |
getLineStyleData(int lineOffset,
String line)
Returns the line style data for the given line or null if there is none. |
Point |
getLocationAtOffset(int offset)
Enabled: Returns the x, y location of the upper left corner of the character bounding box at the specified offset in the text. |
(package private) String |
getModelDelimitedText(String text)
Returns a string that uses only the line delimiter specified by the StyledTextContent implementation. |
int |
getOffsetAtLine(int lineIndex)
Enabled: Returns the character offset of the first character of the given line. |
int |
getOffsetAtLocation(Point point)
Enabled: Returns the offset of the character at the given location relative to the first character in the document. |
(package private) int |
getOffsetAtMouseLocation(int x,
int line)
Returns the offset at the specified x location in the specified line. |
(package private) int |
getOffsetAtX(String line,
int lineOffset,
int lineXOffset)
Returns the offset of the character at the given x location in the line. |
(package private) int |
getPartialBottomIndex()
Returns the index of the last partially visible line. |
(package private) String |
getPlatformDelimitedText(org.eclipse.swt.custom.StyledText.TextWriter writer)
Returns the content in the specified range using the platform line delimiter to separate lines. |
(package private) String |
getRtf()
Returns the widget text with style information encoded using RTF format specification version 1.5. |
Point |
getSelection()
Enabled: Returns the selection. |
Color |
getSelectionBackground()
Suppressed: Returns the receiver's selection background color. |
int |
getSelectionCount()
Enabled: Gets the number of selected characters. |
Color |
getSelectionForeground()
Suppressed: Returns the receiver's selection foreground color. |
Point |
getSelectionRange()
Enabled: Returns the selection. |
String |
getSelectionText()
Enabled: Returns the selected text. |
(package private) StyledTextBidi |
getStyledTextBidi(String lineText,
int lineOffset,
GC gc)
Returns a StyledTextBidi object for the specified line. |
(package private) StyledTextBidi |
getStyledTextBidi(String lineText,
int lineOffset,
GC gc,
StyleRange[] styles)
Returns a StyledTextBidi object for the specified line. |
StyleRange |
getStyleRangeAtOffset(int offset)
Enabled: Returns the style range at the given offset. |
StyleRange[] |
getStyleRanges()
Enabled: Returns the styles. |
int |
getTabs()
Enabled: Returns the tab width measured in characters. |
String |
getText()
Enabled: Returns a copy of the widget content. |
String |
getText(int start,
int end)
Enabled: Returns the widget content between the two offsets. |
int |
getTextLimit()
Enabled: Gets the text limit. |
(package private) int |
getTextPosition(String line,
int lineIndex,
int length,
GC gc)
Returns the x position of the character at the specified offset relative to the first character in the line. |
String |
getTextRange(int start,
int length)
Enabled: Returns the widget content starting at start for length characters. |
int |
getTopIndex()
Enabled: Gets the top index. |
int |
getTopPixel()
Enabled: Gets the top pixel. |
(package private) int |
getVerticalIncrement()
Returns the vertical scroll increment. |
(package private) int |
getWordEnd(int offset)
Returns the offset of the character after the word at the specified offset. |
(package private) int |
getWordEndNoSpaces(int offset)
Returns the offset of the character after the word at the specified offset. |
(package private) int |
getWordStart(int offset)
Returns the start offset of the word at the specified offset. |
boolean |
getWordWrap()
Enabled: Returns whether the widget wraps lines. |
(package private) int |
getXAtOffset(String line,
int lineIndex,
int lineOffset)
Returns the x location of the character at the give offset in the line. |
(package private) void |
handleDispose()
Frees resources. |
(package private) void |
handleHorizontalScroll(Event event)
Scrolls the widget horizontally. |
(package private) void |
handleKey(Event event)
If an action has been registered for the key stroke execute the action. |
(package private) void |
handleKeyDown(Event event)
If a VerifyKey listener exists, verify that the key that was entered should be processed. |
(package private) void |
handleMouseDoubleClick(Event event)
Updates the caret location and selection if mouse button 1 has been pressed. |
(package private) void |
handleMouseDown(Event event)
Updates the caret location and selection if mouse button 1 has been pressed. |
(package private) void |
handleMouseMove(Event event)
Updates the caret location and selection if mouse button 1 is pressed during the mouse move. |
(package private) void |
handleMouseUp(Event event)
Autoscrolling ends when the mouse button is released. |
(package private) void |
handlePaint(Event event)
Renders the invalidated area specified in the paint event. |
(package private) void |
handleResize(Event event)
Recalculates the scroll bars. |
(package private) void |
handleTextChanged(TextChangedEvent event)
Updates the caret position and selection and the scroll bars to reflect the content change. |
(package private) void |
handleTextChanging(TextChangingEvent event)
Updates the screen to reflect a pending content change. |
(package private) void |
handleTextSet(TextChangedEvent event)
Called when the widget content is set programatically, overwriting the old content. |
(package private) void |
handleTraverse(Event event)
Called when a traversal key is pressed. |
(package private) void |
handleVerticalScroll(Event event)
Scrolls the widget vertically. |
(package private) void |
initializeRenderer()
Initializes the fonts used to render font styles. |
void |
insert(String string)
Enabled: Inserts a string. |
(package private) void |
installDefaultContent()
Creates content change listeners and set the default content model. |
(package private) void |
installDefaultLineStyler()
Creates a default line style listener. |
(package private) void |
installListeners()
Adds event listeners |
(package private) StyledTextContent |
internalGetContent()
|
(package private) int |
internalGetHorizontalPixel()
|
(package private) org.eclipse.swt.custom.StyledText.LineCache |
internalGetLineCache()
|
(package private) Point |
internalGetSelection()
|
(package private) boolean |
internalGetWordWrap()
|
(package private) void |
internalRedraw()
Used by WordWrapCache to bypass StyledText.redraw which does an unwanted cache reset. |
(package private) void |
internalRedrawRange(int start,
int length,
boolean clearBackground)
Redraws the specified text range. |
(package private) void |
internalSetSelection(int start,
int length,
boolean sendEvent)
Sets the selection. |
void |
invokeAction(int action)
Suppressed: Executes the action. |
(package private) boolean |
isAreaVisible(int firstLine,
int lastLine)
Returns whether or not the given lines are visible. |
(package private) boolean |
isBidi()
Temporary until SWT provides this |
(package private) boolean |
isLineDelimiter(int offset)
Returns whether the given offset is inside a multi byte line delimiter. |
(package private) boolean |
isRedrawFirstLine(StyleRange[] ranges,
int firstLine,
int firstLineOffset)
Returns whether or not the given styles will necessitate a redraw for the given start line. |
(package private) boolean |
isRedrawLastLine(StyleRange[] ranges,
int lastLine,
int lastLineOffset)
Returns whether or not the given styles will necessitate a redraw for the given end line. |
(package private) boolean |
isSingleLine()
Returns whether the widget can have only one line. |
(package private) boolean |
isStyleChanging(StyleRange range,
int start,
int end)
Returns whether the font style in the given style range is changing from SWT.NORMAL to SWT.BOLD or vice versa. |
(package private) void |
modifyContent(Event event,
boolean updateCaret)
Sends the specified verify event, replace/insert text as defined by the event and send a modify event. |
void |
paste()
Suppressed: Replaces the selection with the clipboard text or insert the text at the current caret offset if there is no selection. |
(package private) void |
performPaint(GC gc,
int startLine,
int startY,
int renderHeight)
Render the specified area. |
void |
print()
Suppressed: Prints the widget's text to the default printer. |
Runnable |
print(org.eclipse.swt.printing.Printer printer)
Suppressed: Returns a runnable that will print the widget's text to the specified printer. |
Runnable |
print(org.eclipse.swt.printing.Printer printer,
org.eclipse.swt.custom.StyledTextPrintOptions options)
Suppressed: Returns a runnable that will print the widget's text to the specified printer. |
void |
redraw()
Enabled: Causes the entire bounds of the receiver to be marked as needing to be redrawn. |
void |
redraw(int x,
int y,
int width,
int height,
boolean all)
Enabled: Causes the rectangular area of the receiver specified by the arguments to be marked as needing to be redrawn. |
(package private) void |
redrawBidiLines(int firstLine,
int offsetInFirstLine,
int lastLine,
int endOffset,
boolean clearBackground)
Redraws a text range in the specified lines |
(package private) void |
redrawLine(int line,
int offset)
Redraw the given line. |
(package private) void |
redrawLines(int firstLine,
int offsetInFirstLine,
int lastLine,
int endOffset,
boolean clearBackground)
Redraws a text range in the specified lines |
(package private) void |
redrawMultiLineChange(int y,
int newLineCount,
int replacedLineCount)
Fixes the widget to display a text change. |
void |
redrawRange(int start,
int length,
boolean clearBackground)
Enabled: Redraws the specified text range. |
void |
removeBidiSegmentListener(BidiSegmentListener listener)
Enabled: Removes the specified bidirectional segment listener. |
void |
removeExtendedModifyListener(ExtendedModifyListener extendedModifyListener)
Enabled: Removes the specified extended modify listener. |
void |
removeLineBackgroundListener(LineBackgroundListener listener)
Enabled: Removes the specified line background listener. |
void |
removeLineStyleListener(LineStyleListener listener)
Enabled: Removes the specified line style listener. |
void |
removeModifyListener(ModifyListener modifyListener)
Enabled: Removes the specified modify listener. |
void |
removeSelectionListener(SelectionListener listener)
Enabled: Removes the specified selection listener. |
void |
removeVerifyKeyListener(VerifyKeyListener listener)
Enabled: Removes the specified key verify listener. |
void |
removeVerifyListener(VerifyListener verifyListener)
Enabled: Removes the specified verify listener. |
void |
replaceStyleRanges(int start,
int length,
StyleRange[] ranges)
Enabled: Replaces the styles in the given range with new styles. |
void |
replaceTextRange(int start,
int length,
String text)
Enabled: Replaces the given text range with new text. |
(package private) void |
|