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.
exception_box.h
Go to the documentation of this file.
1 #pragma once
5 #include "exception_dialog.h"
6 #include "iwin32_window.h"
7 #include <xtd/static.h>
8 
10 namespace xtd {
12  namespace forms {
14  class control;
16 
26  class exception_box final static_ {
27  public:
30  static dialog_result show(const iwin32_window& owner) {return show_exception_box(&owner);}
34  static dialog_result show(const iwin32_window& owner, const xtd::ustring& caption) {return show_exception_box(&owner, nullptr, caption);}
38  static dialog_result show(const iwin32_window& owner, const std::exception& exception) {return show_exception_box(&owner, &exception);}
43  static dialog_result show(const iwin32_window& owner, const std::exception& exception, const xtd::ustring& caption) {return show_exception_box(&owner, &exception, caption);}
44 
46  static dialog_result show() {return show_exception_box(nullptr);}
49  static dialog_result show(const xtd::ustring& caption) {return show_exception_box(nullptr, nullptr, caption);}
52  static dialog_result show(const std::exception& exception) {return show_exception_box(nullptr, &exception);}
56  static dialog_result show(const std::exception& exception, const xtd::ustring& caption) {return show_exception_box(nullptr, &exception, caption);}
57 
58  private:
59  static dialog_result show_exception_box(const iwin32_window* owner, const std::exception* exception = nullptr, const xtd::ustring& caption = "") {
60  exception_dialog dialog;
61  if (exception) dialog.exception(*exception);
62  dialog.text(caption);
63  return owner ? dialog.show_sheet_dialog(*owner) : dialog.show_dialog();
64  }
65  };
66  }
67 }
Contains xtd::static_object class.
static dialog_result show(const iwin32_window &owner, const xtd::ustring &caption)
Displays a exception box in front of the specified window. The exception box displays a specified cap...
Definition: exception_box.h:34
dialog_result
Specifies identifiers to indicate the return value of a dialog box.
Definition: dialog_result.h:39
xtd::forms::dialog_result show_dialog()
Runs exception dialog box.
#define static_
This keyword is use to represent a static object. A static object can&#39;t be instantiated (constructors...
Definition: static.h:38
static dialog_result show(const iwin32_window &owner)
Displays a exception box in front of the specified window. The exception box displays an unknown exce...
Definition: exception_box.h:30
static dialog_result show(const xtd::ustring &caption)
Displays a exception box. The exception box displays a specified caption and unknown exception...
Definition: exception_box.h:49
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
static dialog_result show(const iwin32_window &owner, const std::exception &exception, const xtd::ustring &caption)
Displays a exception box in front of the specified window. The exception box displays a specified exc...
Definition: exception_box.h:43
Contains xtd::forms::iwin32_window interface.
static dialog_result show(const std::exception &exception, const xtd::ustring &caption)
Displays a exception box. The exception box displays a specified exception and caption.
Definition: exception_box.h:56
Provides an interface to expose Win32 HWND handles.
Definition: iwin32_window.h:19
static dialog_result show(const std::exception &exception)
Displays a exception box. The exception box displays a specified exception.
Definition: exception_box.h:52
static dialog_result show()
Displays a exception box. The exception box displays an unknown exception.
Definition: exception_box.h:46
xtd::ustring text() const
Gets the dialog caption text.
Definition: exception_dialog.h:64
Represents a common dialog box that displays exception dialog.
Definition: exception_dialog.h:30
xtd::forms::dialog_result show_sheet_dialog(const iwin32_window &owner)
Runs exception dialog box.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
Represents a common dialog box that displays exception box.
Definition: exception_box.h:26
std::reference_wrapper< const std::exception > exception() const
Gets exception reference.
Definition: exception_dialog.h:52
Contains xtd::forms::exception_dialog dialog.
The left or right CTRL modifier key.
static dialog_result show(const iwin32_window &owner, const std::exception &exception)
Displays a exception box in front of the specified window. The exception box displays a specified exc...
Definition: exception_box.h:38