#pragma once #include #include #include #include "../../lib/Epub/Epub/FootnoteEntry.h" #include "../Activity.h" class FootnotesData { private: FootnoteEntry entries[32]; int count; public: FootnotesData() : count(0) {} void addFootnote(const char* number, const char* href) { if (count < 32) { strncpy(entries[count].number, number, 2); entries[count].number[2] = '\0'; strncpy(entries[count].href, href, 63); entries[count].href[63] = '\0'; count++; } } void clear() { count = 0; } int getCount() const { return count; } const FootnoteEntry* getEntry(int index) const { if (index >= 0 && index < count) { return &entries[index]; } return nullptr; } }; class EpubReaderFootnotesActivity final : public Activity { const FootnotesData& footnotes; const std::function onGoBack; const std::function onSelectFootnote; int selectedIndex; public: EpubReaderFootnotesActivity(GfxRenderer& renderer, InputManager& inputManager, const FootnotesData& footnotes, const std::function& onGoBack, const std::function& onSelectFootnote) : Activity(renderer, inputManager), footnotes(footnotes), onGoBack(onGoBack), onSelectFootnote(onSelectFootnote), selectedIndex(0) {} void onEnter() override; void onExit() override; void loop() override; private: void render(); };