|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.ui.ControlBase
ewe.ui.Control
ewe.ui.EditControl
ewe.ui.mTextPad
You should use this instead of mTextArea. This is a multi-line text editor which has the ability to wrap lines to fit the display. This control is designed to be able to be the base class for a full text editor (e.g. a NotePad).
| Field Summary | |
boolean |
allowOverwrite
If this is true (which it is by default) then the user will be allowed to switch between overwrite and insert mode using the INS key. |
protected boolean |
amScrolling
|
IImage |
backgroundImage
|
protected static ImageBuffer |
blockBuffer
|
int |
charWidth
This is used to estimate line lengths. |
protected ewe.ui.textPadState |
curState
|
boolean |
disableCursor
Set this true to disable the cursor. |
boolean |
disableTextChanges
Set this true to disable any text changes. |
protected DisplayLineSpecs |
dls
|
boolean |
dontWantPopup
This is false by default. |
int |
extraLineSpacing
This is extra spacing placed between lines. |
int |
forcedActualWidth
Set this to be a non-zero value to have a specific document width (in pixels), regardless of the length of the lines being displayed. |
FormattedTextSpecs |
format
This can be used to alter things like the tab stop width. |
int |
inputState
This is used to determine the state of the input. |
protected static ImageBuffer |
itemBuffer
|
int |
leftMargin
This is the left margin. |
protected int |
lineHeight
|
protected DisplayLine |
lines
|
int |
minXScroll
A percent figure. |
int |
minYScroll
A percent figure. |
protected int |
numLines
|
int |
rightMargin
This is the right margin. |
boolean |
selectAllOnFocus
If this is true the entire text is selected when it gains focus. |
int |
spacing
|
static int |
STATE_AUTOTAB
This is used with the inputState variable to indicate auto-tab mode. |
static int |
STATE_OVERWRITE
This is used with the inputState variable to indicate overwrite mode (as opposed to insert mode). |
boolean |
wantReturn
This is true by default. |
boolean |
wrapToScreenSize
This is true by default - it tells the control to wrap lines to fit the display. |
| Fields inherited from class ewe.ui.EditControl |
blinkId, CASE_LOWER, CASE_NORMAL, CASE_NUMBERS, CASE_SENTENCE, CASE_UPPER, colors, conditionalChar, conditionalCharIndex, doingLocalInput, doingNativeInput, FLAG_INPUT_ON_FOCUS, FLAG_KEEP_FOCUS_AFTER_INPUT, FLAG_PASSIVE, FLAG_USE_NATIVE, inFocus, inputFlags, inputMethod, justGotFocus, oldText, pageColor, startNativeOnPaint, textCase, validator |
| Fields inherited from class ewe.ui.Control |
_debug, backGround, beforeRemoved, borderColor, borderStyle, borderWidth, children, columns, constraints, DoPaintMethod, dragging, dragResolution, dragTime, exitKeys, fieldTransfer, font, foreGround, haveNativePaint, height, holdDownPause, holdTick, hotKey, image, lastSelected, listeners, maxHeight, maxWidth, menuState, minHeight, minWidth, modifiers, MyClass, name, next, np, parent, penStatus, popupSound, popupSoundClip, preferredHeight, preferredWidth, prev, prompt, promptControl, rows, ss, standardBorder, standardEdge, startDragResolution, tags, tail, text, toolTip, width, x, y |
| Fields inherited from class ewe.ui.ControlBase |
clipItems, clipObject, clipOwner, curPoint, currentPenEvent, debugControl, debugFlag, DidHoldDown, doubleBuffer, doubleClickTime, firstPress, globalDrawFlat, globalEditable, globalEnabled, globalPalmStyle, globalSmallControls, GotPenDown, PenIsOn, TAG_LAST_USER_DATA, TAG_USER_DATA, TAKE_FIRST_PRESS, unnamed, useNativeTextInput |
| Fields inherited from interface ewe.ui.IScroll |
Higher, Horizontal, Lower, OPTION_INDICATOR_ONLY, PageHigher, PageLower, ScrollHigher, ScrollLower, TrackTo, Vertical |
| Fields inherited from interface ewe.ui.UIConstants |
BDR_DOTTED, BDR_INNER, BDR_NOBORDER, BDR_OUTER, BDR_OUTLINE, BDR_RAISEDINNER, BDR_RAISEDOUTER, BDR_SUNKENINNER, BDR_SUNKENOUTER, BF_BOTTOM, BF_BOTTOMLEFT, BF_BOTTOMRIGHT, BF_BUTTON, BF_DIAGONAL, BF_DIAGONAL_ENDBOTTOMLEFT, BF_DIAGONAL_ENDBOTTOMRIGHT, BF_DIAGONAL_ENDTOPLEFT, BF_DIAGONAL_ENDTOPRIGHT, BF_EXACT, BF_FLAT, BF_LEFT, BF_MIDDLE, BF_MONO, BF_PALM, BF_RECT, BF_RIGHT, BF_SOFT, BF_SQUARE, BF_TOP, BF_TOPLEFT, BF_TOPRIGHT, EDGE_BUMP, EDGE_ETCHED, EDGE_RAISED, EDGE_SUNKEN |
| Fields inherited from interface ewe.ui.CellConstants |
BORDER, BOTTOM, CELLFLAG, CELLMASK, CENTER, CONTROLMASK, DONTCHANGE, DONTFILL, DONTSTRETCH, EAST, FILL, FIXEDSIZE, GROW, HCENTER, HCONTRACT, HEXPAND, HFILL, HGROW, HSHRINK, HSTRETCH, INITIALLY_CLOSED, INITIALLY_MINIMIZED, INITIALLY_PREFERRED_SIZE, INSETS, LEFT, MAXIMUMSIZE, MINIMUMSIZE, NORTH, NORTHEAST, NORTHWEST, PREFERREDSIZE, RECT, RIGHT, SHRINK, SOUTH, SOUTHEAST, SOUTHWEST, SPAN, STRETCH, TEXTSIZE, TOP, VCENTER, VCONTRACT, VEXPAND, VFILL, VGROW, VSHRINK, VSTRETCH, WEST |
| Fields inherited from interface ewe.ui.ControlConstants |
All, AlwaysEnabled, AlwaysRecalculateSizes, ByDeferredMouse, ByDeferredPen, ByFrameChange, ByKeyboard, ByMouse, ByPen, ByRequest, CalculatedSizes, Disabled, DisablePopupMenu, DisplayOnly, Down, DrawFlat, Flag, ForceResize, HasData, Invisible, KeepImage, KeepSIP, Left, MakeMenuAtLeastAsWide, Maximize, Minimize, MouseSensitive, NoFocus, NotAnEditor, NotEditable, PaintDataOnly, PaintOutsideOnly, PenTransparent, PreferredSizeOnly, Right, SendUpKeyEvents, SendUpPenEvents, ShowSIP, ShrinkToNothing, SmallControl, SpecialBackground, TakeControlEvents, TakesKeyFocus, Transparent, Up, WantDrag, WantHoldDown |
| Fields inherited from interface ewe.fx.ImageRefresher |
KEEP_VISIBLE |
| Constructor Summary | |
mTextPad()
|
|
mTextPad(int rows,
int columns)
|
|
mTextPad(String text)
|
|
| Method Summary | |
boolean |
acceptsData(Object data,
DragContext how)
This should indicate whether this control will accept the data either via a drag and drop or via a paste operation. |
DisplayLine |
addDisplayLine(String newLine,
DisplayLine addBefore)
|
void |
addDisplayLines(DisplayLine newSequence,
DisplayLine addBefore)
|
void |
appendText(String what,
boolean moveToEnd)
|
protected void |
applySpecialFormat(int formatIndex,
int lineIndex,
DisplayLine theLine,
FormattedTextSpecs format)
|
protected String |
autoTab(String currentLine,
String newLine)
|
DisplayLine |
breakLineBefore(DisplayLine dataLine,
int index)
This forces a line break in the specified data line immediately before the specified index. |
protected void |
calculateSizes()
Override this to calculate the preferred, minimum and maximum size of your control. |
boolean |
canGo(int orientation,
int direction,
int position)
|
void |
checkScrolls()
|
boolean |
checkSipCoverage()
|
protected void |
clearCursor()
|
void |
clearSelection()
This clears the selection but does not update the screen. |
void |
dataAccepted(Control by,
Object theData,
String action)
This is called either when data that was cut from this control was pasted into another control, OR when data that was dragged from this control is dropped into another control. |
void |
dataDraggedOff(Object data)
This is called when data that was previously dragged into the control has now been dragged off. |
void |
dataDraggedOver(Object data,
Point p,
PenEvent ev)
This is called when data is being dragged into the control. |
boolean |
dataDroppedOn(Object data,
Point where,
DragContext dc)
This is called by a drop from a drag and drop operation. |
protected void |
dataTransferCancelled(Object data)
This gets called either when that was cut from this control was not placed into another control (either it was rejected by a paste or a subsequent copy/cut into the clipboard occured before the data was pasted) or a drag and drop was initiated but not completed. |
boolean |
deleteSelection()
|
void |
displayLinesChanged()
|
void |
doPaint(Graphics g,
Rect area)
|
protected void |
doPaintData(Graphics g)
Repaint the "data" part of the Control. |
protected void |
doPaintData(Graphics g,
Rect area)
|
void |
doScroll(int which,
int action,
int value)
|
protected boolean |
doShowMenu(Point p)
Used to show the menu associated with the Control. |
void |
dragged(DragContext dc)
This is called during the drag operation. |
protected void |
drawSpecialFormat(int formatIndex,
int lineIndex,
DisplayLine theLine,
FormattedTextSpecs format,
Graphics g,
Color background)
|
int |
ensureBlankLines(DisplayLine dataLine,
int count,
boolean above)
Insert blank lines before or after the specified data line so that there are at least count number of blank lines before or after the data line. |
protected boolean |
fix()
|
protected void |
fixText()
|
int |
getActual(int which)
|
int |
getAvailableWidth()
|
int |
getBaselineHeight()
Returns the height in pixels from the top of a line down to the baseline of the font. |
Point |
getCharAt(Point onControl)
Get the line and character index of the character at the point specified (relative to the origin of the mTextPad). |
Point |
getCharAt(Point onControl,
boolean bestGuess,
boolean halfWay)
Get the line and character index of the character at the point specified (relative to the origin of the mTextPad). |
protected boolean |
getCharRect(int ch,
int ln,
Rect dest)
|
int |
getCurrent(int which)
|
Point |
getCursorPosition()
Get the character location of the cursor (caret). |
protected boolean |
getCursorRect(int ch,
int ln,
Rect dest)
|
Dimension |
getIndexLocation(int characterIndex,
Dimension dest)
This locates the row and column index of a character from the original text in the list of DisplayLines. |
int |
getLeftPosition()
Return how many pixels the display is shifted to the right. |
protected DisplayLine |
getLine()
|
DisplayLine |
getLine(int index)
Get the DisplayLine at the specified index. |
String |
getLineAt(int index)
Get the line at the specified index. |
String |
getLineAt(int index,
boolean trueLine)
Get the line at the specified index. |
int |
getLineHeight()
Returns the height in pixels of each line (all lines are the same height). |
int |
getLineLength(int index,
boolean trueLength)
Return the length of the line in characters, with or without the ending line feed. |
String[] |
getLines()
Get all the lines. |
int |
getNumLines()
Return the number of lines being displayed. |
protected Point |
getPenChar(Point onControl)
|
int |
getScreenRows()
|
ScrollablePanel |
getScrollablePanel()
|
Object |
getSelection()
|
Rect |
getSelectionRange()
This returns the selected area, or null if there is no selection. |
protected int |
getSpecialFormatCount(int lineIndex,
DisplayLine theLine)
|
Object |
getState()
Get an Object that can be used to restore the text display to the same state later (using setState(). |
String |
getText()
|
Menu |
getTextPadMenu(Menu addTo)
|
protected FormattedTextSpecs |
getTextPositions(int lineIndex,
DisplayLine line)
|
FormattedTextSpecs |
getTextPositions(int lineIndex,
DisplayLine line,
FormattedTextSpecs format,
int[] posBuffer,
boolean useFormatters)
|
int |
getTextWidth()
If wrapToScreenSize is true, this returns the width of the widest word. |
int |
getTopLine()
Return the index of the top line of the display in the complete list of lines. |
int |
getTrueCharIndex(int lineIndex,
int charIndex)
Get the index of the character in the original text, given the line index and character index on screen. |
int |
getTrueCharIndex(Point charPosition)
Get the index of the character in the original text, given the line index and character index on screen. |
int |
getVisible(int which,
int forSize)
|
void |
gotFocus(int how)
|
boolean |
hasSelection()
|
void |
lostFocus(int how)
|
boolean |
needScrollBar(int which,
int forSize)
|
boolean |
newCursorPos(int ch,
int ln,
boolean takeSel)
This calls newCursorPos(int ch,int ln,boolean takeSel,boolean leaveSel) with leaveSel set to false. |
boolean |
newCursorPos(int ch,
int ln,
boolean takeSel,
boolean leaveSel)
This is used to move the cursor position AND update the display accordingly. |
boolean |
noSelection()
|
void |
onEvent(Event ev)
|
void |
onKeyEvent(KeyEvent ev)
|
void |
onPenEvent(PenEvent ev)
Called to handle an incoming PenEvent. |
protected boolean |
paintConditionalChar(Graphics g,
boolean highlight)
|
void |
paintCursor(Graphics gr)
|
void |
paintCursor(Graphics gr,
boolean sticky)
|
void |
paintLastChar(Graphics g)
|
void |
paintLastChar(Graphics g,
char toErase)
|
void |
paintLine(Graphics g,
int index)
|
void |
paintLine(Graphics g,
int index,
DisplayLine theLine)
|
void |
paintLines(int from,
int to)
|
protected void |
paintLinesFrom(int index)
|
void |
penDoubleClicked(Point where)
Called if the Pen or Mouse button is double clicked on the Control. |
void |
penPressed(Point where)
Called when the Pen or Mouse button is pressed on the control. |
void |
penReleased(Point where)
Called when the Pen or Mouse button is released on the control. |
protected void |
popupMenuClosed(Menu m)
This gets closed after the popup menu for the Control has closed. |
void |
popupMenuEvent(Object selectedItem)
This is called when the user selects an item from the popup menu. |
void |
pushDisplayLine(String newLine,
int newFlags,
DisplayLine pushDown)
|
protected void |
rearrange(DisplayLine firstLine,
int indexOfFirst,
DisplayLine lastLine,
boolean repaint)
This re-arrange the section the cursor is on and following sections up to lastSection. |
void |
removeDisplayLine(DisplayLine toRemove)
Remove a single DisplayLine |
protected boolean |
removeSelection()
This deletes any selected area and updates the cursor, but it does not do a resplitting of the lines nor does it do a repaint. |
void |
replaceDisplayLines(DisplayLine newSequence,
DisplayLine firstToReplace,
DisplayLine lastToReplace)
|
protected void |
replaceLines(DisplayLine start,
int length,
DisplayLine newLines)
|
boolean |
replaceSelection(Object with)
This will replace the current selection with the provided Object. |
void |
resizeTo(int width,
int height)
This will change the width and height values. |
DisplayLine |
resplit(DisplayLine firstLine,
int numLines,
int forWidth,
DisplayLine.WidthProvider widthProvider,
FontMetrics fm,
String newText)
Resplit and replace lines of text, possibly substituting new text. |
void |
scrollTo(int lineIndex,
boolean placeLineAtBottom)
Scroll the display so that the specified line is now visible. |
void |
selectAll()
|
Control |
setAsStaticDisplay(boolean makeScrollBar)
This modifies the mTextPad to be a static text display - where the cursor is never displayed and the cursor keys will scroll the display. |
protected void |
setNativeInputFlags(TextInputParameters tip)
|
boolean |
setSelectionRange(int originalCharacterIndex,
int numCharacters)
This sets the current selection and will also move the cursor to the end of the selection. |
boolean |
setSelectionRange(int startChar,
int startLine,
int endChar,
int endLine)
This sets the current selection and will also move the cursor to the end of the selection. |
boolean |
setState(Object state)
Reset the display to the state as provided by getState(). |
void |
setText(String what)
|
protected void |
splitLines(int width)
|
DisplayLine |
splitLines(String text,
DisplayLine.WidthProvider widthProvider,
FontMetrics fontMetrics,
FormattedTextSpecs fts)
This is used by TextFormatters to split text for display. |
DisplayLine |
splitLines(String text,
int forWidth,
FontMetrics fontMetrics,
FormattedTextSpecs fts)
This is used by TextFormatters to split text for display. |
void |
startDragging(DragContext dc)
This is called to indicate the start of a pen/mouse drag operation. |
void |
ticked(int id,
int elapsed)
|
void |
update()
|
void |
update(boolean doChecks)
|
protected void |
updateScrolls()
|
| Methods inherited from class ewe.ui.EditControl |
checkInputMethod, dataBeingRemoved, fixCase, getBestPassiveFlags, getColors, hasChanged, keepConditionalChar, onControlEvent, setConditionalChar, startActiveInput, startLocalInput, startNativeInput, takeData, updateData |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode |
| Methods inherited from interface ewe.ui.ScrollClient |
getServer, setServer |
| Field Detail |
protected DisplayLine lines
protected DisplayLineSpecs dls
public IImage backgroundImage
public boolean wrapToScreenSize
public int spacing
public boolean dontWantPopup
public boolean wantReturn
public int minXScroll
public int minYScroll
public boolean selectAllOnFocus
public boolean allowOverwrite
public int charWidth
public boolean disableCursor
public boolean disableTextChanges
protected int numLines
protected int lineHeight
public int inputState
public static final int STATE_OVERWRITE
public static final int STATE_AUTOTAB
public int leftMargin
public int rightMargin
public int extraLineSpacing
protected static ImageBuffer itemBuffer
protected static ImageBuffer blockBuffer
public FormattedTextSpecs format
protected boolean amScrolling
public int forcedActualWidth
protected ewe.ui.textPadState curState
| Constructor Detail |
public mTextPad()
public mTextPad(int rows,
int columns)
public mTextPad(String text)
| Method Detail |
public Menu getTextPadMenu(Menu addTo)
protected boolean doShowMenu(Point p)
Control
doShowMenu in class Controlp - The point where the pen was pressed.
protected void popupMenuClosed(Menu m)
Control
popupMenuClosed in class Controlpublic int getLineHeight()
public int getBaselineHeight()
protected void calculateSizes()
Control
calculateSizes in class Controlpublic int getAvailableWidth()
public int getNumLines()
public int getTextWidth()
public void resizeTo(int width,
int height)
Control
resizeTo in class Controlpublic void displayLinesChanged()
public void pushDisplayLine(String newLine,
int newFlags,
DisplayLine pushDown)
public DisplayLine addDisplayLine(String newLine,
DisplayLine addBefore)
public void addDisplayLines(DisplayLine newSequence,
DisplayLine addBefore)
public int ensureBlankLines(DisplayLine dataLine,
int count,
boolean above)
dataLine - The data line.count - The number of blank lines.above - if this is true the blank lines will be added before (above) the data line.
public DisplayLine breakLineBefore(DisplayLine dataLine,
int index)
dataLine - The dataLine to break.index - The index of the character before which a break will be added.
public void replaceDisplayLines(DisplayLine newSequence,
DisplayLine firstToReplace,
DisplayLine lastToReplace)
public void removeDisplayLine(DisplayLine toRemove)
public DisplayLine splitLines(String text,
int forWidth,
FontMetrics fontMetrics,
FormattedTextSpecs fts)
text - The text to split.forWidth - The width in pixels to split for.fontMetrics - The font metrics to use. If this is null then the mTextPad's metrics will be used.fts - The FormattedTextSpecs to use. If this is null then the mTextPad's specs will be used.
public DisplayLine splitLines(String text,
DisplayLine.WidthProvider widthProvider,
FontMetrics fontMetrics,
FormattedTextSpecs fts)
text - The text to split.widthProvider - An object to provide the width of each line.fontMetrics - The font metrics to use. If this is null then the mTextPad's metrics will be used.fts - The FormattedTextSpecs to use. If this is null then the mTextPad's specs will be used.
public DisplayLine resplit(DisplayLine firstLine,
int numLines,
int forWidth,
DisplayLine.WidthProvider widthProvider,
FontMetrics fm,
String newText)
firstLine - The first DisplayLine in the sequence.numLines - The number of lines in the sequence.forWidth - The width to wrap the lines to. Can be zero if widthProvider is used.widthProvider - An optional DisplayLine.WidthProvider to provide widths for each line.fm - The FontMetrics to use, can be null to use the mTextPad's FontMetrics.newText - Optional new text, if null then the original text is used.
protected void splitLines(int width)
protected boolean getCharRect(int ch,
int ln,
Rect dest)
protected boolean getCursorRect(int ch,
int ln,
Rect dest)
public void setText(String what)
setText in class Controlpublic String getText()
getText in class Controlpublic String[] getLines()
protected void fixText()
public int getScreenRows()
public void paintLastChar(Graphics g)
public void paintLastChar(Graphics g,
char toErase)
public boolean deleteSelection()
deleteSelection in interface Selectable
public void paintLine(Graphics g,
int index)
protected int getSpecialFormatCount(int lineIndex,
DisplayLine theLine)
protected void applySpecialFormat(int formatIndex,
int lineIndex,
DisplayLine theLine,
FormattedTextSpecs format)
protected void drawSpecialFormat(int formatIndex,
int lineIndex,
DisplayLine theLine,
FormattedTextSpecs format,
Graphics g,
Color background)
public FormattedTextSpecs getTextPositions(int lineIndex,
DisplayLine line,
FormattedTextSpecs format,
int[] posBuffer,
boolean useFormatters)
protected FormattedTextSpecs getTextPositions(int lineIndex,
DisplayLine line)
public void paintLine(Graphics g,
int index,
DisplayLine theLine)
public void doPaint(Graphics g,
Rect area)
doPaint in class Controlpublic void paintCursor(Graphics gr)
public void paintCursor(Graphics gr,
boolean sticky)
protected void doPaintData(Graphics g)
Control
doPaintData in class Controlg - The Graphics object to paint to.
protected void doPaintData(Graphics g,
Rect area)
public void paintLines(int from,
int to)
protected void paintLinesFrom(int index)
public ScrollablePanel getScrollablePanel()
public void update()
update in class EditControlpublic void update(boolean doChecks)
public int getActual(int which)
getActual in interface ScrollClient
public int getVisible(int which,
int forSize)
getVisible in interface ScrollClientpublic int getCurrent(int which)
getCurrent in interface ScrollClient
public boolean needScrollBar(int which,
int forSize)
needScrollBar in interface ScrollClient
public boolean canGo(int orientation,
int direction,
int position)
canGo in interface ScrollClient
public void doScroll(int which,
int action,
int value)
doScroll in interface ScrollClientpublic void checkScrolls()
protected void updateScrolls()
public void ticked(int id,
int elapsed)
ticked in interface TimerProcticked in class Controlpublic void popupMenuEvent(Object selectedItem)
Control
popupMenuEvent in class ControlselectedItem - The item selected.public void selectAll()
selectAll in class EditControlpublic boolean checkSipCoverage()
checkSipCoverage in class EditControlpublic void gotFocus(int how)
gotFocus in class Controlpublic void lostFocus(int how)
lostFocus in class Controlprotected void setNativeInputFlags(TextInputParameters tip)
setNativeInputFlags in class EditControlprotected boolean fix()
public boolean newCursorPos(int ch,
int ln,
boolean takeSel)
public boolean newCursorPos(int ch,
int ln,
boolean takeSel,
boolean leaveSel)
ch - The character position on the line.ln - The line.takeSel - If this is true then the selection will be extended to the new cursor position.
If it is false AND leaveSel is also false, any selected area will be deselected. If this is false AND
leaveSel is true, the selection will be left as is.leaveSel - If this is true AND takeSel is false, then the selection will not be altered.
public int getTopLine()
public int getLeftPosition()
public Point getCharAt(Point onControl,
boolean bestGuess,
boolean halfWay)
onControl - The x and y co-ordinate within the mTextPad.bestGuess - if this is true and the point is not on a character, the location of the closest character
is returned.halfWay - if this is true then once the point is more than half-way through a character
it is considered on the next character.
protected Point getPenChar(Point onControl)
public Point getCharAt(Point onControl)
onControl - The x and y co-ordinate within the mTextPad.
protected void clearCursor()
public String getLineAt(int index)
index - The index of the line.
public String getLineAt(int index,
boolean trueLine)
index - The index of the line.trueLine - if this is true then ending line feeds or spaces are added to the line. If not,
then the line is returned as it is on the display.
public int getLineLength(int index,
boolean trueLength)
trueLength - if this is true, then any ending line feed is also included in the length,
otherwise only the number of displayed characters is counted.
public int getTrueCharIndex(int lineIndex,
int charIndex)
lineIndex - The line it is displayed on screen.charIndex - The character index within the on-screen line.
public int getTrueCharIndex(Point charPosition)
charPosition - The character position on screen where y = the line it is displayed on screen,
and x is the character index within the on-screen line.
public DisplayLine getLine(int index)
protected DisplayLine getLine()
public boolean noSelection()
noSelection in interface Selectablepublic Object getSelection()
getSelection in interface Selectableprotected boolean removeSelection()
protected void rearrange(DisplayLine firstLine,
int indexOfFirst,
DisplayLine lastLine,
boolean repaint)
public boolean replaceSelection(Object with)
replaceSelection in interface Selectablepublic boolean hasSelection()
hasSelection in interface Selectablepublic void clearSelection()
public void penPressed(Point where)
ControlWithin this method you can use the Control.currentPenEvent value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.
penPressed in class Controlwhere - The point on the Control where the pen was pressed.public void penDoubleClicked(Point where)
ControlWithin this method you can use the Control.currentPenEvent value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.
By default this method simply calls the penClicked() method.
penDoubleClicked in class Controlwhere - The point on the Control where the pen was double-clicked.public void penReleased(Point where)
ControlWithin this method you can use the Control.currentPenEvent value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.
penReleased in class Controlwhere - The point on the Control where the pen was released.public void startDragging(DragContext dc)
Control
startDragging in class Controldc - A DragContext indicating information about the dragging.public void dragged(DragContext dc)
Control
dragged in class Controldc - The DragContext for the dragging operation.
protected void replaceLines(DisplayLine start,
int length,
DisplayLine newLines)
protected String autoTab(String currentLine,
String newLine)
public void onKeyEvent(KeyEvent ev)
onKeyEvent in class Control
public boolean acceptsData(Object data,
DragContext how)
Control
acceptsData in class EditControl
public void dataDraggedOver(Object data,
Point p,
PenEvent ev)
ControlBy default this method calls dataDraggedOver(Object data) - which itself by default calls acceptsData() to determine whether to call willAcceptDrop() or dontAcceptDrop().
dataDraggedOver in class Controldata - The data being dragged.p - The current location of the pen/mouse.ev - The PenEvent that prompted this call.public void dataDraggedOff(Object data)
Control
dataDraggedOff in class Controldata - the data being dragged.public void onPenEvent(PenEvent ev)
Control
onPenEvent in class Controlev - The incoming PenEvent.
public boolean dataDroppedOn(Object data,
Point where,
DragContext dc)
Control
dataDroppedOn in class Control
public void dataAccepted(Control by,
Object theData,
String action)
Control
dataAccepted in class Controlby - The Control that accepted the data.theData - The data being transferred.action - This is either "copy" or "move" indicating if the data
is meant to be copied to the other control or moved to the other Control.protected void dataTransferCancelled(Object data)
Control
dataTransferCancelled in class EditControlpublic Point getCursorPosition()
public Rect getSelectionRange()
public boolean setSelectionRange(int startChar,
int startLine,
int endChar,
int endLine)
startChar - Character index of the start of the selection.startLine - Line index of the start of the selection.endChar - Character index of the end of the selection.endLine - Line index of the start of the selection.
public Dimension getIndexLocation(int characterIndex,
Dimension dest)
characterIndex - The original index of the character.dest - a destination Dimension to hold the results. It can be null, in which case
a new one will be allocated and returned.
public boolean setSelectionRange(int originalCharacterIndex,
int numCharacters)
originalCharacterIndex - The index of the start character as it was in the original text.numCharacters - The number of characters to select.
public void appendText(String what,
boolean moveToEnd)
public void scrollTo(int lineIndex,
boolean placeLineAtBottom)
lineIndex - The line to make visible.placeLineAtBottom - If this is true the line will be placed at the bottom of the screen,
otherwise it will be placed at the top.public Object getState()
public boolean setState(Object state)
state - The object returned by getState().
public void onEvent(Event ev)
onEvent in interface EventListeneronEvent in class Controlpublic Control setAsStaticDisplay(boolean makeScrollBar)
The method returns the mTextPad itself if makeScrollBar is false. If makeScrollBar is true it will return a ScrollablePanel() that contains this mTextPad. The returned ScrollablePanel will be a VerticalScrollPanel on a SmartPhone, or a ScrollBarPanel on any other platform.
protected boolean paintConditionalChar(Graphics g,
boolean highlight)
paintConditionalChar in class EditControl
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||