14#include <lagrange/ui/api.h>
15#include <lagrange/fs/filesystem.h>
42 operator const fs::path &()
const {
return path(); }
44 operator std::string()
const {
return string(); }
47 std::string
string()
const {
return path().string(); }
49 bool empty() const noexcept {
return path().empty(); }
52 const fs::path& path()
const;
55 FileDialogPath(
const fs::path& path);
56 struct FileDialogPathImpl;
57 std::unique_ptr<FileDialogPathImpl> m_impl;
99 const std::string& title,
100 const fs::path& default_path =
".",
101 const std::vector<FileFilter>& filters = {{
"All Files",
"*"}});
112LA_UI_API std::vector<FileDialogPath>
open_files(
113 const std::string& title,
114 const fs::path& default_path =
".",
115 const std::vector<FileFilter>& filters = {{
"All Files",
"*"}});
128 const std::string& title,
129 const fs::path& default_path =
".",
130 const std::vector<FileFilter>& filters = {{
"All Files",
"*"}},
144 const std::string& title,
145 const fs::path& default_path =
".",
163LA_UI_API std::string transform_filters_to_accept(
const std::vector<FileFilter>& filters);
RAII Wrapper for fs::path obtained from a file dialog.
Definition: file_dialog.h:30
operator std::string() const
Implicit string conversion.
Definition: file_dialog.h:44
std::string string() const
Convert path to string.
Definition: file_dialog.h:47
Lagrange UI Viewer and mini 3D engine.
Definition: AcceleratedPicking.h:22
LA_UI_API std::vector< FileDialogPath > open_files(const std::string &title, const fs::path &default_path=".", const std::vector< FileFilter > &filters={{"All Files", "*"}})
Opens a native file dialog to open multiple files.
Definition: file_dialog.cpp:386
FolderOpen
Controls the behavior of the folder open dialog.
Definition: file_dialog.h:84
@ ForcePath
Force folder dialog window to use the provided initial path.
@ LastOpened
On Windows, use the last opened folder as the initial path.
FileSave
Controls the behavior of the file save dialog.
Definition: file_dialog.h:76
@ SilentOverwrite
Force silently overwriting the file.
@ ConfirmOverwrite
Open a confirmation dialog before overwriting a file.
LA_UI_API FileDialogPath save_file(const std::string &title, const fs::path &default_path=".", const std::vector< FileFilter > &filters={{"All Files", "*"}}, FileSave overwrite_behavior=FileSave::ConfirmOverwrite)
Opens a native file dialog to save a file.
Definition: file_dialog.cpp:411
LA_UI_API FileDialogPath open_folder(const std::string &title, const fs::path &default_path=".", FolderOpen open_behavior=FolderOpen::LastOpened)
Opens a native file dialog to select a folder.
Definition: file_dialog.cpp:463
LA_UI_API FileDialogPath open_file(const std::string &title, const fs::path &default_path=".", const std::vector< FileFilter > &filters={{"All Files", "*"}})
Opens a native file dialog to open a single file.
Definition: file_dialog.cpp:361
Main namespace for Lagrange.
Definition: AABBIGL.h:30
File filter option.
Definition: file_dialog.h:65
std::string pattern
Pattern used for filter, e.g. "*" or *.png *.jpg *.jpeg *.bmp".
Definition: file_dialog.h:70
std::string name
Name of the filter, e.g. "All files" or "Image files".
Definition: file_dialog.h:67