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 <string>
5#include <vector>
6#include <functional>
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 const char* shortcut;
24 bool recently_used = false;
25 bool requires_rom = true;
26 ImVec4 color = ImVec4(0.5f, 0.5f, 0.5f, 1.0f); // Theme color for this editor
27};
28
37 public:
39
44 bool Show(bool* p_open = nullptr);
45
50
54 bool IsOpen() const { return is_open_; }
55
59 void Open() { is_open_ = true; }
60
64 void Close() { is_open_ = false; }
65
69 void SetSelectionCallback(std::function<void(EditorType)> callback) {
70 selection_callback_ = callback;
71 }
72
77
81 void LoadRecentEditors();
82
86 void SaveRecentEditors();
87
92 recent_editors_.clear();
94 }
95
96 private:
97 void DrawEditorCard(const EditorInfo& info, int index);
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 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 DrawEditorCard(const EditorInfo &info, int index)
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.
Main namespace for the application.
Metadata about an available editor.