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;
* @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);
}
}
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>
* difference between this.z and that.z, or String.compareTo(text)
*/
@Override
- public final int compareTo(final TWidget that) {
+ public int compareTo(final TWidget that) {
if ((this instanceof TWindow)
&& (that instanceof TWindow)
) {
*
* @param child TWidget to add
*/
- private void addChild(final TWidget child) {
+ public void addChild(final TWidget child) {
children.add(child);
if ((child.enabled)
* @return TRUE if the child was removed, FALSE if it was not found
*/
public boolean removeChild(final TWidget child) {
++<<<<<<< HEAD:TWidget.java
+ if (children.remove(child)) {
+ child.close();
+ child.parent = null;
+ child.window = null;
+
+ resetTabOrder();
+
+ return true;
+ }
+
+ return false;
++=======
+ if (children.remove(child)) {
+ child.close();
+ child.parent = null;
+ child.window = null;
+
+ resetTabOrder();
+
+ return true;
+ }
+
+ return false;
++>>>>>>> upstream-sep2019-tcombo:src/jexer/TWidget.java
}
/**
if (activeChild != null) {
activeChild.active = false;
}
- child.active = true;
- activeChild = child;
}
+ child.active = true;
+ activeChild = child;
}
}
return new TRadioGroup(this, x, y, label);
}
+ /**
+ * Convenience function to add a radio button group to this
+ * container/window.
+ *
+ * @param x column relative to parent
+ * @param y row relative to parent
+ * @param width width of group
+ * @param label label to display on the group box
+ */
+ public final TRadioGroup addRadioGroup(final int x, final int y,
+ final int width, final String label) {
+
+ return new TRadioGroup(this, x, y, width, label);
+ }
+
/**
* Convenience function to add a text field to this container/window.
*