v0.9.2: fixed layout issues with recent styledbutton changes

This commit is contained in:
Evan Debenham 2021-02-22 12:46:40 -05:00
parent 4a31acf50e
commit 33e70fa89d
3 changed files with 5 additions and 1 deletions

View File

@ -119,6 +119,7 @@ public class NewsScene extends PixelScene {
boolean rightCol = false; boolean rightCol = false;
for (NewsArticle article : articles) { for (NewsArticle article : articles) {
StyledButton b = new ArticleButton(article); StyledButton b = new ArticleButton(article);
b.multiline = true;
if (!rightCol) { if (!rightCol) {
top += gap; top += gap;
b.setRect( left, top, BTN_WIDTH, BTN_HEIGHT); b.setRect( left, top, BTN_WIDTH, BTN_HEIGHT);

View File

@ -36,6 +36,8 @@ public class StyledButton extends Button {
protected RenderedTextBlock text; protected RenderedTextBlock text;
protected Image icon; protected Image icon;
public boolean multiline;
public StyledButton(Chrome.Type type, String label ) { public StyledButton(Chrome.Type type, String label ) {
this(type, label, 9); this(type, label, 9);
} }
@ -65,7 +67,7 @@ public class StyledButton extends Button {
if (icon != null) componentWidth += icon.width() + 2; if (icon != null) componentWidth += icon.width() + 2;
if (text != null && !text.text().equals("")){ if (text != null && !text.text().equals("")){
text.maxWidth( (int)(width - componentWidth - bg.marginHor() - 2)); if (multiline) text.maxWidth( (int)(width - componentWidth - bg.marginHor() - 2));
componentWidth += text.width() + 2; componentWidth += text.width() + 2;
text.setPos( text.setPos(

View File

@ -74,6 +74,7 @@ public class WndCombo extends Window {
}; };
ic.tint(move.tintColor); ic.tint(move.tintColor);
moveBtn.icon(ic); moveBtn.icon(ic);
moveBtn.multiline = true;
moveBtn.setSize(width, moveBtn.reqHeight()); moveBtn.setSize(width, moveBtn.reqHeight());
moveBtn.setRect(0, pos, width, moveBtn.reqHeight()); moveBtn.setRect(0, pos, width, moveBtn.reqHeight());
moveBtn.enable(combo.canUseMove(move)); moveBtn.enable(combo.canUseMove(move));