1 #ifndef slic3r_MsgDialog_hpp_ 2 #define slic3r_MsgDialog_hpp_ 3 4 #include <string> 5 #include <unordered_map> 6 7 #include <wx/dialog.h> 8 #include <wx/font.h> 9 #include <wx/bitmap.h> 10 11 class wxBoxSizer; 12 class wxCheckBox; 13 class wxStaticBitmap; 14 15 namespace Slic3r { 16 17 namespace GUI { 18 19 20 // A message / query dialog with a bitmap on the left and any content on the right 21 // with buttons underneath. 22 struct MsgDialog : wxDialog 23 { 24 MsgDialog(MsgDialog &&) = delete; 25 MsgDialog(const MsgDialog &) = delete; 26 MsgDialog &operator=(MsgDialog &&) = delete; 27 MsgDialog &operator=(const MsgDialog &) = delete; 28 virtual ~MsgDialog() = default; 29 30 // TODO: refactor with CreateStdDialogButtonSizer usage 31 32 protected: 33 enum { 34 CONTENT_WIDTH = 50, 35 CONTENT_MAX_HEIGHT = 60, 36 BORDER = 30, 37 VERT_SPACING = 15, 38 HORIZ_SPACING = 5, 39 }; 40 41 // button_id is an id of a button that can be added by default, use wxID_NONE to disable 42 MsgDialog(wxWindow *parent, const wxString &title, const wxString &headline, wxWindowID button_id = wxID_OK, wxBitmap bitmap = wxNullBitmap); 43 44 wxFont boldfont; 45 wxBoxSizer *content_sizer; 46 wxBoxSizer *btn_sizer; 47 wxStaticBitmap *logo; 48 }; 49 50 51 // Generic error dialog, used for displaying exceptions 52 class ErrorDialog : public MsgDialog 53 { 54 public: 55 // If monospaced_font is true, the error message is displayed using html <code><pre></pre></code> tags, 56 // so that the code formatting will be preserved. This is useful for reporting errors from the placeholder parser. 57 ErrorDialog(wxWindow *parent, const wxString &msg, bool courier_font); 58 ErrorDialog(ErrorDialog &&) = delete; 59 ErrorDialog(const ErrorDialog &) = delete; 60 ErrorDialog &operator=(ErrorDialog &&) = delete; 61 ErrorDialog &operator=(const ErrorDialog &) = delete; 62 virtual ~ErrorDialog() = default; 63 64 private: 65 wxString msg; 66 }; 67 68 69 // Generic info dialog, used for displaying exceptions 70 class InfoDialog : public MsgDialog 71 { 72 public: 73 InfoDialog(wxWindow *parent, const wxString &title, const wxString &msg); 74 InfoDialog(InfoDialog&&) = delete; 75 InfoDialog(const InfoDialog&) = delete; 76 InfoDialog&operator=(InfoDialog&&) = delete; 77 InfoDialog&operator=(const InfoDialog&) = delete; 78 virtual ~InfoDialog() = default; 79 80 private: 81 wxString msg; 82 }; 83 84 85 } 86 } 87 88 #endif 89