Mountain  1.0.0
Simple C++ 2D Game Framework
message_box.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 
5 #include "Mountain/core.hpp"
6 
9 
10 namespace Mountain
11 {
13  class MessageBox
14  {
15  STATIC_CLASS(MessageBox)
16 
17  public:
19  enum class Type
20  {
22  Ok,
24  OkCancel,
28  YesNo,
33  };
34 
36  enum class Icon
37  {
39  None,
40 
42  Warning,
44  Error,
46  Information,
47  };
48 
50  enum class DefaultButton
51  {
53  First,
55  Second,
57  Third,
58  };
59 
61  enum class Result
62  {
64  Ok,
66  Cancel,
68  Yes,
70  No,
72  Retry,
74  Try,
76  Continue,
78  Close
79  };
80 
82  static Result Show(std::string_view title, std::string_view text, Type type, Icon icon = Icon::None, DefaultButton defaultButton = DefaultButton::First);
83 
84  private:
85  static uint32_t TypeToWindows(Type type);
86 
87  static uint32_t IconToWindows(Icon icon);
88 
89  static uint32_t DefaultButtonToWindows(DefaultButton defaultButton);
90 
91  static Result ParseResult(int32_t windowsResult);
92 
93  static Result Call(
94  const char_t* text,
95  const char_t* title,
96  Type type,
97  Icon icon,
98  DefaultButton defaultButton
99  );
100  };
101 }
The MessageBox contains the options Ok, Cancel.
Defines functions to work with Windows MessageBox utilities.
Definition: message_box.hpp:13
Sets the default button as the first one.
The MessageBox contains the options Yes, No.
The MessageBox contains the single option Ok.
static Result Show(std::string_view title, std::string_view text, Type type, Icon icon=Icon::None, DefaultButton defaultButton=DefaultButton::First)
Shows a MessageBox with the given options.
The MessageBox contains the options Yes, No, Cancel.
Type
Options for the MessageBox functions.
Definition: message_box.hpp:19
DefaultButton
Default selected button for the MessageBox functions.
Definition: message_box.hpp:50
The MessageBox contains the options Cancel, Try Again, Continue.
Icon
Popup icon for the MessageBox functions.
Definition: message_box.hpp:36
The MessageBox contains the options Retry, Cancel.
Result
Result of the MessageBox functions.
Definition: message_box.hpp:61
Contains all declarations of the Mountain Framework.
Definition: audio.hpp:22