TRadioButton button = new TRadioButton(this, buttonX, buttonY, label,
getChildren().size() + 1);
+ if (getParent().getLayoutManager() != null) {
+ getParent().getLayoutManager().resetSize(this);
+ }
+
// Default to the first item on the list.
activate(getChildren().get(0));
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));
layoutChildren();
}
+ /**
+ * Reset a child widget's original/preferred size.
+ *
+ * @param child the widget to manage
+ */
+ public void resetSize(final TWidget child) {
+ // NOP
+ }
+
// ------------------------------------------------------------------------
// BoxLayoutManager -------------------------------------------------------
// ------------------------------------------------------------------------
*/
public void remove(final TWidget child);
+ /**
+ * Reset a child widget's original/preferred size.
+ *
+ * @param child the widget to manage
+ */
+ public void resetSize(final TWidget child);
+
}
layoutChildren();
}
+ /**
+ * Reset a child widget's original/preferred size.
+ *
+ * @param child the widget to manage
+ */
+ public void resetSize(final TWidget child) {
+ // For this layout, adding is the same as replacing.
+ add(child);
+ }
+
// ------------------------------------------------------------------------
// StretchLayoutManager ---------------------------------------------------
// ------------------------------------------------------------------------