Deluge Firmware 1.3.0
Build date: 2025.08.14
Loading...
Searching...
No Matches
horizontal_menu_group.h
1/*
2 * Copyright (c) 2025 Leonid Burygin
3 *
4 * This file is part of The Synthstrom Audible Deluge Firmware.
5 *
6 * The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software Foundation,
8 * either version 3 of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along with this program.
15 * If not, see <https://www.gnu.org/licenses/>.
16 */
17#pragma once
18
19#include "deluge/gui/menu_item/submenu.h"
20#include <gui/menu_item/horizontal_menu.h>
21#include <string_view>
22
23namespace deluge::gui::menu_item {
24
25// A class to group multiple Horizontal menus into a single long Horizontal menu with paging
26class HorizontalMenuGroup final : public HorizontalMenu {
27public:
28 HorizontalMenuGroup(std::initializer_list<HorizontalMenu*> menus)
29 : HorizontalMenu(l10n::String::STRING_FOR_NONE, {}), menus_{menus} {}
30
31 [[nodiscard]] std::string_view getTitle() const override;
32 bool focusChild(const MenuItem* child) override;
33 MenuPermission checkPermissionToBeginSession(ModControllableAudio* modControllable, int32_t whichThing,
34 MultiRange** currentRange) override;
35 void beginSession(MenuItem* navigatedBackwardFrom) override;
36 void selectEncoderAction(int32_t offset) override;
37 bool hasItem(const MenuItem* item) override;
38
39protected:
40 void renderMenuItems(std::span<MenuItem*> items, const MenuItem* currentItem) override;
41 void selectMenuItem(int32_t pageNumber, int32_t itemPos) override;
42 void handleInstrumentButtonPress(std::span<MenuItem*> visiblePageItems, const MenuItem* previous,
43 int32_t pressedButtonPosition) override;
44 Paging& preparePaging(std::span<MenuItem*> items, const MenuItem*) override;
45 void switchVisiblePage(int32_t direction) override;
46
47private:
48 std::vector<HorizontalMenu*> menus_{};
49 HorizontalMenu* current_menu_{nullptr};
50 MenuItem* navigated_backward_from{nullptr};
51};
52} // namespace deluge::gui::menu_item
Definition mod_controllable_audio.h:47
std::string_view getTitle() const override
Get the title to be used when rendering on OLED, both as a deluge::gui::menu_item::Submenu and when d...
Definition horizontal_menu_group.cpp:27
void selectEncoderAction(int32_t offset) override
Handle select encoder movement.
Definition horizontal_menu_group.cpp:194
void beginSession(MenuItem *navigatedBackwardFrom) override
Begin an editing session with this menu item.
Definition horizontal_menu_group.cpp:39
Definition multi_range.h:24
Definition horizontal_menu.h:34