The Battle for Wesnoth  1.17.0-dev
transient_message.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009 - 2021
3  by Mark de Wever <koraq@xs4all.nl>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
19 
20 namespace gui2
21 {
22 namespace dialogs
23 {
24 
25 /** Shows a transient message. */
27 {
28 public:
29  transient_message(const std::string& title,
30  const bool title_use_markup,
31  const std::string& message,
32  const bool message_use_markup,
33  const std::string& image);
34 
36 
37 private:
40 
41  virtual const std::string& window_id() const override;
42 
43  virtual void pre_show(window& window) override;
44 };
45 } // namespace dialogs
46 
47 /**
48  * Shows a transient message to the user.
49  *
50  * This shows a dialog with a short message which can be dismissed with a
51  * single click.
52  *
53  * @note The message _should_ be small enough to fit on the window, the text
54  * can contain newlines and will wrap when needed.
55  *
56  * @param title The title of the dialog.
57  * @param message The message to show in the dialog.
58  * @param image An image to show in the dialog.
59  * @param message_use_markup Use markup for the message?
60  * @param title_use_markup Use markup for the title?
61  * @param restore_background Restore the background to the state it was before
62  * the message appeared
63  */
64 void show_transient_message(const std::string& title,
65  const std::string& message,
66  const std::string& image = std::string(),
67  const bool message_use_markup = false,
68  const bool title_use_markup = false,
69  const bool restore_background = false);
70 
71 /**
72  * Shows a transient error message to the user.
73  *
74  * This shows a dialog with a short message which can be dismissed with a
75  * single click.
76  *
77  * @param message The message to show in the dialog.
78  * @param image An image to show in the dialog.
79  * @param message_use_markup Use markup for the message?
80  */
81 void show_transient_error_message(const std::string& message,
82  const std::string& image = std::string(),
83  const bool message_use_markup = false);
84 
85 } // namespace gui2
Main class to show messages to the user.
Definition: message.hpp:35
void show_transient_message(const std::string &title, const std::string &message, const std::string &image, const bool message_use_markup, const bool title_use_markup, const bool restore_background)
Shows a transient message to the user.
Generic file dialog.
Definition: field-fwd.hpp:23
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
virtual const std::string & window_id() const override
The id of the window to build.
Various uncategorised dialogs.
Shows a transient message.
void show_transient_error_message(const std::string &message, const std::string &image, const bool message_use_markup)
Shows a transient error message to the user.
Abstract base class for all modal dialogs.
Functions to load and save images from/to disk.
transient_message(const std::string &title, const bool title_use_markup, const std::string &message, const bool message_use_markup, const std::string &image)
base class of top level items, the only item which needs to store the final canvases to draw on...
Definition: window.hpp:65