Build XCEditor viewport slot shell foundation
This commit is contained in:
203
new_editor/include/XCEditor/Widgets/UIEditorViewportSlot.h
Normal file
203
new_editor/include/XCEditor/Widgets/UIEditorViewportSlot.h
Normal file
@@ -0,0 +1,203 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
#include <XCEditor/Widgets/UIEditorStatusBar.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine::UI::Editor::Widgets {
|
||||
|
||||
inline constexpr std::size_t UIEditorViewportSlotInvalidIndex =
|
||||
static_cast<std::size_t>(-1);
|
||||
|
||||
enum class UIEditorViewportSlotToolSlot : std::uint8_t {
|
||||
Leading = 0,
|
||||
Trailing
|
||||
};
|
||||
|
||||
enum class UIEditorViewportSlotHitTargetKind : std::uint8_t {
|
||||
None = 0,
|
||||
TopBar,
|
||||
Title,
|
||||
ToolItem,
|
||||
Surface,
|
||||
BottomBar,
|
||||
StatusSegment,
|
||||
StatusSeparator
|
||||
};
|
||||
|
||||
struct UIEditorViewportSlotFrame {
|
||||
::XCEngine::UI::UITextureHandle texture = {};
|
||||
::XCEngine::UI::UISize requestedSize = {};
|
||||
::XCEngine::UI::UISize presentedSize = {};
|
||||
bool hasTexture = false;
|
||||
std::string statusText = {};
|
||||
};
|
||||
|
||||
struct UIEditorViewportSlotChrome {
|
||||
std::string_view title = {};
|
||||
std::string_view subtitle = {};
|
||||
bool showTopBar = true;
|
||||
bool showBottomBar = true;
|
||||
float topBarHeight = 40.0f;
|
||||
float bottomBarHeight = 28.0f;
|
||||
};
|
||||
|
||||
struct UIEditorViewportSlotToolItem {
|
||||
std::string itemId = {};
|
||||
std::string label = {};
|
||||
UIEditorViewportSlotToolSlot slot = UIEditorViewportSlotToolSlot::Trailing;
|
||||
bool enabled = true;
|
||||
bool selected = false;
|
||||
float desiredWidth = 0.0f;
|
||||
};
|
||||
|
||||
struct UIEditorViewportSlotState {
|
||||
bool focused = false;
|
||||
bool surfaceHovered = false;
|
||||
bool surfaceActive = false;
|
||||
bool inputCaptured = false;
|
||||
std::size_t hoveredToolIndex = UIEditorViewportSlotInvalidIndex;
|
||||
std::size_t activeToolIndex = UIEditorViewportSlotInvalidIndex;
|
||||
UIEditorStatusBarState statusBarState = {};
|
||||
};
|
||||
|
||||
struct UIEditorViewportSlotMetrics {
|
||||
float cornerRounding = 10.0f;
|
||||
float outerBorderThickness = 1.0f;
|
||||
float focusedBorderThickness = 1.5f;
|
||||
float topBarPaddingX = 12.0f;
|
||||
float topBarPaddingY = 7.0f;
|
||||
float toolPaddingX = 10.0f;
|
||||
float toolGap = 6.0f;
|
||||
float toolCornerRounding = 6.0f;
|
||||
float titleGap = 10.0f;
|
||||
float titleInsetY = 10.0f;
|
||||
float subtitleInsetY = 25.0f;
|
||||
float estimatedGlyphWidth = 7.0f;
|
||||
float surfaceInset = 0.0f;
|
||||
float surfaceBorderThickness = 1.0f;
|
||||
float focusedSurfaceBorderThickness = 1.5f;
|
||||
};
|
||||
|
||||
struct UIEditorViewportSlotPalette {
|
||||
::XCEngine::UI::UIColor frameColor =
|
||||
::XCEngine::UI::UIColor(0.14f, 0.14f, 0.14f, 1.0f);
|
||||
::XCEngine::UI::UIColor topBarColor =
|
||||
::XCEngine::UI::UIColor(0.18f, 0.18f, 0.18f, 1.0f);
|
||||
::XCEngine::UI::UIColor surfaceColor =
|
||||
::XCEngine::UI::UIColor(0.10f, 0.10f, 0.10f, 1.0f);
|
||||
::XCEngine::UI::UIColor surfaceHoverOverlayColor =
|
||||
::XCEngine::UI::UIColor(0.22f, 0.22f, 0.22f, 0.24f);
|
||||
::XCEngine::UI::UIColor surfaceActiveOverlayColor =
|
||||
::XCEngine::UI::UIColor(0.34f, 0.34f, 0.34f, 0.18f);
|
||||
::XCEngine::UI::UIColor captureOverlayColor =
|
||||
::XCEngine::UI::UIColor(0.70f, 0.70f, 0.70f, 0.10f);
|
||||
::XCEngine::UI::UIColor borderColor =
|
||||
::XCEngine::UI::UIColor(0.28f, 0.28f, 0.28f, 1.0f);
|
||||
::XCEngine::UI::UIColor focusedBorderColor =
|
||||
::XCEngine::UI::UIColor(0.84f, 0.84f, 0.84f, 1.0f);
|
||||
::XCEngine::UI::UIColor surfaceBorderColor =
|
||||
::XCEngine::UI::UIColor(0.22f, 0.22f, 0.22f, 1.0f);
|
||||
::XCEngine::UI::UIColor surfaceHoveredBorderColor =
|
||||
::XCEngine::UI::UIColor(0.44f, 0.44f, 0.44f, 1.0f);
|
||||
::XCEngine::UI::UIColor surfaceActiveBorderColor =
|
||||
::XCEngine::UI::UIColor(0.64f, 0.64f, 0.64f, 1.0f);
|
||||
::XCEngine::UI::UIColor surfaceCapturedBorderColor =
|
||||
::XCEngine::UI::UIColor(0.86f, 0.86f, 0.86f, 1.0f);
|
||||
::XCEngine::UI::UIColor toolColor =
|
||||
::XCEngine::UI::UIColor(0.24f, 0.24f, 0.24f, 1.0f);
|
||||
::XCEngine::UI::UIColor toolHoveredColor =
|
||||
::XCEngine::UI::UIColor(0.31f, 0.31f, 0.31f, 1.0f);
|
||||
::XCEngine::UI::UIColor toolSelectedColor =
|
||||
::XCEngine::UI::UIColor(0.39f, 0.39f, 0.39f, 1.0f);
|
||||
::XCEngine::UI::UIColor toolDisabledColor =
|
||||
::XCEngine::UI::UIColor(0.19f, 0.19f, 0.19f, 1.0f);
|
||||
::XCEngine::UI::UIColor toolBorderColor =
|
||||
::XCEngine::UI::UIColor(0.40f, 0.40f, 0.40f, 1.0f);
|
||||
::XCEngine::UI::UIColor textPrimary =
|
||||
::XCEngine::UI::UIColor(0.94f, 0.94f, 0.94f, 1.0f);
|
||||
::XCEngine::UI::UIColor textSecondary =
|
||||
::XCEngine::UI::UIColor(0.76f, 0.76f, 0.76f, 1.0f);
|
||||
::XCEngine::UI::UIColor textMuted =
|
||||
::XCEngine::UI::UIColor(0.62f, 0.62f, 0.62f, 1.0f);
|
||||
::XCEngine::UI::UIColor imageTint =
|
||||
::XCEngine::UI::UIColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
UIEditorStatusBarPalette statusBarPalette = {};
|
||||
};
|
||||
|
||||
struct UIEditorViewportSlotLayout {
|
||||
::XCEngine::UI::UIRect bounds = {};
|
||||
::XCEngine::UI::UIRect topBarRect = {};
|
||||
::XCEngine::UI::UIRect titleRect = {};
|
||||
::XCEngine::UI::UIRect subtitleRect = {};
|
||||
::XCEngine::UI::UIRect toolbarLeadingRect = {};
|
||||
::XCEngine::UI::UIRect toolbarTrailingRect = {};
|
||||
::XCEngine::UI::UIRect surfaceRect = {};
|
||||
::XCEngine::UI::UIRect textureRect = {};
|
||||
::XCEngine::UI::UIRect inputRect = {};
|
||||
::XCEngine::UI::UIRect bottomBarRect = {};
|
||||
std::vector<::XCEngine::UI::UIRect> toolItemRects = {};
|
||||
UIEditorStatusBarLayout statusBarLayout = {};
|
||||
::XCEngine::UI::UISize requestedSurfaceSize = {};
|
||||
bool hasTopBar = false;
|
||||
bool hasBottomBar = false;
|
||||
};
|
||||
|
||||
struct UIEditorViewportSlotHitTarget {
|
||||
UIEditorViewportSlotHitTargetKind kind = UIEditorViewportSlotHitTargetKind::None;
|
||||
std::size_t index = UIEditorViewportSlotInvalidIndex;
|
||||
};
|
||||
|
||||
float ResolveUIEditorViewportSlotDesiredToolWidth(
|
||||
const UIEditorViewportSlotToolItem& item,
|
||||
const UIEditorViewportSlotMetrics& metrics = {});
|
||||
|
||||
UIEditorViewportSlotLayout BuildUIEditorViewportSlotLayout(
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
const UIEditorViewportSlotChrome& chrome,
|
||||
const UIEditorViewportSlotFrame& frame,
|
||||
const std::vector<UIEditorViewportSlotToolItem>& toolItems,
|
||||
const std::vector<UIEditorStatusBarSegment>& statusSegments,
|
||||
const UIEditorViewportSlotMetrics& metrics = {});
|
||||
|
||||
UIEditorViewportSlotHitTarget HitTestUIEditorViewportSlot(
|
||||
const UIEditorViewportSlotLayout& layout,
|
||||
const ::XCEngine::UI::UIPoint& point);
|
||||
|
||||
void AppendUIEditorViewportSlotBackground(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const UIEditorViewportSlotLayout& layout,
|
||||
const std::vector<UIEditorViewportSlotToolItem>& toolItems,
|
||||
const std::vector<UIEditorStatusBarSegment>& statusSegments,
|
||||
const UIEditorViewportSlotState& state,
|
||||
const UIEditorViewportSlotPalette& palette = {},
|
||||
const UIEditorViewportSlotMetrics& metrics = {});
|
||||
|
||||
void AppendUIEditorViewportSlotForeground(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const UIEditorViewportSlotLayout& layout,
|
||||
const UIEditorViewportSlotChrome& chrome,
|
||||
const UIEditorViewportSlotFrame& frame,
|
||||
const std::vector<UIEditorViewportSlotToolItem>& toolItems,
|
||||
const std::vector<UIEditorStatusBarSegment>& statusSegments,
|
||||
const UIEditorViewportSlotState& state,
|
||||
const UIEditorViewportSlotPalette& palette = {},
|
||||
const UIEditorViewportSlotMetrics& metrics = {});
|
||||
|
||||
void AppendUIEditorViewportSlot(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
const UIEditorViewportSlotChrome& chrome,
|
||||
const UIEditorViewportSlotFrame& frame,
|
||||
const std::vector<UIEditorViewportSlotToolItem>& toolItems,
|
||||
const std::vector<UIEditorStatusBarSegment>& statusSegments,
|
||||
const UIEditorViewportSlotState& state,
|
||||
const UIEditorViewportSlotPalette& palette = {},
|
||||
const UIEditorViewportSlotMetrics& metrics = {});
|
||||
|
||||
} // namespace XCEngine::UI::Editor::Widgets
|
||||
Reference in New Issue
Block a user