-
-
Notifications
You must be signed in to change notification settings - Fork 988
/
transient_message.hpp
84 lines (72 loc) · 2.62 KB
/
transient_message.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
Copyright (C) 2009 - 2017 by Mark de Wever <koraq@xs4all.nl>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
#pragma once
#include "gui/dialogs/modal_dialog.hpp"
namespace gui2
{
namespace dialogs
{
/** Shows a transient message. */
class transient_message : public modal_dialog
{
public:
transient_message(const std::string& title,
const bool title_use_markup,
const std::string& message,
const bool message_use_markup,
const std::string& image);
private:
bool hide_title_;
bool hide_image_;
/** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
virtual const std::string& window_id() const override;
/** Inherited from modal_dialog. */
virtual void pre_show(window& window) override;
};
} // namespace dialogs
/**
* Shows a transient message to the user.
*
* This shows a dialog with a short message which can be dismissed with a
* single click.
*
* @note The message _should_ be small enough to fit on the window, the text
* can contain newlines and will wrap when needed.
*
* @param title The title of the dialog.
* @param message The message to show in the dialog.
* @param image An image to show in the dialog.
* @param message_use_markup Use markup for the message?
* @param title_use_markup Use markup for the title?
* @param restore_background Restore the background to the state it was before
* the message appeared
*/
void show_transient_message(const std::string& title,
const std::string& message,
const std::string& image = std::string(),
const bool message_use_markup = false,
const bool title_use_markup = false,
const bool restore_background = false);
/**
* Shows a transient error message to the user.
*
* This shows a dialog with a short message which can be dismissed with a
* single click.
*
* @param message The message to show in the dialog.
* @param image An image to show in the dialog.
* @param message_use_markup Use markup for the message?
*/
void show_transient_error_message(const std::string& message,
const std::string& image = std::string(),
const bool message_use_markup = false);
} // namespace gui2