// File: src/FileBrowser.h #pragma once #include #include #include #include #include "systems/AssetManager.h" // for ResourceTreeNode #include "systems/assets/Texture2D.h" // for Texture2D #include "imgui.h" namespace OX { /// Configuration for look & feel struct FileBrowserConfig { float thumbnailSize = 64.0f; float padding = 8.0f; float labelHeight = 20.0f; ImU32 bgColor = IM_COL32(40,40,40,255); ImU32 highlightColor = IM_COL32(75,75,75,255); bool showGrid = true; bool showThumbnails = true; bool allowMultiple = false; // … add more theming or behavioral flags here }; /// FileBrowser widget, supports grid & list, filtering, breadcrumbs, callbacks. class FileBrowser { public: using FileSelectedCallback = std::function; FileBrowser(); ~FileBrowser(); /// Draw the entire browser window void Draw(const char* title = "File Browser"); /// Set a filter string (wildcards, substrings, etc.) void SetFilter(const std::string& filter); /// Called whenever the user clicks on a file (not directory) void SetFileSelectedCallback(FileSelectedCallback cb); /// Access to tweak colors/sizes FileBrowserConfig& Config() { return _cfg; } private: // helpers void DrawToolbar(); void DrawBreadcrumbs(); void DrawGridView(const std::shared_ptr& node); void DrawListView(const std::shared_ptr& node); [[nodiscard]] bool PassesFilter(const std::string& name) const; void SetProgress(float p); ImTextureID GetIconTexture(const ResourceTreeNode&); // stub for folder/file icons // state FileBrowserConfig _cfg; std::string _currentPath = "res://"; std::string _filter; bool _gridMode = true; FileSelectedCallback _onFileSelected; float _lastProgress; size_t _maxQueueSize; }; } // namespace OX