Override the list widget's FindWidget() function, to allow it to return the

scrollbar widget.

svn-id: r22672
This commit is contained in:
Torbjörn Andersson 2006-05-27 06:38:45 +00:00
parent 9943084227
commit 923101abcb
2 changed files with 9 additions and 5 deletions

View File

@ -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);

View File

@ -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; }