Unravel Engine C++ Reference
Loading...
Searching...
No Matches
content_browser_panel.h
Go to the documentation of this file.
1#pragma once
2#include "../panel_base.h"
5
6#include <base/basetypes.hpp>
7#include <context/context.hpp>
8
9namespace unravel
10{
11class imgui_panels;
12
38
39
41{
42public:
43 content_browser_panel(imgui_panels* parent, const char* name);
44
45 void init(rtti::context& ctx);
46 void deinit(rtti::context& ctx);
47
49
50 void draw_ui(rtti::context& ctx) override;
51
52 auto get_window_flags() const -> ImGuiWindowFlags override;
53
54private:
55 void draw(rtti::context& ctx);
56 void draw_details(rtti::context& ctx, const fs::path& root_path);
57
58 void draw_as_explorer(rtti::context& ctx, const fs::path& root_path);
59 void context_menu(rtti::context& ctx, bool use_context_item, const fs::path& target_path);
60 void context_create_menu(rtti::context& ctx, const fs::path& target_path);
61 void set_cache_path(const fs::path& path);
62 void handle_external_drop(rtti::context& ctx);
63 void import(rtti::context& ctx, const fs::path& target_path);
64 void on_import(rtti::context& ctx, const std::vector<std::string>& paths, const fs::path& target_path);
65 void handle_window_empty_click(rtti::context& ctx) const;
66 void draw_external_drop_overlay() const;
67
68 // Helper method to avoid MSVC ICE with complex template lambdas
69 template<typename AssetType>
70 void setup_asset_item(rtti::context& ctx, content_browser_item& item,
71 const fs::path& absolute_path,
72 const std::string& relative,
73 const std::string& file_ext);
74
75 // Reusable member functions for consistent behavior
76 template<typename EntryType>
77 void setup_delete_handler(content_browser_item& item, const std::string& relative,
78 const fs::path& absolute_path, const EntryType& entry, rtti::context& ctx);
79 void setup_rename_handler(content_browser_item& item, const fs::path& absolute_path,
80 const std::string& file_ext);
81 void prompt_delete_asset(const std::string& name, const std::function<void()>& on_delete);
82
84
85 std::shared_ptr<int> sentinel_ = std::make_shared<int>(0);
86
87 ImGuiTextFilter filter_;
88 fs::path root_;
89 int refresh_{};
90 float scale_ = 0.65f;
91
92 int focus_frames_{};
93
94 imgui_panels* parent_{};
95
96};
97} // namespace unravel
void draw_ui(rtti::context &ctx) override
void on_project_closed(rtti::context &ctx)
auto get_window_flags() const -> ImGuiWindowFlags override
content_browser_panel(imgui_panels *parent, const char *name)
std::string name
Definition hub.cpp:33
Definition cache.hpp:235
content_browser_item(const fs::directory_cache::cache_entry &e)
const fs::directory_cache::cache_entry & entry
std::function< void(const std::string &)> on_rename_t