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
const
Common::U32String
&defaultButton =
Common::U32String
(
"OK"
),
48
const
Common::U32String
&altButton =
Common::U32String
(),
49
Graphics::TextAlign
alignment =
Graphics::kTextAlignCenter
,
50
const
char
*url =
nullptr
,
51
const
Common::U32String
&extraMessage =
Common::U32String
());
52
MessageDialog
(
const
Common::String
&message,
53
const
Common::String
&defaultButton =
"OK"
,
54
const
Common::String
&altButton =
Common::String
(),
55
Graphics::TextAlign
alignment =
Graphics::kTextAlignCenter
,
56
const
char
*url =
nullptr
);
57
MessageDialog
(
const
Common::U32String
&message,
58
const
Common::U32String
&defaultButton,
59
const
Common::U32StringArray
&altButtons,
60
Graphics::TextAlign
alignment =
Graphics::kTextAlignCenter
);
61
62
void
handleCommand(
CommandSender
*sender, uint32 cmd, uint32 data)
override
;
63
void
reflowLayout()
override
;
64
65
private
:
66
const
char
*_url;
67
void
init(
const
Common::U32String
&message,
68
const
Common::U32String
&defaultButton,
69
const
Common::U32StringArray
&altButtons,
70
Graphics::TextAlign
alignment,
71
const
char
*url,
72
const
Common::U32String
&extraMessage);
73
74
protected
:
75
Common::U32String
_message;
76
Graphics::TextAlign
_alignment;
77
Common::Array<StaticTextWidget *>
_lines;
78
Common::Array<ButtonWidget *>
_buttons;
79
StaticTextWidget
*_extraMessage;
80
};
81
85
class
TimedMessageDialog
:
public
MessageDialog
{
86
public
:
87
TimedMessageDialog
(
const
Common::U32String
&message, uint32 duration);
88
89
void
handleTickle()
override
;
90
91
protected
:
92
uint32 _timer;
93
};
94
98
class
CountdownMessageDialog
:
public
MessageDialog
{
99
public
:
100
CountdownMessageDialog
(
const
Common::U32String
&message,
101
uint32 duration,
102
const
Common::U32String
&defaultButton =
Common::U32String
(
"OK"
),
103
const
Common::U32String
&altButton =
Common::U32String
(),
104
Graphics::TextAlign
alignment =
Graphics::kTextAlignCenter
,
105
const
Common::U32String
&countdownMessage =
Common::U32String
(
""
));
106
107
void
handleTickle()
override
;
108
109
protected
:
110
void
updateCountdown();
111
112
uint32 _timer;
113
uint32 _startTime;
114
Common::U32String
_countdownMessage;
115
};
116
120
class
MessageDialogWithURL
:
public
MessageDialog
{
121
public
:
122
MessageDialogWithURL
(
const
Common::U32String
&message,
const
char
*url,
const
Common::U32String
&defaultButton =
Common::U32String
(
"OK"
),
Graphics::TextAlign
alignment =
Graphics::kTextAlignCenter
);
123
MessageDialogWithURL
(
const
Common::String
&message,
const
char
*url,
const
char
*defaultButton =
"OK"
,
Graphics::TextAlign
alignment =
Graphics::kTextAlignCenter
);
124
};
125
126
127
128
}
// End of namespace GUI
129
130
#endif
GUI::CountdownMessageDialog
Definition:
message.h:98
Graphics::kTextAlignCenter
Center the text.
Definition:
font.h:52
GUI::MessageDialogWithURL
Definition:
message.h:120
Common::String
Definition:
str.h:59
Graphics::TextAlign
TextAlign
Definition:
font.h:48
GUI::MessageDialog
Definition:
message.h:44
Common::Array
Definition:
array.h:52
GUI::StaticTextWidget
Definition:
widget.h:205
GUI
Definition:
system.h:46
Common::U32String
Definition:
ustr.h:57
GUI::Dialog
Definition:
dialog.h:49
GUI::TimedMessageDialog
Definition:
message.h:85
GUI::CommandSender
Definition:
object.h:40
gui
message.h
Generated on Mon Dec 23 2024 09:10:05 for ScummVM API documentation by
1.8.13