Refactor XCUI editor module layout
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Fields/UIEditorTextFieldInteraction.h>
|
||||
|
||||
#include <XCEngine/UI/Types.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine::UI::Editor {
|
||||
|
||||
struct UIEditorInlineRenameSessionState {
|
||||
bool active = false;
|
||||
std::string itemId = {};
|
||||
Widgets::UIEditorTextFieldSpec textFieldSpec = {};
|
||||
UIEditorTextFieldInteractionState textFieldInteraction = {};
|
||||
};
|
||||
|
||||
struct UIEditorInlineRenameSessionRequest {
|
||||
bool beginSession = false;
|
||||
std::string itemId = {};
|
||||
std::string initialText = {};
|
||||
::XCEngine::UI::UIRect bounds = {};
|
||||
};
|
||||
|
||||
struct UIEditorInlineRenameSessionResult {
|
||||
bool consumed = false;
|
||||
bool sessionStarted = false;
|
||||
bool sessionCommitted = false;
|
||||
bool sessionCanceled = false;
|
||||
bool valueChanged = false;
|
||||
bool active = false;
|
||||
std::string itemId = {};
|
||||
std::string valueBefore = {};
|
||||
std::string valueAfter = {};
|
||||
UIEditorTextFieldInteractionResult textFieldResult = {};
|
||||
};
|
||||
|
||||
struct UIEditorInlineRenameSessionFrame {
|
||||
Widgets::UIEditorTextFieldLayout layout = {};
|
||||
UIEditorInlineRenameSessionResult result = {};
|
||||
};
|
||||
|
||||
Widgets::UIEditorTextFieldMetrics BuildUIEditorInlineRenameTextFieldMetrics(
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
const Widgets::UIEditorTextFieldMetrics& metrics = {});
|
||||
|
||||
UIEditorInlineRenameSessionFrame UpdateUIEditorInlineRenameSession(
|
||||
UIEditorInlineRenameSessionState& state,
|
||||
const UIEditorInlineRenameSessionRequest& request,
|
||||
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents,
|
||||
const Widgets::UIEditorTextFieldMetrics& metrics = {});
|
||||
|
||||
} // namespace XCEngine::UI::Editor
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Widgets/UIEditorListView.h>
|
||||
#include <XCEditor/Collections/UIEditorListView.h>
|
||||
|
||||
#include <XCEngine/UI/Types.h>
|
||||
#include <XCEngine/UI/Widgets/UIKeyboardNavigationModel.h>
|
||||
@@ -14,6 +14,7 @@ namespace XCEngine::UI::Editor {
|
||||
struct UIEditorListViewInteractionState {
|
||||
Widgets::UIEditorListViewState listViewState = {};
|
||||
::XCEngine::UI::Widgets::UIKeyboardNavigationModel keyboardNavigation = {};
|
||||
std::string selectionAnchorId = {};
|
||||
::XCEngine::UI::UIPoint pointerPosition = {};
|
||||
bool hasPointerPosition = false;
|
||||
};
|
||||
@@ -23,8 +24,10 @@ struct UIEditorListViewInteractionResult {
|
||||
bool selectionChanged = false;
|
||||
bool keyboardNavigated = false;
|
||||
bool secondaryClicked = false;
|
||||
bool renameRequested = false;
|
||||
Widgets::UIEditorListViewHitTarget hitTarget = {};
|
||||
std::string selectedItemId = {};
|
||||
std::string renameItemId = {};
|
||||
std::size_t selectedIndex = Widgets::UIEditorListViewInvalidIndex;
|
||||
};
|
||||
|
||||
@@ -25,7 +25,7 @@ struct UIEditorScrollViewMetrics {
|
||||
float scrollbarWidth = 10.0f;
|
||||
float scrollbarInset = 4.0f;
|
||||
float minThumbHeight = 28.0f;
|
||||
float cornerRounding = 6.0f;
|
||||
float cornerRounding = 8.0f;
|
||||
float borderThickness = 1.0f;
|
||||
float focusedBorderThickness = 2.0f;
|
||||
float wheelStep = 48.0f;
|
||||
@@ -33,19 +33,19 @@ struct UIEditorScrollViewMetrics {
|
||||
|
||||
struct UIEditorScrollViewPalette {
|
||||
::XCEngine::UI::UIColor surfaceColor =
|
||||
::XCEngine::UI::UIColor(0.14f, 0.14f, 0.14f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.15f, 0.15f, 0.16f, 1.0f);
|
||||
::XCEngine::UI::UIColor borderColor =
|
||||
::XCEngine::UI::UIColor(0.29f, 0.29f, 0.29f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.30f, 0.32f, 0.34f, 1.0f);
|
||||
::XCEngine::UI::UIColor focusedBorderColor =
|
||||
::XCEngine::UI::UIColor(0.84f, 0.84f, 0.84f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.78f, 0.80f, 0.84f, 1.0f);
|
||||
::XCEngine::UI::UIColor scrollbarTrackColor =
|
||||
::XCEngine::UI::UIColor(0.18f, 0.18f, 0.18f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.19f, 0.19f, 0.21f, 1.0f);
|
||||
::XCEngine::UI::UIColor scrollbarThumbColor =
|
||||
::XCEngine::UI::UIColor(0.31f, 0.31f, 0.31f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.32f, 0.34f, 0.36f, 1.0f);
|
||||
::XCEngine::UI::UIColor scrollbarThumbHoverColor =
|
||||
::XCEngine::UI::UIColor(0.38f, 0.38f, 0.38f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.42f, 0.44f, 0.47f, 1.0f);
|
||||
::XCEngine::UI::UIColor scrollbarThumbActiveColor =
|
||||
::XCEngine::UI::UIColor(0.46f, 0.46f, 0.46f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.50f, 0.52f, 0.56f, 1.0f);
|
||||
};
|
||||
|
||||
struct UIEditorScrollViewLayout {
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Widgets/UIEditorScrollView.h>
|
||||
#include <XCEditor/Collections/UIEditorScrollView.h>
|
||||
|
||||
#include <XCEngine/UI/Types.h>
|
||||
|
||||
@@ -46,41 +46,41 @@ struct UIEditorTabStripMetrics {
|
||||
|
||||
struct UIEditorTabStripPalette {
|
||||
::XCEngine::UI::UIColor stripBackgroundColor =
|
||||
::XCEngine::UI::UIColor(0.17f, 0.17f, 0.17f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.15f, 0.15f, 0.16f, 1.0f);
|
||||
::XCEngine::UI::UIColor headerBackgroundColor =
|
||||
::XCEngine::UI::UIColor(0.20f, 0.20f, 0.20f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.18f, 0.18f, 0.19f, 1.0f);
|
||||
::XCEngine::UI::UIColor contentBackgroundColor =
|
||||
::XCEngine::UI::UIColor(0.21f, 0.21f, 0.21f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.15f, 0.15f, 0.16f, 1.0f);
|
||||
::XCEngine::UI::UIColor stripBorderColor =
|
||||
::XCEngine::UI::UIColor(0.30f, 0.30f, 0.30f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.30f, 0.32f, 0.34f, 1.0f);
|
||||
::XCEngine::UI::UIColor focusedBorderColor =
|
||||
::XCEngine::UI::UIColor(0.86f, 0.86f, 0.86f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.78f, 0.80f, 0.84f, 1.0f);
|
||||
::XCEngine::UI::UIColor tabColor =
|
||||
::XCEngine::UI::UIColor(0.23f, 0.23f, 0.23f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.21f, 0.22f, 0.24f, 1.0f);
|
||||
::XCEngine::UI::UIColor tabHoveredColor =
|
||||
::XCEngine::UI::UIColor(0.27f, 0.27f, 0.27f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.27f, 0.28f, 0.30f, 1.0f);
|
||||
::XCEngine::UI::UIColor tabSelectedColor =
|
||||
::XCEngine::UI::UIColor(0.29f, 0.29f, 0.29f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.33f, 0.35f, 0.38f, 1.0f);
|
||||
::XCEngine::UI::UIColor tabBorderColor =
|
||||
::XCEngine::UI::UIColor(0.32f, 0.32f, 0.32f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.32f, 0.34f, 0.36f, 1.0f);
|
||||
::XCEngine::UI::UIColor tabHoveredBorderColor =
|
||||
::XCEngine::UI::UIColor(0.46f, 0.46f, 0.46f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.42f, 0.44f, 0.47f, 1.0f);
|
||||
::XCEngine::UI::UIColor tabSelectedBorderColor =
|
||||
::XCEngine::UI::UIColor(0.72f, 0.72f, 0.72f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.50f, 0.52f, 0.56f, 1.0f);
|
||||
::XCEngine::UI::UIColor textPrimary =
|
||||
::XCEngine::UI::UIColor(0.94f, 0.94f, 0.94f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.93f, 0.94f, 0.96f, 1.0f);
|
||||
::XCEngine::UI::UIColor textSecondary =
|
||||
::XCEngine::UI::UIColor(0.76f, 0.76f, 0.76f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.70f, 0.72f, 0.74f, 1.0f);
|
||||
::XCEngine::UI::UIColor textMuted =
|
||||
::XCEngine::UI::UIColor(0.60f, 0.60f, 0.60f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.58f, 0.59f, 0.62f, 1.0f);
|
||||
::XCEngine::UI::UIColor closeButtonColor =
|
||||
::XCEngine::UI::UIColor(0.25f, 0.25f, 0.25f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.21f, 0.22f, 0.24f, 1.0f);
|
||||
::XCEngine::UI::UIColor closeButtonHoveredColor =
|
||||
::XCEngine::UI::UIColor(0.36f, 0.36f, 0.36f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.27f, 0.28f, 0.30f, 1.0f);
|
||||
::XCEngine::UI::UIColor closeButtonBorderColor =
|
||||
::XCEngine::UI::UIColor(0.44f, 0.44f, 0.44f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.42f, 0.44f, 0.47f, 1.0f);
|
||||
::XCEngine::UI::UIColor closeGlyphColor =
|
||||
::XCEngine::UI::UIColor(0.92f, 0.92f, 0.92f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.93f, 0.94f, 0.96f, 1.0f);
|
||||
};
|
||||
|
||||
struct UIEditorTabStripLayout {
|
||||
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Collections/UIEditorTabStrip.h>
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
#include <XCEngine/UI/Widgets/UITabStripModel.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine::UI::Editor {
|
||||
|
||||
struct UIEditorTabStripInteractionState {
|
||||
Widgets::UIEditorTabStripState tabStripState = {};
|
||||
::XCEngine::UI::Widgets::UITabStripModel navigationModel = {};
|
||||
Widgets::UIEditorTabStripHitTarget pressedTarget = {};
|
||||
::XCEngine::UI::UIPoint pointerPosition = {};
|
||||
bool hasPointerPosition = false;
|
||||
};
|
||||
|
||||
struct UIEditorTabStripInteractionResult {
|
||||
bool consumed = false;
|
||||
bool selectionChanged = false;
|
||||
bool closeRequested = false;
|
||||
bool keyboardNavigated = false;
|
||||
Widgets::UIEditorTabStripHitTarget hitTarget = {};
|
||||
std::string selectedTabId = {};
|
||||
std::size_t selectedIndex = Widgets::UIEditorTabStripInvalidIndex;
|
||||
std::string closedTabId = {};
|
||||
std::size_t closedIndex = Widgets::UIEditorTabStripInvalidIndex;
|
||||
};
|
||||
|
||||
struct UIEditorTabStripInteractionFrame {
|
||||
Widgets::UIEditorTabStripLayout layout = {};
|
||||
UIEditorTabStripInteractionResult result = {};
|
||||
bool focused = false;
|
||||
};
|
||||
|
||||
UIEditorTabStripInteractionFrame UpdateUIEditorTabStripInteraction(
|
||||
UIEditorTabStripInteractionState& state,
|
||||
std::string& selectedTabId,
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
const std::vector<Widgets::UIEditorTabStripItem>& items,
|
||||
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents,
|
||||
const Widgets::UIEditorTabStripMetrics& metrics = {});
|
||||
|
||||
} // namespace XCEngine::UI::Editor
|
||||
@@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Widgets/UIEditorTreeView.h>
|
||||
#include <XCEditor/Collections/UIEditorTreeView.h>
|
||||
|
||||
#include <XCEngine/UI/Types.h>
|
||||
#include <XCEngine/UI/Widgets/UIExpansionModel.h>
|
||||
#include <XCEngine/UI/Widgets/UIKeyboardNavigationModel.h>
|
||||
#include <XCEngine/UI/Widgets/UISelectionModel.h>
|
||||
|
||||
#include <string>
|
||||
@@ -13,6 +14,8 @@ namespace XCEngine::UI::Editor {
|
||||
|
||||
struct UIEditorTreeViewInteractionState {
|
||||
Widgets::UIEditorTreeViewState treeViewState = {};
|
||||
::XCEngine::UI::Widgets::UIKeyboardNavigationModel keyboardNavigation = {};
|
||||
std::string selectionAnchorId = {};
|
||||
::XCEngine::UI::UIPoint pointerPosition = {};
|
||||
bool hasPointerPosition = false;
|
||||
};
|
||||
@@ -21,10 +24,14 @@ struct UIEditorTreeViewInteractionResult {
|
||||
bool consumed = false;
|
||||
bool selectionChanged = false;
|
||||
bool expansionChanged = false;
|
||||
bool keyboardNavigated = false;
|
||||
bool secondaryClicked = false;
|
||||
bool renameRequested = false;
|
||||
Widgets::UIEditorTreeViewHitTarget hitTarget = {};
|
||||
std::string selectedItemId = {};
|
||||
std::string renameItemId = {};
|
||||
std::string toggledItemId = {};
|
||||
std::size_t selectedVisibleIndex = Widgets::UIEditorTreeViewInvalidIndex;
|
||||
};
|
||||
|
||||
struct UIEditorTreeViewInteractionFrame {
|
||||
@@ -1,157 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Widgets/UIEditorBoolField.h>
|
||||
#include <XCEditor/Widgets/UIEditorEnumField.h>
|
||||
#include <XCEditor/Widgets/UIEditorMenuPopup.h>
|
||||
#include <XCEditor/Widgets/UIEditorNumberField.h>
|
||||
#include <XCEditor/Widgets/UIEditorPropertyGrid.h>
|
||||
#include <XCEditor/Widgets/UIEditorTextField.h>
|
||||
#include <XCEditor/Widgets/UIEditorVector2Field.h>
|
||||
#include <XCEditor/Widgets/UIEditorVector3Field.h>
|
||||
#include <XCEditor/Widgets/UIEditorVector4Field.h>
|
||||
|
||||
#include <XCEngine/UI/Style/Theme.h>
|
||||
|
||||
#include <string_view>
|
||||
|
||||
namespace XCEngine::UI::Editor {
|
||||
|
||||
float ResolveUIEditorThemeFloat(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
std::string_view tokenName,
|
||||
float fallbackValue);
|
||||
|
||||
::XCEngine::UI::UIColor ResolveUIEditorThemeColor(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
std::string_view tokenName,
|
||||
const ::XCEngine::UI::UIColor& fallbackValue);
|
||||
|
||||
Widgets::UIEditorBoolFieldMetrics ResolveUIEditorBoolFieldMetrics(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
const Widgets::UIEditorBoolFieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorBoolFieldPalette ResolveUIEditorBoolFieldPalette(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
const Widgets::UIEditorBoolFieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorNumberFieldMetrics ResolveUIEditorNumberFieldMetrics(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
const Widgets::UIEditorNumberFieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorNumberFieldPalette ResolveUIEditorNumberFieldPalette(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
const Widgets::UIEditorNumberFieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorTextFieldMetrics ResolveUIEditorTextFieldMetrics(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
const Widgets::UIEditorTextFieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorTextFieldPalette ResolveUIEditorTextFieldPalette(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
const Widgets::UIEditorTextFieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorVector2FieldMetrics ResolveUIEditorVector2FieldMetrics(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
const Widgets::UIEditorVector2FieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorVector2FieldPalette ResolveUIEditorVector2FieldPalette(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
const Widgets::UIEditorVector2FieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorVector3FieldMetrics ResolveUIEditorVector3FieldMetrics(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
const Widgets::UIEditorVector3FieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorVector3FieldPalette ResolveUIEditorVector3FieldPalette(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
const Widgets::UIEditorVector3FieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorVector4FieldMetrics ResolveUIEditorVector4FieldMetrics(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
const Widgets::UIEditorVector4FieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorVector4FieldPalette ResolveUIEditorVector4FieldPalette(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
const Widgets::UIEditorVector4FieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorEnumFieldMetrics ResolveUIEditorEnumFieldMetrics(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
const Widgets::UIEditorEnumFieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorEnumFieldPalette ResolveUIEditorEnumFieldPalette(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
const Widgets::UIEditorEnumFieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorMenuPopupMetrics ResolveUIEditorMenuPopupMetrics(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
const Widgets::UIEditorMenuPopupMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorMenuPopupPalette ResolveUIEditorMenuPopupPalette(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
const Widgets::UIEditorMenuPopupPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorPropertyGridMetrics ResolveUIEditorPropertyGridMetrics(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
const Widgets::UIEditorPropertyGridMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorPropertyGridPalette ResolveUIEditorPropertyGridPalette(
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
const Widgets::UIEditorPropertyGridPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorBoolFieldMetrics BuildUIEditorHostedBoolFieldMetrics(
|
||||
const Widgets::UIEditorPropertyGridMetrics& propertyGridMetrics,
|
||||
const Widgets::UIEditorBoolFieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorBoolFieldPalette BuildUIEditorHostedBoolFieldPalette(
|
||||
const Widgets::UIEditorPropertyGridPalette& propertyGridPalette,
|
||||
const Widgets::UIEditorBoolFieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorNumberFieldMetrics BuildUIEditorHostedNumberFieldMetrics(
|
||||
const Widgets::UIEditorPropertyGridMetrics& propertyGridMetrics,
|
||||
const Widgets::UIEditorNumberFieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorNumberFieldPalette BuildUIEditorHostedNumberFieldPalette(
|
||||
const Widgets::UIEditorPropertyGridPalette& propertyGridPalette,
|
||||
const Widgets::UIEditorNumberFieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorTextFieldMetrics BuildUIEditorHostedTextFieldMetrics(
|
||||
const Widgets::UIEditorPropertyGridMetrics& propertyGridMetrics,
|
||||
const Widgets::UIEditorTextFieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorTextFieldPalette BuildUIEditorHostedTextFieldPalette(
|
||||
const Widgets::UIEditorPropertyGridPalette& propertyGridPalette,
|
||||
const Widgets::UIEditorTextFieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorVector2FieldMetrics BuildUIEditorHostedVector2FieldMetrics(
|
||||
const Widgets::UIEditorPropertyGridMetrics& propertyGridMetrics,
|
||||
const Widgets::UIEditorVector2FieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorVector2FieldPalette BuildUIEditorHostedVector2FieldPalette(
|
||||
const Widgets::UIEditorPropertyGridPalette& propertyGridPalette,
|
||||
const Widgets::UIEditorVector2FieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorVector3FieldMetrics BuildUIEditorHostedVector3FieldMetrics(
|
||||
const Widgets::UIEditorPropertyGridMetrics& propertyGridMetrics,
|
||||
const Widgets::UIEditorVector3FieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorVector3FieldPalette BuildUIEditorHostedVector3FieldPalette(
|
||||
const Widgets::UIEditorPropertyGridPalette& propertyGridPalette,
|
||||
const Widgets::UIEditorVector3FieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorVector4FieldMetrics BuildUIEditorHostedVector4FieldMetrics(
|
||||
const Widgets::UIEditorPropertyGridMetrics& propertyGridMetrics,
|
||||
const Widgets::UIEditorVector4FieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorVector4FieldPalette BuildUIEditorHostedVector4FieldPalette(
|
||||
const Widgets::UIEditorPropertyGridPalette& propertyGridPalette,
|
||||
const Widgets::UIEditorVector4FieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorEnumFieldMetrics BuildUIEditorHostedEnumFieldMetrics(
|
||||
const Widgets::UIEditorPropertyGridMetrics& propertyGridMetrics,
|
||||
const Widgets::UIEditorEnumFieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorEnumFieldPalette BuildUIEditorHostedEnumFieldPalette(
|
||||
const Widgets::UIEditorPropertyGridPalette& propertyGridPalette,
|
||||
const Widgets::UIEditorEnumFieldPalette& fallback = {});
|
||||
|
||||
} // namespace XCEngine::UI::Editor
|
||||
188
new_editor/include/XCEditor/Fields/UIEditorAssetField.h
Normal file
188
new_editor/include/XCEditor/Fields/UIEditorAssetField.h
Normal file
@@ -0,0 +1,188 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace XCEngine::UI::Editor::Widgets {
|
||||
|
||||
enum class UIEditorAssetFieldHitTargetKind : std::uint8_t {
|
||||
None = 0,
|
||||
Row,
|
||||
ValueBox,
|
||||
PickerButton,
|
||||
ClearButton
|
||||
};
|
||||
|
||||
struct UIEditorAssetFieldSpec {
|
||||
std::string fieldId = {};
|
||||
std::string label = {};
|
||||
std::string assetId = {};
|
||||
std::string displayName = {};
|
||||
std::string statusText = {};
|
||||
std::string emptyText = "None";
|
||||
::XCEngine::UI::UIColor tint = ::XCEngine::UI::UIColor(0.28f, 0.50f, 0.83f, 1.0f);
|
||||
bool readOnly = false;
|
||||
bool showPickerButton = true;
|
||||
bool allowClear = true;
|
||||
bool showStatusBadge = true;
|
||||
};
|
||||
|
||||
struct UIEditorAssetFieldState {
|
||||
UIEditorAssetFieldHitTargetKind hoveredTarget = UIEditorAssetFieldHitTargetKind::None;
|
||||
UIEditorAssetFieldHitTargetKind activeTarget = UIEditorAssetFieldHitTargetKind::None;
|
||||
bool focused = false;
|
||||
};
|
||||
|
||||
struct UIEditorAssetFieldMetrics {
|
||||
float rowHeight = 22.0f;
|
||||
float horizontalPadding = 12.0f;
|
||||
float labelControlGap = 20.0f;
|
||||
float controlColumnStart = 236.0f;
|
||||
float controlTrailingInset = 8.0f;
|
||||
float valueBoxMinWidth = 116.0f;
|
||||
float controlInsetY = 1.0f;
|
||||
float labelTextInsetY = 0.0f;
|
||||
float labelFontSize = 11.0f;
|
||||
float valueTextInsetX = 6.0f;
|
||||
float valueTextInsetY = 0.0f;
|
||||
float valueFontSize = 12.0f;
|
||||
float previewSize = 16.0f;
|
||||
float previewInsetX = 4.0f;
|
||||
float previewGap = 6.0f;
|
||||
float previewGlyphFontSize = 10.0f;
|
||||
float statusBadgeGap = 6.0f;
|
||||
float statusBadgeMinWidth = 44.0f;
|
||||
float statusBadgePaddingX = 6.0f;
|
||||
float statusBadgeHeight = 14.0f;
|
||||
float statusBadgeFontSize = 10.0f;
|
||||
float actionButtonGap = 2.0f;
|
||||
float actionButtonWidth = 20.0f;
|
||||
float actionGlyphFontSize = 10.0f;
|
||||
float actionGlyphInsetY = -1.0f;
|
||||
float cornerRounding = 0.0f;
|
||||
float valueBoxRounding = 2.0f;
|
||||
float previewRounding = 2.0f;
|
||||
float badgeRounding = 2.0f;
|
||||
float borderThickness = 1.0f;
|
||||
float focusedBorderThickness = 1.0f;
|
||||
};
|
||||
|
||||
struct UIEditorAssetFieldPalette {
|
||||
::XCEngine::UI::UIColor surfaceColor =
|
||||
::XCEngine::UI::UIColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
::XCEngine::UI::UIColor borderColor =
|
||||
::XCEngine::UI::UIColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
::XCEngine::UI::UIColor focusedBorderColor =
|
||||
::XCEngine::UI::UIColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
::XCEngine::UI::UIColor rowHoverColor =
|
||||
::XCEngine::UI::UIColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
::XCEngine::UI::UIColor rowActiveColor =
|
||||
::XCEngine::UI::UIColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
::XCEngine::UI::UIColor valueBoxColor =
|
||||
::XCEngine::UI::UIColor(0.18f, 0.18f, 0.18f, 1.0f);
|
||||
::XCEngine::UI::UIColor valueBoxHoverColor =
|
||||
::XCEngine::UI::UIColor(0.22f, 0.22f, 0.22f, 1.0f);
|
||||
::XCEngine::UI::UIColor valueBoxActiveColor =
|
||||
::XCEngine::UI::UIColor(0.24f, 0.24f, 0.24f, 1.0f);
|
||||
::XCEngine::UI::UIColor readOnlyColor =
|
||||
::XCEngine::UI::UIColor(0.16f, 0.16f, 0.16f, 1.0f);
|
||||
::XCEngine::UI::UIColor controlBorderColor =
|
||||
::XCEngine::UI::UIColor(0.12f, 0.12f, 0.12f, 1.0f);
|
||||
::XCEngine::UI::UIColor controlFocusedBorderColor =
|
||||
::XCEngine::UI::UIColor(0.42f, 0.42f, 0.42f, 1.0f);
|
||||
::XCEngine::UI::UIColor labelColor =
|
||||
::XCEngine::UI::UIColor(0.80f, 0.80f, 0.80f, 1.0f);
|
||||
::XCEngine::UI::UIColor valueColor =
|
||||
::XCEngine::UI::UIColor(0.92f, 0.92f, 0.92f, 1.0f);
|
||||
::XCEngine::UI::UIColor emptyValueColor =
|
||||
::XCEngine::UI::UIColor(0.60f, 0.60f, 0.60f, 1.0f);
|
||||
::XCEngine::UI::UIColor previewBaseColor =
|
||||
::XCEngine::UI::UIColor(0.23f, 0.25f, 0.28f, 1.0f);
|
||||
::XCEngine::UI::UIColor previewEmptyColor =
|
||||
::XCEngine::UI::UIColor(0.26f, 0.26f, 0.26f, 1.0f);
|
||||
::XCEngine::UI::UIColor previewBorderColor =
|
||||
::XCEngine::UI::UIColor(0.08f, 0.08f, 0.08f, 1.0f);
|
||||
::XCEngine::UI::UIColor previewGlyphColor =
|
||||
::XCEngine::UI::UIColor(0.94f, 0.94f, 0.94f, 1.0f);
|
||||
::XCEngine::UI::UIColor statusBadgeColor =
|
||||
::XCEngine::UI::UIColor(0.25f, 0.29f, 0.34f, 1.0f);
|
||||
::XCEngine::UI::UIColor statusBadgeBorderColor =
|
||||
::XCEngine::UI::UIColor(0.14f, 0.14f, 0.14f, 1.0f);
|
||||
::XCEngine::UI::UIColor statusBadgeTextColor =
|
||||
::XCEngine::UI::UIColor(0.82f, 0.87f, 0.96f, 1.0f);
|
||||
::XCEngine::UI::UIColor actionButtonHoverColor =
|
||||
::XCEngine::UI::UIColor(0.28f, 0.28f, 0.28f, 1.0f);
|
||||
::XCEngine::UI::UIColor actionButtonActiveColor =
|
||||
::XCEngine::UI::UIColor(0.32f, 0.32f, 0.32f, 1.0f);
|
||||
::XCEngine::UI::UIColor actionButtonColor =
|
||||
::XCEngine::UI::UIColor(0.16f, 0.16f, 0.16f, 1.0f);
|
||||
::XCEngine::UI::UIColor separatorColor =
|
||||
::XCEngine::UI::UIColor(0.24f, 0.24f, 0.24f, 1.0f);
|
||||
::XCEngine::UI::UIColor pickerGlyphColor =
|
||||
::XCEngine::UI::UIColor(0.88f, 0.88f, 0.88f, 1.0f);
|
||||
::XCEngine::UI::UIColor clearGlyphColor =
|
||||
::XCEngine::UI::UIColor(0.95f, 0.68f, 0.68f, 1.0f);
|
||||
};
|
||||
|
||||
struct UIEditorAssetFieldLayout {
|
||||
::XCEngine::UI::UIRect bounds = {};
|
||||
::XCEngine::UI::UIRect labelRect = {};
|
||||
::XCEngine::UI::UIRect controlRect = {};
|
||||
::XCEngine::UI::UIRect valueRect = {};
|
||||
::XCEngine::UI::UIRect previewRect = {};
|
||||
::XCEngine::UI::UIRect textRect = {};
|
||||
::XCEngine::UI::UIRect statusBadgeRect = {};
|
||||
::XCEngine::UI::UIRect pickerRect = {};
|
||||
::XCEngine::UI::UIRect clearRect = {};
|
||||
};
|
||||
|
||||
struct UIEditorAssetFieldHitTarget {
|
||||
UIEditorAssetFieldHitTargetKind kind = UIEditorAssetFieldHitTargetKind::None;
|
||||
};
|
||||
|
||||
bool HasUIEditorAssetFieldValue(const UIEditorAssetFieldSpec& spec);
|
||||
|
||||
std::string ResolveUIEditorAssetFieldValueText(const UIEditorAssetFieldSpec& spec);
|
||||
|
||||
std::string ResolveUIEditorAssetFieldPreviewGlyph(const UIEditorAssetFieldSpec& spec);
|
||||
|
||||
bool IsUIEditorAssetFieldPointInside(
|
||||
const ::XCEngine::UI::UIRect& rect,
|
||||
const ::XCEngine::UI::UIPoint& point);
|
||||
|
||||
UIEditorAssetFieldLayout BuildUIEditorAssetFieldLayout(
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
const UIEditorAssetFieldSpec& spec,
|
||||
const UIEditorAssetFieldMetrics& metrics = {});
|
||||
|
||||
UIEditorAssetFieldHitTarget HitTestUIEditorAssetField(
|
||||
const UIEditorAssetFieldLayout& layout,
|
||||
const ::XCEngine::UI::UIPoint& point);
|
||||
|
||||
void AppendUIEditorAssetFieldBackground(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const UIEditorAssetFieldLayout& layout,
|
||||
const UIEditorAssetFieldSpec& spec,
|
||||
const UIEditorAssetFieldState& state,
|
||||
const UIEditorAssetFieldPalette& palette = {},
|
||||
const UIEditorAssetFieldMetrics& metrics = {});
|
||||
|
||||
void AppendUIEditorAssetFieldForeground(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const UIEditorAssetFieldLayout& layout,
|
||||
const UIEditorAssetFieldSpec& spec,
|
||||
const UIEditorAssetFieldState& state,
|
||||
const UIEditorAssetFieldPalette& palette = {},
|
||||
const UIEditorAssetFieldMetrics& metrics = {});
|
||||
|
||||
void AppendUIEditorAssetField(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
const UIEditorAssetFieldSpec& spec,
|
||||
const UIEditorAssetFieldState& state,
|
||||
const UIEditorAssetFieldPalette& palette = {},
|
||||
const UIEditorAssetFieldMetrics& metrics = {});
|
||||
|
||||
} // namespace XCEngine::UI::Editor::Widgets
|
||||
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Fields/UIEditorAssetField.h>
|
||||
|
||||
#include <XCEngine/UI/Types.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine::UI::Editor {
|
||||
|
||||
struct UIEditorAssetFieldInteractionState {
|
||||
Widgets::UIEditorAssetFieldState fieldState = {};
|
||||
::XCEngine::UI::UIPoint pointerPosition = {};
|
||||
bool hasPointerPosition = false;
|
||||
};
|
||||
|
||||
struct UIEditorAssetFieldInteractionResult {
|
||||
bool consumed = false;
|
||||
bool focusChanged = false;
|
||||
bool valueChanged = false;
|
||||
bool activateRequested = false;
|
||||
bool pickerRequested = false;
|
||||
bool clearRequested = false;
|
||||
Widgets::UIEditorAssetFieldHitTarget hitTarget = {};
|
||||
std::string assetIdBefore = {};
|
||||
std::string assetIdAfter = {};
|
||||
std::string displayNameBefore = {};
|
||||
std::string displayNameAfter = {};
|
||||
};
|
||||
|
||||
struct UIEditorAssetFieldInteractionFrame {
|
||||
Widgets::UIEditorAssetFieldLayout layout = {};
|
||||
UIEditorAssetFieldInteractionResult result = {};
|
||||
};
|
||||
|
||||
UIEditorAssetFieldInteractionFrame UpdateUIEditorAssetFieldInteraction(
|
||||
UIEditorAssetFieldInteractionState& state,
|
||||
Widgets::UIEditorAssetFieldSpec& spec,
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents,
|
||||
const Widgets::UIEditorAssetFieldMetrics& metrics = {});
|
||||
|
||||
} // namespace XCEngine::UI::Editor
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Widgets/UIEditorBoolField.h>
|
||||
#include <XCEditor/Fields/UIEditorBoolField.h>
|
||||
|
||||
#include <XCEngine/UI/Types.h>
|
||||
|
||||
220
new_editor/include/XCEditor/Fields/UIEditorColorField.h
Normal file
220
new_editor/include/XCEditor/Fields/UIEditorColorField.h
Normal file
@@ -0,0 +1,220 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace XCEngine::UI::Editor::Widgets {
|
||||
|
||||
enum class UIEditorColorFieldHitTargetKind : std::uint8_t {
|
||||
None = 0,
|
||||
Row,
|
||||
Swatch,
|
||||
PopupSurface,
|
||||
PopupCloseButton,
|
||||
HueWheel,
|
||||
SaturationValue,
|
||||
RedChannel,
|
||||
GreenChannel,
|
||||
BlueChannel,
|
||||
AlphaChannel
|
||||
};
|
||||
|
||||
struct UIEditorColorFieldSpec {
|
||||
std::string fieldId = {};
|
||||
std::string label = {};
|
||||
::XCEngine::UI::UIColor value = {};
|
||||
bool showAlpha = true;
|
||||
bool readOnly = false;
|
||||
};
|
||||
|
||||
struct UIEditorColorFieldState {
|
||||
UIEditorColorFieldHitTargetKind hoveredTarget = UIEditorColorFieldHitTargetKind::None;
|
||||
UIEditorColorFieldHitTargetKind activeTarget = UIEditorColorFieldHitTargetKind::None;
|
||||
bool focused = false;
|
||||
bool popupOpen = false;
|
||||
float hue = 0.0f;
|
||||
bool hueValid = false;
|
||||
};
|
||||
|
||||
struct UIEditorColorFieldMetrics {
|
||||
float rowHeight = 22.0f;
|
||||
float horizontalPadding = 12.0f;
|
||||
float labelControlGap = 20.0f;
|
||||
float controlColumnStart = 236.0f;
|
||||
float controlTrailingInset = 8.0f;
|
||||
float swatchWidth = 54.0f;
|
||||
float swatchInsetY = 1.0f;
|
||||
float labelTextInsetY = 0.0f;
|
||||
float labelFontSize = 11.0f;
|
||||
float popupWidth = 292.0f;
|
||||
float popupPadding = 10.0f;
|
||||
float popupGapY = 6.0f;
|
||||
float popupHeaderHeight = 30.0f;
|
||||
float popupTopRowHeight = 34.0f;
|
||||
float popupPreviewWidth = 96.0f;
|
||||
float popupPreviewHeight = 28.0f;
|
||||
float popupCloseButtonSize = 18.0f;
|
||||
float borderThickness = 1.0f;
|
||||
float focusedBorderThickness = 1.0f;
|
||||
float swatchRounding = 2.0f;
|
||||
float popupBorderRounding = 3.0f;
|
||||
float wheelOuterRadius = 110.0f;
|
||||
float wheelRingThickness = 24.0f;
|
||||
float saturationValueSize = 114.0f;
|
||||
float wheelRegionHeight = 220.0f;
|
||||
float channelRowHeight = 20.0f;
|
||||
float numericBoxWidth = 62.0f;
|
||||
float channelLabelWidth = 12.0f;
|
||||
float hexLabelWidth = 84.0f;
|
||||
float controlRowSpacing = 8.0f;
|
||||
float popupFieldInset = 6.0f;
|
||||
float titleFontSize = 12.0f;
|
||||
float valueFontSize = 11.0f;
|
||||
float valueTextInsetX = 6.0f;
|
||||
float valueTextInsetY = 0.0f;
|
||||
float checkerSize = 6.0f;
|
||||
float handleRadius = 8.0f;
|
||||
float ringHandleRadius = 12.0f;
|
||||
};
|
||||
|
||||
struct UIEditorColorFieldPalette {
|
||||
::XCEngine::UI::UIColor surfaceColor =
|
||||
::XCEngine::UI::UIColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
::XCEngine::UI::UIColor borderColor =
|
||||
::XCEngine::UI::UIColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
::XCEngine::UI::UIColor focusedBorderColor =
|
||||
::XCEngine::UI::UIColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
::XCEngine::UI::UIColor rowHoverColor =
|
||||
::XCEngine::UI::UIColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
::XCEngine::UI::UIColor rowActiveColor =
|
||||
::XCEngine::UI::UIColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
::XCEngine::UI::UIColor swatchBorderColor =
|
||||
::XCEngine::UI::UIColor(0.14f, 0.14f, 0.14f, 1.0f);
|
||||
::XCEngine::UI::UIColor swatchHoverBorderColor =
|
||||
::XCEngine::UI::UIColor(0.34f, 0.34f, 0.34f, 1.0f);
|
||||
::XCEngine::UI::UIColor swatchReadOnlyOverlayColor =
|
||||
::XCEngine::UI::UIColor(0.08f, 0.08f, 0.08f, 0.18f);
|
||||
::XCEngine::UI::UIColor popupColor =
|
||||
::XCEngine::UI::UIColor(0.24f, 0.24f, 0.24f, 1.0f);
|
||||
::XCEngine::UI::UIColor popupBorderColor =
|
||||
::XCEngine::UI::UIColor(0.15f, 0.15f, 0.15f, 1.0f);
|
||||
::XCEngine::UI::UIColor popupHeaderColor =
|
||||
::XCEngine::UI::UIColor(0.43f, 0.24f, 0.05f, 1.0f);
|
||||
::XCEngine::UI::UIColor popupTitleColor =
|
||||
::XCEngine::UI::UIColor(0.95f, 0.95f, 0.95f, 1.0f);
|
||||
::XCEngine::UI::UIColor closeButtonColor =
|
||||
::XCEngine::UI::UIColor(0.76f, 0.35f, 0.34f, 1.0f);
|
||||
::XCEngine::UI::UIColor closeButtonHoverColor =
|
||||
::XCEngine::UI::UIColor(0.82f, 0.40f, 0.39f, 1.0f);
|
||||
::XCEngine::UI::UIColor closeGlyphColor =
|
||||
::XCEngine::UI::UIColor(0.95f, 0.95f, 0.95f, 1.0f);
|
||||
::XCEngine::UI::UIColor labelColor =
|
||||
::XCEngine::UI::UIColor(0.88f, 0.88f, 0.88f, 1.0f);
|
||||
::XCEngine::UI::UIColor popupTextColor =
|
||||
::XCEngine::UI::UIColor(0.86f, 0.86f, 0.86f, 1.0f);
|
||||
::XCEngine::UI::UIColor popupTextMutedColor =
|
||||
::XCEngine::UI::UIColor(0.72f, 0.72f, 0.72f, 1.0f);
|
||||
::XCEngine::UI::UIColor previewBorderColor =
|
||||
::XCEngine::UI::UIColor(0.12f, 0.12f, 0.12f, 1.0f);
|
||||
::XCEngine::UI::UIColor previewBaseColor =
|
||||
::XCEngine::UI::UIColor(0.19f, 0.19f, 0.19f, 1.0f);
|
||||
::XCEngine::UI::UIColor checkerLightColor =
|
||||
::XCEngine::UI::UIColor(0.84f, 0.84f, 0.84f, 1.0f);
|
||||
::XCEngine::UI::UIColor checkerDarkColor =
|
||||
::XCEngine::UI::UIColor(0.55f, 0.55f, 0.55f, 1.0f);
|
||||
::XCEngine::UI::UIColor sliderBorderColor =
|
||||
::XCEngine::UI::UIColor(0.12f, 0.12f, 0.12f, 1.0f);
|
||||
::XCEngine::UI::UIColor numericBoxColor =
|
||||
::XCEngine::UI::UIColor(0.19f, 0.19f, 0.19f, 1.0f);
|
||||
::XCEngine::UI::UIColor numericBoxBorderColor =
|
||||
::XCEngine::UI::UIColor(0.12f, 0.12f, 0.12f, 1.0f);
|
||||
::XCEngine::UI::UIColor numericBoxTextColor =
|
||||
::XCEngine::UI::UIColor(0.90f, 0.90f, 0.90f, 1.0f);
|
||||
::XCEngine::UI::UIColor handleFillColor =
|
||||
::XCEngine::UI::UIColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
::XCEngine::UI::UIColor handleStrokeColor =
|
||||
::XCEngine::UI::UIColor(0.0f, 0.0f, 0.0f, 0.4f);
|
||||
};
|
||||
|
||||
struct UIEditorColorFieldLayout {
|
||||
::XCEngine::UI::UIRect bounds = {};
|
||||
::XCEngine::UI::UIRect labelRect = {};
|
||||
::XCEngine::UI::UIRect controlRect = {};
|
||||
::XCEngine::UI::UIRect swatchRect = {};
|
||||
::XCEngine::UI::UIRect popupRect = {};
|
||||
::XCEngine::UI::UIRect popupHeaderRect = {};
|
||||
::XCEngine::UI::UIRect popupTitleRect = {};
|
||||
::XCEngine::UI::UIRect popupCloseButtonRect = {};
|
||||
::XCEngine::UI::UIRect popupBodyRect = {};
|
||||
::XCEngine::UI::UIRect popupTopRowRect = {};
|
||||
::XCEngine::UI::UIRect popupPreviewRect = {};
|
||||
::XCEngine::UI::UIRect popupWheelRect = {};
|
||||
::XCEngine::UI::UIPoint hueWheelCenter = {};
|
||||
float hueWheelOuterRadius = 0.0f;
|
||||
float hueWheelInnerRadius = 0.0f;
|
||||
::XCEngine::UI::UIRect saturationValueRect = {};
|
||||
::XCEngine::UI::UIRect redLabelRect = {};
|
||||
::XCEngine::UI::UIRect redSliderRect = {};
|
||||
::XCEngine::UI::UIRect redValueRect = {};
|
||||
::XCEngine::UI::UIRect greenLabelRect = {};
|
||||
::XCEngine::UI::UIRect greenSliderRect = {};
|
||||
::XCEngine::UI::UIRect greenValueRect = {};
|
||||
::XCEngine::UI::UIRect blueLabelRect = {};
|
||||
::XCEngine::UI::UIRect blueSliderRect = {};
|
||||
::XCEngine::UI::UIRect blueValueRect = {};
|
||||
::XCEngine::UI::UIRect alphaLabelRect = {};
|
||||
::XCEngine::UI::UIRect alphaSliderRect = {};
|
||||
::XCEngine::UI::UIRect alphaValueRect = {};
|
||||
::XCEngine::UI::UIRect hexLabelRect = {};
|
||||
::XCEngine::UI::UIRect hexValueRect = {};
|
||||
};
|
||||
|
||||
struct UIEditorColorFieldHitTarget {
|
||||
UIEditorColorFieldHitTargetKind kind = UIEditorColorFieldHitTargetKind::None;
|
||||
};
|
||||
|
||||
std::string FormatUIEditorColorFieldRgbaText(
|
||||
const UIEditorColorFieldSpec& spec);
|
||||
|
||||
std::string FormatUIEditorColorFieldHexText(
|
||||
const UIEditorColorFieldSpec& spec);
|
||||
|
||||
UIEditorColorFieldLayout BuildUIEditorColorFieldLayout(
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
const UIEditorColorFieldSpec& spec,
|
||||
const UIEditorColorFieldMetrics& metrics = {},
|
||||
const ::XCEngine::UI::UIRect& viewportRect = {});
|
||||
|
||||
UIEditorColorFieldHitTarget HitTestUIEditorColorField(
|
||||
const UIEditorColorFieldLayout& layout,
|
||||
bool popupOpen,
|
||||
const ::XCEngine::UI::UIPoint& point);
|
||||
|
||||
void AppendUIEditorColorFieldBackground(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const UIEditorColorFieldLayout& layout,
|
||||
const UIEditorColorFieldSpec& spec,
|
||||
const UIEditorColorFieldState& state,
|
||||
const UIEditorColorFieldPalette& palette = {},
|
||||
const UIEditorColorFieldMetrics& metrics = {});
|
||||
|
||||
void AppendUIEditorColorFieldForeground(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const UIEditorColorFieldLayout& layout,
|
||||
const UIEditorColorFieldSpec& spec,
|
||||
const UIEditorColorFieldState& state,
|
||||
const UIEditorColorFieldPalette& palette = {},
|
||||
const UIEditorColorFieldMetrics& metrics = {});
|
||||
|
||||
void AppendUIEditorColorField(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
const UIEditorColorFieldSpec& spec,
|
||||
const UIEditorColorFieldState& state,
|
||||
const UIEditorColorFieldPalette& palette = {},
|
||||
const UIEditorColorFieldMetrics& metrics = {},
|
||||
const ::XCEngine::UI::UIRect& viewportRect = {});
|
||||
|
||||
} // namespace XCEngine::UI::Editor::Widgets
|
||||
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Fields/UIEditorColorField.h>
|
||||
|
||||
#include <XCEngine/UI/Types.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine::UI::Editor {
|
||||
|
||||
struct UIEditorColorFieldInteractionState {
|
||||
Widgets::UIEditorColorFieldState colorFieldState = {};
|
||||
::XCEngine::UI::UIPoint pointerPosition = {};
|
||||
bool hasPointerPosition = false;
|
||||
};
|
||||
|
||||
struct UIEditorColorFieldInteractionResult {
|
||||
bool consumed = false;
|
||||
bool focusChanged = false;
|
||||
bool popupOpened = false;
|
||||
bool popupClosed = false;
|
||||
bool colorChanged = false;
|
||||
Widgets::UIEditorColorFieldHitTarget hitTarget = {};
|
||||
::XCEngine::UI::UIColor valueBefore = {};
|
||||
::XCEngine::UI::UIColor valueAfter = {};
|
||||
};
|
||||
|
||||
struct UIEditorColorFieldInteractionFrame {
|
||||
Widgets::UIEditorColorFieldLayout layout = {};
|
||||
UIEditorColorFieldInteractionResult result = {};
|
||||
};
|
||||
|
||||
UIEditorColorFieldInteractionFrame UpdateUIEditorColorFieldInteraction(
|
||||
UIEditorColorFieldInteractionState& state,
|
||||
Widgets::UIEditorColorFieldSpec& spec,
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents,
|
||||
const Widgets::UIEditorColorFieldMetrics& metrics = {},
|
||||
const ::XCEngine::UI::UIRect& viewportRect = {});
|
||||
|
||||
} // namespace XCEngine::UI::Editor
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Widgets/UIEditorMenuPopup.h>
|
||||
#include <XCEditor/Widgets/UIEditorEnumField.h>
|
||||
#include <XCEditor/Shell/UIEditorMenuPopup.h>
|
||||
#include <XCEditor/Fields/UIEditorEnumField.h>
|
||||
|
||||
#include <XCEngine/UI/Types.h>
|
||||
|
||||
101
new_editor/include/XCEditor/Fields/UIEditorFieldStyle.h
Normal file
101
new_editor/include/XCEditor/Fields/UIEditorFieldStyle.h
Normal file
@@ -0,0 +1,101 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Fields/UIEditorAssetField.h>
|
||||
#include <XCEditor/Fields/UIEditorBoolField.h>
|
||||
#include <XCEditor/Fields/UIEditorColorField.h>
|
||||
#include <XCEditor/Fields/UIEditorEnumField.h>
|
||||
#include <XCEditor/Fields/UIEditorNumberField.h>
|
||||
#include <XCEditor/Fields/UIEditorObjectField.h>
|
||||
#include <XCEditor/Fields/UIEditorPropertyGrid.h>
|
||||
#include <XCEditor/Fields/UIEditorTextField.h>
|
||||
#include <XCEditor/Fields/UIEditorVector2Field.h>
|
||||
#include <XCEditor/Fields/UIEditorVector3Field.h>
|
||||
#include <XCEditor/Fields/UIEditorVector4Field.h>
|
||||
|
||||
namespace XCEngine::UI::Editor {
|
||||
|
||||
const Widgets::UIEditorPropertyGridMetrics& GetUIEditorFixedPropertyGridMetrics();
|
||||
|
||||
const Widgets::UIEditorPropertyGridPalette& GetUIEditorFixedPropertyGridPalette();
|
||||
|
||||
Widgets::UIEditorBoolFieldMetrics BuildUIEditorPropertyGridBoolFieldMetrics(
|
||||
const Widgets::UIEditorPropertyGridMetrics& propertyGridMetrics,
|
||||
const Widgets::UIEditorBoolFieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorBoolFieldPalette BuildUIEditorPropertyGridBoolFieldPalette(
|
||||
const Widgets::UIEditorPropertyGridPalette& propertyGridPalette,
|
||||
const Widgets::UIEditorBoolFieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorNumberFieldMetrics BuildUIEditorPropertyGridNumberFieldMetrics(
|
||||
const Widgets::UIEditorPropertyGridMetrics& propertyGridMetrics,
|
||||
const Widgets::UIEditorNumberFieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorNumberFieldPalette BuildUIEditorPropertyGridNumberFieldPalette(
|
||||
const Widgets::UIEditorPropertyGridPalette& propertyGridPalette,
|
||||
const Widgets::UIEditorNumberFieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorTextFieldMetrics BuildUIEditorPropertyGridTextFieldMetrics(
|
||||
const Widgets::UIEditorPropertyGridMetrics& propertyGridMetrics,
|
||||
const Widgets::UIEditorTextFieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorTextFieldPalette BuildUIEditorPropertyGridTextFieldPalette(
|
||||
const Widgets::UIEditorPropertyGridPalette& propertyGridPalette,
|
||||
const Widgets::UIEditorTextFieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorVector2FieldMetrics BuildUIEditorPropertyGridVector2FieldMetrics(
|
||||
const Widgets::UIEditorPropertyGridMetrics& propertyGridMetrics,
|
||||
const Widgets::UIEditorVector2FieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorVector2FieldPalette BuildUIEditorPropertyGridVector2FieldPalette(
|
||||
const Widgets::UIEditorPropertyGridPalette& propertyGridPalette,
|
||||
const Widgets::UIEditorVector2FieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorVector3FieldMetrics BuildUIEditorPropertyGridVector3FieldMetrics(
|
||||
const Widgets::UIEditorPropertyGridMetrics& propertyGridMetrics,
|
||||
const Widgets::UIEditorVector3FieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorVector3FieldPalette BuildUIEditorPropertyGridVector3FieldPalette(
|
||||
const Widgets::UIEditorPropertyGridPalette& propertyGridPalette,
|
||||
const Widgets::UIEditorVector3FieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorVector4FieldMetrics BuildUIEditorPropertyGridVector4FieldMetrics(
|
||||
const Widgets::UIEditorPropertyGridMetrics& propertyGridMetrics,
|
||||
const Widgets::UIEditorVector4FieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorVector4FieldPalette BuildUIEditorPropertyGridVector4FieldPalette(
|
||||
const Widgets::UIEditorPropertyGridPalette& propertyGridPalette,
|
||||
const Widgets::UIEditorVector4FieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorEnumFieldMetrics BuildUIEditorPropertyGridEnumFieldMetrics(
|
||||
const Widgets::UIEditorPropertyGridMetrics& propertyGridMetrics,
|
||||
const Widgets::UIEditorEnumFieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorEnumFieldPalette BuildUIEditorPropertyGridEnumFieldPalette(
|
||||
const Widgets::UIEditorPropertyGridPalette& propertyGridPalette,
|
||||
const Widgets::UIEditorEnumFieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorColorFieldMetrics BuildUIEditorPropertyGridColorFieldMetrics(
|
||||
const Widgets::UIEditorPropertyGridMetrics& propertyGridMetrics,
|
||||
const Widgets::UIEditorColorFieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorColorFieldPalette BuildUIEditorPropertyGridColorFieldPalette(
|
||||
const Widgets::UIEditorPropertyGridPalette& propertyGridPalette,
|
||||
const Widgets::UIEditorColorFieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorObjectFieldMetrics BuildUIEditorPropertyGridObjectFieldMetrics(
|
||||
const Widgets::UIEditorPropertyGridMetrics& propertyGridMetrics,
|
||||
const Widgets::UIEditorObjectFieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorObjectFieldPalette BuildUIEditorPropertyGridObjectFieldPalette(
|
||||
const Widgets::UIEditorPropertyGridPalette& propertyGridPalette,
|
||||
const Widgets::UIEditorObjectFieldPalette& fallback = {});
|
||||
|
||||
Widgets::UIEditorAssetFieldMetrics BuildUIEditorPropertyGridAssetFieldMetrics(
|
||||
const Widgets::UIEditorPropertyGridMetrics& propertyGridMetrics,
|
||||
const Widgets::UIEditorAssetFieldMetrics& fallback = {});
|
||||
|
||||
Widgets::UIEditorAssetFieldPalette BuildUIEditorPropertyGridAssetFieldPalette(
|
||||
const Widgets::UIEditorPropertyGridPalette& propertyGridPalette,
|
||||
const Widgets::UIEditorAssetFieldPalette& fallback = {});
|
||||
|
||||
} // namespace XCEngine::UI::Editor
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Widgets/UIEditorNumberField.h>
|
||||
#include <XCEditor/Fields/UIEditorNumberField.h>
|
||||
|
||||
#include <XCEngine/UI/Text/UITextInputController.h>
|
||||
#include <XCEngine/UI/Types.h>
|
||||
153
new_editor/include/XCEditor/Fields/UIEditorObjectField.h
Normal file
153
new_editor/include/XCEditor/Fields/UIEditorObjectField.h
Normal file
@@ -0,0 +1,153 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace XCEngine::UI::Editor::Widgets {
|
||||
|
||||
enum class UIEditorObjectFieldHitTargetKind : std::uint8_t {
|
||||
None = 0,
|
||||
Row,
|
||||
ValueBox,
|
||||
ClearButton,
|
||||
PickerButton
|
||||
};
|
||||
|
||||
struct UIEditorObjectFieldSpec {
|
||||
std::string fieldId = {};
|
||||
std::string label = {};
|
||||
std::string objectName = {};
|
||||
std::string objectTypeName = {};
|
||||
std::string emptyText = "(none)";
|
||||
bool hasValue = false;
|
||||
bool readOnly = false;
|
||||
bool showClearButton = true;
|
||||
bool showPickerButton = true;
|
||||
};
|
||||
|
||||
struct UIEditorObjectFieldState {
|
||||
UIEditorObjectFieldHitTargetKind hoveredTarget = UIEditorObjectFieldHitTargetKind::None;
|
||||
UIEditorObjectFieldHitTargetKind activeTarget = UIEditorObjectFieldHitTargetKind::None;
|
||||
bool focused = false;
|
||||
};
|
||||
|
||||
struct UIEditorObjectFieldMetrics {
|
||||
float rowHeight = 22.0f;
|
||||
float horizontalPadding = 12.0f;
|
||||
float labelControlGap = 20.0f;
|
||||
float controlColumnStart = 236.0f;
|
||||
float controlTrailingInset = 8.0f;
|
||||
float valueBoxMinWidth = 96.0f;
|
||||
float controlInsetY = 1.0f;
|
||||
float labelTextInsetY = 0.0f;
|
||||
float labelFontSize = 11.0f;
|
||||
float valueTextInsetX = 5.0f;
|
||||
float valueTextInsetY = 0.0f;
|
||||
float valueFontSize = 12.0f;
|
||||
float typeTextInsetX = 5.0f;
|
||||
float typeTextInsetY = 0.0f;
|
||||
float typeFontSize = 10.0f;
|
||||
float typeMaxWidth = 96.0f;
|
||||
float typeMinWidth = 44.0f;
|
||||
float valueTypeGap = 6.0f;
|
||||
float buttonWidth = 20.0f;
|
||||
float buttonGlyphInsetY = -1.0f;
|
||||
float buttonGlyphFontSize = 10.0f;
|
||||
float cornerRounding = 0.0f;
|
||||
float valueBoxRounding = 2.0f;
|
||||
float borderThickness = 1.0f;
|
||||
float focusedBorderThickness = 1.0f;
|
||||
};
|
||||
|
||||
struct UIEditorObjectFieldPalette {
|
||||
::XCEngine::UI::UIColor surfaceColor =
|
||||
::XCEngine::UI::UIColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
::XCEngine::UI::UIColor borderColor =
|
||||
::XCEngine::UI::UIColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
::XCEngine::UI::UIColor focusedBorderColor =
|
||||
::XCEngine::UI::UIColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
::XCEngine::UI::UIColor rowHoverColor =
|
||||
::XCEngine::UI::UIColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
::XCEngine::UI::UIColor rowActiveColor =
|
||||
::XCEngine::UI::UIColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
::XCEngine::UI::UIColor valueBoxColor =
|
||||
::XCEngine::UI::UIColor(0.18f, 0.18f, 0.18f, 1.0f);
|
||||
::XCEngine::UI::UIColor valueBoxHoverColor =
|
||||
::XCEngine::UI::UIColor(0.21f, 0.21f, 0.21f, 1.0f);
|
||||
::XCEngine::UI::UIColor readOnlyColor =
|
||||
::XCEngine::UI::UIColor(0.17f, 0.17f, 0.17f, 1.0f);
|
||||
::XCEngine::UI::UIColor controlBorderColor =
|
||||
::XCEngine::UI::UIColor(0.14f, 0.14f, 0.14f, 1.0f);
|
||||
::XCEngine::UI::UIColor controlFocusedBorderColor =
|
||||
::XCEngine::UI::UIColor(0.46f, 0.46f, 0.46f, 1.0f);
|
||||
::XCEngine::UI::UIColor buttonColor =
|
||||
::XCEngine::UI::UIColor(0.16f, 0.16f, 0.16f, 1.0f);
|
||||
::XCEngine::UI::UIColor buttonHoverColor =
|
||||
::XCEngine::UI::UIColor(0.22f, 0.22f, 0.22f, 1.0f);
|
||||
::XCEngine::UI::UIColor buttonActiveColor =
|
||||
::XCEngine::UI::UIColor(0.26f, 0.26f, 0.26f, 1.0f);
|
||||
::XCEngine::UI::UIColor buttonGlyphColor =
|
||||
::XCEngine::UI::UIColor(0.86f, 0.86f, 0.86f, 1.0f);
|
||||
::XCEngine::UI::UIColor separatorColor =
|
||||
::XCEngine::UI::UIColor(0.24f, 0.24f, 0.24f, 1.0f);
|
||||
::XCEngine::UI::UIColor labelColor =
|
||||
::XCEngine::UI::UIColor(0.80f, 0.80f, 0.80f, 1.0f);
|
||||
::XCEngine::UI::UIColor valueColor =
|
||||
::XCEngine::UI::UIColor(0.92f, 0.92f, 0.92f, 1.0f);
|
||||
::XCEngine::UI::UIColor emptyValueColor =
|
||||
::XCEngine::UI::UIColor(0.62f, 0.62f, 0.62f, 1.0f);
|
||||
::XCEngine::UI::UIColor typeColor =
|
||||
::XCEngine::UI::UIColor(0.68f, 0.68f, 0.68f, 1.0f);
|
||||
};
|
||||
|
||||
struct UIEditorObjectFieldLayout {
|
||||
::XCEngine::UI::UIRect bounds = {};
|
||||
::XCEngine::UI::UIRect labelRect = {};
|
||||
::XCEngine::UI::UIRect controlRect = {};
|
||||
::XCEngine::UI::UIRect valueRect = {};
|
||||
::XCEngine::UI::UIRect typeRect = {};
|
||||
::XCEngine::UI::UIRect clearButtonRect = {};
|
||||
::XCEngine::UI::UIRect pickerButtonRect = {};
|
||||
};
|
||||
|
||||
struct UIEditorObjectFieldHitTarget {
|
||||
UIEditorObjectFieldHitTargetKind kind = UIEditorObjectFieldHitTargetKind::None;
|
||||
};
|
||||
|
||||
std::string ResolveUIEditorObjectFieldDisplayText(const UIEditorObjectFieldSpec& spec);
|
||||
|
||||
UIEditorObjectFieldLayout BuildUIEditorObjectFieldLayout(
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
const UIEditorObjectFieldSpec& spec,
|
||||
const UIEditorObjectFieldMetrics& metrics = {});
|
||||
|
||||
UIEditorObjectFieldHitTarget HitTestUIEditorObjectField(
|
||||
const UIEditorObjectFieldLayout& layout,
|
||||
const ::XCEngine::UI::UIPoint& point);
|
||||
|
||||
void AppendUIEditorObjectFieldBackground(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const UIEditorObjectFieldLayout& layout,
|
||||
const UIEditorObjectFieldSpec& spec,
|
||||
const UIEditorObjectFieldState& state,
|
||||
const UIEditorObjectFieldPalette& palette = {},
|
||||
const UIEditorObjectFieldMetrics& metrics = {});
|
||||
|
||||
void AppendUIEditorObjectFieldForeground(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const UIEditorObjectFieldLayout& layout,
|
||||
const UIEditorObjectFieldSpec& spec,
|
||||
const UIEditorObjectFieldPalette& palette = {},
|
||||
const UIEditorObjectFieldMetrics& metrics = {});
|
||||
|
||||
void AppendUIEditorObjectField(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
const UIEditorObjectFieldSpec& spec,
|
||||
const UIEditorObjectFieldState& state,
|
||||
const UIEditorObjectFieldPalette& palette = {},
|
||||
const UIEditorObjectFieldMetrics& metrics = {});
|
||||
|
||||
} // namespace XCEngine::UI::Editor::Widgets
|
||||
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Fields/UIEditorObjectField.h>
|
||||
|
||||
#include <XCEngine/UI/Types.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine::UI::Editor {
|
||||
|
||||
struct UIEditorObjectFieldInteractionState {
|
||||
Widgets::UIEditorObjectFieldState fieldState = {};
|
||||
::XCEngine::UI::UIPoint pointerPosition = {};
|
||||
bool hasPointerPosition = false;
|
||||
};
|
||||
|
||||
struct UIEditorObjectFieldInteractionResult {
|
||||
bool consumed = false;
|
||||
bool focusChanged = false;
|
||||
bool activateRequested = false;
|
||||
bool clearRequested = false;
|
||||
Widgets::UIEditorObjectFieldHitTarget hitTarget = {};
|
||||
};
|
||||
|
||||
struct UIEditorObjectFieldInteractionFrame {
|
||||
Widgets::UIEditorObjectFieldLayout layout = {};
|
||||
UIEditorObjectFieldInteractionResult result = {};
|
||||
};
|
||||
|
||||
UIEditorObjectFieldInteractionFrame UpdateUIEditorObjectFieldInteraction(
|
||||
UIEditorObjectFieldInteractionState& state,
|
||||
const Widgets::UIEditorObjectFieldSpec& spec,
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents,
|
||||
const Widgets::UIEditorObjectFieldMetrics& metrics = {});
|
||||
|
||||
} // namespace XCEngine::UI::Editor
|
||||
@@ -5,7 +5,8 @@
|
||||
#include <XCEngine/UI/Widgets/UIPropertyEditModel.h>
|
||||
#include <XCEngine/UI/Widgets/UISelectionModel.h>
|
||||
|
||||
#include <XCEditor/Widgets/UIEditorMenuPopup.h>
|
||||
#include <XCEditor/Fields/UIEditorColorField.h>
|
||||
#include <XCEditor/Shell/UIEditorMenuPopup.h>
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
@@ -23,6 +24,7 @@ enum class UIEditorPropertyGridFieldKind : std::uint8_t {
|
||||
Bool,
|
||||
Number,
|
||||
Enum,
|
||||
Color,
|
||||
Vector2,
|
||||
Vector3,
|
||||
Vector4
|
||||
@@ -58,6 +60,11 @@ struct UIEditorPropertyGridEnumFieldValue {
|
||||
std::size_t selectedIndex = 0u;
|
||||
};
|
||||
|
||||
struct UIEditorPropertyGridColorFieldValue {
|
||||
::XCEngine::UI::UIColor value = {};
|
||||
bool showAlpha = true;
|
||||
};
|
||||
|
||||
struct UIEditorPropertyGridVector2FieldValue {
|
||||
std::array<double, 2u> values = { 0.0, 0.0 };
|
||||
std::array<std::string, 2u> componentLabels = { std::string("X"), std::string("Y") };
|
||||
@@ -104,6 +111,7 @@ struct UIEditorPropertyGridField {
|
||||
bool boolValue = false;
|
||||
UIEditorPropertyGridNumberFieldValue numberValue = {};
|
||||
UIEditorPropertyGridEnumFieldValue enumValue = {};
|
||||
UIEditorPropertyGridColorFieldValue colorValue = {};
|
||||
UIEditorPropertyGridVector2FieldValue vector2Value = {};
|
||||
UIEditorPropertyGridVector3FieldValue vector3Value = {};
|
||||
UIEditorPropertyGridVector4FieldValue vector4Value = {};
|
||||
@@ -116,6 +124,11 @@ struct UIEditorPropertyGridSection {
|
||||
float desiredHeaderHeight = 0.0f;
|
||||
};
|
||||
|
||||
struct UIEditorPropertyGridColorFieldVisualState {
|
||||
std::string fieldId = {};
|
||||
UIEditorColorFieldState state = {};
|
||||
};
|
||||
|
||||
struct UIEditorPropertyGridState {
|
||||
std::string hoveredSectionId = {};
|
||||
std::string hoveredFieldId = {};
|
||||
@@ -124,6 +137,7 @@ struct UIEditorPropertyGridState {
|
||||
std::string pressedFieldId = {};
|
||||
std::string popupFieldId = {};
|
||||
std::size_t popupHighlightedIndex = UIEditorPropertyGridInvalidIndex;
|
||||
std::vector<UIEditorPropertyGridColorFieldVisualState> colorFieldStates = {};
|
||||
};
|
||||
|
||||
struct UIEditorPropertyGridMetrics {
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Widgets/UIEditorPropertyGrid.h>
|
||||
#include <XCEditor/Fields/UIEditorPropertyGrid.h>
|
||||
|
||||
#include <XCEngine/UI/Text/UITextInputController.h>
|
||||
#include <XCEngine/UI/Types.h>
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Widgets/UIEditorTextField.h>
|
||||
#include <XCEditor/Fields/UIEditorTextField.h>
|
||||
|
||||
#include <XCEngine/UI/Text/UITextInputController.h>
|
||||
#include <XCEngine/UI/Types.h>
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Widgets/UIEditorVector2Field.h>
|
||||
#include <XCEditor/Fields/UIEditorVector2Field.h>
|
||||
|
||||
#include <XCEngine/UI/Text/UITextInputController.h>
|
||||
#include <XCEngine/UI/Types.h>
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Widgets/UIEditorVector3Field.h>
|
||||
#include <XCEditor/Fields/UIEditorVector3Field.h>
|
||||
|
||||
#include <XCEngine/UI/Text/UITextInputController.h>
|
||||
#include <XCEngine/UI/Types.h>
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Widgets/UIEditorVector4Field.h>
|
||||
#include <XCEditor/Fields/UIEditorVector4Field.h>
|
||||
|
||||
#include <XCEngine/UI/Text/UITextInputController.h>
|
||||
#include <XCEngine/UI/Types.h>
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorCommandRegistry.h>
|
||||
#include <XCEditor/Foundation/UIEditorCommandRegistry.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorWorkspaceController.h>
|
||||
#include <XCEditor/Shell/UIEditorWorkspaceController.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorCommandDispatcher.h>
|
||||
#include <XCEditor/Foundation/UIEditorCommandDispatcher.h>
|
||||
|
||||
#include <XCEngine/UI/Input/UIShortcutRegistry.h>
|
||||
|
||||
76
new_editor/include/XCEditor/Foundation/UIEditorTheme.h
Normal file
76
new_editor/include/XCEditor/Foundation/UIEditorTheme.h
Normal file
@@ -0,0 +1,76 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Collections/UIEditorListView.h>
|
||||
#include <XCEditor/Collections/UIEditorScrollView.h>
|
||||
#include <XCEditor/Collections/UIEditorTabStrip.h>
|
||||
#include <XCEditor/Collections/UIEditorTreeView.h>
|
||||
#include <XCEditor/Fields/UIEditorAssetField.h>
|
||||
#include <XCEditor/Fields/UIEditorBoolField.h>
|
||||
#include <XCEditor/Fields/UIEditorColorField.h>
|
||||
#include <XCEditor/Fields/UIEditorEnumField.h>
|
||||
#include <XCEditor/Fields/UIEditorNumberField.h>
|
||||
#include <XCEditor/Fields/UIEditorObjectField.h>
|
||||
#include <XCEditor/Fields/UIEditorPropertyGrid.h>
|
||||
#include <XCEditor/Fields/UIEditorTextField.h>
|
||||
#include <XCEditor/Fields/UIEditorVector2Field.h>
|
||||
#include <XCEditor/Fields/UIEditorVector3Field.h>
|
||||
#include <XCEditor/Fields/UIEditorVector4Field.h>
|
||||
#include <XCEditor/Shell/UIEditorDockHost.h>
|
||||
#include <XCEditor/Shell/UIEditorMenuBar.h>
|
||||
#include <XCEditor/Shell/UIEditorMenuPopup.h>
|
||||
#include <XCEditor/Shell/UIEditorPanelFrame.h>
|
||||
#include <XCEditor/Shell/UIEditorShellCompose.h>
|
||||
#include <XCEditor/Shell/UIEditorShellInteraction.h>
|
||||
#include <XCEditor/Shell/UIEditorStatusBar.h>
|
||||
#include <XCEditor/Shell/UIEditorViewportSlot.h>
|
||||
|
||||
namespace XCEngine::UI::Editor {
|
||||
|
||||
const Widgets::UIEditorBoolFieldMetrics& ResolveUIEditorBoolFieldMetrics();
|
||||
const Widgets::UIEditorBoolFieldPalette& ResolveUIEditorBoolFieldPalette();
|
||||
const Widgets::UIEditorNumberFieldMetrics& ResolveUIEditorNumberFieldMetrics();
|
||||
const Widgets::UIEditorNumberFieldPalette& ResolveUIEditorNumberFieldPalette();
|
||||
const Widgets::UIEditorTextFieldMetrics& ResolveUIEditorTextFieldMetrics();
|
||||
const Widgets::UIEditorTextFieldPalette& ResolveUIEditorTextFieldPalette();
|
||||
const Widgets::UIEditorVector2FieldMetrics& ResolveUIEditorVector2FieldMetrics();
|
||||
const Widgets::UIEditorVector2FieldPalette& ResolveUIEditorVector2FieldPalette();
|
||||
const Widgets::UIEditorVector3FieldMetrics& ResolveUIEditorVector3FieldMetrics();
|
||||
const Widgets::UIEditorVector3FieldPalette& ResolveUIEditorVector3FieldPalette();
|
||||
const Widgets::UIEditorVector4FieldMetrics& ResolveUIEditorVector4FieldMetrics();
|
||||
const Widgets::UIEditorVector4FieldPalette& ResolveUIEditorVector4FieldPalette();
|
||||
const Widgets::UIEditorEnumFieldMetrics& ResolveUIEditorEnumFieldMetrics();
|
||||
const Widgets::UIEditorEnumFieldPalette& ResolveUIEditorEnumFieldPalette();
|
||||
const Widgets::UIEditorColorFieldMetrics& ResolveUIEditorColorFieldMetrics();
|
||||
const Widgets::UIEditorColorFieldPalette& ResolveUIEditorColorFieldPalette();
|
||||
const Widgets::UIEditorObjectFieldMetrics& ResolveUIEditorObjectFieldMetrics();
|
||||
const Widgets::UIEditorObjectFieldPalette& ResolveUIEditorObjectFieldPalette();
|
||||
const Widgets::UIEditorAssetFieldMetrics& ResolveUIEditorAssetFieldMetrics();
|
||||
const Widgets::UIEditorAssetFieldPalette& ResolveUIEditorAssetFieldPalette();
|
||||
const Widgets::UIEditorMenuPopupMetrics& ResolveUIEditorMenuPopupMetrics();
|
||||
const Widgets::UIEditorMenuPopupPalette& ResolveUIEditorMenuPopupPalette();
|
||||
const Widgets::UIEditorListViewMetrics& ResolveUIEditorListViewMetrics();
|
||||
const Widgets::UIEditorListViewPalette& ResolveUIEditorListViewPalette();
|
||||
const Widgets::UIEditorTreeViewMetrics& ResolveUIEditorTreeViewMetrics();
|
||||
const Widgets::UIEditorTreeViewPalette& ResolveUIEditorTreeViewPalette();
|
||||
const Widgets::UIEditorScrollViewMetrics& ResolveUIEditorScrollViewMetrics();
|
||||
const Widgets::UIEditorScrollViewPalette& ResolveUIEditorScrollViewPalette();
|
||||
const Widgets::UIEditorTabStripMetrics& ResolveUIEditorTabStripMetrics();
|
||||
const Widgets::UIEditorTabStripPalette& ResolveUIEditorTabStripPalette();
|
||||
const Widgets::UIEditorMenuBarMetrics& ResolveUIEditorMenuBarMetrics();
|
||||
const Widgets::UIEditorMenuBarPalette& ResolveUIEditorMenuBarPalette();
|
||||
const Widgets::UIEditorStatusBarMetrics& ResolveUIEditorStatusBarMetrics();
|
||||
const Widgets::UIEditorStatusBarPalette& ResolveUIEditorStatusBarPalette();
|
||||
const Widgets::UIEditorPanelFrameMetrics& ResolveUIEditorPanelFrameMetrics();
|
||||
const Widgets::UIEditorPanelFramePalette& ResolveUIEditorPanelFramePalette();
|
||||
const Widgets::UIEditorDockHostMetrics& ResolveUIEditorDockHostMetrics();
|
||||
const Widgets::UIEditorDockHostPalette& ResolveUIEditorDockHostPalette();
|
||||
const Widgets::UIEditorViewportSlotMetrics& ResolveUIEditorViewportSlotMetrics();
|
||||
const Widgets::UIEditorViewportSlotPalette& ResolveUIEditorViewportSlotPalette();
|
||||
const UIEditorShellComposeMetrics& ResolveUIEditorShellComposeMetrics();
|
||||
const UIEditorShellComposePalette& ResolveUIEditorShellComposePalette();
|
||||
const UIEditorShellInteractionMetrics& ResolveUIEditorShellInteractionMetrics();
|
||||
const UIEditorShellInteractionPalette& ResolveUIEditorShellInteractionPalette();
|
||||
const Widgets::UIEditorPropertyGridMetrics& ResolveUIEditorPropertyGridMetrics();
|
||||
const Widgets::UIEditorPropertyGridPalette& ResolveUIEditorPropertyGridPalette();
|
||||
|
||||
} // namespace XCEngine::UI::Editor
|
||||
@@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorPanelRegistry.h>
|
||||
#include <XCEditor/Core/UIEditorWorkspaceModel.h>
|
||||
#include <XCEditor/Core/UIEditorWorkspaceSession.h>
|
||||
#include <XCEditor/Widgets/UIEditorPanelFrame.h>
|
||||
#include <XCEditor/Widgets/UIEditorTabStrip.h>
|
||||
#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>
|
||||
|
||||
@@ -35,10 +35,16 @@ struct UIEditorDockHostHitTarget {
|
||||
std::size_t index = UIEditorTabStripInvalidIndex;
|
||||
};
|
||||
|
||||
struct UIEditorDockHostTabStripVisualState {
|
||||
std::string nodeId = {};
|
||||
UIEditorTabStripState state = {};
|
||||
};
|
||||
|
||||
struct UIEditorDockHostState {
|
||||
bool focused = false;
|
||||
UIEditorDockHostHitTarget hoveredTarget = {};
|
||||
std::string activeSplitterNodeId = {};
|
||||
std::vector<UIEditorDockHostTabStripVisualState> tabStripStates = {};
|
||||
};
|
||||
|
||||
struct UIEditorDockHostMetrics {
|
||||
@@ -58,17 +64,17 @@ struct UIEditorDockHostPalette {
|
||||
UIEditorTabStripPalette tabStripPalette = {};
|
||||
UIEditorPanelFramePalette panelFramePalette = {};
|
||||
::XCEngine::UI::UIColor splitterColor =
|
||||
::XCEngine::UI::UIColor(0.26f, 0.26f, 0.26f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.22f, 0.23f, 0.25f, 1.0f);
|
||||
::XCEngine::UI::UIColor splitterHoveredColor =
|
||||
::XCEngine::UI::UIColor(0.36f, 0.36f, 0.36f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.32f, 0.34f, 0.36f, 1.0f);
|
||||
::XCEngine::UI::UIColor splitterActiveColor =
|
||||
::XCEngine::UI::UIColor(0.86f, 0.86f, 0.86f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.50f, 0.52f, 0.56f, 1.0f);
|
||||
::XCEngine::UI::UIColor placeholderTitleColor =
|
||||
::XCEngine::UI::UIColor(0.94f, 0.94f, 0.94f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.93f, 0.94f, 0.96f, 1.0f);
|
||||
::XCEngine::UI::UIColor placeholderTextColor =
|
||||
::XCEngine::UI::UIColor(0.72f, 0.72f, 0.72f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.70f, 0.72f, 0.74f, 1.0f);
|
||||
::XCEngine::UI::UIColor placeholderMutedColor =
|
||||
::XCEngine::UI::UIColor(0.58f, 0.58f, 0.58f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.58f, 0.59f, 0.62f, 1.0f);
|
||||
};
|
||||
|
||||
struct UIEditorDockHostTabItemLayout {
|
||||
@@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorWorkspaceController.h>
|
||||
#include <XCEditor/Widgets/UIEditorDockHost.h>
|
||||
#include <XCEditor/Collections/UIEditorTabStripInteraction.h>
|
||||
#include <XCEditor/Shell/UIEditorWorkspaceController.h>
|
||||
#include <XCEditor/Shell/UIEditorDockHost.h>
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
#include <XCEngine/UI/Widgets/UISplitterInteraction.h>
|
||||
@@ -11,9 +12,15 @@
|
||||
|
||||
namespace XCEngine::UI::Editor {
|
||||
|
||||
struct UIEditorDockHostTabStripInteractionEntry {
|
||||
std::string nodeId = {};
|
||||
UIEditorTabStripInteractionState state = {};
|
||||
};
|
||||
|
||||
struct UIEditorDockHostInteractionState {
|
||||
Widgets::UIEditorDockHostState dockHostState = {};
|
||||
::XCEngine::UI::Widgets::UISplitterDragState splitterDragState = {};
|
||||
std::vector<UIEditorDockHostTabStripInteractionEntry> tabStripInteractions = {};
|
||||
::XCEngine::UI::UIPoint pointerPosition = {};
|
||||
bool hasPointerPosition = false;
|
||||
};
|
||||
@@ -34,7 +34,7 @@ struct UIEditorMenuBarMetrics {
|
||||
float estimatedGlyphWidth = 7.0f;
|
||||
float labelInsetY = -1.0f;
|
||||
float barCornerRounding = 8.0f;
|
||||
float buttonCornerRounding = 7.0f;
|
||||
float buttonCornerRounding = 6.0f;
|
||||
float baseBorderThickness = 1.0f;
|
||||
float focusedBorderThickness = 2.0f;
|
||||
float openBorderThickness = 1.5f;
|
||||
@@ -42,25 +42,25 @@ struct UIEditorMenuBarMetrics {
|
||||
|
||||
struct UIEditorMenuBarPalette {
|
||||
::XCEngine::UI::UIColor barColor =
|
||||
::XCEngine::UI::UIColor(0.16f, 0.16f, 0.16f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.18f, 0.18f, 0.19f, 1.0f);
|
||||
::XCEngine::UI::UIColor buttonColor =
|
||||
::XCEngine::UI::UIColor(0.23f, 0.23f, 0.23f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.21f, 0.22f, 0.24f, 1.0f);
|
||||
::XCEngine::UI::UIColor buttonHoveredColor =
|
||||
::XCEngine::UI::UIColor(0.29f, 0.29f, 0.29f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.27f, 0.28f, 0.30f, 1.0f);
|
||||
::XCEngine::UI::UIColor buttonOpenColor =
|
||||
::XCEngine::UI::UIColor(0.35f, 0.35f, 0.35f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.33f, 0.35f, 0.38f, 1.0f);
|
||||
::XCEngine::UI::UIColor borderColor =
|
||||
::XCEngine::UI::UIColor(0.30f, 0.30f, 0.30f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.30f, 0.32f, 0.34f, 1.0f);
|
||||
::XCEngine::UI::UIColor focusedBorderColor =
|
||||
::XCEngine::UI::UIColor(0.84f, 0.84f, 0.84f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.78f, 0.80f, 0.84f, 1.0f);
|
||||
::XCEngine::UI::UIColor openBorderColor =
|
||||
::XCEngine::UI::UIColor(0.68f, 0.68f, 0.68f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.50f, 0.52f, 0.56f, 1.0f);
|
||||
::XCEngine::UI::UIColor textPrimary =
|
||||
::XCEngine::UI::UIColor(0.94f, 0.94f, 0.94f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.93f, 0.94f, 0.96f, 1.0f);
|
||||
::XCEngine::UI::UIColor textMuted =
|
||||
::XCEngine::UI::UIColor(0.74f, 0.74f, 0.74f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.70f, 0.72f, 0.74f, 1.0f);
|
||||
::XCEngine::UI::UIColor textDisabled =
|
||||
::XCEngine::UI::UIColor(0.52f, 0.52f, 0.52f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.54f, 0.55f, 0.58f, 1.0f);
|
||||
};
|
||||
|
||||
struct UIEditorMenuBarLayout {
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorCommandDispatcher.h>
|
||||
#include <XCEditor/Foundation/UIEditorCommandDispatcher.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorMenuModel.h>
|
||||
#include <XCEditor/Shell/UIEditorMenuModel.h>
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
|
||||
#include <cstddef>
|
||||
@@ -24,8 +24,8 @@ struct UIEditorMenuSessionMutationResult {
|
||||
std::string openRootMenuId = {};
|
||||
std::string openedPopupId = {};
|
||||
std::vector<std::string> closedPopupIds = {};
|
||||
Widgets::UIPopupDismissReason dismissReason =
|
||||
Widgets::UIPopupDismissReason::None;
|
||||
::XCEngine::UI::Widgets::UIPopupDismissReason dismissReason =
|
||||
::XCEngine::UI::Widgets::UIPopupDismissReason::None;
|
||||
|
||||
[[nodiscard]] bool HasOpenMenu() const {
|
||||
return !openRootMenuId.empty();
|
||||
@@ -34,7 +34,7 @@ struct UIEditorMenuSessionMutationResult {
|
||||
|
||||
class UIEditorMenuSession {
|
||||
public:
|
||||
const Widgets::UIPopupOverlayModel& GetPopupOverlayModel() const {
|
||||
const ::XCEngine::UI::Widgets::UIPopupOverlayModel& GetPopupOverlayModel() const {
|
||||
return m_popupOverlayModel;
|
||||
}
|
||||
|
||||
@@ -66,23 +66,23 @@ public:
|
||||
|
||||
UIEditorMenuSessionMutationResult OpenRootMenu(
|
||||
std::string_view menuId,
|
||||
Widgets::UIPopupOverlayEntry entry);
|
||||
::XCEngine::UI::Widgets::UIPopupOverlayEntry entry);
|
||||
|
||||
UIEditorMenuSessionMutationResult OpenMenuBarRoot(
|
||||
std::string_view menuId,
|
||||
Widgets::UIPopupOverlayEntry entry);
|
||||
::XCEngine::UI::Widgets::UIPopupOverlayEntry entry);
|
||||
|
||||
UIEditorMenuSessionMutationResult HoverMenuBarRoot(
|
||||
std::string_view menuId,
|
||||
Widgets::UIPopupOverlayEntry entry);
|
||||
::XCEngine::UI::Widgets::UIPopupOverlayEntry entry);
|
||||
|
||||
UIEditorMenuSessionMutationResult HoverSubmenu(
|
||||
std::string_view itemId,
|
||||
Widgets::UIPopupOverlayEntry entry);
|
||||
::XCEngine::UI::Widgets::UIPopupOverlayEntry entry);
|
||||
|
||||
UIEditorMenuSessionMutationResult CloseAll(
|
||||
Widgets::UIPopupDismissReason dismissReason =
|
||||
Widgets::UIPopupDismissReason::Programmatic);
|
||||
::XCEngine::UI::Widgets::UIPopupDismissReason dismissReason =
|
||||
::XCEngine::UI::Widgets::UIPopupDismissReason::Programmatic);
|
||||
|
||||
UIEditorMenuSessionMutationResult DismissFromEscape();
|
||||
UIEditorMenuSessionMutationResult DismissFromPointerDown(
|
||||
@@ -92,13 +92,13 @@ public:
|
||||
|
||||
private:
|
||||
UIEditorMenuSessionMutationResult BuildResult(
|
||||
const Widgets::UIPopupOverlayMutationResult& mutation) const;
|
||||
const ::XCEngine::UI::Widgets::UIPopupOverlayMutationResult& mutation) const;
|
||||
|
||||
void RemoveClosedPopupStates(const std::vector<std::string>& closedPopupIds);
|
||||
void RebuildDerivedState();
|
||||
|
||||
std::string m_openRootMenuId = {};
|
||||
Widgets::UIPopupOverlayModel m_popupOverlayModel = {};
|
||||
::XCEngine::UI::Widgets::UIPopupOverlayModel m_popupOverlayModel = {};
|
||||
std::vector<UIEditorMenuPopupState> m_popupStates = {};
|
||||
std::vector<std::string> m_openSubmenuItemIds = {};
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorPanelRegistry.h>
|
||||
#include <XCEditor/Widgets/UIEditorDockHost.h>
|
||||
#include <XCEditor/Shell/UIEditorPanelRegistry.h>
|
||||
#include <XCEditor/Shell/UIEditorDockHost.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
@@ -41,7 +41,7 @@ struct UIEditorPanelFrameText {
|
||||
};
|
||||
|
||||
struct UIEditorPanelFrameMetrics {
|
||||
float cornerRounding = 10.0f;
|
||||
float cornerRounding = 8.0f;
|
||||
float headerHeight = 36.0f;
|
||||
float footerHeight = 24.0f;
|
||||
float contentPadding = 12.0f;
|
||||
@@ -61,35 +61,35 @@ struct UIEditorPanelFrameMetrics {
|
||||
|
||||
struct UIEditorPanelFramePalette {
|
||||
::XCEngine::UI::UIColor surfaceColor =
|
||||
::XCEngine::UI::UIColor(0.16f, 0.16f, 0.16f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.15f, 0.15f, 0.16f, 1.0f);
|
||||
::XCEngine::UI::UIColor headerColor =
|
||||
::XCEngine::UI::UIColor(0.20f, 0.20f, 0.20f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.18f, 0.18f, 0.19f, 1.0f);
|
||||
::XCEngine::UI::UIColor footerColor =
|
||||
::XCEngine::UI::UIColor(0.19f, 0.19f, 0.19f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.17f, 0.17f, 0.18f, 1.0f);
|
||||
::XCEngine::UI::UIColor borderColor =
|
||||
::XCEngine::UI::UIColor(0.30f, 0.30f, 0.30f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.30f, 0.32f, 0.34f, 1.0f);
|
||||
::XCEngine::UI::UIColor hoveredBorderColor =
|
||||
::XCEngine::UI::UIColor(0.42f, 0.42f, 0.42f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.39f, 0.41f, 0.43f, 1.0f);
|
||||
::XCEngine::UI::UIColor activeBorderColor =
|
||||
::XCEngine::UI::UIColor(0.58f, 0.58f, 0.58f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.50f, 0.52f, 0.56f, 1.0f);
|
||||
::XCEngine::UI::UIColor focusedBorderColor =
|
||||
::XCEngine::UI::UIColor(0.84f, 0.84f, 0.84f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.78f, 0.80f, 0.84f, 1.0f);
|
||||
::XCEngine::UI::UIColor textPrimary =
|
||||
::XCEngine::UI::UIColor(0.94f, 0.94f, 0.94f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.93f, 0.94f, 0.96f, 1.0f);
|
||||
::XCEngine::UI::UIColor textSecondary =
|
||||
::XCEngine::UI::UIColor(0.71f, 0.71f, 0.71f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.70f, 0.72f, 0.74f, 1.0f);
|
||||
::XCEngine::UI::UIColor textMuted =
|
||||
::XCEngine::UI::UIColor(0.60f, 0.60f, 0.60f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.58f, 0.59f, 0.62f, 1.0f);
|
||||
::XCEngine::UI::UIColor actionButtonColor =
|
||||
::XCEngine::UI::UIColor(0.24f, 0.24f, 0.24f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.21f, 0.22f, 0.24f, 1.0f);
|
||||
::XCEngine::UI::UIColor actionButtonHoveredColor =
|
||||
::XCEngine::UI::UIColor(0.34f, 0.34f, 0.34f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.27f, 0.28f, 0.30f, 1.0f);
|
||||
::XCEngine::UI::UIColor actionButtonSelectedColor =
|
||||
::XCEngine::UI::UIColor(0.48f, 0.48f, 0.48f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.33f, 0.35f, 0.38f, 1.0f);
|
||||
::XCEngine::UI::UIColor actionButtonBorderColor =
|
||||
::XCEngine::UI::UIColor(0.52f, 0.52f, 0.52f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.42f, 0.44f, 0.47f, 1.0f);
|
||||
::XCEngine::UI::UIColor actionGlyphColor =
|
||||
::XCEngine::UI::UIColor(0.92f, 0.92f, 0.92f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.93f, 0.94f, 0.96f, 1.0f);
|
||||
};
|
||||
|
||||
struct UIEditorPanelFrameLayout {
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorPanelRegistry.h>
|
||||
#include <XCEditor/Core/UIEditorWorkspaceSession.h>
|
||||
#include <XCEditor/Shell/UIEditorPanelRegistry.h>
|
||||
#include <XCEditor/Shell/UIEditorWorkspaceSession.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorWorkspaceCompose.h>
|
||||
#include <XCEditor/Widgets/UIEditorMenuBar.h>
|
||||
#include <XCEditor/Widgets/UIEditorStatusBar.h>
|
||||
#include <XCEditor/Shell/UIEditorWorkspaceCompose.h>
|
||||
#include <XCEditor/Shell/UIEditorMenuBar.h>
|
||||
#include <XCEditor/Shell/UIEditorStatusBar.h>
|
||||
|
||||
namespace XCEngine::UI::Editor {
|
||||
|
||||
@@ -24,6 +24,7 @@ struct UIEditorShellComposeMetrics {
|
||||
float surfaceCornerRounding = 10.0f;
|
||||
Widgets::UIEditorMenuBarMetrics menuBarMetrics = {};
|
||||
Widgets::UIEditorDockHostMetrics dockHostMetrics = {};
|
||||
Widgets::UIEditorViewportSlotMetrics viewportMetrics = {};
|
||||
Widgets::UIEditorStatusBarMetrics statusBarMetrics = {};
|
||||
};
|
||||
|
||||
@@ -34,6 +35,7 @@ struct UIEditorShellComposePalette {
|
||||
::XCEngine::UI::UIColor(0.27f, 0.27f, 0.27f, 1.0f);
|
||||
Widgets::UIEditorMenuBarPalette menuBarPalette = {};
|
||||
Widgets::UIEditorDockHostPalette dockHostPalette = {};
|
||||
Widgets::UIEditorViewportSlotPalette viewportPalette = {};
|
||||
Widgets::UIEditorStatusBarPalette statusBarPalette = {};
|
||||
};
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorMenuModel.h>
|
||||
#include <XCEditor/Core/UIEditorMenuSession.h>
|
||||
#include <XCEditor/Core/UIEditorShellCompose.h>
|
||||
#include <XCEditor/Core/UIEditorWorkspaceController.h>
|
||||
#include <XCEditor/Core/UIEditorWorkspaceInteraction.h>
|
||||
#include <XCEditor/Widgets/UIEditorMenuPopup.h>
|
||||
#include <XCEditor/Shell/UIEditorMenuModel.h>
|
||||
#include <XCEditor/Shell/UIEditorMenuSession.h>
|
||||
#include <XCEditor/Shell/UIEditorShellCompose.h>
|
||||
#include <XCEditor/Shell/UIEditorWorkspaceController.h>
|
||||
#include <XCEditor/Shell/UIEditorWorkspaceInteraction.h>
|
||||
#include <XCEditor/Shell/UIEditorMenuPopup.h>
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
|
||||
@@ -59,32 +59,32 @@ struct UIEditorStatusBarMetrics {
|
||||
float cornerRounding = 8.0f;
|
||||
float estimatedGlyphWidth = 7.0f;
|
||||
float borderThickness = 1.0f;
|
||||
float focusedBorderThickness = 1.5f;
|
||||
float focusedBorderThickness = 2.0f;
|
||||
};
|
||||
|
||||
struct UIEditorStatusBarPalette {
|
||||
::XCEngine::UI::UIColor surfaceColor =
|
||||
::XCEngine::UI::UIColor(0.15f, 0.15f, 0.15f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.15f, 0.15f, 0.16f, 1.0f);
|
||||
::XCEngine::UI::UIColor borderColor =
|
||||
::XCEngine::UI::UIColor(0.28f, 0.28f, 0.28f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.30f, 0.32f, 0.34f, 1.0f);
|
||||
::XCEngine::UI::UIColor focusedBorderColor =
|
||||
::XCEngine::UI::UIColor(0.78f, 0.78f, 0.78f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.78f, 0.80f, 0.84f, 1.0f);
|
||||
::XCEngine::UI::UIColor segmentColor =
|
||||
::XCEngine::UI::UIColor(0.17f, 0.17f, 0.17f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.19f, 0.19f, 0.21f, 1.0f);
|
||||
::XCEngine::UI::UIColor segmentHoveredColor =
|
||||
::XCEngine::UI::UIColor(0.23f, 0.23f, 0.23f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.24f, 0.26f, 0.28f, 1.0f);
|
||||
::XCEngine::UI::UIColor segmentActiveColor =
|
||||
::XCEngine::UI::UIColor(0.29f, 0.29f, 0.29f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.30f, 0.32f, 0.35f, 1.0f);
|
||||
::XCEngine::UI::UIColor segmentBorderColor =
|
||||
::XCEngine::UI::UIColor(0.35f, 0.35f, 0.35f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.42f, 0.44f, 0.47f, 1.0f);
|
||||
::XCEngine::UI::UIColor separatorColor =
|
||||
::XCEngine::UI::UIColor(0.32f, 0.32f, 0.32f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.32f, 0.34f, 0.36f, 1.0f);
|
||||
::XCEngine::UI::UIColor textPrimary =
|
||||
::XCEngine::UI::UIColor(0.92f, 0.92f, 0.92f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.93f, 0.94f, 0.96f, 1.0f);
|
||||
::XCEngine::UI::UIColor textMuted =
|
||||
::XCEngine::UI::UIColor(0.66f, 0.66f, 0.66f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.58f, 0.59f, 0.62f, 1.0f);
|
||||
::XCEngine::UI::UIColor textAccent =
|
||||
::XCEngine::UI::UIColor(0.94f, 0.94f, 0.94f, 1.0f);
|
||||
::XCEngine::UI::UIColor(0.82f, 0.86f, 0.93f, 1.0f);
|
||||
};
|
||||
|
||||
struct UIEditorStatusBarLayout {
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorViewportInputBridge.h>
|
||||
#include <XCEditor/Widgets/UIEditorViewportSlot.h>
|
||||
#include <XCEditor/Shell/UIEditorViewportInputBridge.h>
|
||||
#include <XCEditor/Shell/UIEditorViewportSlot.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
#include <XCEditor/Widgets/UIEditorStatusBar.h>
|
||||
#include <XCEditor/Shell/UIEditorStatusBar.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
@@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorPanelContentHost.h>
|
||||
#include <XCEditor/Core/UIEditorPanelRegistry.h>
|
||||
#include <XCEditor/Core/UIEditorViewportShell.h>
|
||||
#include <XCEditor/Core/UIEditorWorkspaceSession.h>
|
||||
#include <XCEditor/Widgets/UIEditorDockHost.h>
|
||||
#include <XCEditor/Shell/UIEditorPanelContentHost.h>
|
||||
#include <XCEditor/Shell/UIEditorPanelRegistry.h>
|
||||
#include <XCEditor/Shell/UIEditorViewportShell.h>
|
||||
#include <XCEditor/Shell/UIEditorWorkspaceSession.h>
|
||||
#include <XCEditor/Shell/UIEditorDockHost.h>
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
|
||||
@@ -78,7 +78,8 @@ UIEditorWorkspaceComposeRequest ResolveUIEditorWorkspaceComposeRequest(
|
||||
const UIEditorWorkspaceSession& session,
|
||||
const std::vector<UIEditorWorkspacePanelPresentationModel>& presentations,
|
||||
const Widgets::UIEditorDockHostState& dockHostState = {},
|
||||
const Widgets::UIEditorDockHostMetrics& dockHostMetrics = {});
|
||||
const Widgets::UIEditorDockHostMetrics& dockHostMetrics = {},
|
||||
const Widgets::UIEditorViewportSlotMetrics& viewportMetrics = {});
|
||||
|
||||
UIEditorWorkspaceComposeFrame UpdateUIEditorWorkspaceCompose(
|
||||
UIEditorWorkspaceComposeState& state,
|
||||
@@ -89,7 +90,8 @@ UIEditorWorkspaceComposeFrame UpdateUIEditorWorkspaceCompose(
|
||||
const std::vector<UIEditorWorkspacePanelPresentationModel>& presentations,
|
||||
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents,
|
||||
const Widgets::UIEditorDockHostState& dockHostState = {},
|
||||
const Widgets::UIEditorDockHostMetrics& dockHostMetrics = {});
|
||||
const Widgets::UIEditorDockHostMetrics& dockHostMetrics = {},
|
||||
const Widgets::UIEditorViewportSlotMetrics& viewportMetrics = {});
|
||||
|
||||
std::vector<std::string> CollectUIEditorWorkspaceComposeExternalBodyPanelIds(
|
||||
const UIEditorWorkspaceComposeFrame& frame);
|
||||
@@ -98,6 +100,8 @@ void AppendUIEditorWorkspaceCompose(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const UIEditorWorkspaceComposeFrame& frame,
|
||||
const Widgets::UIEditorDockHostPalette& dockHostPalette = {},
|
||||
const Widgets::UIEditorDockHostMetrics& dockHostMetrics = {});
|
||||
const Widgets::UIEditorDockHostMetrics& dockHostMetrics = {},
|
||||
const Widgets::UIEditorViewportSlotPalette& viewportPalette = {},
|
||||
const Widgets::UIEditorViewportSlotMetrics& viewportMetrics = {});
|
||||
|
||||
} // namespace XCEngine::UI::Editor
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorWorkspaceLayoutPersistence.h>
|
||||
#include <XCEditor/Core/UIEditorWorkspaceSession.h>
|
||||
#include <XCEditor/Shell/UIEditorWorkspaceLayoutPersistence.h>
|
||||
#include <XCEditor/Shell/UIEditorWorkspaceSession.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorDockHostInteraction.h>
|
||||
#include <XCEditor/Core/UIEditorWorkspaceCompose.h>
|
||||
#include <XCEditor/Shell/UIEditorDockHostInteraction.h>
|
||||
#include <XCEditor/Shell/UIEditorWorkspaceCompose.h>
|
||||
|
||||
#include <XCEngine/UI/Types.h>
|
||||
|
||||
@@ -41,6 +41,7 @@ UIEditorWorkspaceInteractionFrame UpdateUIEditorWorkspaceInteraction(
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
const UIEditorWorkspaceInteractionModel& model,
|
||||
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents,
|
||||
const Widgets::UIEditorDockHostMetrics& dockHostMetrics = {});
|
||||
const Widgets::UIEditorDockHostMetrics& dockHostMetrics = {},
|
||||
const Widgets::UIEditorViewportSlotMetrics& viewportMetrics = {});
|
||||
|
||||
} // namespace XCEngine::UI::Editor
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorWorkspaceSession.h>
|
||||
#include <XCEditor/Shell/UIEditorWorkspaceSession.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Core/UIEditorPanelRegistry.h>
|
||||
#include <XCEditor/Core/UIEditorWorkspaceModel.h>
|
||||
#include <XCEditor/Shell/UIEditorPanelRegistry.h>
|
||||
#include <XCEditor/Shell/UIEditorWorkspaceModel.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEngine/UI/Style/Theme.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string_view>
|
||||
|
||||
@@ -24,14 +22,11 @@ bool UsesUIEditorCollectionPrimitiveColumnLayout(UIEditorCollectionPrimitiveKind
|
||||
bool IsUIEditorCollectionPrimitiveHoverable(UIEditorCollectionPrimitiveKind kind);
|
||||
bool DoesUIEditorCollectionPrimitiveClipChildren(UIEditorCollectionPrimitiveKind kind);
|
||||
float ResolveUIEditorCollectionPrimitivePadding(
|
||||
UIEditorCollectionPrimitiveKind kind,
|
||||
const ::XCEngine::UI::Style::UITheme& theme);
|
||||
UIEditorCollectionPrimitiveKind kind);
|
||||
float ResolveUIEditorCollectionPrimitiveDefaultHeight(
|
||||
UIEditorCollectionPrimitiveKind kind,
|
||||
const ::XCEngine::UI::Style::UITheme& theme);
|
||||
UIEditorCollectionPrimitiveKind kind);
|
||||
float ResolveUIEditorCollectionPrimitiveIndent(
|
||||
UIEditorCollectionPrimitiveKind kind,
|
||||
const ::XCEngine::UI::Style::UITheme& theme,
|
||||
float indentLevel);
|
||||
|
||||
} // namespace XCEngine::UI::Editor::Widgets
|
||||
|
||||
178
new_editor/include/XCEditor/Widgets/UIEditorColorUtils.h
Normal file
178
new_editor/include/XCEditor/Widgets/UIEditorColorUtils.h
Normal file
@@ -0,0 +1,178 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
namespace XCEngine::UI::Editor::Widgets {
|
||||
|
||||
struct UIEditorHsvColor {
|
||||
float hue = 0.0f;
|
||||
float saturation = 0.0f;
|
||||
float value = 0.0f;
|
||||
float alpha = 1.0f;
|
||||
};
|
||||
|
||||
inline float ClampUIEditorColorUnit(float value) {
|
||||
return (std::clamp)(value, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
inline int ToUIEditorColorByte(float value) {
|
||||
return static_cast<int>(std::lround(ClampUIEditorColorUnit(value) * 255.0f));
|
||||
}
|
||||
|
||||
inline UIEditorHsvColor ConvertUIEditorColorToHsv(
|
||||
const ::XCEngine::UI::UIColor& color,
|
||||
float fallbackHue = 0.0f) {
|
||||
const float red = ClampUIEditorColorUnit(color.r);
|
||||
const float green = ClampUIEditorColorUnit(color.g);
|
||||
const float blue = ClampUIEditorColorUnit(color.b);
|
||||
const float maxChannel = (std::max)({ red, green, blue });
|
||||
const float minChannel = (std::min)({ red, green, blue });
|
||||
const float delta = maxChannel - minChannel;
|
||||
|
||||
UIEditorHsvColor hsv = {};
|
||||
hsv.hue = ClampUIEditorColorUnit(fallbackHue);
|
||||
hsv.saturation = maxChannel <= 0.0f ? 0.0f : delta / maxChannel;
|
||||
hsv.value = maxChannel;
|
||||
hsv.alpha = ClampUIEditorColorUnit(color.a);
|
||||
|
||||
if (delta <= 0.00001f) {
|
||||
return hsv;
|
||||
}
|
||||
|
||||
if (maxChannel == red) {
|
||||
hsv.hue = std::fmod(((green - blue) / delta), 6.0f) / 6.0f;
|
||||
} else if (maxChannel == green) {
|
||||
hsv.hue = (((blue - red) / delta) + 2.0f) / 6.0f;
|
||||
} else {
|
||||
hsv.hue = (((red - green) / delta) + 4.0f) / 6.0f;
|
||||
}
|
||||
|
||||
if (hsv.hue < 0.0f) {
|
||||
hsv.hue += 1.0f;
|
||||
}
|
||||
return hsv;
|
||||
}
|
||||
|
||||
inline ::XCEngine::UI::UIColor ConvertUIEditorHsvToColor(const UIEditorHsvColor& hsv) {
|
||||
const float hue = ClampUIEditorColorUnit(hsv.hue);
|
||||
const float saturation = ClampUIEditorColorUnit(hsv.saturation);
|
||||
const float value = ClampUIEditorColorUnit(hsv.value);
|
||||
|
||||
if (saturation <= 0.00001f) {
|
||||
return ::XCEngine::UI::UIColor(value, value, value, ClampUIEditorColorUnit(hsv.alpha));
|
||||
}
|
||||
|
||||
const float sector = hue * 6.0f;
|
||||
const int sectorIndex = static_cast<int>(std::floor(sector)) % 6;
|
||||
const float fraction = sector - std::floor(sector);
|
||||
const float p = value * (1.0f - saturation);
|
||||
const float q = value * (1.0f - saturation * fraction);
|
||||
const float t = value * (1.0f - saturation * (1.0f - fraction));
|
||||
|
||||
float red = value;
|
||||
float green = t;
|
||||
float blue = p;
|
||||
switch (sectorIndex) {
|
||||
case 0:
|
||||
red = value;
|
||||
green = t;
|
||||
blue = p;
|
||||
break;
|
||||
case 1:
|
||||
red = q;
|
||||
green = value;
|
||||
blue = p;
|
||||
break;
|
||||
case 2:
|
||||
red = p;
|
||||
green = value;
|
||||
blue = t;
|
||||
break;
|
||||
case 3:
|
||||
red = p;
|
||||
green = q;
|
||||
blue = value;
|
||||
break;
|
||||
case 4:
|
||||
red = t;
|
||||
green = p;
|
||||
blue = value;
|
||||
break;
|
||||
case 5:
|
||||
default:
|
||||
red = value;
|
||||
green = p;
|
||||
blue = q;
|
||||
break;
|
||||
}
|
||||
|
||||
return ::XCEngine::UI::UIColor(red, green, blue, ClampUIEditorColorUnit(hsv.alpha));
|
||||
}
|
||||
|
||||
inline UIEditorHsvColor ResolveUIEditorDisplayHsv(
|
||||
const ::XCEngine::UI::UIColor& color,
|
||||
float rememberedHue,
|
||||
bool hueValid) {
|
||||
UIEditorHsvColor hsv = ConvertUIEditorColorToHsv(color, hueValid ? rememberedHue : 0.0f);
|
||||
if (hsv.saturation <= 0.00001f && hueValid) {
|
||||
hsv.hue = ClampUIEditorColorUnit(rememberedHue);
|
||||
}
|
||||
return hsv;
|
||||
}
|
||||
|
||||
inline std::string FormatUIEditorColorHex(
|
||||
const ::XCEngine::UI::UIColor& color,
|
||||
bool includeAlpha = true) {
|
||||
char buffer[16] = {};
|
||||
if (includeAlpha) {
|
||||
std::snprintf(
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
"#%02X%02X%02X%02X",
|
||||
ToUIEditorColorByte(color.r),
|
||||
ToUIEditorColorByte(color.g),
|
||||
ToUIEditorColorByte(color.b),
|
||||
ToUIEditorColorByte(color.a));
|
||||
} else {
|
||||
std::snprintf(
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
"#%02X%02X%02X",
|
||||
ToUIEditorColorByte(color.r),
|
||||
ToUIEditorColorByte(color.g),
|
||||
ToUIEditorColorByte(color.b));
|
||||
}
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
inline std::string FormatUIEditorColorChannelsText(
|
||||
const ::XCEngine::UI::UIColor& color,
|
||||
bool includeAlpha = true) {
|
||||
char buffer[64] = {};
|
||||
if (includeAlpha) {
|
||||
std::snprintf(
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
"RGBA %d, %d, %d, %d",
|
||||
ToUIEditorColorByte(color.r),
|
||||
ToUIEditorColorByte(color.g),
|
||||
ToUIEditorColorByte(color.b),
|
||||
ToUIEditorColorByte(color.a));
|
||||
} else {
|
||||
std::snprintf(
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
"RGB %d, %d, %d",
|
||||
ToUIEditorColorByte(color.r),
|
||||
ToUIEditorColorByte(color.g),
|
||||
ToUIEditorColorByte(color.b));
|
||||
}
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
} // namespace XCEngine::UI::Editor::Widgets
|
||||
@@ -4,6 +4,95 @@
|
||||
|
||||
namespace XCEngine::UI::Editor::Widgets {
|
||||
|
||||
struct UIEditorInspectorFieldStyleTokens {
|
||||
::XCEngine::UI::UIColor rowHoverColor =
|
||||
::XCEngine::UI::UIColor(0.20f, 0.20f, 0.20f, 1.0f);
|
||||
::XCEngine::UI::UIColor rowActiveColor =
|
||||
::XCEngine::UI::UIColor(0.24f, 0.24f, 0.24f, 1.0f);
|
||||
::XCEngine::UI::UIColor labelColor =
|
||||
::XCEngine::UI::UIColor(0.80f, 0.80f, 0.80f, 1.0f);
|
||||
::XCEngine::UI::UIColor valueColor =
|
||||
::XCEngine::UI::UIColor(0.92f, 0.92f, 0.92f, 1.0f);
|
||||
::XCEngine::UI::UIColor readOnlyValueColor =
|
||||
::XCEngine::UI::UIColor(0.60f, 0.60f, 0.60f, 1.0f);
|
||||
::XCEngine::UI::UIColor controlColor =
|
||||
::XCEngine::UI::UIColor(0.18f, 0.18f, 0.18f, 1.0f);
|
||||
::XCEngine::UI::UIColor controlHoverColor =
|
||||
::XCEngine::UI::UIColor(0.21f, 0.21f, 0.21f, 1.0f);
|
||||
::XCEngine::UI::UIColor controlEditingColor =
|
||||
::XCEngine::UI::UIColor(0.24f, 0.24f, 0.24f, 1.0f);
|
||||
::XCEngine::UI::UIColor controlReadOnlyColor =
|
||||
::XCEngine::UI::UIColor(0.15f, 0.15f, 0.15f, 1.0f);
|
||||
::XCEngine::UI::UIColor controlBorderColor =
|
||||
::XCEngine::UI::UIColor(0.30f, 0.30f, 0.30f, 1.0f);
|
||||
::XCEngine::UI::UIColor controlFocusedBorderColor =
|
||||
::XCEngine::UI::UIColor(0.64f, 0.64f, 0.64f, 1.0f);
|
||||
::XCEngine::UI::UIColor prefixColor =
|
||||
::XCEngine::UI::UIColor(0.20f, 0.20f, 0.20f, 1.0f);
|
||||
::XCEngine::UI::UIColor prefixBorderColor =
|
||||
::XCEngine::UI::UIColor(0.31f, 0.31f, 0.31f, 1.0f);
|
||||
::XCEngine::UI::UIColor axisXColor =
|
||||
::XCEngine::UI::UIColor(0.78f, 0.42f, 0.42f, 1.0f);
|
||||
::XCEngine::UI::UIColor axisYColor =
|
||||
::XCEngine::UI::UIColor(0.56f, 0.72f, 0.46f, 1.0f);
|
||||
::XCEngine::UI::UIColor axisZColor =
|
||||
::XCEngine::UI::UIColor(0.45f, 0.62f, 0.82f, 1.0f);
|
||||
::XCEngine::UI::UIColor axisWColor =
|
||||
::XCEngine::UI::UIColor(0.76f, 0.66f, 0.42f, 1.0f);
|
||||
::XCEngine::UI::UIColor arrowColor =
|
||||
::XCEngine::UI::UIColor(0.88f, 0.88f, 0.88f, 1.0f);
|
||||
::XCEngine::UI::UIColor swatchBorderColor =
|
||||
::XCEngine::UI::UIColor(0.30f, 0.30f, 0.30f, 1.0f);
|
||||
::XCEngine::UI::UIColor swatchHoverBorderColor =
|
||||
::XCEngine::UI::UIColor(0.64f, 0.64f, 0.64f, 1.0f);
|
||||
::XCEngine::UI::UIColor swatchReadOnlyOverlayColor =
|
||||
::XCEngine::UI::UIColor(0.08f, 0.08f, 0.08f, 0.18f);
|
||||
::XCEngine::UI::UIColor popupColor =
|
||||
::XCEngine::UI::UIColor(0.20f, 0.20f, 0.20f, 1.0f);
|
||||
::XCEngine::UI::UIColor popupBorderColor =
|
||||
::XCEngine::UI::UIColor(0.12f, 0.12f, 0.12f, 1.0f);
|
||||
::XCEngine::UI::UIColor popupHeaderColor =
|
||||
::XCEngine::UI::UIColor(0.17f, 0.17f, 0.17f, 1.0f);
|
||||
::XCEngine::UI::UIColor popupTitleColor =
|
||||
::XCEngine::UI::UIColor(0.93f, 0.93f, 0.93f, 1.0f);
|
||||
::XCEngine::UI::UIColor popupTextColor =
|
||||
::XCEngine::UI::UIColor(0.86f, 0.86f, 0.86f, 1.0f);
|
||||
::XCEngine::UI::UIColor popupTextMutedColor =
|
||||
::XCEngine::UI::UIColor(0.72f, 0.72f, 0.72f, 1.0f);
|
||||
::XCEngine::UI::UIColor previewBorderColor =
|
||||
::XCEngine::UI::UIColor(0.11f, 0.11f, 0.11f, 1.0f);
|
||||
::XCEngine::UI::UIColor previewBaseColor =
|
||||
::XCEngine::UI::UIColor(0.19f, 0.19f, 0.19f, 1.0f);
|
||||
::XCEngine::UI::UIColor checkerLightColor =
|
||||
::XCEngine::UI::UIColor(0.84f, 0.84f, 0.84f, 1.0f);
|
||||
::XCEngine::UI::UIColor checkerDarkColor =
|
||||
::XCEngine::UI::UIColor(0.55f, 0.55f, 0.55f, 1.0f);
|
||||
::XCEngine::UI::UIColor sliderBorderColor =
|
||||
::XCEngine::UI::UIColor(0.11f, 0.11f, 0.11f, 1.0f);
|
||||
::XCEngine::UI::UIColor numericBoxColor =
|
||||
::XCEngine::UI::UIColor(0.17f, 0.17f, 0.17f, 1.0f);
|
||||
::XCEngine::UI::UIColor numericBoxBorderColor =
|
||||
::XCEngine::UI::UIColor(0.11f, 0.11f, 0.11f, 1.0f);
|
||||
::XCEngine::UI::UIColor numericBoxTextColor =
|
||||
::XCEngine::UI::UIColor(0.93f, 0.93f, 0.93f, 1.0f);
|
||||
::XCEngine::UI::UIColor closeButtonColor =
|
||||
::XCEngine::UI::UIColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
::XCEngine::UI::UIColor closeButtonHoverColor =
|
||||
::XCEngine::UI::UIColor(0.25f, 0.25f, 0.25f, 1.0f);
|
||||
::XCEngine::UI::UIColor closeGlyphColor =
|
||||
::XCEngine::UI::UIColor(0.85f, 0.85f, 0.85f, 1.0f);
|
||||
::XCEngine::UI::UIColor handleFillColor =
|
||||
::XCEngine::UI::UIColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
::XCEngine::UI::UIColor handleStrokeColor =
|
||||
::XCEngine::UI::UIColor(0.10f, 0.10f, 0.10f, 0.5f);
|
||||
float controlTrailingInset = 9.0f;
|
||||
float controlMinWidth = 88.0f;
|
||||
float dropdownArrowWidth = 14.0f;
|
||||
float vectorComponentMinWidth = 74.0f;
|
||||
float vectorPrefixWidth = 18.0f;
|
||||
float vectorPrefixGap = 5.0f;
|
||||
};
|
||||
|
||||
struct UIEditorFieldRowLayoutMetrics {
|
||||
float rowHeight = 22.0f;
|
||||
float horizontalPadding = 12.0f;
|
||||
@@ -19,6 +108,14 @@ struct UIEditorFieldRowLayout {
|
||||
::XCEngine::UI::UIRect controlRect = {};
|
||||
};
|
||||
|
||||
const UIEditorInspectorFieldStyleTokens& GetUIEditorInspectorFieldStyleTokens();
|
||||
|
||||
bool AreUIEditorFieldMetricsEqual(float lhs, float rhs);
|
||||
|
||||
bool AreUIEditorFieldColorsEqual(
|
||||
const ::XCEngine::UI::UIColor& lhs,
|
||||
const ::XCEngine::UI::UIColor& rhs);
|
||||
|
||||
UIEditorFieldRowLayout BuildUIEditorFieldRowLayout(
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
float minimumControlWidth,
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace XCEngine::UI::Editor::Widgets {
|
||||
|
||||
struct UIEditorPanelChromeState {
|
||||
bool active = false;
|
||||
bool hovered = false;
|
||||
};
|
||||
|
||||
struct UIEditorPanelChromeText {
|
||||
std::string_view title = {};
|
||||
std::string_view subtitle = {};
|
||||
std::string_view footer = {};
|
||||
};
|
||||
|
||||
struct UIEditorPanelChromeMetrics {
|
||||
float cornerRounding = 18.0f;
|
||||
float headerHeight = 42.0f;
|
||||
float titleInsetX = 16.0f;
|
||||
float titleInsetY = 12.0f;
|
||||
float subtitleInsetY = 28.0f;
|
||||
float footerInsetX = 16.0f;
|
||||
float footerInsetBottom = 18.0f;
|
||||
float activeBorderThickness = 2.0f;
|
||||
float inactiveBorderThickness = 1.0f;
|
||||
};
|
||||
|
||||
struct UIEditorPanelChromePalette {
|
||||
::XCEngine::UI::UIColor surfaceColor =
|
||||
::XCEngine::UI::UIColor(9.0f / 255.0f, 13.0f / 255.0f, 18.0f / 255.0f, 212.0f / 255.0f);
|
||||
::XCEngine::UI::UIColor borderColor =
|
||||
::XCEngine::UI::UIColor(53.0f / 255.0f, 72.0f / 255.0f, 96.0f / 255.0f, 1.0f);
|
||||
::XCEngine::UI::UIColor accentColor =
|
||||
::XCEngine::UI::UIColor(84.0f / 255.0f, 176.0f / 255.0f, 244.0f / 255.0f, 1.0f);
|
||||
::XCEngine::UI::UIColor hoveredAccentColor =
|
||||
::XCEngine::UI::UIColor(1.0f, 206.0f / 255.0f, 112.0f / 255.0f, 1.0f);
|
||||
::XCEngine::UI::UIColor headerColor =
|
||||
::XCEngine::UI::UIColor(13.0f / 255.0f, 20.0f / 255.0f, 28.0f / 255.0f, 242.0f / 255.0f);
|
||||
::XCEngine::UI::UIColor textPrimary =
|
||||
::XCEngine::UI::UIColor(232.0f / 255.0f, 238.0f / 255.0f, 246.0f / 255.0f, 1.0f);
|
||||
::XCEngine::UI::UIColor textSecondary =
|
||||
::XCEngine::UI::UIColor(150.0f / 255.0f, 164.0f / 255.0f, 184.0f / 255.0f, 1.0f);
|
||||
::XCEngine::UI::UIColor textMuted =
|
||||
::XCEngine::UI::UIColor(108.0f / 255.0f, 123.0f / 255.0f, 145.0f / 255.0f, 1.0f);
|
||||
};
|
||||
|
||||
inline ::XCEngine::UI::UIRect BuildUIEditorPanelChromeHeaderRect(
|
||||
const ::XCEngine::UI::UIRect& panelRect,
|
||||
const UIEditorPanelChromeMetrics& metrics = {}) {
|
||||
return ::XCEngine::UI::UIRect(
|
||||
panelRect.x,
|
||||
panelRect.y,
|
||||
panelRect.width,
|
||||
metrics.headerHeight);
|
||||
}
|
||||
|
||||
inline ::XCEngine::UI::UIColor ResolveUIEditorPanelChromeBorderColor(
|
||||
const UIEditorPanelChromeState& state,
|
||||
const UIEditorPanelChromePalette& palette = {}) {
|
||||
if (state.active) {
|
||||
return palette.accentColor;
|
||||
}
|
||||
|
||||
if (state.hovered) {
|
||||
return palette.hoveredAccentColor;
|
||||
}
|
||||
|
||||
return palette.borderColor;
|
||||
}
|
||||
|
||||
inline float ResolveUIEditorPanelChromeBorderThickness(
|
||||
const UIEditorPanelChromeState& state,
|
||||
const UIEditorPanelChromeMetrics& metrics = {}) {
|
||||
return state.active
|
||||
? metrics.activeBorderThickness
|
||||
: metrics.inactiveBorderThickness;
|
||||
}
|
||||
|
||||
inline void AppendUIEditorPanelChromeBackground(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const ::XCEngine::UI::UIRect& panelRect,
|
||||
const UIEditorPanelChromeState& state,
|
||||
const UIEditorPanelChromePalette& palette = {},
|
||||
const UIEditorPanelChromeMetrics& metrics = {}) {
|
||||
drawList.AddFilledRect(panelRect, palette.surfaceColor, metrics.cornerRounding);
|
||||
drawList.AddRectOutline(
|
||||
panelRect,
|
||||
ResolveUIEditorPanelChromeBorderColor(state, palette),
|
||||
ResolveUIEditorPanelChromeBorderThickness(state, metrics),
|
||||
metrics.cornerRounding);
|
||||
drawList.AddFilledRect(
|
||||
BuildUIEditorPanelChromeHeaderRect(panelRect, metrics),
|
||||
palette.headerColor,
|
||||
metrics.cornerRounding);
|
||||
}
|
||||
|
||||
inline void AppendUIEditorPanelChromeForeground(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const ::XCEngine::UI::UIRect& panelRect,
|
||||
const UIEditorPanelChromeText& text,
|
||||
const UIEditorPanelChromePalette& palette = {},
|
||||
const UIEditorPanelChromeMetrics& metrics = {}) {
|
||||
if (!text.title.empty()) {
|
||||
drawList.AddText(
|
||||
::XCEngine::UI::UIPoint(panelRect.x + metrics.titleInsetX, panelRect.y + metrics.titleInsetY),
|
||||
std::string(text.title),
|
||||
palette.textPrimary);
|
||||
}
|
||||
|
||||
if (!text.subtitle.empty()) {
|
||||
drawList.AddText(
|
||||
::XCEngine::UI::UIPoint(panelRect.x + metrics.titleInsetX, panelRect.y + metrics.subtitleInsetY),
|
||||
std::string(text.subtitle),
|
||||
palette.textSecondary);
|
||||
}
|
||||
|
||||
if (!text.footer.empty()) {
|
||||
drawList.AddText(
|
||||
::XCEngine::UI::UIPoint(
|
||||
panelRect.x + metrics.footerInsetX,
|
||||
panelRect.y + panelRect.height - metrics.footerInsetBottom),
|
||||
std::string(text.footer),
|
||||
palette.textMuted);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace XCEngine::UI::Editor::Widgets
|
||||
Reference in New Issue
Block a user