Nui
Loading...
Searching...
No Matches
file_dialog_options.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <nui/core.hpp>
4
5#include <optional>
6#include <string>
7#include <vector>
8#include <filesystem>
9
10#ifdef NUI_BACKEND
11# include <nlohmann/json.hpp>
12#endif
13
14namespace Nui::FileDialog
15{
16 struct Filter
17 {
18 std::string name;
19 std::vector<std::string> masks;
20 };
21
22// This way aggregate initialization can be done without needing to add extra braces
23// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
24#define COMMON_DIALOG_OPTIONS() \
25 std::optional<std::string> title = std::nullopt; \
26 std::optional<std::filesystem::path> defaultPath = std::nullopt; \
27 std::vector<Filter> filters = {}; \
28 bool forcePath = false
29
31 {
33
34 bool allowMultiSelect = false;
35 };
36
41
43 {
45
46 bool forceOverwrite = false;
47 };
48
49#ifdef NUI_BACKEND
51
52 void to_json(nlohmann::json& json, OpenDialogOptions const& options);
53 void from_json(nlohmann::json const& json, OpenDialogOptions& options);
54
55 void to_json(nlohmann::json& json, DirectoryDialogOptions const& options);
56 void from_json(nlohmann::json const& json, DirectoryDialogOptions& options);
57
58 void to_json(nlohmann::json& json, SaveDialogOptions const& options);
59 void from_json(nlohmann::json const& json, SaveDialogOptions& options);
60#endif
61}
Definition file_dialog.hpp:6
void to_json(nlohmann::json &json, OpenDialogOptions const &options)
Definition file_dialog_options.cpp:37
void from_json(nlohmann::json const &json, OpenDialogOptions &options)
Definition file_dialog_options.cpp:43
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(FetchOptions, method, headers, body, verbose, followRedirects, maxRedirects, autoReferer, dontDecodeBody, verifyPeer, verifyHost)
Definition file_dialog_options.hpp:38
Definition file_dialog_options.hpp:17
std::string name
Definition file_dialog_options.hpp:18
std::vector< std::string > masks
Definition file_dialog_options.hpp:19
Definition file_dialog_options.hpp:31
bool allowMultiSelect
Definition file_dialog_options.hpp:34
Definition file_dialog_options.hpp:43
bool forceOverwrite
Definition file_dialog_options.hpp:46