#pragma once #include "Hierarchy/ProductHierarchyModel.h" #include #include #include #include #include #include #include #include namespace XCEngine::UI::Editor::App { class ProductBuiltInIcons; class ProductHierarchyPanel { public: enum class EventKind : std::uint8_t { None = 0, SelectionChanged, Reparented, MovedToRoot, RenameRequested }; struct Event { EventKind kind = EventKind::None; std::string itemId = {}; std::string targetItemId = {}; std::string label = {}; }; void Initialize(); void SetBuiltInIcons(const ProductBuiltInIcons* icons); void Update( const UIEditorPanelContentHostFrame& contentHostFrame, const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents, bool allowInteraction, bool panelActive); void Append(::XCEngine::UI::UIDrawList& drawList) const; bool WantsHostPointerCapture() const; bool WantsHostPointerRelease() const; bool HasActivePointerCapture() const; const std::vector& GetFrameEvents() const; private: struct DragState { std::string armedItemId = {}; std::string draggedItemId = {}; std::string dropTargetItemId = {}; ::XCEngine::UI::UIPoint pressPosition = {}; bool armed = false; bool dragging = false; bool dropToRoot = false; bool validDropTarget = false; bool requestPointerCapture = false; bool requestPointerRelease = false; }; const UIEditorPanelContentHostPanelState* FindMountedHierarchyPanel( const UIEditorPanelContentHostFrame& contentHostFrame) const; void ResetTransientState(); void RebuildItems(); void ProcessDragAndFrameEvents( const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents, const ::XCEngine::UI::UIRect& bounds, bool allowInteraction, bool panelActive); void EmitSelectionEvent(); void EmitReparentEvent( EventKind kind, std::string itemId, std::string targetItemId); std::vector<::XCEngine::UI::UIInputEvent> BuildInteractionInputEvents( const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents, const ::XCEngine::UI::UIRect& bounds, bool allowInteraction, bool panelActive) const; const ProductBuiltInIcons* m_icons = nullptr; ProductHierarchyModel m_model = {}; std::vector m_treeItems = {}; ::XCEngine::UI::Widgets::UISelectionModel m_selection = {}; ::XCEngine::UI::Widgets::UIExpansionModel m_expansion = {}; UIEditorTreeViewInteractionState m_treeInteractionState = {}; UIEditorTreeViewInteractionFrame m_treeFrame = {}; std::vector m_frameEvents = {}; DragState m_dragState = {}; bool m_visible = false; }; } // namespace XCEngine::UI::Editor::App