|
|||||||||||
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 |
reset()
Resets the caret position, selection and scroll offsets. |
(package private) void |
resetSelection()
Resets the selection. |
(package private) void |
scrollHorizontal(int pixels)
Scrolls the widget horizontally. |
(package private) boolean |
scrollHorizontalBar(int pixels)
Scrolls the widget horizontally and adjust the horizontal scroll bar to reflect the new horizontal offset.. |
void |
selectAll()
Enabled: Selects all the text. |
(package private) void |
sendKeyEvent(Event event)
Replaces/inserts text as defined by the event. |
(package private) StyledTextEvent |
sendLineEvent(int eventType,
int lineOffset,
String line)
Returns a StyledTextEvent that can be used to request data such as styles and background color for a line. |
(package private) void |
sendSelectionEvent()
Sends the specified selection event. |
void |
setBackground(Color color)
Enabled: @see org.eclipse.swt.widgets.Control#setBackground |
(package private) void |
setBidiCaretDirection()
Set the caret to indicate the current typing direction. |
(package private) void |
setBidiCaretLocation(StyledTextBidi bidi)
Moves the Caret to the current caret offset. |
(package private) void |
setBidiCaretLocation(StyledTextBidi bidi,
int caretLine)
Moves the Caret to the current caret offset. |
void |
setBidiColoring(boolean mode)
Deprecated. use BidiSegmentListener instead. |
(package private) void |
setBidiKeyboardLanguage()
Switches the keyboard language according to the current editing position and cursor direction. |
void |
setCaret(Caret caret)
Enabled: Sets the receiver's caret. |
(package private) void |
setCaretLocation()
Moves the Caret to the current caret offset. |
(package private) void |
setCaretLocation(int newCaretX,
int line)
Moves the Caret to the current caret offset. |
void |
setCaretOffset(int offset)
Enabled: Sets the caret offset. |
(package private) void |
setClipboardContent(int start,
int length)
Copies the specified text range to the clipboard. |
void |
setContent(StyledTextContent newContent)
Enabled: Sets the content implementation to use for text storage. |
void |
setCursor(Cursor cursor)
Enabled: Sets the receiver's cursor to the cursor specified by the argument. |
void |
setDoubleClickEnabled(boolean enable)
Enabled: Sets whether the widget implements double click mouse behavior. |
void |
setEditable(boolean editable)
Enabled: Sets whether the widget content can be edited. |
void |
setFont(Font font)
Enabled: Sets a new font to render text with. |
void |
setForeground(Color color)
Enabled: @see org.eclipse.swt.widgets.Control#setForeground |
void |
setHorizontalIndex(int offset)
Enabled: Sets the horizontal scroll offset relative to the start of the line. |
void |
setHorizontalPixel(int pixel)
Enabled: Sets the horizontal pixel offset relative to the start of the line. |
(package private) void |
setHorizontalScrollBar()
Adjusts the maximum and the page size of the horizontal scroll bar to reflect content width changes. |
void |
setKeyBinding(int key,
int action)
Enabled: Maps a key to an action. |
void |
setLineBackground(int startLine,
int lineCount,
Color background)
Enabled: Sets the background color of the specified lines. |
(package private) void |
setMouseWordSelectionAnchor()
Flips selection anchor based on word selection direction. |
(package private) void |
setScrollBars()
Adjusts the maximum and the page size of the scroll bars to reflect content width/length changes. |
void |
setSelection(int start)
Enabled: Sets the selection to the given position and scrolls it into view. |
void |
setSelection(int start,
int end)
Enabled: Sets the selection and scrolls it into view. |
void |
setSelection(Point point)
Enabled: Sets the selection and scrolls it into view. |
void |
setSelectionBackground(Color color)
Suppressed: Sets the receiver's selection background color to the color specified by the argument, or to the default system color for the control if the argument is null. |
void |
setSelectionForeground(Color color)
Suppressed: Sets the receiver's selection foreground color to the color specified by the argument, or to the default system color for the control if the argument is null. |
void |
setSelectionRange(int start,
int length)
Enabled: Sets the selection. |
void |
setStyleRange(StyleRange range)
Enabled: Adds the specified style. |
void |
setStyleRanges(StyleRange[] ranges)
Enabled: Sets styles to be used for rendering the widget content. |
void |
setTabs(int tabs)
Enabled: Sets the tab width. |
void |
setText(String text)
Enabled: Sets the widget content. |
void |
setTextLimit(int limit)
Enabled: Sets the text limit. |
void |
setTopIndex(int topIndex)
Enabled: Sets the top index. |
void |
setTopPixel(int pixel)
Enabled: Sets the top pixel offset. |
(package private) boolean |
setVerticalScrollOffset(int pixelOffset,
boolean adjustScrollBar)
Scrolls the widget vertically. |
void |
setWordWrap(boolean wrap)
Enabled: Sets whether the widget wraps lines. |
(package private) void |
showBidiCaret()
Sets the caret location and scrolls the caret offset into view. |
(package private) void |
showCaret()
Sets the caret location and scrolls the caret offset into view. |
(package private) void |
showCaret(int caretLine)
Sets the caret location and scrolls the caret offset into view. |
(package private) boolean |
showLocation(int x,
int line)
Scrolls the specified location into view. |
(package private) void |
showOffset(int offset)
Scrolls the specified offset into view. |
void |
showSelection()
Enabled: /** Scrolls the selection into view. |
(package private) void |
updateBidiDirection(boolean isBackspace,
boolean isDirectionBoundary)
Updates the caret direction when a delete operation occured based on the type of the delete operation (next/previous character) and the caret location (at a direction boundary or inside a direction segment). |
(package private) void |
updateSelection(int startOffset,
int replacedLength,
int newLength)
Updates the selection and caret position depending on the text change. |
(package private) void |
wordWrapResize(int oldClientAreaWidth)
Rewraps all lines |
Methods inherited from class org.eclipse.swt.widgets.Canvas |
getCaret, scroll |
Methods inherited from class org.eclipse.swt.widgets.Composite |
checkSubclass, getChildren, getLayout, getTabList, layout, layout, moveAbove, moveBelow, setFocus, setLayout, setTabList |
Methods inherited from class org.eclipse.swt.widgets.Scrollable |
computeTrim, getClientArea, getHorizontalBar, getVerticalBar |
Methods inherited from class org.eclipse.swt.widgets.Widget |
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getStyle, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
static final char TAB
static final String PlatformLineDelimiter
static final int BIDI_CARET_WIDTH
static final int XINSET
static final int DEFAULT_WIDTH
static final int DEFAULT_HEIGHT
static final int ExtendedModify
static final int LineGetBackground
static final int LineGetStyle
static final int TextChanging
static final int TextSet
static final int VerifyKey
static final int TextChanged
static final int LineGetSegments
Color selectionBackground
Color selectionForeground
StyledTextContent logicalContent
StyledTextContent content
DisplayRenderer renderer
TextChangeListener textChangeListener
DefaultLineStyler defaultLineStyler
org.eclipse.swt.custom.StyledText.LineCache lineCache
boolean userLineStyle
boolean userLineBackground
int verticalScrollOffset
int horizontalScrollOffset
int topIndex
int topOffset
int clientAreaHeight
int clientAreaWidth
int lineHeight
int tabLength
int lineEndSpaceWidth
int leftMargin
int topMargin
int rightMargin
int bottomMargin
Cursor ibeamCursor
int columnX
int caretOffset
Point selection
int selectionAnchor
Point doubleClickSelection
boolean editable
boolean wordWrap
boolean doubleClickEnabled
boolean overwrite
int textLimit
Hashtable keyActionMap
Color background
Color foreground
Clipboard clipboard
boolean mouseDoubleClick
int autoScrollDirection
int lastTextChangeStart
int lastTextChangeNewLineCount
int lastTextChangeNewCharCount
int lastTextChangeReplaceLineCount
int lastTextChangeReplaceCharCount
boolean isBidi
boolean bidiColoring
Image leftCaretBitmap
Image rightCaretBitmap
int caretDirection
PaletteData caretPalette
int lastCaretDirection
boolean isCarbon
Constructor Detail |
public StyledText(Composite parent, int style)
The style value is either one of the style constants defined in
class SWT
which is applicable to instances of this
class, or must be built by bitwise OR'ing together
(that is, using the int
"|" operator) two or more
of those SWT
style constants. The class description
lists the style constants that are applicable to the class.
Style bits are also inherited from superclasses.
parent
- a widget which will be the parent of the new instance (cannot be null)style
- the style of widget to constructSWT.FULL_SELECTION
,
SWT.MULTI
,
SWT.READ_ONLY
,
SWT.SINGLE
,
SWT.WRAP
,
Widget.getStyle()
Method Detail |
public void addExtendedModifyListener(ExtendedModifyListener extendedModifyListener)
public void setKeyBinding(int key, int action)
key
- a key code defined in SWT.java or a character.
Optionally ORd with a state mask. Preferred state masks are one or more of
SWT.MOD1, SWT.MOD2, SWT.MOD3, since these masks account for modifier platform
differences. However, there may be cases where using the specific state masks
(i.e., SWT.CTRL, SWT.SHIFT, SWT.ALT, SWT.COMMAND) makes sense.action
- one of the predefined actions defined in ST.java.
Use SWT.NULL to remove a key binding.public void addBidiSegmentListener(BidiSegmentListener listener)
listener
- the listenerBidiSegmentEvent
public void addLineBackgroundListener(LineBackgroundListener listener)
listener
- the listenerpublic void addLineStyleListener(LineStyleListener listener)
listener
- the listenerpublic void addModifyListener(ModifyListener modifyListener)
public void addSelectionListener(SelectionListener listener)
listener
- the listenerpublic void addVerifyKeyListener(VerifyKeyListener listener)
listener
- the listenerpublic void addVerifyListener(VerifyListener verifyListener)
public void append(String string)
string
- the string to be appendedreplaceTextRange(int,int,String)
void calculateContentWidth()
void calculateScrollBars()
void calculateTopIndex()
static int checkStyle(int style)
void claimBottomFreeSpace()
void claimRightFreeSpace()
void clearMargin(GC gc, Color background, Rectangle clientArea, int renderHeight)
gc
- GC to render onbackground
- background color to use for clearing the marginclientArea
- widget client area dimensionsrenderHeight
- height in pixel of the rendered linesvoid clearSelection(boolean sendEvent)
sendEvent
- a Selection event is sent when set to true and when the selection is actually reset.public Point computeSize(int wHint, int hHint, boolean changed)
computeSize
in class Composite
wHint
- the width hint (can be SWT.DEFAULT
)hHint
- the height hint (can be SWT.DEFAULT
)changed
- true
if the control's contents have changed, and false
otherwise
Layout
,
Control.getBorderWidth()
,
Control.getBounds()
,
Control.getSize()
,
Control.pack()
,
"computeTrim, getClientArea for controls that implement them"public void copy()
String getModelDelimitedText(String text)
text
- the text that may have line delimiters that don't
match the model line delimiter. Possible line delimiters
are CR ('\r'), LF ('\n'), CR/LF ("\r\n")
void createKeyBindings()
void createCaretBitmaps()
public void cut()
void doAutoScroll(Event event)
void doAutoScroll(int direction)
direction
- SWT.UP, SWT.DOWN, SWT.RIGHT, SWT.LEFTvoid doBackspace()
void doColumnLeft()
void doColumnRight()
void doContent(char key)
key
- the character typed by the uservoid doContentEnd()
void doContentStart()
void doCursorPrevious()
doSelectionCursorPrevious()
void doCursorNext()
doSelectionCursorNext()
void doDelete()
void doDeleteWordNext()
void doDeleteWordPrevious()
int doLineDown()
void doLineEnd()
void doLineStart()
int doLineUp()
void doMouseLocationChange(int x, int y, boolean select)
x
- x location of the new caret positiony
- y location of the new caret positionselect
- the location change is a selection operation.
include the line delimiter in the selectionvoid doMouseSelection()
int doMouseWordSelect(int x, int newCaretOffset, int line)
x
- mouse x locationnewCaretOffset
- caret offset of the mouse cursor locationline
- line index of the mouse cursor locationvoid doPageDown(boolean select)
select
- whether or not to select the pagevoid doPageEnd()
void doPageStart()
void doPageUp()
void doSelection(int direction)
void doSelectionCursorNext()
void doSelectionCursorPrevious()
void doSelectionLineDown()
void doSelectionLineUp()
void doSelectionPageDown()
Adjusts the selection according to the caret change. This can either add to or subtract from the old selection, depending on the previous selection direction.
void doSelectionPageUp()
Adjusts the selection according to the caret change. This can either add to or subtract from the old selection, depending on the previous selection direction.
void doSelectionWordNext()
void doSelectionWordPrevious()
void doWordNext()
void doWordPrevious()
void draw(int x, int y, int width, int height, boolean clearBackground)
x
- the x positiony
- the y positionwidth
- the widthheight
- the heightclearBackground
- true=clear the background by invalidating the requested
redraw area, false=draw the foreground directly without invalidating the
redraw area.void endAutoScroll()
public Color getBackground()
getBackground
in class Control
public boolean getBidiColoring()
int getBidiOffsetAtMouseLocation(int x, int line)
x
- x location of the mouse locationline
- line the mouse location is in
int getBidiTextPosition(String text, int endOffset, StyledTextBidi bidi)
text
- text to be measured.endOffset
- offset of the characterbidi
- the bidi object to use for measuring text in bidi
locales.
int getBottomIndex()
public int getCaretOffset()
int getCaretOffsetAtX(String line, int lineOffset, int lineXOffset)
line
- text of the line to calculate the offset inlineOffset
- offset of the first character in the line.
0 based from the beginning of the document.lineXOffset
- x location in the line
int getCaretWidth()
public StyledTextContent getContent()
public boolean getDoubleClickEnabled()
public boolean getEditable()
public Color getForeground()
getForeground
in class Control
GC getGC()
int getHorizontalIncrement()
public int getHorizontalIndex()
public int getHorizontalPixel()
public int getKeyBinding(int key)
key
- a key code defined in SWT.java or a character.
Optionally ORd with a state mask. Preferred state masks are one or more of
SWT.MOD1, SWT.MOD2, SWT.MOD3, since these masks account for modifier platform
differences. However, there may be cases where using the specific state masks
(i.e., SWT.CTRL, SWT.SHIFT, SWT.ALT, SWT.COMMAND) makes sense.
public int getCharCount()
public Color getLineBackground(int index)
StyledTextEvent getLineBackgroundData(int lineOffset, String line)
lineOffset
- offset of the line start relative to the start
of the content.line
- line to get line background data for
public int getLineCount()
int getLineCountWhole()
public int getLineAtOffset(int offset)
offset
- offset relative to the start of the content.
0 <= offset <= getCharCount()
public String getLineDelimiter()
StyledTextEvent sendLineEvent(int eventType, int lineOffset, String line)
lineOffset
- offset of the line. This may be the offset of
a visual line if the widget is in word wrap mode.line
- line text. This may be the text of a visualline if
the widget is in word wrap mode.
public int getLineHeight()
org.eclipse.swt.custom.StyledText.LineCache getLineCache(StyledTextContent content)
content
- StyledTextContent to create the LineCache on.
StyledTextEvent getLineStyleData(int lineOffset, String line)
lineOffset
- offset of the line start relative to the start of
the content.line
- line to get line styles for
public Point getLocationAtOffset(int offset)
offset
- offset relative to the start of the content.
0 <= offset <= getCharCount()
public int getOffsetAtLine(int lineIndex)
lineIndex
- index of the line, 0 based relative to the first
line in the content. 0 <= lineIndex < getLineCount(), except
lineIndex may always be 0
public int getOffsetAtLocation(Point point)
point
- the origin of character bounding box relative to
the origin of the widget client area.
int getOffsetAtMouseLocation(int x, int line)
x
- x location of the mouse locationline
- line the mouse location is in
int getOffsetAtX(String line, int lineOffset, int lineXOffset)
line
- text of the line to calculate the offset inlineOffset
- offset of the first character in the line.
0 based from the beginning of the document.lineXOffset
- x location in the line
int getPartialBottomIndex()
String getPlatformDelimitedText(org.eclipse.swt.custom.StyledText.TextWriter writer)
writer
- the TextWriter to write line text into
public Point getSelection()
Text selections are specified in terms of caret positions. In a text widget that contains N characters, there are N+1 caret positions, ranging from 0..N
getSelectionRange()
public Point getSelectionRange()
public Color getSelectionBackground()
public int getSelectionCount()
public Color getSelectionForeground()
public String getSelectionText()
int[] getBidiSegments(int lineOffset, String line)
lineOffset
- offset of the first character in the line.
0 based from the beginning of the document.line
- text of the line to specify bidi segments for
int[] getBidiSegmentsCompatibility(String line, int lineOffset)
Supports deprecated setBidiColoring API. Remove when API is removed.
public StyleRange getStyleRangeAtOffset(int offset)
offset
- the offset to return the style for.
0 <= offset < getCharCount() must be true.
public StyleRange[] getStyleRanges()
StyledTextBidi getStyledTextBidi(String lineText, int lineOffset, GC gc)
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.
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.
public int getTabs()
public String getText()
public String getText(int start, int end)
start
- offset of the first character in the returned Stringend
- offset of the last character in the returned String
getTextRange(int,int)
public String getTextRange(int start, int length)
start
- offset of the first character in the returned Stringlength
- number of characters to return
public int getTextLimit()
int getTextPosition(String line, int lineIndex, int length, GC gc)
line
- line to be measured.lineIndex
- index of the line relative to the first kine of the
documentlength
- number of characters to measure. Tabs are counted
as one character in this parameter.gc
- GC to use for measuring text
public int getTopIndex()
public int getTopPixel()
int getVerticalIncrement()
int getCaretLine()
int getWordEnd(int offset)
There are two classes of words formed by a sequence of characters:
Space characters ' ' (ASCII 20) are special as they are treated as part of the word leading up to the space character. Line breaks are treated as one word.
int getWordEndNoSpaces(int offset)
There are two classes of words formed by a sequence of characters:
Spaces are ignored and do not represent a word. Line breaks are treated as one word.
int getWordStart(int offset)
Space characters ' ' (ASCII 20) are special as they are treated as part of the word leading up to the space character. Line breaks are treated as one word.
public boolean getWordWrap()
int getXAtOffset(String line, int lineIndex, int lineOffset)
public void insert(String string)
string
- the stringreplaceTextRange(int,int,String)
void installDefaultContent()
void installDefaultLineStyler()
addLineStyleListener(org.eclipse.swt.custom.LineStyleListener)
void installListeners()
StyledTextContent internalGetContent()
int internalGetHorizontalPixel()
org.eclipse.swt.custom.StyledText.LineCache internalGetLineCache()
Point internalGetSelection()
boolean internalGetWordWrap()
void internalRedraw()
void internalRedrawRange(int start, int length, boolean clearBackground)
start
- offset of the first character to redrawlength
- number of characters to redrawclearBackground
- true if the background should be cleared as
part of the redraw operation. If true, the entire redraw range will
be cleared before anything is redrawn. If the redraw range includes
the last character of a line (i.e., the entire line is redrawn) the
line is cleared all the way to the right border of the widget.
The redraw operation will be faster and smoother if clearBackground is
set to false. Whether or not the flag can be set to false depends on
the type of change that has taken place. If font styles or background
colors for the redraw range have changed, clearBackground should be
set to true. If only foreground colors have changed for the redraw
range, clearBackground can be set to false.String getRtf()
void handleDispose()
void handleHorizontalScroll(Event event)
void handleKey(Event event)
event
- keyboard eventvoid handleKeyDown(Event event)
event
- keyboard eventvoid handleMouseDoubleClick(Event event)
void handleMouseDown(Event event)
void handleMouseMove(Event event)
void handleMouseUp(Event event)
void handlePaint(Event event)
event
- paint eventvoid handleResize(Event event)
event
- resize eventvoid handleTextChanged(TextChangedEvent event)
void handleTextChanging(TextChangingEvent event)
void handleTextSet(TextChangedEvent event)
event
- text change event.void handleTraverse(Event event)
event
- the eventvoid handleVerticalScroll(Event event)
void initializeRenderer()
public void invokeAction(int action)
action
- one of the actions defined in ST.javaboolean isBidi()
boolean isLineDelimiter(int offset)
boolean isAreaVisible(int firstLine, int lastLine)
boolean isRedrawFirstLine(StyleRange[] ranges, int firstLine, int firstLineOffset)
boolean isRedrawLastLine(StyleRange[] ranges, int lastLine, int lastLineOffset)
boolean isSingleLine()
boolean isStyleChanging(StyleRange range, int start, int end)
range
- StyleRange to compare current font style with.start
- offset of the first font style to compareend
- offset behind the last font style to compare
void modifyContent(Event event, boolean updateCaret)
event
- the text change event.
updateCaret
- whether or not he caret should be set behind
the new textpublic void paste()
void performPaint(GC gc, int startLine, int startY, int renderHeight)
gc
- GC to render onstartLine
- first line to renderstartY
- y pixel location to start rendering atrenderHeight
- renderHeight widget area that needs to be filled with linespublic void print()
public Runnable print(org.eclipse.swt.printing.Printer printer)
The runnable may be run in a non-UI thread.
printer
- the printer to print topublic Runnable print(org.eclipse.swt.printing.Printer printer, org.eclipse.swt.custom.StyledTextPrintOptions options)
The runnable may be run in a non-UI thread.
printer
- the printer to print tooptions
- print options to use during printingpublic void redraw()
Recalculates the content width for all lines in the bounds.
When a LineStyleListener
is used a redraw call
is the only notification to the widget that styles have changed
and that the content width may have changed.
redraw
in class Control
Control.update()
public void redraw(int x, int y, int width, int height, boolean all)
all
flag
is true
, any children of the receiver which
intersect with the specified area will also paint their
intersecting areas. If the all
flag is
false
, the children will not be painted.
Marks the content width of all lines in the specified rectangle
as unknown. Recalculates the content width of all visible lines.
When a LineStyleListener
is used a redraw call
is the only notification to the widget that styles have changed
and that the content width may have changed.
redraw
in class Control
x
- the x coordinate of the area to drawy
- the y coordinate of the area to drawwidth
- the width of the area to drawheight
- the height of the area to drawall
- true
if children should redraw, and false
otherwiseControl.update()
void redrawBidiLines(int firstLine, int offsetInFirstLine, int lastLine, int endOffset, boolean clearBackground)
firstLine
- first line to redraw at the specified offsetoffsetInFirstLine
- offset in firstLine to start redrawinglastLine
- last line to redrawendOffset
- offset in the last where redrawing should stopclearBackground
- true=clear the background by invalidating
the requested redraw range, false=draw the foreground directly
without invalidating the redraw range.void redrawLine(int line, int offset)
line
- index of the line to redrawoffset
- offset in line to start redrawingvoid redrawLines(int firstLine, int offsetInFirstLine, int lastLine, int endOffset, boolean clearBackground)
firstLine
- first line to redraw at the specified offsetoffsetInFirstLine
- offset in firstLine to start redrawinglastLine
- last line to redrawendOffset
- offset in the last where redrawing should stopclearBackground
- true=clear the background by invalidating
the requested redraw range. If the redraw range includes the
last character of a line (i.e., the entire line is redrawn) the
line is cleared all the way to the right border of the widget.
false=draw the foreground directly without invalidating the
redraw range.void redrawMultiLineChange(int y, int newLineCount, int replacedLineCount)
y
- y location of the text changenewLineCount
- number of new lines.replacedLineCount
- number of replaced lines.public void redrawRange(int start, int length, boolean clearBackground)
start
- offset of the first character to redrawlength
- number of characters to redrawclearBackground
- true if the background should be cleared as
part of the redraw operation. If true, the entire redraw range will
be cleared before anything is redrawn. If the redraw range includes
the last character of a line (i.e., the entire line is redrawn) the
line is cleared all the way to the right border of the widget.
The redraw operation will be faster and smoother if clearBackground
is set to false. Whether or not the flag can be set to false depends
on the type of change that has taken place. If font styles or
background colors for the redraw range have changed, clearBackground
should be set to true. If only foreground colors have changed for
the redraw range, clearBackground can be set to false.public void removeBidiSegmentListener(BidiSegmentListener listener)
listener
- the listenerpublic void removeExtendedModifyListener(ExtendedModifyListener extendedModifyListener)
public void removeLineBackgroundListener(LineBackgroundListener listener)
listener
- the listenerpublic void removeLineStyleListener(LineStyleListener listener)
listener
- the listenerpublic void removeModifyListener(ModifyListener modifyListener)
public void removeSelectionListener(SelectionListener listener)
listener
- the listenerpublic void removeVerifyListener(VerifyListener verifyListener)
public void removeVerifyKeyListener(VerifyKeyListener listener)
listener
- the listenerpublic void replaceStyleRanges(int start, int length, StyleRange[] ranges)
Should not be called if a LineStyleListener has been set since the listener maintains the styles.
start
- offset of first character where styles will be deletedlength
- length of the range to delete styles inranges
- StyleRange objects containing the new style information.
The ranges should not overlap and should be within the specified start
and length. The style rendering is undefined if the ranges do overlap
or are ill-defined. Must not be null.public void replaceTextRange(int start, int length, String text)
NOTE: During the replace operation the current selection is changed as follows:
start
- offset of first character to replacelength
- number of characters to replace. Use 0 to insert texttext
- new text. May be empty to delete text.void reset()
void resetSelection()
void scrollHorizontal(int pixels)
pixels
- number of pixels to scroll, > 0 = scroll left,
< 0 scroll rightboolean scrollHorizontalBar(int pixels)
pixels
- number of pixels to scroll, > 0 = scroll left,
< 0 scroll right
public void selectAll()
void sendKeyEvent(Event event)
event
- the text change event.
void sendSelectionEvent()
public void setWordWrap(boolean wrap)
wrap
- true=widget wraps lines, false=widget does not wrap linesvoid showBidiCaret()
public void setCaret(Caret caret)
setCaret
in class Canvas
caret
- the new caret for the receiverpublic void setBackground(Color color)
setBackground
in class Control
color
- the new color (or null)void setBidiCaretDirection()
void setBidiCaretLocation(StyledTextBidi bidi)
bidi
- StyledTextBidi object to use for measuring.
May be left null in which case a new object will be created.void setBidiCaretLocation(StyledTextBidi bidi, int caretLine)
bidi
- StyledTextBidi object to use for measuring.
May be left null in which case a new object will be created.caretLine
- line the caret should be placed on. Relative to
first line in documentpublic void setBidiColoring(boolean mode)
mode
- the new coloring modevoid setBidiKeyboardLanguage()
void setCaretLocation(int newCaretX, int line)
newCaretX
- the new x location of the caret.
passed in for better performance when it has already been
calculated outside this method.line
- index of the line the caret is on. Relative to
the first line in the document.void setCaretLocation()
public void setCaretOffset(int offset)
offset
- caret offset, relative to the first character in the text.void setClipboardContent(int start, int length) throws SWTError
start
- start index of the textlength
- length of text to place in clipboard
SWTError
org.eclipse.swt.dnd.Clipboard.setContents
public void setContent(StyledTextContent newContent)
public void setCursor(Cursor cursor)
setCursor
in class Control
cursor
- the new cursor (or null)org.eclipse.swt.widgets.Control#setCursor
public void setDoubleClickEnabled(boolean enable)
enable
- if true double clicking a word selects the word, if false
double clicks have the same effect as regular mouse clicks.public void setEditable(boolean editable)
editable
- if true content can be edited, if false content can not be
editedpublic void setFont(Font font)
NOTE: Italic fonts are not supported unless they have no overhang and the same baseline as regular fonts.
setFont
in class Canvas
font
- new fontpublic void setForeground(Color color)
setForeground
in class Control
color
- the new color (or null)public void setHorizontalIndex(int offset)
NOTE: The horizontal index is reset to 0 when new text is set in the widget.
offset
- horizontal scroll offset relative to the start
of the line, measured in character increments starting at 0, if
equal to 0 the content is not scrolled, if > 0 = the content is scrolled.public void setHorizontalPixel(int pixel)
NOTE: The horizontal pixel offset is reset to 0 when new text is set in the widget.
pixel
- horizontal pixel offset relative to the start
of the line.void setHorizontalScrollBar()
public void setLineBackground(int startLine, int lineCount, Color background)
Line background colors are maintained relative to the line text, not the line index that is specified in this method call. During text changes, when entire lines are inserted or removed, the line background colors that are associated with the lines after the change will "move" with their respective text. An entire line is defined as extending from the first character on a line to the last and including the line delimiter.
When two lines are joined by deleting a line delimiter, the top line background takes precedence and the color of the bottom line is deleted. For all other text changes line background colors will remain unchanged.
startLine
- first line the color is applied to, 0 basedlineCount
- number of lines the color applies to.background
- line background colorvoid setMouseWordSelectionAnchor()
void setScrollBars()
public void setSelection(int start)
start
- new caret positionsetSelection(int,int)
public void setSelection(Point point)
Indexing is zero based. Text selections are specified in terms of caret positions. In a text widget that contains N characters, there are N+1 caret positions, ranging from 0..N
point
- x=selection start offset, y=selection end offset
The caret will be placed at the selection start when x > y.setSelection(int,int)
public void setSelectionBackground(Color color)
color
- the new color (or null)public void setSelectionForeground(Color color)
color
- the new color (or null)public void setSelection(int start, int end)
Indexing is zero based. Text selections are specified in terms of caret positions. In a text widget that contains N characters, there are N+1 caret positions, ranging from 0..N
start
- selection start offset. The caret will be placed at the
selection start when start > end.end
- selection end offsetsetSelectionRange(int,int)
public void setSelectionRange(int start, int length)
start
- offset of the first selected character, start >= 0 must be true.length
- number of characters to select, 0 <= start + length <= getCharCount()
must be true.
A negative length places the caret at the visual start of the selection.void internalSetSelection(int start, int length, boolean sendEvent)
start
- offset of the first selected character, start >= 0 must be true.length
- number of characters to select, 0 <= start + length
<= getCharCount() must be true.
A negative length places the caret at the selection start.sendEvent
- a Selection event is sent when set to true and when
the selection is reset.public void setStyleRange(StyleRange range)
Should not be called if a LineStyleListener has been set since the listener maintains the styles.
range
- StyleRange object containing the style information.
Overwrites the old style in the given range. May be null to delete
all styles.public void setStyleRanges(StyleRange[] ranges)
Should not be called if a LineStyleListener has been set since the listener maintains the styles.
ranges
- StyleRange objects containing the style information.
The ranges should not overlap. The style rendering is undefined if
the ranges do overlap. Must not be null.public void setTabs(int tabs)
tabs
- tab width measured in characters.public void setText(String text)
Note: Only a single line of text should be set when the SWT.SINGLE style is used.
text
- new widget content. Replaces existing content. Line styles
that were set using StyledText API are discarded. The
current selection is also discarded.public void setTextLimit(int limit)
The text limit specifies the amount of text that the user can type into the widget.
limit
- the new text limit.public void setTopIndex(int topIndex)
The top index is the index of the line that is currently at the top of the widget. The top index changes when the widget is scrolled. Indexing starts from zero. Note: The top index is reset to 0 when new text is set in the widget.
public void setTopPixel(int pixel)
The top pixel offset is the vertical pixel offset of the widget. The widget is scrolled so that the given pixel position is at the top. The top index is adjusted to the corresponding top line. Note: The top pixel is reset to 0 when new text is set in the widget.
pixel
- new top pixel offset. Must be between 0 and
(getLineCount() - visible lines per page) / getLineHeight()). An out
of range offset will be adjusted accordingly.boolean setVerticalScrollOffset(int pixelOffset, boolean adjustScrollBar)
pixelOffset
- the new vertical scroll offsetadjustScrollBar
- true= the scroll thumb will be moved to reflect the new scroll offset.
false = the scroll thumb will not be moved
boolean showLocation(int x, int line)
x
- the x coordinate that should be made visible.line
- the line that should be made visible. Relative to the
first line in the document.
void showCaret()
void showCaret(int caretLine)
void showOffset(int offset)
offset
- offset that should be scolled into viewpublic void showSelection()
void updateBidiDirection(boolean isBackspace, boolean isDirectionBoundary)
isBackspace
- true=the previous character was deleted, false=the
character next to the caret location was deletedisDirectionBoundary
- true=the caret is between a R2L and L2R segment,
false=the caret is within a direction segmentvoid updateSelection(int startOffset, int replacedLength, int newLength)
startOffset
- offset of the text changereplacedLength
- length of text being replacednewLength
- length of new textvoid wordWrapResize(int oldClientAreaWidth)
oldClientAreaWidth
- client area width before resize
occurred
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |