yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::gui::EditorCardManager Class Reference

Central registry and manager for all editor cards. More...

#include <editor_card_manager.h>

Classes

struct  WorkspacePreset
 

Public Member Functions

void RegisterCard (const CardInfo &info)
 
void UnregisterCard (const std::string &card_id)
 
void ClearAllCards ()
 
bool ShowCard (const std::string &card_id)
 
bool HideCard (const std::string &card_id)
 
bool ToggleCard (const std::string &card_id)
 
bool IsCardVisible (const std::string &card_id) const
 
void ShowAllCardsInCategory (const std::string &category)
 
void HideAllCardsInCategory (const std::string &category)
 
void ShowOnlyCard (const std::string &card_id)
 
std::vector< CardInfoGetCardsInCategory (const std::string &category) const
 
std::vector< std::string > GetAllCategories () const
 
const CardInfoGetCardInfo (const std::string &card_id) const
 
void DrawViewMenuSection (const std::string &category)
 
void DrawViewMenuAll ()
 
void DrawCompactCardControl (const std::string &category)
 
void DrawInlineCardToggles (const std::string &category)
 
void DrawCardBrowser (bool *p_open)
 
void DrawCardBrowserTable (const char *search_filter, const std::string &category_filter)
 
void DrawPresetsTab ()
 
void SavePreset (const std::string &name, const std::string &description="")
 
bool LoadPreset (const std::string &name)
 
void DeletePreset (const std::string &name)
 
std::vector< WorkspacePresetGetPresets () const
 
void ShowAll ()
 
void HideAll ()
 
void ResetToDefaults ()
 
size_t GetCardCount () const
 
size_t GetVisibleCardCount () const
 

Static Public Member Functions

static EditorCardManagerGet ()
 

Private Member Functions

 EditorCardManager ()=default
 
 ~EditorCardManager ()=default
 
 EditorCardManager (const EditorCardManager &)=delete
 
EditorCardManageroperator= (const EditorCardManager &)=delete
 
void SavePresetsToFile ()
 
void LoadPresetsFromFile ()
 

Private Attributes

std::unordered_map< std::string, CardInfocards_
 
std::unordered_map< std::string, WorkspacePresetpresets_
 

Detailed Description

Central registry and manager for all editor cards.

This singleton provides:

  • Global card registration across all editors
  • View menu integration
  • Keyboard shortcut management
  • Workspace preset system
  • Quick search/filter
  • Programmatic card control without GUI coupling

Design Philosophy:

  • Cards register themselves on creation
  • Manager provides unified interface for visibility control
  • No direct GUI dependency in card logic
  • Supports dynamic card creation/destruction

Usage:

// In editor initialization:
auto& manager = EditorCardManager::Get();
manager.RegisterCard({
.card_id = "dungeon.room_selector",
.display_name = "Room Selector",
.icon = ICON_MD_LIST,
.category = "Dungeon",
.visibility_flag = &show_room_selector_,
.on_show = []() { printf("Room selector opened\n"); }
});
// Programmatic control:
manager.ShowCard("dungeon.room_selector");
manager.HideCard("dungeon.room_selector");
manager.ToggleCard("dungeon.room_selector");
// In View menu:
manager.DrawViewMenuSection("Dungeon");
static EditorCardManager & Get()
#define ICON_MD_LIST
Definition icons.h:1092

Definition at line 72 of file editor_card_manager.h.

Constructor & Destructor Documentation

◆ EditorCardManager() [1/2]

yaze::gui::EditorCardManager::EditorCardManager ( )
privatedefault

◆ ~EditorCardManager()

yaze::gui::EditorCardManager::~EditorCardManager ( )
privatedefault

◆ EditorCardManager() [2/2]

yaze::gui::EditorCardManager::EditorCardManager ( const EditorCardManager )
privatedelete

Member Function Documentation

◆ Get()

◆ RegisterCard()

void yaze::gui::EditorCardManager::RegisterCard ( const CardInfo info)

◆ UnregisterCard()

void yaze::gui::EditorCardManager::UnregisterCard ( const std::string &  card_id)

Definition at line 37 of file editor_card_manager.cc.

References cards_.

Referenced by yaze::gui::CardRegistration::~CardRegistration().

◆ ClearAllCards()

void yaze::gui::EditorCardManager::ClearAllCards ( )

Definition at line 45 of file editor_card_manager.cc.

References cards_.

◆ ShowCard()

bool yaze::gui::EditorCardManager::ShowCard ( const std::string &  card_id)

Definition at line 50 of file editor_card_manager.cc.

References cards_.

Referenced by LoadPreset().

◆ HideCard()

bool yaze::gui::EditorCardManager::HideCard ( const std::string &  card_id)

Definition at line 69 of file editor_card_manager.cc.

References cards_.

◆ ToggleCard()

bool yaze::gui::EditorCardManager::ToggleCard ( const std::string &  card_id)

Definition at line 88 of file editor_card_manager.cc.

References cards_.

Referenced by DrawViewMenuSection().

◆ IsCardVisible()

bool yaze::gui::EditorCardManager::IsCardVisible ( const std::string &  card_id) const

Definition at line 110 of file editor_card_manager.cc.

References cards_.

◆ ShowAllCardsInCategory()

void yaze::gui::EditorCardManager::ShowAllCardsInCategory ( const std::string &  category)

◆ HideAllCardsInCategory()

void yaze::gui::EditorCardManager::HideAllCardsInCategory ( const std::string &  category)

