aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-05-16 10:26:20 +0000
committerTorbjörn Andersson2005-05-16 10:26:20 +0000
commit469319aa7009486e3f15475fed115708ffdc9a0d (patch)
treeedd03a98dab0d5642b2da7363437bde41123d541
parent6a0ba15b0d2a264cc45b6b534301fea919d86d1d (diff)
downloadscummvm-rg350-469319aa7009486e3f15475fed115708ffdc9a0d.tar.gz
scummvm-rg350-469319aa7009486e3f15475fed115708ffdc9a0d.tar.bz2
scummvm-rg350-469319aa7009486e3f15475fed115708ffdc9a0d.zip
Made the buttons scale themselves too.
svn-id: r18127
-rw-r--r--gui/message.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/gui/message.cpp b/gui/message.cpp
index 28ab5e3f58..68378d1ac7 100644
--- a/gui/message.cpp
+++ b/gui/message.cpp
@@ -42,15 +42,20 @@ MessageDialog::MessageDialog(const Common::String &message, const char *defaultB
GUI::WidgetSize ws;
int lineHeight;
+ int buttonWidth, buttonHeight;
const Graphics::Font *font;
if (screenW >= 400 && screenH >= 300) {
ws = GUI::kBigWidgetSize;
font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
lineHeight = font->getFontHeight() + 2;
+ buttonWidth = kBigButtonWidth;
+ buttonHeight = kBigButtonHeight;
} else {
ws = GUI::kNormalWidgetSize;
font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
lineHeight = font->getFontHeight() + 2;
+ buttonWidth = kButtonWidth;
+ buttonHeight = kButtonHeight;
}
// First, determine the size the dialog needs. For this we have to break
@@ -67,7 +72,7 @@ MessageDialog::MessageDialog(const Common::String &message, const char *defaultB
_h = 16;
if (defaultButton || altButton)
- _h += 24;
+ _h += buttonHeight + 8;
// Limit the number of lines so that the dialog still fits on the screen.
if (lineCount > (screenH - 20 - _h) / lineHeight) {
@@ -88,17 +93,17 @@ MessageDialog::MessageDialog(const Common::String &message, const char *defaultB
// FIXME - allow for more than two buttons, and return in runModal() which one
// was selected.
if (defaultButton && altButton) {
- okButtonPos = (_w - (kButtonWidth * 2)) / 2;
- cancelButtonPos = ((_w - (kButtonWidth * 2)) / 2) + kButtonWidth + 10;
+ okButtonPos = (_w - (buttonWidth * 2)) / 2;
+ cancelButtonPos = ((_w - (buttonWidth * 2)) / 2) + buttonWidth + 10;
} else {
- okButtonPos = cancelButtonPos = (_w - kButtonWidth) / 2;
+ okButtonPos = cancelButtonPos = (_w - buttonWidth) / 2;
}
if (defaultButton)
- addButton(okButtonPos, _h - 24, defaultButton, kOkCmd, '\n'); // Confirm dialog
+ addButton(okButtonPos, _h - buttonHeight - 8, defaultButton, kOkCmd, '\n', ws); // Confirm dialog
if (altButton)
- addButton(cancelButtonPos, _h - 24, altButton, kCancelCmd, '\27'); // Cancel dialog
+ addButton(cancelButtonPos, _h - buttonHeight - 8, altButton, kCancelCmd, '\27', ws); // Cancel dialog
}
void MessageDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {