The Battle for Wesnoth  1.19.0-dev
transient_message.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009 - 2024
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  */
62 void show_transient_message(const std::string& title,
63  const std::string& message,
64  const std::string& image = std::string(),
65  const bool message_use_markup = false,
66  const bool title_use_markup = false);
67 
68 /**
69  * Shows a transient error message to the user.
70  *
71  * This shows a dialog with a short message which can be dismissed with a
72  * single click.
73  *
74  * @param message The message to show in the dialog.
75  * @param image An image to show in the dialog.
76  * @param message_use_markup Use markup for the message?
77  */
78 void show_transient_error_message(const std::string& message,
79  const std::string& image = std::string(),
80  const bool message_use_markup = false);
81 
82 } // namespace gui2
Main class to show messages to the user.
Definition: message.hpp:36
Abstract base class for all modal dialogs.
Shows a transient message.
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.
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
#define DEFINE_SIMPLE_DISPLAY_WRAPPER(dialog)
Adds a bare-bones static display function to a dialog class that immediately invokes the dialogs's mo...
Various uncategorised dialogs.
Generic file dialog.
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.
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)
Shows a transient message to the user.
Functions to load and save images from/to disk.