Definition at line 127 of file editor_card_manager.cc.

References cards_.

Referenced by DrawCompactCardControl(), and DrawViewMenuAll().

◆ ShowOnlyCard()

void yaze::gui::EditorCardManager::ShowOnlyCard ( const std::string &  card_id)

Definition at line 136 of file editor_card_manager.cc.

References cards_.

◆ GetCardsInCategory()

std::vector< CardInfo > yaze::gui::EditorCardManager::GetCardsInCategory ( const std::string &  category) const

Definition at line 158 of file editor_card_manager.cc.

References cards_.

Referenced by DrawCompactCardControl(), DrawInlineCardToggles(), and DrawViewMenuSection().

◆ GetAllCategories()

std::vector< std::string > yaze::gui::EditorCardManager::GetAllCategories ( ) const

Definition at line 176 of file editor_card_manager.cc.

References cards_.

Referenced by DrawCardBrowser(), and DrawViewMenuAll().

◆ GetCardInfo()

const CardInfo * yaze::gui::EditorCardManager::GetCardInfo ( const std::string &  card_id) const

Definition at line 189 of file editor_card_manager.cc.

References cards_.

◆ DrawViewMenuSection()

void yaze::gui::EditorCardManager::DrawViewMenuSection ( const std::string &  category)

Definition at line 194 of file editor_card_manager.cc.

References GetCardsInCategory(), and ToggleCard().

Referenced by DrawViewMenuAll().

Here is the call graph for this function:

◆ DrawViewMenuAll()

◆ DrawCompactCardControl()

void yaze::gui::EditorCardManager::DrawCompactCardControl ( const std::string &  category)

◆ DrawInlineCardToggles()

void yaze::gui::EditorCardManager::DrawInlineCardToggles ( const std::string &  category)

Definition at line 330 of file editor_card_manager.cc.

References GetCardsInCategory(), and ICON_MD_DASHBOARD.

Here is the call graph for this function:

◆ DrawCardBrowser()

◆ DrawCardBrowserTable()

void yaze::gui::EditorCardManager::DrawCardBrowserTable ( const char *  search_filter,
const std::string &  category_filter 
)

Definition at line 417 of file editor_card_manager.cc.

References cards_.

Referenced by DrawCardBrowser().

◆ DrawPresetsTab()

void yaze::gui::EditorCardManager::DrawPresetsTab ( )

Definition at line 504 of file editor_card_manager.cc.

References DeletePreset(), GetPresets(), ICON_MD_BOOKMARK, ICON_MD_DELETE, ICON_MD_FOLDER_OPEN, ICON_MD_SAVE, LoadPreset(), and SavePreset().

Referenced by DrawCardBrowser().

Here is the call graph for this function:

◆ SavePreset()

void yaze::gui::EditorCardManager::SavePreset ( const std::string &  name,
const std::string &  description = "" 
)

◆ LoadPreset()

bool yaze::gui::EditorCardManager::LoadPreset ( const std::string &  name)

Definition at line 579 of file editor_card_manager.cc.

References HideAll(), presets_, and ShowCard().

Referenced by DrawPresetsTab().

Here is the call graph for this function:

◆ DeletePreset()

void yaze::gui::EditorCardManager::DeletePreset ( const std::string &  name)

Definition at line 599 of file editor_card_manager.cc.

References presets_, and SavePresetsToFile().

Referenced by DrawPresetsTab().

Here is the call graph for this function:

◆ GetPresets()

std::vector< EditorCardManager::WorkspacePreset > yaze::gui::EditorCardManager::GetPresets ( ) const

Definition at line 608 of file editor_card_manager.cc.

References presets_.

Referenced by DrawPresetsTab().

◆ ShowAll()

void yaze::gui::EditorCardManager::ShowAll ( )

Definition at line 616 of file editor_card_manager.cc.

References cards_.

Referenced by DrawViewMenuAll().

◆ HideAll()

void yaze::gui::EditorCardManager::HideAll ( )

Definition at line 625 of file editor_card_manager.cc.

References cards_.

Referenced by DrawViewMenuAll(), and LoadPreset().

◆ ResetToDefaults()

void yaze::gui::EditorCardManager::ResetToDefaults ( )

Definition at line 634 of file editor_card_manager.cc.

References cards_.

◆ GetCardCount()

size_t yaze::gui::EditorCardManager::GetCardCount ( ) const
inline

Definition at line 128 of file editor_card_manager.h.

References cards_.

Referenced by DrawCardBrowser().

◆ GetVisibleCardCount()

size_t yaze::gui::EditorCardManager::GetVisibleCardCount ( ) const

Definition at line 650 of file editor_card_manager.cc.

References cards_.

Referenced by DrawCardBrowser().

◆ operator=()

EditorCardManager & yaze::gui::EditorCardManager::operator= ( const EditorCardManager )
privatedelete

◆ SavePresetsToFile()

void yaze::gui::EditorCardManager::SavePresetsToFile ( )
private
Todo:
Implement file I/O

Definition at line 660 of file editor_card_manager.cc.

References presets_.

Referenced by DeletePreset(), and SavePreset().

◆ LoadPresetsFromFile()

void yaze::gui::EditorCardManager::LoadPresetsFromFile ( )
private
Todo:
Implement file I/O

Definition at line 666 of file editor_card_manager.cc.

Member Data Documentation

◆ cards_

◆ presets_

std::unordered_map<std::string, WorkspacePreset> yaze::gui::EditorCardManager::presets_
private

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