aboutsummaryrefslogtreecommitdiff
path: root/gui/chooser.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-05-20 15:59:29 +0000
committerTorbjörn Andersson2005-05-20 15:59:29 +0000
commit4d9edbedc6a0f6ca4e5788c6bd3e793458a96869 (patch)
tree1b1d4eeef56e93dd2f3797c59414af91c2174369 /gui/chooser.cpp
parent0a2e243e811379c4a5d38d6b111f5673e3bcdffc (diff)
downloadscummvm-rg350-4d9edbedc6a0f6ca4e5788c6bd3e793458a96869.tar.gz
scummvm-rg350-4d9edbedc6a0f6ca4e5788c6bd3e793458a96869.tar.bz2
scummvm-rg350-4d9edbedc6a0f6ca4e5788c6bd3e793458a96869.zip
Made the chooser dialog scale itself, albeit in a slightly hackish way.
svn-id: r18194
Diffstat (limited to 'gui/chooser.cpp')
-rw-r--r--gui/chooser.cpp46
1 files changed, 42 insertions, 4 deletions
diff --git a/gui/chooser.cpp b/gui/chooser.cpp
index 291e927255..cd434ad9b2 100644
--- a/gui/chooser.cpp
+++ b/gui/chooser.cpp
@@ -19,6 +19,7 @@
*/
#include "stdafx.h"
+#include "common/system.h"
#include "gui/chooser.h"
#include "gui/newgui.h"
#include "gui/ListWidget.h"
@@ -31,16 +32,53 @@ enum {
ChooserDialog::ChooserDialog(const String &title, const String &buttonLabel, int height)
: Dialog(8, (200 - height) / 2, 320 - 2 * 8, height) {
+
+ const int screenW = g_system->getOverlayWidth();
+ const int screenH = g_system->getOverlayHeight();
+ const Graphics::Font *font;
+
+ GUI::WidgetSize ws;
+ int buttonWidth, buttonHeight;
+
+ if (screenW >= 400 && screenH >= 300) {
+ ws = GUI::kBigWidgetSize;
+ font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
+ buttonHeight = kBigButtonHeight;
+ buttonWidth = kBigButtonWidth;
+ } else {
+ ws = GUI::kNormalWidgetSize;
+ font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
+ buttonHeight = kButtonHeight;
+ buttonWidth = kButtonWidth;
+ }
+
+ int lineHeight = font->getFontHeight() + 2;
+
+ // FIXME: This is an ugly hack. The 'height' parameter assumes a 200
+ // pixel tall screen, so try to scale that to something sensible.
+
+ _h = (screenH * height) / 200;
+ _w = screenW - 2 * 8;
+
+ _x = (screenW - _w) / 2;
+ _y = (screenH - _h) / 2;
+
+ int yoffset = 6;
+
// Headline
- new StaticTextWidget(this, 10, 6, _w - 2 * 10, kLineHeight, title, kTextAlignCenter);
+ new StaticTextWidget(this, 10, 6, _w - 2 * 10, lineHeight, title, kTextAlignCenter, ws);
+
+ yoffset += lineHeight + 2;
// Add choice list
- _list = new ListWidget(this, 10, 18, _w - 2 * 10, _h - 14 - 24 - 10);
+ // HACK: Subtracting -12 from the height makes the list look good when
+ // it's used to list savegames in the 320x200 version of the GUI.
+ _list = new ListWidget(this, 10, yoffset, _w - 2 * 10, _h - yoffset - buttonHeight - 12, ws);
_list->setNumberingMode(kListNumberingOff);
// Buttons
- addButton(this, _w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
- _chooseButton = addButton(this, _w-(kButtonWidth + 10), _h - 24, buttonLabel, kChooseCmd, 0);
+ addButton(this, _w - 2 * (buttonWidth + 10), _h - buttonHeight - 8, "Cancel", kCloseCmd, 0, ws);
+ _chooseButton = addButton(this, _w - (buttonWidth + 10), _h - buttonHeight - 8, buttonLabel, kChooseCmd, 0, ws);
_chooseButton->setEnabled(false);
}