Support for NCurses 6.0 and mouse wheel

This commit is contained in:
Hisham Muhammad
2015-08-19 18:55:24 -03:00
parent 3e93f9b852
commit b003636958
5 changed files with 61 additions and 20 deletions

15
Panel.c
View File

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