aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-05-17 06:19:42 +0000
committerTorbjörn Andersson2005-05-17 06:19:42 +0000
commit4ecb6d650f54bc0f7f46d32b685f6abe599f3fbd (patch)
tree3d832ee52c185ba2849f4f01a5fabba7c9ecd117
parent99ef35bdd4a0a18b96e2fde71dbf546a4cf40e73 (diff)
downloadscummvm-rg350-4ecb6d650f54bc0f7f46d32b685f6abe599f3fbd.tar.gz
scummvm-rg350-4ecb6d650f54bc0f7f46d32b685f6abe599f3fbd.tar.bz2
scummvm-rg350-4ecb6d650f54bc0f7f46d32b685f6abe599f3fbd.zip
Added "big" version of the Tab widget, and made use of it.
svn-id: r18134
-rw-r--r--gui/TabWidget.cpp46
-rw-r--r--gui/TabWidget.h5
-rw-r--r--gui/launcher.cpp10
-rw-r--r--gui/options.cpp23
4 files changed, 62 insertions, 22 deletions
diff --git a/gui/TabWidget.cpp b/gui/TabWidget.cpp
index a082ef7295..5d821e9d48 100644
--- a/gui/TabWidget.cpp
+++ b/gui/TabWidget.cpp
@@ -28,20 +28,36 @@ namespace GUI {
enum {
kTabHeight = 16,
+ kBigTabHeight = 21,
kTabLeftOffset = 4,
kTabSpacing = 2,
kTabPadding = 3
};
-TabWidget::TabWidget(GuiObject *boss, int x, int y, int w, int h)
- : Widget(boss, x, y, w, h) {
+TabWidget::TabWidget(GuiObject *boss, int x, int y, int w, int h, WidgetSize ws)
+ : Widget(boss, x, y, w, h), _ws(ws) {
_flags = WIDGET_ENABLED;
_type = kTabWidget;
_activeTab = -1;
_tabWidth = 40;
+
+ switch (_ws) {
+ case kNormalWidgetSize:
+ _font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
+ _tabHeight = kTabHeight;
+ break;
+ case kBigWidgetSize:
+ _font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
+ _tabHeight = kBigTabHeight;
+ break;
+ case kDefaultWidgetSize:
+ _font = &g_gui.getFont();
+ _tabHeight = kTabHeight;
+ break;
+ }
}
TabWidget::~TabWidget() {
@@ -53,21 +69,21 @@ TabWidget::~TabWidget() {
}
int16 TabWidget::getChildY() const {
- return getAbsY() + kTabHeight;
+ return getAbsY() + _tabHeight;
}
int TabWidget::addTab(const String &title) {
// Add a new tab page
Tab newTab;
- newTab.title = title;
- newTab.firstWidget = 0;
+ newTab.title = title;
+ newTab.firstWidget = 0;
_tabs.push_back(newTab);
int numTabs = _tabs.size();
// Determine the new tab width
- int newWidth = g_gui.getStringWidth(title) + 2 * kTabPadding;
+ int newWidth = _font->getStringWidth(title) + 2 * kTabPadding;
if (_tabWidth < newWidth)
_tabWidth = newWidth;
int maxWidth = (_w - kTabLeftOffset) / numTabs - kTabLeftOffset;
@@ -96,7 +112,7 @@ void TabWidget::setActiveTab(int tabID) {
void TabWidget::handleMouseDown(int x, int y, int button, int clickCount) {
- assert(y < kTabHeight);
+ assert(y < _tabHeight);
// Determine which tab was clicked
int tabID = -1;
@@ -146,33 +162,33 @@ void TabWidget::drawWidget(bool hilite) {
const int right2 = _x + _w - 2;
// Draw horizontal line
- gui->hLine(left1, _y + kTabHeight - 2, right1, gui->_shadowcolor);
- gui->hLine(left2, _y + kTabHeight - 2, right2, gui->_shadowcolor);
+ gui->hLine(left1, _y + _tabHeight - 2, right1, gui->_shadowcolor);
+ gui->hLine(left2, _y + _tabHeight - 2, right2, gui->_shadowcolor);
// Iterate over all tabs and draw them
int i, x = _x + kTabLeftOffset;
for (i = 0; i < (int)_tabs.size(); ++i) {
OverlayColor color = (i == _activeTab) ? gui->_color : gui->_shadowcolor;
int yOffset = (i == _activeTab) ? 0 : 2;
- box(x, _y + yOffset, _tabWidth, kTabHeight - yOffset, color, color, (i == _activeTab));
- gui->drawString(_tabs[i].title, x + kTabPadding, _y + yOffset / 2 + (kTabHeight - kLineHeight - 1), _tabWidth - 2 * kTabPadding, gui->_textcolor, kTextAlignCenter);
+ box(x, _y + yOffset, _tabWidth, _tabHeight - yOffset, color, color, (i == _activeTab));
+ gui->drawString(_font, _tabs[i].title, x + kTabPadding, _y + yOffset / 2 + (_tabHeight - _font->getFontHeight() - 3), _tabWidth - 2 * kTabPadding, gui->_textcolor, kTextAlignCenter);
x += _tabWidth + kTabSpacing;
}
// Draw more horizontal lines
- gui->hLine(left1, _y + kTabHeight - 1, right1, gui->_color);
- gui->hLine(left2, _y + kTabHeight - 1, right2, gui->_color);
+ gui->hLine(left1, _y + _tabHeight - 1, right1, gui->_color);
+ gui->hLine(left2, _y + _tabHeight - 1, right2, gui->_color);
gui->hLine(_x+1, _y + _h - 2, _x + _w - 2, gui->_shadowcolor);
gui->hLine(_x+1, _y + _h - 1, _x + _w - 2, gui->_color);
}
Widget *TabWidget::findWidget(int x, int y) {
- if (y < kTabHeight) {
+ if (y < _tabHeight) {
// Click was in the tab area
return this;
} else {
// Iterate over all child widgets and find the one which was clicked
- return Widget::findWidgetInChain(_firstWidget, x, y - kTabHeight);
+ return Widget::findWidgetInChain(_firstWidget, x, y - _tabHeight);
}
}
diff --git a/gui/TabWidget.h b/gui/TabWidget.h
index ec8ebf1aaf..347dcc0290 100644
--- a/gui/TabWidget.h
+++ b/gui/TabWidget.h
@@ -38,9 +38,12 @@ protected:
int _activeTab;
TabList _tabs;
int _tabWidth;
+ int _tabHeight;
+ const WidgetSize _ws;
+ const Graphics::Font *_font;
public:
- TabWidget(GuiObject *boss, int x, int y, int w, int h);
+ TabWidget(GuiObject *boss, int x, int y, int w, int h, WidgetSize ws = kDefaultWidgetSize);
~TabWidget();
virtual int16 getChildY() const;
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index ba03f00b1e..244a787fc7 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -144,6 +144,14 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target)
_w = screenW - 2 * 10;
_h = screenH - 2 * 40; // TODO/FIXME
+
+ GUI::WidgetSize ws;
+
+ if (screenW >= 400 && screenH >= 300) {
+ ws = GUI::kBigWidgetSize;
+ } else {
+ ws = GUI::kNormalWidgetSize;
+ }
const int x = 5;
const int w = _w - 15;
@@ -163,7 +171,7 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target)
}
// GUI: Add tab widget
- TabWidget *tab = new TabWidget(this, 0, vBorder, _w, _h - 24 - 2*vBorder);
+ TabWidget *tab = new TabWidget(this, 0, vBorder, _w, _h - 24 - 2 * vBorder, ws);
//
// 1) The game tab
diff --git a/gui/options.cpp b/gui/options.cpp
index 5116d67178..b9e6ccb2b8 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -435,19 +435,32 @@ int OptionsDialog::addVolumeControls(GuiObject *boss, int yoffset) {
GlobalOptionsDialog::GlobalOptionsDialog()
- : OptionsDialog(Common::ConfigManager::kApplicationDomain, 10, 20, 320 - 2 * 10, 200 - 1 * 20) {
+ : OptionsDialog(Common::ConfigManager::kApplicationDomain, 10, 40, 320 - 2 * 10, 140) {
const int screenW = g_system->getOverlayWidth();
const int screenH = g_system->getOverlayHeight();
+
+ GUI::WidgetSize ws;
- _w = screenW - 2 * 10;
- _h = screenH - 1 * 20;
+ if (screenW >= 400 && screenH >= 300) {
+ ws = GUI::kBigWidgetSize;
+ _w = screenW - 2 * 10;
+ _h = screenH - 2 * 40;
+ _x = 10;
+ _y = 40;
+ } else {
+ ws = GUI::kNormalWidgetSize;
+ _w = screenW - 2 * 10;
+ _h = screenH - 1 * 20;
+ _x = 10;
+ _y = 20;
+ }
- const int vBorder = 4;
+ const int vBorder = 5; // Tab border
int yoffset;
// The tab widget
- TabWidget *tab = new TabWidget(this, 0, vBorder, _w, _h - 24 - 2 * vBorder);
+ TabWidget *tab = new TabWidget(this, 0, vBorder, _w, _h - 24 - 2 * vBorder, ws);
//
// 1) The graphics tab