#pragma once #include #include #include #include #include "../Activity.h" #include "util/ButtonNavigator.h" class BookManageMenuActivity final : public Activity { public: enum class Action { ARCHIVE, UNARCHIVE, DELETE, DELETE_CACHE, REINDEX, REINDEX_FULL, }; explicit BookManageMenuActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const std::string& bookPath, bool isArchived, const std::function& onAction, const std::function& onCancel) : Activity("BookManageMenu", renderer, mappedInput), bookPath(bookPath), archived(isArchived), onAction(onAction), onCancel(onCancel) { 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; bool archived; std::vector menuItems; int selectedIndex = 0; ButtonNavigator buttonNavigator; bool ignoreNextConfirmRelease = false; static constexpr unsigned long LONG_PRESS_MS = 700; const std::function onAction; const std::function onCancel; void buildMenuItems(); };