Enigma  3.2.0
A Simple, Reliable and Efficient Encryption Tool
DialogUtils.hpp
Go to the documentation of this file.
1 #pragma once
2 #ifndef ENIGMA_DIALOG_UTILS_H
3 #define ENIGMA_DIALOG_UTILS_H
4 
5 #include <Core/Core.hpp>
10 #include <Utility/FileUtils.hpp>
11 
13 
14 class DialogUtils final {
15  ENIGMA_STATIC_CLASS(DialogUtils);
16 
17  public:
18  static Enigma::MessageBox::Action Error(const std::string& title, const std::string& message, const Enigma::MessageBox::Choice choice = Enigma::MessageBox::Choice::Ok) {
19  const auto msgbox = std::make_unique<Enigma::MessageBox>(
20  title,
21  message,
22  Enigma::MessageBox::Icon::Error,
23  choice);
24  return msgbox->Show();
25  }
26 
27  static Enigma::MessageBox::Action Error(const std::string& message, const Enigma::MessageBox::Choice choice = Enigma::MessageBox::Choice::Ok) {
28  const auto msgbox = std::make_unique<Enigma::MessageBox>(
29  "Enigma",
30  message,
31  Enigma::MessageBox::Icon::Error,
32  choice);
33  return msgbox->Show();
34  }
35 
36  static Enigma::MessageBox::Action Warn(const std::string& title, const std::string& message, const Enigma::MessageBox::Choice choice = Enigma::MessageBox::Choice::Ok) {
37  const auto msgbox = std::make_unique<Enigma::MessageBox>(
38  title,
39  message,
40  Enigma::MessageBox::Icon::Warning,
41  choice);
42  return msgbox->Show();
43  }
44 
45  static Enigma::MessageBox::Action Warn(const std::string& message, const Enigma::MessageBox::Choice choice = Enigma::MessageBox::Choice::Ok) {
46  const auto msgbox = std::make_unique<Enigma::MessageBox>(
47  "Enigma",
48  message,
49  Enigma::MessageBox::Icon::Warning,
50  choice);
51  return msgbox->Show();
52  }
53 
54  static Enigma::MessageBox::Action Question(const std::string& title, const std::string& message, const Enigma::MessageBox::Choice choice = Enigma::MessageBox::Choice::Yes_No) {
55  const auto msgbox = std::make_unique<Enigma::MessageBox>(
56  title,
57  message,
58  Enigma::MessageBox::Icon::Question,
59  choice);
60  return msgbox->Show();
61  }
62 
63  static Enigma::MessageBox::Action Question(const std::string& message, const Enigma::MessageBox::Choice choice = Enigma::MessageBox::Choice::Yes_No) {
64  const auto msgbox = std::make_unique<Enigma::MessageBox>(
65  "Enigma",
66  message,
67  Enigma::MessageBox::Icon::Question,
68  choice);
69  return msgbox->Show();
70  }
71 
72  static Enigma::MessageBox::Action Info(const std::string& title, const std::string& message, const Enigma::MessageBox::Choice choice = Enigma::MessageBox::Choice::Ok) {
73  const auto msgbox = std::make_unique<Enigma::MessageBox>(
74  title,
75  message,
76  Enigma::MessageBox::Icon::Info,
77  choice);
78  return msgbox->Show();
79  }
80 
81  static Enigma::MessageBox::Action Info(const std::string& message, const Enigma::MessageBox::Choice choice = Enigma::MessageBox::Choice::Ok) {
82  const auto msgbox = std::make_unique<Enigma::MessageBox>(
83  "Enigma",
84  message,
85  Enigma::MessageBox::Icon::Info,
86  choice);
87  return msgbox->Show();
88  }
89 
90  /*
91  static fs::path SelectFolder(const std::string& title, const std::string& initial_path = FileUtils::GetEnigmaExecutableDir().string(), const bool force_path = true)
92  {
93  const auto sfd = std::make_unique<Enigma::SelectFolderDialog>(
94  title,
95  initial_path,
96  force_path
97  );
98  return fs::path(sfd->Show());
99  }
100  static fs::path SelectFile(const std::string& title, const std::string& initial_path = FileUtils::GetEnigmaExecutableDir().string(), const bool allow_multiselect = true)
101  {
102  std::initializer_list<std::string> filters{};
103  const auto sfd = std::make_unique<Enigma::OpenFileDialog>(
104  title,
105  initial_path,
106  false,
107  filters
108  );
109  return fs::path(sfd->Show()[0]);
110  }*/
111 };
112 
114 
115 
116 #endif // !ENIGMA_DIALOG_UTILS_H
#define NS_ENIGMA_BEGIN
Enable/Disable Assertions.
Definition: Macros.hpp:13
#define NS_ENIGMA_END
Definition: Macros.hpp:14
static Enigma::MessageBox::Action Info(const std::string &title, const std::string &message, const Enigma::MessageBox::Choice choice=Enigma::MessageBox::Choice::Ok)
Definition: DialogUtils.hpp:72
static Enigma::MessageBox::Action Info(const std::string &message, const Enigma::MessageBox::Choice choice=Enigma::MessageBox::Choice::Ok)
Definition: DialogUtils.hpp:81
static Enigma::MessageBox::Action Warn(const std::string &message, const Enigma::MessageBox::Choice choice=Enigma::MessageBox::Choice::Ok)
Definition: DialogUtils.hpp:45
static Enigma::MessageBox::Action Question(const std::string &title, const std::string &message, const Enigma::MessageBox::Choice choice=Enigma::MessageBox::Choice::Yes_No)
Definition: DialogUtils.hpp:54
static Enigma::MessageBox::Action Error(const std::string &title, const std::string &message, const Enigma::MessageBox::Choice choice=Enigma::MessageBox::Choice::Ok)
Definition: DialogUtils.hpp:18
static Enigma::MessageBox::Action Question(const std::string &message, const Enigma::MessageBox::Choice choice=Enigma::MessageBox::Choice::Yes_No)
Definition: DialogUtils.hpp:63
static Enigma::MessageBox::Action Warn(const std::string &title, const std::string &message, const Enigma::MessageBox::Choice choice=Enigma::MessageBox::Choice::Ok)
Definition: DialogUtils.hpp:36
static Enigma::MessageBox::Action Error(const std::string &message, const Enigma::MessageBox::Choice choice=Enigma::MessageBox::Choice::Ok)
Definition: DialogUtils.hpp:27