minor tweaks

This commit is contained in:
thrust26 2020-02-19 07:34:11 +01:00
parent b26c271ec1
commit 7ba3dae4e2
3 changed files with 13 additions and 6 deletions

View File

@ -779,7 +779,7 @@ void Dialog::addOKCancelBGroup(WidgetArray& wid, const GUI::Font& font,
std::max(font.getStringWidth("Defaults"),
std::max(font.getStringWidth(okText),
font.getStringWidth(cancelText))) + BTN_BORDER);
int buttonHeight = font.getLineHeight() + 4;
int buttonHeight = Dialog::buttonHeight(font);
_w = std::max(HBORDER * 2 + buttonWidth * 2 + BUTTON_GAP, _w);
@ -821,7 +821,7 @@ void Dialog::addDefaultsOKCancelBGroup(WidgetArray& wid, const GUI::Font& font,
const int VBORDER = 10;
const int BTN_BORDER = 20;
int buttonWidth = font.getStringWidth(defaultsText) + BTN_BORDER;
int buttonHeight = font.getLineHeight() + 4;
int buttonHeight = Dialog::buttonHeight(font);
addDefaultWidget(new ButtonWidget(this, font, HBORDER, _h - buttonHeight - VBORDER,
buttonWidth, buttonHeight, defaultsText, GuiObject::kDefaultsCmd));
@ -830,6 +830,12 @@ void Dialog::addDefaultsOKCancelBGroup(WidgetArray& wid, const GUI::Font& font,
addOKCancelBGroup(wid, font, okText, cancelText, focusOKButton, buttonWidth);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Dialog::buttonHeight(const GUI::Font& font) const
{
return font.getLineHeight() + 4;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::TabFocus::appendFocusList(WidgetArray& list)
{

View File

@ -157,6 +157,7 @@ class Dialog : public GuiObject
const string& cancelText = "Cancel",
const string& defaultsText = "Defaults",
bool focusOKButton = true);
int buttonHeight(const GUI::Font& font) const;
void processCancelWithoutWidget(bool state) { _processCancel = state; }
virtual void processCancel() { close(); }

View File

@ -43,7 +43,7 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& ifont = instance().frameBuffer().infoFont();
const int lineHeight = _font.getLineHeight(),
fontWidth = _font.getMaxCharWidth();
const int VBORDER = 8;
const int VBORDER = 10;
const int HBORDER = 10;
const int VGAP = 4;
@ -90,7 +90,7 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent,
wid.push_back(myEditNamesWidget[p]);
myDatesWidget[p] = new StaticTextWidget(this, _font, xposDate, ypos + 1, "12-02-20 17:15");
myDeleteButtons[p] = new ButtonWidget(this, _font, xposDelete, ypos + 1, 18, 18, "X",
kDeleteSingle);
kDeleteSingle);
myDeleteButtons[p]->setID(p);
wid.push_back(myDeleteButtons[p]);
@ -100,7 +100,7 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent,
myMD5Widget = new StaticTextWidget(this, ifont, xpos, ypos + 1, "MD5: 12345678901234567890123456789012");
_h = myMD5Widget->getBottom() + VBORDER + (lineHeight + 4) + VBORDER;
_h = myMD5Widget->getBottom() + VBORDER + buttonHeight(_font) + VBORDER;
_w = myDeleteButtons[0]->getRight() + HBORDER;
addDefaultsOKCancelBGroup(wid, _font, "Save", "Cancel", " Reset ");
@ -192,7 +192,7 @@ void HighScoresDialog::handleCommand(CommandSender* sender, int cmd, int data, i
updateWidgets();
break;
case GuiObject::kDefaultsCmd:
case GuiObject::kDefaultsCmd: // "Reset" button
for (int p = NUM_POSITIONS - 1; p >= 0; --p)
deletePos(p);
updateWidgets();