MeshLib
 
Loading...
Searching...
No Matches
MRFileDialog.h
Go to the documentation of this file.
1#pragma once
2#include "exports.h"
4#include <filesystem>
5#include <functional>
6
7namespace MR
8{
9
11{
12 // Default filename
13 std::string fileName;
14 // Dialog will open this folder for browsing, default: last used folder
15 // this parameter is not used in emscripten build
16 std::filesystem::path baseFolder{};
18};
19
20// Allow user to select only one file
21// returns empty path on cancel
22MRVIEWER_API std::filesystem::path openFileDialog( const FileParameters& params = {} );
23
24// Unified function to open file in desktop code and in emscripten
25// callback is called inside this function in desktop build and deferred in emscripten build
26MRVIEWER_API void openFileDialogAsync( std::function<void( const std::filesystem::path& )> callback, const FileParameters& params = {} );
27
28// Allow user to select several files
29// returns empty vector on cancel
30MRVIEWER_API std::vector<std::filesystem::path> openFilesDialog( const FileParameters& params = {} );
31
32// Unified function to open files in desktop code and in emscripten
33// callback is called inside this function in desktop build and deferred in emscripten build
34MRVIEWER_API void openFilesDialogAsync( std::function<void( const std::vector<std::filesystem::path>& )> callback, const FileParameters& params = {} );
35
36// Select one folder
37// returns empty path on cancel
38MRVIEWER_API std::filesystem::path openFolderDialog( std::filesystem::path baseFolder = {} );
39
40// Unified function to select a folder in desktop code and in emscripten
41// callback is called inside this function in desktop build and deferred in emscripten build
42MRVIEWER_API void openFolderDialogAsync( std::function<void ( const std::filesystem::path& )> callback, std::filesystem::path baseFolder = {} );
43
44// Allow user to select several folders
45// returns empty path on cancel
46MRVIEWER_API std::vector<std::filesystem::path> openFoldersDialog( std::filesystem::path baseFolder = {} );
47
48// returns empty path on cancel
49MRVIEWER_API std::filesystem::path saveFileDialog( const FileParameters& params = {} );
50
51// Unified function to save file in desktop code and in emscripten
52// callback is called inside this function in desktop build and deferred in emscripten build
53MRVIEWER_API void saveFileDialogAsync( std::function<void( const std::filesystem::path& )> callback, const FileParameters& params = {} );
54
55}
std::vector< IOFilter > IOFilters
Definition MRIOFilters.h:23
Definition MRCameraOrientationPlugin.h:7
MRVIEWER_API std::filesystem::path openFileDialog(const FileParameters &params={})
MRVIEWER_API std::vector< std::filesystem::path > openFoldersDialog(std::filesystem::path baseFolder={})
MRVIEWER_API void openFilesDialogAsync(std::function< void(const std::vector< std::filesystem::path > &)> callback, const FileParameters &params={})
MRVIEWER_API std::filesystem::path saveFileDialog(const FileParameters &params={})
MRVIEWER_API void openFileDialogAsync(std::function< void(const std::filesystem::path &)> callback, const FileParameters &params={})
MRVIEWER_API std::filesystem::path openFolderDialog(std::filesystem::path baseFolder={})
MRVIEWER_API void openFolderDialogAsync(std::function< void(const std::filesystem::path &)> callback, std::filesystem::path baseFolder={})
MRVIEWER_API std::vector< std::filesystem::path > openFilesDialog(const FileParameters &params={})
MRVIEWER_API void saveFileDialogAsync(std::function< void(const std::filesystem::path &)> callback, const FileParameters &params={})
Definition MRFileDialog.h:11
std::string fileName
Definition MRFileDialog.h:13
std::filesystem::path baseFolder
Definition MRFileDialog.h:16
IOFilters filters
Definition MRFileDialog.h:17