ScummVM API documentation
message.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef MESSAGE_DIALOG_H
23 #define MESSAGE_DIALOG_H
24 
25 #include "gui/dialog.h"
26 #include "common/str.h"
27 #include "common/str-array.h"
28 
29 namespace GUI {
30 
31 class CommandSender;
32 class StaticTextWidget;
33 class ButtonWidget;
34 
35 enum {
36  kMessageOK = 0,
37  kMessageAlt = 1
38 };
39 
40 
44 class MessageDialog : public Dialog {
45 public:
46  MessageDialog(const Common::U32String &message);
47  MessageDialog(const Common::String &message);
48  MessageDialog(const Common::U32String &message,
49  const Common::U32String &defaultButton,
50  const Common::U32String &altButton = Common::U32String(),
52  const char *url = nullptr,
53  const Common::U32String &extraMessage = Common::U32String());
54  MessageDialog(const Common::String &message,
55  const Common::String &defaultButton,
56  const Common::String &altButton = Common::String(),
58  const char *url = nullptr);
59  MessageDialog(const Common::U32String &message,
60  const Common::U32String &defaultButton,
61  const Common::U32StringArray &altButtons,
63 
64  void handleCommand(CommandSender *sender, uint32 cmd, uint32 data) override;
65  void reflowLayout() override;
66 
67 private:
68  const char *_url;
69  void init(const Common::U32String &message,
70  const Common::U32String &defaultButton,
71  const Common::U32StringArray &altButtons,
72  Graphics::TextAlign alignment,
73  const char *url,
74  const Common::U32String &extraMessage);
75 
76 protected:
77  Common::U32String _message;
78  Graphics::TextAlign _alignment;
81  StaticTextWidget *_extraMessage;
82 };
83 
88 public:
89  TimedMessageDialog(const Common::U32String &message, uint32 duration);
90 
91  void handleTickle() override;
92 
93 protected:
94  uint32 _timer;
95 };
96 
101 public:
103  uint32 duration);
105  uint32 duration,
106  const Common::U32String &defaultButton,
107  const Common::U32String &altButton = Common::U32String(),
109  const Common::U32String &countdownMessage = Common::U32String(""));
110 
111  void handleTickle() override;
112 
113 protected:
114  void updateCountdown();
115 
116  uint32 _timer;
117  uint32 _startTime;
118  Common::U32String _countdownMessage;
119 };
120 
125 public:
126  MessageDialogWithURL(const Common::U32String &message, const char *url);
127  MessageDialogWithURL(const Common::String &message, const char *url);
128  MessageDialogWithURL(const Common::U32String &message, const char *url, const Common::U32String &defaultButton, Graphics::TextAlign alignment = Graphics::kTextAlignCenter);
129  MessageDialogWithURL(const Common::String &message, const char *url, const char *defaultButton, Graphics::TextAlign alignment = Graphics::kTextAlignCenter);
130 };
131 
132 
133 
134 } // End of namespace GUI
135 
136 #endif
Definition: message.h:100
Center the text.
Definition: font.h:52
Definition: message.h:124
Definition: str.h:59
TextAlign
Definition: font.h:48
Definition: message.h:44
Definition: array.h:52
Definition: widget.h:206
Definition: printman.h:30
Definition: ustr.h:57
Definition: dialog.h:49
Definition: message.h:87
Definition: object.h:40