From ff5e15cce72aa255f117328788fca9a5fe04f75e Mon Sep 17 00:00:00 2001 From: eshifri Date: Tue, 10 Aug 2021 17:04:12 -0700 Subject: [PATCH] Split number of topbar widgets for vertical and horizontal LCD. Add Exit button to topbar widgets setup. --- radio/src/gui/colorlcd/topbar.cpp | 9 +++++++++ radio/src/gui/colorlcd/widgets_container.h | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/radio/src/gui/colorlcd/topbar.cpp b/radio/src/gui/colorlcd/topbar.cpp index fe18dd59f..290f23d41 100644 --- a/radio/src/gui/colorlcd/topbar.cpp +++ b/radio/src/gui/colorlcd/topbar.cpp @@ -57,6 +57,15 @@ SetupTopBarWidgetsPage::SetupTopBarWidgetsPage(ScreenMenu* menu): auto widget = new SetupWidgetsPageSlot(this, rect, topbar, i); if (i == 0) widget->setFocus(); } +#if defined(HARDWARE_TOUCH) + new Button( + this, {0, 0, MENU_HEADER_BUTTON_WIDTH, MENU_HEADER_BUTTON_WIDTH}, + [this]() -> uint8_t { + this->deleteLater(); + return 1; + }, + NO_FOCUS | FORM_NO_BORDER); +#endif } void SetupTopBarWidgetsPage::deleteLater(bool detach, bool trash) diff --git a/radio/src/gui/colorlcd/widgets_container.h b/radio/src/gui/colorlcd/widgets_container.h index 754bbec11..85e04a4dc 100644 --- a/radio/src/gui/colorlcd/widgets_container.h +++ b/radio/src/gui/colorlcd/widgets_container.h @@ -29,7 +29,11 @@ #define WIDGET_NAME_LEN 10 #define MAX_WIDGET_OPTIONS 5 // Name? +#if LCD_W > LCD_H #define MAX_TOPBAR_ZONES 4 +#else +#define MAX_TOPBAR_ZONES 2 +#endif #define MAX_TOPBAR_OPTIONS 1 // just because of VC++ which doesn't like 0-size arrays :( // Common 'ZoneOptionValue's among all layouts