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 // Leave undeclared only in code the admission audit does not cover; every
36 // shipped window names a policy (see panel_admission.h).
38 std::vector<std::string> legacy_ids;
39 std::function<void()> on_show;
40 std::function<void()> on_hide;
41};
42
47 public:
50
55
56 bool RegisterPanel(size_t session_id, const WindowDefinition& definition);
57 bool RegisterPanel(const WindowDefinition& definition);
58 bool RegisterPanels(size_t session_id,
59 const std::vector<WindowDefinition>& definitions);
60 bool RegisterPanels(const std::vector<WindowDefinition>& definitions);
61
62 bool RegisterWindow(size_t session_id, const WindowDefinition& definition) {
63 return RegisterPanel(session_id, definition);
64 }
65 bool RegisterWindow(const WindowDefinition& definition) {
66 return RegisterPanel(definition);
67 }
68 bool RegisterWindows(size_t session_id,
69 const std::vector<WindowDefinition>& definitions) {
70 return RegisterPanels(session_id, definitions);
71 }
72 bool RegisterWindows(const std::vector<WindowDefinition>& definitions) {
73 return RegisterPanels(definitions);
74 }
75
76 void RegisterPanelAlias(const std::string& legacy_id,
77 const std::string& canonical_id);
78 void RegisterWindowAlias(const std::string& legacy_id,
79 const std::string& canonical_id) {
80 RegisterPanelAlias(legacy_id, canonical_id);
81 }
82
83 bool OpenWindow(size_t session_id, const std::string& window_id);
84 bool CloseWindow(size_t session_id, const std::string& window_id);
85 bool ToggleWindow(size_t session_id, const std::string& window_id);
86 bool IsWindowOpen(size_t session_id, const std::string& window_id) const;
87
88 bool OpenAndFocusWindow(size_t session_id,
89 const std::string& window_id) const;
90
91 std::string ResolveWindowId(const std::string& window_id) const;
92 std::string GetWorkspaceWindowName(size_t session_id,
93 const std::string& window_id) const;
94
95 private:
96 static WindowDescriptor ToDescriptor(const WindowDefinition& definition);
97
99};
100
103
104} // namespace editor
105} // namespace yaze
106
107#endif // YAZE_APP_EDITOR_SYSTEM_PANEL_HOST_H_
Thin host API over WorkspaceWindowManager for declarative window workflows.
Definition panel_host.h:46
bool OpenWindow(size_t session_id, const std::string &window_id)
Definition panel_host.cc:82
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:95
void RegisterPanelAlias(const std::string &legacy_id, const std::string &canonical_id)
Definition panel_host.cc:74
std::string ResolveWindowId(const std::string &window_id) const
bool RegisterWindow(const WindowDefinition &definition)
Definition panel_host.h:65
bool RegisterWindow(size_t session_id, const WindowDefinition &definition)
Definition panel_host.h:62
bool OpenAndFocusWindow(size_t session_id, const std::string &window_id) const
bool RegisterPanels(size_t session_id, const std::vector< WindowDefinition > &definitions)
Definition panel_host.cc:53
WindowHost(WorkspaceWindowManager *window_manager=nullptr)
Definition panel_host.h:48
WorkspaceWindowManager * window_manager_
Definition panel_host.h:98
void SetWindowManager(WorkspaceWindowManager *window_manager)
Definition panel_host.h:51
void RegisterWindowAlias(const std::string &legacy_id, const std::string &canonical_id)
Definition panel_host.h:78
bool RegisterWindows(size_t session_id, const std::vector< WindowDefinition > &definitions)
Definition panel_host.h:68
bool ToggleWindow(size_t session_id, const std::string &window_id)
Definition panel_host.cc:90
bool RegisterWindows(const std::vector< WindowDefinition > &definitions)
Definition panel_host.h:72
bool CloseWindow(size_t session_id, const std::string &window_id)
Definition panel_host.cc:86
bool RegisterPanel(size_t session_id, const WindowDefinition &definition)
Definition panel_host.cc:28
WorkspaceWindowManager * window_manager() const
Definition panel_host.h:54
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:38
std::function< void()> on_show
Definition panel_host.h:39
WindowPresentationPolicy presentation
Definition panel_host.h:37
std::function< void()> on_hide
Definition panel_host.h:40
WindowLifecycle window_lifecycle
Definition panel_host.h:33
Metadata for a dockable editor window (formerly PanelInfo)