aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/ListWidget.cpp8
-rw-r--r--gui/ListWidget.h6
-rw-r--r--gui/dialog.cpp3
3 files changed, 8 insertions, 9 deletions
diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp
index d40cfc829d..ca501fe617 100644
--- a/gui/ListWidget.cpp
+++ b/gui/ListWidget.cpp
@@ -86,7 +86,7 @@ ListWidget::~ListWidget()
void ListWidget::handleClick(int x, int y, int button)
{
if (_flags & WIDGET_ENABLED) {
- _selectedItem = (y / LINE_HEIGHT) + _currentPos;
+ _selectedItem = (y - 2) / LINE_HEIGHT + _currentPos;
draw();
}
}
@@ -123,9 +123,7 @@ void ListWidget::drawWidget(bool hilite)
} else
buffer = "";
buffer += _list[pos];
- if (_selectedItem == pos)
- gui->drawString(buffer, _x+5, _y+2 + LINE_HEIGHT * i, _w - 10, gui->_textcolorhi);
- else
- gui->drawString(buffer, _x+5, _y+2 + LINE_HEIGHT * i, _w - 10, gui->_textcolor);
+ gui->drawString(buffer, _x+5, _y+2 + LINE_HEIGHT * i, _w - 10,
+ (_selectedItem == pos) ? gui->_textcolorhi : gui->_textcolor);
}
}
diff --git a/gui/ListWidget.h b/gui/ListWidget.h
index b3fa7437d2..35a827e017 100644
--- a/gui/ListWidget.h
+++ b/gui/ListWidget.h
@@ -46,9 +46,9 @@ public:
ListWidget(Dialog *boss, int x, int y, int w, int h);
virtual ~ListWidget();
- void setList(const StringList& list) { _list = list; }
- const StringList& getList() const { return _list; }
- const int getSelected() {return _selectedItem;}
+ void setList(const StringList& list) { _list = list; }
+ const StringList& getList() const { return _list; }
+ int getSelected() const { return _selectedItem; }
void setNumberingMode(int numberingMode) { _numberingMode = numberingMode; }
virtual void handleClick(int x, int y, int button);
diff --git a/gui/dialog.cpp b/gui/dialog.cpp
index 9f399564f8..828a630168 100644
--- a/gui/dialog.cpp
+++ b/gui/dialog.cpp
@@ -212,9 +212,10 @@ void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
{
switch (cmd) {
case kSaveCmd:
+ //printf("Saving game in slot %d\n", _savegameList->getSelected());
break;
case kLoadCmd:
- //printf("Saving game in slot %d\n", _savegameList->getSelected());
+ //printf("Loading game in slot %d\n", _savegameList->getSelected());
break;
case kPlayCmd:
close();