public class SpenControlShape extends SpenControlBase
STYLE_BORDER_NONE, STYLE_BORDER_NONE_ACTION_NONE, STYLE_BORDER_OBJECT, STYLE_BORDER_STATIC| Constructor and Description |
|---|
SpenControlShape(Context context,
SpenPageDoc pageDoc)
ControlShape constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendText(String str)
Append the specified text to the text box in shape control.
|
void |
close()
Close the SpenControlShape instance.
|
void |
fit()
Fit control region according to object's size in list.
|
void |
fit(boolean checkCursorPosition)
Fit control region according to object's size in list.
|
SpenObjectShape |
getObject()
Get the shape object. |
int |
getPixel(int x,
int y)
Get the color at the specified location of the text box in the shape control.
|
String |
getText(boolean onlySelection)
Get the text that is displayed in the text box in shape control.
|
int |
getTextCursorPosition()
Get the current cursor position in the text box in shape control.
|
int |
getTextLimit()
Get the text length allowed in the text box in shape control.
|
SpenSettingTextInfo |
getTextSettingInfo()
Get the text settings information for the text box in shape control.
|
void |
hideSoftInput()
Hide soft input.
|
boolean |
isContextMenuVisible()
Check if the context menu is visible.
|
boolean |
isEditable()
Check if the text box object in shape control is editable.
|
boolean |
isSelectByKey()
Check if text is selected by keyboard or touch action.
|
void |
onDraw(Canvas canvas)
Called when a text object is drawn on the canvas.
|
boolean |
onTouchEvent(MotionEvent event)
Called when a touch event occurs in the text box in shape control.
|
void |
removeText()
Remove the text in the text box in shape control.
|
void |
selectAllText()
Select all the text in the text box in shape control.
|
void |
setContextMenuVisible(boolean visible)
Enable or disable the visibility of the context menu.
|
void |
setEditable(boolean enable)
Enable or disable editing in the text box in shape control from user using keyboard.
|
void |
setMargin(int left,
int top,
int right,
int bottom)
Set the specified margin for the text box in shape control.
|
void |
setObject(SpenObjectShape objectShape)
Set the specified shape object. |
void |
setSelection(int start,
int end)
Set the specified anchor to start and the specified edge to end the text selection.
|
void |
setText(String str)
Set the specified text for the text box in shape control.
|
void |
setTextCursorPosition(int index)
Set the cursor at the specified position.
|
void |
setTextLimit(int count)
Set the specified allowable length for text in the text box in shape control.
|
void |
setTextSelectionContextMenu(SpenContextMenu contextMenu)
Set the specified context menu for the text box in shape control.
|
void |
setTextSettingInfo(SpenSettingTextInfo info)
Set the specified text settings information for the text box in shape control.
|
void |
setTouchEnabled(boolean enable)
Enable or disable touch event handling.
|
void |
showSoftInput()
Show soft input.
|
getContextMenu, getMinResizeRect, getObjectList, getRect, getStyle, isClosed, isContextMenuItemEnabled, isDimEnabled, isObjectOutlineEnabled, isTouchEnabled, onHoverEvent, onWindowFocusChanged, setContextMenu, setContextMenuItemEnabled, setDimEnabled, setMinResizeRect, setObjectOutlineEnabled, setStylepublic SpenControlShape(Context context, SpenPageDoc pageDoc)
context - The context for the application.pageDoc - The page document.NullPointerException - Thrown if context is null.public void setEditable(boolean enable)
enable - Set to true to enable editing in the text box, set to false to disable editing in the text box.
When you disable editing, the text box is not focusable in touch mode.isEditable()public boolean isEditable()
setEditable(boolean)public void showSoftInput()
public void hideSoftInput()
public void fit(boolean checkCursorPosition)
checkCursorPosition - If the param is true, recent cursor position will be shown in textbox.public void setObject(SpenObjectShape objectShape)
objectShape - Shape object attached to the control.public SpenObjectShape getObject()
public void appendText(String str)
str - The text to add to the text box.IllegalArgumentException - Thrown if str is null.public void removeText()
public void setMargin(int left,
int top,
int right,
int bottom)
left - The left margin.top - The top margin.right - The right margin.bottom - The bottom margin.public void setText(String str)
str - The text to set in the text box in shape control.IllegalArgumentException - Thrown if str is null.public String getText(boolean onlySelection)
onlySelection - Set to true to get only the selected text, set to false to get all the text in the text box in shape
control.public void setTextCursorPosition(int index)
index - The cursor position.IllegalStateException - Thrown if the text box in shape control is not editable.IllegalArgumentException - Thrown if text is empty, index is negative number or index is greater than string
length of TextBoxpublic int getTextCursorPosition()
IllegalStateException - Thrown if the text box in shape control is not editable.public void setTextLimit(int count)
count - The maximum text length. Set a limit value greater than or equal to zero and less than 5000.IllegalArgumentException - Thrown when the count value passed is less than 0.public int getTextLimit()
public void setSelection(int start,
int end)
start - Position of start cursorend - Position of start cursorIllegalStateException - Thrown if the text box in shape control is not editable.IllegalArgumentException - Thrown if start is greater than end, start is negative number or
end is greater than string length of TextBoxpublic void selectAllText()
IllegalStateException - Thrown if the text box in shape control is not editable.public void setTextSelectionContextMenu(SpenContextMenu contextMenu)
contextMenu - -The context menu that you want to set.public void setTextSettingInfo(SpenSettingTextInfo info)
info - The text settings information object.NullPointerException - Thrown if info is null.public SpenSettingTextInfo getTextSettingInfo()
public boolean isSelectByKey()
public int getPixel(int x,
int y)
getPixel in class SpenControlBasex - The X coordinate.y - The Y coordinate.public void setContextMenuVisible(boolean visible)
setContextMenuVisible in class SpenControlBasevisible - Context visible attribute.
Set to true to make the context menu visible,
set to false to make it invisible.isContextMenuVisible()public boolean isContextMenuVisible()
isContextMenuVisible in class SpenControlBasesetContextMenuVisible(boolean)public void setTouchEnabled(boolean enable)
setTouchEnabled in class SpenControlBaseenable - Set to true to handle the touch event,
set to false to ignore and pass the touch event to theSpenControlBase.isTouchEnabled()public void close()
close in class SpenControlBasepublic boolean onTouchEvent(MotionEvent event)
onTouchEvent in class SpenControlBasepublic void onDraw(Canvas canvas)
onDraw in class SpenControlBasecanvas - The Canvas instance on which objects are drawnpublic void fit()
fit in class SpenControlBase