Add editor panel content host contract
This commit is contained in:
88
new_editor/include/XCEditor/Core/UIEditorPanelContentHost.h
Normal file
88
new_editor/include/XCEditor/Core/UIEditorPanelContentHost.h
Normal file
@@ -0,0 +1,88 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorPanelRegistry.h>
|
||||
#include <XCEditor/Widgets/UIEditorDockHost.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine::UI::Editor {
|
||||
|
||||
enum class UIEditorPanelContentHostEventKind : std::uint8_t {
|
||||
Mounted = 0,
|
||||
Unmounted,
|
||||
BoundsChanged
|
||||
};
|
||||
|
||||
std::string_view GetUIEditorPanelContentHostEventKindName(
|
||||
UIEditorPanelContentHostEventKind kind);
|
||||
|
||||
bool IsUIEditorPanelPresentationExternallyHosted(UIEditorPanelPresentationKind kind);
|
||||
|
||||
struct UIEditorPanelContentHostBinding {
|
||||
std::string panelId = {};
|
||||
UIEditorPanelPresentationKind kind = UIEditorPanelPresentationKind::Placeholder;
|
||||
};
|
||||
|
||||
struct UIEditorPanelContentHostMountRequest {
|
||||
std::string panelId = {};
|
||||
UIEditorPanelPresentationKind kind = UIEditorPanelPresentationKind::Placeholder;
|
||||
::XCEngine::UI::UIRect bounds = {};
|
||||
};
|
||||
|
||||
struct UIEditorPanelContentHostRequest {
|
||||
std::vector<UIEditorPanelContentHostMountRequest> mountRequests = {};
|
||||
};
|
||||
|
||||
struct UIEditorPanelContentHostPanelState {
|
||||
std::string panelId = {};
|
||||
UIEditorPanelPresentationKind kind = UIEditorPanelPresentationKind::Placeholder;
|
||||
bool mounted = false;
|
||||
::XCEngine::UI::UIRect bounds = {};
|
||||
};
|
||||
|
||||
struct UIEditorPanelContentHostState {
|
||||
std::vector<UIEditorPanelContentHostPanelState> panelStates = {};
|
||||
};
|
||||
|
||||
struct UIEditorPanelContentHostEvent {
|
||||
UIEditorPanelContentHostEventKind kind = UIEditorPanelContentHostEventKind::Mounted;
|
||||
std::string panelId = {};
|
||||
UIEditorPanelPresentationKind presentationKind = UIEditorPanelPresentationKind::Placeholder;
|
||||
::XCEngine::UI::UIRect bounds = {};
|
||||
};
|
||||
|
||||
struct UIEditorPanelContentHostFrame {
|
||||
std::vector<UIEditorPanelContentHostPanelState> panelStates = {};
|
||||
std::vector<UIEditorPanelContentHostEvent> events = {};
|
||||
};
|
||||
|
||||
const UIEditorPanelContentHostMountRequest* FindUIEditorPanelContentHostMountRequest(
|
||||
const UIEditorPanelContentHostRequest& request,
|
||||
std::string_view panelId);
|
||||
|
||||
const UIEditorPanelContentHostPanelState* FindUIEditorPanelContentHostPanelState(
|
||||
const UIEditorPanelContentHostState& state,
|
||||
std::string_view panelId);
|
||||
|
||||
const UIEditorPanelContentHostPanelState* FindUIEditorPanelContentHostPanelState(
|
||||
const UIEditorPanelContentHostFrame& frame,
|
||||
std::string_view panelId);
|
||||
|
||||
UIEditorPanelContentHostRequest ResolveUIEditorPanelContentHostRequest(
|
||||
const Widgets::UIEditorDockHostLayout& dockHostLayout,
|
||||
const UIEditorPanelRegistry& panelRegistry,
|
||||
const std::vector<UIEditorPanelContentHostBinding>& bindings);
|
||||
|
||||
UIEditorPanelContentHostFrame UpdateUIEditorPanelContentHost(
|
||||
UIEditorPanelContentHostState& state,
|
||||
const UIEditorPanelContentHostRequest& request,
|
||||
const UIEditorPanelRegistry& panelRegistry,
|
||||
const std::vector<UIEditorPanelContentHostBinding>& bindings);
|
||||
|
||||
std::vector<std::string> CollectMountedUIEditorPanelContentHostPanelIds(
|
||||
const UIEditorPanelContentHostFrame& frame);
|
||||
|
||||
} // namespace XCEngine::UI::Editor
|
||||
@@ -9,7 +9,8 @@ namespace XCEngine::UI::Editor {
|
||||
|
||||
enum class UIEditorPanelPresentationKind : std::uint8_t {
|
||||
Placeholder = 0,
|
||||
ViewportShell
|
||||
ViewportShell,
|
||||
HostedContent
|
||||
};
|
||||
|
||||
struct UIEditorPanelDescriptor {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorPanelContentHost.h>
|
||||
#include <XCEditor/Core/UIEditorPanelRegistry.h>
|
||||
#include <XCEditor/Core/UIEditorViewportShell.h>
|
||||
#include <XCEditor/Core/UIEditorWorkspaceSession.h>
|
||||
@@ -25,6 +26,7 @@ struct UIEditorWorkspacePanelPresentationState {
|
||||
};
|
||||
|
||||
struct UIEditorWorkspaceComposeState {
|
||||
UIEditorPanelContentHostState contentHostState = {};
|
||||
std::vector<UIEditorWorkspacePanelPresentationState> panelStates = {};
|
||||
};
|
||||
|
||||
@@ -36,6 +38,7 @@ struct UIEditorWorkspaceViewportComposeRequest {
|
||||
|
||||
struct UIEditorWorkspaceComposeRequest {
|
||||
Widgets::UIEditorDockHostLayout dockHostLayout = {};
|
||||
UIEditorPanelContentHostRequest contentHostRequest = {};
|
||||
std::vector<UIEditorWorkspaceViewportComposeRequest> viewportRequests = {};
|
||||
};
|
||||
|
||||
@@ -48,6 +51,7 @@ struct UIEditorWorkspaceViewportComposeFrame {
|
||||
|
||||
struct UIEditorWorkspaceComposeFrame {
|
||||
Widgets::UIEditorDockHostLayout dockHostLayout = {};
|
||||
UIEditorPanelContentHostFrame contentHostFrame = {};
|
||||
std::vector<UIEditorWorkspaceViewportComposeFrame> viewportFrames = {};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user