1 | //============================================================================ |
2 | // |
3 | // SSSS tt lll lll |
4 | // SS SS tt ll ll |
5 | // SS tttttt eeee ll ll aaaa |
6 | // SSSS tt ee ee ll ll aa |
7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" |
8 | // SS SS tt ee ll ll aa aa |
9 | // SSSS ttt eeeee llll llll aaaaa |
10 | // |
11 | // Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony |
12 | // and the Stella Team |
13 | // |
14 | // See the file "License.txt" for information on usage and redistribution of |
15 | // this file, and for a DISCLAIMER OF ALL WARRANTIES. |
16 | //============================================================================ |
17 | |
18 | #ifndef MESSAGE_BOX_HXX |
19 | #define MESSAGE_BOX_HXX |
20 | |
21 | class GuiObject; |
22 | class StaticTextWidget; |
23 | |
24 | #include "Dialog.hxx" |
25 | #include "Command.hxx" |
26 | |
27 | namespace GUI { |
28 | |
29 | /** |
30 | * Show a simple message box containing the given text, with buttons |
31 | * prompting the user to accept or reject. If the user selects 'OK', |
32 | * the value of 'cmd' is returned. |
33 | */ |
34 | class MessageBox : public Dialog, public CommandSender |
35 | { |
36 | public: |
37 | MessageBox(GuiObject* boss, const GUI::Font& font, const StringList& text, |
38 | int max_w, int max_h, int cmd = 0, |
39 | const string& okText = "OK" , const string& cancelText = "Cancel" , |
40 | const string& title = "" , |
41 | bool focusOKButton = true); |
42 | MessageBox(GuiObject* boss, const GUI::Font& font, const string& text, |
43 | int max_w, int max_h, int cmd = 0, |
44 | const string& okText = "OK" , const string& cancelText = "Cancel" , |
45 | const string& title = "" , |
46 | bool focusOKButton = true); |
47 | virtual ~MessageBox() = default; |
48 | |
49 | /** Place the input dialog onscreen and center it */ |
50 | void show() { open(); } |
51 | |
52 | private: |
53 | void addText(const GUI::Font& font, const StringList& text); |
54 | void handleCommand(CommandSender* sender, int cmd, int data, int id) override; |
55 | |
56 | private: |
57 | int myCmd; |
58 | |
59 | private: |
60 | // Following constructors and assignment operators not supported |
61 | MessageBox() = delete; |
62 | MessageBox(const MessageBox&) = delete; |
63 | MessageBox(MessageBox&&) = delete; |
64 | MessageBox& operator=(const MessageBox&) = delete; |
65 | MessageBox& operator=(MessageBox&&) = delete; |
66 | }; |
67 | |
68 | } // namespace GUI |
69 | |
70 | #endif |
71 | |