diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-03-07 21:10:47 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-03-07 21:10:47 +0100 |
commit | d556005df149558e2614b7019ca4b180f9c44fb8 (patch) | |
tree | aa72fe8fd186480c6c0992cc650ccc130979bf81 /plugingui/listbox.cc | |
parent | d611ee9834561622faeeddb604062d92b30a4512 (diff) |
Add scrollEvent and use it for scrolling on listbox.
Diffstat (limited to 'plugingui/listbox.cc')
-rw-r--r-- | plugingui/listbox.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/plugingui/listbox.cc b/plugingui/listbox.cc index dfb5f07..f917368 100644 --- a/plugingui/listbox.cc +++ b/plugingui/listbox.cc @@ -125,6 +125,15 @@ void GUI::ListBox::repaintEvent(GUI::RepaintEvent *e) width() - 1, height() - 1); } +void GUI::ListBox::scrollEvent(ScrollEvent *e) +{ + scroll_offset += e->delta; + if(scroll_offset < 0) scroll_offset = 0; + if(scroll_offset > (items.size() - 1)) + scroll_offset = (items.size() - 1); + repaintEvent(NULL); +} + void GUI::ListBox::buttonEvent(ButtonEvent *e) { //printf("click %d %d [dc: %d]\n", e->x, e->y, e->doubleclick); |