1 #ifndef MESSAGE_BOX_HPP__
2 #define MESSAGE_BOX_HPP__
3 
4 #include <QMessageBox>
5 
6 // get rid of the nasty MS define
7 #ifdef MessageBox
8 #undef MessageBox
9 #endif
10 
11 //
12 // MessageBox - wrap the Qt QMessageBox class to give a more platform
13 // 							neutral and functional interface
14 //
15 class MessageBox
16   : public QMessageBox
17 {
18 public:
19   explicit MessageBox (QWidget * parent = nullptr);
20   explicit MessageBox (Icon, QString const& text, StandardButtons = NoButton
21                        , QWidget * parent = nullptr
22                        , Qt::WindowFlags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
23 
24   static void about_message (QWidget * parent, QString const& text);
25   static void about_Qt_message (QWidget * parent);
26   static StandardButton information_message (QWidget * parent, QString const& text
27                                              , QString const& informative = QString {}
28                                              , QString const& detail = QString {}
29                                              , StandardButtons buttons = Ok
30                                              , StandardButton default_button = NoButton);
31   static StandardButton query_message (QWidget * parent, QString const& text
32                                        , QString const& informative = QString {}
33                                        , QString const& detail = QString {}
34                                        , StandardButtons buttons = Yes | No
35                                        , StandardButton default_button = NoButton);
36   static StandardButton warning_message (QWidget * parent, QString const& text
37                                          , QString const& informative = QString {}
38                                          , QString const& detail = QString {}
39                                          , StandardButtons buttons = Ok
40                                          , StandardButton default_button = NoButton);
41   static StandardButton critical_message (QWidget * parent, QString const& text
42                                           , QString const& informative = QString {}
43                                           , QString const& detail = QString {}
44                                           , StandardButtons buttons = Ok
45                                           , StandardButton default_button = NoButton);
46 private:
47   // hide the parent static functions so that users use our versions
48   // above that are correctly branded and have better platform
49   // independence
50   using QMessageBox::about;
51   using QMessageBox::aboutQt;
52   using QMessageBox::information;
53   using QMessageBox::question;
54   using QMessageBox::warning;
55   using QMessageBox::critical;
56 };
57 
58 #endif
59