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.
Go to the documentation of this file.
1 #pragma once
5 #include <functional>
6 #include <string>
7 #include <xtd/version.h>
8 #include <xtd/drawing/icon.h>
9 #include <xtd/system_exception.h>
10 #include "component.h"
11 #include "dialog_result.h"
12 #include "dialog_style.h"
14 #include "iwin32_window.h"
18 namespace xtd {
20  namespace forms {
30  class forms_export_ exception_dialog final : public component {
31  public:
33  exception_dialog() = default;
37  xtd::forms::dialog_result dialog_result() const {return dialog_result_;}
41  xtd::forms::dialog_style dialog_style() const {return dialog_style_;}
46  dialog_style_ = dialog_style;
47  return *this;
48  }
52  std::reference_wrapper<const std::exception> exception() const {return std::reference_wrapper<const std::exception>(*exception_);}
57  exception_dialog& exception(const std::exception& exception) {
58  exception_ = &exception;
59  return *this;
60  }
64  xtd::ustring text() const {return text_;}
69  if (text_ != text)
70  text_ = text;
71  return *this;
72  }
75  void reset();
78  xtd::forms::dialog_result show_dialog();
80  xtd::forms::dialog_result show_dialog(const iwin32_window& owner);
83  void show_sheet(const iwin32_window& owner);
85  xtd::forms::dialog_result show_sheet_dialog(const iwin32_window& owner);
91  protected:
96  dialog_result_ = e.dialog_result();
97  dialog_closed(*this, e);
98  }
100  private:
103  const std::exception* exception_ = nullptr;
104  xtd::ustring text_;
105  };
106  }
107 }
Contains xtd::drawing::icon class.
xtd::forms::dialog_style dialog_style() const
Gets the dialog style.
Definition: exception_dialog.h:41
Specifies identifiers to indicate the return value of a dialog box.
Definition: dialog_result.h:39
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.
Contains xtd::forms::arranged_element_collection collection.
exception_dialog & exception(const std::exception &exception)
Sets exception.
Definition: exception_dialog.h:57
Contains xtd::system_exception exception.
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
event< exception_dialog, dialog_closed_event_handler > dialog_closed
Occurs when the user close an exception dialog box with dialog close button or other dialog buttons...
Definition: exception_dialog.h:89
Contains xtd::forms::iwin32_window interface.
Provides an interface to expose Win32 HWND handles.
Definition: iwin32_window.h:19
void on_dialog_closed(const dialog_closed_event_args &e)
Raises the close event.
Definition: exception_dialog.h:95
Represents an event.
Definition: event.h:21
Standard style dialog.
Contains xtd::forms::dialog_result enum class.
exception_dialog & text(const xtd::ustring &text)
Sets the dialog caption text.
Definition: exception_dialog.h:68
Contains xtd::version class.
xtd::forms::dialog_result dialog_result() const
Get async dialog_result result after dialog box is closing.
Definition: exception_dialog.h:37
xtd::ustring text() const
Gets the dialog caption text.
Definition: exception_dialog.h:64
exception_dialog & dialog_style(xtd::forms::dialog_style dialog_style)
Sets the dialog style.
Definition: exception_dialog.h:45
Represents a common dialog box that displays exception dialog.
Definition: exception_dialog.h:30
Provides data for a dialog closed event.
Definition: dialog_closed_event_args.h:17
Contains xtd::forms::dialog_style enum class.
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.
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:27
std::reference_wrapper< const std::exception > exception() const
Gets exception reference.
Definition: exception_dialog.h:52
Provides the base implementation and enables object sharing between applications. ...
Definition: component.h:21