Enigma  3.2.0
A Simple, Reliable and Efficient Encryption Tool
MessageBox.hpp
Go to the documentation of this file.
1 #pragma once
2 #ifndef ENIGMA_MESSAGE_BOX_H
3 #define ENIGMA_MESSAGE_BOX_H
4 
5 #include <Core/Core.hpp>
6 #include <portable-file-dialogs.h>
7 
9 #if defined(ENIGMA_PLATFORM_WINDOWS)
10 #undef MessageBox
11 #undef ERROR
12 #undef IGNORE
13 #endif
14 
16 
17 class MessageBox {
18  public: /* Enums */
22  enum class Icon : std::uint8_t {
23  Info = static_cast<std::uint8_t>(pfd::icon::info),
24  Warning = static_cast<std::uint8_t>(pfd::icon::warning),
25  Error = static_cast<std::uint8_t>(pfd::icon::error),
26  Question = static_cast<std::uint8_t>(pfd::icon::question)
27  };
28 
32  enum class Choice : std::uint8_t {
33  Ok = static_cast<std::uint8_t>(pfd::choice::ok),
34  Ok_Cancel = static_cast<std::uint8_t>(pfd::choice::ok_cancel),
35  Yes_No = static_cast<std::uint8_t>(pfd::choice::yes_no),
36  Yes_No_Cancel = static_cast<std::uint8_t>(pfd::choice::yes_no_cancel),
37  Retry_Cancel = static_cast<std::uint8_t>(pfd::choice::retry_cancel),
38  Abort_Retry_Ignore = static_cast<std::uint8_t>(pfd::choice::abort_retry_ignore)
39  };
40 
44  enum class Action : std::int8_t {
45  Cancel = static_cast<std::int8_t>(pfd::button::cancel),
46  Ok = static_cast<std::int8_t>(pfd::button::ok),
47  Yes = static_cast<std::int8_t>(pfd::button::yes),
48  No = static_cast<std::int8_t>(pfd::button::no),
49  Abort = static_cast<std::int8_t>(pfd::button::abort),
50  Retry = static_cast<std::int8_t>(pfd::button::retry),
51  Ignore = static_cast<std::int8_t>(pfd::button::ignore)
52  };
53 
54  public: /* Constructors / Destructor */
62  MessageBox(const std::string& title, const std::string& message,
63  Icon icon = Icon::Info,
64  Choice choice = Choice::Ok_Cancel);
65  ~MessageBox() noexcept = default;
66 
67  public: /* Accessors */
72 
73  private:
74  std::string m_title; /*< MessageBox title */
75  std::string m_message; /*< MessageBox message */
76  Icon m_icon; /*< MessageBox icon */
77  Choice m_choice; /*< MessageBox choice/button template */
78 };
79 
81 
82 #endif // !ENIGMA_MESSAGE_BOX_H
#define NS_ENIGMA_BEGIN
Enable/Disable Assertions.
Definition: Macros.hpp:13
#define NS_ENIGMA_END
Definition: Macros.hpp:14
~MessageBox() noexcept=default
MessageBox::Action Show() const
MessageBox(const std::string &title, const std::string &message, Icon icon=Icon::Info, Choice choice=Choice::Ok_Cancel)