X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTWidget.java;h=e94fed25077c68ca763b8dc90e76b98d36898469;hb=cf8b15bcb6f7fa2b2c114563115d47b34bfc7436;hp=ba18989bfc43d38ea0549e42f5f20dfb8358e1ab;hpb=1e71bba21116ce83e76501c2e60f85ba6113e82d;p=fanfix.git diff --git a/src/jexer/TWidget.java b/src/jexer/TWidget.java index ba18989..e94fed2 100644 --- a/src/jexer/TWidget.java +++ b/src/jexer/TWidget.java @@ -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)); @@ -1475,6 +1476,19 @@ public abstract class TWidget implements Comparable { } } + /** + * Make this widget, all of its parents, the active child. + */ + public final void activateAll() { + activate(); + if (parent == this) { + return; + } + if (parent != null) { + parent.activateAll(); + } + } + /** * Switch the active widget with the next in the tab order. * @@ -1605,11 +1619,10 @@ public abstract class TWidget implements Comparable { splitPane.setLeft(this); splitPane.setRight(newWidget); } - splitPane.activate(); if (newWidget != null) { - newWidget.activate(); + newWidget.activateAll(); } else { - activate(); + activateAll(); } assert (parent != null); @@ -1657,11 +1670,10 @@ public abstract class TWidget implements Comparable { splitPane.setTop(this); splitPane.setBottom(newWidget); } - splitPane.activate(); if (newWidget != null) { - newWidget.activate(); + newWidget.activateAll(); } else { - activate(); + activateAll(); } assert (parent != null);