[Scummvm-cvs-logs] SF.net SVN: scummvm: [23037] scummvm/trunk/gui/TabWidget.cpp
eriktorbjorn at users.sourceforge.net
eriktorbjorn at users.sourceforge.net
Sun Jun 11 23:43:13 CEST 2006
Revision: 23037
Author: eriktorbjorn
Date: 2006-06-11 14:43:09 -0700 (Sun, 11 Jun 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=23037&view=rev
Log Message:
-----------
Re-calculate tab width when the screen changes.
Modified Paths:
--------------
scummvm/trunk/gui/TabWidget.cpp
Modified: scummvm/trunk/gui/TabWidget.cpp
===================================================================
--- scummvm/trunk/gui/TabWidget.cpp 2006-06-11 21:41:04 UTC (rev 23036)
+++ scummvm/trunk/gui/TabWidget.cpp 2006-06-11 21:43:09 UTC (rev 23037)
@@ -137,6 +137,8 @@
}
void TabWidget::handleScreenChanged() {
+ Widget::handleScreenChanged();
+
for (uint i = 0; i < _tabs.size(); ++i) {
Widget *w = _tabs[i].firstWidget;
while (w) {
@@ -144,12 +146,24 @@
w = w->next();
}
}
+
if (g_gui.getWidgetSize() == kBigWidgetSize) {
_tabHeight = kBigTabHeight;
} else {
_tabHeight = kTabHeight;
}
- Widget::handleScreenChanged();
+
+ _tabWidth = 40;
+
+ for (uint i = 0; i < _tabs.size(); ++i) {
+ int newWidth = g_gui.getStringWidth(_tabs[i].title) + 2 * kTabPadding;
+ if (_tabWidth < newWidth)
+ _tabWidth = newWidth;
+ }
+
+ int maxWidth = (_w - kTabLeftOffset) / _tabs.size() - kTabLeftOffset;
+ if (_tabWidth > maxWidth)
+ _tabWidth = maxWidth;
}
void TabWidget::drawWidget(bool hilite) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list