slot 0.0.1
A real time UI render framework
载入中...
搜索中...
未找到
FileExplorerNode.h
浏览该文件的文档.
1#pragma once
2
4
5#include <filesystem>
6#include <functional>
7#include <unordered_map>
8
9namespace z8::ui {
10
18public:
19 std::filesystem::path RootPath = "asset";
20 bool ShowHidden = false;
21 std::function<void(const std::filesystem::path&)> PathSelected;
22
24
25 const std::filesystem::path* GetPath(const TreeViewItemNode* item) const;
27 void Refresh();
28 bool SetProperty(const std::string& name,
29 const std::string& value) override;
30 const char* TypeName() const override { return "FileExplorer"; }
31
32private:
33 std::unordered_map<const TreeViewItemNode*, std::filesystem::path> ItemPaths;
34
35 std::unique_ptr<TreeViewItemNode>
36 BuildItem(const std::filesystem::path& path, bool isRoot);
37 static std::string ToUtf8(const std::filesystem::path& path);
38};
39
40} // namespace z8::ui
资源的强类型引用,同时覆盖持久化 ID 与运行时索引两种边界。
Definition ResourceRef.h:36
把文件目录投影为 TreeView 的编辑器文件浏览控件。
Definition FileExplorerNode.h:17
std::function< void(const std::filesystem::path &) PathSelected)
Definition FileExplorerNode.h:21
std::filesystem::path RootPath
Definition FileExplorerNode.h:19
const std::filesystem::path * GetPath(const TreeViewItemNode *item) const
Definition FileExplorerNode.cpp:61
bool SetProperty(const std::string &name, const std::string &value) override
Definition FileExplorerNode.cpp:81
std::unique_ptr< TreeViewItemNode > BuildItem(const std::filesystem::path &path, bool isRoot)
Definition FileExplorerNode.cpp:20
FileExplorerNode()
Definition FileExplorerNode.cpp:10
const char * TypeName() const override
Definition FileExplorerNode.h:30
bool ShowHidden
Definition FileExplorerNode.h:20
void Refresh()
Definition FileExplorerNode.cpp:66
static std::string ToUtf8(const std::filesystem::path &path)
Definition FileExplorerNode.cpp:99
std::unordered_map< const TreeViewItemNode *, std::filesystem::path > ItemPaths
Definition FileExplorerNode.h:33
Definition TreeViewNode.h:15
Definition TreeViewNode.h:50
Definition Application.h:18