2026-03-20 17:08:06 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "Panel.h"
|
|
|
|
|
#include "Core/AssetItem.h"
|
2026-03-26 21:18:33 +08:00
|
|
|
#include "UI/PopupState.h"
|
2026-03-27 23:21:43 +08:00
|
|
|
#include "UI/TreeView.h"
|
2026-03-20 17:08:06 +08:00
|
|
|
|
2026-03-24 20:02:38 +08:00
|
|
|
namespace XCEngine {
|
|
|
|
|
namespace Editor {
|
2026-03-20 17:08:06 +08:00
|
|
|
|
|
|
|
|
class ProjectPanel : public Panel {
|
|
|
|
|
public:
|
|
|
|
|
ProjectPanel();
|
|
|
|
|
void Render() override;
|
|
|
|
|
void Initialize(const std::string& projectPath);
|
|
|
|
|
|
|
|
|
|
private:
|
2026-03-27 21:55:14 +08:00
|
|
|
struct AssetItemInteraction {
|
|
|
|
|
bool clicked = false;
|
|
|
|
|
bool contextRequested = false;
|
|
|
|
|
bool openRequested = false;
|
|
|
|
|
std::string droppedSourcePath;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void RenderToolbar();
|
|
|
|
|
void RenderFolderTreePane(IProjectManager& manager);
|
|
|
|
|
void RenderFolderTreeNode(IProjectManager& manager, const AssetItemPtr& folder, const std::string& currentFolderPath);
|
|
|
|
|
void RenderBrowserPane(IProjectManager& manager);
|
|
|
|
|
void RenderBrowserHeader(IProjectManager& manager);
|
|
|
|
|
AssetItemInteraction RenderAssetItem(const AssetItemPtr& item, bool isSelected);
|
|
|
|
|
static bool MatchesSearch(const AssetItemPtr& item, const std::string& search);
|
|
|
|
|
static bool IsCurrentTreeBranch(const std::string& currentFolderPath, const std::string& folderPath);
|
2026-03-20 17:08:06 +08:00
|
|
|
|
|
|
|
|
char m_searchBuffer[256] = "";
|
2026-03-27 21:55:14 +08:00
|
|
|
float m_navigationWidth = UI::ProjectNavigationDefaultWidth();
|
2026-03-27 23:21:43 +08:00
|
|
|
UI::TreeViewState m_folderTreeState;
|
2026-03-26 21:18:33 +08:00
|
|
|
UI::TextInputPopupState<256> m_createFolderDialog;
|
2026-03-27 12:06:24 +08:00
|
|
|
UI::DeferredPopupState m_emptyContextMenu;
|
2026-03-26 23:52:05 +08:00
|
|
|
UI::TargetedPopupState<AssetItemPtr> m_itemContextMenu;
|
2026-03-20 17:08:06 +08:00
|
|
|
};
|
|
|
|
|
|
2026-03-24 20:02:38 +08:00
|
|
|
}
|
2026-03-26 21:18:33 +08:00
|
|
|
}
|