X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTWidget.java;h=012ed756c3a60adf4f40bf72e9c54954a3c28e98;hb=51e46b3e9d457882e5dad35b79b0bd0d11654f04;hp=e94fed25077c68ca763b8dc90e76b98d36898469;hpb=cf8b15bcb6f7fa2b2c114563115d47b34bfc7436;p=fanfix.git diff --git a/src/jexer/TWidget.java b/src/jexer/TWidget.java index e94fed2..012ed75 100644 --- a/src/jexer/TWidget.java +++ b/src/jexer/TWidget.java @@ -36,6 +36,7 @@ import java.util.ArrayList; import jexer.backend.Screen; import jexer.bits.Cell; import jexer.bits.CellAttributes; +import jexer.bits.Clipboard; import jexer.bits.ColorTheme; import jexer.event.TCommandEvent; import jexer.event.TInputEvent; @@ -598,9 +599,8 @@ public abstract class TWidget implements Comparable { * @param command command event */ public void onCommand(final TCommandEvent command) { - // Default: do nothing, pass to children instead - for (TWidget widget: children) { - widget.onCommand(command); + if (activeChild != null) { + activeChild.onCommand(command); } } @@ -1133,6 +1133,18 @@ public abstract class TWidget implements Comparable { return null; } + /** + * Get the Clipboard. + * + * @return the Clipboard, or null if not assigned + */ + public Clipboard getClipboard() { + if (window != null) { + return window.getApplication().getClipboard(); + } + return null; + } + /** * Comparison operator. For various subclasses it sorts on: *