Learning repository. Imgui filetree with callbacks onClick, onDoubleClick and onContextMenu with extension specific variants. If u wanna use this i recommend stripping away the callback system and actually making something good or using ImGui stuff raw.
There are some behavior that isnt controller trough the callbacks. For example double clicking a file in filetree will open readonly preview of the file.
static std::shared_ptr<FileTree> fTree = std::make_shared<FileTree>();
static FileTreeRenderer r(fTree);
r.Render();Too bad no information about filetree. Defaults to current project directory when constructred.
Bad implementation of a callback system. Split into two: General and Extension specific
Incase you add RegisterExtensionCallback the filetree will automatically add ImGui::MenuItem to ImGui::ContextMenu in File Tree Context Menu Implementation. You can also see this in the See the Check out the example for a visual example. red and purple boxes compares effect of this functionality.
r.RegisterExtensionCallback(".any", FileTreeRenderer::CallbackType::ContextMenu, [](const std::filesystem::path& path) {
std::cout << "[ANY_CONTEXT] " << path.string() << " - Triggers on context menu for any file without specific handler" << std::endl;
});
// File callbacks
r.RegisterFileCallback(FileTreeRenderer::CallbackType::Click, [](const std::filesystem::path& path) {});
r.RegisterFileCallback(FileTreeRenderer::CallbackType::DoubleClick, [](const std::filesystem::path& path) {});
r.RegisterFileCallback(FileTreeRenderer::CallbackType::ContextMenu, [](const std::filesystem::path& path) {});// Director callbacks
r.RegisterDirectoryCallback(FileTreeRenderer::CallbackType::Click, [](const std::filesystem::path& path) {});
r.RegisterDirectoryCallback(FileTreeRenderer::CallbackType::DoubleClick, [](const std::filesystem::path& path) {});
r.RegisterDirectoryCallback(FileTreeRenderer::CallbackType::ContextMenu, [](const std::filesystem::path& path) {});// Generic "any" extension callbacks
r.RegisterExtensionCallback(".any", FileTreeRenderer::CallbackType::Click, [](const std::filesystem::path& path) {});
r.RegisterExtensionCallback(".any", FileTreeRenderer::CallbackType::DoubleClick, [](const std::filesystem::path& path) {});
r.RegisterExtensionCallback(".any", FileTreeRenderer::CallbackType::ContextMenu, [](const std::filesystem::path& path) {});This project is licensed under the MIT License - see the LICENSE.txt file for details.
This project uses the following third-party libraries:
- Dear ImGui - MIT License - View License
- GLFW - zlib/libpng License - View License
