Study Dungeon  1.0.0
A group project for COSC345
Public Member Functions
FlashcardEdit::EditDeckScene Class Reference

Represents the scene for editing flashcard decks. More...

#include <edit_flashcard.h>

Inheritance diagram for FlashcardEdit::EditDeckScene:
ConsoleUI::Scene

Public Member Functions

 EditDeckScene (ConsoleUI::UIManager &uiManager, std::function< void()> goBack, std::function< void(FlashCardDeck &)> openEditFlashcardScene, StudySettings &studySettings)
 Constructs an EditDeckScene object. More...
 
void init () override
 Initialises the scene.
 
void update () override
 Updates the scene state. More...
 
void render (std::shared_ptr< ConsoleUI::ConsoleWindow > window) override
 Renders the scene on the console window. More...
 
void handleInput () override
 Handles user input for the scene. More...
 
void setStaticDrawn (bool staticDrawn) override
 Sets the static drawn state of the scene. More...
 
void drawBookshelf (std::shared_ptr< ConsoleUI::ConsoleWindow > window)
 Draws the books shelf art. More...
 
void loadDecks ()
 Loads all flashcard decks from the file system. More...
 
const std::vector< FlashCardDeck > & getDecks () const
 Gets the vector of loaded flashcard decks. More...
 
size_t getSelectedDeckIndex () const
 Gets the index of the currently selected deck. More...
 
void setSelectedDeckIndex (size_t index)
 Sets the index of the currently selected deck. More...
 
int getCurrentPage () const
 Gets the current page number for deck content display. More...
 
void setCurrentPage (int page)
 Sets the current page number for deck content display. More...
 
size_t getMaxCardsPerPage () const
 Gets the maximum number of cards displayed per page. More...
 
void setMaxCardsPerPage (size_t maxCards)
 Sets the maximum number of cards displayed per page. More...
 
bool getNeedsRedraw () const
 Gets the flag indicating if the scene needs redrawing. More...
 
void setNeedsRedraw (bool needsRedraw)
 Sets the flag indicating if the scene needs redrawing. More...
 
StudySettingsgetStudySettings ()
 Gets the study settings object. More...
 
void setStudySettings (const StudySettings &settings)
 Sets the study settings object. More...
 
- Public Member Functions inherited from ConsoleUI::Scene
virtual ~Scene ()=default
 Destroy the Scene object.
 

Detailed Description

Represents the scene for editing flashcard decks.

This class manages the user interface for editing flashcard decks, including functionality to view, add, delete, and rename decks, as well as to edit individual flashcards within a deck.

Constructor & Destructor Documentation

◆ EditDeckScene()

FlashcardEdit::EditDeckScene::EditDeckScene ( ConsoleUI::UIManager uiManager,
std::function< void()>  goBack,
std::function< void(FlashCardDeck &)>  openEditFlashcardScene,
StudySettings studySettings 
)

Constructs an EditDeckScene object.

Parameters
uiManagerReference to the UIManager for handling UI operations.
goBackFunction to return to the previous scene.
openEditFlashcardSceneFunction to open the EditFlashcardScene for a specific deck.
studySettingsReference to the StudySettings object.

Member Function Documentation

◆ drawBookshelf()

void FlashcardEdit::EditDeckScene::drawBookshelf ( std::shared_ptr< ConsoleUI::ConsoleWindow window)

Draws the books shelf art.

Parameters
windowThe console window to add the bookshelf art to

◆ getCurrentPage()

int FlashcardEdit::EditDeckScene::getCurrentPage ( ) const
inline

Gets the current page number for deck content display.

Returns
int The current page number.

◆ getDecks()

const std::vector<FlashCardDeck>& FlashcardEdit::EditDeckScene::getDecks ( ) const
inline

Gets the vector of loaded flashcard decks.

Returns
const std::vector<FlashCardDeck>& The vector of loaded flashcard decks.

◆ getMaxCardsPerPage()

size_t FlashcardEdit::EditDeckScene::getMaxCardsPerPage ( ) const
inline

Gets the maximum number of cards displayed per page.

Returns
size_t The maximum number of cards per page.

◆ getNeedsRedraw()

bool FlashcardEdit::EditDeckScene::getNeedsRedraw ( ) const
inline

Gets the flag indicating if the scene needs redrawing.

Returns
bool True if the scene needs redrawing, false otherwise.

◆ getSelectedDeckIndex()

size_t FlashcardEdit::EditDeckScene::getSelectedDeckIndex ( ) const
inline

Gets the index of the currently selected deck.

Returns
size_t The index of the currently selected deck.

◆ getStudySettings()

StudySettings& FlashcardEdit::EditDeckScene::getStudySettings ( )
inline

Gets the study settings object.

Returns
StudySettings& Reference to the study settings object.

◆ handleInput()

void FlashcardEdit::EditDeckScene::handleInput ( )
overridevirtual

Handles user input for the scene.

This function processes keyboard input to navigate through decks, change pages, and perform actions like adding, deleting, or renaming decks.

Implements ConsoleUI::Scene.

◆ loadDecks()

void FlashcardEdit::EditDeckScene::loadDecks ( )

Loads all flashcard decks from the file system.

This function reads all .deck files from the "Decks/" directory and populates the m_decks vector with the loaded FlashCardDeck objects.

◆ render()

void FlashcardEdit::EditDeckScene::render ( std::shared_ptr< ConsoleUI::ConsoleWindow window)
overridevirtual

Renders the scene on the console window.

Parameters
windowShared pointer to the ConsoleWindow to render on.

This function draws the list of decks, the contents of the selected deck, and navigation instructions on the console window.

Implements ConsoleUI::Scene.

◆ setCurrentPage()

void FlashcardEdit::EditDeckScene::setCurrentPage ( int  page)
inline

Sets the current page number for deck content display.

Parameters
pageThe page number to set as the current page.

◆ setMaxCardsPerPage()

void FlashcardEdit::EditDeckScene::setMaxCardsPerPage ( size_t  maxCards)
inline

Sets the maximum number of cards displayed per page.

Parameters
maxCardsThe maximum number of cards to display per page.

◆ setNeedsRedraw()

void FlashcardEdit::EditDeckScene::setNeedsRedraw ( bool  needsRedraw)
inline

Sets the flag indicating if the scene needs redrawing.

Parameters
needsRedrawBoolean value to set as the needs redraw flag.

◆ setSelectedDeckIndex()

void FlashcardEdit::EditDeckScene::setSelectedDeckIndex ( size_t  index)
inline

Sets the index of the currently selected deck.

Parameters
indexThe index to set as the selected deck.

◆ setStaticDrawn()

void FlashcardEdit::EditDeckScene::setStaticDrawn ( bool  staticDrawn)
overridevirtual

Sets the static drawn state of the scene.

Parameters
staticDrawnBoolean indicating whether the static elements have been drawn.

Implements ConsoleUI::Scene.

◆ setStudySettings()

void FlashcardEdit::EditDeckScene::setStudySettings ( const StudySettings settings)
inline

Sets the study settings object.

Parameters
settingsThe study settings object to set.

◆ update()

void FlashcardEdit::EditDeckScene::update ( )
overridevirtual

Updates the scene state.

This function is called every frame to update the scene's state. Currently, it doesn't perform any operations as the scene doesn't require continuous updates.

Implements ConsoleUI::Scene.


The documentation for this class was generated from the following files: