From b003636958377ecad3ee5df4ca2de8717c4530b9 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Wed, 19 Aug 2015 18:55:24 -0300 Subject: Support for NCurses 6.0 and mouse wheel --- Panel.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'Panel.c') diff --git a/Panel.c b/Panel.c index 08d04022..f421a0d5 100644 --- a/Panel.c +++ b/Panel.c @@ -412,6 +412,21 @@ bool Panel_onKey(Panel* this, int key) { this->scrollV += (this->h - 1); this->needsRedraw = true; break; + case KEY_WHEELUP: + this->selected -= CRT_scrollWheelVAmount; + this->scrollV -= CRT_scrollWheelVAmount; + this->needsRedraw = true; + break; + case KEY_WHEELDOWN: + { + this->selected += CRT_scrollWheelVAmount; + this->scrollV += CRT_scrollWheelVAmount; + if (this->scrollV > Vector_size(this->items) - this->h) { + this->scrollV = Vector_size(this->items) - this->h; + } + this->needsRedraw = true; + break; + } case KEY_HOME: this->selected = 0; break; -- cgit v1.2.3