diff options
-rw-r--r-- | gui/ListWidget.cpp | 12 | ||||
-rw-r--r-- | gui/ListWidget.h | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index 523f23fb9c..154d7f88a7 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -78,6 +78,13 @@ ListWidget::~ListWidget() { delete[] _textWidth; } +Widget *ListWidget::findWidget(int x, int y) { + if (x >= _w - _scrollBarWidth) + return _scrollBar; + + return this; +} + void ListWidget::setSelected(int item) { assert(item >= -1 && item < (int)_list.size()); @@ -138,11 +145,6 @@ void ListWidget::handleMouseDown(int x, int y, int button, int clickCount) { if (!isEnabled()) return; - if (x >= _w - _scrollBarWidth) { - _scrollBar->handleMouseDown(x, y, button, clickCount); - return; - } - // First check whether the selection changed int newSelectedItem; newSelectedItem = findItem(x, y); diff --git a/gui/ListWidget.h b/gui/ListWidget.h index d5b2ad669d..b74e90d32b 100644 --- a/gui/ListWidget.h +++ b/gui/ListWidget.h @@ -73,6 +73,8 @@ public: ListWidget(GuiObject *boss, String name); virtual ~ListWidget(); + virtual Widget *findWidget(int x, int y); + void setList(const StringList& list); const StringList& getList() const { return _list; } int getSelected() const { return _selectedItem; } |