{"id":13532066,"url":"https://github.com/AirGuanZ/imgui-filebrowser","last_synced_at":"2025-04-01T20:31:15.093Z","repository":{"id":38271802,"uuid":"175215725","full_name":"AirGuanZ/imgui-filebrowser","owner":"AirGuanZ","description":"File browser implementation for dear-imgui. C++17 is required.","archived":false,"fork":false,"pushed_at":"2025-01-05T05:58:51.000Z","size":138,"stargazers_count":685,"open_issues_count":3,"forks_count":90,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-01-05T06:27:47.299Z","etag":null,"topics":["dear-imgui","imgui","imgui-filebrowser"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AirGuanZ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-12T13:20:40.000Z","updated_at":"2025-01-05T05:58:55.000Z","dependencies_parsed_at":"2024-01-03T04:01:28.182Z","dependency_job_id":"9c87bb1f-3344-45b3-b3ad-5c3e05bffff4","html_url":"https://github.com/AirGuanZ/imgui-filebrowser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AirGuanZ%2Fimgui-filebrowser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AirGuanZ%2Fimgui-filebrowser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AirGuanZ%2Fimgui-filebrowser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AirGuanZ%2Fimgui-filebrowser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AirGuanZ","download_url":"https://codeload.github.com/AirGuanZ/imgui-filebrowser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246709923,"owners_count":20821297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dear-imgui","imgui","imgui-filebrowser"],"created_at":"2024-08-01T07:01:07.930Z","updated_at":"2025-04-01T20:31:10.082Z","avatar_url":"https://github.com/AirGuanZ.png","language":"C++","funding_links":[],"categories":["Libraries","Graphics"],"sub_categories":["C++"],"readme":"# imgui-filebrowser\n\n[imgui-filebrowser](https://github.com/AirGuanZ/imgui-filebrowser) is a header-only file browser implementation for [dear-imgui](https://github.com/ocornut/imgui). C++ 17 is required.\n\n![IMG](./screenshots/0.png)\n\n## Getting Started\n\n`imfilebrowser.h` should be included after `imgui.h`:\n\n```cpp\n#include \u003cimgui.h\u003e\n#include \u003cimfilebrowser.h\u003e\n```\n\nInstead of creating a file dialog with an immediate function call, you need to create a `ImGui::FileBrowser` instance, open it with member function `Open()`, and call `Display()` in each frame. Here is a simple example:\n\n```cpp\n#include \u003cimgui.h\u003e\n#include \u003cimfilebrowser.h\u003e\n\nint main()\n{\n    //...initialize rendering window and imgui\n    \n    // create a file browser instance\n    ImGui::FileBrowser fileDialog;\n    \n    // (optional) set browser properties\n    fileDialog.SetTitle(\"title\");\n    fileDialog.SetTypeFilters({ \".h\", \".cpp\" });\n    \n    // mainloop\n    while(continueRendering)\n    {\n        //...do other stuff like ImGui::NewFrame();\n        \n        if(ImGui::Begin(\"dummy window\"))\n        {\n            // open file dialog when user clicks this button\n            if(ImGui::Button(\"open file dialog\"))\n                fileDialog.Open();\n        }\n        ImGui::End();\n        \n        fileDialog.Display();\n        \n        if(fileDialog.HasSelected())\n        {\n            std::cout \u003c\u003c \"Selected filename\" \u003c\u003c fileDialog.GetSelected().string() \u003c\u003c std::endl;\n            fileDialog.ClearSelected();\n        }\n        \n        //...do other stuff like ImGui::Render();\n    }\n    \n    //...shutdown\n}\n```\n\n## Options\n\nVarious options can be combined with '|' and passed to the constructor:\n\n```cpp\nenum ImGuiFileBrowserFlags_\n{\n    ImGuiFileBrowserFlags_SelectDirectory       = 1 \u003c\u003c 0, // select directory instead of regular file\n    ImGuiFileBrowserFlags_EnterNewFilename      = 1 \u003c\u003c 1, // allow user to enter new filename when selecting regular file\n    ImGuiFileBrowserFlags_NoModal               = 1 \u003c\u003c 2, // file browsing window is modal by default. specify this to use a popup window\n    ImGuiFileBrowserFlags_NoTitleBar            = 1 \u003c\u003c 3, // hide window title bar\n    ImGuiFileBrowserFlags_NoStatusBar           = 1 \u003c\u003c 4, // hide status bar at the bottom of browsing window\n    ImGuiFileBrowserFlags_CloseOnEsc            = 1 \u003c\u003c 5, // close file browser when pressing 'ESC'\n    ImGuiFileBrowserFlags_CreateNewDir          = 1 \u003c\u003c 6, // allow user to create new directory\n    ImGuiFileBrowserFlags_MultipleSelection     = 1 \u003c\u003c 7, // allow user to select multiple files. this will hide ImGuiFileBrowserFlags_EnterNewFilename\n    ImGuiFileBrowserFlags_HideRegularFiles      = 1 \u003c\u003c 8, // hide regular files when ImGuiFileBrowserFlags_SelectDirectory is enabled\n    ImGuiFileBrowserFlags_ConfirmOnEnter        = 1 \u003c\u003c 9, // confirm selection when pressnig 'ENTER'\n    ImGuiFileBrowserFlags_SkipItemsCausingError = 1 \u003c\u003c 10, // when entering a new directory, any error will interrupt the process, causing the file browser to fall back to the working directory.\n                                                           // with this flag, if an error is caused by a specific item in the directory, that item will be skipped, allowing the process to continue.\n    ImGuiFileBrowserFlags_EditPathString        = 1 \u003c\u003c 11, // allow user to directly edit the whole path string\n};\n```\n\nWhen `ImGuiFileBrowserFlags_MultipleSelection` is enabled, use `fileBrowser.GetMultiSelected()` to get all selected filenames (instead of `fileBrowser.GetSelected()`, which returns only one of them).\n\nHere are some common examples:\n\n```cpp\n// (default) select single regular file for opening\n0\n// select multiple regular files for opening\nImGuiFileBrowserFlags_MultipleSelection\n// select single directory for opening\nImGuiFileBrowserFlags_SelectDirectory\n// select multiple directories for opening\nImGuiFileBrowserFlags_SelectDirectory | ImGuiFileBrowserFlags_MultipleSelection\n// select single regular file for saving\nImGuiFileBrowserFlags_EnterNewFilename | ImGuiFileBrowserFlags_CreateNewDir\n// select single directory for saving\nImGuiFileBrowserFlags_SelectDirectory | ImGuiFileBrowserFlags_CreateNewDir\n// select single directory and hide regular files in browser\nImGuiFileBrowserFlags_SelectDirectory | ImGuiFileBrowserFlags_HideRegularFiles\n```\n\n## Usage\n\n* When `ImGuiFileBrowserFlags_EditPathString` is set, click the top-right button `#` to directly edit the current directory.\n* Click the top-right button `*` to refresh.\n* Double click to enter a directory.\n* Single click to (de)select a regular file (or directory, if `ImGuiFileBrowserFlags_SelectDirectory` is enabled).\n*  When `ImGuiFileBrowserFlags_SelectDirectory` is enabled and no item is selected, click `ok` to choose the current directory as selected result.\n*  When `ImGuiFileBrowserFlags_MultipleSelection` is enabled, hold  `Ctrl` for multi selection and `Shift` for range selection.  \n*  When `ImGuiFileBrowserFlags_MultipleSelection` is enabled, use `Ctrl + A` to select all (filtered) items.\n*  When `ImGuiFileBrowserFlags_CreateNewDir` is enabled, click the top-right button `+` to create a new directory.\n*  When `ImGuiFileBrowserFlags_SelectDirectory` is not specified,  double click to choose a regular file as selected result.\n\n## Type Filters\n\n* Use `SetTypeFilters({\".h\", \".cpp\"})` to set file extension filters.\n* `.*` matches with any extension\n* Filters are case-insensitive on Windows platform\n\n## Note\n\nThe filebrowser implementation queries drive list via Win32 API (only on Windows). Thus `\u003cWindows.h\u003e` is included in `\u003cimfilebrowser.h\u003e`, which may pollute the global namespace. This can be solved by simply moving the `GetDrivesBitMask()` definition into a cpp file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAirGuanZ%2Fimgui-filebrowser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAirGuanZ%2Fimgui-filebrowser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAirGuanZ%2Fimgui-filebrowser/lists"}