[Scummvm-cvs-logs] CVS: scummvm/gui TabWidget.cpp,1.12,1.13

Max Horn fingolfin at users.sourceforge.net
Sat Dec 25 13:57:01 CET 2004


Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10328

Modified Files:
	TabWidget.cpp 
Log Message:
Draw the active tab differently: remove the horizontal line at the bottom (inspired by patch #1091165)

Index: TabWidget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/TabWidget.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- TabWidget.cpp	28 Feb 2004 12:57:53 -0000	1.12
+++ TabWidget.cpp	25 Dec 2004 21:56:26 -0000	1.13
@@ -118,29 +118,52 @@
 	return Widget::handleKeyDown(ascii, keycode, modifiers);
 }
 
+static void box(int x, int y, int width, int height, OverlayColor colorA, OverlayColor colorB, bool omitBottom) {
+	NewGui &gui = g_gui;
+
+	gui.hLine(x + 1, y, x + width - 2, colorA);
+	gui.hLine(x, y + 1, x + width - 1, colorA);
+	gui.vLine(x, y + 1, y + height - (omitBottom ? 1 : 2), colorA);
+	gui.vLine(x + 1, y, y + height - (omitBottom ? 2 : 1), colorA);
+
+	if (!omitBottom) {
+		gui.hLine(x + 1, y + height - 2, x + width - 1, colorB);
+		gui.hLine(x + 1, y + height - 1, x + width - 2, colorB);
+	}
+	gui.vLine(x + width - 1, y + 1, y + height - (omitBottom ? 1 : 2), colorB);
+	gui.vLine(x + width - 2, y + 1, y + height - (omitBottom ? 2 : 1), colorB);
+}
+
+
 void TabWidget::drawWidget(bool hilite) {
 	NewGui *gui = &g_gui;
 	
+	const int left1  = _x + 1;
+	const int right1 = _x + kTabLeftOffset + _activeTab * (_tabWidth + kTabSpacing);
+	const int left2  = right1 + _tabWidth;
+	const int right2 = _x + _w - 2;
+	
 	// Draw horizontal line
-	gui->hLine(_x + 1, _y + kTabHeight - 2, _x + _w - 2, gui->_shadowcolor);
+	gui->hLine(left1, _y + kTabHeight - 2, right1, gui->_shadowcolor);
+	gui->hLine(left2, _y + kTabHeight - 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; 
-		gui->box(x, _y + yOffset, _tabWidth, kTabHeight - yOffset, color, color);
+		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);
 		x += _tabWidth + kTabSpacing;
 	}
 
 	// Draw more horizontal lines
-	gui->hLine(_x+1, _y + kTabHeight - 1, _x + _w - 2, gui->_color);
+	gui->hLine(left1, _y + kTabHeight - 1, right1, gui->_color);
+	gui->hLine(left2, _y + kTabHeight - 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) {
 		// Click was in the tab area





More information about the Scummvm-git-logs mailing list