| 31 | #include "util.hpp" |
| 32 | |
| 33 | ChoiceOverlay::ChoiceOverlay(Screen& screen, const std::string& text, Button first, Button second, u32 dismissKeys) |
| 34 | : Overlay(screen), mText(text), mButtons{std::move(first), std::move(second)}, mHid(2, 2), mDismissKeys(dismissKeys) |
| 35 | { |
| 36 | // Size the card to the wrapped prompt (same math as MessageOverlay), so a |
| 37 | // long prompt grows the box instead of spilling out of it. |
| 38 | mLayout = ModalChrome::fitText(mText, SIZE, false); |
| 39 | mPosx = ceilf((320 - StringUtils::textWidth(mText, SIZE)) / 2); |
| 40 | |
| 41 | for (size_t i = 0; i < 2; i++) { |
| 42 | mClick[i] = std::make_unique<Clickable>( |
| 43 | mButtons[i].x, mLayout.btnY, ModalChrome::BTN_HALF_W, ModalChrome::BTN_H, mButtons[i].bg, mButtons[i].fg, mButtons[i].label, true); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | void ChoiceOverlay::drawTop(void) const |
| 48 | { |
nothing calls this directly
no outgoing calls
no test coverage detected