213 lines
7.3 KiB
C++
213 lines
7.3 KiB
C++
#pragma once
|
|
|
|
#include <XCEditor/Shell/UIEditorPanelRegistry.h>
|
|
#include <XCEditor/Shell/UIEditorWorkspaceModel.h>
|
|
#include <XCEditor/Shell/UIEditorWorkspaceSession.h>
|
|
#include <XCEditor/Shell/UIEditorPanelFrame.h>
|
|
#include <XCEditor/Collections/UIEditorTabStrip.h>
|
|
|
|
#include <XCEngine/UI/Layout/UISplitterLayout.h>
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
namespace XCEngine::UI::Editor::Widgets {
|
|
|
|
enum class UIEditorDockHostHitTargetKind : std::uint8_t {
|
|
None = 0,
|
|
SplitterHandle,
|
|
TabStripBackground,
|
|
Tab,
|
|
TabCloseButton,
|
|
PanelHeader,
|
|
PanelBody,
|
|
PanelFooter,
|
|
PanelCloseButton
|
|
};
|
|
|
|
struct UIEditorDockHostHitTarget {
|
|
UIEditorDockHostHitTargetKind kind = UIEditorDockHostHitTargetKind::None;
|
|
std::string nodeId = {};
|
|
std::string panelId = {};
|
|
std::size_t index = UIEditorTabStripInvalidIndex;
|
|
};
|
|
|
|
struct UIEditorDockHostTabStripVisualState {
|
|
std::string nodeId = {};
|
|
UIEditorTabStripState state = {};
|
|
};
|
|
|
|
struct UIEditorDockHostDropPreviewState {
|
|
bool visible = false;
|
|
std::string sourceNodeId = {};
|
|
std::string sourcePanelId = {};
|
|
std::string targetNodeId = {};
|
|
UIEditorWorkspaceDockPlacement placement =
|
|
UIEditorWorkspaceDockPlacement::Center;
|
|
std::size_t insertionIndex = UIEditorTabStripInvalidIndex;
|
|
};
|
|
|
|
struct UIEditorDockHostState {
|
|
bool focused = false;
|
|
UIEditorDockHostHitTarget hoveredTarget = {};
|
|
std::string activeSplitterNodeId = {};
|
|
std::vector<UIEditorDockHostTabStripVisualState> tabStripStates = {};
|
|
UIEditorDockHostDropPreviewState dropPreview = {};
|
|
};
|
|
|
|
struct UIEditorDockHostMetrics {
|
|
::XCEngine::UI::Layout::UISplitterMetrics splitterMetrics =
|
|
::XCEngine::UI::Layout::UISplitterMetrics{ 2.0f, 10.0f };
|
|
UIEditorTabStripMetrics tabStripMetrics = {};
|
|
UIEditorPanelFrameMetrics panelFrameMetrics = {};
|
|
::XCEngine::UI::UISize minimumStandalonePanelBodySize =
|
|
::XCEngine::UI::UISize(180.0f, 140.0f);
|
|
::XCEngine::UI::UISize minimumTabContentBodySize =
|
|
::XCEngine::UI::UISize(260.0f, 180.0f);
|
|
float splitterHandleRounding = 0.0f;
|
|
float placeholderLineGap = 22.0f;
|
|
};
|
|
|
|
struct UIEditorDockHostPalette {
|
|
UIEditorTabStripPalette tabStripPalette = {};
|
|
UIEditorPanelFramePalette panelFramePalette = {};
|
|
::XCEngine::UI::UIColor splitterColor =
|
|
::XCEngine::UI::UIColor(0.13f, 0.13f, 0.13f, 1.0f);
|
|
::XCEngine::UI::UIColor splitterHoveredColor =
|
|
::XCEngine::UI::UIColor(0.13f, 0.13f, 0.13f, 1.0f);
|
|
::XCEngine::UI::UIColor splitterActiveColor =
|
|
::XCEngine::UI::UIColor(0.13f, 0.13f, 0.13f, 1.0f);
|
|
::XCEngine::UI::UIColor placeholderTitleColor =
|
|
::XCEngine::UI::UIColor(0.93f, 0.94f, 0.96f, 1.0f);
|
|
::XCEngine::UI::UIColor placeholderTextColor =
|
|
::XCEngine::UI::UIColor(0.70f, 0.72f, 0.74f, 1.0f);
|
|
::XCEngine::UI::UIColor placeholderMutedColor =
|
|
::XCEngine::UI::UIColor(0.58f, 0.59f, 0.62f, 1.0f);
|
|
::XCEngine::UI::UIColor dropPreviewFillColor =
|
|
::XCEngine::UI::UIColor(0.88f, 0.88f, 0.88f, 0.14f);
|
|
::XCEngine::UI::UIColor dropPreviewBorderColor =
|
|
::XCEngine::UI::UIColor(0.94f, 0.94f, 0.94f, 0.78f);
|
|
};
|
|
|
|
struct UIEditorDockHostTabItemLayout {
|
|
std::string panelId = {};
|
|
std::string title = {};
|
|
bool closable = true;
|
|
bool active = false;
|
|
};
|
|
|
|
struct UIEditorDockHostSplitterLayout {
|
|
std::string nodeId = {};
|
|
UIEditorWorkspaceSplitAxis axis = UIEditorWorkspaceSplitAxis::Horizontal;
|
|
::XCEngine::UI::UIRect bounds = {};
|
|
::XCEngine::UI::UIRect handleHitRect = {};
|
|
::XCEngine::UI::Layout::UISplitterConstraints constraints = {};
|
|
::XCEngine::UI::Layout::UISplitterMetrics metrics = {};
|
|
::XCEngine::UI::Layout::UISplitterLayoutResult splitterLayout = {};
|
|
bool hovered = false;
|
|
bool active = false;
|
|
};
|
|
|
|
struct UIEditorDockHostTabStackLayout {
|
|
std::string nodeId = {};
|
|
std::string selectedPanelId = {};
|
|
::XCEngine::UI::UIRect bounds = {};
|
|
std::vector<UIEditorDockHostTabItemLayout> items = {};
|
|
UIEditorTabStripState tabStripState = {};
|
|
UIEditorTabStripLayout tabStripLayout = {};
|
|
UIEditorPanelFrameState contentFrameState = {};
|
|
UIEditorPanelFrameLayout contentFrameLayout = {};
|
|
};
|
|
|
|
struct UIEditorDockHostDropPreviewLayout {
|
|
bool visible = false;
|
|
std::string targetNodeId = {};
|
|
UIEditorWorkspaceDockPlacement placement =
|
|
UIEditorWorkspaceDockPlacement::Center;
|
|
std::size_t insertionIndex = UIEditorTabStripInvalidIndex;
|
|
::XCEngine::UI::UIRect previewRect = {};
|
|
};
|
|
|
|
struct UIEditorDockHostLayout {
|
|
::XCEngine::UI::UIRect bounds = {};
|
|
std::vector<UIEditorDockHostSplitterLayout> splitters = {};
|
|
std::vector<UIEditorDockHostTabStackLayout> tabStacks = {};
|
|
UIEditorDockHostDropPreviewLayout dropPreview = {};
|
|
};
|
|
|
|
enum class UIEditorDockHostCursorKind : std::uint8_t {
|
|
Arrow = 0,
|
|
ResizeEW,
|
|
ResizeNS
|
|
};
|
|
|
|
// Allows higher-level compose to own panel body presentation while DockHost
|
|
// keeps drawing the surrounding chrome/frame.
|
|
struct UIEditorDockHostForegroundOptions {
|
|
std::vector<std::string> externalBodyPanelIds = {};
|
|
};
|
|
|
|
const UIEditorDockHostSplitterLayout* FindUIEditorDockHostSplitterLayout(
|
|
const UIEditorDockHostLayout& layout,
|
|
std::string_view nodeId);
|
|
|
|
UIEditorDockHostCursorKind ResolveUIEditorDockHostCursorKind(
|
|
const UIEditorDockHostLayout& layout);
|
|
|
|
UIEditorDockHostLayout BuildUIEditorDockHostLayout(
|
|
const ::XCEngine::UI::UIRect& bounds,
|
|
const UIEditorPanelRegistry& panelRegistry,
|
|
const UIEditorWorkspaceModel& workspace,
|
|
const UIEditorWorkspaceSession& session,
|
|
const UIEditorDockHostState& state = {},
|
|
const UIEditorDockHostMetrics& metrics = {});
|
|
|
|
UIEditorDockHostHitTarget HitTestUIEditorDockHost(
|
|
const UIEditorDockHostLayout& layout,
|
|
const ::XCEngine::UI::UIPoint& point);
|
|
|
|
void AppendUIEditorDockHostBackground(
|
|
::XCEngine::UI::UIDrawList& drawList,
|
|
const UIEditorDockHostLayout& layout,
|
|
const UIEditorDockHostPalette& palette = {},
|
|
const UIEditorDockHostMetrics& metrics = {});
|
|
|
|
void AppendUIEditorDockHostForeground(
|
|
::XCEngine::UI::UIDrawList& drawList,
|
|
const UIEditorDockHostLayout& layout,
|
|
const UIEditorDockHostForegroundOptions& options = {},
|
|
const UIEditorDockHostPalette& palette = {},
|
|
const UIEditorDockHostMetrics& metrics = {});
|
|
|
|
void AppendUIEditorDockHostForeground(
|
|
::XCEngine::UI::UIDrawList& drawList,
|
|
const UIEditorDockHostLayout& layout,
|
|
const UIEditorDockHostPalette& palette,
|
|
const UIEditorDockHostMetrics& metrics = {});
|
|
|
|
void AppendUIEditorDockHost(
|
|
::XCEngine::UI::UIDrawList& drawList,
|
|
const ::XCEngine::UI::UIRect& bounds,
|
|
const UIEditorPanelRegistry& panelRegistry,
|
|
const UIEditorWorkspaceModel& workspace,
|
|
const UIEditorWorkspaceSession& session,
|
|
const UIEditorDockHostState& state = {},
|
|
const UIEditorDockHostForegroundOptions& foregroundOptions = {},
|
|
const UIEditorDockHostPalette& palette = {},
|
|
const UIEditorDockHostMetrics& metrics = {});
|
|
|
|
void AppendUIEditorDockHost(
|
|
::XCEngine::UI::UIDrawList& drawList,
|
|
const ::XCEngine::UI::UIRect& bounds,
|
|
const UIEditorPanelRegistry& panelRegistry,
|
|
const UIEditorWorkspaceModel& workspace,
|
|
const UIEditorWorkspaceSession& session,
|
|
const UIEditorDockHostState& state,
|
|
const UIEditorDockHostPalette& palette,
|
|
const UIEditorDockHostMetrics& metrics = {});
|
|
|
|
} // namespace XCEngine::UI::Editor::Widgets
|