Open/save browsers for Mui - keeps ImGui::FileBrowser out of IMui.
More...
#include <rigImGui/src/FileDialogs.h>
|
| using | DropHandler = std::function<void(const std::vector<std::string>& paths)> |
| | Receive OS file drops while no open/save/folder dialog is open.
|
|
|
void | shutdown () |
| | Drop GPU thumbs while the GL context is still current.
|
| void | openMany (const std::string &title, std::vector< std::string > filters, MultiCallback onSelected) |
| | Open dialog that can return more than one file.
|
| void | save (const std::string &title, std::vector< std::string > filters, Callback onSelected, const std::string &defaultName={}) |
| void | openFolder (const std::string &title, Callback onSelected, const std::string &startDir={}) |
|
void | tick () |
| | Draw browsers and fire callback when a path is chosen.
|
| void | installDropTarget (GLFWwindow *window=nullptr) |
| | Route OS file drops to the open browser.
|
| void | setPinnedFolders (const std::vector< std::string > &paths) |
| | Replace the user-pinned Quick access folders on both browsers.
|
| std::vector< std::string > | pinnedFolders () const |
| bool | consumePinnedFoldersChanged () |
| bool | consumeViewModeChanged () |
|
void | registerThumbnailDecoder (const std::string &extension, IMui::FileThumbnailDecoder decoder) |
| | Pack-registered CPU decoder for one file extension.
|
Open/save browsers for Mui - keeps ImGui::FileBrowser out of IMui.
Opening size uses uiPx (design × FontScaleDpi), clamped to the work area. Undersized imgui.ini crumbs are bumped up on open. Hosted as FileDialogWindow, not a FileBrowser popup.
◆ DropHandler
Receive OS file drops while no open/save/folder dialog is open.
Paths are native narrow strings, the same form Open returns. An empty handler clears it. The open dialog still consumes a drop.
◆ consumePinnedFoldersChanged()
| bool rigkit::FileDialogs::consumePinnedFoldersChanged |
( |
| ) |
|
- Returns
- True once after the user pinned or unpinned a folder in either browser (right-click a folder row / a pinned sidebar entry). The host persists pinnedFolders() when this fires.
◆ consumeViewModeChanged()
| bool rigkit::FileDialogs::consumeViewModeChanged |
( |
| ) |
|
- Returns
- True once after the user toggled Details / Icons. The host persists viewMode() when this fires.
◆ installDropTarget()
| void rigkit::FileDialogs::installDropTarget |
( |
GLFWwindow * | window = nullptr | ) |
|
Route OS file drops to the open browser.
Installs the GLFW drop callback on window and on ImGui viewport windows. Call after the GLFW window exists, and again after viewports are created. A drop whose cursor is over the browser jumps to that folder, or to a file's parent and selects the file. The dialog stays open. A multi-file drop uses the first path. Drops while no dialog is open go to setUnclaimedFileDropHandler.
◆ openFolder()
| void rigkit::FileDialogs::openFolder |
( |
const std::string & | title, |
|
|
Callback | onSelected, |
|
|
const std::string & | startDir = {} ) |
- Parameters
-
| startDir | Directory the browser opens in. Empty keeps the last one. |
◆ openMany()
| void rigkit::FileDialogs::openMany |
( |
const std::string & | title, |
|
|
std::vector< std::string > | filters, |
|
|
MultiCallback | onSelected ) |
Open dialog that can return more than one file.
Ctrl+click, Shift+click, and Ctrl+A. One file still confirms. Does not apply to save or folder dialogs. Cancel runs no callback.
◆ pinnedFolders()
| std::vector< std::string > rigkit::FileDialogs::pinnedFolders |
( |
| ) |
const |
- Returns
- Current user-pinned Quick access folders (UTF-8).
◆ save()
| void rigkit::FileDialogs::save |
( |
const std::string & | title, |
|
|
std::vector< std::string > | filters, |
|
|
Callback | onSelected, |
|
|
const std::string & | defaultName = {} ) |
- Parameters
-
| defaultName | Pre-filled file name (Save As suggests the current one). |
◆ setPinnedFolders()
| void rigkit::FileDialogs::setPinnedFolders |
( |
const std::vector< std::string > & | paths | ) |
|
Replace the user-pinned Quick access folders on both browsers.
- Parameters
-
| paths | UTF-8 folder paths; missing folders are skipped. |
The documentation for this class was generated from the following file: