Files
XCEngine/new_editor/include/XCEditor/Collections/UIEditorTreeViewInteraction.h

73 lines
2.6 KiB
C++

#pragma once
#include <XCEditor/Collections/UIEditorScrollViewInteraction.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>
#include <vector>
namespace XCEngine::UI::Editor {
struct UIEditorHostedTreeViewInputOptions {
bool allowInteraction = false;
bool hasInputFocus = false;
bool captureActive = false;
};
struct UIEditorTreeViewInteractionState {
Widgets::UIEditorTreeViewState treeViewState = {};
UIEditorScrollViewInteractionState scrollViewInteractionState = {};
::XCEngine::UI::Widgets::UIKeyboardNavigationModel keyboardNavigation = {};
std::string selectionAnchorId = {};
::XCEngine::UI::UIPoint pointerPosition = {};
float verticalOffset = 0.0f;
bool hasPointerPosition = false;
};
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 {
Widgets::UIEditorTreeViewLayout layout = {};
UIEditorTreeViewInteractionResult result = {};
};
inline bool HasActiveUIEditorTreeViewPointerCapture(
const UIEditorTreeViewInteractionState& state) {
return HasActiveUIEditorScrollViewPointerCapture(state.scrollViewInteractionState);
}
std::vector<::XCEngine::UI::UIInputEvent> BuildUIEditorHostedTreeViewInputEvents(
const ::XCEngine::UI::UIRect& bounds,
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents,
const UIEditorHostedTreeViewInputOptions& options,
bool synthesizeFocusGained = false,
bool synthesizeFocusLost = false);
UIEditorTreeViewInteractionFrame UpdateUIEditorTreeViewInteraction(
UIEditorTreeViewInteractionState& state,
::XCEngine::UI::Widgets::UISelectionModel& selectionModel,
::XCEngine::UI::Widgets::UIExpansionModel& expansionModel,
const ::XCEngine::UI::UIRect& bounds,
const std::vector<Widgets::UIEditorTreeViewItem>& items,
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents,
const Widgets::UIEditorTreeViewMetrics& metrics = {});
} // namespace XCEngine::UI::Editor