xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
message_dialog.h
Go to the documentation of this file.
1
4#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"
14#include "message_dialog_icon.h"
16
18struct __xtd_forms_message_dialog_closed_caller__;
20
22namespace xtd {
24 namespace forms {
34 class forms_export_ message_dialog final : public component {
35 public:
37 message_dialog() = default;
38
46 if (buttons_ != buttons)
47 buttons_ = buttons;
48 return *this;
49 }
50
58 if (default_button_ != default_button)
59 default_button_ = default_button;
60 return *this;
61 }
62
65 bool display_help_button() const {return display_help_button_;}
69 message_dialog& display_help_button(bool display_help_button) {
70 if (display_help_button_ != display_help_button)
71 display_help_button_ = display_help_button;
72 return *this;
73 }
74
77 xtd::forms::dialog_result dialog_result() const {return dialog_result_;}
78
81 xtd::forms::dialog_style dialog_style() const {return dialog_style_;}
86 if (dialog_style_ != dialog_style)
87 dialog_style_ = dialog_style;
88 return *this;
89 }
90
93 xtd::forms::message_dialog_icon icon() const {return icon_;}
98 if (icon_ != icon)
99 icon_ = icon;
100 return *this;
101 }
102
110 if (options_ != options)
111 options_ = options;
112 return *this;
113 }
114
117 xtd::ustring message() const {return message_;}
122 if (message_ != message)
123 message_ = message;
124 return *this;
125 }
126
129 xtd::ustring text() const {return text_;}
134 if (text_ != text)
135 text_ = text;
136 return *this;
137 }
138
140 void reset();
141
147 void show_sheet(const iwin32_window& owner);
150
154
158
159 private:
161 friend struct ::__xtd_forms_message_dialog_closed_caller__;
163
167 virtual void on_dialog_closed(const dialog_closed_event_args& e) {
168 dialog_result_ = e.dialog_result();
169 dialog_closed(*this, e);
170 }
171
176 bool display_help_button_ = false;
179 xtd::ustring message_;
180 xtd::ustring text_;
181 };
182 }
183}
Represents an event.
Definition: event.h:21
Provides a collection of button objects for use by a Windows Forms application.
Definition: buttons.h:21
Provides the base implementation and enables object sharing between applications.
Definition: component.h:21
Provides data for a dialog closed event.
Definition: dialog_closed_event_args.h:17
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_dialog.h:34
xtd::forms::message_dialog_default_button default_button() const
Gets default button for the message dialog.
Definition: message_dialog.h:53
message_dialog & default_button(xtd::forms::message_dialog_default_button default_button)
Sets default button for the message dialog.
Definition: message_dialog.h:57
xtd::forms::message_dialog_buttons buttons() const
Gets buttons to display in the message dialog.
Definition: message_dialog.h:41
xtd::forms::dialog_result show_dialog(const iwin32_window &owner)
Runs message dialog box.
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_style dialog_style() const
Gets the dialog style.
Definition: message_dialog.h:81
xtd::forms::dialog_result show_dialog()
Runs message dialog box.
message_dialog & options(xtd::forms::message_dialog_options options)
Sets options will be used for the message box.
Definition: message_dialog.h:109
message_dialog & dialog_style(xtd::forms::dialog_style dialog_style)
Sets the dialog style.
Definition: message_dialog.h:85
void reset()
Resets all properties to empty string.
message_dialog & buttons(xtd::forms::message_dialog_buttons buttons)
Sets buttons to display in the message dialog.
Definition: message_dialog.h:45
xtd::forms::dialog_result dialog_result() const
Get async dialog_result result after dialog box is closing.
Definition: message_dialog.h:77
xtd::ustring text() const
Gets the dialog caption text.
Definition: message_dialog.h:129
void show_sheet(const iwin32_window &owner)
Runs message dialog box.
xtd::ustring message() const
Gets the text message.
Definition: message_dialog.h:117
message_dialog & display_help_button(bool display_help_button)
Sets a value indicate if help button is shown.
Definition: message_dialog.h:69
message_dialog & message(const xtd::ustring &message)
Sets the text message.
Definition: message_dialog.h:121
message_dialog & text(const xtd::ustring &text)
Sets the dialog caption text.
Definition: message_dialog.h:133
xtd::forms::dialog_result show_sheet_dialog(const iwin32_window &owner)
Runs message dialog box.
message_dialog & icon(xtd::forms::message_dialog_icon icon)
Sets icon to display in the message dialog.
Definition: message_dialog.h:97
bool display_help_button() const
Gets a value indicate if help button is shown.
Definition: message_dialog.h:65
message_dialog()=default
Initializes a new instance of the message_dialog class.
Implements a Windows message.
Definition: message.h:25
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
Contains xtd::forms::component class.
Contains xtd::forms::dialog_closed_event_handler dialog.
Contains xtd::forms::dialog_result enum class.
Contains xtd::forms::dialog_style 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:157
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:153
#define forms_export_
Define shared library export.
Definition: forms_export.h:13
@ e
The E 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
dialog_style
Specifies the style of a dialog.
Definition: dialog_style.h:17
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.
@ none
Nothing is returned from the dialog box. This means that the modal dialog continues running.
@ button1
The first button on the message box is the default button.
@ system
System style dialog.
@ ok
The message box contains an OK button.
Contains xtd::forms::help_event_handler event handler.
Contains xtd::forms::iwin32_window interface.
Contains xtd::forms::message_dialog_buttons enum class.
Contains xtd::forms::message_dialog_default_button enum class.
Contains xtd::forms::message_dialog_icon enum class.
Contains xtd::forms::message_dialog_options enum class.
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