| 30 | #include "textpool.hpp" |
| 31 | |
| 32 | MessageOverlay::MessageOverlay(Screen& screen, const std::string& mtext, const Style& style) : Overlay(screen), mStyle(style), mText(mtext) |
| 33 | { |
| 34 | // Grow the card to the message before anything is placed: the button row |
| 35 | // rides on the card's bottom edge, so its y comes out of the layout too. |
| 36 | mLayout = ModalChrome::fitText(mText, SIZE, !mStyle.header.empty()); |
| 37 | mButton = std::make_unique<Clickable>( |
| 38 | ModalChrome::BTN_WIDE_X, mLayout.btnY, ModalChrome::BTN_WIDE_W, ModalChrome::BTN_H, style.buttonBg, style.buttonFg, " OK", true); |
| 39 | mButton->selected(true); |
| 40 | mPosx = ceilf((320 - StringUtils::textWidth(mText, SIZE)) / 2); |
| 41 | } |
| 42 | |
| 43 | void MessageOverlay::drawTop(void) const |
| 44 | { |