X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTWidget.java;h=6cb0f98b1fe4c6634334c13f081a07fbd78a7e0e;hb=92554d64c21c6a477fd23a06ca3a64a542b622a3;hp=d6864db746316659ef5d3ed4fed3cc76b0934d6a;hpb=a83fea2bae838f4b9bbf59ce3832e0e67be41378;p=nikiroo-utils.git diff --git a/src/jexer/TWidget.java b/src/jexer/TWidget.java index d6864db..6cb0f98 100644 --- a/src/jexer/TWidget.java +++ b/src/jexer/TWidget.java @@ -86,13 +86,6 @@ public abstract class TWidget implements Comparable { this.height = height; } - /** - * Request full repaint on next screen refresh. - */ - protected final void setRepaint() { - window.getApplication().setRepaint(); - } - /** * Get this TWidget's parent TApplication. * @@ -487,14 +480,14 @@ public abstract class TWidget implements Comparable { public final void drawChildren() { // Set my clipping rectangle assert (window != null); - assert (window.getScreen() != null); - Screen screen = window.getScreen(); + assert (getScreen() != null); + Screen screen = getScreen(); screen.setClipRight(width); screen.setClipBottom(height); - int absoluteRightEdge = window.getAbsoluteX() + screen.getWidth(); - int absoluteBottomEdge = window.getAbsoluteY() + screen.getHeight(); + int absoluteRightEdge = window.getAbsoluteX() + window.getWidth(); + int absoluteBottomEdge = window.getAbsoluteY() + window.getHeight(); if (!(this instanceof TWindow) && !(this instanceof TVScroller)) { absoluteRightEdge -= 1; } @@ -508,14 +501,14 @@ public abstract class TWidget implements Comparable { screen.setClipRight(0); } else if (myRightEdge > absoluteRightEdge) { screen.setClipRight(screen.getClipRight() - - myRightEdge - absoluteRightEdge); + - (myRightEdge - absoluteRightEdge)); } if (getAbsoluteY() > absoluteBottomEdge) { // I am offscreen screen.setClipBottom(0); } else if (myBottomEdge > absoluteBottomEdge) { screen.setClipBottom(screen.getClipBottom() - - myBottomEdge - absoluteBottomEdge); + - (myBottomEdge - absoluteBottomEdge)); } // Set my offset @@ -727,9 +720,6 @@ public abstract class TWidget implements Comparable { activeChild.active = false; children.get(tabOrder).active = true; activeChild = children.get(tabOrder); - - // Refresh - window.getApplication().setRepaint(); } /** @@ -789,27 +779,25 @@ public abstract class TWidget implements Comparable { // If I have any buttons on me AND this is an Alt-key that matches // its mnemonic, send it an Enter keystroke for (TWidget widget: children) { - /* - TODO - - if (TButton button = cast(TButton)w) { - if (button.enabled && - !keypress.key.isKey && - keypress.key.alt && - !keypress.key.ctrl && - (toLowercase(button.mnemonic.shortcut) == toLowercase(keypress.key.ch))) { - - w.handleEvent(new TKeypressEvent(kbEnter)); + if (widget instanceof TButton) { + TButton button = (TButton) widget; + if (button.getEnabled() + && !keypress.getKey().getIsKey() + && keypress.getKey().getAlt() + && !keypress.getKey().getCtrl() + && (Character.toLowerCase(button.getMnemonic().getShortcut()) + == Character.toLowerCase(keypress.getKey().getCh())) + ) { + + widget.handleEvent(new TKeypressEvent(kbEnter)); return; } } - */ } // Dispatch the keypress to an active widget for (TWidget widget: children) { if (widget.active) { - window.getApplication().setRepaint(); widget.handleEvent(keypress); return; }