Deluge Firmware
1.3.0
Build date: 2026.08.23
Toggle main menu visibility
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
23
namespace
deluge::gui::menu_item {
24
25
// A class to group multiple Horizontal menus into a single long Horizontal menu with paging
26
class
HorizontalMenuGroup final :
public
HorizontalMenu {
27
public
:
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
void
beginSession
(MenuItem* navigatedBackwardFrom)
override
;
34
void
endSession
()
override
;
35
bool
hasItem(
const
MenuItem* item)
override
;
36
37
protected
:
38
void
renderMenuItems(std::span<MenuItem*> items,
const
MenuItem* currentItem)
override
;
39
void
selectMenuItem(int32_t pageNumber, int32_t itemPos)
override
;
40
void
handleInstrumentButtonPress(std::span<MenuItem*> visiblePageItems,
const
MenuItem* previous,
41
int32_t pressedButtonPosition)
override
;
42
Paging
& preparePaging(std::span<MenuItem*> items,
const
MenuItem*)
override
;
43
void
switchVisiblePage(int32_t direction)
override
;
44
45
private
:
46
std::vector<HorizontalMenu*> menus_{};
47
HorizontalMenu* current_menu_{
nullptr
};
48
MenuItem* navigated_backward_from{
nullptr
};
49
};
50
}
// namespace deluge::gui::menu_item
deluge::gui::menu_item::HorizontalMenuGroup::getTitle
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
deluge::gui::menu_item::HorizontalMenuGroup::endSession
void endSession() override
Definition
horizontal_menu_group.cpp:44
deluge::gui::menu_item::HorizontalMenuGroup::beginSession
void beginSession(MenuItem *navigatedBackwardFrom) override
Begin an editing session with this menu item.
Definition
horizontal_menu_group.cpp:31
deluge::gui::menu_item::HorizontalMenu::Paging
Definition
horizontal_menu.h:34