aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorEugene Sandulenko2006-06-15 02:14:40 +0000
committerEugene Sandulenko2006-06-15 02:14:40 +0000
commit021159724d5babf61f8239506275e147ed3882a7 (patch)
tree21526aab64f9d349920df3303f87b1ec5335bf4f /gui
parent4eefe52e1ccb6e830025906706651e0e9e4c9949 (diff)
downloadscummvm-rg350-021159724d5babf61f8239506275e147ed3882a7.tar.gz
scummvm-rg350-021159724d5babf61f8239506275e147ed3882a7.tar.bz2
scummvm-rg350-021159724d5babf61f8239506275e147ed3882a7.zip
Fix drawing of tab widget. Now it matches mock-ups. Added tab scrolling.
svn-id: r23116
Diffstat (limited to 'gui')
-rw-r--r--gui/TabWidget.cpp115
-rw-r--r--gui/TabWidget.h10
-rw-r--r--gui/ThemeClassic.cpp30
-rw-r--r--gui/ThemeNew.cpp43
-rw-r--r--gui/theme-config.cpp7
-rw-r--r--gui/theme.h15
-rw-r--r--gui/themes/modern.ini33
-rw-r--r--gui/widget.cpp3
8 files changed, 181 insertions, 75 deletions
diff --git a/gui/TabWidget.cpp b/gui/TabWidget.cpp
index 98772985fa..6879325e63 100644
--- a/gui/TabWidget.cpp
+++ b/gui/TabWidget.cpp
@@ -24,8 +24,15 @@
#include "gui/TabWidget.h"
#include "gui/dialog.h"
#include "gui/newgui.h"
+#include "gui/eval.h"
namespace GUI {
+
+enum {
+ kCmdLeft = 'LEFT',
+ kCmdRight = 'RGHT'
+};
+
TabWidget::TabWidget(GuiObject *boss, int x, int y, int w, int h)
: Widget(boss, x, y, w, h) {
init();
@@ -44,9 +51,23 @@ void TabWidget::init() {
_flags = WIDGET_ENABLED;
_type = kTabWidget;
_activeTab = -1;
-
- _tabWidth = 40;
- _tabHeight = g_gui.theme()->getTabHeight();
+ _firstVisibleTab = 0;
+
+ _tabWidth = g_gui.evaluator()->getVar("TabWidget.tabWidth");
+ _tabHeight = g_gui.evaluator()->getVar("TabWidget.tabHeight");
+ _titleVPad = g_gui.evaluator()->getVar("TabWidget.titleVPad");
+
+ _butRP = g_gui.evaluator()->getVar("TabWidget.navButtonRightPad", 0);
+ _butTP = g_gui.evaluator()->getVar("TabWidget.navButtonTopPad", 0);
+ _butW = g_gui.evaluator()->getVar("TabWidget.navButtonW", 10);
+ _butH = g_gui.evaluator()->getVar("TabWidget.navButtonH", 10);
+
+ int x = _w - _butRP - _butW * 2 - 2;
+ int y = _butTP - _tabHeight;
+ _navLeft = new ButtonWidget(this, x, y, _butW, _butH, "<", kCmdLeft, 0);
+ _navLeft->clearHints(THEME_HINT_SAVE_BACKGROUND);
+ _navRight = new ButtonWidget(this, x + _butW + 2, y, _butW, _butH, ">", kCmdRight, 0);
+ _navRight->clearHints(THEME_HINT_SAVE_BACKGROUND);
}
TabWidget::~TabWidget() {
@@ -70,7 +91,18 @@ int TabWidget::addTab(const String &title) {
_tabs.push_back(newTab);
int numTabs = _tabs.size();
- _tabWidth = _w / numTabs;
+
+ if (g_gui.evaluator()->getVar("TabWidget.tabWidth") == 0) {
+ if (_tabWidth == 0)
+ _tabWidth = 40;
+ // Determine the new tab width
+ int newWidth = g_gui.getStringWidth(title) + 2 * 3;
+ if (_tabWidth < newWidth)
+ _tabWidth = newWidth;
+ int maxWidth = _w / numTabs;
+ if (_tabWidth > maxWidth)
+ _tabWidth = maxWidth;
+ }
// Activate the new tab
setActiveTab(numTabs - 1);
@@ -93,6 +125,24 @@ void TabWidget::setActiveTab(int tabID) {
}
+void TabWidget::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
+ switch (cmd) {
+ case kCmdLeft:
+ if (_firstVisibleTab) {
+ _firstVisibleTab--;
+ draw();
+ }
+ break;
+
+ case kCmdRight:
+ if (_firstVisibleTab + _w / _tabWidth < (int)_tabs.size()) {
+ _firstVisibleTab++;
+ draw();
+ }
+ break;
+ }
+}
+
void TabWidget::handleMouseDown(int x, int y, int button, int clickCount) {
assert(y < _tabHeight);
@@ -105,8 +155,8 @@ void TabWidget::handleMouseDown(int x, int y, int button, int clickCount) {
}
// If a tab was clicked, switch to that pane
- if (tabID >= 0) {
- setActiveTab(tabID);
+ if (tabID >= 0 && tabID + _firstVisibleTab < (int)_tabs.size()) {
+ setActiveTab(tabID + _firstVisibleTab);
}
}
@@ -128,27 +178,66 @@ void TabWidget::handleScreenChanged() {
}
}
- _tabHeight = g_gui.theme()->getTabHeight();
- _tabWidth = 40;
+ _tabHeight = g_gui.evaluator()->getVar("TabWidget.tabHeight");
+ _tabWidth = g_gui.evaluator()->getVar("TabWidget.tabWidth");
+ _titleVPad = g_gui.evaluator()->getVar("TabWidget.titleVPad");
+
+ if (_tabWidth == 0) {
+ _tabWidth = 40;
+ int maxWidth = _w / _tabs.size();
+
+ for (uint i = 0; i < _tabs.size(); ++i) {
+ // Determine the new tab width
+ int newWidth = g_gui.getStringWidth(_tabs[i].title) + 2 * 3;
+ if (_tabWidth < newWidth)
+ _tabWidth = newWidth;
+ if (_tabWidth > maxWidth)
+ _tabWidth = maxWidth;
+ }
+ }
+
+ _butRP = g_gui.evaluator()->getVar("TabWidget.navButtonRightPad", 0);
+ _butTP = g_gui.evaluator()->getVar("TabWidget.navButtonTopPad", 0);
+ _butW = g_gui.evaluator()->getVar("TabWidget.navButtonW", 10);
+ _butH = g_gui.evaluator()->getVar("TabWidget.navButtonH", 10);
+
+ int x = _w - _butRP - _butW * 2 - 2 - _boss->getChildX();
+ int y = _butTP - _boss->getChildY() - _tabHeight;
+ _navLeft->resize(x, y, _butW, _butH);
+ _navRight->resize(x + _butW + 2, y, _butW, _butH);
_tabOffset = 0; // TODO
_tabSpacing = g_gui.theme()->getTabSpacing();
_tabPadding = g_gui.theme()->getTabPadding();
-
- if (_tabs.size())
- _tabWidth = _w / _tabs.size();
}
void TabWidget::drawWidget(bool hilite) {
Common::Array<Common::String> tabs;
- for (int i = 0; i < (int)_tabs.size(); ++i) {
+ for (int i = _firstVisibleTab; i < (int)_tabs.size(); ++i) {
tabs.push_back(_tabs[i].title);
}
- g_gui.theme()->drawTab(Common::Rect(_x, _y, _x+_w, _y+_h), _tabHeight, _tabWidth, tabs, _activeTab, _hints);
+ g_gui.theme()->drawTab(Common::Rect(_x, _y, _x+_w, _y+_h), _tabHeight, _tabWidth, tabs, _activeTab - _firstVisibleTab, _hints, _titleVPad);
+}
+
+void TabWidget::draw() {
+ Widget::draw();
+ if (_tabWidth * _tabs.size() > _w) {
+ _navLeft->draw();
+ _navRight->draw();
+ }
}
Widget *TabWidget::findWidget(int x, int y) {
if (y < _tabHeight) {
+ if (_tabWidth * _tabs.size() > _w) {
+ if (y >= _butTP && y < _butTP + _butH) {
+ if (x >= _w - _butRP - _butW * 2 - 2 && x < _w - _butRP - _butW - 2)
+ return _navLeft;
+ if (x >= _w - _butRP - _butW && x < _w - _butRP)
+ return _navRight;
+ }
+ }
+
// Click was in the tab area
return this;
} else {
diff --git a/gui/TabWidget.h b/gui/TabWidget.h
index d6e158364e..36dea14030 100644
--- a/gui/TabWidget.h
+++ b/gui/TabWidget.h
@@ -35,8 +35,10 @@ class TabWidget : public Widget {
Widget *firstWidget;
};
typedef Common::Array<Tab> TabList;
+
protected:
int _activeTab;
+ int _firstVisibleTab;
TabList _tabs;
int _tabWidth;
int _tabHeight;
@@ -44,6 +46,11 @@ protected:
int _tabOffset;
int _tabSpacing;
int _tabPadding;
+ int _titleVPad;
+
+ int _butRP, _butTP, _butW, _butH;
+
+ ButtonWidget *_navLeft, *_navRight;
public:
TabWidget(GuiObject *boss, int x, int y, int w, int h);
@@ -71,9 +78,12 @@ public:
virtual void handleMouseDown(int x, int y, int button, int clickCount);
virtual bool handleKeyDown(uint16 ascii, int keycode, int modifiers);
+ virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
virtual void handleScreenChanged();
+ virtual void draw();
+
protected:
virtual void drawWidget(bool hilite);
diff --git a/gui/ThemeClassic.cpp b/gui/ThemeClassic.cpp
index f56eec08fe..9c36463fd2 100644
--- a/gui/ThemeClassic.cpp
+++ b/gui/ThemeClassic.cpp
@@ -138,14 +138,6 @@ void ThemeClassic::resetDrawArea() {
}
}
-int ThemeClassic::getTabHeight() const {
- if (_screen.w >= 400 && _screen.h >= 300) {
- return 21;
- } else {
- return 16;
- }
-}
-
int ThemeClassic::getTabSpacing() const {
return 2;
}
@@ -221,7 +213,7 @@ void ThemeClassic::drawWidgetBackground(const Common::Rect &r, uint16 hints, Wid
addDirtyRect(r, (hints & THEME_HINT_SAVE_BACKGROUND) != 0);
}
-void ThemeClassic::drawButton(const Common::Rect &r, const Common::String &str, State state) {
+void ThemeClassic::drawButton(const Common::Rect &r, const Common::String &str, State state, uint16 hints) {
if (!_initOk)
return;
restoreBackground(r);
@@ -356,7 +348,7 @@ void ThemeClassic::drawCheckbox(const Common::Rect &r, const Common::String &str
addDirtyRect(r);
}
-void ThemeClassic::drawTab(const Common::Rect &r, int tabHeight, int tabWidth, const Common::Array<Common::String> &tabs, int active, uint16 hints, State state) {
+void ThemeClassic::drawTab(const Common::Rect &r, int tabHeight, int tabWidth, const Common::Array<Common::String> &tabs, int active, uint16 hints, int titleVPad, State state) {
if (!_initOk)
return;
restoreBackground(r);
@@ -368,14 +360,16 @@ void ThemeClassic::drawTab(const Common::Rect &r, int tabHeight, int tabWidth, c
_font->drawString(&_screen, tabs[i], r.left + i * tabWidth, r.top+4, tabWidth, getColor(state), Graphics::kTextAlignCenter, 0, true);
}
- box(r.left + active * tabWidth, r.top, tabWidth, tabHeight, _color, _shadowcolor, true);
- _font->drawString(&_screen, tabs[active], r.left + active * tabWidth, r.top+2, tabWidth, getColor(kStateHighlight), Graphics::kTextAlignCenter, 0, true);
-
- _screen.hLine(r.left, r.top + tabHeight, r.left + active * tabWidth + 1, _color);
- _screen.hLine(r.left + active * tabWidth + tabWidth - 2, r.top + tabHeight, r.right, _color);
- _screen.hLine(r.left, r.bottom - 1, r.right - 1, _shadowcolor);
- _screen.vLine(r.left, r.top + tabHeight, r.bottom - 1, _color);
- _screen.vLine(r.right - 1, r.top + tabHeight, r.bottom - 1, _shadowcolor);
+ if (active >= 0) {
+ box(r.left + active * tabWidth, r.top, tabWidth, tabHeight, _color, _shadowcolor, true);
+ _font->drawString(&_screen, tabs[active], r.left + active * tabWidth, r.top+titleVPad, tabWidth, getColor(kStateHighlight), Graphics::kTextAlignCenter, 0, true);
+
+ _screen.hLine(r.left, r.top + tabHeight, r.left + active * tabWidth + 1, _color);
+ _screen.hLine(r.left + active * tabWidth + tabWidth - 2, r.top + tabHeight, r.right, _color);
+ _screen.hLine(r.left, r.bottom - 1, r.right - 1, _shadowcolor);
+ _screen.vLine(r.left, r.top + tabHeight, r.bottom - 1, _color);
+ _screen.vLine(r.right - 1, r.top + tabHeight, r.bottom - 1, _shadowcolor);
+ }
addDirtyRect(r);
}
diff --git a/gui/ThemeNew.cpp b/gui/ThemeNew.cpp
index ef73508ba4..00545da33d 100644
--- a/gui/ThemeNew.cpp
+++ b/gui/ThemeNew.cpp
@@ -43,7 +43,7 @@
#define kShadowTr4 128
#define kShadowTr5 192
-#define THEME_VERSION 16
+#define THEME_VERSION 17
using Graphics::Surface;
@@ -391,12 +391,14 @@ void ThemeNew::drawWidgetBackground(const Common::Rect &r, uint16 hints, WidgetB
addDirtyRect((hints & THEME_HINT_USE_SHADOW) ? r2 : r, (hints & THEME_HINT_SAVE_BACKGROUND) != 0);
}
-void ThemeNew::drawButton(const Common::Rect &r, const Common::String &str, State state) {
+void ThemeNew::drawButton(const Common::Rect &r, const Common::String &str, State state, uint16 hints) {
if (!_initOk)
return;
Common::Rect r2 = shadowRect(r, kShadowButton);
- restoreBackground(r2);
+
+ if (hints & THEME_HINT_SAVE_BACKGROUND)
+ restoreBackground(r2);
// shadow
drawShadow(r, surface(kButtonBkgdCorner), surface(kButtonBkgdTop), surface(kButtonBkgdLeft), surface(kButtonBkgd), kShadowButton);
@@ -568,7 +570,7 @@ void ThemeNew::drawCheckbox(const Common::Rect &r, const Common::String &str, bo
addDirtyRect(r);
}
-void ThemeNew::drawTab(const Common::Rect &r, int tabHeight, int tabWidth, const Common::Array<Common::String> &tabs, int active, uint16 hints, State state) {
+void ThemeNew::drawTab(const Common::Rect &r, int tabHeight, int tabWidth, const Common::Array<Common::String> &tabs, int active, uint16 hints, int titleVPad, State state) {
if (!_initOk)
return;
@@ -595,31 +597,39 @@ void ThemeNew::drawTab(const Common::Rect &r, int tabHeight, int tabWidth, const
if (i == active)
continue;
- Common::Rect tabRect(r.left + i * (tabWidth + tabOffset), r.top, r.left + i * (tabWidth + tabOffset) + tabWidth, r.top + tabHeight);
+ Common::Rect tabRect(r.left + i * (tabWidth + tabOffset), r.top, r.left + i * (tabWidth + tabOffset) + tabWidth, r.top + tabHeight + 5);
drawRectMasked(tabRect, surface(kTabBkgdCorner), surface(kTabBkgdTop), surface(kTabBkgdLeft), surface(kTabBkgd),
256, _colors[kTabInactiveStart], _colors[kTabInactiveEnd], _gradientFactors[kTabFactor], true);
- getFont()->drawString(&_screen, tabs[i], tabRect.left, tabRect.top+2, tabRect.width(), getColor(kStateEnabled), Graphics::kTextAlignCenter, 0, true);
+ getFont()->drawString(&_screen, tabs[i], tabRect.left, tabRect.top+titleVPad, tabRect.width(), getColor(kStateEnabled), Graphics::kTextAlignCenter, 0, true);
}
// area shadow
- Common::Rect widgetBackground = Common::Rect(r.left, r.top + tabHeight, r.right, r.bottom - 2);
+ Common::Rect widgetBackground = Common::Rect(r.left, r.top + tabHeight - 1, r.right, r.top
+ + tabHeight + 20);
drawShadow(widgetBackground, surface(kTabBkgdCorner), surface(kTabBkgdTop), surface(kTabBkgdLeft), surface(kTabBkgd),
- kShadowSmall, false, true);
+ kShadowSmall);
// area itself
widgetBackground = Common::Rect(r.left, r.top + tabHeight, r.right, r.bottom);
drawRectMasked(widgetBackground, surface(kTabBkgdCorner), surface(kTabBkgdTop), surface(kTabBkgdLeft), surface(kTabBkgd),
/*(state == kStateDisabled) ? -30 : */256, tabEnd, _colors[kTabActiveEnd],
- _gradientFactors[kTabFactor], false, true);
+ _gradientFactors[kTabFactor]);
addDirtyRect(widgetBackground, true);
// active tab
- Common::Rect tabRect(r.left + active * (tabWidth + tabOffset), r.top, r.left + active * (tabWidth + tabOffset) + tabWidth, r.top + tabHeight + 1);
- drawRectMasked(tabRect, surface(kTabBkgdCorner), surface(kTabBkgdTop), surface(kTabBkgdLeft), surface(kTabBkgd),
+ if (active >= 0) {
+ Common::Rect tabRect(r.left + active * (tabWidth + tabOffset), r.top, r.left + active * (tabWidth + tabOffset) + tabWidth, r.top + tabHeight + 5);
+
+ Common::Rect shadowRect2(tabRect.left, r.top, tabRect.right, tabRect.bottom - 6);
+ drawShadow(shadowRect2, surface(kTabBkgdCorner), surface(kTabBkgdTop), surface(kTabBkgdLeft), surface(kTabBkgd), kShadowSmall, false, true);
+
+ drawRectMasked(tabRect, surface(kTabBkgdCorner), surface(kTabBkgdTop), surface(kTabBkgdLeft), surface(kTabBkgd),
256, _colors[kTabActiveStart], tabEnd, _gradientFactors[kTabFactor], true);
- getFont()->drawString(&_screen, tabs[active], tabRect.left, tabRect.top+2, tabRect.width(), getColor(kStateHighlight), Graphics::kTextAlignCenter, 0, true);
+
+ getFont()->drawString(&_screen, tabs[active], tabRect.left, tabRect.top+titleVPad, tabRect.width(), getColor(kStateEnabled), Graphics::kTextAlignCenter, 0, true);
+ }
addDirtyRect(Common::Rect(r.left, r.top-2, r.right, r.bottom));
}
@@ -748,15 +758,6 @@ void ThemeNew::drawLineSeparator(const Common::Rect &r, State state) {
addDirtyRect(r);
}
-int ThemeNew::getTabHeight() const {
- // TODO let the user specify those
- if (_screen.w >= 400 && _screen.h >= 300) {
- return 25;
- } else {
- return 16;
- }
-}
-
int ThemeNew::getTabSpacing() const {
return 0;
}
diff --git a/gui/theme-config.cpp b/gui/theme-config.cpp
index e1e29d1679..174bccd38c 100644
--- a/gui/theme-config.cpp
+++ b/gui/theme-config.cpp
@@ -52,6 +52,10 @@ const char *Theme::_defaultConfigINI =
"def_midiControlsSpacing=1\n"
"def_vcAudioTabIndent=0\n"
"use=XxY\n"
+"\n"
+"TabWidget.tabWidth=0\n"
+"TabWidget.tabHeight=16\n"
+"TabWidget.titleVPad=2\n"
"# Scumm Saveload dialog\n"
"scummsaveload=8 8 (w - 2 * 8) (h - 16)\n"
"set_parent=scummsaveload\n"
@@ -100,6 +104,9 @@ const char *Theme::_defaultConfigINI =
"ListWidget.hlRightPadding=1\n"
"PopUpWidget.leftPadding=4\n"
"PopUpWidget.rightPadding=0\n"
+"TabWidget.tabWidth=70\n"
+"TabWidget.tabHeight=21\n"
+"TabWidget.titleVPad=2\n"
"\n"
"###### chooser\n"
"opHeight=(h * 7 / 10)\n"
diff --git a/gui/theme.h b/gui/theme.h
index 137abafb72..2fd43e98bc 100644
--- a/gui/theme.h
+++ b/gui/theme.h
@@ -147,11 +147,11 @@ public:
virtual void drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, State state = kStateEnabled) = 0;
virtual void drawWidgetBackground(const Common::Rect &r, uint16 hints, WidgetBackground background = kWidgetBackgroundPlain, State state = kStateEnabled) = 0;
- virtual void drawButton(const Common::Rect &r, const Common::String &str, State state = kStateEnabled) = 0;
+ virtual void drawButton(const Common::Rect &r, const Common::String &str, State state = kStateEnabled, uint16 hints = 0) = 0;
virtual void drawSurface(const Common::Rect &r, const Graphics::Surface &surface, State state = kStateEnabled, int alpha = 256, bool themeTrans = false) = 0;
virtual void drawSlider(const Common::Rect &r, int width, State state = kStateEnabled) = 0;
virtual void drawCheckbox(const Common::Rect &r, const Common::String &str, bool checked, State state = kStateEnabled) = 0;
- virtual void drawTab(const Common::Rect &r, int tabHeight, int tabWidth, const Common::Array<Common::String> &tabs, int active, uint16 hints, State state = kStateEnabled) = 0;
+ virtual void drawTab(const Common::Rect &r, int tabHeight, int tabWidth, const Common::Array<Common::String> &tabs, int active, uint16 hints, int titleVPad, State state = kStateEnabled) = 0;
virtual void drawScrollbar(const Common::Rect &r, int sliderY, int sliderHeight, ScrollbarState, State state = kStateEnabled) = 0;
virtual void drawPopUpWidget(const Common::Rect &r, const Common::String &sel, int deltax, State state = kStateEnabled, TextAlign align = kTextAlignLeft) = 0;
virtual void drawCaret(const Common::Rect &r, bool erase, State state = kStateEnabled) = 0;
@@ -160,7 +160,6 @@ public:
virtual void restoreBackground(Common::Rect r, bool special = false) = 0;
virtual bool addDirtyRect(Common::Rect r, bool save = false, bool special = false) = 0;
- virtual int getTabHeight() const = 0;
virtual int getTabSpacing() const = 0;
virtual int getTabPadding() const = 0;
@@ -252,11 +251,11 @@ public:
void drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, State state);
void drawWidgetBackground(const Common::Rect &r, uint16 hints, WidgetBackground background, State state);
- void drawButton(const Common::Rect &r, const String &str, State state);
+ void drawButton(const Common::Rect &r, const String &str, State state, uint16 hints);
void drawSurface(const Common::Rect &r, const Graphics::Surface &surface, State state, int alpha, bool themeTrans);
void drawSlider(const Common::Rect &r, int width, State state);
void drawCheckbox(const Common::Rect &r, const String &str, bool checked, State state);
- void drawTab(const Common::Rect &r, int tabHeight, int tabWidth, const Common::Array<String> &tabs, int active, uint16 hints, State state);
+ void drawTab(const Common::Rect &r, int tabHeight, int tabWidth, const Common::Array<String> &tabs, int active, uint16 hints, int titleVPad, State state);
void drawScrollbar(const Common::Rect &r, int sliderY, int sliderHeight, ScrollbarState, State state);
void drawPopUpWidget(const Common::Rect &r, const Common::String &sel, int deltax, State state, TextAlign align);
void drawCaret(const Common::Rect &r, bool erase, State state);
@@ -264,7 +263,6 @@ public:
void restoreBackground(Common::Rect r, bool special = false);
bool addDirtyRect(Common::Rect r, bool save = false, bool special = false);
- int getTabHeight() const;
int getTabSpacing() const;
int getTabPadding() const;
@@ -333,11 +331,11 @@ public:
void drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, State state);
void drawWidgetBackground(const Common::Rect &r, uint16 hints, WidgetBackground background, State state);
- void drawButton(const Common::Rect &r, const String &str, State state);
+ void drawButton(const Common::Rect &r, const String &str, State state, uint16 hints);
void drawSurface(const Common::Rect &r, const Graphics::Surface &surface, State state, int alpha, bool themeTrans);
void drawSlider(const Common::Rect &r, int width, State state);
void drawCheckbox(const Common::Rect &r, const String &str, bool checked, State state);
- void drawTab(const Common::Rect &r, int tabHeight, int tabWidth, const Common::Array<String> &tabs, int active, uint16 hints, State state);
+ void drawTab(const Common::Rect &r, int tabHeight, int tabWidth, const Common::Array<String> &tabs, int active, uint16 hints, int titleVPad, State state);
void drawScrollbar(const Common::Rect &r, int sliderY, int sliderHeight, ScrollbarState, State state);
void drawPopUpWidget(const Common::Rect &r, const Common::String &sel, int deltax, State state, TextAlign align);
void drawCaret(const Common::Rect &r, bool erase, State state);
@@ -347,7 +345,6 @@ public:
void restoreBackground(Common::Rect r, bool special = false);
bool addDirtyRect(Common::Rect r, bool backup = false, bool special = false);
- int getTabHeight() const;
int getTabSpacing() const;
int getTabPadding() const;
diff --git a/gui/themes/modern.ini b/gui/themes/modern.ini
index 4531fb3605..cc0e26b5da 100644
--- a/gui/themes/modern.ini
+++ b/gui/themes/modern.ini
@@ -1,7 +1,7 @@
# $URL$
# $Id$
[theme]
-version=16
+version=17
[pixmaps]
pix_dialog_corner="dialog_bkgd_corner.bmp"
@@ -24,10 +24,10 @@ pix_checkbox_checked="checkbox_checked.bmp"
pix_widget_arrow="widget_arrow.bmp"
-pix_tab_corner="tab_bkgd_corner.bmp"
-pix_tab_top="button_bkgd_top.bmp"
-pix_tab_left="button_bkgd_left.bmp"
-pix_tab_bkgd="button_bkgd.bmp"
+pix_tab_corner="button_bkgd_corner.bmp"
+pix_tab_top="widget_bkgd_top.bmp"
+pix_tab_left="widget_bkgd_left.bmp"
+pix_tab_bkgd="widget_bkgd.bmp"
pix_slider_bkgd_corner="button_bkgd_corner.bmp"
pix_slider_bkgd_top="button_bkgd_top.bmp"
@@ -104,13 +104,13 @@ slider_end=169 42 12
slider_highlight_start=255 210 200
slider_highlight_end=200 70 50
-tab_background_start=246 224 139
-tab_background_end=249 238 190
+tab_background_start=232 180 80
+tab_background_end=232 180 80
tab_active_start=246 224 139
-tab_active_end=249 238 190
-tab_inactive_start=246 224 139
-tab_inactive_end=246 224 139
+tab_active_end=251 241 206
+tab_inactive_start=239 202 109
+tab_inactive_end=239 202 109
scrollbar_background_start=247 228 166
scrollbar_background_end=247 228 166
@@ -135,7 +135,7 @@ caret_color=0 0 0
[gradients]
gradient_dialog_main=1
-gradient_dialog=1
+gradient_dialog=2
gradient_dialog_special=2
gradient_widget_small=3
@@ -221,6 +221,13 @@ Console.leftPadding=7
Console.rightPadding=5
Console.topPadding=5
Console.bottomPadding=5
+TabWidget.tabWidth=100
+TabWidget.tabHeight=27
+TabWidget.titleVPad=8
+TabWidget.navButtonRightPad=3
+TabWidget.navButtonTopPad=4
+TabWidget.navButtonW=15
+TabWidget.navButtonH=18
###### chooser
opHeight=insetH
@@ -259,7 +266,7 @@ use=scummmain
globaloptions=insetX insetY insetW insetH
set_parent=globaloptions
vBorder=optionsVPad
-globaloptions_tabwidget=0 vBorder parent.w (parent.h - buttonHeight - 8 - 2 * vBorder)
+globaloptions_tabwidget=0 0 parent.w (parent.h - buttonHeight - 8 - 2 * vBorder)
# graphics tab
opYoffset=vBorder
@@ -300,7 +307,7 @@ vBorder=gameOptionsOverrideVPad
gox=10
gow=(parent.w - gox - 25)
-gameoptions_tabwidget=0 vBorder parent.w (parent.h - buttonHeight - 8 - 2 * vBorder)
+gameoptions_tabwidget=0 0 parent.w (parent.h - buttonHeight - 8 - 2 * vBorder)
# game tab
opYoffset=optionsVPad
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 5053b0317e..ccf9ed78b3 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -201,6 +201,7 @@ ButtonWidget::ButtonWidget(GuiObject *boss, const String &name, const String &la
: StaticTextWidget(boss, name, label), CommandSender(boss),
_cmd(cmd), _hotkey(hotkey) {
_flags = WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG;
+ _hints = THEME_HINT_USE_SHADOW;
_type = kButtonWidget;
}
@@ -210,7 +211,7 @@ void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount) {
}
void ButtonWidget::drawWidget(bool hilite) {
- g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), _label, isEnabled() ? (hilite ? Theme::kStateHighlight : Theme::kStateEnabled) : Theme::kStateDisabled);
+ g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), _label, isEnabled() ? (hilite ? Theme::kStateHighlight : Theme::kStateEnabled) : Theme::kStateDisabled, _hints);
}
#pragma mark -