X-Git-Url: http://git.nikiroo.be/?p=nikiroo-utils.git;a=blobdiff_plain;f=src%2Fjexer%2FTWidget.java;h=d60efd8d3a321236e2069199c6db2fb364505d69;hp=f643f83c550c161dcf338a4a43935903fce6e444;hb=c4cefaa04ec122fc02efb6542451a31fdf722c32;hpb=c6815053bca27b1c2374548e06779a97651fe07d diff --git a/src/jexer/TWidget.java b/src/jexer/TWidget.java index f643f83..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: *