yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
panel_host.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_SYSTEM_PANEL_HOST_H_
2#define YAZE_APP_EDITOR_SYSTEM_PANEL_HOST_H_
3
4#include <functional>
5#include <string>
6#include <vector>
7
9
10namespace yaze {
11namespace editor {
12
13class WorkspaceWindowManager;
14struct WindowDescriptor;
15
23 std::string id;
24 std::string display_name;
25 std::string icon;
26 std::string category;
27 std::string window_title;
28 std::string shortcut_hint;
29 int priority = 50;
30 bool visible_by_default = false;
31 bool* visibility_flag = nullptr;
35 std::vector<std::string> legacy_ids;
36 std::function<void()> on_show;
37 std::function<void()> on_hide;
38};
39
44 public:
47
52
53 bool RegisterPanel(size_t session_id, const WindowDefinition& definition);
54 bool RegisterPanel(const WindowDefinition& definition);
55 bool RegisterPanels(size_t session_id,
56 const std::vector<WindowDefinition>& definitions);
57 bool RegisterPanels(const std::vector<WindowDefinition>& definitions);
58
59 bool RegisterWindow(size_t session_id, const WindowDefinition& definition) {
60 return RegisterPanel(session_id, definition);
61 }
62 bool RegisterWindow(const WindowDefinition& definition) {
63 return RegisterPanel(definition);
64 }
65 bool RegisterWindows(size_t session_id,
66 const std::vector<WindowDefinition>& definitions) {
67 return RegisterPanels(session_id, definitions);
68 }
69 bool RegisterWindows(const std::vector<WindowDefinition>& definitions) {
70 return RegisterPanels(definitions);
71 }
72
73 void RegisterPanelAlias(const std::string& legacy_id,
74 const std::string& canonical_id);
75 void RegisterWindowAlias(const std::string& legacy_id,
76 const std::string& canonical_id) {
77 RegisterPanelAlias(legacy_id, canonical_id);
78 }
79
80 bool OpenWindow(size_t session_id, const std::string& window_id);
81 bool CloseWindow(size_t session_id, const std::string& window_id);
82 bool ToggleWindow(size_t session_id, const std::string& window_id);
83 bool IsWindowOpen(size_t session_id, const std::string& window_id) const;
84
85 bool OpenAndFocusWindow(size_t session_id,
86 const std::string& window_id) const;
87
88 std::string ResolveWindowId(const std::string& window_id) const;
89 std::string GetWorkspaceWindowName(size_t session_id,
90 const std::string& window_id) const;
91
92 private:
93 static WindowDescriptor ToDescriptor(const WindowDefinition& definition);
94
96};
97
100
101} // namespace editor
102} // namespace yaze
103
104#endif // YAZE_APP_EDITOR_SYSTEM_PANEL_HOST_H_
Thin host API over WorkspaceWindowManager for declarative window workflows.
Definition panel_host.h:43
bool OpenWindow(size_t session_id, const std::string &window_id)
Definition panel_host.cc:81
static WindowDescriptor ToDescriptor(const WindowDefinition &definition)
Definition panel_host.cc:9
std::string GetWorkspaceWindowName(size_t session_id, const std::string &window_id) const
bool IsWindowOpen(size_t session_id, const std::string &window_id) const
Definition panel_host.cc:93
void RegisterPanelAlias(const std::string &legacy_id, const std::string &canonical_id)
Definition panel_host.cc:73
std::string ResolveWindowId(const std::string &window_id) const
bool RegisterWindow(const WindowDefinition &definition)
Definition panel_host.h:62
bool RegisterWindow(size_t session_id, const WindowDefinition &definition)
Definition panel_host.h:59
bool OpenAndFocusWindow(size_t session_id, const std::string &window_id) const
Definition panel_host.cc:98
bool RegisterPanels(size_t session_id, const std::vector< WindowDefinition > &definitions)
Definition panel_host.cc:52
WindowHost(WorkspaceWindowManager *window_manager=nullptr)
Definition panel_host.h:45
WorkspaceWindowManager * window_manager_
Definition panel_host.h:95
void SetWindowManager(WorkspaceWindowManager *window_manager)
Definition panel_host.h:48
void RegisterWindowAlias(const std::string &legacy_id, const std::string &canonical_id)
Definition panel_host.h:75
bool RegisterWindows(size_t session_id, const std::vector< WindowDefinition > &definitions)
Definition panel_host.h:65
bool ToggleWindow(size_t session_id, const std::string &window_id)
Definition panel_host.cc:89
bool RegisterWindows(const std::vector< WindowDefinition > &definitions)
Definition panel_host.h:69
bool CloseWindow(size_t session_id, const std::string &window_id)
Definition panel_host.cc:85
bool RegisterPanel(size_t session_id, const WindowDefinition &definition)
Definition panel_host.cc:27
WorkspaceWindowManager * window_manager() const
Definition panel_host.h:51
Central registry for all editor cards with session awareness and dependency injection.
WindowContextScope
Optional context binding for a window's behavior within an editor.
WindowLifecycle
Defines lifecycle behavior for editor windows.
@ EditorBound
Hidden when switching editors (default)
WindowScope
Defines whether a window is session-scoped or global.
Declarative registration contract for editor windows.
Definition panel_host.h:22
WindowContextScope context_scope
Definition panel_host.h:34
std::vector< std::string > legacy_ids
Definition panel_host.h:35
std::function< void()> on_show
Definition panel_host.h:36
std::function< void()> on_hide
Definition panel_host.h:37
WindowLifecycle window_lifecycle
Definition panel_host.h:33
Metadata for a dockable editor window (formerly PanelInfo)