| 1 | #ifndef FG_GUI_MESSAGE_BOX_HXX |
| 2 | #define FG_GUI_MESSAGE_BOX_HXX |
| 3 | |
| 4 | #include <string> |
| 5 | #include <cstdlib> |
| 6 | |
| 7 | namespace flightgear |
| 8 | { |
| 9 | |
| 10 | // set a global value indicating we're in headless mode. |
| 11 | void setHeadlessMode(bool headless); |
| 12 | bool isHeadlessMode(); |
| 13 | |
| 14 | // special exception class used to signal an exit. Must not inherit |
| 15 | // std::exception or similar, since we want to handle it specially |
| 16 | class FatalErrorException |
| 17 | { |
| 18 | }; |
| 19 | |
| 20 | enum MessageBoxResult |
| 21 | { |
| 22 | MSG_BOX_OK, |
| 23 | MSG_BOX_YES, |
| 24 | MSG_BOX_NO |
| 25 | }; |
| 26 | |
| 27 | MessageBoxResult modalMessageBox(const std::string& caption, |
| 28 | const std::string& msg, |
| 29 | const std::string& moreText = std::string()); |
| 30 | |
| 31 | MessageBoxResult fatalMessageBoxWithoutExit( |
| 32 | const std::string& caption, |
| 33 | const std::string& msg, |
| 34 | const std::string& moreText = std::string(), |
| 35 | bool reportToSentry = true); |
| 36 | |
| 37 | [[noreturn]] void fatalMessageBoxThenExit( |
| 38 | const std::string& caption, |
| 39 | const std::string& msg, |
| 40 | const std::string& moreText = std::string(), |
| 41 | int exitStatus = EXIT_FAILURE, |
| 42 | bool reportToSentry = true); |
| 43 | |
| 44 | |
| 45 | } // of namespace flightgear |
| 46 | |
| 47 | #endif // of FG_GUI_MESSAGE_BOX_HXX |