aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-05-16 13:28:34 +0000
committerTorbjörn Andersson2005-05-16 13:28:34 +0000
commit9a17302f5792ceb9e4e1a3be10f584ecb1a4ffcb (patch)
tree7c82267e7f0cfffd38a3d0edda8414ec370618ab
parent8eee14934b7bcba1a6de1a0f5228e9c7adc9ca1b (diff)
downloadscummvm-rg350-9a17302f5792ceb9e4e1a3be10f584ecb1a4ffcb.tar.gz
scummvm-rg350-9a17302f5792ceb9e4e1a3be10f584ecb1a4ffcb.tar.bz2
scummvm-rg350-9a17302f5792ceb9e4e1a3be10f584ecb1a4ffcb.zip
Use the same offset - string width for the item number - for every line in
the list. There's a slight hack here: I've assumed that all digits have the same width. svn-id: r18129
-rw-r--r--gui/ListWidget.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp
index b858d2b84b..96b37da6c8 100644
--- a/gui/ListWidget.cpp
+++ b/gui/ListWidget.cpp
@@ -302,7 +302,7 @@ void ListWidget::drawWidget(bool hilite) {
NewGui *gui = &g_gui;
int i, pos, len = _list.size();
Common::String buffer;
- int offset, deltax;
+ int deltax;
Graphics::Surface *surf = &g_gui.getScreen();
// Draw a thin frame around the list.
@@ -329,9 +329,6 @@ void ListWidget::drawWidget(bool hilite) {
sprintf(temp, "%2d. ", (pos + _numberingMode));
buffer = temp;
_font->drawString(surf, buffer, _x + 2, y, _w - 4, textColor);
- offset = _font->getStringWidth(buffer);
- } else {
- offset = 0;
}
Common::Rect r(getEditRect());
@@ -358,7 +355,8 @@ Common::Rect ListWidget::getEditRect() const {
if (_numberingMode != kListNumberingOff) {
char temp[10];
- sprintf(temp, "%2d. ", (_selectedItem + _numberingMode));
+ // FIXME: Assumes that all digits have the same width.
+ sprintf(temp, "%2d. ", (_list.size() - 1 + _numberingMode));
r.left += _font->getStringWidth(temp);
}