Add native scrolling to new editor tree views
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Collections/UIEditorScrollView.h>
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
#include <XCEngine/UI/Widgets/UIExpansionModel.h>
|
||||
#include <XCEngine/UI/Widgets/UISelectionModel.h>
|
||||
@@ -32,6 +34,7 @@ struct UIEditorTreeViewItem {
|
||||
struct UIEditorTreeViewState {
|
||||
std::string hoveredItemId = {};
|
||||
bool focused = false;
|
||||
UIEditorScrollViewState scrollViewState = {};
|
||||
};
|
||||
|
||||
struct UIEditorTreeViewMetrics {
|
||||
@@ -48,6 +51,7 @@ struct UIEditorTreeViewMetrics {
|
||||
float cornerRounding = 6.0f;
|
||||
float borderThickness = 1.0f;
|
||||
float focusedBorderThickness = 2.0f;
|
||||
UIEditorScrollViewMetrics scrollViewMetrics = {};
|
||||
};
|
||||
|
||||
struct UIEditorTreeViewPalette {
|
||||
@@ -67,10 +71,12 @@ struct UIEditorTreeViewPalette {
|
||||
::XCEngine::UI::UIColor(0.62f, 0.62f, 0.62f, 1.0f);
|
||||
::XCEngine::UI::UIColor textColor =
|
||||
::XCEngine::UI::UIColor(0.92f, 0.92f, 0.92f, 1.0f);
|
||||
UIEditorScrollViewPalette scrollViewPalette = {};
|
||||
};
|
||||
|
||||
struct UIEditorTreeViewLayout {
|
||||
::XCEngine::UI::UIRect bounds = {};
|
||||
UIEditorScrollViewLayout scrollViewLayout = {};
|
||||
std::vector<std::size_t> visibleItemIndices = {};
|
||||
std::vector<::XCEngine::UI::UIRect> rowRects = {};
|
||||
std::vector<::XCEngine::UI::UIRect> disclosureRects = {};
|
||||
@@ -111,11 +117,17 @@ std::size_t FindUIEditorTreeViewFirstVisibleChildItemIndex(
|
||||
const ::XCEngine::UI::Widgets::UIExpansionModel& expansionModel,
|
||||
std::size_t itemIndex);
|
||||
|
||||
float MeasureUIEditorTreeViewContentHeight(
|
||||
const std::vector<UIEditorTreeViewItem>& items,
|
||||
const ::XCEngine::UI::Widgets::UIExpansionModel& expansionModel,
|
||||
const UIEditorTreeViewMetrics& metrics = {});
|
||||
|
||||
UIEditorTreeViewLayout BuildUIEditorTreeViewLayout(
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
const std::vector<UIEditorTreeViewItem>& items,
|
||||
const ::XCEngine::UI::Widgets::UIExpansionModel& expansionModel,
|
||||
const UIEditorTreeViewMetrics& metrics = {});
|
||||
const UIEditorTreeViewMetrics& metrics = {},
|
||||
float verticalOffset = 0.0f);
|
||||
|
||||
UIEditorTreeViewHitTarget HitTestUIEditorTreeView(
|
||||
const UIEditorTreeViewLayout& layout,
|
||||
|
||||
Reference in New Issue
Block a user