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

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< EditorInfoeditors_
 
EditorType selected_editor_ = static_cast<EditorType>(0)
 
bool is_open_ = false
 
std::function< void(EditorType)> selection_callback_
 
std::vector< EditorTyperecent_editors_
 

Static Private Attributes

static constexpr int kMaxRecentEditors = 5
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ EditorSelectionDialog()

Member Function Documentation

◆ Show()

bool yaze::editor::EditorSelectionDialog::Show ( bool *  p_open = nullptr)

Show the dialog.

Returns
True if an editor was selected

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().

Here is the call graph for this function:

◆ GetSelectedEditor()

EditorType yaze::editor::EditorSelectionDialog::GetSelectedEditor ( ) const
inline

Get the selected editor type.

Definition at line 49 of file editor_selection_dialog.h.

References selected_editor_.

◆ IsOpen()

bool yaze::editor::EditorSelectionDialog::IsOpen ( ) const
inline

Check if dialog is open.

Definition at line 54 of file editor_selection_dialog.h.

References is_open_.

◆ Open()

void yaze::editor::EditorSelectionDialog::Open ( )
inline

Open the dialog.

Definition at line 59 of file editor_selection_dialog.h.

References is_open_.

◆ Close()

void yaze::editor::EditorSelectionDialog::Close ( )
inline

Close the dialog.

Definition at line 64 of file editor_selection_dialog.h.

References is_open_.

◆ SetSelectionCallback()

void yaze::editor::EditorSelectionDialog::SetSelectionCallback ( std::function< void(EditorType)>  callback)
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().

◆ MarkRecentlyUsed()

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().

Here is the call graph for this function:

◆ LoadRecentEditors()

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().

Here is the call graph for this function:

◆ SaveRecentEditors()

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().

Here is the call graph for this function:

◆ ClearRecentEditors()

void yaze::editor::EditorSelectionDialog::ClearRecentEditors ( )
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().

Here is the call graph for this function:

◆ DrawEditorCard()

◆ DrawWelcomeHeader()

void yaze::editor::EditorSelectionDialog::DrawWelcomeHeader ( )
private

Definition at line 151 of file editor_selection_dialog.cc.

References ICON_MD_EDIT.

Referenced by Show().

◆ DrawQuickAccessButtons()

void yaze::editor::EditorSelectionDialog::DrawQuickAccessButtons ( )
private

Definition at line 170 of file editor_selection_dialog.cc.

References editors_, ICON_MD_HISTORY, recent_editors_, and selected_editor_.

Referenced by Show().

Member Data Documentation

◆ editors_

std::vector<EditorInfo> yaze::editor::EditorSelectionDialog::editors_
private

Definition at line 101 of file editor_selection_dialog.h.

Referenced by DrawQuickAccessButtons(), EditorSelectionDialog(), and Show().

◆ selected_editor_

EditorType yaze::editor::EditorSelectionDialog::selected_editor_ = static_cast<EditorType>(0)
private

◆ is_open_

bool yaze::editor::EditorSelectionDialog::is_open_ = false
private

Definition at line 103 of file editor_selection_dialog.h.

Referenced by Close(), IsOpen(), Open(), and Show().

◆ selection_callback_

std::function<void(EditorType)> yaze::editor::EditorSelectionDialog::selection_callback_
private

Definition at line 104 of file editor_selection_dialog.h.

Referenced by SetSelectionCallback(), and Show().

◆ recent_editors_

std::vector<EditorType> yaze::editor::EditorSelectionDialog::recent_editors_
private

◆ kMaxRecentEditors

constexpr int yaze::editor::EditorSelectionDialog::kMaxRecentEditors = 5
staticconstexprprivate

Definition at line 108 of file editor_selection_dialog.h.

Referenced by LoadRecentEditors(), and MarkRecentlyUsed().


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