yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
command_palette_providers.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_SYSTEM_COMMAND_PALETTE_PROVIDERS_H_
2#define YAZE_APP_EDITOR_SYSTEM_COMMAND_PALETTE_PROVIDERS_H_
3
4#include <functional>
5#include <string>
6#include <vector>
7
9
10namespace yaze {
11namespace editor {
12
13class WorkspaceWindowManager;
14class RecentProjectsModel;
15class UserSettings;
16
28 public:
30 size_t session_id);
31 std::string ProviderId() const override { return "panels"; }
32 void Provide(CommandPalette* palette) override;
33
34 private:
37};
38
41 public:
43 std::function<void(const std::string&)> switch_callback);
44 std::string ProviderId() const override { return "editors"; }
45 void Provide(CommandPalette* palette) override;
46
47 private:
48 std::function<void(const std::string&)> switch_callback_;
49};
50
53 public:
55 std::function<void(const std::string&)> open_callback);
56 std::string ProviderId() const override { return "recent-files"; }
57 void Provide(CommandPalette* palette) override;
58
59 private:
60 std::function<void(const std::string&)> open_callback_;
61};
62
65 public:
66 explicit DungeonRoomCommandsProvider(size_t session_id);
67 std::string ProviderId() const override { return "dungeon-rooms"; }
68 void Provide(CommandPalette* palette) override;
69
70 private:
72};
73
76 public:
77 DrawerCommandsProvider(std::function<void(int drawer_type)> toggle_callback,
78 std::function<void()> cycle_next = {},
79 std::function<void()> cycle_prev = {});
80 std::string ProviderId() const override { return "drawers"; }
81 void Provide(CommandPalette* palette) override;
82
83 private:
84 std::function<void(int)> toggle_callback_;
85 std::function<void()> cycle_next_;
86 std::function<void()> cycle_prev_;
87};
88
91 public:
93 std::function<void(const std::string&)> apply_callback);
94 std::string ProviderId() const override { return "layouts"; }
95 void Provide(CommandPalette* palette) override;
96
97 private:
98 std::function<void(const std::string&)> apply_callback_;
99};
100
103 public:
105 size_t session_id);
106 std::string ProviderId() const override { return "workflow"; }
107 void Provide(CommandPalette* palette) override;
108
109 private:
112};
113
119 public:
121 UserSettings* user_settings, size_t session_id);
122 std::string ProviderId() const override { return "sidebar"; }
123 void Provide(CommandPalette* palette) override;
124
125 private:
129};
130
135 public:
136 struct Callbacks {
137 const RecentProjectsModel* model = nullptr;
138 std::vector<std::string> template_names;
139 std::function<void(const std::string&)> remove;
140 std::function<void(const std::string&)> toggle_pin;
141 std::function<void()> undo_remove;
142 std::function<void()> clear_recents;
143 std::function<void(const std::string&)> create_from_template;
144 std::function<void()> dismiss_welcome;
145 std::function<void()> show_welcome;
146 };
147 explicit WelcomeCommandsProvider(Callbacks callbacks);
148 std::string ProviderId() const override { return "welcome"; }
149 void Provide(CommandPalette* palette) override;
150
151 private:
153};
154
155} // namespace editor
156} // namespace yaze
157
158#endif // YAZE_APP_EDITOR_SYSTEM_COMMAND_PALETTE_PROVIDERS_H_
Plug-in command source for the palette.
ID: "drawers". Right-drawer toggles with "drawer: " prefix for discovery.
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
DrawerCommandsProvider(std::function< void(int drawer_type)> toggle_callback, std::function< void()> cycle_next={}, std::function< void()> cycle_prev={})
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
ID: "dungeon-rooms". One-shot; only depends on the session id.
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
ID: "editors". Rebuilds on editor-registry changes (rare).
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
EditorCommandsProvider(std::function< void(const std::string &)> switch_callback)
std::function< void(const std::string &) switch_callback_)
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
ID: "layouts". layout: / Apply Layout / profile commands.
LayoutCommandsProvider(std::function< void(const std::string &)> apply_callback)
std::function< void(const std::string &) apply_callback_)
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
ID: "panels". Rebuilds when the set of open windows/panels changes.
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
PanelCommandsProvider(WorkspaceWindowManager *window_manager, size_t session_id)
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
ID: "recent-files". Refresh after RecentFilesManager mutates.
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
std::function< void(const std::string &) open_callback_)
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
RecentFilesCommandsProvider(std::function< void(const std::string &)> open_callback)
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
SidebarCommandsProvider(WorkspaceWindowManager *window_manager, UserSettings *user_settings, size_t session_id)
Manages user preferences and settings persistence.
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
ID: "workflow". Refresh when workflow actions change.
std::string ProviderId() const override
Stable identifier. Used for selective refresh; must be unique.
void Provide(CommandPalette *palette) override
Populate palette with this source's commands.
WorkflowCommandsProvider(WorkspaceWindowManager *window_manager, size_t session_id)
Central registry for all editor cards with session awareness and dependency injection.
std::function< void(const std::string &) toggle_pin)
std::function< void(const std::string &) remove)
std::function< void(const std::string &) create_from_template)