#include "ProjectPanelSupport.h" namespace XCEngine::UI::Editor::App { using namespace ProjectPanelSupport; void ProjectPanel::Append(UIDrawList& drawList) const { if (!m_visible || m_layout.bounds.width <= 0.0f || m_layout.bounds.height <= 0.0f) { return; } const auto& assetEntries = m_browserModel.GetAssetEntries(); drawList.AddFilledRect(m_layout.bounds, kSurfaceColor); drawList.AddFilledRect(m_layout.leftPaneRect, kPaneColor); drawList.AddFilledRect(m_layout.rightPaneRect, kPaneColor); drawList.AddFilledRect( m_layout.dividerRect, ResolveUIEditorDockHostPalette().splitterColor); drawList.AddFilledRect(m_layout.browserHeaderRect, kHeaderColor); drawList.AddFilledRect( UIRect( m_layout.browserHeaderRect.x, m_layout.browserHeaderRect.y + m_layout.browserHeaderRect.height - kHeaderBottomBorderThickness, m_layout.browserHeaderRect.width, kHeaderBottomBorderThickness), ResolveUIEditorDockHostPalette().splitterColor); const Widgets::UIEditorTreeViewPalette treePalette = BuildEditorTreeViewPalette(); const Widgets::UIEditorTreeViewMetrics treeMetrics = BuildEditorTreeViewMetrics(); AppendUIEditorTreeViewBackground( drawList, m_treeFrame.layout, m_browserModel.GetTreeItems(), m_folderSelection, m_treeInteractionState.treeViewState, treePalette, treeMetrics); AppendUIEditorTreeViewForeground( drawList, m_treeFrame.layout, m_browserModel.GetTreeItems(), treePalette, treeMetrics); drawList.PushClipRect(m_layout.browserHeaderRect); for (std::size_t index = 0u; index < m_layout.breadcrumbItems.size(); ++index) { const BreadcrumbItemLayout& item = m_layout.breadcrumbItems[index]; const UIColor textColor = item.separator ? kTextMuted : (index == m_hoveredBreadcrumbIndex && item.clickable ? kTextStrong : (item.current ? kTextPrimary : kTextMuted)); const float textWidth = MeasureTextWidth(m_textMeasurer, item.label, kHeaderFontSize); const float textX = item.separator ? item.rect.x : item.rect.x + (item.rect.width - textWidth) * 0.5f; drawList.AddText( UIPoint(textX, ResolveTextTop(item.rect.y, item.rect.height, kHeaderFontSize)), item.label, textColor, kHeaderFontSize); } drawList.PopClipRect(); for (const AssetTileLayout& tile : m_layout.assetTiles) { if (tile.itemIndex >= assetEntries.size()) { continue; } const AssetEntry& assetEntry = assetEntries[tile.itemIndex]; const bool selected = m_assetSelection.IsSelected(assetEntry.itemId); const bool hovered = m_hoveredAssetItemId == assetEntry.itemId; if (selected || hovered) { drawList.AddFilledRect( tile.tileRect, selected ? kTileSelectedColor : kTileHoverColor); } AppendTilePreview(drawList, tile.previewRect, assetEntry.directory); drawList.PushClipRect(tile.labelRect); const float textWidth = MeasureTextWidth(m_textMeasurer, assetEntry.displayName, kTileLabelFontSize); drawList.AddText( UIPoint( tile.labelRect.x + (tile.labelRect.width - textWidth) * 0.5f, ResolveTextTop(tile.labelRect.y, tile.labelRect.height, kTileLabelFontSize)), assetEntry.displayName, kTextPrimary, kTileLabelFontSize); drawList.PopClipRect(); } if (assetEntries.empty()) { const UIRect messageRect( m_layout.gridRect.x, m_layout.gridRect.y, m_layout.gridRect.width, 18.0f); drawList.AddText( UIPoint(messageRect.x, ResolveTextTop(messageRect.y, messageRect.height, kHeaderFontSize)), "Current folder is empty.", kTextMuted, kHeaderFontSize); } } } // namespace XCEngine::UI::Editor::App