Added example buttons

This commit is contained in:
2021-12-02 11:16:07 +01:00
parent 704109f0d0
commit c2d8042182

View File

@ -33,17 +33,20 @@ void AlertDisplay::initOverlay()
constexpr auto topMargin = 50;
constexpr auto bottomMargin = topMargin;
const auto width = espgui::tft.width() - leftMargin - rightMargin;
const auto height = espgui::tft.height() - topMargin - bottomMargin;
const auto right = espgui::tft.width() - rightMargin;
const auto bottom = espgui::tft.height() - bottomMargin;
//espgui::tft.drawRect(leftMargin, topMargin, espgui::tft.width() - leftMargin - rightMargin, espgui::tft.height() - topMargin - bottomMargin, TFT_WHITE);
//espgui::tft.fillRect(leftMargin + 1, topMargin + 1, espgui::tft.width() - leftMargin - rightMargin - 2, espgui::tft.height() - topMargin - bottomMargin - 2, TFT_BLACK);
espgui::tft.drawSunkenRect(leftMargin, topMargin,
espgui::tft.width() - leftMargin - rightMargin,
espgui::tft.height() - topMargin - bottomMargin,
espgui::tft.drawSunkenRect(leftMargin, topMargin, width, height,
espgui::tft.color565(240, 240, 240),
espgui::tft.color565(100, 100, 100),
espgui::tft.color565(40, 40, 40));
espgui::tft.color565(30, 30, 30));
espgui::tft.setTextColor(TFT_WHITE, espgui::tft.color565(40, 40, 40));
espgui::tft.setTextColor(TFT_WHITE, espgui::tft.color565(30, 30, 30));
int x = leftMargin + 5;
int y = topMargin + 5;
@ -60,7 +63,30 @@ void AlertDisplay::initOverlay()
const auto addedWidth = espgui::tft.drawChar(espgui::tft.decodeUTF8(c), x, y, 4);
x += addedWidth;
}
if (y >= espgui::tft.height() - bottomMargin)
break;
}
espgui::tft.setTextColor(TFT_BLACK, espgui::tft.color565(170, 170, 170));
espgui::tft.drawSunkenRect(leftMargin + 15, bottom - 40,
(width - 15 - 10 - 15) / 2,
30,
espgui::tft.color565(240, 240, 240),
espgui::tft.color565(100, 100, 100),
espgui::tft.color565(170, 170, 170));
espgui::tft.drawString("Yes", leftMargin + 16, bottom - 39);
espgui::tft.drawSunkenRect(leftMargin + 15 + ((width - 15 - 30 - 15) / 2) + 15, bottom - 40,
(width - 15 - 10 - 15) / 2,
30,
espgui::tft.color565(240, 240, 240),
espgui::tft.color565(100, 100, 100),
espgui::tft.color565(170, 170, 170));
espgui::tft.drawString("No", leftMargin + 15 + ((width - 15 - 30 - 15) / 2) + 15 + 1, bottom - 39);
}
void AlertDisplay::closeOverlay()