mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 09:21:09 +02:00
menue.cpp: add reverse search to find selectable item
Origin commit data
------------------
Commit: cad8efec3c
Author: GetAway <get-away@t-online.de>
Date: 2017-11-04 (Sat, 04 Nov 2017)
This commit is contained in:
@@ -1261,9 +1261,9 @@ void CMenuWidget::calcSize()
|
||||
|
||||
void CMenuWidget::initSelectable()
|
||||
{
|
||||
int pos = 0;
|
||||
int pos = 0, npos = 0;
|
||||
if (selected > 0 && selected < (int)items.size())
|
||||
pos = selected;
|
||||
npos = pos = selected;
|
||||
else
|
||||
selected = -1;
|
||||
|
||||
@@ -1272,7 +1272,15 @@ void CMenuWidget::initSelectable()
|
||||
break;
|
||||
pos++;
|
||||
}
|
||||
selected = pos;
|
||||
if (pos == (int)items.size()) {
|
||||
pos = npos;
|
||||
while (pos > 1) {
|
||||
if (items[pos]->isSelectable())
|
||||
break;
|
||||
pos--;
|
||||
}
|
||||
}
|
||||
selected = (pos == 0) ? -1 : pos;
|
||||
}
|
||||
|
||||
void CMenuWidget::paint()
|
||||
|
Reference in New Issue
Block a user