aboutsummaryrefslogtreecommitdiff
path: root/gui/ThemeNew.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2006-02-13 18:00:04 +0000
committerJohannes Schickel2006-02-13 18:00:04 +0000
commite067a7f288098d78fdd1067ab4ddfa24087b512a (patch)
treea824e9bf295dce33b8ab9574b3c0de76619c418f /gui/ThemeNew.cpp
parent1b459ee95976c36a4b4c46f32c8190377a1609f0 (diff)
downloadscummvm-rg350-e067a7f288098d78fdd1067ab4ddfa24087b512a.tar.gz
scummvm-rg350-e067a7f288098d78fdd1067ab4ddfa24087b512a.tar.bz2
scummvm-rg350-e067a7f288098d78fdd1067ab4ddfa24087b512a.zip
Implemented new tab drawing, should look nicer now. (The border under the active tab isn't drawn anymore)
svn-id: r20669
Diffstat (limited to 'gui/ThemeNew.cpp')
-rw-r--r--gui/ThemeNew.cpp41
1 files changed, 32 insertions, 9 deletions
diff --git a/gui/ThemeNew.cpp b/gui/ThemeNew.cpp
index e221eff45d..62c8feafb0 100644
--- a/gui/ThemeNew.cpp
+++ b/gui/ThemeNew.cpp
@@ -597,17 +597,40 @@ void ThemeNew::drawCheckbox(const Common::Rect &r, const Common::String &str, bo
addDirtyRect(r);
}
-void ThemeNew::drawTab(const Common::Rect &r, const Common::String &str, bool active, kState state) {
+OverlayColor calcGradient(OverlayColor start, OverlayColor end, int pos, int max, uint factor);
+
+void ThemeNew::drawTab(const Common::Rect &r, int tabHeight, int tabWidth, const Common::Array<Common::String> &tabs, int active, uint16 hints, kState state) {
if (!_initOk)
return;
- drawRectMasked(r, surface(kTabBkgdCorner), surface(kTabBkgdTop), surface(kTabBkgdLeft), surface(kTabBkgd),
- (state == kStateDisabled) ? 128 : 256, _colors[kTabBackgroundStart], _colors[kTabBackgroundEnd],
- _gradientFactors[kTabFactor], true);
- if (active) {
- _font->drawString(&_screen, str, r.left, r.top+2, r.width(), getColor(kStateHighlight), Graphics::kTextAlignCenter, 0, true);
- } else {
- _font->drawString(&_screen, str, r.left, r.top+2, r.width(), getColor(state), Graphics::kTextAlignCenter, 0, true);
+
+ restoreBackground(r);
+ int tabXOffset = surface(kWidgetSmallBkgdCorner)->w;
+
+ OverlayColor tabEnd = calcGradient(_colors[kTabBackgroundStart], _colors[kTabBackgroundEnd], tabHeight, r.height(), _gradientFactors[kTabFactor]);
+
+ for (int i = 0; i < (int)tabs.size(); ++i) {
+ if (i == active)
+ continue;
+
+ Common::Rect tabRect(r.left + tabXOffset + i * tabWidth, r.top, r.left + tabXOffset + i * tabWidth + tabWidth, r.top + tabHeight);
+ drawRectMasked(tabRect, surface(kTabBkgdCorner), surface(kTabBkgdTop), surface(kTabBkgdLeft), surface(kTabBkgd),
+ 128, _colors[kTabBackgroundStart], tabEnd, _gradientFactors[kTabFactor], true);
+
+ _font->drawString(&_screen, tabs[i], tabRect.left, tabRect.top+2, tabRect.width(), getColor(kStateEnabled), Graphics::kTextAlignCenter, 0, true);
}
+
+ Common::Rect widgetBackground = Common::Rect(r.left, r.top + tabHeight, r.right, r.bottom);
+ drawRectMasked(widgetBackground, surface(kWidgetSmallBkgdCorner), surface(kWidgetSmallBkgdTop), surface(kWidgetSmallBkgdLeft), surface(kWidgetSmallBkgd),
+ (state == kStateDisabled) ? 128 : 256, tabEnd, _colors[kTabBackgroundEnd],
+ _gradientFactors[kTabFactor]);
+ addDirtyRect(widgetBackground, true);
+
+ Common::Rect tabRect(r.left + tabXOffset + active * tabWidth, r.top, r.left + tabXOffset + active * tabWidth + tabWidth, r.top + tabHeight + 1);
+ drawRectMasked(tabRect, surface(kTabBkgdCorner), surface(kTabBkgdTop), surface(kTabBkgdLeft), surface(kTabBkgd),
+ 256, _colors[kTabBackgroundStart], tabEnd, _gradientFactors[kTabFactor], true);
+
+ _font->drawString(&_screen, tabs[active], tabRect.left, tabRect.top+2, tabRect.width(), getColor(kStateHighlight), Graphics::kTextAlignCenter, 0, true);
+
addDirtyRect(r);
}
@@ -914,7 +937,7 @@ void ThemeNew::drawRectMasked(const Common::Rect &r, const Graphics::Surface *co
} else {
drawSurfaceMasked(Common::Rect(xPos, yPos, xPos+usedWidth, yPos+usedHeight), left, upDown, true, alpha, startCol, endCol);
}
- } else if (!y || y == partsH - 1) {
+ } else if (!y || (y == partsH - 1 && !skipLastRow)) {
drawSurfaceMasked(Common::Rect(xPos, yPos, xPos+usedWidth, yPos+usedHeight), top, upDown, false, alpha, startCol, endCol);
} else {
drawSurfaceMasked(Common::Rect(xPos, yPos, xPos+usedWidth, yPos+usedHeight), fill, upDown, false, alpha, startCol, endCol);