git://git.nikiroo.be
/
fanfix.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5a6e1cc
)
LayoutManager.resetSize()
author
Kevin Lamonte
<kevin.lamonte@gmail.com>
Thu, 22 Aug 2019 18:36:48 +0000
(13:36 -0500)
committer
Kevin Lamonte
<kevin.lamonte@gmail.com>
Thu, 22 Aug 2019 18:36:48 +0000
(13:36 -0500)
src/jexer/TRadioGroup.java
patch
|
blob
|
blame
|
history
src/jexer/TWidget.java
patch
|
blob
|
blame
|
history
src/jexer/layout/BoxLayoutManager.java
patch
|
blob
|
blame
|
history
src/jexer/layout/LayoutManager.java
patch
|
blob
|
blame
|
history
src/jexer/layout/StretchLayoutManager.java
patch
|
blob
|
blame
|
history
diff --git
a/src/jexer/TRadioGroup.java
b/src/jexer/TRadioGroup.java
index 58c65e2b11eb679a4110802cde00ea90d06e3366..a82b074f8ce9a1c4fe6de462433b8d4124507b91 100644
(file)
--- a/
src/jexer/TRadioGroup.java
+++ b/
src/jexer/TRadioGroup.java
@@
-190,6
+190,10
@@
public class TRadioGroup extends TWidget {
TRadioButton button = new TRadioButton(this, buttonX, buttonY, label,
getChildren().size() + 1);
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));
// Default to the first item on the list.
activate(getChildren().get(0));
diff --git
a/src/jexer/TWidget.java
b/src/jexer/TWidget.java
index 60bc3e4a618c0cce09d84cbdbedfdc200da39906..e94fed25077c68ca763b8dc90e76b98d36898469 100644
(file)
--- a/
src/jexer/TWidget.java
+++ b/
src/jexer/TWidget.java
@@
-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));
diff --git
a/src/jexer/layout/BoxLayoutManager.java
b/src/jexer/layout/BoxLayoutManager.java
index c3d12802b1e72d24346cd81f5353aa917ac075f6..8e7a01e39231913870469d3c8b26653a6e78690b 100644
(file)
--- a/
src/jexer/layout/BoxLayoutManager.java
+++ b/
src/jexer/layout/BoxLayoutManager.java
@@
-120,6
+120,15
@@
public class BoxLayoutManager implements LayoutManager {
layoutChildren();
}
layoutChildren();
}
+ /**
+ * Reset a child widget's original/preferred size.
+ *
+ * @param child the widget to manage
+ */
+ public void resetSize(final TWidget child) {
+ // NOP
+ }
+
// ------------------------------------------------------------------------
// BoxLayoutManager -------------------------------------------------------
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// BoxLayoutManager -------------------------------------------------------
// ------------------------------------------------------------------------
diff --git
a/src/jexer/layout/LayoutManager.java
b/src/jexer/layout/LayoutManager.java
index bfa64a098463e6ffcc46ce5f831f1476b278a5a2..5dbd1e8432401df45f1a45ef34e42898c717d58b 100644
(file)
--- a/
src/jexer/layout/LayoutManager.java
+++ b/
src/jexer/layout/LayoutManager.java
@@
-59,4
+59,11
@@
public interface LayoutManager {
*/
public void remove(final TWidget child);
*/
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);
+
}
}
diff --git
a/src/jexer/layout/StretchLayoutManager.java
b/src/jexer/layout/StretchLayoutManager.java
index 0ae7dff396be3ad685619f70d0a20dcea50cde31..3dea86ab990872544cf55d247d3ed6784707b302 100644
(file)
--- a/
src/jexer/layout/StretchLayoutManager.java
+++ b/
src/jexer/layout/StretchLayoutManager.java
@@
-126,6
+126,16
@@
public class StretchLayoutManager implements LayoutManager {
layoutChildren();
}
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 ---------------------------------------------------
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// StretchLayoutManager ---------------------------------------------------
// ------------------------------------------------------------------------