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