diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/FbTk/Menu.cc | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index 6b2db3a..ff040ba 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc | |||
@@ -320,15 +320,24 @@ void Menu::lower() { | |||
320 | 320 | ||
321 | void Menu::cycleItems(bool reverse) { | 321 | void Menu::cycleItems(bool reverse) { |
322 | 322 | ||
323 | if (m_items.empty()) | ||
324 | return; | ||
325 | |||
326 | int offset = reverse ? -1 : 1; | ||
327 | int l = m_items.size(); | 323 | int l = m_items.size(); |
328 | int i = m_active_index; | 324 | int i; |
325 | int offset = reverse ? -1 : 1; | ||
329 | size_t ignore; | 326 | size_t ignore; |
330 | 327 | ||
331 | for (i += offset; i != m_active_index; i += offset ) { | 328 | // check if there is _any_ selectable item |
329 | for (i = 0; i < l; i++) { | ||
330 | if (isItemSelectable(i)) { | ||
331 | break; | ||
332 | } | ||
333 | } | ||
334 | |||
335 | // no selectable item | ||
336 | if (i >= l) { | ||
337 | return; | ||
338 | } | ||
339 | |||
340 | for (i = m_active_index + offset; i != m_active_index; i += offset ) { | ||
332 | if (i < 0) { | 341 | if (i < 0) { |
333 | i = l - 1; | 342 | i = l - 1; |
334 | } else if (i >= l) { | 343 | } else if (i >= l) { |