Navigation buttons (#2458)

* regenerate bitmap data
* pagination in submenu
* using little font so we are not eating menu buttons
This commit is contained in:
gullradriel
2024-12-31 03:01:03 +01:00
committed by GitHub
parent 01034af077
commit 4c18b80e42
4 changed files with 208 additions and 51 deletions

View File

@@ -68,11 +68,18 @@ class BtnGridView : public View {
NewButton* item_view(size_t index) const;
bool show_arrows{true}; // flag used to hide arrows in main menu
void show_arrows_enabled(bool enabled);
bool set_highlighted(int32_t new_value);
uint32_t highlighted_index();
void set_parent_rect(const Rect new_parent_rect) override;
void set_arrow_enabled(bool enabled);
bool arrow_up_enabled{false};
bool arrow_down_enabled{false};
void set_arrow_up_enabled(bool enabled);
void set_arrow_down_enabled(bool enabled);
void show_hide_arrows();
void on_focus() override;
void on_blur() override;
void on_show() override;
@@ -88,24 +95,21 @@ class BtnGridView : public View {
private:
int rows_{3};
void on_tick_second();
bool keep_highlight{false};
SignalToken signal_token_tick_second{};
std::vector<GridItem> menu_items{};
std::vector<std::unique_ptr<NewButton>> menu_item_views{};
Image arrow_more{
{228, 320 - 8, 8, 8},
&bitmap_more,
Theme::getInstance()->bg_darkest->foreground,
Theme::getInstance()->bg_darkest->background};
Button button_pgup{
{0, 324, 120, 16},
" "};
Button button_pgdown{
{121, 324, 119, 16},
" "};
int button_w = 240 / rows_;
static constexpr int button_h = 48;
bool blink = false;
bool more = false;
size_t displayed_max{0};
size_t highlighted_item{0};
size_t offset{0};