Override the list widget's FindWidget() function, to allow it to return the
scrollbar widget. svn-id: r22672
This commit is contained in:
parent
9943084227
commit
923101abcb
2 changed files with 9 additions and 5 deletions
|
@ -78,6 +78,13 @@ ListWidget::~ListWidget() {
|
||||||
delete[] _textWidth;
|
delete[] _textWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget *ListWidget::findWidget(int x, int y) {
|
||||||
|
if (x >= _w - _scrollBarWidth)
|
||||||
|
return _scrollBar;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
void ListWidget::setSelected(int item) {
|
void ListWidget::setSelected(int item) {
|
||||||
assert(item >= -1 && item < (int)_list.size());
|
assert(item >= -1 && item < (int)_list.size());
|
||||||
|
|
||||||
|
@ -138,11 +145,6 @@ void ListWidget::handleMouseDown(int x, int y, int button, int clickCount) {
|
||||||
if (!isEnabled())
|
if (!isEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (x >= _w - _scrollBarWidth) {
|
|
||||||
_scrollBar->handleMouseDown(x, y, button, clickCount);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// First check whether the selection changed
|
// First check whether the selection changed
|
||||||
int newSelectedItem;
|
int newSelectedItem;
|
||||||
newSelectedItem = findItem(x, y);
|
newSelectedItem = findItem(x, y);
|
||||||
|
|
|
@ -73,6 +73,8 @@ public:
|
||||||
ListWidget(GuiObject *boss, String name);
|
ListWidget(GuiObject *boss, String name);
|
||||||
virtual ~ListWidget();
|
virtual ~ListWidget();
|
||||||
|
|
||||||
|
virtual Widget *findWidget(int x, int y);
|
||||||
|
|
||||||
void setList(const StringList& list);
|
void setList(const StringList& list);
|
||||||
const StringList& getList() const { return _list; }
|
const StringList& getList() const { return _list; }
|
||||||
int getSelected() const { return _selectedItem; }
|
int getSelected() const { return _selectedItem; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue