From 923101abcbad36dbfc676008cf7193efa60caaa7 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 27 May 2006 06:38:45 +0000 Subject: Override the list widget's FindWidget() function, to allow it to return the scrollbar widget. svn-id: r22672 --- gui/ListWidget.cpp | 12 +++++++----- 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; } -- cgit v1.2.3