Interactive menu shown when reaching the end of a book with options: Archive Book, Delete Book, Back to Beginning, Close Book, Close Menu. Wired into EpubReaderActivity, XtcReaderActivity, and TxtReaderActivity (TXT shows menu when user tries to advance past the last page). Co-authored-by: Cursor <cursoragent@cursor.com>
47 lines
1.0 KiB
C++
47 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <I18n.h>
|
|
|
|
#include <functional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "../Activity.h"
|
|
#include "util/ButtonNavigator.h"
|
|
|
|
class EndOfBookMenuActivity final : public Activity {
|
|
public:
|
|
enum class Action {
|
|
ARCHIVE,
|
|
DELETE,
|
|
BACK_TO_BEGINNING,
|
|
CLOSE_BOOK,
|
|
CLOSE_MENU,
|
|
};
|
|
|
|
explicit EndOfBookMenuActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const std::string& bookPath,
|
|
const std::function<void(Action)>& onAction)
|
|
: Activity("EndOfBookMenu", renderer, mappedInput), bookPath(bookPath), onAction(onAction) {
|
|
buildMenuItems();
|
|
}
|
|
|
|
void onEnter() override;
|
|
void onExit() override;
|
|
void loop() override;
|
|
void render(Activity::RenderLock&&) override;
|
|
|
|
private:
|
|
struct MenuItem {
|
|
Action action;
|
|
StrId labelId;
|
|
};
|
|
|
|
std::string bookPath;
|
|
std::vector<MenuItem> menuItems;
|
|
int selectedIndex = 0;
|
|
ButtonNavigator buttonNavigator;
|
|
const std::function<void(Action)> onAction;
|
|
|
|
void buildMenuItems();
|
|
};
|