Package jexer.backend
Class MultiScreen
- java.lang.Object
-
- jexer.backend.MultiScreen
-
-
Constructor Summary
Constructors Constructor Description MultiScreen(Screen screen)
Public constructor requires one screen.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addScreen(Screen screen)
Add a screen to the list.void
clear()
Clear the logical screen.void
clearPhysical()
Clear the physical screen.void
copySelection(Clipboard clipboard, int x0, int y0, int x1, int y1, boolean rectangle)
Copy the screen selection area to the clipboard.void
drawBox(int left, int top, int right, int bottom, CellAttributes border, CellAttributes background)
Draw a box with a border and empty background.void
drawBox(int left, int top, int right, int bottom, CellAttributes border, CellAttributes background, int borderType, boolean shadow)
Draw a box with a border and empty background.void
drawBoxShadow(int left, int top, int right, int bottom)
Draw a box shadow.void
flushPhysical()
Classes must provide an implementation to push the logical screen to the physical device.CellAttributes
getAttrXY(int x, int y)
Get the attributes at one location.Cell
getCharXY(int x, int y)
Get the cell at one location.Cell
getCharXY(int x, int y, boolean clip)
Get the cell at one location, in either absolute or clipped coordinates.int
getClipBottom()
Get bottom drawing clipping boundary.int
getClipLeft()
Get left drawing clipping boundary.int
getClipRight()
Get right drawing clipping boundary.int
getClipTop()
Get top drawing clipping boundary.int
getCursorX()
Get the cursor X position.int
getCursorY()
Get the cursor Y position.int
getHeight()
Get the height.int
getOffsetX()
Get drawing offset for x.int
getOffsetY()
Get drawing offset for y.int
getTextHeight()
Get the height of a character cell in pixels.int
getTextWidth()
Get the width of a character cell in pixels.int
getWidth()
Get the width.void
hideCursor()
Hide the cursor.void
hLineXY(int x, int y, int n, int ch, CellAttributes attr)
Draw a horizontal line from (x, y) to (x + n, y).void
invertCell(int x, int y)
Invert the cell color at a position, including both halves of a double-width cell.void
invertCell(int x, int y, boolean onlyThisCell)
Invert the cell color at a position.boolean
isCursorVisible()
Get the cursor visibility.boolean
isDirty()
Get dirty flag.void
putAll(int ch, CellAttributes attr)
Fill the entire screen with one character with attributes.void
putAttrXY(int x, int y, CellAttributes attr)
Set the attributes at one location.void
putAttrXY(int x, int y, CellAttributes attr, boolean clip)
Set the attributes at one location.void
putCharXY(int x, int y, int ch)
Render one character without changing the underlying attributes.void
putCharXY(int x, int y, int ch, CellAttributes attr)
Render one character with attributes.void
putCharXY(int x, int y, Cell ch)
Render one character with attributes.void
putCursor(boolean visible, int x, int y)
Put the cursor at (x,y).void
putStringXY(int x, int y, java.lang.String str)
Render a string without changing the underlying attribute.void
putStringXY(int x, int y, java.lang.String str, CellAttributes attr)
Render a string.void
removeScreen(Screen screen)
Remove a screen from the list.void
reset()
Reset screen to not-bold, white-on-black.void
resetClipping()
Flush the offset and clip variables.void
setClipBottom(int clipBottom)
Set bottom drawing clipping boundary.void
setClipLeft(int clipLeft)
Set left drawing clipping boundary.void
setClipRight(int clipRight)
Set right drawing clipping boundary.void
setClipTop(int clipTop)
Set top drawing clipping boundary.void
setDimensions(int width, int height)
Change the width and height.void
setHeight(int height)
Change the height.void
setOffsetX(int offsetX)
Set drawing offset for x.void
setOffsetY(int offsetY)
Set drawing offset for y.void
setSelection(int x0, int y0, int x1, int y1, boolean rectangle)
Set a selection area on the screen.void
setTitle(java.lang.String title)
Set the window title.void
setWidth(int width)
Change the width.Screen
snapshot()
Obtain a snapshot copy of the screen.void
unsetImageRow(int y)
Unset every image cell on one row of the physical screen, forcing images on that row to be redrawn.void
vLineXY(int x, int y, int n, int ch, CellAttributes attr)
Draw a vertical line from (x, y) to (x, y + n).
-
-
-
Constructor Detail
-
MultiScreen
public MultiScreen(Screen screen)
Public constructor requires one screen.- Parameters:
screen
- the screen to add
-
-
Method Detail
-
setOffsetX
public void setOffsetX(int offsetX)
Set drawing offset for x.- Specified by:
setOffsetX
in interfaceScreen
- Parameters:
offsetX
- new drawing offset
-
getOffsetX
public int getOffsetX()
Get drawing offset for x.- Specified by:
getOffsetX
in interfaceScreen
- Returns:
- the drawing offset
-
setOffsetY
public void setOffsetY(int offsetY)
Set drawing offset for y.- Specified by:
setOffsetY
in interfaceScreen
- Parameters:
offsetY
- new drawing offset
-
getOffsetY
public int getOffsetY()
Get drawing offset for y.- Specified by:
getOffsetY
in interfaceScreen
- Returns:
- the drawing offset
-
getClipRight
public int getClipRight()
Get right drawing clipping boundary.- Specified by:
getClipRight
in interfaceScreen
- Returns:
- drawing boundary
-
setClipRight
public void setClipRight(int clipRight)
Set right drawing clipping boundary.- Specified by:
setClipRight
in interfaceScreen
- Parameters:
clipRight
- new boundary
-
getClipBottom
public int getClipBottom()
Get bottom drawing clipping boundary.- Specified by:
getClipBottom
in interfaceScreen
- Returns:
- drawing boundary
-
setClipBottom
public void setClipBottom(int clipBottom)
Set bottom drawing clipping boundary.- Specified by:
setClipBottom
in interfaceScreen
- Parameters:
clipBottom
- new boundary
-
getClipLeft
public int getClipLeft()
Get left drawing clipping boundary.- Specified by:
getClipLeft
in interfaceScreen
- Returns:
- drawing boundary
-
setClipLeft
public void setClipLeft(int clipLeft)
Set left drawing clipping boundary.- Specified by:
setClipLeft
in interfaceScreen
- Parameters:
clipLeft
- new boundary
-
getClipTop
public int getClipTop()
Get top drawing clipping boundary.- Specified by:
getClipTop
in interfaceScreen
- Returns:
- drawing boundary
-
setClipTop
public void setClipTop(int clipTop)
Set top drawing clipping boundary.- Specified by:
setClipTop
in interfaceScreen
- Parameters:
clipTop
- new boundary
-
isDirty
public boolean isDirty()
Get dirty flag.
-
getAttrXY
public CellAttributes getAttrXY(int x, int y)
Get the attributes at one location.
-
getCharXY
public Cell getCharXY(int x, int y)
Get the cell at one location.
-
getCharXY
public Cell getCharXY(int x, int y, boolean clip)
Get the cell at one location, in either absolute or clipped coordinates.
-
putAttrXY
public void putAttrXY(int x, int y, CellAttributes attr)
Set the attributes at one location.
-
putAttrXY
public void putAttrXY(int x, int y, CellAttributes attr, boolean clip)
Set the attributes at one location.
-
putAll
public void putAll(int ch, CellAttributes attr)
Fill the entire screen with one character with attributes.
-
putCharXY
public void putCharXY(int x, int y, Cell ch)
Render one character with attributes.
-
putCharXY
public void putCharXY(int x, int y, int ch, CellAttributes attr)
Render one character with attributes.
-
putCharXY
public void putCharXY(int x, int y, int ch)
Render one character without changing the underlying attributes.
-
putStringXY
public void putStringXY(int x, int y, java.lang.String str, CellAttributes attr)
Render a string. Does not wrap if the string exceeds the line.- Specified by:
putStringXY
in interfaceScreen
- Parameters:
x
- column coordinate. 0 is the left-most column.y
- row coordinate. 0 is the top-most row.str
- string to drawattr
- attributes to use (bold, foreColor, backColor)
-
putStringXY
public void putStringXY(int x, int y, java.lang.String str)
Render a string without changing the underlying attribute. Does not wrap if the string exceeds the line.- Specified by:
putStringXY
in interfaceScreen
- Parameters:
x
- column coordinate. 0 is the left-most column.y
- row coordinate. 0 is the top-most row.str
- string to draw
-
vLineXY
public void vLineXY(int x, int y, int n, int ch, CellAttributes attr)
Draw a vertical line from (x, y) to (x, y + n).
-
hLineXY
public void hLineXY(int x, int y, int n, int ch, CellAttributes attr)
Draw a horizontal line from (x, y) to (x + n, y).
-
setWidth
public void setWidth(int width)
Change the width. Everything on-screen will be destroyed and must be redrawn.
-
setHeight
public void setHeight(int height)
Change the height. Everything on-screen will be destroyed and must be redrawn.
-
setDimensions
public void setDimensions(int width, int height)
Change the width and height. Everything on-screen will be destroyed and must be redrawn.- Specified by:
setDimensions
in interfaceScreen
- Parameters:
width
- new screen widthheight
- new screen height
-
getHeight
public int getHeight()
Get the height.
-
getWidth
public int getWidth()
Get the width.
-
reset
public void reset()
Reset screen to not-bold, white-on-black. Also flushes the offset and clip variables.
-
resetClipping
public void resetClipping()
Flush the offset and clip variables.- Specified by:
resetClipping
in interfaceScreen
-
drawBox
public void drawBox(int left, int top, int right, int bottom, CellAttributes border, CellAttributes background)
Draw a box with a border and empty background.- Specified by:
drawBox
in interfaceScreen
- Parameters:
left
- left column of box. 0 is the left-most row.top
- top row of the box. 0 is the top-most row.right
- right column of boxbottom
- bottom row of the boxborder
- attributes to use for the borderbackground
- attributes to use for the background
-
drawBox
public void drawBox(int left, int top, int right, int bottom, CellAttributes border, CellAttributes background, int borderType, boolean shadow)
Draw a box with a border and empty background.- Specified by:
drawBox
in interfaceScreen
- Parameters:
left
- left column of box. 0 is the left-most row.top
- top row of the box. 0 is the top-most row.right
- right column of boxbottom
- bottom row of the boxborder
- attributes to use for the borderbackground
- attributes to use for the backgroundborderType
- if 1, draw a single-line border; if 2, draw a double-line border; if 3, draw double-line top/bottom edges and single-line left/right edges (like Qmodem)shadow
- if true, draw a "shadow" on the box
-
drawBoxShadow
public void drawBoxShadow(int left, int top, int right, int bottom)
Draw a box shadow.- Specified by:
drawBoxShadow
in interfaceScreen
- Parameters:
left
- left column of box. 0 is the left-most row.top
- top row of the box. 0 is the top-most row.right
- right column of boxbottom
- bottom row of the box
-
clearPhysical
public void clearPhysical()
Clear the physical screen.- Specified by:
clearPhysical
in interfaceScreen
-
unsetImageRow
public final void unsetImageRow(int y)
Unset every image cell on one row of the physical screen, forcing images on that row to be redrawn.- Specified by:
unsetImageRow
in interfaceScreen
- Parameters:
y
- row coordinate. 0 is the top-most row.
-
flushPhysical
public void flushPhysical()
Classes must provide an implementation to push the logical screen to the physical device.- Specified by:
flushPhysical
in interfaceScreen
-
putCursor
public void putCursor(boolean visible, int x, int y)
Put the cursor at (x,y).
-
hideCursor
public void hideCursor()
Hide the cursor.- Specified by:
hideCursor
in interfaceScreen
-
isCursorVisible
public boolean isCursorVisible()
Get the cursor visibility.- Specified by:
isCursorVisible
in interfaceScreen
- Returns:
- true if the cursor is visible
-
getCursorX
public int getCursorX()
Get the cursor X position.- Specified by:
getCursorX
in interfaceScreen
- Returns:
- the cursor x column position
-
getCursorY
public int getCursorY()
Get the cursor Y position.- Specified by:
getCursorY
in interfaceScreen
- Returns:
- the cursor y row position
-
setTitle
public void setTitle(java.lang.String title)
Set the window title.
-
addScreen
public void addScreen(Screen screen)
Add a screen to the list.- Parameters:
screen
- the screen to add
-
removeScreen
public void removeScreen(Screen screen)
Remove a screen from the list.- Parameters:
screen
- the screen to remove
-
getTextWidth
public int getTextWidth()
Get the width of a character cell in pixels.- Specified by:
getTextWidth
in interfaceScreen
- Returns:
- the width in pixels of a character cell
-
getTextHeight
public int getTextHeight()
Get the height of a character cell in pixels.- Specified by:
getTextHeight
in interfaceScreen
- Returns:
- the height in pixels of a character cell
-
invertCell
public void invertCell(int x, int y)
Invert the cell color at a position, including both halves of a double-width cell.- Specified by:
invertCell
in interfaceScreen
- Parameters:
x
- column positiony
- row position
-
invertCell
public void invertCell(int x, int y, boolean onlyThisCell)
Invert the cell color at a position.- Specified by:
invertCell
in interfaceScreen
- Parameters:
x
- column positiony
- row positiononlyThisCell
- if true, only invert this cell, otherwise invert both halves of a double-width cell if necessary
-
setSelection
public void setSelection(int x0, int y0, int x1, int y1, boolean rectangle)
Set a selection area on the screen.- Specified by:
setSelection
in interfaceScreen
- Parameters:
x0
- the starting X position of the selectiony0
- the starting Y position of the selectionx1
- the ending X position of the selectiony1
- the ending Y position of the selectionrectangle
- if true, this is a rectangle select
-
copySelection
public void copySelection(Clipboard clipboard, int x0, int y0, int x1, int y1, boolean rectangle)
Copy the screen selection area to the clipboard.- Specified by:
copySelection
in interfaceScreen
- Parameters:
clipboard
- the clipboard to usex0
- the starting X position of the selectiony0
- the starting Y position of the selectionx1
- the ending X position of the selectiony1
- the ending Y position of the selectionrectangle
- if true, this is a rectangle select
-
-