Beautiful grid-based editor selection dialog. More...
#include <editor_selection_dialog.h>
Public Member Functions | |
EditorSelectionDialog () | |
bool | Show (bool *p_open=nullptr) |
Show the dialog. | |
EditorType | GetSelectedEditor () const |
Get the selected editor type. | |
bool | IsOpen () const |
Check if dialog is open. | |
void | Open () |
Open the dialog. | |
void | Close () |
Close the dialog. | |
void | SetSelectionCallback (std::function< void(EditorType)> callback) |
Set callback for when editor is selected. | |
void | MarkRecentlyUsed (EditorType type) |
Mark an editor as recently used. | |
void | LoadRecentEditors () |
Load recently used editors from settings. | |
void | SaveRecentEditors () |
Save recently used editors to settings. | |
void | ClearRecentEditors () |
Clear recent editors (for new ROM sessions) | |
Private Member Functions | |
void | DrawEditorCard (const EditorInfo &info, int index) |
void | DrawWelcomeHeader () |
void | DrawQuickAccessButtons () |
Private Attributes | |
std::vector< EditorInfo > | editors_ |
EditorType | selected_editor_ = static_cast<EditorType>(0) |
bool | is_open_ = false |
std::function< void(EditorType)> | selection_callback_ |
std::vector< EditorType > | recent_editors_ |
Static Private Attributes | |
static constexpr int | kMaxRecentEditors = 5 |
Beautiful grid-based editor selection dialog.
Displays when a ROM is loaded, showing all available editors with icons, descriptions, and quick access.
Definition at line 36 of file editor_selection_dialog.h.
yaze::editor::EditorSelectionDialog::EditorSelectionDialog | ( | ) |
Definition at line 16 of file editor_selection_dialog.cc.
References editors_, ICON_MD_CASTLE, ICON_MD_CHAT_BUBBLE, ICON_MD_CODE, ICON_MD_COLOR_LENS, ICON_MD_DATA_ARRAY, ICON_MD_EMOJI_EMOTIONS, ICON_MD_MAP, ICON_MD_MUSIC_NOTE, ICON_MD_PALETTE, ICON_MD_SETTINGS, ICON_MD_SMART_TOY, ICON_MD_TV, ICON_MD_VIDEOGAME_ASSET, yaze::editor::kAgent, yaze::editor::kAssembly, yaze::editor::kDungeon, yaze::editor::kEmulator, yaze::editor::kGraphics, yaze::editor::kHex, yaze::editor::kMessage, yaze::editor::kMusic, yaze::editor::kOverworld, yaze::editor::kPalette, yaze::editor::kScreen, yaze::editor::kSettings, yaze::editor::kSprite, and LoadRecentEditors().
bool yaze::editor::EditorSelectionDialog::Show | ( | bool * | p_open = nullptr | ) |
Show the dialog.
Definition at line 75 of file editor_selection_dialog.cc.
References DrawEditorCard(), DrawQuickAccessButtons(), DrawWelcomeHeader(), editors_, ICON_MD_APPS, is_open_, MarkRecentlyUsed(), recent_editors_, selected_editor_, and selection_callback_.
Referenced by yaze::editor::EditorManager::Update().
|
inline |
Get the selected editor type.
Definition at line 49 of file editor_selection_dialog.h.
References selected_editor_.
|
inline |
Check if dialog is open.
Definition at line 54 of file editor_selection_dialog.h.
References is_open_.
|
inline |
|
inline |
|
inline |
Set callback for when editor is selected.
Definition at line 69 of file editor_selection_dialog.h.
References selection_callback_.
Referenced by yaze::editor::EditorManager::Initialize().
void yaze::editor::EditorSelectionDialog::MarkRecentlyUsed | ( | EditorType | type | ) |
Mark an editor as recently used.
Definition at line 327 of file editor_selection_dialog.cc.
References kMaxRecentEditors, recent_editors_, and SaveRecentEditors().
Referenced by yaze::editor::EditorManager::Initialize(), and Show().
void yaze::editor::EditorSelectionDialog::LoadRecentEditors | ( | ) |
Load recently used editors from settings.
Definition at line 345 of file editor_selection_dialog.cc.
References kMaxRecentEditors, yaze::editor::kSettings, yaze::util::LoadFileFromConfigDir(), and recent_editors_.
Referenced by EditorSelectionDialog().
void yaze::editor::EditorSelectionDialog::SaveRecentEditors | ( | ) |
Save recently used editors to settings.
Definition at line 364 of file editor_selection_dialog.cc.
References recent_editors_, and yaze::util::SaveFile().
Referenced by ClearRecentEditors(), and MarkRecentlyUsed().
|
inline |
Clear recent editors (for new ROM sessions)
Definition at line 91 of file editor_selection_dialog.h.
References recent_editors_, and SaveRecentEditors().
Referenced by yaze::editor::EditorManager::LoadRom(), yaze::editor::EditorManager::OpenProject(), and yaze::editor::EditorManager::OpenRomOrProject().
|
private |
Definition at line 208 of file editor_selection_dialog.cc.
References yaze::editor::EditorInfo::color, yaze::editor::EditorInfo::description, yaze::editor::EditorInfo::icon, ICON_MD_KEYBOARD, ICON_MD_STAR, yaze::editor::EditorInfo::name, recent_editors_, selected_editor_, yaze::editor::EditorInfo::shortcut, and yaze::editor::EditorInfo::type.
Referenced by Show().
|
private |
Definition at line 151 of file editor_selection_dialog.cc.
References ICON_MD_EDIT.
Referenced by Show().
|
private |
Definition at line 170 of file editor_selection_dialog.cc.
References editors_, ICON_MD_HISTORY, recent_editors_, and selected_editor_.
Referenced by Show().
|
private |
Definition at line 101 of file editor_selection_dialog.h.
Referenced by DrawQuickAccessButtons(), EditorSelectionDialog(), and Show().
|
private |
Definition at line 102 of file editor_selection_dialog.h.
Referenced by DrawEditorCard(), DrawQuickAccessButtons(), GetSelectedEditor(), and Show().
|
private |
|
private |
Definition at line 104 of file editor_selection_dialog.h.
Referenced by SetSelectionCallback(), and Show().
|
private |
Definition at line 107 of file editor_selection_dialog.h.
Referenced by ClearRecentEditors(), DrawEditorCard(), DrawQuickAccessButtons(), LoadRecentEditors(), MarkRecentlyUsed(), SaveRecentEditors(), and Show().
|
staticconstexprprivate |
Definition at line 108 of file editor_selection_dialog.h.
Referenced by LoadRecentEditors(), and MarkRecentlyUsed().