[Scummvm-cvs-logs] CVS: scummvm/gui browser.cpp,1.29,1.30
Torbjörn Andersson
eriktorbjorn at users.sourceforge.net
Mon May 16 16:17:23 CEST 2005
Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28720
Modified Files:
browser.cpp
Log Message:
Made the file/directory browser dialog scale itself.
Index: browser.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/browser.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- browser.cpp 16 Apr 2005 17:55:08 -0000 1.29
+++ browser.cpp 16 May 2005 09:24:28 -0000 1.30
@@ -131,29 +131,55 @@
*/
BrowserDialog::BrowserDialog(const char *title, bool dirBrowser)
- : Dialog(20, 10, 320 -2 * 20, 200 - 2 * 10)
- {
+ : Dialog(0, 0, 320, 200) {
+
+ const int screenW = g_system->getOverlayWidth();
+ const int screenH = g_system->getOverlayHeight();
+
+ GUI::WidgetSize ws;
+ int lineHeight;
+ int buttonHeight;
+ int buttonWidth;
+ const Graphics::Font *font;
+
+ _w = (screenW * 7) / 8;
+ _h = (screenH * 9) / 10;
+ _x = (screenW - _w) / 2;
+ _y = (screenH - _h) / 2;
+
+ if (screenW >= 400 && screenH >= 300) {
+ ws = GUI::kBigWidgetSize;
+ font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
+ buttonWidth = kBigButtonWidth;
+ buttonHeight = kBigButtonHeight;
+ } else {
+ ws = GUI::kNormalWidgetSize;
+ font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
+ buttonWidth = kButtonWidth;
+ buttonHeight = kButtonHeight;
+ }
+
+ lineHeight = font->getFontHeight() + 2;
_isDirBrowser = dirBrowser;
_fileList = NULL;
_currentPath = NULL;
// Headline - TODO: should be customizable during creation time
- new StaticTextWidget(this, 10, 8, _w - 2 * 10, kLineHeight, title, kTextAlignCenter);
+ new StaticTextWidget(this, 10, lineHeight, _w - 2 * 10, lineHeight, title, kTextAlignCenter, ws);
// Current path - TODO: handle long paths ?
- _currentPath = new StaticTextWidget(this, 10, 20, _w - 2 * 10, kLineHeight,
- "DUMMY", kTextAlignLeft);
+ _currentPath = new StaticTextWidget(this, 10, 2 * lineHeight, _w - 2 * 10, kLineHeight, "DUMMY", kTextAlignLeft, ws);
// Add file list
- _fileList = new ListWidget(this, 10, 34, _w - 2 * 10, _h - 34 - 24 - 10);
+ _fileList = new ListWidget(this, 10, 3 * lineHeight, _w - 2 * 10, _h - 3 * lineHeight - buttonHeight - 14, ws);
_fileList->setNumberingMode(kListNumberingOff);
_fileList->setEditable(false);
// Buttons
- addButton(10, _h - 24, "Go up", kGoUpCmd, 0);
- addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
- addButton(_w - (kButtonWidth+10), _h - 24, "Choose", kChooseCmd, 0);
+ addButton(10, _h - buttonHeight - 8, "Go up", kGoUpCmd, 0, ws);
+ addButton(_w - 2 * (buttonWidth + 10), _h - buttonHeight - 8, "Cancel", kCloseCmd, 0, ws);
+ addButton(_w - (buttonWidth + 10), _h - buttonHeight - 8, "Choose", kChooseCmd, 0, ws);
}
void BrowserDialog::open() {
More information about the Scummvm-git-logs
mailing list