Refactor XCUI editor module layout
This commit is contained in:
160
new_editor/include/XCEditor/Shell/UIEditorPanelFrame.h
Normal file
160
new_editor/include/XCEditor/Shell/UIEditorPanelFrame.h
Normal file
@@ -0,0 +1,160 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string_view>
|
||||
|
||||
namespace XCEngine::UI::Editor::Widgets {
|
||||
|
||||
enum class UIEditorPanelFrameAction : std::uint8_t {
|
||||
None = 0,
|
||||
Pin,
|
||||
Close
|
||||
};
|
||||
|
||||
enum class UIEditorPanelFrameHitTarget : std::uint8_t {
|
||||
None = 0,
|
||||
Header,
|
||||
Body,
|
||||
Footer,
|
||||
PinButton,
|
||||
CloseButton
|
||||
};
|
||||
|
||||
struct UIEditorPanelFrameState {
|
||||
bool active = false;
|
||||
bool hovered = false;
|
||||
bool focused = false;
|
||||
bool pinned = false;
|
||||
bool closable = true;
|
||||
bool pinnable = true;
|
||||
bool showFooter = false;
|
||||
bool pinHovered = false;
|
||||
bool closeHovered = false;
|
||||
};
|
||||
|
||||
struct UIEditorPanelFrameText {
|
||||
std::string_view title = {};
|
||||
std::string_view subtitle = {};
|
||||
std::string_view footer = {};
|
||||
};
|
||||
|
||||
struct UIEditorPanelFrameMetrics {
|
||||
float cornerRounding = 8.0f;
|
||||
float headerHeight = 36.0f;
|
||||
float footerHeight = 24.0f;
|
||||
float contentPadding = 12.0f;
|
||||
float titleInsetX = 14.0f;
|
||||
float titleInsetY = 9.0f;
|
||||
float subtitleInsetY = 22.0f;
|
||||
float footerInsetX = 14.0f;
|
||||
float footerInsetY = 6.0f;
|
||||
float actionButtonExtent = 18.0f;
|
||||
float actionInsetX = 12.0f;
|
||||
float actionGap = 6.0f;
|
||||
float baseBorderThickness = 1.0f;
|
||||
float hoveredBorderThickness = 1.25f;
|
||||
float activeBorderThickness = 1.5f;
|
||||
float focusedBorderThickness = 2.0f;
|
||||
};
|
||||
|
||||
struct UIEditorPanelFramePalette {
|
||||
::XCEngine::UI::UIColor surfaceColor =
|
||||
::XCEngine::UI::UIColor(0.15f, 0.15f, 0.16f, 1.0f);
|
||||
::XCEngine::UI::UIColor headerColor =
|
||||
::XCEngine::UI::UIColor(0.18f, 0.18f, 0.19f, 1.0f);
|
||||
::XCEngine::UI::UIColor footerColor =
|
||||
::XCEngine::UI::UIColor(0.17f, 0.17f, 0.18f, 1.0f);
|
||||
::XCEngine::UI::UIColor borderColor =
|
||||
::XCEngine::UI::UIColor(0.30f, 0.32f, 0.34f, 1.0f);
|
||||
::XCEngine::UI::UIColor hoveredBorderColor =
|
||||
::XCEngine::UI::UIColor(0.39f, 0.41f, 0.43f, 1.0f);
|
||||
::XCEngine::UI::UIColor activeBorderColor =
|
||||
::XCEngine::UI::UIColor(0.50f, 0.52f, 0.56f, 1.0f);
|
||||
::XCEngine::UI::UIColor focusedBorderColor =
|
||||
::XCEngine::UI::UIColor(0.78f, 0.80f, 0.84f, 1.0f);
|
||||
::XCEngine::UI::UIColor textPrimary =
|
||||
::XCEngine::UI::UIColor(0.93f, 0.94f, 0.96f, 1.0f);
|
||||
::XCEngine::UI::UIColor textSecondary =
|
||||
::XCEngine::UI::UIColor(0.70f, 0.72f, 0.74f, 1.0f);
|
||||
::XCEngine::UI::UIColor textMuted =
|
||||
::XCEngine::UI::UIColor(0.58f, 0.59f, 0.62f, 1.0f);
|
||||
::XCEngine::UI::UIColor actionButtonColor =
|
||||
::XCEngine::UI::UIColor(0.21f, 0.22f, 0.24f, 1.0f);
|
||||
::XCEngine::UI::UIColor actionButtonHoveredColor =
|
||||
::XCEngine::UI::UIColor(0.27f, 0.28f, 0.30f, 1.0f);
|
||||
::XCEngine::UI::UIColor actionButtonSelectedColor =
|
||||
::XCEngine::UI::UIColor(0.33f, 0.35f, 0.38f, 1.0f);
|
||||
::XCEngine::UI::UIColor actionButtonBorderColor =
|
||||
::XCEngine::UI::UIColor(0.42f, 0.44f, 0.47f, 1.0f);
|
||||
::XCEngine::UI::UIColor actionGlyphColor =
|
||||
::XCEngine::UI::UIColor(0.93f, 0.94f, 0.96f, 1.0f);
|
||||
};
|
||||
|
||||
struct UIEditorPanelFrameLayout {
|
||||
::XCEngine::UI::UIRect frameRect = {};
|
||||
::XCEngine::UI::UIRect headerRect = {};
|
||||
::XCEngine::UI::UIRect bodyRect = {};
|
||||
::XCEngine::UI::UIRect footerRect = {};
|
||||
::XCEngine::UI::UIRect pinButtonRect = {};
|
||||
::XCEngine::UI::UIRect closeButtonRect = {};
|
||||
bool hasFooter = false;
|
||||
bool showPinButton = false;
|
||||
bool showCloseButton = false;
|
||||
};
|
||||
|
||||
bool IsUIEditorPanelFramePointInside(
|
||||
const ::XCEngine::UI::UIRect& rect,
|
||||
const ::XCEngine::UI::UIPoint& point);
|
||||
|
||||
bool IsUIEditorPanelFramePinButtonVisible(const UIEditorPanelFrameState& state);
|
||||
bool IsUIEditorPanelFrameCloseButtonVisible(const UIEditorPanelFrameState& state);
|
||||
|
||||
UIEditorPanelFrameLayout BuildUIEditorPanelFrameLayout(
|
||||
const ::XCEngine::UI::UIRect& frameRect,
|
||||
const UIEditorPanelFrameState& state,
|
||||
const UIEditorPanelFrameMetrics& metrics = {});
|
||||
|
||||
::XCEngine::UI::UIColor ResolveUIEditorPanelFrameBorderColor(
|
||||
const UIEditorPanelFrameState& state,
|
||||
const UIEditorPanelFramePalette& palette = {});
|
||||
|
||||
float ResolveUIEditorPanelFrameBorderThickness(
|
||||
const UIEditorPanelFrameState& state,
|
||||
const UIEditorPanelFrameMetrics& metrics = {});
|
||||
|
||||
UIEditorPanelFrameAction HitTestUIEditorPanelFrameAction(
|
||||
const UIEditorPanelFrameLayout& layout,
|
||||
const UIEditorPanelFrameState& state,
|
||||
const ::XCEngine::UI::UIPoint& point);
|
||||
|
||||
UIEditorPanelFrameHitTarget HitTestUIEditorPanelFrame(
|
||||
const UIEditorPanelFrameLayout& layout,
|
||||
const UIEditorPanelFrameState& state,
|
||||
const ::XCEngine::UI::UIPoint& point);
|
||||
|
||||
void AppendUIEditorPanelFrameBackground(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const UIEditorPanelFrameLayout& layout,
|
||||
const UIEditorPanelFrameState& state,
|
||||
const UIEditorPanelFramePalette& palette = {},
|
||||
const UIEditorPanelFrameMetrics& metrics = {});
|
||||
|
||||
void AppendUIEditorPanelFrameForeground(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const UIEditorPanelFrameLayout& layout,
|
||||
const UIEditorPanelFrameState& state,
|
||||
const UIEditorPanelFrameText& text,
|
||||
const UIEditorPanelFramePalette& palette = {},
|
||||
const UIEditorPanelFrameMetrics& metrics = {});
|
||||
|
||||
void AppendUIEditorPanelFrame(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const ::XCEngine::UI::UIRect& frameRect,
|
||||
const UIEditorPanelFrameState& state,
|
||||
const UIEditorPanelFrameText& text,
|
||||
const UIEditorPanelFramePalette& palette = {},
|
||||
const UIEditorPanelFrameMetrics& metrics = {});
|
||||
|
||||
} // namespace XCEngine::UI::Editor::Widgets
|
||||
Reference in New Issue
Block a user