163 auto* gfx =
static_cast<Gdey029T94*
>(
display->getNativeHandle());
166 const uint16_t screenWidth =
display->getWidth();
167 const uint16_t screenHeight =
display->getHeight();
171 uint16_t maxLabelWidth = 0;
174 for (uint8_t i = 0; i < itemCount_; i++) {
175 if (items_[i].label) {
177 gfx->getTextBounds(items_[i].label, 0, 0, &x1, &y1, &w, &h);
178 if (w > maxLabelWidth) maxLabelWidth = w;
185 gfx->getTextBounds(title_, 0, 0, &x1, &y1, &w, &h);
186 if (w > maxLabelWidth) maxLabelWidth = w;
189 uint16_t boxWidth = maxLabelWidth +
BOX_PADDING * 2 + 10;
197 int boxX = (screenWidth - boxWidth) / 2;
198 int boxY = (screenHeight - boxHeight) / 2;
204 gfx->setTextColor(EPD_WHITE);
205 gfx->fillRect(boxX + 2, boxY + 2, boxWidth - 4,
TITLE_HEIGHT, EPD_BLACK);
213 for (uint8_t i = 0; i < visibleCount; i++) {
214 uint8_t itemIndex = scrollPos_ + i;
215 if (itemIndex >= itemCount_)
break;
223 if (itemIndex == selection_) {
225 gfx->setTextColor(EPD_WHITE);
227 gfx->setTextColor(EPD_BLACK);
244 if (scrollPos_ > 0) {
246 indicatorX, indicatorY + 6,
247 indicatorX - 3, indicatorY + 2,
248 indicatorX + 3, indicatorY + 2,
258 indicatorX - 3, arrowY + 4,
259 indicatorX + 3, arrowY + 4,