aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/gui/SaveOpenDialogOptions.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-02-08 16:53:51 +0800
committercrupest <crupest@outlook.com>2022-02-08 16:53:51 +0800
commit74bb9cd27242b9320f99ff4d2b50c3051576cc14 (patch)
tree744bac5799c593d1d6f81e7b09581bea626f2cde /include/cru/platform/gui/SaveOpenDialogOptions.hpp
parentb90c398de829d1ba5329651d75bae82f5e4085fe (diff)
downloadcru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.tar.gz
cru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.tar.bz2
cru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.zip
...
Diffstat (limited to 'include/cru/platform/gui/SaveOpenDialogOptions.hpp')
-rw-r--r--include/cru/platform/gui/SaveOpenDialogOptions.hpp81
1 files changed, 0 insertions, 81 deletions
diff --git a/include/cru/platform/gui/SaveOpenDialogOptions.hpp b/include/cru/platform/gui/SaveOpenDialogOptions.hpp
deleted file mode 100644
index 907ec808..00000000
--- a/include/cru/platform/gui/SaveOpenDialogOptions.hpp
+++ /dev/null
@@ -1,81 +0,0 @@
-#pragma once
-#include "Base.hpp"
-
-namespace cru::platform::gui {
-struct CRU_PLATFORM_GUI_API SaveDialogOptions {
- String title;
- String prompt;
- String message;
- std::vector<String> allowed_file_types;
- bool allow_all_file_types = false;
-};
-
-struct CRU_PLATFORM_GUI_API OpenDialogOptions : SaveDialogOptions {
- bool can_choose_files = true;
- bool can_choose_directories = false;
- bool allow_mulitple_selection = false;
-};
-
-template <typename T>
-struct CRU_PLATFORM_GUI_API SaveDialogOptionsBuilderTemplate {
- T options;
-
- SaveDialogOptionsBuilderTemplate& SetTitle(String title) {
- options.title = std::move(title);
- return *this;
- }
-
- SaveDialogOptionsBuilderTemplate& SetPrompt(String prompt) {
- options.prompt = std::move(prompt);
- return *this;
- }
-
- SaveDialogOptionsBuilderTemplate& SetMessage(String message) {
- options.message = std::move(message);
- return *this;
- }
-
- SaveDialogOptionsBuilderTemplate& SetAllowedFileTypes(
- std::vector<String> allowed_file_types) {
- options.allowed_file_types = std::move(allowed_file_types);
- return *this;
- }
-
- SaveDialogOptionsBuilderTemplate& AddAllowedFileType(
- String allowed_file_type) {
- options.allowed_file_types.push_back(allowed_file_type);
- return *this;
- }
-
- SaveDialogOptionsBuilderTemplate& SetAllowAllFileTypes(
- bool allow_all_file_types) {
- options.allow_all_file_types = allow_all_file_types;
- return *this;
- }
-
- T Build() { return options; }
-};
-
-using SaveDialogOptionsBuilder =
- SaveDialogOptionsBuilderTemplate<SaveDialogOptions>;
-
-struct CRU_PLATFORM_GUI_API OpenDialogOptionsBuilder
- : SaveDialogOptionsBuilderTemplate<OpenDialogOptions> {
- OpenDialogOptionsBuilder& SetCanChooseFiles(bool can_choose_files) {
- options.can_choose_files = can_choose_files;
- return *this;
- }
-
- OpenDialogOptionsBuilder& SetCanChooseDirectories(
- bool can_choose_directories) {
- options.can_choose_directories = can_choose_directories;
- return *this;
- }
-
- OpenDialogOptionsBuilder& SetAllowMultipleSelection(
- bool allow_mulitple_selection) {
- options.allow_mulitple_selection = allow_mulitple_selection;
- return *this;
- }
-};
-} // namespace cru::platform::gui