yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
dashboard_panel.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_SHELL_WINDOWS_DASHBOARD_PANEL_H_
2#define YAZE_APP_EDITOR_SHELL_WINDOWS_DASHBOARD_PANEL_H_
3
4#include <functional>
5#include <string>
6#include <vector>
7
8#include "app/editor/editor.h"
10#include "imgui/imgui.h"
11
12namespace yaze {
13namespace editor {
14
15class IEditorSwitcher;
16
18 public:
19 explicit DashboardPanel(IEditorSwitcher* editor_switcher);
20 ~DashboardPanel() = default;
21
22 void Draw();
23
24 void Show() { show_ = true; }
25 void Hide() { show_ = false; }
26 bool IsVisible() const { return show_; }
27 bool* visibility_flag() { return &show_; }
28
30 // Parses the recent-editors file body. Pure and static so the validation
31 // rules are testable without touching the user's real config directory,
32 // which LoadFileFromConfigDir/SaveFile resolve through PlatformPaths.
33 static std::vector<EditorType> ParseRecentEditors(const std::string& data,
34 size_t max_entries);
35 void LoadRecentEditors();
36 void SaveRecentEditors();
37 void ClearRecentEditors();
38
39 private:
40 struct EditorInfo {
41 std::string name;
42 std::string icon;
43 std::string description;
44 std::string shortcut;
46 bool recently_used = false;
47 bool requires_rom = true;
48 };
49
50 void DrawWelcomeHeader();
51 void DrawRecentEditors();
52 void DrawEditorGrid();
53 void DrawEditorPanel(const EditorInfo& info, int index,
54 const ImVec2& card_size, bool enabled);
55
58 bool show_ = true;
59 bool has_rom_ = false;
60
61 std::vector<EditorInfo> editors_;
62 std::vector<EditorType> recent_editors_;
63 static constexpr size_t kMaxRecentEditors = 5;
64};
65
66} // namespace editor
67} // namespace yaze
68
69#endif // YAZE_APP_EDITOR_SHELL_WINDOWS_DASHBOARD_PANEL_H_
std::vector< EditorInfo > editors_
static std::vector< EditorType > ParseRecentEditors(const std::string &data, size_t max_entries)
static constexpr size_t kMaxRecentEditors
std::vector< EditorType > recent_editors_
void MarkRecentlyUsed(EditorType type)
void DrawEditorPanel(const EditorInfo &info, int index, const ImVec2 &card_size, bool enabled)
DashboardPanel(IEditorSwitcher *editor_switcher)
IEditorSwitcher * editor_switcher_
Interface for editor selection and navigation.
Draggable, dockable panel for editor sub-windows.