| 616 | } |
| 617 | |
| 618 | void Menu::EncoderActionScrollItemHelper(int action) noexcept |
| 619 | { |
| 620 | // Based mainly on file listing requiring we handle list of unknown length |
| 621 | // before moving on to the next selectable item at the Menu level, we let the |
| 622 | // currently selected MenuItem try to handle the scroll action itself. It will |
| 623 | // return the remainder of the scrolling that it was unable to accommodate. |
| 624 | if (highlightedItem != nullptr && highlightedItem->IsVisible()) |
| 625 | { |
| 626 | // Let the current menu item attempt to handle scroll wheel first |
| 627 | action = highlightedItem->Advance(action); |
| 628 | } |
| 629 | |
| 630 | if (action != 0) |
| 631 | { |
| 632 | // Otherwise we move through the remaining selectable menu items |
| 633 | AdvanceHighlightedItem(action); |
| 634 | |
| 635 | if (highlightedItem != nullptr) |
| 636 | { |
| 637 | // Let the newly selected MenuItem handle any selection setup |
| 638 | highlightedItem->Enter(action > 0); |
| 639 | |
| 640 | PixelNumber tLastOffset = rowOffset; |
| 641 | rowOffset = highlightedItem->GetVisibilityRowOffset(tLastOffset, lcd.GetFontHeight(highlightedItem->GetFontNumber())); |
| 642 | |
| 643 | if (rowOffset != tLastOffset) |
| 644 | { |
| 645 | // We have scrolled the whole menu, so redraw it |
| 646 | lcd.ClearAll(); |
| 647 | for (MenuItem *_ecv_from _ecv_null item = selectableItems; item != nullptr; item = item->GetNext()) |
| 648 | { |
| 649 | item->SetChanged(); |
| 650 | } |
| 651 | for (MenuItem *_ecv_from _ecv_null item = unSelectableItems; item != nullptr; item = item->GetNext()) |
| 652 | { |
| 653 | item->SetChanged(); |
| 654 | } |
| 655 | } |
| 656 | } |
| 657 | } |
| 658 | } |
| 659 | |
| 660 | // Perform the specified encoder action |
| 661 | // If 'action' is zero then the button was pressed, else 'action' is the number of clicks (+ve for clockwise) |
nothing calls this directly
no test coverage detected