From 9a17302f5792ceb9e4e1a3be10f584ecb1a4ffcb Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Mon, 16 May 2005 13:28:34 +0000 Subject: 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 --- gui/ListWidget.cpp | 8 +++----- 1 file 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); } -- cgit v1.2.3