xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
message_box.h
Go to the documentation of this file.
1 #pragma once
5 #include "message_dialog.h"
6 #include "iwin32_window.h"
7 #include "message_box_buttons.h"
9 #include "message_box_icon.h"
10 #include "message_box_options.h"
11 #include <xtd/static.h>
12 
14 namespace xtd {
16  namespace forms {
18  class control;
20 
30  class message_box final static_ {
31  public:
34  static dialog_result show(const iwin32_window& owner) {return show_message_dialog(&owner);}
38  static dialog_result show(const iwin32_window& owner, const xtd::ustring& text) {return show_message_dialog(&owner, text);}
43  static dialog_result show(const iwin32_window& owner, const xtd::ustring& text, const xtd::ustring& caption) {return show_message_dialog(&owner, text, caption);}
49  static dialog_result show(const iwin32_window& owner, const xtd::ustring& text, const xtd::ustring& caption, message_box_buttons buttons) {return show_message_dialog(&owner, text, caption, buttons);}
56  static dialog_result show(const iwin32_window& owner, const xtd::ustring& text, const xtd::ustring& caption, message_box_buttons buttons, message_box_icon icon) {return show_message_dialog(&owner, text, caption, buttons, icon);}
64  static dialog_result show(const iwin32_window& owner, const xtd::ustring& text, const xtd::ustring& caption, message_box_buttons buttons, message_box_icon icon, message_box_default_button default_button) {return show_message_dialog(&owner, text, caption, buttons, icon, default_button);}
73  static dialog_result show(const iwin32_window& owner, const xtd::ustring& text, const xtd::ustring& caption, message_box_buttons buttons, message_box_icon icon, message_box_default_button default_button, message_box_options options) {return show_message_dialog(&owner, text, caption, buttons, icon, default_button, options);}
83  static dialog_result show(const iwin32_window& owner, const xtd::ustring& text, const xtd::ustring& caption, message_box_buttons buttons, message_box_icon icon, message_box_default_button default_button, message_box_options options, bool display_help_button) {return show_message_dialog(&owner, text, caption, buttons, icon, default_button, options, display_help_button);}
84 
86  static dialog_result show() {return show_message_dialog(nullptr);}
89  static dialog_result show(const xtd::ustring& text) {return show_message_dialog(nullptr, text);}
93  static dialog_result show(const xtd::ustring& text, const xtd::ustring& caption) {return show_message_dialog(nullptr, text, caption);}
98  static dialog_result show(const xtd::ustring& text, const xtd::ustring& caption, message_box_buttons buttons) {return show_message_dialog(nullptr, text, caption, buttons);}
104  static dialog_result show(const xtd::ustring& text, const xtd::ustring& caption, message_box_buttons buttons, message_box_icon icon) {return show_message_dialog(nullptr, text, caption, buttons, icon);}
111  static dialog_result show(const xtd::ustring& text, const xtd::ustring& caption, message_box_buttons buttons, message_box_icon icon, message_box_default_button default_button) {return show_message_dialog(nullptr, text, caption, buttons, icon, default_button);}
119  static dialog_result show(const xtd::ustring& text, const xtd::ustring& caption, message_box_buttons buttons, message_box_icon icon, message_box_default_button default_button, message_box_options options) {return show_message_dialog(nullptr, text, caption, buttons, icon, default_button, options);}
128  static dialog_result show(const xtd::ustring& text, const xtd::ustring& caption, message_box_buttons buttons, message_box_icon icon, message_box_default_button default_button, message_box_options options, bool display_help_button) {return show_message_dialog(nullptr, text, caption, buttons, icon, default_button, options, display_help_button);}
129 
130  private:
131  static dialog_result show_message_dialog(const iwin32_window* owner, const xtd::ustring& text = "", const xtd::ustring& caption = "", message_box_buttons buttons = message_box_buttons::ok, message_box_icon icon = message_box_icon::none, message_box_default_button default_button = message_box_default_button::button1, message_box_options options = static_cast<message_box_options>(0), bool display_help_button = false) {
132  message_dialog dialog;
133  dialog.buttons(buttons);
134  dialog.default_button(default_button);
135  dialog.display_help_button(display_help_button);
136  dialog.icon(icon);
137  dialog.message(text);
138  dialog.options(options);
139  dialog.text(caption);
140  return owner ? dialog.show_sheet_dialog(*owner) : dialog.show_dialog();
141  }
142  };
143  }
144 }
Provides a collection of button objects for use by a Windows Forms application.
Definition: buttons.h:21
Provides an interface to expose Win32 HWND handles.
Definition: iwin32_window.h:19
Displays a message window, also known as a dialog box, which presents a message to the user....
Definition: message_box.h:30
static dialog_result show(const iwin32_window &owner)
Displays a message box in front of the specified window.
Definition: message_box.h:34
static dialog_result show(const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons, message_box_icon icon, message_box_default_button default_button, message_box_options options)
Displays a message box with the specified text, caption, buttons, icon, default button,...
Definition: message_box.h:119
static dialog_result show()
Displays a message box.
Definition: message_box.h:86
static dialog_result show(const iwin32_window &owner, const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons, message_box_icon icon)
Displays a message box in front of the specified window with the specified text, caption,...
Definition: message_box.h:56
static dialog_result show(const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons, message_box_icon icon)
Displays a message box with the specified text, caption, buttons, and icon.
Definition: message_box.h:104
static dialog_result show(const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons, message_box_icon icon, message_box_default_button default_button)
Displays a message box with the specified text, caption, buttons, icon, and default button.
Definition: message_box.h:111
static dialog_result show(const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons, message_box_icon icon, message_box_default_button default_button, message_box_options options, bool display_help_button)
Displays a message box with the specified text, caption, buttons, icon, default button,...
Definition: message_box.h:128
static dialog_result show(const xtd::ustring &text, const xtd::ustring &caption)
Displays a message box with specified text and caption.
Definition: message_box.h:93
static dialog_result show(const iwin32_window &owner, const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons, message_box_icon icon, message_box_default_button default_button, message_box_options options, bool display_help_button)
Displays a message box in front of the specified window with the specified text, caption,...
Definition: message_box.h:83
static dialog_result show(const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons)
Displays a message box with the specified text, caption, and buttons.
Definition: message_box.h:98
static dialog_result show(const iwin32_window &owner, const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons, message_box_icon icon, message_box_default_button default_button, message_box_options options)
Displays a message box in front of the specified window with the specified text, caption,...
Definition: message_box.h:73
static dialog_result show(const iwin32_window &owner, const xtd::ustring &text, const xtd::ustring &caption)
Displays a message box in front of the specified window with specified text and caption.
Definition: message_box.h:43
static dialog_result show(const iwin32_window &owner, const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons, message_box_icon icon, message_box_default_button default_button)
Displays a message box in front of the specified window with the specified text, caption,...
Definition: message_box.h:64
static dialog_result show(const xtd::ustring &text)
Displays a message box with specified text.
Definition: message_box.h:89
static dialog_result show(const iwin32_window &owner, const xtd::ustring &text)
Displays a message box in front of the specified window with specified text.
Definition: message_box.h:38
static dialog_result show(const iwin32_window &owner, const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons)
Displays a message box in front of the specified window with the specified text, caption,...
Definition: message_box.h:49
Displays a message window, also known as a dialog box, which presents a message to the user....
Definition: message_dialog.h:34
xtd::forms::message_dialog_default_button default_button() const
Gets default button for the message dialog.
Definition: message_dialog.h:53
xtd::forms::message_dialog_buttons buttons() const
Gets buttons to display in the message dialog.
Definition: message_dialog.h:41
xtd::forms::message_dialog_icon icon() const
Gets icon to display in the message dialog.
Definition: message_dialog.h:93
xtd::forms::message_dialog_options options() const
Gets options will be used for the message box.
Definition: message_dialog.h:105
xtd::forms::dialog_result show_dialog()
Runs message dialog box.
xtd::ustring text() const
Gets the dialog caption text.
Definition: message_dialog.h:129
xtd::ustring message() const
Gets the text message.
Definition: message_dialog.h:117
xtd::forms::dialog_result show_sheet_dialog(const iwin32_window &owner)
Runs message dialog box.
bool display_help_button() const
Gets a value indicate if help button is shown.
Definition: message_dialog.h:65
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition: static.h:38
@ control
The left or right CTRL modifier key.
message_dialog_icon
Specifies constants defining which information to display.
Definition: message_dialog_icon.h:18
dialog_result
Specifies identifiers to indicate the return value of a dialog box.
Definition: dialog_result.h:39
message_dialog_default_button
Specifies constants defining the default button on a message_box.
Definition: message_dialog_default_button.h:18
message_dialog_options
Specifies options on a message_box.
Definition: message_dialog_options.h:20
message_dialog_buttons
Specifies constants defining which buttons to display on a message_box.
Definition: message_dialog_buttons.h:18
@ none
The message box contain no symbols.
@ ok
The message box contains an OK button.
Contains xtd::forms::iwin32_window interface.
Contains xtd::forms::message_box_buttons enum class.
Contains xtd::forms::message_box_default_button enum class.
Contains xtd::forms::message_box_icon enum class.
Contains xtd::forms::message_box_options enum class.
Contains xtd::forms::message_dialog dialog.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::static_object class.