From f3622e678ef5f45047949ea82ba2bd7a7fc26cd2 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Wed, 18 Jan 2023 14:04:03 +0100 Subject: [PATCH] Menu items now have a second icon for when selected --- CMakeLists.txt | 6 +++ converticons.sh | 10 ++++ iconconvert/main.cpp | 46 +++++++++++++++---- src/changevaluedisplay_bool.cpp | 3 +- src/changevaluedisplay_daylightsavingmode.cpp | 3 +- src/changevaluedisplay_sntp_sync_mode_t.cpp | 3 +- src/changevaluedisplay_wifi_auth_mode_t.cpp | 3 +- src/changevaluedisplay_wifi_mode_t.cpp | 3 +- src/checkboxicon.h | 6 ++- src/iconinterface.h | 16 +------ src/icons/back_grey.cpp | 45 ++++++++++++++++++ src/icons/back_grey.h | 10 ++++ src/icons/checked_grey.cpp | 45 ++++++++++++++++++ src/icons/checked_grey.h | 10 ++++ src/icons/unchecked_grey.cpp | 45 ++++++++++++++++++ src/icons/unchecked_grey.h | 10 ++++ src/menudisplay.cpp | 3 +- src/menuitem.h | 34 ++++++++++++-- 18 files changed, 265 insertions(+), 36 deletions(-) create mode 100644 src/icons/back_grey.cpp create mode 100644 src/icons/back_grey.h create mode 100644 src/icons/checked_grey.cpp create mode 100644 src/icons/checked_grey.h create mode 100644 src/icons/unchecked_grey.cpp create mode 100644 src/icons/unchecked_grey.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f02886..d462d06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,9 @@ set(headers src/icons/back.h src/icons/checked.h src/icons/unchecked.h + src/icons/back_grey.h + src/icons/checked_grey.h + src/icons/unchecked_grey.h src/marginmenuitem.h src/menudisplay.h src/menuitem.h @@ -78,6 +81,9 @@ set(sources src/icons/back.cpp src/icons/checked.cpp src/icons/unchecked.cpp + src/icons/back_grey.cpp + src/icons/checked_grey.cpp + src/icons/unchecked_grey.cpp src/widgets/label.cpp src/widgets/progressbar.cpp src/widgets/reverseprogressbar.cpp diff --git a/converticons.sh b/converticons.sh index 37b9aa6..ac2dbbe 100755 --- a/converticons.sh +++ b/converticons.sh @@ -3,4 +3,14 @@ for i in icons/* do build-iconconvert-Desktop_Qt_6_4_1-Debug/iconconvert $i src/icons/ icon_templ.h.tmpl icon_templ.cpp.tmpl + + ICON_NAME="$(basename "$i" .png)" + case "$ICON_NAME" in + icons_to_exclude) + echo no grey version needed + ;; + *) + build-iconconvert-Desktop_Qt_6_4_1-Debug/iconconvert "$i" src/icons/ icon_templ.h.tmpl icon_templ.cpp.tmpl --background-color "#5c5c5c" --name-override "${ICON_NAME}_grey" + ;; + esac done diff --git a/iconconvert/main.cpp b/iconconvert/main.cpp index 09ed362..90a4281 100644 --- a/iconconvert/main.cpp +++ b/iconconvert/main.cpp @@ -7,19 +7,25 @@ #include namespace { +QColor backgroundColor; + constexpr uint16_t color565(uint8_t red, uint8_t green, uint8_t blue) noexcept { return __builtin_bswap16(((red & 0xF8) << 8) | ((green & 0xFC) << 3) | (blue >> 3)); } uint16_t color565(const QColor &color) noexcept { - return color565(color.red() * color.alphaF(), color.green() * color.alphaF(), color.blue() * color.alphaF()); + return color565( + color.red() * color.alphaF() + ((1-color.alphaF())*backgroundColor.red()), + color.green() * color.alphaF() + ((1-color.alphaF())*backgroundColor.green()), + color.blue() * color.alphaF() + ((1-color.alphaF())*backgroundColor.blue()) + ); } } // namespace int main(int argc, char *argv[]) { - QCoreApplication app(argc, argv); + QCoreApplication app{argc, argv}; QCoreApplication::setApplicationName("iconconvert"); QCoreApplication::setApplicationVersion("1.0"); @@ -27,13 +33,32 @@ int main(int argc, char *argv[]) parser.setApplicationDescription("Converts icons to .h/.cpp sources"); parser.addHelpOption(); parser.addVersionOption(); - parser.addPositionalArgument("icon", QCoreApplication::translate("main", "Icon file.")); - parser.addPositionalArgument("destination", QCoreApplication::translate("main", "Destination directory.")); + parser.addPositionalArgument("icon-file", QCoreApplication::translate("main", "Icon file.")); + parser.addPositionalArgument("destination-dir", QCoreApplication::translate("main", "Destination directory.")); parser.addPositionalArgument("header-templ", QCoreApplication::translate("main", "Header template")); parser.addPositionalArgument("footer-templ", QCoreApplication::translate("main", "Footer template")); + QCommandLineOption backgroundColorOption{ + {"b", "background-color"}, + QCoreApplication::translate("main", "Background color for transparent icons"), + "name", "#000000" + }; + parser.addOption(backgroundColorOption); + QCommandLineOption nameOverrideOption{ + {"n", "name-override"}, + QCoreApplication::translate("main", "Override name for generated .h .cpp files"), + "name" + }; + parser.addOption(nameOverrideOption); parser.process(app); + backgroundColor = QColor{parser.value(backgroundColorOption)}; + if (!backgroundColor.isValid()) + { + qWarning() << "invalid background color, falling back to #000000"; + backgroundColor = QColor{0, 0, 0}; + } + const QStringList args = parser.positionalArguments(); if (args.size() < 1) { @@ -111,6 +136,9 @@ int main(int argc, char *argv[]) } } + const auto &nameOverrideValue = parser.value(nameOverrideOption); + const auto &basename = nameOverrideValue.isEmpty() ? fileInfo.baseName() : nameOverrideValue; + { QString templ; @@ -126,7 +154,7 @@ int main(int argc, char *argv[]) } { - QFile file{dir.absoluteFilePath(QStringLiteral("%0.h").arg(fileInfo.baseName()))}; + QFile file{dir.absoluteFilePath(QStringLiteral("%0.h").arg(basename))}; if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { qCritical("could not open .h file for writing %s", qPrintable(file.errorString())); @@ -134,7 +162,7 @@ int main(int argc, char *argv[]) } const auto content = templ - .replace("${name}", fileInfo.baseName()) + .replace("${name}", basename) .replace("${width}", QString::number(image.width())) .replace("${height}", QString::number(image.height())) .toUtf8(); @@ -162,7 +190,7 @@ int main(int argc, char *argv[]) } { - QFile file{dir.absoluteFilePath(QStringLiteral("%0.cpp").arg(fileInfo.baseName()))}; + QFile file{dir.absoluteFilePath(QStringLiteral("%0.cpp").arg(basename))}; if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { qCritical("could not open .cpp file for writing %s", qPrintable(file.errorString())); @@ -170,7 +198,7 @@ int main(int argc, char *argv[]) } const auto content = templ - .replace("${name}", fileInfo.baseName()) + .replace("${name}", basename) .replace("${width}", QString::number(image.width())) .replace("${height}", QString::number(image.height())) .replace("${bytes}", bytes) @@ -184,7 +212,7 @@ int main(int argc, char *argv[]) } } - qDebug() << fileInfo.baseName() << image.width() << image.height(); + qDebug() << basename << image.width() << image.height(); return 0; } diff --git a/src/changevaluedisplay_bool.cpp b/src/changevaluedisplay_bool.cpp index 1203510..fd02144 100644 --- a/src/changevaluedisplay_bool.cpp +++ b/src/changevaluedisplay_bool.cpp @@ -4,6 +4,7 @@ #include "actions/setvalueaction.h" #include "actions/backproxyaction.h" #include "icons/back.h" +#include "icons/back_grey.h" namespace espgui { namespace { @@ -16,7 +17,7 @@ ChangeValueDisplay::ChangeValueDisplay() { constructMenuItem, StaticText>>(true, *this, *this, *this); constructMenuItem, StaticText>>(false, *this, *this, *this); - constructMenuItem, StaticMenuItemIcon<&icons::back>>>(*this); + constructMenuItem, StaticMenuItemIcon<&icons::back, &icons::back_grey>>>(*this); } void ChangeValueDisplay::start() diff --git a/src/changevaluedisplay_daylightsavingmode.cpp b/src/changevaluedisplay_daylightsavingmode.cpp index 64c66f5..f72c5b8 100644 --- a/src/changevaluedisplay_daylightsavingmode.cpp +++ b/src/changevaluedisplay_daylightsavingmode.cpp @@ -7,6 +7,7 @@ #include "actions/setvalueaction.h" #include "actions/backproxyaction.h" #include "icons/back.h" +#include "icons/back_grey.h" namespace espgui { namespace { @@ -23,7 +24,7 @@ ChangeValueDisplay::ChangeValueDisplay() constructMenuItem, StaticText>>(espchrono::DayLightSavingMode::None, *this, *this, *this); constructMenuItem, StaticText>>(espchrono::DayLightSavingMode::EuropeanSummerTime, *this, *this, *this); constructMenuItem, StaticText>>(espchrono::DayLightSavingMode::UsDaylightTime, *this, *this, *this); - constructMenuItem, StaticMenuItemIcon<&icons::back>>>(*this); + constructMenuItem, StaticMenuItemIcon<&icons::back, &icons::back_grey>>>(*this); } void ChangeValueDisplay::start() diff --git a/src/changevaluedisplay_sntp_sync_mode_t.cpp b/src/changevaluedisplay_sntp_sync_mode_t.cpp index 9f3d36f..74d8dc0 100644 --- a/src/changevaluedisplay_sntp_sync_mode_t.cpp +++ b/src/changevaluedisplay_sntp_sync_mode_t.cpp @@ -7,6 +7,7 @@ #include "actions/setvalueaction.h" #include "actions/backproxyaction.h" #include "icons/back.h" +#include "icons/back_grey.h" namespace espgui { namespace { @@ -21,7 +22,7 @@ ChangeValueDisplay::ChangeValueDisplay() { constructMenuItem, StaticText>>(SNTP_SYNC_MODE_IMMED, *this, *this, *this); constructMenuItem, StaticText>>(SNTP_SYNC_MODE_SMOOTH, *this, *this, *this); - constructMenuItem, StaticMenuItemIcon<&icons::back>>>(*this); + constructMenuItem, StaticMenuItemIcon<&icons::back, &icons::back_grey>>>(*this); } void ChangeValueDisplay::start() diff --git a/src/changevaluedisplay_wifi_auth_mode_t.cpp b/src/changevaluedisplay_wifi_auth_mode_t.cpp index aafe072..ee48bd8 100644 --- a/src/changevaluedisplay_wifi_auth_mode_t.cpp +++ b/src/changevaluedisplay_wifi_auth_mode_t.cpp @@ -7,6 +7,7 @@ #include "actions/setvalueaction.h" #include "actions/backproxyaction.h" #include "icons/back.h" +#include "icons/back_grey.h" namespace espgui { namespace { @@ -35,7 +36,7 @@ ChangeValueDisplay::ChangeValueDisplay() constructMenuItem, StaticText>>(WIFI_AUTH_WPA3_PSK, *this, *this, *this); constructMenuItem, StaticText>>(WIFI_AUTH_WPA2_WPA3_PSK, *this, *this, *this); constructMenuItem, StaticText>>(WIFI_AUTH_WAPI_PSK, *this, *this, *this); - constructMenuItem, StaticMenuItemIcon<&espgui::icons::back>>>(*this); + constructMenuItem, StaticMenuItemIcon<&icons::back, &icons::back_grey>>>(*this); } void ChangeValueDisplay::start() diff --git a/src/changevaluedisplay_wifi_mode_t.cpp b/src/changevaluedisplay_wifi_mode_t.cpp index acca838..d696a0c 100644 --- a/src/changevaluedisplay_wifi_mode_t.cpp +++ b/src/changevaluedisplay_wifi_mode_t.cpp @@ -7,6 +7,7 @@ #include "actions/setvalueaction.h" #include "actions/backproxyaction.h" #include "icons/back.h" +#include "icons/back_grey.h" namespace espgui { namespace { @@ -25,7 +26,7 @@ ChangeValueDisplay::ChangeValueDisplay() constructMenuItem, StaticText>>(WIFI_MODE_STA, *this, *this, *this); constructMenuItem, StaticText>>(WIFI_MODE_AP, *this, *this, *this); constructMenuItem, StaticText>>(WIFI_MODE_APSTA, *this, *this, *this); - constructMenuItem, StaticMenuItemIcon<&espgui::icons::back>>>(*this); + constructMenuItem, StaticMenuItemIcon<&icons::back, &icons::back_grey>>>(*this); } void ChangeValueDisplay::start() diff --git a/src/checkboxicon.h b/src/checkboxicon.h index 480b4f8..b43107c 100644 --- a/src/checkboxicon.h +++ b/src/checkboxicon.h @@ -4,15 +4,17 @@ #include "menuitem.h" #include "accessorinterface.h" #include "icons/checked.h" +#include "icons/checked_grey.h" #include "icons/unchecked.h" +#include "icons/unchecked_grey.h" namespace espgui { class CheckboxIcon : public virtual MenuItemIconInterface, public virtual AccessorInterface { public: - const MenuItemIcon *icon() const override + const MenuItemIcon *icon(bool selected) const override { - return getValue() ? &icons::checked : &icons::unchecked; + return getValue() ? (selected ? &icons::checked_grey : &icons::checked) : (selected ? &icons::unchecked_grey : &icons::unchecked); } }; } // namespace espgui diff --git a/src/iconinterface.h b/src/iconinterface.h index 2adf241..30edb06 100644 --- a/src/iconinterface.h +++ b/src/iconinterface.h @@ -12,25 +12,11 @@ public: virtual const Icon *icon() const { return nullptr; } }; -template -class SelectedIconInterface -{ -public: - virtual const Icon *selectedIcon() const { return nullptr; } -}; - template *T> class StaticIcon : public virtual IconInterface { public: - virtual const Icon *icon() const { return T; } -}; - -template *T> -class StaticSelectedIcon : public virtual SelectedIconInterface -{ -public: - virtual const Icon *selectedIcon() const { return T; } + virtual const Icon *icon() const override { return T; } }; } // namespace espgui diff --git a/src/icons/back_grey.cpp b/src/icons/back_grey.cpp new file mode 100644 index 0000000..e1b1d42 --- /dev/null +++ b/src/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 0xeb5a, 0xeb5a, 0xcb5a, 0xad3a, 0xf764, 0x3c7e, 0x1c76, + 0x1c76, 0x1c6e, 0xbb65, 0x9a5d, 0x7a5d, 0x3955, 0xf854, 0xb74c, 0x764c, 0xd43b, 0x103b, 0xac42, 0xcb52, 0xeb5a, 0xeb5a, 0xeb5a, + 0xeb5a, 0xeb5a, 0xaa52, 0xee42, 0xf764, 0x3c7e, 0x5c7e, 0x5c76, 0x5c76, 0x3c6e, 0x1c66, 0xfc65, 0xbb5d, 0x9a55, 0x5a4d, 0xf944, + 0xd844, 0x973c, 0x5644, 0xb43b, 0xef3a, 0xab4a, 0xeb5a, 0xeb5a, 0xeb5a, 0xcb5a, 0xee42, 0xf764, 0x3c86, 0x3c7e, 0x3c6e, 0x3c66, + 0x3d66, 0x3d5e, 0x1c5e, 0xfc5d, 0xdb55, 0x9b55, 0x5a4d, 0x1945, 0xb83c, 0x7734, 0x3634, 0xf533, 0xd43b, 0xef3a, 0xcb52, 0xeb5a, + 0xcb5a, 0xce3a, 0xb754, 0x9a5d, 0x7a4d, 0x7b3d, 0x7b35, 0x9c2d, 0xdc2d, 0xdc2d, 0xbc2d, 0x7b2d, 0x5a35, 0x5a3d, 0x3a45, 0x1945, + 0xd83c, 0x7734, 0x3634, 0xd52b, 0xb52b, 0x9433, 0xad42, 0xcb5a, 0xcb5a, 0xad3a, 0x3634, 0xd924, 0xd914, 0x1a1d, 0x5b1d, 0x9c1d, + 0xdd25, 0xdd25, 0x9c1d, 0x5b1d, 0x1a1d, 0xd91c, 0xb81c, 0xb82c, 0xb83c, 0x7734, 0x362c, 0xd52b, 0x9423, 0xd533, 0xef32, 0xcb5a, + 0xeb5a, 0xcb5a, 0xce3a, 0x562c, 0xf924, 0x1a1d, 0x5b1d, 0x7c1d, 0xbc1d, 0xbc25, 0x9c1d, 0x5b1d, 0x1a1d, 0xd91c, 0x981c, 0x5714, + 0x371c, 0x362c, 0x162c, 0xd523, 0x9423, 0xb523, 0x322b, 0xab52, 0xeb5a, 0xeb5a, 0xaa52, 0xee3a, 0x7734, 0x1a25, 0x3a1d, 0x5b1d, + 0x7b1d, 0x7b1d, 0x5b1d, 0x3a1d, 0xfa1c, 0xb91c, 0x781c, 0x5714, 0x1614, 0xd513, 0xd523, 0xb523, 0x941b, 0x941b, 0x522b, 0xab4a, + 0xeb5a, 0xeb5a, 0xeb5a, 0xaa52, 0xee3a, 0x7734, 0x1a25, 0x1a1d, 0x3a1d, 0x5b2d, 0x3a2d, 0x1a2d, 0xf924, 0xd924, 0x7814, 0x3714, + 0xf613, 0xb513, 0x9413, 0x741b, 0x741b, 0x941b, 0x322b, 0xab4a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xaa52, 0xce3a, 0x9734, 0x1a1d, + 0xfa1c, 0x973c, 0x302b, 0x5133, 0x7233, 0xb42b, 0x1534, 0x572c, 0xf613, 0x9513, 0x7413, 0x5313, 0x5413, 0x9423, 0x1133, 0xcb52, + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xcb5a, 0x8d32, 0x9734, 0xd924, 0xf433, 0x694a, 0xeb5a, 0xcb5a, 0x8b52, 0x8b42, 0xef32, + 0xd533, 0x9513, 0x5413, 0x3313, 0x330b, 0x9423, 0xef3a, 0xcb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xcb5a, 0x8d32, + 0x7634, 0xf43b, 0x6a4a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xcb5a, 0xae32, 0xb42b, 0x330b, 0x3313, 0x340b, 0x732b, 0xcd42, 0xcb5a, + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xcb5a, 0xae3a, 0x5133, 0x6b4a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, + 0x8b4a, 0x532b, 0x5413, 0x330b, 0x541b, 0x3133, 0xcb52, 0xeb5a, 0xeb5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 0xeb5a, 0xeb5a, 0x4c32, + 0xae32, 0xec52, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xab52, 0xcb52, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, + +}}; +} // namespace icons +} // namespace espgui diff --git a/src/icons/back_grey.h b/src/icons/back_grey.h new file mode 100644 index 0000000..2e6e10f --- /dev/null +++ b/src/icons/back_grey.h @@ -0,0 +1,10 @@ +#pragma once + +// local +#include "icon.h" + +namespace espgui { +namespace icons { +extern const Icon<24, 24> back_grey; +} // namespace icons +} // namespace espgui diff --git a/src/icons/checked_grey.cpp b/src/icons/checked_grey.cpp new file mode 100644 index 0000000..bb50720 --- /dev/null +++ b/src/icons/checked_grey.cpp @@ -0,0 +1,45 @@ +#include "checked_grey.h" + +namespace espgui { +namespace icons { +const Icon<24, 24> checked_grey {{ + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb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a5d, 0x550b, 0xec52, 0xeb5a, + 0xeb5a, 0x550b, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0xbb7d, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xbb7d, 0x550b, 0xec52, 0x0f3b, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, + 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x3a65, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x9944, 0x312b, + 0x5413, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0xddbe, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xddbe, 0x5413, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, + 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xbfef, 0x7603, + 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0xbfef, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x7603, 0x5413, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, + 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0xddbe, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xddbe, 0x5413, + 0x312b, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x9944, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x3a5d, 0x0f3b, 0xec52, 0x550b, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, + 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0xbb85, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xbb85, 0x550b, 0xeb5a, + 0xeb5a, 0xec52, 0x550b, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x3a65, + 0xddbe, 0xffff, 0xbfef, 0xddbe, 0x9944, 0x550b, 0xec52, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0x0f3b, 0x5413, 0x7603, 0x7603, 0x7603, + 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x7603, 0x5413, 0x312b, 0xec52, 0xeb5a, 0xeb5a, + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, + +}}; +} // namespace icons +} // namespace espgui diff --git a/src/icons/checked_grey.h b/src/icons/checked_grey.h new file mode 100644 index 0000000..30c950d --- /dev/null +++ b/src/icons/checked_grey.h @@ -0,0 +1,10 @@ +#pragma once + +// local +#include "icon.h" + +namespace espgui { +namespace icons { +extern const Icon<24, 24> checked_grey; +} // namespace icons +} // namespace espgui diff --git a/src/icons/unchecked_grey.cpp b/src/icons/unchecked_grey.cpp new file mode 100644 index 0000000..0f9b68c --- /dev/null +++ b/src/icons/unchecked_grey.cpp @@ -0,0 +1,45 @@ +#include "unchecked_grey.h" + +namespace espgui { +namespace icons { +const Icon<24, 24> unchecked_grey {{ + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0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xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, + 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, 0xeb5a, + +}}; +} // namespace icons +} // namespace espgui diff --git a/src/icons/unchecked_grey.h b/src/icons/unchecked_grey.h new file mode 100644 index 0000000..6e1588d --- /dev/null +++ b/src/icons/unchecked_grey.h @@ -0,0 +1,10 @@ +#pragma once + +// local +#include "icon.h" + +namespace espgui { +namespace icons { +extern const Icon<24, 24> unchecked_grey; +} // namespace icons +} // namespace espgui diff --git a/src/menudisplay.cpp b/src/menudisplay.cpp index 3bfaf94..8b00af6 100644 --- a/src/menudisplay.cpp +++ b/src/menudisplay.cpp @@ -175,9 +175,8 @@ void MenuDisplay::redraw(TftInterface &tft) labelsIter->redraw(tft, item.text(), item.color(), selected ? TFT_GREY : TFT_BLACK, item.font()); - if (item.icon() != *iconsIter) + if (const auto icon = item.icon(selected); icon != *iconsIter) { - auto icon = item.icon(); if (icon) tft.pushImage(6, labelsIter->y() + 1, *icon); else if (*iconsIter) diff --git a/src/menuitem.h b/src/menuitem.h index 5434e81..e0f0fed 100644 --- a/src/menuitem.h +++ b/src/menuitem.h @@ -13,12 +13,40 @@ namespace espgui { using MenuItemIcon = Icon<24, 24>; -using MenuItemIconInterface = IconInterface<24, 24>; +template +class SelectableIconInterface +{ +public: + virtual const Icon *icon(bool selected) const { return nullptr; } +}; + +template *T, const Icon *Tselected> +class StaticSelectableIcon : public virtual SelectableIconInterface +{ +public: + virtual const Icon *icon(bool selected) const override { return selected ? Tselected : T; } +}; + +template +class SelectedIconInterface +{ +public: + virtual const Icon *selectedIcon() const { return nullptr; } +}; + +template *T> +class StaticSelectedIcon : public virtual SelectedIconInterface +{ +public: + virtual const Icon *selectedIcon() const override { return T; } +}; + +using MenuItemIconInterface = SelectableIconInterface<24, 24>; using MenuItemSelectedIconInterface = SelectedIconInterface<24, 24>; -template -using StaticMenuItemIcon = StaticIcon<24, 24, T>; +template +using StaticMenuItemIcon = StaticSelectableIcon<24, 24, T, Tselected>; template using StaticMenuItemSelectedIcon = StaticSelectedIcon<24, 24, T>;