X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTWidget.java;h=d60efd8d3a321236e2069199c6db2fb364505d69;hb=HEAD;hp=f11cbf35c62d3aa53d19040343c47a492109d019;hpb=35b1874b53e81e93aea42f146decc138c71ca0d1;p=fanfix.git diff --git a/src/jexer/TWidget.java b/src/jexer/TWidget.java index f11cbf3..d60efd8 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; @@ -591,9 +592,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); } } @@ -1126,6 +1126,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: *