12 #ifndef EDIT_DECK_SCENE_H
13 #define EDIT_DECK_SCENE_H
29 namespace FlashcardEdit
52 std::function<
void()> goBack,
78 void render(std::shared_ptr<ConsoleUI::ConsoleWindow> window)
override;
99 void drawBookshelf(std::shared_ptr<ConsoleUI::ConsoleWindow> window);
124 return m_selectedDeckIndex;
133 m_selectedDeckIndex = index;
142 return m_currentPage;
151 m_currentPage = page;
160 return m_maxCardsPerPage;
169 m_maxCardsPerPage = maxCards;
178 return m_needsRedraw;
187 m_needsRedraw = needsRedraw;
205 m_settings = settings;
210 std::function<void()> m_goBack;
211 std::function<void(
FlashCardDeck &)> m_openEditFlashcardScene;
212 std::vector<FlashCardDeck> m_decks;
213 size_t m_selectedDeckIndex;
215 size_t m_maxCardsPerPage;
218 bool m_staticDrawn =
false;
219 int m_prevBookshelfIndex = -1;
220 bool m_paging =
false;
221 std::chrono::steady_clock::time_point m_lastPageChangeTime;
222 const std::chrono::milliseconds m_pageChangeDelay{200};
223 int bookshelfIndex = 0;
254 void drawLibrarianComment();
276 std::function<
void()> goBack,
283 void init()
override;
301 void render(std::shared_ptr<ConsoleUI::ConsoleWindow> window)
override;
332 return m_selectedCardIndex;
341 m_selectedCardIndex = index;
350 return m_currentPage;
359 m_currentPage = page;
368 return m_maxCardsPerPage;
377 m_maxCardsPerPage = maxCards;
386 return m_needsRedraw;
395 m_needsRedraw = needsRedraw;
413 m_settings = settings;
419 std::function<void()> m_goBack;
420 size_t m_selectedCardIndex;
422 size_t m_maxCardsPerPage;
425 bool m_staticDrawn =
false;
435 void editSelectedCard();
452 void deleteSelectedCard();
457 void drawLibrarianComment();
Defines variables containg ASCII artwork.
Defines a UI scene.
Definition: menu.h:629
Defines the UI manager.
Definition: menu.h:675
Class that defines a "deck" of flashcards.
Definition: deck.h:113
Represents the scene for editing flashcard decks.
Definition: edit_flashcard.h:42
void setNeedsRedraw(bool needsRedraw)
Sets the flag indicating if the scene needs redrawing.
Definition: edit_flashcard.h:185
void setCurrentPage(int page)
Sets the current page number for deck content display.
Definition: edit_flashcard.h:149
size_t getMaxCardsPerPage() const
Gets the maximum number of cards displayed per page.
Definition: edit_flashcard.h:158
void loadDecks()
Loads all flashcard decks from the file system.
Definition: edit_flashcard.cpp:378
EditDeckScene(ConsoleUI::UIManager &uiManager, std::function< void()> goBack, std::function< void(FlashCardDeck &)> openEditFlashcardScene, StudySettings &studySettings)
Constructs an EditDeckScene object.
Definition: edit_flashcard.cpp:368
size_t getSelectedDeckIndex() const
Gets the index of the currently selected deck.
Definition: edit_flashcard.h:122
void update() override
Updates the scene state.
Definition: edit_flashcard.cpp:392
void drawBookshelf(std::shared_ptr< ConsoleUI::ConsoleWindow > window)
Draws the books shelf art.
Definition: edit_flashcard.cpp:402
bool getNeedsRedraw() const
Gets the flag indicating if the scene needs redrawing.
Definition: edit_flashcard.h:176
void render(std::shared_ptr< ConsoleUI::ConsoleWindow > window) override
Renders the scene on the console window.
Definition: edit_flashcard.cpp:442
int getCurrentPage() const
Gets the current page number for deck content display.
Definition: edit_flashcard.h:140
void setStaticDrawn(bool staticDrawn) override
Sets the static drawn state of the scene.
Definition: edit_flashcard.cpp:397
const std::vector< FlashCardDeck > & getDecks() const
Gets the vector of loaded flashcard decks.
Definition: edit_flashcard.h:113
void setStudySettings(const StudySettings &settings)
Sets the study settings object.
Definition: edit_flashcard.h:203
void setSelectedDeckIndex(size_t index)
Sets the index of the currently selected deck.
Definition: edit_flashcard.h:131
void handleInput() override
Handles user input for the scene.
Definition: edit_flashcard.cpp:515
void init() override
Initialises the scene.
Definition: edit_flashcard.cpp:386
void setMaxCardsPerPage(size_t maxCards)
Sets the maximum number of cards displayed per page.
Definition: edit_flashcard.h:167
StudySettings & getStudySettings()
Gets the study settings object.
Definition: edit_flashcard.h:194
Represents the scene for editing individual flashcards within a deck.
Definition: edit_flashcard.h:265
bool getNeedsRedraw() const
Gets the flag indicating if the scene needs redrawing.
Definition: edit_flashcard.h:384
void handleInput() override
Handles user input for the scene.
Definition: edit_flashcard.cpp:109
void render(std::shared_ptr< ConsoleUI::ConsoleWindow > window) override
Renders the scene on the console window.
Definition: edit_flashcard.cpp:55
StudySettings & getStudySettings()
Gets the study settings object.
Definition: edit_flashcard.h:402
size_t getMaxCardsPerPage() const
Gets the maximum number of flashcards displayed per page.
Definition: edit_flashcard.h:366
EditFlashcardScene(ConsoleUI::UIManager &uiManager, FlashCardDeck &deck, std::function< void()> goBack, StudySettings &studySettings)
Constructs an EditFlashcardScene object.
Definition: edit_flashcard.cpp:20
size_t getSelectedCardIndex() const
Gets the index of the currently selected flashcard.
Definition: edit_flashcard.h:330
void setSelectedCardIndex(size_t index)
Sets the index of the currently selected flashcard.
Definition: edit_flashcard.h:339
void setStudySettings(const StudySettings &settings)
Sets the study settings object.
Definition: edit_flashcard.h:411
void update() override
Updates the scene state.
Definition: edit_flashcard.cpp:34
void init() override
Initialises the scene.
Definition: edit_flashcard.cpp:29
void setMaxCardsPerPage(size_t maxCards)
Sets the maximum number of flashcards displayed per page.
Definition: edit_flashcard.h:375
const FlashCardDeck & getDeck() const
Gets the flashcard deck being edited.
Definition: edit_flashcard.h:321
void setStaticDrawn(bool staticDrawn) override
Sets the static drawn state of the scene.
Definition: edit_flashcard.cpp:39
void setNeedsRedraw(bool needsRedraw)
Sets the flag indicating if the scene needs redrawing.
Definition: edit_flashcard.h:393
void setCurrentPage(int page)
Sets the current page number for flashcard list display.
Definition: edit_flashcard.h:357
int getCurrentPage() const
Gets the current page number for flashcard list display.
Definition: edit_flashcard.h:348
Object for the settings relating to the study sessions component.
Definition: settings_scene.h:27
Functions and classes relating to flashcards.
The menu and settings for the over all game.
Contains useful helper functions.