/****************************************************************************** * File - asset_browser.h * Author - Joey Pollack * Date - 2021/11/10 (y/m/d) * Mod Date - 2021/11/10 (y/m/d) * Description - Browse and manage project assets ******************************************************************************/ #ifndef ASSET_BROWSER_H_ #define ASSET_BROWSER_H_ #include #include #include #include namespace lunarium { namespace editor { class AssetBrowser : public gui::Panel { public: AssetBrowser(std::filesystem::path dir, Editor* pEditor); void SetAssetDirectory(std::filesystem::path dir); bool DoFrame(); std::filesystem::path GetSelectedDirectory(); private: struct Node { std::filesystem::path Myself; std::vector Children; std::vector Files; }; private: std::filesystem::path mAssetDirectory; std::filesystem::path mSelectedDir; Node* mTreeRoot; Node* mSelectedNode; Editor* mpEditor; bool mNewFolder; bool mSyncTree; private: Node* ReloadAssets(std::filesystem::path dir); Node* FindNodeAt(std::filesystem::path dir); void HandleAssetDrop(std::filesystem::path dir); void DoDirTree(std::filesystem::path dir); void DoContextMenu(); }; } } #endif // ASSET_BROWSER_H_