X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTWidget.java;h=012ed756c3a60adf4f40bf72e9c54954a3c28e98;hb=7ed28054941adbb9e7f2b4487fa9d2325b12a752;hp=60bc3e4a618c0cce09d84cbdbedfdc200da39906;hpb=9917c620116aa68ebf5d74afaeec44416b314729;p=fanfix.git diff --git a/src/jexer/TWidget.java b/src/jexer/TWidget.java index 60bc3e4..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); } } @@ -935,8 +935,9 @@ public abstract class TWidget implements Comparable { this.x = x; this.y = y; - this.width = width; - this.height = height; + // Call the functions so that subclasses can choose how to handle it. + setWidth(width); + setHeight(height); if (layout != null) { layout.onResize(new TResizeEvent(TResizeEvent.Type.WIDGET, width, height)); @@ -1132,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: *