46 std::vector<ChooserFilter> filters = {},
47 std::filesystem::path start_dir = {});
80 std::function<T(std::filesystem::path)> on_success,
82 std::vector<ChooserFilter> filters = {},
83 std::filesystem::path start_dir = {})
85 std::promise<T> promise;
86 auto future = promise.get_future();
89 [&promise, on_success = std::move(on_success), on_error = std::move(on_error)](
ChooserResult result) {
91 promise.set_value(on_success(std::move(*result)));
93 on_error(result.error());
94 promise.set_value(T {});
98 std::move(start_dir));
119 std::string suggested_name = {},
120 std::vector<ChooserFilter> filters = {},
121 std::filesystem::path start_dir = {});
141 std::function<T(std::filesystem::path)> on_success,
143 std::string suggested_name = {},
144 std::vector<ChooserFilter> filters = {},
145 std::filesystem::path start_dir = {})
147 std::promise<T> promise;
148 auto future = promise.get_future();
151 [&promise, on_success = std::move(on_success), on_error = std::move(on_error)](
ChooserResult result) {
153 promise.set_value(on_success(std::move(*result)));
155 on_error(result.error());
156 promise.set_value(T {});
159 std::move(suggested_name),
161 std::move(start_dir));
SystemDialogError
Failure modes for OS dialog operations.
std::function< void(FileDialogResult)> FileDialogCallback
Callback type for all file dialog operations.
std::expected< std::filesystem::path, SystemDialogError > FileDialogResult
Result type delivered to all file dialog callbacks.
Core::FileDialogCallback ChooserCallback
Callback type for the primitive callback overload.
Core::FileDialogResult ChooserResult
Result type for the primitive callback overload.
void open_file(ChooserCallback callback, std::vector< ChooserFilter > filters, std::filesystem::path start_dir)
Present a native open-file dialog, delivering the result via callback.
void save_file(ChooserCallback callback, std::string suggested_name, std::vector< ChooserFilter > filters, std::filesystem::path start_dir)
Present a native save-file dialog, delivering the result via callback.
A named group of accepted file extensions for dialog filters.