xtd.forms - Reference Guide  0.1.0
Modern c++17 library containing classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows, Apple macOS and Linux like Ubuntu operating system.
message_box.h
1 #pragma once
2 #include "message_dialog.h"
3 #include "iwin32_window.h"
4 #include "message_box_buttons.h"
5 #include "message_box_default_button.h"
6 #include "message_box_icon.h"
7 #include "message_box_options.h"
8 #include <xtd/static.h>
9 
11 namespace xtd {
13  namespace forms {
15  class control;
17 
18  class message_box static_ {
19  public:
20  static dialog_result show(const iwin32_window& owner) {return show_message_dialog(&owner);}
21  static dialog_result show(const iwin32_window& owner, const std::string& text) {return show_message_dialog(&owner, text);}
22  static dialog_result show(const iwin32_window& owner, const std::string& text, const std::string& caption) {return show_message_dialog(&owner, text, caption);}
23  static dialog_result show(const iwin32_window& owner, const std::string& text, const std::string& caption, message_box_buttons buttons) {return show_message_dialog(&owner, text, caption, buttons);}
24  static dialog_result show(const iwin32_window& owner, const std::string& text, const std::string& caption, message_box_buttons buttons, message_box_icon icon) {return show_message_dialog(&owner, text, caption, buttons, icon);}
25  static dialog_result show(const iwin32_window& owner, const std::string& text, const std::string& 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);}
26  static dialog_result show(const iwin32_window& owner, const std::string& text, const std::string& 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);}
27  static dialog_result show(const iwin32_window& owner, const std::string& text, const std::string& 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);}
28 
29  static dialog_result show() {return show_message_dialog(nullptr);}
30  static dialog_result show(const std::string& text) {return show_message_dialog(nullptr, text);}
31  static dialog_result show(const std::string& text, const std::string& caption) {return show_message_dialog(nullptr, text, caption);}
32  static dialog_result show(const std::string& text, const std::string& caption, message_box_buttons buttons) {return show_message_dialog(nullptr, text, caption, buttons);}
33  static dialog_result show(const std::string& text, const std::string& caption, message_box_buttons buttons, message_box_icon icon) {return show_message_dialog(nullptr, text, caption, buttons, icon);}
34  static dialog_result show(const std::string& text, const std::string& 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);}
35  static dialog_result show(const std::string& text, const std::string& 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);}
36  static dialog_result show(const std::string& text, const std::string& 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);}
37 
38  private:
39  static dialog_result show_message_dialog(const iwin32_window* owner, const std::string& text = "", const std::string& 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) {
40  message_dialog dialog;
41  dialog.buttons(buttons);
42  dialog.default_button(default_button);
43  dialog.display_help_button(display_help_button);
44  dialog.icon(icon);
45  dialog.message(text);
46  dialog.options(options);
47  dialog.text(caption);
48  return owner ? dialog.show_sheet_dialog(*owner) : dialog.show_dialog();
49  }
50  };
51  }
52 }
dialog_result
Specifies identifiers to indicate the return value of a dialog box.
Definition: dialog_result.h:31
Definition: message_box.h:18
xtd::forms::dialog_result show_sheet_dialog(const iwin32_window &owner)
Runs message dialog box.
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
message_dialog_options
Specifies options on a message_box.
Definition: message_dialog_options.h:12
message_dialog & message(const std::string &message)
Sets the text message.
Definition: message_dialog.h:92
message_dialog_icon
Specifies constants defining which information to display.
Definition: message_dialog_icon.h:10
Provides an interface to expose Win32 HWND handles.
Definition: iwin32_window.h:10
message_dialog_buttons
Specifies constants defining which buttons to display on a message_box.
Definition: message_dialog_buttons.h:10
message_dialog_default_button
Specifies constants defining the default button on a message_box.
Definition: message_dialog_default_button.h:10
Represents a common dialog box that displays message box.
Definition: message_dialog.h:39
The message box contain no symbols.
Provides a collection of button objects for use by a Windows Forms application.
Definition: buttons.h:10
std::string text() const
Gets the dialog caption text.
Definition: message_dialog.h:100
The message box contains an OK button.
The first button on the message box is the default button.
xtd::forms::dialog_result show_dialog()
Runs message dialog box.