public class TextPad extends EditControl implements ScrollClient, Selectable
Modifier and Type | Field and Description |
---|---|
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 |
int |
charWidth
This is used to estimate line lengths.
|
protected eve.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.
|
boolean |
fitExactNumLines |
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.
|
int |
leftMargin
This is the left margin.
|
protected int |
lineHeight |
protected DisplayLine |
lines |
int |
minXScroll
A percent figure.
|
int |
minYScroll
A percent figure.
|
String |
moreMessage
If this is not null, then the last visible line of text will display this message, if there is more text
that cannot be seen because it cannot fit on the display.
|
boolean |
noCursorMovement |
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 |
wantTab
This is true by default.
|
boolean |
wrapToScreenSize
This is true by default - it tells the control to wrap lines to fit the
display.
|
actAsLabel, blinkId, CASE_LOWER, CASE_NORMAL, CASE_NUMBERS, CASE_SENTENCE, CASE_UPPER, colors, conditionalChar, conditionalCharIndex, defaultInputFlags, doingLocalInput, doingNativeInput, FLAG_INPUT_ON_FOCUS, FLAG_KEEP_FOCUS_AFTER_INPUT, FLAG_NEED_FULL_ACTION, FLAG_PASSIVE, FLAG_USE_NATIVE, inFocus, inputFlags, inputMethod, justGotFocus, nothingEnteredText, oldText, pageColor, startNativeOnPaint, textCase, validator
backGround, beforeRemoved, borderColor, borderStyle, borderWidth, children, columns, constraints, curFont, debugModify, debugRepaintNow, disabledBackground, dragging, dragResolution, dragTime, exitKeys, fieldTransfer, font, fontChange, fontFrom, foreGround, height, holdDownPause, holdTick, hotKey, image, lastSelected, listeners, lockPaint, maxHeight, maxWidth, menuState, minHeight, minWidth, modifiers, name, next, parent, penStatus, preferredHeight, preferredWidth, prev, prompt, promptControl, rows, ss, startDragResolution, tags, tail, text, toolTip, width, x, y
clipItems, clipObject, clipOwner, debugControl, debugFlag, doubleBuffer, doubleClickTime, doubleSizedFontHeight, firstPress, globalEditable, globalEnabled, PEN_STATUS_DID_HOLD_DOWN, PEN_STATUS_GOT_PEN_DOWN, PEN_STATUS_PEN_IS_ON, TAG_BOOLEAN_KEEP_BELOW_SIP, TAG_HOVER_TIME_INT, TAG_LAST_USER_DATA, TAG_USER_DATA, TAKE_FIRST_PRESS, unnamed
GoHigher, GoLower, Horizontal, OPTION_INDICATOR_ONLY, PageHigher, PageLower, ScrollHigher, ScrollLower, TrackTo, Vertical
BDR_DOTTED, BDR_INNER, BDR_NOBORDER, BDR_OUTER, BDR_OUTLINE, BDR_RAISEDINNER, BDR_RAISEDOUTER, BDR_SUNKENINNER, BDR_SUNKENOUTER, BF_ABUT_ANY, BF_ABUT_BOTTOM, BF_ABUT_LEFT, BF_ABUT_RIGHT, BF_ABUT_TOP, 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
ALWAYS_STRETCHABLE, BOTTOM, CELLFLAG, CELLMASK, CENTER, CONTROLMASK, DONTCHANGE, DONTFILL, DONTSTRETCH, EAST, FILL, GROW, HCENTER, HCONTRACT, HEXPAND, HFILL, HGROW, HSHRINK, HSTRETCH, INITIALLY_CLOSED, INITIALLY_HIDDEN, INITIALLY_MINIMIZED, INITIALLY_PREFERRED_SIZE, INSETS, LEFT, MAXIMUMSIZE, MINIMUMSIZE, NORTH, NORTHEAST, NORTHWEST, PREFERREDSIZE, RECT, RIGHT, SHRINK, SOUTH, SOUTHEAST, SOUTHWEST, SPAN, STRETCH, TAG_BACKGROUND_IMAGE, TAG_BUSY_DISPLAY, TAG_COLORS, TAG_CONTROL_PAINTER, TAG_EXPOSE_GROUP, TAG_FIXEDSIZE, TAG_GRAY_BACKGROUND, TAG_HIDE_CONTROL_OBJECT, TAG_HIDE_PARENT, TAG_INNER_TEXT_INSETS, TAG_INPUT_STACK_PARENT, TAG_INSETS, TAG_MAKE_VISIBLE, TAG_MAXIMUMSIZE, TAG_MINIMUMSIZE, TAG_PAINT_CONTROL_LIST, TAG_PREFERRED_TEXT_SIZE, TAG_PREFERRED_TEXT_SIZE_HEIGHT, TAG_PREFERRED_TEXT_SIZE_WIDTH, TAG_PREFERREDSIZE, TAG_RECT, TAG_SHADOW_INSETS, TAG_SPAN, TAG_SWIPER, TAG_TEMPORARY_ERROR, TAG_TEXT_INSETS, TAG_TEXTSIZE, TEXTSIZE, TOP, VCENTER, VCONTRACT, VEXPAND, VFILL, VGROW, VSHRINK, VSTRETCH, WEST
All, AlwaysEnabled, AlwaysRecalculateSizes, ByDeferredMouse, ByDeferredPen, ByFrameChange, ByKeyboard, ByMouse, ByPen, ByRequest, CalculatedSizes, ContainerDontPaintChildren, Disabled, DisablePopupMenu, DisplayOnly, DontBuffer, Down, DrawFlat, Flag, ForceResize, HasData, Invisible, KeepImage, KeepSIP, Left, MakeMenuAtLeastAsWide, Maximize, Minimize, ModifiersInheritedFromWindow, MouseSensitive, NoFocus, NotAnEditor, NotEditable, PaintDataOnly, PaintOutsideOnly, PenTransparent, PreferredSizeOnly, Right, SendUpUIEvents, ShowSIP, ShrinkToNothing, SmallControl, TakeChildUIEvents, TakeControlEvents, TakesKeyFocus, Transparent, Up, WantDrag, WantHoldDown
KEEP_VISIBLE
Constructor and Description |
---|
TextPad() |
TextPad(int rows,
int columns) |
TextPad(String text) |
Modifier and Type | Method and Description |
---|---|
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)
This method should return whether the ScrollClient can actually scroll in a particular
direction, given a starting position in units.
|
void |
checkScrolls() |
boolean |
checkSipCoverage() |
protected void |
clearCursor() |
void |
clearSelection()
This clears the selection but does not update the screen.
|
int |
countLines(int fullWidth,
FontMetrics fm,
boolean fitExact) |
int |
countSplitLines(int forPixelWidth,
FontMetrics fm) |
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)
This is the main method to override when doing custom Control painting.
|
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)
This is called by the ScrolledServer to indicate that the user has requested
a scroll.
|
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)
Get the full number of units either vertically or horizontally that the ScrollClient
contains.
|
int |
getAvailableWidth() |
int |
getBaselineHeight()
Returns the height in pixels from the top of a line down to the baseline of the font.
|
Control |
getBestScrollingControl()
Returns the best Control to add to a destination which contains this TextPad and allows it to be scrolled,
or return this TextPad itself if it is not appropriate to scroll the TextPad (e.g. on a Smartphone).
|
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)
This should return which unit is currently being displayed.
|
Point |
getCursorPosition()
Get the character location of the cursor (caret).
|
protected boolean |
getCursorRect(int ch,
int ln,
Rect dest) |
protected FontMetrics |
getFontMetricsForSplitting() |
int |
getHeightForLines(int lines) |
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()
Get the text of the Control.
|
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)
Given a display size, this method should return the number of units that can be fully
displayed within the display size for the specified dimension.
|
void |
gotFocus(int how)
This is called when the Control gets the focus.
|
boolean |
hasSelection() |
void |
lostFocus(int how)
This is called when the Control loses the focus.
|
boolean |
needScrollBar(int which,
int forSize)
This method should return whether a ScrollBar (or some other form of scrolling
user control) is necessary for the specified dimension.
|
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) |
protected boolean |
paintConditionalChar(Graphics g,
boolean highlight) |
void |
paintCursor(Graphics gr) |
void |
paintCursor(Graphics gr,
boolean sticky) |
void |
paintLastChar() |
void |
paintLastChar(char toErase) |
void |
paintLine(Graphics g,
int index) |
void |
paintLine(Graphics grp,
int index,
DisplayLine theLine) |
void |
paintLine(Graphics grp,
int index,
DisplayLine theLine,
int screenRows,
int lineHeight) |
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 is called to 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)
Set the text of the Control, automatically repainting it.
|
protected void |
splitLines(int width) |
protected void |
splitLines(int width,
FontMetrics fm) |
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 splitWidth,
FontMetrics fm) |
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(Object id,
long elapsed) |
void |
update() |
void |
update(boolean doChecks) |
protected void |
updateScrolls() |
calculateInputFlags, checkInputMethod, dataBeingRemoved, fixCase, getBestPassiveFlags, getColors, getNativeInputParameters, hasChanged, inActivePassiveInput, isLabel, keepConditionalChar, nativeInputStopped, onControlEvent, setAsLabel, setConditionalChar, showHoldDownIndicator, startActiveInput, startLocalInput, startNativeInput, takeData, updateData, verifyWantDrag, verifyWantHoldDown
activate, addListener, amOnTopFrame, applyFontChange, baseOnPenEvent, bufferGraphics, bufferGraphics, bufferGraphics, bufferGraphics, bufferGraphics, cache, calculatedSizes, calculateTextSize, calculateTextSize, calculateTextSize, cancelHoldDown, cancelPenPress, canEdit, change, changeDimension, changeTag, checkClipboardOperations, checkExitKey, checkMenu, checkMenuKey, checkModifiers, checkParentInterceptsUIEvent, checkPenTransparent, childrenPainted, clearTag, clipboardToString, clipboardTransfer, closeMenu, contains, contains, createNewMenu, dataDraggedOver, deactivate, defaultTo, deferInWindowThread, doAction, doActionKey, doBackground, doBorder, doHotKey, doMenu, dontAcceptDrop, doPaintChildren, doPaintData, draw, draw, draw, exitEntry, fillBackground, fillBackgroundNotInFrame, findTagInParents, fontChanged, formClosing, free, fromClipboard, fromField, fromField, getAllDescendants, getAllSubControls, getAncestor, getAncestor, getAncestorProperty, getBackground, getCached, getCachedChildren, getCachedDim, getCachedDim, getCachedRect, getCachedRect, getCachedSubControls, getChildAnchor, getChildren, getChildren, getChildrenBackwards, getClipboardMenu, getClipObject, getContentsInsets, getContentsInsets, getContentsRect, getDataToCopy, getDataToDragAndDrop, getDim, getDisplayText, getDragAndDropContext, getFieldTransfer, getFont, getFontMetrics, getFontMetrics, getFontMetricsForSizeCalculations, getForeground, getFrame, getFrameOrContainer, getGraphics, getGraphics, getHeight, getHideParent, getImage, getLastSelected, getLocation, getLock, getMaximumSize, getMenu, getMinimumSize, getModifiedBorderFlags, getModifiers, getNext, getNextKeyFocus, getPaintParameters, getParent, getParent, getParent, getParentOrListener, getPasswordCharacter, getPosInFrame, getPosInFrame, getPosInParent, getPosInParent, getPreferredSize, getPreferredSizeByParent, getPreferredTextSize, getPrompt, getPromptText, getRect, getRect, getServer, getSize, getSizes, getSubControls, getSubControls, getTag, getToolTip, getWidth, getWindow, getWindowGraphics, hasModifier, hasPopupFormAttached, hasTag, hide, inheritModifiers, insetToContents, interceptChildUIEvent, isChildOf, isDirectChildOfWindow, isHidden, isModal, isOnMe, isOnMe, isOnMe, isSomeonesHotKey, make, makeFrameTopMost, makeHot, makeHot, makeInvisible, makeVisible, markAsTemporaryError, menuIsActive, menuStateChanged, modify, modifyAll, modifyAll, modifyFlags, mouseHover, newEventThread, notifyAction, notifyDataChange, notifyDataChange, notifyMenuItemSelected, notifyStructureChanged, onLabelPenEvent, paintBackground, paintWithControlPainter, pauseEventThread, penClicked, penHeld, penRightReleased, popupBeep, popupMenuEvent, postEvent, postInWindowThread, postUIEvent, putInside, queueKeyEvent, queuePenEvent, readLock, recalculatePreferredSize, redisplay, refresh, releaseBufferedGraphics, removed, removeListener, repaint, repaint, repaintDataNow, repaintInWindowThread, repaintInWindowThread, repaintNow, repaintNow, repaintNow, repaintNow, requestPaint, requestResizeTo, resetAllCachedProperties, resetCachedProperties, resetRect, restore, restoreBorderModifiers, restoreFlags, resumeEventThread, scrollAndRepaint, sendToListeners, set, setAllFonts, setBackgroundImage, setBorder, setBorderModifiers, setCell, setChildAnchor, setClipObject, setControl, setCursor, setFieldTransfer, setFixedSize, setFont, setFontChange, setFreeDragging, setHidden, setHiddenParent, setHotKey, setHotKey, setLocation, setMaximumSize, setMenu, setMinimumSize, setPreferredSize, setPreferredTextSize, setPreferredTextSize, setPromptControl, setRect, setRect, setScaledBackgroundImage, setServer, setShadow, setSwiping, setTag, setTags, setTextSize, setTiledBackgroundImage, setToolTip, shown, simulateClickOn, simulateKeyPresses, simulateKeyType, standardOnKeyEvent, startDragAndDrop, startDragAndDrop, stopDragging, takeFocus, takeFromClipboard, takePromptControl, testInWindowThread, tipIsDisplayed, toClipboard, toField, toField, toIDString, toString, toTextData, transferPenPress, transferPenPress, tryDragAndDrop, tryGetGraphics, tryNext, tryStartMenu, unhide, unlock, updateDCDuringDD, updateFrom, updateTo, waitEventThread, willAcceptDrop, willShowFrame, windowHasFloatingControls, writeLock
doubleSizeIt, getGuiTextHeight, isDoubleSized, isDoubleSizedFont, loadImage, tryLoadImage
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getServer, setServer
protected DisplayLine lines
protected DisplayLineSpecs dls
public IImage backgroundImage
public boolean wrapToScreenSize
public int spacing
public boolean dontWantPopup
public boolean wantReturn
public boolean wantTab
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
public String moreMessage
public boolean fitExactNumLines
public FormattedTextSpecs format
protected boolean amScrolling
public int forcedActualWidth
protected eve.ui.textPadState curState
public boolean noCursorMovement
public TextPad()
public TextPad(int rows, int columns)
public TextPad(String text)
protected boolean doShowMenu(Point p)
Control
doShowMenu
in class Control
p
- The point where the pen was pressed.protected void popupMenuClosed(Menu m)
Control
popupMenuClosed
in class Control
public int getLineHeight()
public int getBaselineHeight()
protected FontMetrics getFontMetricsForSplitting()
protected void calculateSizes()
Control
calculateSizes
in class Control
public int getHeightForLines(int lines)
public int countSplitLines(int forPixelWidth, FontMetrics fm)
public int getAvailableWidth()
public int getNumLines()
public int getTextWidth()
public void resizeTo(int width, int height)
Control
public 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.public DisplayLine splitLines(String text, int splitWidth, FontMetrics fm)
public int countLines(int fullWidth, FontMetrics fm, boolean fitExact)
protected void splitLines(int width, FontMetrics fm)
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)
Control
public String[] getLines()
protected void fixText()
public int getScreenRows()
public void paintLastChar()
public void paintLastChar(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 grp, int index, DisplayLine theLine)
public void paintLine(Graphics grp, int index, DisplayLine theLine, int screenRows, int lineHeight)
public void doPaint(Graphics g, Rect area)
Control
public void paintCursor(Graphics gr)
public void paintCursor(Graphics gr, boolean sticky)
protected void doPaintData(Graphics g)
Control
doPaintData
in class Control
g
- The Graphics object to paint to.public void paintLines(int from, int to)
protected void paintLinesFrom(int index)
public ScrollablePanel getScrollablePanel()
public Control getBestScrollingControl()
public void update()
update
in class EditControl
public void update(boolean doChecks)
public int getActual(int which)
ScrollClient
getActual
in interface ScrollClient
which
- either Horizontal or Vertical.public int getVisible(int which, int forSize)
ScrollClient
getVisible
in interface ScrollClient
which
- either Horizontal or Vertical.forSize
- the size (usually in pixels) allowed to be displayed on screen.public int getCurrent(int which)
ScrollClient
getCurrent
in interface ScrollClient
which
- either Horizontal or Vertical.public boolean needScrollBar(int which, int forSize)
ScrollClient
However a ScrollClient can return true always if it always wishes a ScrollBar to be present, or false always if it never wishes a ScrollBar to be present.
needScrollBar
in interface ScrollClient
which
- either Horizontal or Vertical.forSize
- the size (usually in pixels) allowed to be displayed on screen.public boolean canGo(int orientation, int direction, int position)
ScrollClient
canGo
in interface ScrollClient
orientation
- either Horizontal or Vertical.direction
- either GoHigher or GoLower.position
- a starting position in units.public void doScroll(int which, int action, int value)
ScrollClient
doScroll
in interface ScrollClient
which
- either Horizontal or Verticalaction
- one of PageHigher, PageLower, ScrollHigher, ScrollLower, TrackTovalue
- this is used for the TrackTo action and indicates the position to
track to.public void checkScrolls()
protected void updateScrolls()
public void ticked(Object id, long elapsed)
public void popupMenuEvent(Object selectedItem)
Control
popupMenuEvent
in class Control
selectedItem
- The item selected.public void selectAll()
selectAll
in class EditControl
public boolean checkSipCoverage()
checkSipCoverage
in class EditControl
public void gotFocus(int how)
Control
public void lostFocus(int how)
Control
protected void setNativeInputFlags(TextInputParameters tip)
setNativeInputFlags
in class EditControl
protected 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.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 Selectable
public Object getSelection()
getSelection
in interface Selectable
protected boolean removeSelection()
protected void rearrange(DisplayLine firstLine, int indexOfFirst, DisplayLine lastLine, boolean repaint)
public boolean replaceSelection(Object with)
replaceSelection
in interface Selectable
public boolean hasSelection()
hasSelection
in interface Selectable
public void clearSelection()
public void penPressed(Point where)
Control
Within this method you can use the Control.Gui.currentPenPress() 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 Control
where
- The point on the Control where the pen was pressed.public void penDoubleClicked(Point where)
Control
Within this method you can use the Control.Gui.currentPenPress() 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 Control
where
- The point on the Control where the pen was double-clicked.public void penReleased(Point where)
Control
Within this method you can use the Control.Gui.currentPenPress() 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 Control
where
- The point on the Control where the pen was released.public void startDragging(DragContext dc)
Control
startDragging
in class Control
dc
- A DragContext indicating information about the dragging.public void dragged(DragContext dc)
Control
protected void replaceLines(DisplayLine start, int length, DisplayLine newLines)
public void onKeyEvent(KeyEvent ev)
onKeyEvent
in class Control
public boolean acceptsData(Object data, DragContext how)
Control
acceptsData
in class EditControl
data
- The data to be transferred.how
- if the transfer is via DragAndDrop this will be a DragContext object,
otherwise it will be null to indicate a clipboard operation.public void dataDraggedOver(Object data, Point p, PenEvent ev)
Control
By default this method calls dataDraggedOver(Object data) - which itself by default calls acceptsData() to determine whether to call willAcceptDrop() or dontAcceptDrop().
dataDraggedOver
in class Control
data
- 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 Control
data
- the data being dragged.public void onPenEvent(PenEvent ev)
onPenEvent
in class Control
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 Control
by
- 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 EditControl
data
- The data that was being transferred. If it is null it indicates
that this Control was a destination for a Drag and Drop operation, but the
operation was cancelled by the user.public 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 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