git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
stubs for editor copy/paste
[fanfix.git]
/
src
/
jexer
/
TWidget.java
diff --git
a/src/jexer/TWidget.java
b/src/jexer/TWidget.java
index 60bc3e4a618c0cce09d84cbdbedfdc200da39906..012ed756c3a60adf4f40bf72e9c54954a3c28e98 100644
(file)
--- 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.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;
import jexer.bits.ColorTheme;
import jexer.event.TCommandEvent;
import jexer.event.TInputEvent;
@@
-598,9
+599,8
@@
public abstract class TWidget implements Comparable<TWidget> {
* @param command command event
*/
public void onCommand(final TCommandEvent command) {
* @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<TWidget> {
this.x = x;
this.y = y;
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));
if (layout != null) {
layout.onResize(new TResizeEvent(TResizeEvent.Type.WIDGET,
width, height));
@@
-1132,6
+1133,18
@@
public abstract class TWidget implements Comparable<TWidget> {
return null;
}
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:
* <ul>
/**
* Comparison operator. For various subclasses it sorts on:
* <ul>