feat: add property customization to save dialogs (#19672)

This commit is contained in:
Shelley Vohr 2019-08-13 13:40:07 -07:00 committed by GitHub
parent e1824c00a9
commit 28466a39d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 119 additions and 50 deletions

View file

@ -24,18 +24,26 @@ namespace file_dialog {
typedef std::pair<std::string, std::vector<std::string>> Filter;
typedef std::vector<Filter> Filters;
enum FileDialogProperty {
FILE_DIALOG_OPEN_FILE = 1 << 0,
FILE_DIALOG_OPEN_DIRECTORY = 1 << 1,
FILE_DIALOG_MULTI_SELECTIONS = 1 << 2,
FILE_DIALOG_CREATE_DIRECTORY = 1 << 3, // macOS
FILE_DIALOG_SHOW_HIDDEN_FILES = 1 << 4,
FILE_DIALOG_PROMPT_TO_CREATE = 1 << 5, // Windows
FILE_DIALOG_NO_RESOLVE_ALIASES = 1 << 6, // macOS
FILE_DIALOG_TREAT_PACKAGE_APP_AS_DIRECTORY = 1 << 7, // macOS
enum OpenFileDialogProperty {
OPEN_DIALOG_OPEN_FILE = 1 << 0,
OPEN_DIALOG_OPEN_DIRECTORY = 1 << 1,
OPEN_DIALOG_MULTI_SELECTIONS = 1 << 2,
OPEN_DIALOG_CREATE_DIRECTORY = 1 << 3, // macOS
OPEN_DIALOG_SHOW_HIDDEN_FILES = 1 << 4,
OPEN_DIALOG_PROMPT_TO_CREATE = 1 << 5, // Windows
OPEN_DIALOG_NO_RESOLVE_ALIASES = 1 << 6, // macOS
OPEN_DIALOG_TREAT_PACKAGE_APP_AS_DIRECTORY = 1 << 7, // macOS
FILE_DIALOG_DONT_ADD_TO_RECENT = 1 << 8, // Windows
};
enum SaveFileDialogProperty {
SAVE_DIALOG_CREATE_DIRECTORY = 1 << 0,
SAVE_DIALOG_SHOW_HIDDEN_FILES = 1 << 1,
SAVE_DIALOG_TREAT_PACKAGE_APP_AS_DIRECTORY = 1 << 2, // macOS
SAVE_DIALOG_SHOW_OVERWRITE_CONFIRMATION = 1 << 3, // Linux
SAVE_DIALOG_DONT_ADD_TO_RECENT = 1 << 4, // Windows
};
struct DialogSettings {
electron::NativeWindow* parent_window = nullptr;
std::string title;