Refactor XCUI editor module layout
This commit is contained in:
116
new_editor/include/XCEditor/Fields/UIEditorBoolField.h
Normal file
116
new_editor/include/XCEditor/Fields/UIEditorBoolField.h
Normal file
@@ -0,0 +1,116 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace XCEngine::UI::Editor::Widgets {
|
||||
|
||||
enum class UIEditorBoolFieldHitTargetKind : std::uint8_t {
|
||||
None = 0,
|
||||
Row,
|
||||
Checkbox
|
||||
};
|
||||
|
||||
struct UIEditorBoolFieldSpec {
|
||||
std::string fieldId = {};
|
||||
std::string label = {};
|
||||
bool value = false;
|
||||
bool readOnly = false;
|
||||
};
|
||||
|
||||
struct UIEditorBoolFieldState {
|
||||
UIEditorBoolFieldHitTargetKind hoveredTarget = UIEditorBoolFieldHitTargetKind::None;
|
||||
bool focused = false;
|
||||
bool active = false;
|
||||
};
|
||||
|
||||
struct UIEditorBoolFieldMetrics {
|
||||
float rowHeight = 22.0f;
|
||||
float horizontalPadding = 12.0f;
|
||||
float labelControlGap = 20.0f;
|
||||
float controlColumnStart = 236.0f;
|
||||
float controlTrailingInset = 8.0f;
|
||||
float checkboxSize = 18.0f;
|
||||
float labelTextInsetY = 0.0f;
|
||||
float labelFontSize = 11.0f;
|
||||
float checkboxGlyphInsetX = 2.0f;
|
||||
float checkboxGlyphInsetY = -1.0f;
|
||||
float checkboxGlyphFontSize = 10.0f;
|
||||
float cornerRounding = 0.0f;
|
||||
float checkboxRounding = 2.0f;
|
||||
float borderThickness = 1.0f;
|
||||
float focusedBorderThickness = 1.0f;
|
||||
};
|
||||
|
||||
struct UIEditorBoolFieldPalette {
|
||||
::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.14f, 0.14f, 0.14f, 1.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 checkboxColor =
|
||||
::XCEngine::UI::UIColor(0.18f, 0.18f, 0.18f, 1.0f);
|
||||
::XCEngine::UI::UIColor checkboxHoverColor =
|
||||
::XCEngine::UI::UIColor(0.21f, 0.21f, 0.21f, 1.0f);
|
||||
::XCEngine::UI::UIColor checkboxReadOnlyColor =
|
||||
::XCEngine::UI::UIColor(0.17f, 0.17f, 0.17f, 1.0f);
|
||||
::XCEngine::UI::UIColor checkboxBorderColor =
|
||||
::XCEngine::UI::UIColor(0.14f, 0.14f, 0.14f, 1.0f);
|
||||
::XCEngine::UI::UIColor checkboxMarkColor =
|
||||
::XCEngine::UI::UIColor(0.72f, 0.72f, 0.72f, 1.0f);
|
||||
::XCEngine::UI::UIColor labelColor =
|
||||
::XCEngine::UI::UIColor(0.88f, 0.88f, 0.88f, 1.0f);
|
||||
};
|
||||
|
||||
struct UIEditorBoolFieldLayout {
|
||||
::XCEngine::UI::UIRect bounds = {};
|
||||
::XCEngine::UI::UIRect labelRect = {};
|
||||
::XCEngine::UI::UIRect controlRect = {};
|
||||
::XCEngine::UI::UIRect checkboxRect = {};
|
||||
::XCEngine::UI::UIRect checkmarkRect = {};
|
||||
};
|
||||
|
||||
struct UIEditorBoolFieldHitTarget {
|
||||
UIEditorBoolFieldHitTargetKind kind = UIEditorBoolFieldHitTargetKind::None;
|
||||
};
|
||||
|
||||
UIEditorBoolFieldLayout BuildUIEditorBoolFieldLayout(
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
const UIEditorBoolFieldSpec& spec,
|
||||
const UIEditorBoolFieldMetrics& metrics = {});
|
||||
|
||||
UIEditorBoolFieldHitTarget HitTestUIEditorBoolField(
|
||||
const UIEditorBoolFieldLayout& layout,
|
||||
const ::XCEngine::UI::UIPoint& point);
|
||||
|
||||
void AppendUIEditorBoolFieldBackground(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const UIEditorBoolFieldLayout& layout,
|
||||
const UIEditorBoolFieldSpec& spec,
|
||||
const UIEditorBoolFieldState& state,
|
||||
const UIEditorBoolFieldPalette& palette = {},
|
||||
const UIEditorBoolFieldMetrics& metrics = {});
|
||||
|
||||
void AppendUIEditorBoolFieldForeground(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const UIEditorBoolFieldLayout& layout,
|
||||
const UIEditorBoolFieldSpec& spec,
|
||||
const UIEditorBoolFieldPalette& palette = {},
|
||||
const UIEditorBoolFieldMetrics& metrics = {});
|
||||
|
||||
void AppendUIEditorBoolField(
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
const UIEditorBoolFieldSpec& spec,
|
||||
const UIEditorBoolFieldState& state,
|
||||
const UIEditorBoolFieldPalette& palette = {},
|
||||
const UIEditorBoolFieldMetrics& metrics = {});
|
||||
|
||||
} // namespace XCEngine::UI::Editor::Widgets
|
||||
Reference in New Issue
Block a user