Something went wrong. Try again.
A fork of https://github.com/crosspoint-reader/crosspoint-reader
Something went wrong. Try again.
1.5 kB · 45 lines
C++
12345678910111213141516171819202122232425262728293031323334353637383940414243444546#include "ConfirmationActivity.h"
#include <I18n.h>
#include "HalDisplay.h"#include "components/UITheme.h"
ConfirmationActivity::ConfirmationActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const std::string& heading, const std::string& body) : Activity("Confirmation", renderer, mappedInput), heading(heading), body(body) {}
void ConfirmationActivity::onEnter() { Activity::onEnter();
// Both texts live inside the dialog: the heading as its caption and the // subject (a book title) as the wrapping headline beneath it. No // pre-truncation — the dialog wraps both to its own width. const char* options[] = {I18N.get(StrId::STR_CANCEL), I18N.get(StrId::STR_CONFIRM)}; confirmPopup.show(heading.c_str(), body.c_str(), options, 2, 0, [this](int idx) { ActivityResult res; res.isCancelled = (idx != 1); setResult(std::move(res)); finish(); });
requestUpdate(true);}
void ConfirmationActivity::render(RenderLock&& lock) { renderer.clearScreen();
if (confirmPopup.processRender(renderer, mappedInput)) return;
renderer.displayBuffer(HalDisplay::RefreshMode::FAST_REFRESH);}
void ConfirmationActivity::loop() { if (confirmPopup.handleInput(mappedInput, [this] { requestUpdate(); })) return;
// Popup dismissed without a selection (Back button or tap outside): cancel. ActivityResult res; res.isCancelled = true; setResult(std::move(res)); finish();}