yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
editor_selection_dialog.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_UI_EDITOR_SELECTION_DIALOG_H_
2#define YAZE_APP_EDITOR_UI_EDITOR_SELECTION_DIALOG_H_
3
4#include <functional>
5#include <string>
6#include <vector>
7
8#include "app/editor/editor.h"
9#include "imgui/imgui.h"
10
11namespace yaze {
12namespace editor {
13
18struct EditorInfo {
20 const char* name;
21 const char* icon;
22 const char* description;
23 std::string shortcut; // Platform-aware shortcut string
24 bool recently_used = false;
25 bool requires_rom = true;
26};
27
36 public:
38
43 bool Show(bool* p_open = nullptr);
44
49
53 bool IsOpen() const { return is_open_; }
54
58 void Open() { is_open_ = true; }
59
63 void Close() { is_open_ = false; }
64
68 void SetSelectionCallback(std::function<void(EditorType)> callback) {
69 selection_callback_ = callback;
70 }
71
76
80 void LoadRecentEditors();
81
85 void SaveRecentEditors();
86
91 recent_editors_.clear();
93 }
94
95 private:
96 void DrawEditorPanel(const EditorInfo& info, int index,
97 const ImVec2& card_size);
98 void DrawWelcomeHeader();
100
101 std::vector<EditorInfo> editors_;
103 bool is_open_ = false;
104 std::function<void(EditorType)> selection_callback_;
105
106 // Recently used tracking
107 std::vector<EditorType> recent_editors_;
108 static constexpr int kMaxRecentEditors = 5;
109};
110
111} // namespace editor
112} // namespace yaze
113
114#endif // YAZE_APP_EDITOR_UI_EDITOR_SELECTION_DIALOG_H_
Beautiful grid-based editor selection dialog.
void DrawEditorPanel(const EditorInfo &info, int index, const ImVec2 &card_size)
void ClearRecentEditors()
Clear recent editors (for new ROM sessions)
EditorType GetSelectedEditor() const
Get the selected editor type.
void SaveRecentEditors()
Save recently used editors to settings.
void SetSelectionCallback(std::function< void(EditorType)> callback)
Set callback for when editor is selected.
void LoadRecentEditors()
Load recently used editors from settings.
std::function< void(EditorType)> selection_callback_
void MarkRecentlyUsed(EditorType type)
Mark an editor as recently used.
bool Show(bool *p_open=nullptr)
Show the dialog.
bool IsOpen() const
Check if dialog is open.
Metadata about an available editor.