menue.cpp: add reverse search to find selectable item

Origin commit data
------------------
Branch: ni/coolstream
Commit: 002ef3a1c9
Author: GetAway <get-away@t-online.de>
Date: 2017-11-04 (Sat, 04 Nov 2017)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
GetAway
2017-11-04 21:43:17 +01:00
committed by Thilo Graf
parent 8666cc198d
commit 2724f0ad67

View File

@@ -1229,9 +1229,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;
@@ -1240,7 +1240,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()