Configure background color via kconfig
This commit is contained in:
@ -4,4 +4,8 @@ config ESPGUI_MENUDISPLAY_ROWS
|
|||||||
int "Number of rows for MenuDisplays"
|
int "Number of rows for MenuDisplays"
|
||||||
default 10
|
default 10
|
||||||
|
|
||||||
|
config ESPGUI_MENUITEM_BACKGROUND_COLOR
|
||||||
|
hex "MenuItem background color"
|
||||||
|
default 0x5AEB
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
@ -156,7 +156,7 @@ void MenuDisplay::redraw(TftInterface &tft)
|
|||||||
|
|
||||||
if (relativeIndex != m_highlightedIndex)
|
if (relativeIndex != m_highlightedIndex)
|
||||||
{
|
{
|
||||||
drawItemRect(*labelsIter, TFT_GREY);
|
drawItemRect(*labelsIter, CONFIG_ESPGUI_MENUITEM_BACKGROUND_COLOR);
|
||||||
*iconsIter = nullptr;
|
*iconsIter = nullptr;
|
||||||
labelsIter->start(tft);
|
labelsIter->start(tft);
|
||||||
|
|
||||||
@ -173,20 +173,20 @@ void MenuDisplay::redraw(TftInterface &tft)
|
|||||||
labelsIter->start(tft);
|
labelsIter->start(tft);
|
||||||
}
|
}
|
||||||
|
|
||||||
labelsIter->redraw(tft, item.text(), item.color(), selected ? TFT_GREY : TFT_BLACK, item.font());
|
labelsIter->redraw(tft, item.text(), item.color(), selected ? CONFIG_ESPGUI_MENUITEM_BACKGROUND_COLOR : TFT_BLACK, item.font());
|
||||||
|
|
||||||
if (const auto icon = item.icon(selected); icon != *iconsIter)
|
if (const auto icon = item.icon(selected); icon != *iconsIter)
|
||||||
{
|
{
|
||||||
if (icon)
|
if (icon)
|
||||||
tft.pushImage(6, labelsIter->y() + 1, *icon);
|
tft.pushImage(6, labelsIter->y() + 1, *icon);
|
||||||
else if (*iconsIter)
|
else if (*iconsIter)
|
||||||
tft.fillRect(6, labelsIter->y() + 1, 24, 24, selected ? TFT_GREY : TFT_BLACK);
|
tft.fillRect(6, labelsIter->y() + 1, 24, 24, selected ? CONFIG_ESPGUI_MENUITEM_BACKGROUND_COLOR : TFT_BLACK);
|
||||||
*iconsIter = icon;
|
*iconsIter = icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (selected && (relativeIndex != m_highlightedIndex))
|
// if (selected && (relativeIndex != m_highlightedIndex))
|
||||||
// {
|
// {
|
||||||
// drawItemRect(*labelsIter, TFT_GREY);
|
// drawItemRect(*labelsIter, CONFIG_ESPGUI_MENUITEM_BACKGROUND_COLOR);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
labelsIter++;
|
labelsIter++;
|
||||||
|
Reference in New Issue
Block a user