载入中...
搜索中...
未找到
EditorWorkspace.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include "editor/EditorDock.h"
7
8#include <cstdint>
9#include <cstddef>
10#include <string>
11#include <string_view>
12#include <vector>
13
14namespace eve::editor {
15
18
20std::string_view workspaceRegionName(WorkspaceRegion region);
21
24 std::string id;
25 std::string title;
26 std::string region = "center";
27 std::string capability;
28 std::string context;
29 int order = 0;
30 bool visible = true;
31 bool singleton = true;
32};
33
44public:
46 EditorWorkspace(std::string id, std::string title);
47
49 const std::string& getId() const { return id_; }
51 const std::string& getTitle() const { return title_; }
53 void setTitle(const std::string& title);
54
58 [[nodiscard]] Result<WorkspacePanelDescriptor> movePanel(const StableId& id, WorkspaceRegion region,
59 int order);
61 [[nodiscard]] Result<WorkspacePanelDescriptor> removePanel(const StableId& id);
63 [[nodiscard]] Result<WorkspacePanelDescriptor> activatePanel(const StableId& id);
65 [[nodiscard]] Result<WorkspacePanelDescriptor> panelAt(std::size_t index) const;
66
72 bool registerPanel(const std::string& id, const std::string& title, const std::string& region, int order);
74 bool removePanel(const std::string& id);
76 void clearPanels();
78 bool movePanel(const std::string& id, const std::string& region, int order);
80 bool setPanelCapability(const std::string& id, const std::string& capability);
82 bool setPanelContext(const std::string& id, const std::string& context);
84 bool setPanelVisible(const std::string& id, bool visible);
86 bool setPanelSingleton(const std::string& id, bool singleton);
88 bool activatePanel(const std::string& id);
90 const std::string& getActivePanel() const { return activePanel_; }
91
93 int getPanelCount() const { return static_cast<int>(panels_.size()); }
95 std::string getPanelId(int index) const;
97 std::string getPanelTitle(int index) const;
99 std::string getPanelRegion(int index) const;
101 std::string getPanelCapability(int index) const;
103 std::string getPanelContext(int index) const;
105 int getPanelOrder(int index) const;
107 bool getPanelVisible(int index) const;
109 bool getPanelSingleton(int index) const;
110
112 void setRegionSize(const std::string& region, float pixels);
114 void layout(float width, float height);
116 float getRegionX(const std::string& region) const;
118 float getRegionY(const std::string& region) const;
120 float getRegionW(const std::string& region) const;
122 float getRegionH(const std::string& region) const;
123
125 bool setMode(const std::string& mode);
127 [[nodiscard]] Result<StableId> setModeId(StableId mode);
129 const std::string& getMode() const { return mode_; }
130
135 bool select(const std::string& channel, const std::string& domain, const std::string& target,
136 const std::string& item, const std::string& type, bool additive);
138 [[nodiscard]] Result<SelectionSnapshot> selectItem(std::string channel, SelectionItem item, bool additive);
140 bool clearSelection(const std::string& channel);
142 [[nodiscard]] Result<SelectionSnapshot> clearSelectionChecked(const std::string& channel);
144 int getSelectionCount(const std::string& channel) const;
146 std::string getSelectionItem(const std::string& channel, int index) const;
148 std::string getSelectionType(const std::string& channel, int index) const;
150 std::string getPrimarySelection(const std::string& channel) const;
152 std::uint64_t getSelectionSequence(const std::string& channel) const;
154 bool focus(const std::string& channel, const std::string& surface, const std::string& item);
156 [[nodiscard]] Result<EditorFocusSnapshot> focusItem(const std::string& channel, StableId surface,
157 StableId item);
159 std::string getFocusedSurface(const std::string& channel) const;
160
162 std::uint64_t getRevision() const { return revision_; }
163
164private:
165 static bool isRegion(const std::string& region);
166 static bool parseDomain(const std::string& value, SelectionDomain& domain);
168 WorkspacePanelDescriptor* findPanel(const std::string& id);
170 const WorkspacePanelDescriptor* panelAtUnchecked(int index) const;
171 void sortPanels();
172 void changed();
173
174 std::string id_;
175 std::string title_;
176 std::string mode_ = "edit";
177 std::string activePanel_;
178 std::vector<WorkspacePanelDescriptor> panels_;
179 EditorDock dock_;
180 EditorSelectionService selection_;
181 EditorFocusService focus_;
182 std::uint64_t revision_ = 0;
183};
184
185} // namespace eve::editor
LogicalId target
double value
std::string descriptor
std::string title
#define EVENGINE_API_ORCHESTRATION
Definition Export.h:111
std::string layout
std::uint32_t height
std::uint32_t width
std::vector< std::int32_t > order
uint8_t * pixels
bool visible
uint32_t index
const VegetationPresetContext & context
Move-only operation result carrying either a value or Status.
Definition Result.h:155
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:314
Simple editor chrome regions: left / right / top / bottom / center.
Definition EditorDock.h:11
Shared semantic focus service for docked editor and game HUD surfaces.
Channelled selection/focus state shared by editor and in-game presentations.
Composition model shared by project-specific developer and runtime editors.
std::uint64_t getRevision() const
Monotonic structural revision for cheap ViewModel synchronization.
const std::string & getMode() const
Current project-defined mode.
int getPanelCount() const
Number of registered panels in deterministic region/order/id order.
const std::string & getId() const
Stable project-defined workspace id.
const std::string & getActivePanel() const
Active panel id, or an empty string.
const std::string & getTitle() const
User-facing workspace title.
SelectionDomain
SelectionDomain public API.
WorkspaceRegion
Supported semantic dock regions for UI-neutral workspace panels.
std::string_view workspaceRegionName(WorkspaceRegion region)
Return the stable serialized name for a workspace region.
SelectionItem public API.
UI-neutral description of one composable editor panel.