X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fbackend%2FScreen.java;h=a9a2053565b7bf5dc8ba02f25cfce37e9453c714;hb=c4cefaa04ec122fc02efb6542451a31fdf722c32;hp=9b5890fc0e382bcee1ad48ba6de90dcacd37b448;hpb=42873e30bf487bc0b695d60652dba44f82185dbb;p=fanfix.git diff --git a/src/jexer/backend/Screen.java b/src/jexer/backend/Screen.java index 9b5890f..a9a2053 100644 --- a/src/jexer/backend/Screen.java +++ b/src/jexer/backend/Screen.java @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (C) 2017 Kevin Lamonte + * Copyright (C) 2019 Kevin Lamonte * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -30,6 +30,7 @@ package jexer.backend; import jexer.bits.Cell; import jexer.bits.CellAttributes; +import jexer.bits.Clipboard; /** * Drawing operations API. @@ -123,6 +124,15 @@ public interface Screen { */ public CellAttributes getAttrXY(final int x, final int y); + /** + * Get the cell at one location. + * + * @param x column coordinate. 0 is the left-most column. + * @param y row coordinate. 0 is the top-most row. + * @return the character + attributes + */ + public Cell getCharXY(final int x, final int y); + /** * Set the attributes at one location. * @@ -150,7 +160,7 @@ public interface Screen { * @param ch character to draw * @param attr attributes to use (bold, foreColor, backColor) */ - public void putAll(final char ch, final CellAttributes attr); + public void putAll(final int ch, final CellAttributes attr); /** * Render one character with attributes. @@ -169,7 +179,7 @@ public interface Screen { * @param ch character to draw * @param attr attributes to use (bold, foreColor, backColor) */ - public void putCharXY(final int x, final int y, final char ch, + public void putCharXY(final int x, final int y, final int ch, final CellAttributes attr); /** @@ -179,7 +189,7 @@ public interface Screen { * @param y row coordinate. 0 is the top-most row. * @param ch character to draw */ - public void putCharXY(final int x, final int y, final char ch); + public void putCharXY(final int x, final int y, final int ch); /** * Render a string. Does not wrap if the string exceeds the line. @@ -212,7 +222,7 @@ public interface Screen { * @param attr attributes to use (bold, foreColor, backColor) */ public void vLineXY(final int x, final int y, final int n, - final char ch, final CellAttributes attr); + final int ch, final CellAttributes attr); /** * Draw a horizontal line from (x, y) to (x + n, y). @@ -224,7 +234,7 @@ public interface Screen { * @param attr attributes to use (bold, foreColor, backColor) */ public void hLineXY(final int x, final int y, final int n, - final char ch, final CellAttributes attr); + final int ch, final CellAttributes attr); /** * Change the width. Everything on-screen will be destroyed and must be @@ -325,6 +335,19 @@ public interface Screen { public void drawBoxShadow(final int left, final int top, final int right, final int bottom); + /** + * Clear the physical screen. + */ + public void clearPhysical(); + + /** + * Unset every image cell on one row of the physical screen, forcing + * images on that row to be redrawn. + * + * @param y row coordinate. 0 is the top-most row. + */ + public void unsetImageRow(final int y); + /** * Classes must provide an implementation to push the logical screen to * the physical device. @@ -345,6 +368,27 @@ public interface Screen { */ public void hideCursor(); + /** + * Get the cursor visibility. + * + * @return true if the cursor is visible + */ + public boolean isCursorVisible(); + + /** + * Get the cursor X position. + * + * @return the cursor x column position + */ + public int getCursorX(); + + /** + * Get the cursor Y position. + * + * @return the cursor y row position + */ + public int getCursorY(); + /** * Set the window title. * @@ -352,4 +396,64 @@ public interface Screen { */ public void setTitle(final String title); + /** + * Get the width of a character cell in pixels. + * + * @return the width in pixels of a character cell + */ + public int getTextWidth(); + + /** + * Get the height of a character cell in pixels. + * + * @return the height in pixels of a character cell + */ + public int getTextHeight(); + + /** + * Invert the cell color at a position, including both halves of a + * double-width cell. + * + * @param x column position + * @param y row position + */ + public void invertCell(final int x, final int y); + + /** + * Invert the cell color at a position. + * + * @param x column position + * @param y row position + * @param onlyThisCell if true, only invert this cell, otherwise invert + * both halves of a double-width cell if necessary + */ + public void invertCell(final int x, final int y, + final boolean onlyThisCell); + + /** + * Set a selection area on the screen. + * + * @param x0 the starting X position of the selection + * @param y0 the starting Y position of the selection + * @param x1 the ending X position of the selection + * @param y1 the ending Y position of the selection + * @param rectangle if true, this is a rectangle select + */ + public void setSelection(final int x0, final int y0, + final int x1, final int y1, final boolean rectangle); + + /** + * Copy the screen selection area to the clipboard. + * + * @param clipboard the clipboard to use + * @param x0 the starting X position of the selection + * @param y0 the starting Y position of the selection + * @param x1 the ending X position of the selection + * @param y1 the ending Y position of the selection + * @param rectangle if true, this is a rectangle select + */ + public void copySelection(final Clipboard clipboard, + final int x0, final int y0, final int x1, final int y1, + final boolean rectangle); + }