xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
message_dialog.h
Go to the documentation of this file.
1 #pragma once
5 #include <string>
6 #include "component.h"
7 #include "dialog_style.h"
9 #include "dialog_result.h"
10 #include "help_event_handler.h"
11 #include "iwin32_window.h"
12 #include "message_dialog_buttons.h"
14 #include "message_dialog_icon.h"
15 #include "message_dialog_options.h"
16 
18 struct __xtd_forms_message_dialog_closed_caller__;
20 
22 namespace xtd {
24  namespace forms {
34  class forms_export_ message_dialog final : public component {
35  public:
37 
40  message_dialog() = default;
42 
44 
48  xtd::forms::message_dialog_buttons buttons() const {return buttons_;}
53  if (buttons_ != buttons)
54  buttons_ = buttons;
55  return *this;
56  }
57 
65  if (default_button_ != default_button)
66  default_button_ = default_button;
67  return *this;
68  }
69 
72  bool display_help_button() const {return display_help_button_;}
76  message_dialog& display_help_button(bool display_help_button) {
77  if (display_help_button_ != display_help_button)
78  display_help_button_ = display_help_button;
79  return *this;
80  }
81 
84  xtd::forms::dialog_result dialog_result() const {return dialog_result_;}
85 
88  xtd::forms::dialog_style dialog_style() const {return dialog_style_;}
93  if (dialog_style_ != dialog_style)
94  dialog_style_ = dialog_style;
95  return *this;
96  }
97 
100  xtd::forms::message_dialog_icon icon() const {return icon_;}
105  if (icon_ != icon)
106  icon_ = icon;
107  return *this;
108  }
109 
112  xtd::forms::message_dialog_options options() const {return options_;}
117  if (options_ != options)
118  options_ = options;
119  return *this;
120  }
121 
124  xtd::ustring message() const {return message_;}
129  if (message_ != message)
130  message_ = message;
131  return *this;
132  }
133 
136  xtd::ustring text() const {return text_;}
141  if (text_ != text)
142  text_ = text;
143  return *this;
144  }
146 
148 
151  void reset();
152 
154  xtd::forms::dialog_result show_dialog();
156  xtd::forms::dialog_result show_dialog(const iwin32_window& owner);
158  void show_sheet(const iwin32_window& owner);
160  xtd::forms::dialog_result show_sheet_dialog(const iwin32_window& owner);
162 
164 
170 
176 
177  private:
179  friend struct ::__xtd_forms_message_dialog_closed_caller__;
181 
185  virtual void on_dialog_closed(const dialog_closed_event_args& e) {
186  dialog_result_ = e.dialog_result();
187  dialog_closed(*this, e);
188  }
189 
194  bool display_help_button_ = false;
197  xtd::ustring message_;
198  xtd::ustring text_;
199  };
200  }
201 }
message_dialog & dialog_style(xtd::forms::dialog_style dialog_style)
Sets the dialog style.
Definition: message_dialog.h:92
The first button on the message box is the default button.
Contains xtd::forms::message_dialog_buttons enum class.
message_dialog & options(xtd::forms::message_dialog_options options)
Sets options will be used for the message box.
Definition: message_dialog.h:116
message_dialog_default_button
Specifies constants defining the default button on a message_box.
Definition: message_dialog_default_button.h:18
message_dialog & default_button(xtd::forms::message_dialog_default_button default_button)
Sets default button for the message dialog.
Definition: message_dialog.h:64
dialog_result
Specifies identifiers to indicate the return value of a dialog box.
Definition: dialog_result.h:39
dialog_style
Specifies the style of a dialog.
Definition: dialog_style.h:17
Nothing is returned from the dialog box. This means that the modal dialog continues running...
Contains xtd::forms::dialog_closed_event_handler dialog.
message_dialog_icon
Specifies constants defining which information to display.
Definition: message_dialog_icon.h:18
Contains xtd::forms::message_dialog_icon enum class.
xtd::forms::message_dialog_icon icon() const
Gets icon to display in the message dialog.
Definition: message_dialog.h:100
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
message_dialog & display_help_button(bool display_help_button)
Sets a value indicate if help button is shown.
Definition: message_dialog.h:76
message_dialog_options
Specifies options on a message_box.
Definition: message_dialog_options.h:20
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
message_dialog & icon(xtd::forms::message_dialog_icon icon)
Sets icon to display in the message dialog.
Definition: message_dialog.h:104
message_dialog_buttons
Specifies constants defining which buttons to display on a message_box.
Definition: message_dialog_buttons.h:18
xtd::forms::message_dialog_buttons buttons() const
Gets buttons to display in the message dialog.
Definition: message_dialog.h:48
Contains xtd::forms::iwin32_window interface.
event< message_dialog, help_event_handler > help_request
Occurs when the user clicks the Help button on a common dialog box.
Definition: message_dialog.h:169
Provides an interface to expose Win32 HWND handles.
Definition: iwin32_window.h:19
The message box contains an OK button.
xtd::forms::dialog_style dialog_style() const
Gets the dialog style.
Definition: message_dialog.h:88
xtd::ustring text() const
Gets the dialog caption text.
Definition: message_dialog.h:136
Represents an event.
Definition: event.h:21
xtd::forms::message_dialog_options options() const
Gets options will be used for the message box.
Definition: message_dialog.h:112
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:60
message_dialog & buttons(xtd::forms::message_dialog_buttons buttons)
Sets buttons to display in the message dialog.
Definition: message_dialog.h:52
Contains xtd::forms::help_event_handler event handler.
message_dialog & message(const xtd::ustring &message)
Sets the text message.
Definition: message_dialog.h:128
Contains xtd::forms::message_dialog_default_button enum class.
Contains xtd::forms::dialog_result enum class.
Provides a collection of button objects for use by a Windows Forms application.
Definition: buttons.h:21
The message box contain no symbols.
Implements a Windows message.
Definition: message.h:25
Provides data for a dialog closed event.
Definition: dialog_closed_event_args.h:17
message_dialog & text(const xtd::ustring &text)
Sets the dialog caption text.
Definition: message_dialog.h:140
Contains xtd::forms::dialog_style enum class.
bool display_help_button() const
Gets a value indicate if help button is shown.
Definition: message_dialog.h:72
xtd::ustring message() const
Gets the text message.
Definition: message_dialog.h:124
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
Contains xtd::forms::component class.
xtd::forms::dialog_result dialog_result() const
Get async dialog_result result after dialog box is closing.
Definition: message_dialog.h:84
virtual forms::dialog_result dialog_result() const
Get the dialog_result contains the result when closing dialog. One of dialog_result enumerated values...
Definition: dialog_closed_event_args.h:34
Provides the base implementation and enables object sharing between applications. ...
Definition: component.h:21
Contains xtd::forms::message_dialog_options enum class.
event< message_dialog, dialog_closed_event_handler > dialog_closed
Occurs when the user close a message dialog box with dialog close button or other dialog buttons...
Definition: message_dialog.h:174