X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTWidget.java;h=12e43444a6f085392903d4335fe6004fc72c6194;hb=6f8ff91a29056209f9fd5f40e2dcf1ae285e0210;hp=d292ec1490c938f304e142a565551d8eb6060e74;hpb=be72cb5ccbd42fe304c0acafc380c5636f0d03a2;p=fanfix.git diff --git a/src/jexer/TWidget.java b/src/jexer/TWidget.java index d292ec1..12e4344 100644 --- a/src/jexer/TWidget.java +++ b/src/jexer/TWidget.java @@ -302,6 +302,25 @@ public abstract class TWidget implements Comparable { * @return if true, this widget has a visible cursor */ public final boolean isCursorVisible() { + // If cursor is out of my bounds, it is not visible. + if ((cursorX >= width) + || (cursorX < 0) + || (cursorY >= height) + || (cursorY < 0) + ) { + return false; + } + + // If cursor is out of my window's bounds, it is not visible. + if ((getCursorAbsoluteX() >= window.getAbsoluteX() + + window.getWidth() - 1) + || (getCursorAbsoluteX() < 0) + || (getCursorAbsoluteY() >= window.getAbsoluteY() + + window.getHeight() - 1) + || (getCursorAbsoluteY() < 0) + ) { + return false; + } return cursorVisible; } @@ -603,7 +622,12 @@ public abstract class TWidget implements Comparable { this.parent = parent; this.window = parent.window; children = new ArrayList(); - parent.addChild(this); + + // Do not add TStatusBars, they are drawn by TApplication + if (this instanceof TStatusBar) { + } else { + parent.addChild(this); + } } /** @@ -623,7 +647,12 @@ public abstract class TWidget implements Comparable { this.parent = parent; this.window = parent.window; children = new ArrayList(); - parent.addChild(this); + + // Do not add TStatusBars, they are drawn by TApplication + if (this instanceof TStatusBar) { + } else { + parent.addChild(this); + } this.x = x; this.y = y;