aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-05-27 06:38:45 +0000
committerTorbjörn Andersson2006-05-27 06:38:45 +0000
commit923101abcbad36dbfc676008cf7193efa60caaa7 (patch)
tree4010bc054ad96768f0973105612fab31ff048956
parent9943084227a1c1f06cc2703060c4f347e4362385 (diff)
downloadscummvm-rg350-923101abcbad36dbfc676008cf7193efa60caaa7.tar.gz
scummvm-rg350-923101abcbad36dbfc676008cf7193efa60caaa7.tar.bz2
scummvm-rg350-923101abcbad36dbfc676008cf7193efa60caaa7.zip
Override the list widget's FindWidget() function, to allow it to return the
scrollbar widget. svn-id: r22672
-rw-r--r--gui/ListWidget.cpp12
-rw-r--r--gui/ListWidget.h2
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; }