#pragma once #include #include #include #include #include "../Activity.h" // Enum for quick menu selection enum class QuickMenuAction { DICTIONARY, ADD_BOOKMARK, CLEAR_CACHE, TOGGLE_ORIENTATION, GO_TO_SETTINGS }; /** * QuickMenuActivity presents a quick access menu triggered by short power button press. * Options: * - "Dictionary" - Look up a word * - "Add/Remove Bookmark" - Toggle bookmark on current page * * The onActionSelected callback is called with the user's choice. * The onCancel callback is called if the user presses back. */ class QuickMenuActivity final : public Activity { TaskHandle_t displayTaskHandle = nullptr; SemaphoreHandle_t renderingMutex = nullptr; int selectedIndex = 0; bool updateRequired = false; const std::function onActionSelected; const std::function onCancel; const bool isPageBookmarked; // True if current page already has a bookmark // Edit mode state bool editMode = false; // True when in edit mode int movingIndex = -1; // Index of item being moved (-1 if none) uint8_t localOrder[5] = {0}; // Local copy of order for editing static void taskTrampoline(void* param); [[noreturn]] void displayTaskLoop(); void render() const; void handleNormalMode(); void handleEditMode(); public: explicit QuickMenuActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, const std::function& onActionSelected, const std::function& onCancel, bool isPageBookmarked = false) : Activity("QuickMenu", renderer, mappedInput), onActionSelected(onActionSelected), onCancel(onCancel), isPageBookmarked(isPageBookmarked) {} void onEnter() override; void onExit() override; void loop() override; };